Class: Io::Flow::V0::Models::SubcatalogItemVersion

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

Returns a new instance of SubcatalogItemVersion.



30662
30663
30664
30665
30666
30667
30668
30669
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30662

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :timestamp, :type, :subcatalog_item], 'SubcatalogItemVersion')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ChangeType) ? x : ::Io::Flow::V0::Models::ChangeType.apply(x))
  @subcatalog_item = (x = opts.delete(:subcatalog_item); x.is_a?(::Io::Flow::V0::Models::SubcatalogItem) ? x : ::Io::Flow::V0::Models::SubcatalogItem.new(x))
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



30660
30661
30662
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30660

def id
  @id
end

#subcatalog_itemObject (readonly)

Returns the value of attribute subcatalog_item.



30660
30661
30662
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30660

def subcatalog_item
  @subcatalog_item
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



30660
30661
30662
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30660

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



30660
30661
30662
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30660

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30675
30676
30677
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30675

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

#to_hashObject



30679
30680
30681
30682
30683
30684
30685
30686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30679

def to_hash
  {
    :id => id,
    :timestamp => timestamp,
    :type => type.value,
    :subcatalog_item => subcatalog_item.to_hash
  }
end

#to_jsonObject



30671
30672
30673
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30671

def to_json
  JSON.dump(to_hash)
end