Class: Io::Flow::V0::Models::SerialForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::SerialForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
A unique identifier assigned to an individual item.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#center_key ⇒ Object
readonly
Returns the value of attribute center_key.
-
#item_currency ⇒ Object
readonly
Returns the value of attribute item_currency.
-
#item_number ⇒ Object
readonly
Returns the value of attribute item_number.
-
#item_price ⇒ Object
readonly
Returns the value of attribute item_price.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ SerialForm
constructor
A new instance of SerialForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ SerialForm
Returns a new instance of SerialForm.
35594 35595 35596 35597 35598 35599 35600 35601 35602 35603 35604 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35594 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:number, :item_number, :item_price, :item_currency, :status], 'SerialForm') @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String) @item_price = HttpClient::Preconditions.assert_class('item_price', HttpClient::Helper.to_big_decimal(opts.delete(:item_price)), BigDecimal) @item_currency = HttpClient::Preconditions.assert_class('item_currency', opts.delete(:item_currency), String) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::SerialStatus) ? x : ::Io::Flow::V0::Models::SerialStatus.apply(x)) @center_key = (x = opts.delete(:center_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('center_key', x, String)) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
35592 35593 35594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35592 def attributes @attributes end |
#center_key ⇒ Object (readonly)
Returns the value of attribute center_key.
35592 35593 35594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35592 def center_key @center_key end |
#item_currency ⇒ Object (readonly)
Returns the value of attribute item_currency.
35592 35593 35594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35592 def item_currency @item_currency end |
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
35592 35593 35594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35592 def item_number @item_number end |
#item_price ⇒ Object (readonly)
Returns the value of attribute item_price.
35592 35593 35594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35592 def item_price @item_price end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
35592 35593 35594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35592 def number @number end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
35592 35593 35594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35592 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
35610 35611 35612 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35610 def copy(incoming={}) SerialForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
35614 35615 35616 35617 35618 35619 35620 35621 35622 35623 35624 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35614 def to_hash { :number => number, :item_number => item_number, :item_price => item_price, :item_currency => item_currency, :status => status.value, :center_key => center_key, :attributes => attributes.nil? ? nil : attributes } end |
#to_json ⇒ Object
35606 35607 35608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35606 def to_json JSON.dump(to_hash) end |