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, WooCommerce::ApiBase::SENSITIVE_ARGS

Instance Method Summary collapse

Methods inherited from ApiBase

#initialize, #inspect

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.



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

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.



209
210
211
# File 'lib/woocommerce_api.rb', line 209

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.



248
249
250
# File 'lib/woocommerce_api.rb', line 248

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.



219
220
221
# File 'lib/woocommerce_api.rb', line 219

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.



229
230
231
# File 'lib/woocommerce_api.rb', line 229

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