Class: Pennylane::Category

Inherits:
Resources::Base show all
Defined in:
lib/pennylane/resources/category.rb

Instance Attribute Summary

Attributes inherited from Object

#id

Class Method Summary collapse

Methods inherited from Resources::Base

#[], client, execute_resource_request, #id, #method_missing, normalize_filters, #object, object_name, request_pennylane_object, #respond_to_missing?, #update

Methods inherited from Object

build_from, descendants, #initialize_from_response, objects, protected_fields

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Pennylane::Resources::Base

Class Method Details

.create(params, opts = {}) ⇒ Object



20
21
22
# File 'lib/pennylane/resources/category.rb', line 20

def create params, opts = {}
  request_pennylane_object(method: :post, path: "/categories", params: { body: { object_name => params } }, opts: opts)
end

.list(filters = {}, opts = {}) ⇒ Object



11
12
13
14
# File 'lib/pennylane/resources/category.rb', line 11

def list filters = {}, opts = {}
  normalize_filters(filters)
  request_pennylane_object(method: :get, path: "/categories", params: { query: filters }, opts: opts)
end

.object_name_pluralObject

override the object_name_plural method otherwise it will return ‘categorys’



7
8
9
# File 'lib/pennylane/resources/category.rb', line 7

def object_name_plural
  'categories'
end

.retrieve(id, opts = {}) ⇒ Object



16
17
18
# File 'lib/pennylane/resources/category.rb', line 16

def retrieve id, opts = {}
  request_pennylane_object(method: :get, path: "/categories/#{id}", params: {}, opts: opts)
end