Class: MundiApi::CreateSetupRequest

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

Overview

Request for creating a Setup for a subscription. The setup is an order that will be created at the subscription creation.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(amount = nil, description = nil, payment = nil) ⇒ CreateSetupRequest

Returns a new instance of CreateSetupRequest.



31
32
33
34
35
36
37
# File 'lib/mundi_api/models/create_setup_request.rb', line 31

def initialize(amount = nil,
               description = nil,
               payment = nil)
  @amount = amount
  @description = description
  @payment = payment
end

Instance Attribute Details

#amountInteger

Setup amount

Returns:

  • (Integer)


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

def amount
  @amount
end

#descriptionString

Description

Returns:



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

def description
  @description
end

#paymentCreatePaymentRequest

Payment data



18
19
20
# File 'lib/mundi_api/models/create_setup_request.rb', line 18

def payment
  @payment
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/mundi_api/models/create_setup_request.rb', line 40

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount = hash['amount']
  description = hash['description']
  payment = CreatePaymentRequest.from_hash(hash['payment']) if
    hash['payment']

  # Create object from extracted values.
  CreateSetupRequest.new(amount,
                         description,
                         payment)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
26
27
28
29
# File 'lib/mundi_api/models/create_setup_request.rb', line 21

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