Class: MundiApi::CreateCaptureChargeRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mundi_api/models/create_capture_charge_request.rb

Overview

Request for capturing a charge

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(code = nil, amount = nil) ⇒ CreateCaptureChargeRequest

Returns a new instance of CreateCaptureChargeRequest.



26
27
28
29
30
# File 'lib/mundi_api/models/create_capture_charge_request.rb', line 26

def initialize(code = nil,
               amount = nil)
  @code = code
  @amount = amount
end

Instance Attribute Details

#amountInteger

The amount that will be captured

Returns:

  • (Integer)


14
15
16
# File 'lib/mundi_api/models/create_capture_charge_request.rb', line 14

def amount
  @amount
end

#codeString

Code for the charge. Sending this field will update the code send on the charge and order creation.

Returns:



10
11
12
# File 'lib/mundi_api/models/create_capture_charge_request.rb', line 10

def code
  @code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/mundi_api/models/create_capture_charge_request.rb', line 33

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  code = hash['code']
  amount = hash['amount']

  # Create object from extracted values.
  CreateCaptureChargeRequest.new(code,
                                 amount)
end

.namesObject

A mapping from model property names to API property names.



17
18
19
20
21
22
23
24
# File 'lib/mundi_api/models/create_capture_charge_request.rb', line 17

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