Class: Io::Flow::V0::Models::PaymentRequestUpserted

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

Returns a new instance of PaymentRequestUpserted.



58936
58937
58938
58939
58940
58941
58942
58943
58944
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58936

def initialize(incoming={})
  super(:discriminator => Event::Types::PAYMENT_REQUEST_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :payment_request], 'PaymentRequestUpserted')
  @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)
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @payment_request = (x = opts.delete(:payment_request); x.is_a?(::Io::Flow::V0::Models::PaymentRequest) ? x : ::Io::Flow::V0::Models::PaymentRequest.new(x))
end

Instance Attribute Details

#event_idObject (readonly)

Returns the value of attribute event_id.



58934
58935
58936
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58934

def event_id
  @event_id
end

#organizationObject (readonly)

Returns the value of attribute organization.



58934
58935
58936
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58934

def organization
  @organization
end

#payment_requestObject (readonly)

Returns the value of attribute payment_request.



58934
58935
58936
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58934

def payment_request
  @payment_request
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



58934
58935
58936
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58934

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



58950
58951
58952
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58950

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

#subtype_to_hashObject



58954
58955
58956
58957
58958
58959
58960
58961
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58954

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :payment_request => payment_request.to_hash
  }
end

#to_jsonObject



58946
58947
58948
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58946

def to_json
  JSON.dump(to_hash)
end