class Io::Flow::V0::Models::DiscountRuleOffer

Attributes

discount[R]
entitlement[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 40142
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:discount, :entitlement], 'DiscountRuleOffer')
  @discount = (x = opts.delete(:discount); x.is_a?(::Io::Flow::V0::Models::DiscountOffer) ? x : ::Io::Flow::V0::Models::DiscountOffer.from_json(x))
  @entitlement = (x = opts.delete(:entitlement); x.is_a?(::Io::Flow::V0::Models::DiscountRuleEntitlement) ? x : ::Io::Flow::V0::Models::DiscountRuleEntitlement.from_json(x))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 40153
def copy(incoming={})
  DiscountRuleOffer.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 40157
def to_hash
  {
    :discount => discount.to_hash,
    :entitlement => entitlement.to_hash
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 40149
def to_json
  JSON.dump(to_hash)
end