Class: Io::Flow::V0::Models::ConsumerInvoiceItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ConsumerInvoiceItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ConsumerInvoiceItem
constructor
A new instance of ConsumerInvoiceItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ConsumerInvoiceItem
Returns a new instance of ConsumerInvoiceItem.
19149 19150 19151 19152 19153 19154 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19149 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:item, :quantity], 'ConsumerInvoiceItem') @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::ItemReference) ? x : ::Io::Flow::V0::Models::ItemReference.new(x)) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) end |
Instance Attribute Details
#item ⇒ Object (readonly)
Returns the value of attribute item.
19147 19148 19149 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19147 def item @item end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
19147 19148 19149 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19147 def quantity @quantity end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
19160 19161 19162 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19160 def copy(incoming={}) ConsumerInvoiceItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
19164 19165 19166 19167 19168 19169 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19164 def to_hash { :item => item.to_hash, :quantity => quantity } end |
#to_json ⇒ Object
19156 19157 19158 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19156 def to_json JSON.dump(to_hash) end |