Class: Io::Flow::V0::Models::ConsumerInvoiceLineShipping

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

Instance Attribute Summary collapse

Attributes inherited from ConsumerInvoiceLine

#discriminator

Instance Method Summary collapse

Methods inherited from ConsumerInvoiceLine

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ConsumerInvoiceLineShipping

Returns a new instance of ConsumerInvoiceLineShipping.



27028
27029
27030
27031
27032
27033
27034
27035
27036
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27028

def initialize(incoming={})
  super(:discriminator => ConsumerInvoiceLine::Types::CONSUMER_INVOICE_LINE_SHIPPING)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:price], 'ConsumerInvoiceLineShipping')
  @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @discount = (x = opts.delete(:discount); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)))
  @tax = (x = opts.delete(:tax); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLevy) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLevy.new(x)))
  @duty = (x = opts.delete(:duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLevy) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLevy.new(x)))
end

Instance Attribute Details

#discountObject (readonly)

Returns the value of attribute discount.



27026
27027
27028
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27026

def discount
  @discount
end

#dutyObject (readonly)

Returns the value of attribute duty.



27026
27027
27028
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27026

def duty
  @duty
end

#priceObject (readonly)

Returns the value of attribute price.



27026
27027
27028
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27026

def price
  @price
end

#taxObject (readonly)

Returns the value of attribute tax.



27026
27027
27028
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27026

def tax
  @tax
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27042
27043
27044
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27042

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

#subtype_to_hashObject



27046
27047
27048
27049
27050
27051
27052
27053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27046

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

#to_jsonObject



27038
27039
27040
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27038

def to_json
  JSON.dump(to_hash)
end