Class: SekoEcomAPI::OmniReturnsClient
- Inherits:
-
Object
- Object
- SekoEcomAPI::OmniReturnsClient
- Includes:
- Client
- Defined in:
- lib/seko_ecom_api/clients/omni_returns_client.rb
Constant Summary collapse
- BASE_URL =
'https://www.omniparcelreturns.com/index.php/api/'.freeze
- TEST_BASE_URL =
'https://test.omniparcelreturns.com/index.php/api/'.freeze
Instance Attribute Summary collapse
-
#access_key ⇒ Object
readonly
Returns the value of attribute access_key.
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#conn_opts ⇒ Object
readonly
Returns the value of attribute conn_opts.
-
#test ⇒ Object
readonly
Returns the value of attribute test.
Instance Method Summary collapse
- #connection ⇒ Object
- #create_shipment(params) ⇒ Object
-
#initialize(access_key:, adapter: :http, test: false, conn_opts: {}) ⇒ OmniReturnsClient
constructor
A new instance of OmniReturnsClient.
Methods included from Client
Constructor Details
#initialize(access_key:, adapter: :http, test: false, conn_opts: {}) ⇒ OmniReturnsClient
Returns a new instance of OmniReturnsClient.
15 16 17 18 19 20 |
# File 'lib/seko_ecom_api/clients/omni_returns_client.rb', line 15 def initialize(access_key:, adapter: :http, test: false, conn_opts: {}) @access_key = access_key @adapter = adapter @test = test @conn_opts = conn_opts end |
Instance Attribute Details
#access_key ⇒ Object (readonly)
Returns the value of attribute access_key.
13 14 15 |
# File 'lib/seko_ecom_api/clients/omni_returns_client.rb', line 13 def access_key @access_key end |
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
13 14 15 |
# File 'lib/seko_ecom_api/clients/omni_returns_client.rb', line 13 def adapter @adapter end |
#conn_opts ⇒ Object (readonly)
Returns the value of attribute conn_opts.
13 14 15 |
# File 'lib/seko_ecom_api/clients/omni_returns_client.rb', line 13 def conn_opts @conn_opts end |
#test ⇒ Object (readonly)
Returns the value of attribute test.
13 14 15 |
# File 'lib/seko_ecom_api/clients/omni_returns_client.rb', line 13 def test @test end |
Instance Method Details
#connection ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/seko_ecom_api/clients/omni_returns_client.rb', line 27 def connection @connection ||= Faraday.new do |conn| conn.url_prefix = test ? TEST_BASE_URL : BASE_URL conn.ssl.verify = test ? false : true conn..merge!(conn_opts) conn.headers['Access_Key'] = access_key conn.request :json conn.response :encoding conn.adapter adapter end end |