class Zype::Base::Categories

Any categories nested routes will inherit from this class

Public Instance Methods

all(category_id:) click to toggle source

Returns all objects for given class

@param category_id [String] the ID of the category @return [Array<Hash>] the objects returned from the API

# File lib/zype/models/base/categories.rb, line 9
def all(category_id:)
  client.execute(method: :get, path: "/categories/#{category_id}/#{path}")
end
create(category_id:, params:) click to toggle source

Creates a new object via the API.

@param category_id [String] ID of the category to assign to the object @param params [Hash] the properties of the object @return [Hash] the newly created object

# File lib/zype/models/base/categories.rb, line 27
def create(category_id:, params:)
  client.execute(method: :post, path: "/categories/#{category_id}/#{path}", params: params)
end
delete(category_id:, id:) click to toggle source

Deletes an existing object via the API

@param category_id [String] the ID of the category @param id [String] the ID of the object @return [Hash] the deleted object

# File lib/zype/models/base/categories.rb, line 45
def delete(category_id:, id:)
  client.execute(method: :delete, path: "/categories/#{category_id}/#{path}/#{id}")
end
find(category_id:, id:) click to toggle source

Returns object matching ID

@param category_id [String] the ID of the category @param id [String] the ID of the object @return [Hash] the object returned from the API

# File lib/zype/models/base/categories.rb, line 18
def find(category_id:, id:)
  client.execute(method: :get, path: "/categories/#{category_id}/#{path}/#{id}")
end
update(category_id:, id:, params:) click to toggle source

Updates an existing object via the API

@param category_id [String] the ID of the category @param params [Hash] the properties to be updated @return [Hash] the updated object

# File lib/zype/models/base/categories.rb, line 36
def update(category_id:, id:, params:)
  client.execute(method: :put, path: "/categories/#{category_id}/#{path}/#{id}", params: params)
end