Class: Io::Flow::V0::Models::DiscountOfferFixed

Inherits:
DiscountOffer show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from DiscountOffer

#discriminator

Instance Method Summary collapse

Methods inherited from DiscountOffer

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ DiscountOfferFixed



28508
28509
28510
28511
28512
28513
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28508

def initialize(incoming={})
  super(:discriminator => DiscountOffer::Types::DISCOUNT_OFFER_FIXED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:money], 'DiscountOfferFixed')
  @money = (x = opts.delete(:money); x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))
end

Instance Attribute Details

#moneyObject (readonly)

Returns the value of attribute money.



28506
28507
28508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28506

def money
  @money
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



28519
28520
28521
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28519

def copy(incoming={})
  DiscountOfferFixed.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



28523
28524
28525
28526
28527
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28523

def subtype_to_hash
  {
    :money => money.to_hash
  }
end

#to_jsonObject



28515
28516
28517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28515

def to_json
  JSON.dump(to_hash)
end