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.



25027
25028
25029
25030
25031
25032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25027

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.



25025
25026
25027
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25025

def amount
  @amount
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



25038
25039
25040
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25038

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

#subtype_to_hashObject



25042
25043
25044
25045
25046
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25042

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

#to_jsonObject



25034
25035
25036
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25034

def to_json
  JSON.dump(to_hash)
end