Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Faraday 2.x #65

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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