Class: Io::Flow::V0::Models::ReturnUpserted

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

Instance Attribute Summary collapse

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ReturnUpserted

Returns a new instance of ReturnUpserted.



23733
23734
23735
23736
23737
23738
23739
23740
23741
23742
23743
23744
23745
23746
23747
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23733

def initialize(incoming={})
  super(:discriminator => Event::Types::RETURN_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :id, :organization, :destination, :items, :key, :labels, :service, :origin], 'ReturnUpserted')
  @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @destination = HttpClient::Preconditions.assert_class('destination', HttpClient::Helper.to_object(opts.delete(:destination)), Hash)
  @items = HttpClient::Preconditions.assert_class('items', HttpClient::Helper.to_object(opts.delete(:items)), Hash)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @labels = HttpClient::Preconditions.assert_class('labels', HttpClient::Helper.to_object(opts.delete(:labels)), Hash)
  @service = HttpClient::Preconditions.assert_class('service', opts.delete(:service), String)
  @origin = HttpClient::Preconditions.assert_class('origin', HttpClient::Helper.to_object(opts.delete(:origin)), Hash)
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



23731
23732
23733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23731

def destination
  @destination
end

#event_idObject (readonly)

Returns the value of attribute event_id.



23731
23732
23733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23731

def event_id
  @event_id
end

#idObject (readonly)

Returns the value of attribute id.



23731
23732
23733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23731

def id
  @id
end

#itemsObject (readonly)

Returns the value of attribute items.



23731
23732
23733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23731

def items
  @items
end

#keyObject (readonly)

Returns the value of attribute key.



23731
23732
23733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23731

def key
  @key
end

#labelsObject (readonly)

Returns the value of attribute labels.



23731
23732
23733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23731

def labels
  @labels
end

#organizationObject (readonly)

Returns the value of attribute organization.



23731
23732
23733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23731

def organization
  @organization
end

#originObject (readonly)

Returns the value of attribute origin.



23731
23732
23733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23731

def origin
  @origin
end

#serviceObject (readonly)

Returns the value of attribute service.



23731
23732
23733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23731

def service
  @service
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



23731
23732
23733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23731

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23753
23754
23755
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23753

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

#subtype_to_hashObject



23757
23758
23759
23760
23761
23762
23763
23764
23765
23766
23767
23768
23769
23770
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23757

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :id => id,
    :organization => organization,
    :destination => destination,
    :items => items,
    :key => key,
    :labels => labels,
    :service => service,
    :origin => origin
  }
end

#to_jsonObject



23749
23750
23751
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23749

def to_json
  JSON.dump(to_hash)
end