Class: Io::Flow::V0::Models::ShopifyItemEventData

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

Returns a new instance of ShopifyItemEventData.



67422
67423
67424
67425
67426
67427
67428
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67422

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:created_at, :experience, :item], 'ShopifyItemEventData')
  @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
  @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceReference) ? x : ::Io::Flow::V0::Models::ExperienceReference.new(x))
  @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::CatalogItemSummary) ? x : ::Io::Flow::V0::Models::CatalogItemSummary.new(x))
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



67420
67421
67422
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67420

def created_at
  @created_at
end

#experienceObject (readonly)

Returns the value of attribute experience.



67420
67421
67422
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67420

def experience
  @experience
end

#itemObject (readonly)

Returns the value of attribute item.



67420
67421
67422
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67420

def item
  @item
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



67434
67435
67436
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67434

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

#to_hashObject



67438
67439
67440
67441
67442
67443
67444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67438

def to_hash
  {
    :created_at => created_at,
    :experience => experience.to_hash,
    :item => item.to_hash
  }
end

#to_jsonObject



67430
67431
67432
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 67430

def to_json
  JSON.dump(to_hash)
end