Class: Io::Flow::V0::Models::ConsumerInvoiceLineShippingForm

Inherits:
ConsumerInvoiceLineForm show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from ConsumerInvoiceLineForm

#discriminator

Instance Method Summary collapse

Methods inherited from ConsumerInvoiceLineForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ConsumerInvoiceLineShippingForm

Returns a new instance of ConsumerInvoiceLineShippingForm.



21430
21431
21432
21433
21434
21435
21436
21437
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21430

def initialize(incoming={})
  super(:discriminator => ConsumerInvoiceLineForm::Types::CONSUMER_INVOICE_LINE_SHIPPING_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:price], 'ConsumerInvoiceLineShippingForm')
  @price = HttpClient::Preconditions.assert_class('price', HttpClient::Helper.to_big_decimal(opts.delete(:price)), BigDecimal)
  @tax = (x = opts.delete(:tax); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLevyForm) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLevyForm.new(x)))
  @duty = (x = opts.delete(:duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLevyForm) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLevyForm.new(x)))
end

Instance Attribute Details

#dutyObject (readonly)

Returns the value of attribute duty.



21428
21429
21430
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21428

def duty
  @duty
end

#priceObject (readonly)

Returns the value of attribute price.



21428
21429
21430
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21428

def price
  @price
end

#taxObject (readonly)

Returns the value of attribute tax.



21428
21429
21430
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21428

def tax
  @tax
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



21443
21444
21445
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21443

def copy(incoming={})
  ConsumerInvoiceLineShippingForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



21447
21448
21449
21450
21451
21452
21453
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21447

def subtype_to_hash
  {
    :price => price,
    :tax => tax.nil? ? nil : tax.to_hash,
    :duty => duty.nil? ? nil : duty.to_hash
  }
end

#to_jsonObject



21439
21440
21441
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21439

def to_json
  JSON.dump(to_hash)
end