class Io::Flow::V0::Models::PercentMargin

Rule outcome where shipping surfaced in quote is actual cost plus a predefined margin percentage

Attributes

percentage[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 59529
def initialize(incoming={})
  super(:discriminator => TierRuleOutcome::Types::PERCENT_MARGIN)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:percentage], 'PercentMargin')
  @percentage = HttpClient::Preconditions.assert_class('percentage', opts.delete(:percentage), Numeric)
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 59540
def copy(incoming={})
  PercentMargin.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 59544
def subtype_to_hash
  {
    :percentage => percentage
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 59536
def to_json
  JSON.dump(to_hash)
end