Class: Trolley::Client
- Inherits:
-
Object
- Object
- Trolley::Client
- Defined in:
- lib/trolley/Client.rb
Instance Method Summary collapse
- #delete(endPoint, body = '') ⇒ Object
- #get(endPoint) ⇒ Object
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
- #patch(endPoint, body) ⇒ Object
- #post(endPoint, body) ⇒ Object
Constructor Details
#initialize(config) ⇒ Client
Returns a new instance of Client.
11 12 13 |
# File 'lib/trolley/Client.rb', line 11 def initialize(config) @config = config end |
Instance Method Details
#delete(endPoint, body = '') ⇒ Object
24 25 26 27 |
# File 'lib/trolley/Client.rb', line 24 def delete(endPoint, body = '') body = body.to_json if body != '' send_request(endPoint, 'DELETE', body) end |
#get(endPoint) ⇒ Object
15 16 17 |
# File 'lib/trolley/Client.rb', line 15 def get(endPoint) send_request(endPoint, 'GET') end |
#patch(endPoint, body) ⇒ Object
29 30 31 32 |
# File 'lib/trolley/Client.rb', line 29 def patch(endPoint, body) body = body.to_json send_request(endPoint, 'PATCH', body) end |
#post(endPoint, body) ⇒ Object
19 20 21 22 |
# File 'lib/trolley/Client.rb', line 19 def post(endPoint, body) body = body.to_json send_request(endPoint, 'POST', body) end |