Class: BreweryDB::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ 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.



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

#glasswareObject



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

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

#locationsObject



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

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

#searchObject



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

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

#stylesObject



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

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