Class: Io::Flow::V0::Models::AppliedPromotion
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AppliedPromotion
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AppliedPromotion
constructor
A new instance of AppliedPromotion.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AppliedPromotion
Returns a new instance of AppliedPromotion.
9527 9528 9529 9530 9531 9532 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9527 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type, :value], 'AppliedPromotion') @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::AppliedPromotionType) ? x : ::Io::Flow::V0::Models::AppliedPromotionType.apply(x)) @value = (x = opts.delete(:value); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
9525 9526 9527 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9525 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
9525 9526 9527 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9525 def value @value end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
9538 9539 9540 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9538 def copy(incoming={}) AppliedPromotion.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
9542 9543 9544 9545 9546 9547 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9542 def to_hash { :type => type.value, :value => value.to_hash } end |
#to_json ⇒ Object
9534 9535 9536 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9534 def to_json JSON.dump(to_hash) end |