Skip to content

Commit

Permalink
I know this is broken...
Browse files Browse the repository at this point in the history
  • Loading branch information
Ted Wexler committed May 7, 2014
1 parent 24848c9 commit f052196
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -15,3 +15,4 @@ spec/reports
test/tmp
test/version_tmp
tmp
vendor/
24 changes: 12 additions & 12 deletions lib/lita/handlers/yelpme.rb
Expand Up @@ -6,23 +6,23 @@ class Yelpme < Handler
route(/^(?:yelp|y)\s+(.+)/u, :yelp, command: true, help: {
"yelp QUERY" => "Return the first Yelp result with information about the first business found"
})
@client = Yelp::Client.new({ consumer_key: Lita.config.handlers.yelpme.consumer_key,
consumer_secret: Lita.config.handlers.yelpme.consumer_secret,
token: Lita.config.handlers.yelpme.token,
token_secret: Lita.config.handlers.yelpme.token_secret
})
def self.default_config(handler_config)
handler_config.consumer_key = nil
handler_config.consumer_secret = nil
handler_config.token = nil
handler_config.token_secret = nil
handler_config.default_city = "San Francisco"
handler_config.consumer_key = ""
handler_config.consumer_secret = ""
handler_config.token = ""
handler_config.token_secret = ""
handler_config.default_city = "San Francisco"
end
def yelp(response)
query = response.matches[0][0]
client = Yelp::Client.new({ consumer_key: config.yelpme.consumer_key,
consumer_secret: config.yelpme.consumer_secret,
token: config.yelpme.token,
token_secret: config.yelpme.token_secret
})
yelp_response = client.search(config.default_city, { term: query, limit: 1 })
yelp_response = @client.search(config.default_city, { term: query, limit: 1 })
if len(yelp_response.businesses) == 0
response.reply('Cannot find any businesses in #{config.default_city} matching #{query}')
response.reply('Cannot find any businesses in #{config.default_city} matching #{query}')
end
result = yelp_response.businesses[0]
address = "#{result.location.address.join(' ')}, #{result.location.city}, #{result.location.state_code} #{result.location.postal_code}"
Expand Down

0 comments on commit f052196

Please sign in to comment.