class Io::Flow::V0::Models::AbandonedOrderPromotion

Attributes

ends_at[R]
id[R]
name[R]
promotion_details[R]
starts_at[R]
status[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 28717
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :name, :promotion_details, :status], 'AbandonedOrderPromotion')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @promotion_details = (x = opts.delete(:promotion_details); x.is_a?(::Io::Flow::V0::Models::AbandonedOrderPromotionDetails) ? x : ::Io::Flow::V0::Models::AbandonedOrderPromotionDetails.from_json(x))
  @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::AbandonedOrderPromotionStatus) ? x : ::Io::Flow::V0::Models::AbandonedOrderPromotionStatus.apply(x))
  @starts_at = (x = opts.delete(:starts_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('starts_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @ends_at = (x = opts.delete(:ends_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('ends_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 28732
def copy(incoming={})
  AbandonedOrderPromotion.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 28736
def to_hash
  {
    :id => id,
    :name => name,
    :promotion_details => promotion_details.to_hash,
    :status => status.value,
    :starts_at => starts_at,
    :ends_at => ends_at
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 28728
def to_json
  JSON.dump(to_hash)
end