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
38383 38384 38385 38386 38387 38388 38389 38390 38391 38392 38393 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38383 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.
38381 38382 38383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38381 def attributes @attributes end |
#center_key ⇒ Object (readonly)
Returns the value of attribute center_key.
38381 38382 38383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38381 def center_key @center_key end |
#item_currency ⇒ Object (readonly)
Returns the value of attribute item_currency.
38381 38382 38383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38381 def item_currency @item_currency end |
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
38381 38382 38383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38381 def item_number @item_number end |
#item_price ⇒ Object (readonly)
Returns the value of attribute item_price.
38381 38382 38383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38381 def item_price @item_price end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
38381 38382 38383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38381 def number @number end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
38381 38382 38383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38381 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
38399 38400 38401 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38399 def copy(incoming={}) SerialForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
38403 38404 38405 38406 38407 38408 38409 38410 38411 38412 38413 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38403 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
38395 38396 38397 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38395 def to_json JSON.dump(to_hash) end |