Class: Io::Flow::V0::Models::FreeShipping

Inherits:
Promotion
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from Promotion

#discriminator

Instance Method Summary collapse

Methods inherited from Promotion

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ FreeShipping

Returns a new instance of FreeShipping.



15915
15916
15917
15918
15919
15920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15915

def initialize(incoming={})
  super(:discriminator => Promotion::Types::FREE_SHIPPING)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:trigger], 'FreeShipping')
  @trigger = (x = opts.delete(:trigger); x.is_a?(::Io::Flow::V0::Models::PromotionTrigger) ? x : ::Io::Flow::V0::Models::PromotionTrigger.new(x))
end

Instance Attribute Details

#triggerObject (readonly)

Returns the value of attribute trigger.



15913
15914
15915
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15913

def trigger
  @trigger
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15926
15927
15928
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15926

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

#subtype_to_hashObject



15930
15931
15932
15933
15934
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15930

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

#to_jsonObject



15922
15923
15924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15922

def to_json
  JSON.dump(to_hash)
end