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.



54456
54457
54458
54459
54460
54461
54462
54463
54464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54456

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.



54454
54455
54456
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54454

def event_id
  @event_id
end

#organizationObject (readonly)

Returns the value of attribute organization.



54454
54455
54456
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54454

def organization
  @organization
end

#payment_requestObject (readonly)

Returns the value of attribute payment_request.



54454
54455
54456
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54454

def payment_request
  @payment_request
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



54454
54455
54456
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54454

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



54470
54471
54472
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54470

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

#subtype_to_hashObject



54474
54475
54476
54477
54478
54479
54480
54481
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54474

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

#to_jsonObject



54466
54467
54468
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54466

def to_json
  JSON.dump(to_hash)
end