Skip to content

Commit

Permalink
Merge pull request #68 from Shopify/loosen-faraday-version-constraints
Browse files Browse the repository at this point in the history
Upgrade to Faraday 2.x
  • Loading branch information
Ginja authored Jul 12, 2023
2 parents 5ee9589 + 8fd0cce commit 8aaea76
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.6
2.7.2
30 changes: 5 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
oktakit (0.3.3)
faraday (>= 0.17.3, < 2)
faraday (>= 2.0.1, < 3)
sawyer (>= 0.8.1, < 0.10)

GEM
Expand All @@ -13,30 +13,10 @@ GEM
ast (2.4.2)
byebug (11.1.3)
diff-lcs (1.4.4)
faraday (1.10.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
faraday (2.6.0)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
multipart-post (2.2.3)
faraday-net_http (3.0.1)
parallel (1.21.0)
parser (3.0.3.2)
ast (~> 2.4.1)
Expand Down Expand Up @@ -99,4 +79,4 @@ DEPENDENCIES
yard

BUNDLED WITH
2.2.22
2.3.24
2 changes: 1 addition & 1 deletion dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: oktakit

up:
- ruby: 2.6.6
- ruby: 2.7.2
- bundler

commands:
Expand Down
7 changes: 2 additions & 5 deletions lib/oktakit/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@ class Client
include Templates
include Users

# In Faraday 0.9, Faraday::Builder was renamed to Faraday::RackBuilder
RACK_BUILDER_CLASS = defined?(Faraday::RackBuilder) ? Faraday::RackBuilder : Faraday::Builder

# Default Faraday middleware stack
MIDDLEWARE = RACK_BUILDER_CLASS.new do |builder|
MIDDLEWARE = Faraday::RackBuilder.new do |builder|
builder.use(Oktakit::Response::RaiseError)
builder.adapter(Faraday.default_adapter)
builder.adapter(:net_http)
end

def initialize(token: nil, access_token: nil, organization: nil, api_endpoint: nil)
Expand Down
2 changes: 1 addition & 1 deletion lib/oktakit/response/raise_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Oktakit
module Response
# This class raises an Oktakit-flavored exception based
# HTTP status codes returned by the API
class RaiseError < Faraday::Response::Middleware
class RaiseError < Faraday::Middleware
private

def on_complete(response)
Expand Down
2 changes: 1 addition & 1 deletion oktakit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.6'

spec.add_dependency('sawyer', '>= 0.8.1', '< 0.10')
spec.add_dependency('faraday', '>= 0.17.3', '< 2')
spec.add_dependency('faraday', '>= 2.0.1', '< 3')
spec.add_development_dependency('bundler')
end

0 comments on commit 8aaea76

Please sign in to comment.