Class: PacklinkLite::Client

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

Instance Method Summary collapse

Instance Method Details

#delete(path, options = {}) ⇒ Object



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

def delete(path, options = {})
  response = request(:delete, url(path))
  process_response(response, options)
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, options = {})
  url = url(path)
  url+= '?' + build_nested_query(params) if params
  response = request(:get, url, headers)
  process_response(response, options)
end

#post(path, payload, options = {}) ⇒ Object



12
13
14
15
16
# File 'lib/packlink_lite/client.rb', line 12

def post(path, payload, options = {})
  payload = payload.to_json unless payload.is_a?(String)
  response = request(:post, url(path), payload, headers)
  process_response(response, options)
end