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

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ReturnUpserted

Returns a new instance of ReturnUpserted.



19610
19611
19612
19613
19614
19615
19616
19617
19618
19619
19620
19621
19622
19623
19624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19610

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

#destination ⇒ Object (readonly)

Returns the value of attribute destination.



19608
19609
19610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19608

def destination
  @destination
end

#event_id ⇒ Object (readonly)

Returns the value of attribute event_id.



19608
19609
19610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19608

def event_id
  @event_id
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



19608
19609
19610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19608

def id
  @id
end

#items ⇒ Object (readonly)

Returns the value of attribute items.



19608
19609
19610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19608

def items
  @items
end

#key ⇒ Object (readonly)

Returns the value of attribute key.



19608
19609
19610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19608

def key
  @key
end

#labels ⇒ Object (readonly)

Returns the value of attribute labels.



19608
19609
19610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19608

def labels
  @labels
end

#organization ⇒ Object (readonly)

Returns the value of attribute organization.



19608
19609
19610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19608

def organization
  @organization
end

#origin ⇒ Object (readonly)

Returns the value of attribute origin.



19608
19609
19610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19608

def origin
  @origin
end

#service ⇒ Object (readonly)

Returns the value of attribute service.



19608
19609
19610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19608

def service
  @service
end

#timestamp ⇒ Object (readonly)

Returns the value of attribute timestamp.



19608
19609
19610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19608

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



19630
19631
19632
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19630

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

#subtype_to_hash ⇒ Object



19634
19635
19636
19637
19638
19639
19640
19641
19642
19643
19644
19645
19646
19647
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19634

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_json ⇒ Object



19626
19627
19628
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19626

def to_json
  JSON.dump(to_hash)
end