Class: Aurfy::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



8
9
10
11
12
# File 'lib/aurfy/client.rb', line 8

def initialize(options = {})
  @api_url = options[:test] ? TEST_API_URL : API_URL
  @merchantid = options[:merchantid]
  @trade_certificate = options[:trade_certificate]
end

Instance Attribute Details

#api_urlObject (readonly)

Returns the value of attribute api_url.



6
7
8
# File 'lib/aurfy/client.rb', line 6

def api_url
  @api_url
end

#merchantidObject (readonly)

Returns the value of attribute merchantid.



6
7
8
# File 'lib/aurfy/client.rb', line 6

def merchantid
  @merchantid
end

#trade_certificateObject (readonly)

Returns the value of attribute trade_certificate.



6
7
8
# File 'lib/aurfy/client.rb', line 6

def trade_certificate
  @trade_certificate
end

Instance Method Details

#purchase(options = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/aurfy/client.rb', line 14

def purchase(options = {})
  configure = Configure.new(options.merge(merchantid: merchantid, trade_certificate: trade_certificate))

  response = Faraday.post api_url, configure.params
  Response.new(response)
end