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



21271
21272
21273
21274
21275
21276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21271

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.



21269
21270
21271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21269

def rate
  @rate
end

#valueObject (readonly)

Returns the value of attribute value.



21269
21270
21271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21269

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



21282
21283
21284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21282

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

#to_hashObject



21286
21287
21288
21289
21290
21291
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21286

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

#to_jsonObject



21278
21279
21280
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21278

def to_json
  JSON.dump(to_hash)
end