Class: PaymentsApi::HttpClient
- Inherits:
-
Object
- Object
- PaymentsApi::HttpClient
- Includes:
- Errors
- Defined in:
- lib/payments_api/http_client.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#get(href, query = {}) ⇒ Object
Only GET and POST verbs are used with Payments API, but more verbs can be easily added as needed.
-
#initialize(options = {}) ⇒ HttpClient
constructor
A new instance of HttpClient.
- #post(href, payload = {}) ⇒ Object
Methods included from Errors
Constructor Details
#initialize(options = {}) ⇒ HttpClient
Returns a new instance of HttpClient.
11 12 13 |
# File 'lib/payments_api/http_client.rb', line 11 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/payments_api/http_client.rb', line 9 def @options end |
Instance Method Details
#get(href, query = {}) ⇒ Object
Only GET and POST verbs are used with Payments API, but more verbs can be easily added as needed.
18 19 20 21 22 |
# File 'lib/payments_api/http_client.rb', line 18 def get(href, query = {}) execute_request!(:get, href) do |req| req.params.update(query) end end |
#post(href, payload = {}) ⇒ Object
24 25 26 27 28 |
# File 'lib/payments_api/http_client.rb', line 24 def post(href, payload = {}) execute_request!(:post, href) do |req| req.body = JSON.dump(payload) end end |