Class: Io::Flow::V0::Models::AbandonedOrderPromotionForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AbandonedOrderPromotionForm

Returns a new instance of AbandonedOrderPromotionForm.



26635
26636
26637
26638
26639
26640
26641
26642
26643
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26635

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:name, :promotion_details], 'AbandonedOrderPromotionForm')
  @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.nil? ? nil : (x = x; 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_atObject (readonly)

Returns the value of attribute ends_at.



26633
26634
26635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26633

def ends_at
  @ends_at
end

#nameObject (readonly)

Returns the value of attribute name.



26633
26634
26635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26633

def name
  @name
end

#promotion_detailsObject (readonly)

Returns the value of attribute promotion_details.



26633
26634
26635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26633

def promotion_details
  @promotion_details
end

#starts_atObject (readonly)

Returns the value of attribute starts_at.



26633
26634
26635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26633

def starts_at
  @starts_at
end

#statusObject (readonly)

Returns the value of attribute status.



26633
26634
26635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26633

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26649
26650
26651
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26649

def copy(incoming={})
  AbandonedOrderPromotionForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



26653
26654
26655
26656
26657
26658
26659
26660
26661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26653

def to_hash
  {
    :name => name,
    :promotion_details => promotion_details.to_hash,
    :status => status.nil? ? nil : status.value,
    :starts_at => starts_at,
    :ends_at => ends_at
  }
end

#to_jsonObject



26645
26646
26647
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26645

def to_json
  JSON.dump(to_hash)
end