Class: CheckoutSdk::CheckoutUtils
- Inherits:
-
Object
- Object
- CheckoutSdk::CheckoutUtils
- Defined in:
- lib/checkout_sdk/checkout_utils.rb
Class Method Summary collapse
- .build_default_client ⇒ Faraday::Connection
- .build_multipart_client ⇒ Faraday::Connection
- .map_to_http_metadata(response) ⇒ CheckoutSdk::HttpMetadata
Class Method Details
.build_default_client ⇒ Faraday::Connection
33 34 35 36 37 38 |
# File 'lib/checkout_sdk/checkout_utils.rb', line 33 def self.build_default_client Faraday.new do |f| f.response :follow_redirects f.response :raise_error end end |
.build_multipart_client ⇒ Faraday::Connection
25 26 27 28 29 30 |
# File 'lib/checkout_sdk/checkout_utils.rb', line 25 def self.build_multipart_client Faraday.new do |f| f.request :multipart f.response :raise_error end end |
.map_to_http_metadata(response) ⇒ CheckoutSdk::HttpMetadata
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/checkout_sdk/checkout_utils.rb', line 6 def self.(response) = CheckoutSdk::HttpMetadata.new return if response.nil? if response.is_a?(Hash) .headers = response[:headers] .status_code = response[:status] .body = response[:body] end if response.class.name.start_with? Faraday::Response.name .headers = response.headers .status_code = response.status .body = response.body end end |