Class: Io::Flow::V0::Models::Center
- Inherits:
-
ExpandableCenter
- Object
- ExpandableCenter
- 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_center ⇒ Object
readonly
Returns the value of attribute partner_center.
-
#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.
Attributes inherited from ExpandableCenter
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Center
constructor
A new instance of Center.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from ExpandableCenter
Constructor Details
#initialize(incoming = {}) ⇒ Center
Returns a new instance of Center.
20873 20874 20875 20876 20877 20878 20879 20880 20881 20882 20883 20884 20885 20886 20887 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20873 def initialize(incoming={}) super(:discriminator => ExpandableCenter::Types::CENTER) 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 : HttpClient::Preconditions.assert_class('capabilities', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::CenterCapability) ? x : ::Io::Flow::V0::Models::CenterCapability.apply(x)) }) @partner_center = (x = opts.delete(:partner_center); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PartnerCenter) ? x : ::Io::Flow::V0::Models::PartnerCenter.new(x))) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
20871 20872 20873 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20871 def address @address end |
#capabilities ⇒ Object (readonly)
Returns the value of attribute capabilities.
20871 20872 20873 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20871 def capabilities @capabilities end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
20871 20872 20873 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20871 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
20871 20872 20873 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20871 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
20871 20872 20873 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20871 def name @name end |
#packaging ⇒ Object (readonly)
Returns the value of attribute packaging.
20871 20872 20873 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20871 def packaging @packaging end |
#partner_center ⇒ Object (readonly)
Returns the value of attribute partner_center.
20871 20872 20873 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20871 def partner_center @partner_center end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
20871 20872 20873 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20871 def schedule @schedule end |
#services ⇒ Object (readonly)
Returns the value of attribute services.
20871 20872 20873 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20871 def services @services end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone.
20871 20872 20873 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20871 def timezone @timezone end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
20893 20894 20895 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20893 def copy(incoming={}) Center.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
20897 20898 20899 20900 20901 20902 20903 20904 20905 20906 20907 20908 20909 20910 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20897 def subtype_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.map { |o| o.value }, :partner_center => partner_center.nil? ? nil : partner_center.to_hash } end |
#to_json ⇒ Object
20889 20890 20891 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20889 def to_json JSON.dump(to_hash) end |