Class: Io::Flow::V0::Models::ConsumerInvoiceLineDiscount

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 = {}) ⇒ ConsumerInvoiceLineDiscount

Returns a new instance of ConsumerInvoiceLineDiscount.



26799
26800
26801
26802
26803
26804
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26799

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

Instance Attribute Details

#priceObject (readonly)

Returns the value of attribute price.



26797
26798
26799
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26797

def price
  @price
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26810
26811
26812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26810

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

#subtype_to_hashObject



26814
26815
26816
26817
26818
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26814

def subtype_to_hash
  {
    :price => price.to_hash
  }
end

#to_jsonObject



26806
26807
26808
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26806

def to_json
  JSON.dump(to_hash)
end