Class: BreweryDB::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/brewery_db/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Client

Returns a new instance of Client.



3
4
5
# File 'lib/brewery_db/client.rb', line 3

def initialize(&block)
  configure(&block) if block_given?
end

Instance Method Details

#beersObject



16
17
18
# File 'lib/brewery_db/client.rb', line 16

def beers
  @beers ||= Resources::Beers.new(config)
end

#breweriesObject



28
29
30
# File 'lib/brewery_db/client.rb', line 28

def breweries
  @breweries ||= Resources::Breweries.new(config)
end

#brewery(id) ⇒ Resources::Breweries

Builds a new instance of the brewery resource.

Parameters:

  • id (String)

    the brewery ID

Returns:



24
25
26
# File 'lib/brewery_db/client.rb', line 24

def brewery(id)
  Resources::Brewery.new(config, id: id)
end

#categoriesObject



32
33
34
# File 'lib/brewery_db/client.rb', line 32

def categories
  @categories ||= Resources::Categories.new(config)
end

#configObject



7
8
9
# File 'lib/brewery_db/client.rb', line 7

def config
  @config ||= Config.new
end

#configure {|config| ... } ⇒ Object

Yields:



11
12
13
14
# File 'lib/brewery_db/client.rb', line 11

def configure
  yield(config)
  self
end

#fermentablesObject



36
37
38
# File 'lib/brewery_db/client.rb', line 36

def fermentables
  @fermentables ||= Resources::Fermentables.new(config)
end

#fluid_sizeObject



40
41
42
# File 'lib/brewery_db/client.rb', line 40

def fluid_size
  @fluid_size ||= Resources::FluidSize.new(config)
end

#glasswareObject



44
45
46
# File 'lib/brewery_db/client.rb', line 44

def glassware
  @glassware ||= Resources::Glassware.new(config)
end

#hopsObject



48
49
50
# File 'lib/brewery_db/client.rb', line 48

def hops
  @hops ||= Resources::Hops.new(config)
end

#locationsObject



52
53
54
# File 'lib/brewery_db/client.rb', line 52

def locations
  @locations ||= Resources::Locations.new(config)
end


56
57
58
# File 'lib/brewery_db/client.rb', line 56

def menu
  @menu ||= Resources::Menu.new(config)
end

#searchObject



60
61
62
# File 'lib/brewery_db/client.rb', line 60

def search
  @search ||= Resources::Search.new(config)
end

#stylesObject



64
65
66
# File 'lib/brewery_db/client.rb', line 64

def styles
  @styles ||= Resources::Styles.new(config)
end

#yeastsObject



68
69
70
# File 'lib/brewery_db/client.rb', line 68

def yeasts
  @yeasts ||= Resources::Yeasts.new(config)
end