Skip to content

Commit 4a5bd95

Browse files
committed
set faraday version to 2.7.4
change Faraday authorization methodology more liberal versioning of Faraday no longer need to sanitize token in url remove trailing slash from DEFAULT_URL
1 parent 12db9dd commit 4a5bd95

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

ecwid_api.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
2121
spec.add_development_dependency "rake"
2222
spec.add_development_dependency "rspec"
2323

24-
spec.add_dependency "faraday", "~> 2.7.4"
24+
spec.add_dependency "faraday", ">= 2.7.4"
2525
end

lib/ecwid_api/client.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Client
1313
extend Forwardable
1414

1515
# The default base URL for the Ecwid API
16-
DEFAULT_URL = "https://app.ecwid.com/"
16+
DEFAULT_URL = "https://app.ecwid.com"
1717

1818
# Public: Returns the Ecwid Store ID
1919
attr_reader :store_id
@@ -32,7 +32,7 @@ def initialize(store_id, token, options={})
3232
options[:adapter] ||= Faraday.default_adapter
3333
@store_id, @token, @adapter = store_id, token, options[:adapter]
3434

35-
@connection = Faraday.new(url: store_url(uri_base: options[:uri_base]), params: { token: @token }) do |conn|
35+
@connection = Faraday.new(url: store_url(uri_base: options[:uri_base]), headers: { 'Authorization' => "Bearer #{@token}" }) do |conn|
3636
# conn.request :oauth2, token, param_name: :token, token_type: :param
3737
conn.request :json
3838
conn.response :json

lib/ecwid_api/error.rb

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ def initialize(response)
88

99
def get_response_info(response)
1010
url = response.env.url
11-
url.query = url.query.sub(/token=[^&]*/, 'token=**SECRET**')
1211
message = "url: #{url}, response (#{response.status})\n#{response.body}"
1312
if response.respond_to?(:reason_phrase)
1413
message = "#{response.reason_phrase} #{message}"

0 commit comments

Comments
 (0)