Class: Cargowise::Endpoint
- Inherits:
-
Object
- Object
- Cargowise::Endpoint
- Defined in:
- lib/cargowise/endpoint.rb
Overview
Stores the details for connecting to a single logistics company.
Generally created using the register() method on the Order and Shipment classes.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Endpoint
constructor
create a new endpoint.
Constructor Details
#initialize(opts = {}) ⇒ Endpoint
create a new endpoint. All 4 options are compulsory.
17 18 19 20 21 22 23 24 25 |
# File 'lib/cargowise/endpoint.rb', line 17 def initialize(opts = {}) raise ArgumentError, "option :uri must be provided" if opts[:uri].nil? raise ArgumentError, "option :code must be provided" if opts[:code].nil? raise ArgumentError, "option :user must be provided" if opts[:user].nil? raise ArgumentError, "option :password must be provided" if opts[:password].nil? @uri = opts[:uri] @code, @user, @password = opts[:code], opts[:user], opts[:password] end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
13 14 15 |
# File 'lib/cargowise/endpoint.rb', line 13 def code @code end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
13 14 15 |
# File 'lib/cargowise/endpoint.rb', line 13 def password @password end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
12 13 14 |
# File 'lib/cargowise/endpoint.rb', line 12 def uri @uri end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
13 14 15 |
# File 'lib/cargowise/endpoint.rb', line 13 def user @user end |