Class: Io::Flow::V0::Models::Serial
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Serial
- 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 ⇒ Object
readonly
Returns the value of attribute center.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#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 = {}) ⇒ Serial
constructor
A new instance of Serial.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Serial
Returns a new instance of Serial.
36970 36971 36972 36973 36974 36975 36976 36977 36978 36979 36980 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36970 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :number, :item_number, :item_price, :status, :center], 'Serial') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @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 = (x = opts.delete(:item_price); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::SerialStatus) ? x : ::Io::Flow::V0::Models::SerialStatus.apply(x)) @center = (x = opts.delete(:center); x.is_a?(::Io::Flow::V0::Models::CenterReference) ? x : ::Io::Flow::V0::Models::CenterReference.new(x)) @attributes = HttpClient::Preconditions.assert_class('attributes', (x = opts.delete(:attributes); x.nil? ? {} : 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.
36968 36969 36970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36968 def attributes @attributes end |
#center ⇒ Object (readonly)
Returns the value of attribute center.
36968 36969 36970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36968 def center @center end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
36968 36969 36970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36968 def id @id end |
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
36968 36969 36970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36968 def item_number @item_number end |
#item_price ⇒ Object (readonly)
Returns the value of attribute item_price.
36968 36969 36970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36968 def item_price @item_price end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
36968 36969 36970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36968 def number @number end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
36968 36969 36970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36968 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
36986 36987 36988 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36986 def copy(incoming={}) Serial.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
36990 36991 36992 36993 36994 36995 36996 36997 36998 36999 37000 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36990 def to_hash { :id => id, :number => number, :item_number => item_number, :item_price => item_price.to_hash, :status => status.value, :center => center.to_hash, :attributes => attributes } end |
#to_json ⇒ Object
36982 36983 36984 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36982 def to_json JSON.dump(to_hash) end |