Class: NMIGateway::CustomerVault

Inherits:
Api
  • Object
show all
Defined in:
lib/nmi_gateway/customer_vault.rb

Constant Summary

Constants inherited from Api

Api::QUERY_URL, Api::TRANSACTION_URL

Instance Attribute Summary

Attributes inherited from Api

#query, #security_key

Instance Method Summary collapse

Methods inherited from Api

#get, #initialize, #post

Constructor Details

This class inherits a constructor from NMIGateway::Api

Instance Method Details

#create(options = {}) ⇒ Object

NMIGateway::CustomerVault.new.create ccnumber: ‘4111111111111111’, ccexp: “0219”, first_name: “John”, last_name: “Doe” NMIGateway::CustomerVault.new.create payment_token: “00000000-000000-000000-000000000000”, first_name: “John”, last_name: “Doe”



6
7
8
9
10
11
12
13
14
15
# File 'lib/nmi_gateway/customer_vault.rb', line 6

def create(options = {})
  query = set_query(options)
  query[:customer_vault] = 'add_customer'
  if query[:payment_token]
    require_fields(:payment_token, :first_name, :last_name)
  else
    require_fields(:ccnumber, :ccexp, :first_name, :last_name)
  end
  post query
end

#destroy(options = {}) ⇒ Object

NMIGateway::CustomerVault.new.destroy customer_vault_id: 481397475



26
27
28
29
30
31
# File 'lib/nmi_gateway/customer_vault.rb', line 26

def destroy(options = {})
  query = set_query(options)
  query[:customer_vault] = 'delete_customer'
  require_fields(:customer_vault_id)
  post query
end

#find(options = {}) ⇒ Object

NMIGateway::CustomerVault.new.find customer_vault_id: 481397475



34
35
36
37
38
39
# File 'lib/nmi_gateway/customer_vault.rb', line 34

def find(options = {})
  query = set_query(options)
  query[:report_type] = 'customer_vault'
  require_fields(:customer_vault_id)
  get query
end

#update(options = {}) ⇒ Object

NMIGateway::CustomerVault.new.update customer_vault_id: 481397475, ccnumber: ‘4111111111111111’, ccexp: “0220”, first_name: “Jane”, last_name: “Doe”



18
19
20
21
22
23
# File 'lib/nmi_gateway/customer_vault.rb', line 18

def update(options = {})
  query = set_query(options)
  query[:customer_vault] = 'update_customer'
  require_fields(:customer_vault_id)
  post query
end