Class: Io::Flow::V0::Models::PaymentDuty

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

Returns a new instance of PaymentDuty.



56777
56778
56779
56780
56781
56782
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56777

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:amount], 'PaymentDuty')
  @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
  @name = HttpClient::Preconditions.assert_class('name', (x = opts.delete(:name); x.nil? ? "Duty" : x), String)
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



56775
56776
56777
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56775

def amount
  @amount
end

#nameObject (readonly)

Returns the value of attribute name.



56775
56776
56777
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56775

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



56788
56789
56790
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56788

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

#to_hashObject



56792
56793
56794
56795
56796
56797
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56792

def to_hash
  {
    :amount => amount.to_f.to_s,
    :name => name
  }
end

#to_jsonObject



56784
56785
56786
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56784

def to_json
  JSON.dump(to_hash)
end