Class: PacklinkLite::Client
- Inherits:
-
Object
- Object
- PacklinkLite::Client
- Defined in:
- lib/packlink_lite/client.rb
Instance Method Summary collapse
Instance Method Details
#delete(path) ⇒ Object
18 19 20 21 |
# File 'lib/packlink_lite/client.rb', line 18 def delete(path) response = RestClient.delete(url(path)) handle_response(response) end |
#get(path, params = nil) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/packlink_lite/client.rb', line 5 def get(path, params = nil) url = url(path) url+= '?' + build_nested_query(params) if params response = RestClient.get(url, headers) handle_response(response) end |
#post(path, payload) ⇒ Object
12 13 14 15 16 |
# File 'lib/packlink_lite/client.rb', line 12 def post(path, payload) payload = payload.to_json unless payload.is_a?(String) response = RestClient.post(url(path), payload, headers) handle_response(response) end |