Class: DhlEcommerce::Client

Inherits:
Object
  • Object
show all
Includes:
Connection, Endpoints, HTTParty
Defined in:
lib/dhl_ecommerce.rb,
lib/dhl_ecommerce/endpoints.rb,
lib/dhl_ecommerce/connection.rb

Defined Under Namespace

Modules: Connection, Endpoints

Instance Method Summary collapse

Methods included from Endpoints

#create_label, #destroy_shipment, #track

Methods included from Connection

#get, #post

Constructor Details

#initialize(client_id: '', password: '', production_env: false) ⇒ Client

Returns a new instance of Client.



14
15
16
17
18
19
20
# File 'lib/dhl_ecommerce.rb', line 14

def initialize(client_id: '', password: '', production_env: false)
  self.class.base_uri (production_env ? PRODUCTION_BASE_URL : SANDBOX_BASE_URL)
  @client_id = client_id
  @password = password
  authenticate!
  self.class.default_options.merge!(headers: { 'content-type': 'application/json' })
end