Class: Io::Flow::V0::Models::ConsumerInvoiceLevy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ConsumerInvoiceLevy

Returns a new instance of ConsumerInvoiceLevy.



33457
33458
33459
33460
33461
33462
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33457

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:rate, :value], 'ConsumerInvoiceLevy')
  @rate = HttpClient::Preconditions.assert_class('rate', HttpClient::Helper.to_big_decimal(opts.delete(:rate)), BigDecimal)
  @value = (x = opts.delete(:value); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
end

Instance Attribute Details

#rateObject (readonly)

Returns the value of attribute rate.



33455
33456
33457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33455

def rate
  @rate
end

#valueObject (readonly)

Returns the value of attribute value.



33455
33456
33457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33455

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



33468
33469
33470
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33468

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

#to_hashObject



33472
33473
33474
33475
33476
33477
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33472

def to_hash
  {
    :rate => rate.to_f.to_s,
    :value => value.to_hash
  }
end

#to_jsonObject



33464
33465
33466
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33464

def to_json
  JSON.dump(to_hash)
end