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 ⇒ Object
readonly
Returns the value of attribute from.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
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.
28943 28944 28945 28946 28947 28948 28949 28950 28951 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28943 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:name, :from, :experience_keys, :rule], 'DiscountRuleSettingsForm') @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @from = HttpClient::Preconditions.assert_class('from', HttpClient::Helper.to_date_time_iso8601(opts.delete(:from)), DateTime) @to = (x = opts.delete(:to); x.nil? ? nil : HttpClient::Preconditions.assert_class('to', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @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.
28941 28942 28943 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28941 def experience_keys @experience_keys end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
28941 28942 28943 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28941 def from @from end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
28941 28942 28943 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28941 def name @name end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
28941 28942 28943 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28941 def rule @rule end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
28941 28942 28943 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28941 def to @to end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
28957 28958 28959 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28957 def copy(incoming={}) DiscountRuleSettingsForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
28961 28962 28963 28964 28965 28966 28967 28968 28969 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28961 def to_hash { :name => name, :from => from, :to => to, :experience_keys => experience_keys, :rule => rule.to_hash } end |
#to_json ⇒ Object
28953 28954 28955 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28953 def to_json JSON.dump(to_hash) end |