Class: Io::Flow::V0::Models::DiscountRuleSettings
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DiscountRuleSettings
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#experience_keys ⇒ Object
readonly
Returns the value of attribute experience_keys.
-
#from_with_tz ⇒ Object
readonly
Returns the value of attribute from_with_tz.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#to_with_tz ⇒ Object
readonly
Returns the value of attribute to_with_tz.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DiscountRuleSettings
constructor
A new instance of DiscountRuleSettings.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DiscountRuleSettings
Returns a new instance of DiscountRuleSettings.
30007 30008 30009 30010 30011 30012 30013 30014 30015 30016 30017 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30007 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 |
Instance Attribute Details
#experience_keys ⇒ Object (readonly)
Returns the value of attribute experience_keys.
30005 30006 30007 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30005 def experience_keys @experience_keys end |
#from_with_tz ⇒ Object (readonly)
Returns the value of attribute from_with_tz.
30005 30006 30007 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30005 def from_with_tz @from_with_tz end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
30005 30006 30007 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30005 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
30005 30006 30007 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30005 def name @name end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
30005 30006 30007 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30005 def rule @rule end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
30005 30006 30007 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30005 def status @status end |
#to_with_tz ⇒ Object (readonly)
Returns the value of attribute to_with_tz.
30005 30006 30007 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30005 def to_with_tz @to_with_tz end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
30023 30024 30025 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30023 def copy(incoming={}) DiscountRuleSettings.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
30027 30028 30029 30030 30031 30032 30033 30034 30035 30036 30037 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30027 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 ⇒ Object
30019 30020 30021 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30019 def to_json JSON.dump(to_hash) end |