Class: SecondAmendmentWholesale::Category
- Includes:
- API
- Defined in:
- lib/second_amendment_wholesale/category.rb
Constant Summary collapse
- EXCLUDED_CATEGORY_IDS =
Excludes brands and other non-categories returned from 2AW’s Categories endpoint
[3, 26, 27]
Constants included from API
Class Method Summary collapse
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize(options = {}) ⇒ Category
constructor
A new instance of Category.
Methods included from API
#delete_request, #get_request, #post_request, #put_request
Constructor Details
#initialize(options = {}) ⇒ Category
Returns a new instance of Category.
9 10 11 12 13 |
# File 'lib/second_amendment_wholesale/category.rb', line 9 def initialize( = {}) requires!(, :token) @options = end |
Class Method Details
.all(options = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/second_amendment_wholesale/category.rb', line 15 def self.all( = {}) requires!(, :token) new().all end |
Instance Method Details
#all ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/second_amendment_wholesale/category.rb', line 21 def all headers = [ *auth_header(@options[:token]), *content_type_header('application/json'), ].to_h response = get_request('categories', headers) extract_categories(response.body[:children_data]) end |