class Zype::Base::Consumers

Any consumer nested routes will inherit from this class

Public Instance Methods

all(consumer_id:) click to toggle source

Returns all objects for given class

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

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

Creates a new object via the API.

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

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

Deletes an existing object via the API

@param consumer_id [String] the ID of the consumer @param id [String] the ID of the object @return [Hash] the deleted object

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

Returns object matching ID

@param consumer_id [String] the ID of the consumer @param id [String] the ID of the object @return [Hash] the object returned from the API

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

Updates an existing object via the API

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

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