Class: Io::Flow::V0::Models::CenterForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CenterForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#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 = {}) ⇒ CenterForm
constructor
A new instance of CenterForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CenterForm
Returns a new instance of CenterForm.
11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11986 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:address, :packaging, :name, :services, :schedule], 'CenterForm') @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 = (x = opts.delete(:timezone); x.nil? ? nil : HttpClient::Preconditions.assert_class('timezone', x, String)) @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String)) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
11984 11985 11986 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11984 def address @address end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
11984 11985 11986 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11984 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11984 11985 11986 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11984 def name @name end |
#packaging ⇒ Object (readonly)
Returns the value of attribute packaging.
11984 11985 11986 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11984 def packaging @packaging end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
11984 11985 11986 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11984 def schedule @schedule end |
#services ⇒ Object (readonly)
Returns the value of attribute services.
11984 11985 11986 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11984 def services @services end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone.
11984 11985 11986 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11984 def timezone @timezone end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
12002 12003 12004 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12002 def copy(incoming={}) CenterForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12006 def to_hash { :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, :key => key } end |
#to_json ⇒ Object
11998 11999 12000 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11998 def to_json JSON.dump(to_hash) end |