Class: PacklinkLite::Client
- Inherits:
-
Object
- Object
- PacklinkLite::Client
- Defined in:
- lib/packlink_lite/client.rb
Instance Method Summary collapse
- #delete(path, options = {}) ⇒ Object
- #get(path, params = nil, options = {}) ⇒ Object
- #post(path, payload, options = {}) ⇒ Object
Instance Method Details
#delete(path, options = {}) ⇒ Object
18 19 20 21 |
# File 'lib/packlink_lite/client.rb', line 18 def delete(path, = {}) response = request(:delete, url(path)) process_response(response, ) end |
#get(path, params = nil, options = {}) ⇒ 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 = request(:get, url, headers) process_response(response, ) end |
#post(path, payload, options = {}) ⇒ 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 = request(:post, url(path), payload, headers) process_response(response, ) end |