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.
-
#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.
-
#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.
14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14749 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) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
14747 14748 14749 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14747 def address @address end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14747 14748 14749 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14747 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
14747 14748 14749 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14747 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14747 14748 14749 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14747 def name @name end |
#packaging ⇒ Object (readonly)
Returns the value of attribute packaging.
14747 14748 14749 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14747 def packaging @packaging end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
14747 14748 14749 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14747 def schedule @schedule end |
#services ⇒ Object (readonly)
Returns the value of attribute services.
14747 14748 14749 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14747 def services @services end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone.
14747 14748 14749 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14747 def timezone @timezone end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
14766 14767 14768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14766 def copy(incoming={}) Center.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14770 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 } end |
#to_json ⇒ Object
14762 14763 14764 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14762 def to_json JSON.dump(to_hash) end |