Class: Pay2go::Client
- Inherits:
-
Object
- Object
- Pay2go::Client
- Defined in:
- lib/pay2go/client.rb
Instance Attribute Summary collapse
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
Instance Method Summary collapse
- #api_host ⇒ Object
-
#initialize(amt, options = {}) ⇒ Client
constructor
A new instance of Client.
- #request(path = "", params = {}) ⇒ Object
- #response ⇒ Object
Constructor Details
#initialize(amt, options = {}) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 |
# File 'lib/pay2go/client.rb', line 9 def initialize amt, = {} @amt = amt @item_desc = [:item_desc] || "" @email = [:email] || "" @mode = [:mode] || "test" @secret = PAY2GO_CONFIG[@mode] end |
Instance Attribute Details
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
7 8 9 |
# File 'lib/pay2go/client.rb', line 7 def secret @secret end |
Instance Method Details
#api_host ⇒ Object
17 18 19 |
# File 'lib/pay2go/client.rb', line 17 def api_host secret["host"] end |
#request(path = "", params = {}) ⇒ Object
21 22 23 24 |
# File 'lib/pay2go/client.rb', line 21 def request path="", params = {} api_url = URI.join(api_host, path) Net::HTTP.post_form api_url, payment_params end |
#response ⇒ Object
26 27 28 29 |
# File 'lib/pay2go/client.rb', line 26 def response res = request return res.body end |