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 faraday from v1 to v2 #220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 8 additions & 9 deletions lib/plivo/base_client.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'json'
require 'faraday'
require 'faraday_middleware'

require_relative 'exceptions'
require_relative 'utils'
Expand Down Expand Up @@ -78,7 +77,7 @@ def send_request(resource_path, method = 'GET', data = {}, timeout = nil, use_mu
process_response(method, response.to_hash)
end
end

private

def auth_token
Expand Down Expand Up @@ -137,7 +136,7 @@ def configure_connection
# DANGER: Basic auth should always come after headers, else
# The headers will replace the basic_auth

faraday.request(:basic_auth, auth_id, auth_token)
faraday.request(:authorization, :basic, auth_id, auth_token)

faraday.proxy=@proxy_hash if @proxy_hash
faraday.response :json, content_type: /\bjson$/
Expand All @@ -150,7 +149,7 @@ def configure_connection
# DANGER: Basic auth should always come after headers, else
# The headers will replace the basic_auth

faraday.request(:basic_auth, auth_id, auth_token)
faraday.request(:authorization, :basic, auth_id, auth_token)

faraday.proxy=@proxy_hash if @proxy_hash
faraday.response :json, content_type: /\bjson$/
Expand All @@ -163,7 +162,7 @@ def configure_connection
# DANGER: Basic auth should always come after headers, else
# The headers will replace the basic_auth

faraday.request(:basic_auth, auth_id, auth_token)
faraday.request(:authorization, :basic, auth_id, auth_token)

faraday.proxy=@proxy_hash if @proxy_hash
faraday.response :json, content_type: /\bjson$/
Expand All @@ -176,7 +175,7 @@ def configure_connection
# DANGER: Basic auth should always come after headers, else
# The headers will replace the basic_auth

faraday.request(:basic_auth, auth_id, auth_token)
faraday.request(:authorization, :basic, auth_id, auth_token)

faraday.proxy=@proxy_hash if @proxy_hash
faraday.response :json, content_type: /\bjson$/
Expand All @@ -189,7 +188,7 @@ def configure_connection
# DANGER: Basic auth should always come after headers, else
# The headers will replace the basic_auth

faraday.request(:basic_auth, auth_id, auth_token)
faraday.request(:authorization, :basic, auth_id, auth_token)

faraday.proxy=@proxy_hash if @proxy_hash
faraday.response :json, content_type: /\bjson$/
Expand All @@ -202,7 +201,7 @@ def configure_connection
# DANGER: Basic auth should always come after headers, else
# The headers will replace the basic_auth

faraday.request(:basic_auth, auth_id, auth_token)
faraday.request(:authorization, :basic, auth_id, auth_token)

faraday.proxy=@proxy_hash if @proxy_hash
faraday.response :json, content_type: /\bjson$/
Expand Down Expand Up @@ -255,7 +254,7 @@ def send_post(resource_path, data, timeout, use_multipart_conn, options = nil)

faraday.request :multipart
faraday.request :url_encoded
faraday.request(:basic_auth, auth_id, auth_token)
faraday.request(:authorization, :basic, auth_id, auth_token)

faraday.proxy=@proxy_hash if @proxy_hash
faraday.response :json, content_type: /\bjson$/
Expand Down
7 changes: 3 additions & 4 deletions lib/plivo/resources/call_feedback.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'json'
require 'faraday'
require 'faraday_middleware'

module Plivo
module Resources
Expand All @@ -21,7 +20,7 @@ def initialize(client, resource_list_json = nil)
end

def create(call_uuid, rating, issues = [], notes = "")

valid_param?(:call_uuid, call_uuid, String, true)
valid_param?(:rating, rating, [Integer, Float], true)

Expand All @@ -32,7 +31,7 @@ def create(call_uuid, rating, issues = [], notes = "")
if rating < 1 or rating > 5
raise_invalid_request("Rating has to be a float between 1 - 5")
end

params = {
rating: rating,
}
Expand All @@ -52,4 +51,4 @@ def create(call_uuid, rating, issues = [], notes = "")
end
end
end
end
end
2 changes: 1 addition & 1 deletion lib/plivo/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Plivo
VERSION = "4.45.0".freeze
VERSION = "4.46.0".freeze
end
3 changes: 1 addition & 2 deletions plivo.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = '>= 2.0.0'

spec.add_dependency 'faraday', '~> 1.0'
spec.add_dependency 'faraday_middleware', '~> 1.0'
spec.add_dependency 'faraday', '~> 2.7.8'
spec.add_dependency 'htmlentities'
spec.add_dependency 'jwt'

Expand Down