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.



26301
26302
26303
26304
26305
26306
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26301

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.



26299
26300
26301
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26299

def amount
  @amount
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26312
26313
26314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26312

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

#subtype_to_hashObject



26316
26317
26318
26319
26320
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26316

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

#to_jsonObject



26308
26309
26310
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26308

def to_json
  JSON.dump(to_hash)
end