class Io::Flow::V0::Models::DiscountRuleSettings

Attributes

experience_keys[R]
from_with_tz[R]
id[R]
name[R]
rule[R]
status[R]
to_with_tz[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 40170
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :name, :from_with_tz, :status, :experience_keys, :rule], 'DiscountRuleSettings')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @from_with_tz = (x = opts.delete(:from_with_tz); x.is_a?(::Io::Flow::V0::Models::DatetimeWithTimezone) ? x : ::Io::Flow::V0::Models::DatetimeWithTimezone.new(x))
  @to_with_tz = (x = opts.delete(:to_with_tz); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::DatetimeWithTimezone) ? x : ::Io::Flow::V0::Models::DatetimeWithTimezone.new(x)))
  @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::DiscountRuleStatus) ? x : ::Io::Flow::V0::Models::DiscountRuleStatus.apply(x))
  @experience_keys = HttpClient::Preconditions.assert_class('experience_keys', opts.delete(:experience_keys), Array).map { |v| HttpClient::Preconditions.assert_class('experience_keys', v, String) }
  @rule = (x = opts.delete(:rule); x.is_a?(::Io::Flow::V0::Models::DiscountRule) ? x : ::Io::Flow::V0::Models::DiscountRule.new(x))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 40186
def copy(incoming={})
  DiscountRuleSettings.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 40190
def to_hash
  {
    :id => id,
    :name => name,
    :from_with_tz => from_with_tz.to_hash,
    :to_with_tz => to_with_tz.nil? ? nil : to_with_tz.to_hash,
    :status => status.value,
    :experience_keys => experience_keys,
    :rule => rule.to_hash
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 40182
def to_json
  JSON.dump(to_hash)
end