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.



51971
51972
51973
51974
51975
51976
51977
51978
51979
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51971

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.



51969
51970
51971
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51969

def event_id
  @event_id
end

#organizationObject (readonly)

Returns the value of attribute organization.



51969
51970
51971
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51969

def organization
  @organization
end

#payment_requestObject (readonly)

Returns the value of attribute payment_request.



51969
51970
51971
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51969

def payment_request
  @payment_request
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



51969
51970
51971
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51969

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



51985
51986
51987
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51985

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

#subtype_to_hashObject



51989
51990
51991
51992
51993
51994
51995
51996
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51989

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

#to_jsonObject



51981
51982
51983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51981

def to_json
  JSON.dump(to_hash)
end