Skip to content

Commit

Permalink
chore: update faraday to 2.7.10
Browse files Browse the repository at this point in the history
  • Loading branch information
esarmstrong committed Aug 24, 2023
1 parent 0820427 commit dd1e704
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
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 dd1e704

Please sign in to comment.