Class: Io::Flow::V0::Models::AbandonedOrderPromotion
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AbandonedOrderPromotion
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#ends_at ⇒ Object
readonly
Returns the value of attribute ends_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#promotion_details ⇒ Object
readonly
Returns the value of attribute promotion_details.
-
#starts_at ⇒ Object
readonly
Returns the value of attribute starts_at.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AbandonedOrderPromotion
constructor
A new instance of AbandonedOrderPromotion.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AbandonedOrderPromotion
Returns a new instance of AbandonedOrderPromotion.
28717 28718 28719 28720 28721 28722 28723 28724 28725 28726 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28717 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :name, :promotion_details, :status], 'AbandonedOrderPromotion') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @promotion_details = (x = opts.delete(:promotion_details); x.is_a?(::Io::Flow::V0::Models::AbandonedOrderPromotionDetails) ? x : ::Io::Flow::V0::Models::AbandonedOrderPromotionDetails.from_json(x)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::AbandonedOrderPromotionStatus) ? x : ::Io::Flow::V0::Models::AbandonedOrderPromotionStatus.apply(x)) @starts_at = (x = opts.delete(:starts_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('starts_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @ends_at = (x = opts.delete(:ends_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('ends_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) end |
Instance Attribute Details
#ends_at ⇒ Object (readonly)
Returns the value of attribute ends_at.
28715 28716 28717 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28715 def ends_at @ends_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
28715 28716 28717 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28715 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
28715 28716 28717 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28715 def name @name end |
#promotion_details ⇒ Object (readonly)
Returns the value of attribute promotion_details.
28715 28716 28717 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28715 def promotion_details @promotion_details end |
#starts_at ⇒ Object (readonly)
Returns the value of attribute starts_at.
28715 28716 28717 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28715 def starts_at @starts_at end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
28715 28716 28717 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28715 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
28732 28733 28734 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28732 def copy(incoming={}) AbandonedOrderPromotion.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
28736 28737 28738 28739 28740 28741 28742 28743 28744 28745 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28736 def to_hash { :id => id, :name => name, :promotion_details => promotion_details.to_hash, :status => status.value, :starts_at => starts_at, :ends_at => ends_at } end |
#to_json ⇒ Object
28728 28729 28730 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28728 def to_json JSON.dump(to_hash) end |