Class: Io::Flow::V0::Models::CrossdockRatecardFee

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

Instance Attribute Summary collapse

Attributes inherited from RatecardFee

#discriminator

Instance Method Summary collapse

Methods inherited from RatecardFee

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ CrossdockRatecardFee

Returns a new instance of CrossdockRatecardFee.



27719
27720
27721
27722
27723
27724
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27719

def initialize(incoming={})
  super(:discriminator => RatecardFee::Types::CROSSDOCK_RATECARD_FEE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:amount], 'CrossdockRatecardFee')
  @amount = (x = opts.delete(:amount); x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



27717
27718
27719
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27717

def amount
  @amount
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27730
27731
27732
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27730

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

#subtype_to_hashObject



27734
27735
27736
27737
27738
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27734

def subtype_to_hash
  {
    :amount => amount.to_hash
  }
end

#to_jsonObject



27726
27727
27728
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27726

def to_json
  JSON.dump(to_hash)
end