Class: Io::Flow::V0::Models::DiscountRuleOffer
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DiscountRuleOffer
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#discount ⇒ Object
readonly
Returns the value of attribute discount.
-
#entitlement ⇒ Object
readonly
Returns the value of attribute entitlement.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DiscountRuleOffer
constructor
A new instance of DiscountRuleOffer.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DiscountRuleOffer
Returns a new instance of DiscountRuleOffer.
36923 36924 36925 36926 36927 36928 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36923 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:discount, :entitlement], 'DiscountRuleOffer') @discount = (x = opts.delete(:discount); x.is_a?(::Io::Flow::V0::Models::DiscountOffer) ? x : ::Io::Flow::V0::Models::DiscountOffer.from_json(x)) @entitlement = (x = opts.delete(:entitlement); x.is_a?(::Io::Flow::V0::Models::DiscountRuleEntitlement) ? x : ::Io::Flow::V0::Models::DiscountRuleEntitlement.from_json(x)) end |
Instance Attribute Details
#discount ⇒ Object (readonly)
Returns the value of attribute discount.
36921 36922 36923 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36921 def discount @discount end |
#entitlement ⇒ Object (readonly)
Returns the value of attribute entitlement.
36921 36922 36923 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36921 def entitlement @entitlement end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
36934 36935 36936 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36934 def copy(incoming={}) DiscountRuleOffer.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
36938 36939 36940 36941 36942 36943 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36938 def to_hash { :discount => discount.to_hash, :entitlement => entitlement.to_hash } end |
#to_json ⇒ Object
36930 36931 36932 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36930 def to_json JSON.dump(to_hash) end |