Class: BitPesa::Client

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

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.base_urlObject (readonly)

Returns the value of attribute base_url.



19
20
21
# File 'lib/bitpesa/client.rb', line 19

def base_url
  @base_url
end

.hostObject

Returns the value of attribute host.



18
19
20
# File 'lib/bitpesa/client.rb', line 18

def host
  @host
end

.keyObject

Returns the value of attribute key.



18
19
20
# File 'lib/bitpesa/client.rb', line 18

def key
  @key
end

.secretObject

Returns the value of attribute secret.



18
19
20
# File 'lib/bitpesa/client.rb', line 18

def secret
  @secret
end

.timeoutObject

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