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.



20073
20074
20075
20076
20077
20078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20073

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.



20071
20072
20073
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20071

def rate
  @rate
end

#valueObject (readonly)

Returns the value of attribute value.



20071
20072
20073
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20071

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



20084
20085
20086
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20084

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

#to_hashObject



20088
20089
20090
20091
20092
20093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20088

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

#to_jsonObject



20080
20081
20082
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20080

def to_json
  JSON.dump(to_hash)
end