Class: Io::Flow::V0::Models::OversizedShipmentRatecardFee
- Inherits:
-
RatecardFee
- Object
- RatecardFee
- Io::Flow::V0::Models::OversizedShipmentRatecardFee
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#margin ⇒ Object
readonly
Returns the value of attribute margin.
-
#weight_threshold ⇒ Object
readonly
Returns the value of attribute weight_threshold.
-
#weight_unit ⇒ Object
readonly
Returns the value of attribute weight_unit.
Attributes inherited from RatecardFee
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OversizedShipmentRatecardFee
constructor
A new instance of OversizedShipmentRatecardFee.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from RatecardFee
Constructor Details
#initialize(incoming = {}) ⇒ OversizedShipmentRatecardFee
Returns a new instance of OversizedShipmentRatecardFee.
55927 55928 55929 55930 55931 55932 55933 55934 55935 |
# 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 |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
55925 55926 55927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55925 def amount @amount end |
#margin ⇒ Object (readonly)
Returns the value of attribute margin.
55925 55926 55927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55925 def margin @margin end |
#weight_threshold ⇒ Object (readonly)
Returns the value of attribute weight_threshold.
55925 55926 55927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55925 def weight_threshold @weight_threshold end |
#weight_unit ⇒ Object (readonly)
Returns the value of attribute weight_unit.
55925 55926 55927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55925 def weight_unit @weight_unit end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
55941 55942 55943 |
# 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 ⇒ Object
55945 55946 55947 55948 55949 55950 55951 55952 |
# 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 ⇒ Object
55937 55938 55939 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55937 def to_json JSON.dump(to_hash) end |