Class: ProcessOut::InvoicesProcessNativePaymentResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/processout/invoices_process_native_payment_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, data = {}) ⇒ InvoicesProcessNativePaymentResponse

Initializes the InvoicesProcessNativePaymentResponse object Params:

client

ProcessOut client instance

data

data that can be used to fill the object



52
53
54
55
56
57
58
# File 'lib/processout/invoices_process_native_payment_response.rb', line 52

def initialize(client, data = {})
  @client = client

  self.transaction = data.fetch(:transaction, nil)
  self.native_apm = data.fetch(:native_apm, nil)
  
end

Instance Attribute Details

#native_apmObject

Returns the value of attribute native_apm.



12
13
14
# File 'lib/processout/invoices_process_native_payment_response.rb', line 12

def native_apm
  @native_apm
end

#transactionObject

Returns the value of attribute transaction.



11
12
13
# File 'lib/processout/invoices_process_native_payment_response.rb', line 11

def transaction
  @transaction
end

Instance Method Details

#fill_with_data(data) ⇒ Object

Fills the object with data coming from the API Params:

data

Hash of data coming from the API



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/processout/invoices_process_native_payment_response.rb', line 76

def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "transaction"
    self.transaction = data["transaction"]
  end
  if data.include? "native_apm"
    self.native_apm = data["native_apm"]
  end
  
  self
end

#new(data = {}) ⇒ Object

Create a new InvoicesProcessNativePaymentResponse using the current client



61
62
63
# File 'lib/processout/invoices_process_native_payment_response.rb', line 61

def new(data = {})
  InvoicesProcessNativePaymentResponse.new(@client, data)
end

#prefill(data) ⇒ Object

Prefills the object with the data passed as parameters Params:

data

Hash of data



93
94
95
96
97
98
99
100
101
# File 'lib/processout/invoices_process_native_payment_response.rb', line 93

def prefill(data)
  if data.nil?
    return self
  end
  self.transaction = data.fetch(:transaction, self.transaction)
  self.native_apm = data.fetch(:native_apm, self.native_apm)
  
  self
end

#to_json(options) ⇒ Object

Overrides the JSON marshaller to only send the fields we want



66
67
68
69
70
71
# File 'lib/processout/invoices_process_native_payment_response.rb', line 66

def to_json(options)
  {
      "transaction": self.transaction,
      "native_apm": self.native_apm,
  }.to_json
end