Class: MundiApi::UpdateSubscriptionPaymentMethodRequest

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

Overview

Request for updating a subscription’s payment method

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(payment_method = nil, card_id = nil, card = nil) ⇒ UpdateSubscriptionPaymentMethodRequest

Returns a new instance of UpdateSubscriptionPaymentMethodRequest.



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

def initialize(payment_method = nil,
               card_id = nil,
               card = nil)
  @payment_method = payment_method
  @card_id = card_id
  @card = card
end

Instance Attribute Details

#cardCreateCardRequest

Card data

Returns:



17
18
19
# File 'lib/mundi_api/models/update_subscription_payment_method_request.rb', line 17

def card
  @card
end

#card_idString

Card id

Returns:



13
14
15
# File 'lib/mundi_api/models/update_subscription_payment_method_request.rb', line 13

def card_id
  @card_id
end

#payment_methodString

The new payment method

Returns:



9
10
11
# File 'lib/mundi_api/models/update_subscription_payment_method_request.rb', line 9

def payment_method
  @payment_method
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payment_method = hash['payment_method']
  card_id = hash['card_id']
  card = CreateCardRequest.from_hash(hash['card']) if hash['card']

  # Create object from extracted values.
  UpdateSubscriptionPaymentMethodRequest.new(payment_method,
                                             card_id,
                                             card)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  if @_hash.nil?
    @_hash = {}
    @_hash['payment_method'] = 'payment_method'
    @_hash['card_id'] = 'card_id'
    @_hash['card'] = 'card'
  end
  @_hash
end