Class: AN

Inherits:
Object
  • Object
show all
Includes:
Mote::Helpers
Defined in:
lib/an.rb

Defined Under Namespace

Modules: Luhn Classes: AuthorizationResponse, Client, Response

Constant Summary collapse

TEMPLATES =
File.expand_path("../templates", File.dirname(__FILE__))

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ AN

Returns a new instance of AN.



28
29
30
31
# File 'lib/an.rb', line 28

def initialize(uri)
  @auth   = { login: uri.user, transaction_key: uri.password }
  @client = Client.new(uri)
end

Instance Attribute Details

#authObject (readonly)

Returns the value of attribute auth.



25
26
27
# File 'lib/an.rb', line 25

def auth
  @auth
end

#clientObject (readonly)

Returns the value of attribute client.



26
27
28
# File 'lib/an.rb', line 26

def client
  @client
end

#urlObject (readonly)

Returns the value of attribute url.



24
25
26
# File 'lib/an.rb', line 24

def url
  @url
end

Class Method Details

.connect(url = ENV["AUTHORIZE_NET_URL"]) ⇒ Object

In production systems, you can simply set

AUTHORIZE_NET_URL=login:[email protected]/xml/v1/request.api

in the appropriate location (e.g. /etc/profile.d, ~/.bashrc, or whatever you’re most comfortable with.

The TEST URL is apikey.authorize.net/xml/v1/request.api



16
17
18
# File 'lib/an.rb', line 16

def self.connect(url = ENV["AUTHORIZE_NET_URL"])
  new(URI(url))
end

Instance Method Details

#create_payment_profile(params) ⇒ Object



41
42
43
# File 'lib/an.rb', line 41

def create_payment_profile(params)
  call("createCustomerPaymentProfileRequest", params)
end

#create_profile(params) ⇒ Object



37
38
39
# File 'lib/an.rb', line 37

def create_profile(params)
  call("createCustomerProfileRequest", params)
end

#create_profile_transaction(params) ⇒ Object



45
46
47
# File 'lib/an.rb', line 45

def create_profile_transaction(params)
  call("createCustomerProfileTransactionRequest", params)
end

#get_profile(params) ⇒ Object



49
50
51
# File 'lib/an.rb', line 49

def get_profile(params)
  call("getCustomerProfileRequest", params)
end

#transact(params) ⇒ Object



33
34
35
# File 'lib/an.rb', line 33

def transact(params)
  call("createTransactionRequest", params)
end