Module: Bigcommerce::Request::ClassMethods

Defined in:
lib/bigcommerce/request.rb

Instance Method Summary collapse

Instance Method Details

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



26
27
28
29
# File 'lib/bigcommerce/request.rb', line 26

def delete(path, params = {})
  response = raw_request(:delete, path, params)
  response.body
end

#get(path, params = {}) ⇒ Object



21
22
23
24
# File 'lib/bigcommerce/request.rb', line 21

def get(path, params = {})
  response = raw_request(:get, path, params)
  build_response_object response
end

#post(path, params = {}) ⇒ Object



31
32
33
34
# File 'lib/bigcommerce/request.rb', line 31

def post(path, params = {})
  response = raw_request(:post, path, params)
  build_response_object response
end

#put(path, params = {}) ⇒ Object



36
37
38
39
# File 'lib/bigcommerce/request.rb', line 36

def put(path, params = {})
  response = raw_request(:put, path, params)
  build_response_object response
end

#raw_request(method, path, params = {}) ⇒ Object



41
42
43
44
# File 'lib/bigcommerce/request.rb', line 41

def raw_request(method, path, params = {})
  client = params.delete(:connection) || Bigcommerce.api
  client.send(method, path.to_s, params)
end