Class: Multisafepay::TokensResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/multisafepay/resources/tokens.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Multisafepay::Resource

Instance Method Details

#createObject



3
4
5
# File 'lib/multisafepay/resources/tokens.rb', line 3

def create
  Token.new get_request("auth/api_token")
end

#delete(customer_reference, token) ⇒ Object



16
17
18
# File 'lib/multisafepay/resources/tokens.rb', line 16

def delete(customer_reference, token)
  Token.new delete_request("recurring/#{customer_reference}/token/#{token}")
end

#retrieve(customer_reference, token = nil) ⇒ Object



7
8
9
10
# File 'lib/multisafepay/resources/tokens.rb', line 7

def retrieve(customer_reference, token = nil)
  url = token.nil? ? "recurring/#{customer_reference}" : "recurring/#{customer_reference}/token/#{token}"
  Token.new get_request(url)
end

#update(customer_reference, token, payload = {}) ⇒ Object



12
13
14
# File 'lib/multisafepay/resources/tokens.rb', line 12

def update(customer_reference, token, payload = {})
  Token.new patch_request("recurring/#{customer_reference}/update/#{token}", body: payload)
end