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.
43581 43582 43583 43584 43585 43586 43587 43588 43589 43590 43591 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43581 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.
43579 43580 43581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43579 def attributes @attributes end |
#center_key ⇒ Object (readonly)
Returns the value of attribute center_key.
43579 43580 43581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43579 def center_key @center_key end |
#item_currency ⇒ Object (readonly)
Returns the value of attribute item_currency.
43579 43580 43581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43579 def item_currency @item_currency end |
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
43579 43580 43581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43579 def item_number @item_number end |
#item_price ⇒ Object (readonly)
Returns the value of attribute item_price.
43579 43580 43581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43579 def item_price @item_price end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
43579 43580 43581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43579 def number @number end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
43579 43580 43581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43579 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
43597 43598 43599 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43597 def copy(incoming={}) SerialForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
43601 43602 43603 43604 43605 43606 43607 43608 43609 43610 43611 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43601 def to_hash { :number => number, :item_number => item_number, :item_price => item_price.to_f.to_s, :item_currency => item_currency, :status => status.value, :center_key => center_key, :attributes => attributes.nil? ? nil : attributes } end |
#to_json ⇒ Object
43593 43594 43595 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43593 def to_json JSON.dump(to_hash) end |