Class: Paynow::PaynowClient
- Inherits:
-
Object
- Object
- Paynow::PaynowClient
- Defined in:
- lib/paynow/paynow_client.rb
Overview
Net::HTTP wraper for consuming the Paynow API
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Class Method Summary collapse
Instance Method Summary collapse
- #create_payment ⇒ Object
-
#initialize(body) ⇒ PaynowClient
constructor
A new instance of PaynowClient.
Constructor Details
#initialize(body) ⇒ PaynowClient
Returns a new instance of PaynowClient.
14 15 16 |
# File 'lib/paynow/paynow_client.rb', line 14 def initialize(body) @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/paynow/paynow_client.rb', line 8 def body @body end |
Class Method Details
.create_payment(body) ⇒ Object
10 11 12 |
# File 'lib/paynow/paynow_client.rb', line 10 def self.create_payment(body) new(body).create_payment end |
Instance Method Details
#create_payment ⇒ Object
18 19 20 21 22 |
# File 'lib/paynow/paynow_client.rb', line 18 def create_payment uri = URI("https://#{host}/v1/payments") Net::HTTP.post(uri, json_body, headers) end |