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.
37040 37041 37042 37043 37044 37045 37046 37047 37048 37049 37050 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37040 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.
37038 37039 37040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37038 def attributes @attributes end |
#center_key ⇒ Object (readonly)
Returns the value of attribute center_key.
37038 37039 37040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37038 def center_key @center_key end |
#item_currency ⇒ Object (readonly)
Returns the value of attribute item_currency.
37038 37039 37040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37038 def item_currency @item_currency end |
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
37038 37039 37040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37038 def item_number @item_number end |
#item_price ⇒ Object (readonly)
Returns the value of attribute item_price.
37038 37039 37040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37038 def item_price @item_price end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
37038 37039 37040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37038 def number @number end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
37038 37039 37040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37038 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
37056 37057 37058 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37056 def copy(incoming={}) SerialForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
37060 37061 37062 37063 37064 37065 37066 37067 37068 37069 37070 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37060 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
37052 37053 37054 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37052 def to_json JSON.dump(to_hash) end |