Class: Yelpr::Client
- Inherits:
-
Object
- Object
- Yelpr::Client
- Defined in:
- lib/yelpr/client.rb
Instance Attribute Summary collapse
-
#consumer_key ⇒ Object
Returns the value of attribute consumer_key.
-
#consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
-
#token ⇒ Object
Returns the value of attribute token.
-
#token_secret ⇒ Object
Returns the value of attribute token_secret.
Instance Method Summary collapse
- #business(id) ⇒ Object
-
#initialize {|_self| ... } ⇒ Client
constructor
A new instance of Client.
- #search(options = {}) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/yelpr/client.rb', line 9 def initialize() yield self @conn = Faraday.new(:url => 'http://api.yelp.com') do |builder| builder.use Faraday::Request::OAuth, auth if auth.values.all? builder.use Faraday::Response::Mashify builder.use Faraday::Response::ParseJson builder.adapter Faraday.default_adapter end end |
Instance Attribute Details
#consumer_key ⇒ Object
Returns the value of attribute consumer_key.
7 8 9 |
# File 'lib/yelpr/client.rb', line 7 def consumer_key @consumer_key end |
#consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
7 8 9 |
# File 'lib/yelpr/client.rb', line 7 def consumer_secret @consumer_secret end |
#token ⇒ Object
Returns the value of attribute token.
7 8 9 |
# File 'lib/yelpr/client.rb', line 7 def token @token end |
#token_secret ⇒ Object
Returns the value of attribute token_secret.
7 8 9 |
# File 'lib/yelpr/client.rb', line 7 def token_secret @token_secret end |
Instance Method Details
#business(id) ⇒ Object
28 29 30 31 |
# File 'lib/yelpr/client.rb', line 28 def business(id) response = @conn.get "/v2/business/#{id}" response.body end |
#search(options = {}) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/yelpr/client.rb', line 20 def search( = {}) response = @conn.get do |request| request.url '/v2/search', end response.body end |