class Io::Flow::V0::Models::OversizedShipmentRatecardFee

Attributes

amount[R]
margin[R]
weight_threshold[R]
weight_unit[R]

Public Class Methods

new(incoming={}) click to toggle source
Calls superclass method Io::Flow::V0::Models::RatecardFee::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 55927
def initialize(incoming={})
  super(:discriminator => RatecardFee::Types::OVERSIZED_SHIPMENT_RATECARD_FEE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:weight_threshold, :weight_unit], 'OversizedShipmentRatecardFee')
  @weight_threshold = HttpClient::Preconditions.assert_class('weight_threshold', HttpClient::Helper.to_big_decimal(opts.delete(:weight_threshold)), BigDecimal)
  @weight_unit = (x = opts.delete(:weight_unit); x.is_a?(::Io::Flow::V0::Models::UnitOfMeasurement) ? x : ::Io::Flow::V0::Models::UnitOfMeasurement.apply(x))
  @margin = (x = opts.delete(:margin); x.nil? ? nil : HttpClient::Preconditions.assert_class('margin', x, Numeric))
  @amount = (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', x, Numeric))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 55941
def copy(incoming={})
  OversizedShipmentRatecardFee.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 55945
def subtype_to_hash
  {
    :weight_threshold => weight_threshold.to_f.to_s,
    :weight_unit => weight_unit.value,
    :margin => margin,
    :amount => amount
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 55937
def to_json
  JSON.dump(to_hash)
end