Class: BitPesa::Client
- Inherits:
-
Object
- Object
- BitPesa::Client
- Defined in:
- lib/bitpesa/client.rb
Class Attribute Summary collapse
-
.base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
.host ⇒ Object
Returns the value of attribute host.
-
.key ⇒ Object
Returns the value of attribute key.
-
.secret ⇒ Object
Returns the value of attribute secret.
-
.timeout ⇒ Object
Returns the value of attribute timeout.
Class Method Summary collapse
- .delete(endpoint) ⇒ Object
- .get(endpoint, payload = nil) ⇒ Object
- .patch(endpoint, payload = {}) ⇒ Object
- .post(endpoint, payload = {}) ⇒ Object
- .put(endpoint, payload = {}) ⇒ Object
Class Attribute Details
.base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
19 20 21 |
# File 'lib/bitpesa/client.rb', line 19 def base_url @base_url end |
.host ⇒ Object
Returns the value of attribute host.
18 19 20 |
# File 'lib/bitpesa/client.rb', line 18 def host @host end |
.key ⇒ Object
Returns the value of attribute key.
18 19 20 |
# File 'lib/bitpesa/client.rb', line 18 def key @key end |
.secret ⇒ Object
Returns the value of attribute secret.
18 19 20 |
# File 'lib/bitpesa/client.rb', line 18 def secret @secret end |
.timeout ⇒ Object
Returns the value of attribute timeout.
18 19 20 |
# File 'lib/bitpesa/client.rb', line 18 def timeout @timeout end |
Class Method Details
.delete(endpoint) ⇒ Object
42 43 44 |
# File 'lib/bitpesa/client.rb', line 42 def delete(endpoint) request "DELETE", request_url(endpoint) end |
.get(endpoint, payload = nil) ⇒ Object
21 22 23 24 25 |
# File 'lib/bitpesa/client.rb', line 21 def get(endpoint, payload=nil) url = request_url(endpoint) url += "?" + URI.encode_www_form(payload) if payload request "GET", url end |
.patch(endpoint, payload = {}) ⇒ Object
37 38 39 40 |
# File 'lib/bitpesa/client.rb', line 37 def patch(endpoint, payload={}) body = JSON.generate(payload) request "PATCH", request_url(endpoint), body end |
.post(endpoint, payload = {}) ⇒ Object
27 28 29 30 |
# File 'lib/bitpesa/client.rb', line 27 def post(endpoint, payload={}) body = JSON.generate(payload) request "POST", request_url(endpoint), body end |
.put(endpoint, payload = {}) ⇒ Object
32 33 34 35 |
# File 'lib/bitpesa/client.rb', line 32 def put(endpoint, payload={}) body = JSON.generate(payload) request "PUT", request_url(endpoint), body end |