Module: Bigcommerce::Request::ClassMethods

Defined in:
lib/bigcommerce/request.rb

Instance Method Summary collapse

Instance Method Details

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


51
52
53
54
# File 'lib/bigcommerce/request.rb', line 51

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

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


46
47
48
49
# File 'lib/bigcommerce/request.rb', line 46

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

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


56
57
58
59
# File 'lib/bigcommerce/request.rb', line 56

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

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


61
62
63
64
# File 'lib/bigcommerce/request.rb', line 61

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

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


66
67
68
69
# File 'lib/bigcommerce/request.rb', line 66

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