Class: SimpleShipping::Abstract::Client
- Inherits:
-
Object
- Object
- SimpleShipping::Abstract::Client
- Defined in:
- lib/simple_shipping/abstract/client.rb
Overview
Abstract class which provides common interfaces for the next concrete clients:
Direct Known Subclasses
Class Method Summary collapse
-
.set_production_address(address) ⇒ Object
Set the production endpoint.
-
.set_required_credentials(*args) ⇒ Object
Set credentials which should be validated.
-
.set_testing_address(address) ⇒ Object
Set the testing endpoint.
-
.set_wsdl_document(wsdl_path) ⇒ Object
Set the WSDL document used by Savon.
Instance Method Summary collapse
-
#initialize(options) ⇒ Client
constructor
Create an instance of a client.
Constructor Details
#initialize(options) ⇒ Client
Create an instance of a client.
Parameters:
* credentials - a hash with credentials.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/simple_shipping/abstract/client.rb', line 38 def initialize() @options = .dup @live = .delete(:live) @debug = .delete(:debug) @debug_path = .delete(:debug_path) credentials = .delete(:credentials) validate_credentials(credentials) @credentials = OpenStruct.new(credentials) @client = Savon.client(()) end |
Class Method Details
.set_production_address(address) ⇒ Object
Set the production endpoint.
24 25 26 |
# File 'lib/simple_shipping/abstract/client.rb', line 24 def self.set_production_address(address) self.production_address = address end |
.set_required_credentials(*args) ⇒ Object
Set credentials which should be validated.
12 13 14 |
# File 'lib/simple_shipping/abstract/client.rb', line 12 def self.set_required_credentials(*args) self.required_credentials = args end |
.set_testing_address(address) ⇒ Object
Set the testing endpoint.
31 32 33 |
# File 'lib/simple_shipping/abstract/client.rb', line 31 def self.set_testing_address(address) self.testing_address = address end |
.set_wsdl_document(wsdl_path) ⇒ Object
Set the WSDL document used by Savon.
17 18 19 |
# File 'lib/simple_shipping/abstract/client.rb', line 17 def self.set_wsdl_document(wsdl_path) self.wsdl_document = wsdl_path end |