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

Returns a new instance of DiscountOfferFixed.



30598
30599
30600
30601
30602
30603
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30598

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.



30596
30597
30598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30596

def money
  @money
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30609
30610
30611
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30609

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

#subtype_to_hashObject



30613
30614
30615
30616
30617
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30613

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

#to_jsonObject



30605
30606
30607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30605

def to_json
  JSON.dump(to_hash)
end