Class: Verifi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/verifi.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_key, api_secret, api_host = "http://api.verifi.com/hpp") ⇒ Client

Returns a new instance of Client.



9
10
11
12
13
# File 'lib/verifi.rb', line 9

def initialize api_key, api_secret, api_host="http://api.verifi.com/hpp"
  @api_key = api_key
  @api_secret = api_secret
  @api_host = api_host
end

Instance Method Details

#create_payment_request(attributes) ⇒ Object

The attributes should simply be a hash of attribute name to value i.e. should not be wrapped with payment



17
18
19
20
21
22
23
24
25
# File 'lib/verifi.rb', line 17

def create_payment_request attributes
  uri = '/payment_requests'

  params = {:payment => attributes}
  params.merge!(base_api_params.merge(:command => 'create_payment_request'))
  params.merge!(:sig => gen_sig(params, @api_secret))

  do_post "#{@api_host}#{uri}", params
end

#read_payment_request(pay_key) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/verifi.rb', line 27

def read_payment_request pay_key
  uri = "/payment_requests/#{pay_key}"

  params = base_api_params.merge(:command => 'read_payment_request')
  params.merge!(:sig => gen_sig(params, @api_secret))

  do_get "#{@api_host}#{uri}", params
end