Class: Io::Flow::V0::Models::PaymentOrderDetailsLineItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentOrderDetailsLineItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#discounts ⇒ Object
readonly
Returns the value of attribute discounts.
-
#duty ⇒ Object
readonly
Returns the value of attribute duty.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image_url ⇒ Object
readonly
Returns the value of attribute image_url.
-
#product_url ⇒ Object
readonly
Returns the value of attribute product_url.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#tax ⇒ Object
readonly
Returns the value of attribute tax.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PaymentOrderDetailsLineItem
constructor
A new instance of PaymentOrderDetailsLineItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentOrderDetailsLineItem
Returns a new instance of PaymentOrderDetailsLineItem.
51420 51421 51422 51423 51424 51425 51426 51427 51428 51429 51430 51431 51432 51433 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51420 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :description, :quantity, :amount], 'PaymentOrderDetailsLineItem') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @description = HttpClient::Preconditions.assert_class('description', opts.delete(:description), String) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @tax = (x = opts.delete(:tax); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PaymentTax) ? x : ::Io::Flow::V0::Models::PaymentTax.new(x))) @duty = (x = opts.delete(:duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PaymentDuty) ? x : ::Io::Flow::V0::Models::PaymentDuty.new(x))) @product_url = (x = opts.delete(:product_url); x.nil? ? nil : HttpClient::Preconditions.assert_class('product_url', x, String)) @image_url = (x = opts.delete(:image_url); x.nil? ? nil : HttpClient::Preconditions.assert_class('image_url', x, String)) @category = (x = opts.delete(:category); x.nil? ? nil : HttpClient::Preconditions.assert_class('category', x, String)) @discounts = (x = opts.delete(:discounts); x.nil? ? nil : HttpClient::Preconditions.assert_class('discounts', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentDiscount) ? x : ::Io::Flow::V0::Models::PaymentDiscount.new(x)) }) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
51418 51419 51420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51418 def amount @amount end |
#category ⇒ Object (readonly)
Returns the value of attribute category.
51418 51419 51420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51418 def category @category end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
51418 51419 51420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51418 def description @description end |
#discounts ⇒ Object (readonly)
Returns the value of attribute discounts.
51418 51419 51420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51418 def discounts @discounts end |
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
51418 51419 51420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51418 def duty @duty end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
51418 51419 51420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51418 def id @id end |
#image_url ⇒ Object (readonly)
Returns the value of attribute image_url.
51418 51419 51420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51418 def image_url @image_url end |
#product_url ⇒ Object (readonly)
Returns the value of attribute product_url.
51418 51419 51420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51418 def product_url @product_url end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
51418 51419 51420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51418 def quantity @quantity end |
#tax ⇒ Object (readonly)
Returns the value of attribute tax.
51418 51419 51420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51418 def tax @tax end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
51439 51440 51441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51439 def copy(incoming={}) PaymentOrderDetailsLineItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
51443 51444 51445 51446 51447 51448 51449 51450 51451 51452 51453 51454 51455 51456 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51443 def to_hash { :id => id, :description => description, :quantity => quantity, :amount => amount.to_f.to_s, :tax => tax.nil? ? nil : tax.to_hash, :duty => duty.nil? ? nil : duty.to_hash, :product_url => product_url, :image_url => image_url, :category => category, :discounts => discounts.nil? ? nil : discounts.map { |o| o.to_hash } } end |
#to_json ⇒ Object
51435 51436 51437 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51435 def to_json JSON.dump(to_hash) end |