class Io::Flow::V0::Models::AmountMargin
Rule outcome where shipping surfaced in quote is actual cost plus a predefined margin price
Attributes
margin[R]
Public Class Methods
new(incoming={})
click to toggle source
Calls superclass method
Io::Flow::V0::Models::TierRuleOutcome::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 30468 def initialize(incoming={}) super(:discriminator => TierRuleOutcome::Types::AMOUNT_MARGIN) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:margin], 'AmountMargin') @margin = (x = opts.delete(:margin); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 30479 def copy(incoming={}) AmountMargin.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 30483 def subtype_to_hash { :margin => margin.to_hash } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 30475 def to_json JSON.dump(to_hash) end