lib/lita/handlers/cheapshark.rb in lita-cheapshark-0.1.0 vs lib/lita/handlers/cheapshark.rb in lita-cheapshark-0.2.0
- old
+ new
@@ -6,10 +6,10 @@
route(/^(?:cheapshark)\s+(.*)/i, :cheapshark, command: true, help: { t("help.cheapshark_key") => t("help.cheapshark_value")})
def cheapshark(response)
term = response.matches[0][0]
- data = connection.get("games", title: term).body
+ data = JSON.parse(connection.get("games", title: term).body)
response.reply("No deal found for '#{term}'") && return if data.size == 0
deal = data.first
response.reply("Cheapest deal for '#{deal['external']}': $#{deal['cheapest']}")
response.reply("#{CHEAPSHARK_DEAL_URL}?dealID=#{deal['cheapestDealID']}")
end