Class: PaymentsApi::PaymentStatus

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/payments_api/models/payment_status.rb

Overview

Payment Information Data

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(approved = nil, sent = nil) ⇒ PaymentStatus

Returns a new instance of PaymentStatus.



25
26
27
28
29
# File 'lib/payments_api/models/payment_status.rb', line 25

def initialize(approved = nil,
               sent = nil)
  @approved = approved
  @sent = sent
end

Instance Attribute Details

#approvedBoolean

Set to true once the payment has been approved

Returns:

  • (Boolean)


11
12
13
# File 'lib/payments_api/models/payment_status.rb', line 11

def approved
  @approved
end

#sentBoolean

Set to true once the payment has been sent

Returns:

  • (Boolean)


15
16
17
# File 'lib/payments_api/models/payment_status.rb', line 15

def sent
  @sent
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/payments_api/models/payment_status.rb', line 32

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  approved = hash['approved']
  sent = hash['sent']

  # Create object from extracted values.

  PaymentStatus.new(approved,
                    sent)
end

.namesObject

A mapping from model property names to API property names.



18
19
20
21
22
23
# File 'lib/payments_api/models/payment_status.rb', line 18

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['approved'] = 'approved'
  @_hash['sent'] = 'sent'
  @_hash
end