Class: Grubber::Client

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

Constant Summary collapse

HOST =
'api.yelp.com'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#consumer_keyObject

Returns the value of attribute consumer_key.



9
10
11
# File 'lib/grubber/client.rb', line 9

def consumer_key
  @consumer_key
end

#consumer_secretObject

Returns the value of attribute consumer_secret.



9
10
11
# File 'lib/grubber/client.rb', line 9

def consumer_secret
  @consumer_secret
end

#token_keyObject

Returns the value of attribute token_key.



9
10
11
# File 'lib/grubber/client.rb', line 9

def token_key
  @token_key
end

#token_secretObject

Returns the value of attribute token_secret.



9
10
11
# File 'lib/grubber/client.rb', line 9

def token_secret
  @token_secret
end

Instance Method Details

#search(term, opts = {}) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/grubber/client.rb', line 11

def search(term, opts={})
  lat, lng = *Grubber::CONFIG.coordinates
  yelp     = connection
  return [] if yelp.nil?

  response = yelp.get("/v2/search?term=#{term}&ll=#{lat},#{lng}")
  Restaurant.parse(response.body)
end