Class: Io::Flow::V0::Models::AbandonedOrderPromotion

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 = {}) ⇒ AbandonedOrderPromotion

Returns a new instance of AbandonedOrderPromotion.



26570
26571
26572
26573
26574
26575
26576
26577
26578
26579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26570

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_atObject (readonly)

Returns the value of attribute ends_at.



26568
26569
26570
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26568

def ends_at
  @ends_at
end

#idObject (readonly)

Returns the value of attribute id.



26568
26569
26570
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26568

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



26568
26569
26570
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26568

def name
  @name
end

#promotion_detailsObject (readonly)

Returns the value of attribute promotion_details.



26568
26569
26570
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26568

def promotion_details
  @promotion_details
end

#starts_atObject (readonly)

Returns the value of attribute starts_at.



26568
26569
26570
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26568

def starts_at
  @starts_at
end

#statusObject (readonly)

Returns the value of attribute status.



26568
26569
26570
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26568

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26585
26586
26587
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26585

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

#to_hashObject



26589
26590
26591
26592
26593
26594
26595
26596
26597
26598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26589

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_jsonObject



26581
26582
26583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26581

def to_json
  JSON.dump(to_hash)
end