Class: Io::Flow::V0::Models::Center
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Center
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a facility capable of fulfilling a shipment
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#capabilities ⇒ Object
readonly
Returns the value of attribute capabilities.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#packaging ⇒ Object
readonly
Returns the value of attribute packaging.
-
#partner_reference ⇒ Object
readonly
Returns the value of attribute partner_reference.
-
#schedule ⇒ Object
readonly
Returns the value of attribute schedule.
-
#services ⇒ Object
readonly
Returns the value of attribute services.
-
#timezone ⇒ Object
readonly
Returns the value of attribute timezone.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Center
constructor
A new instance of Center.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Center
Returns a new instance of Center.
16381 16382 16383 16384 16385 16386 16387 16388 16389 16390 16391 16392 16393 16394 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16381 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :address, :packaging, :name, :services, :schedule, :timezone], 'Center') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @address = (x = opts.delete(:address); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)) @packaging = HttpClient::Preconditions.assert_class('packaging', opts.delete(:packaging), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Packaging) ? x : ::Io::Flow::V0::Models::Packaging.new(x)) } @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @services = HttpClient::Preconditions.assert_class('services', opts.delete(:services), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AvailableService) ? x : ::Io::Flow::V0::Models::AvailableService.new(x)) } @schedule = (x = opts.delete(:schedule); x.is_a?(::Io::Flow::V0::Models::Schedule) ? x : ::Io::Flow::V0::Models::Schedule.new(x)) @timezone = HttpClient::Preconditions.assert_class('timezone', opts.delete(:timezone), String) @capabilities = (x = opts.delete(:capabilities); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CenterCapabilities) ? x : ::Io::Flow::V0::Models::CenterCapabilities.new(x))) @partner_reference = (x = opts.delete(:partner_reference); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PartnerReference) ? x : ::Io::Flow::V0::Models::PartnerReference.new(x))) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
16379 16380 16381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16379 def address @address end |
#capabilities ⇒ Object (readonly)
Returns the value of attribute capabilities.
16379 16380 16381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16379 def capabilities @capabilities end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
16379 16380 16381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16379 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
16379 16380 16381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16379 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
16379 16380 16381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16379 def name @name end |
#packaging ⇒ Object (readonly)
Returns the value of attribute packaging.
16379 16380 16381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16379 def packaging @packaging end |
#partner_reference ⇒ Object (readonly)
Returns the value of attribute partner_reference.
16379 16380 16381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16379 def partner_reference @partner_reference end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
16379 16380 16381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16379 def schedule @schedule end |
#services ⇒ Object (readonly)
Returns the value of attribute services.
16379 16380 16381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16379 def services @services end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone.
16379 16380 16381 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16379 def timezone @timezone end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
16400 16401 16402 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16400 def copy(incoming={}) Center.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
16404 16405 16406 16407 16408 16409 16410 16411 16412 16413 16414 16415 16416 16417 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16404 def to_hash { :id => id, :key => key, :address => address.to_hash, :packaging => packaging.map { |o| o.to_hash }, :name => name, :services => services.map { |o| o.to_hash }, :schedule => schedule.to_hash, :timezone => timezone, :capabilities => capabilities.nil? ? nil : capabilities.to_hash, :partner_reference => partner_reference.nil? ? nil : partner_reference.to_hash } end |
#to_json ⇒ Object
16396 16397 16398 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16396 def to_json JSON.dump(to_hash) end |