Class: Io::Flow::V0::Models::DiscountRuleSettingsForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DiscountRuleSettingsForm
- 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.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#to_with_tz ⇒ Object
readonly
Returns the value of attribute to_with_tz.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DiscountRuleSettingsForm
constructor
A new instance of DiscountRuleSettingsForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DiscountRuleSettingsForm
Returns a new instance of DiscountRuleSettingsForm.
30050 30051 30052 30053 30054 30055 30056 30057 30058 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30050 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:name, :from_with_tz, :experience_keys, :rule], 'DiscountRuleSettingsForm') @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))) @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.
30048 30049 30050 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30048 def experience_keys @experience_keys end |
#from_with_tz ⇒ Object (readonly)
Returns the value of attribute from_with_tz.
30048 30049 30050 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30048 def from_with_tz @from_with_tz end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
30048 30049 30050 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30048 def name @name end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
30048 30049 30050 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30048 def rule @rule end |
#to_with_tz ⇒ Object (readonly)
Returns the value of attribute to_with_tz.
30048 30049 30050 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30048 def to_with_tz @to_with_tz end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
30064 30065 30066 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30064 def copy(incoming={}) DiscountRuleSettingsForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
30068 30069 30070 30071 30072 30073 30074 30075 30076 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30068 def to_hash { :name => name, :from_with_tz => from_with_tz.to_hash, :to_with_tz => to_with_tz.nil? ? nil : to_with_tz.to_hash, :experience_keys => experience_keys, :rule => rule.to_hash } end |
#to_json ⇒ Object
30060 30061 30062 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30060 def to_json JSON.dump(to_hash) end |