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.



27320
27321
27322
27323
27324
27325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27320

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.



27318
27319
27320
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27318

def rate
  @rate
end

#valueObject (readonly)

Returns the value of attribute value.



27318
27319
27320
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27318

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27331
27332
27333
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27331

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

#to_hashObject



27335
27336
27337
27338
27339
27340
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27335

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

#to_jsonObject



27327
27328
27329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27327

def to_json
  JSON.dump(to_hash)
end