Class: Io::Flow::V0::Models::OutboundCartonFee

Inherits:
PartnerCenterFee show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from PartnerCenterFee

#discriminator

Instance Method Summary collapse

Methods inherited from PartnerCenterFee

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ OutboundCartonFee

Returns a new instance of OutboundCartonFee.



29949
29950
29951
29952
29953
29954
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29949

def initialize(incoming={})
  super(:discriminator => PartnerCenterFee::Types::OUTBOUND_CARTON_FEE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:amount], 'OutboundCartonFee')
  @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.



29947
29948
29949
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29947

def amount
  @amount
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29960
29961
29962
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29960

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

#subtype_to_hashObject



29964
29965
29966
29967
29968
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29964

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

#to_jsonObject



29956
29957
29958
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29956

def to_json
  JSON.dump(to_hash)
end