Class: Tankard::Api::Style

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Request::Get, Utils::Find, Utils::PageFinders
Defined in:
lib/tankard/api/style.rb

Overview

Access for the /style route on brewerydb

Instance Method Summary collapse

Constructor Details

#initialize(request, options = {}) ⇒ Tankard::Api::Style

Initializes a new object

Parameters:



23
24
25
26
# File 'lib/tankard/api/style.rb', line 23

def initialize(request, options = {})
  @http_client = request
  @http_request_parameters = Hashie::Mash.new(options)
end

Instance Method Details

#each {|hash| ... } ⇒ Object

Calls the given block once for each style

Yield Parameters:

  • hash (Hash)

    containing individual style information

Raises:



# File 'lib/tankard/api/style.rb', line 37

#find(id_or_array, options = {}) ⇒ Hash, Array

Find a single or multiple styles by their id

Parameters:

  • id_or_array (String, Array)
  • options (Hash) (defaults to: {})

Returns:

  • (Hash, Array)

    if a string with a style id is passed to find then the hash of the style is returned. if an array is passed to find an array containing hashes with each style is returned. if a style is not found nothing for that style is returned.



# File 'lib/tankard/api/style.rb', line 28

#id(style_id) ⇒ self

Style id to query

Parameters:

  • style_id (String)

Returns:

  • (self)

    returns itself



51
52
53
54
# File 'lib/tankard/api/style.rb', line 51

def id(style_id)
  @http_request_parameters.id = style_id
  self
end