Class: WooCommerce::API

Inherits:
ApiBase show all
Defined in:
lib/woocommerce_api.rb

Overview

Initialize the API class

Constant Summary

Constants inherited from ApiBase

WooCommerce::ApiBase::DEFAULT_ARGS

Instance Method Summary collapse

Methods inherited from ApiBase

#initialize

Constructor Details

This class inherits a constructor from WooCommerce::ApiBase

Instance Method Details

#delete(endpoint, query = nil) ⇒ Object

Public: DELETE requests.

endpoint - A String naming the request endpoint. query - A Hash with query params.

Returns the request Hash.



231
232
233
# File 'lib/woocommerce_api.rb', line 231

def delete(endpoint, query = nil)
  do_request :delete, add_query_params(endpoint, query)
end

#get(endpoint, query = nil) ⇒ Object

Public: GET requests.

endpoint - A String naming the request endpoint. query - A Hash with query params.

Returns the request Hash.



201
202
203
# File 'lib/woocommerce_api.rb', line 201

def get(endpoint, query = nil)
  do_request :get, add_query_params(endpoint, query)
end

#options(endpoint) ⇒ Object

Public: OPTIONS requests.

endpoint - A String naming the request endpoint.

Returns the request Hash.



240
241
242
# File 'lib/woocommerce_api.rb', line 240

def options(endpoint)
  do_request :options, add_query_params(endpoint, nil)
end

#post(endpoint, data) ⇒ Object

Public: POST requests.

endpoint - A String naming the request endpoint. data - The Hash data for the request.

Returns the request Hash.



211
212
213
# File 'lib/woocommerce_api.rb', line 211

def post(endpoint, data)
  do_request :post, endpoint, data
end

#put(endpoint, data) ⇒ Object

Public: PUT requests.

endpoint - A String naming the request endpoint. data - The Hash data for the request.

Returns the request Hash.



221
222
223
# File 'lib/woocommerce_api.rb', line 221

def put(endpoint, data)
  do_request :put, endpoint, data
end