Skip to content

Commit

Permalink
Merge pull request #120 from esarmstrong/chore-update-faraday-to-v2
Browse files Browse the repository at this point in the history
chore: update faraday to 2.7.10
  • Loading branch information
dblock authored Aug 24, 2023
2 parents 0820427 + 33e2e3a commit e01f013
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ jobs:
bundler-cache: true
- run: |
# the personal token is public, this is ok, base64 encode to avoid tripping Github
TOKEN=$(echo -n NWY1ZmM5MzEyMzNlYWY4OTZiOGU3MmI3MWQ3Mzk0MzgxMWE4OGVmYwo= | base64 --decode)
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### 2.0.1 (Next)
* [#120](https://github.com/dblock/iex-ruby-client/pull/120): Upgrade faraday to 2.7.10 - [@esarmstrong](https://github.com/esarmstrong).
* Your contribution here.

### 2.0.0 (2022/07/24)
Expand Down
2 changes: 1 addition & 1 deletion iex-ruby-client.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.licenses = ['MIT']
s.summary = 'IEX Finance API Ruby client with support for retrieving stock quotes.'
s.add_dependency 'faraday', '>= 0.17'
s.add_dependency 'faraday_middleware'
s.add_dependency 'faraday-multipart'
s.add_dependency 'hashie'
s.add_dependency 'money', '~> 6.0'
s.add_development_dependency 'rake', '~> 10'
Expand Down
3 changes: 1 addition & 2 deletions lib/iex-ruby-client.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'faraday'
require 'faraday_middleware'
require 'faraday_middleware/response_middleware'
require 'faraday/multipart'
require 'hashie'
require 'money'
require 'date'
Expand Down
16 changes: 9 additions & 7 deletions lib/iex/cloud/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ def headers

def connection
@connection ||= begin
options = {}
options = {
headers: {
'Accept' => 'application/json; charset=utf-8',
'Content-Type' => 'application/json; charset=utf-8'
}
}

options[:headers] = {}
options[:headers]['Accept'] = 'application/json; charset=utf-8'
options[:headers]['Content-Type'] = 'application/json; charset=utf-8'
options[:headers]['User-Agent'] = user_agent if user_agent
options[:headers]['Referer'] = referer if referer
options[:proxy] = proxy if proxy
Expand All @@ -26,10 +28,10 @@ def connection
options[:request] = request_options if request_options.any?

::Faraday::Connection.new(endpoint, options) do |connection|
connection.use ::Faraday::Request::Multipart
connection.use ::Faraday::Request::UrlEncoded
connection.request :multipart
connection.request :url_encoded
connection.use ::IEX::Cloud::Response::RaiseError
connection.use ::FaradayMiddleware::ParseJson, content_type: /\bjson$/
connection.response :json
connection.response(:logger, logger.instance, logger.options, &logger.proc) if logger.instance
connection.adapter ::Faraday.default_adapter
end
Expand Down

0 comments on commit e01f013

Please sign in to comment.