class Io::Flow::V0::Models::AvailablePromotion

Attributes

id[R]
promotions[R]
region[R]
shipping_configuration[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 31571
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :shipping_configuration, :region, :promotions], 'AvailablePromotion')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @shipping_configuration = (x = opts.delete(:shipping_configuration); x.is_a?(::Io::Flow::V0::Models::ShippingConfigurationReference) ? x : ::Io::Flow::V0::Models::ShippingConfigurationReference.new(x))
  @region = (x = opts.delete(:region); x.is_a?(::Io::Flow::V0::Models::RegionReference) ? x : ::Io::Flow::V0::Models::RegionReference.new(x))
  @promotions = HttpClient::Preconditions.assert_class('promotions', opts.delete(:promotions), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Promotion) ? x : ::Io::Flow::V0::Models::Promotion.from_json(x)) }
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 31584
def copy(incoming={})
  AvailablePromotion.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 31588
def to_hash
  {
    :id => id,
    :shipping_configuration => shipping_configuration.to_hash,
    :region => region.to_hash,
    :promotions => promotions.map { |o| o.to_hash }
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 31580
def to_json
  JSON.dump(to_hash)
end