lita-cheapshark 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/cheapshark.rb +1 -1
- data/lita-cheapshark.gemspec +1 -1
- data/spec/lita/handlers/cheapshark_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc4ba64364b6866c6228bf54ff09750127122706
|
4
|
+
data.tar.gz: 2eac7362781b13833e152c6c3be51147a9516ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 369a57310d171cd087a8b159e201fd62d4629c5bff82d5791a240e338e415710a0b2e59263c853df2e3dbc89c82f326cbeb97db2ba7264bb250facaf77b9e119
|
7
|
+
data.tar.gz: 73a2afbb9c4beb31b3a3a0db1d4eb89eafa97b458bcf6d84b2d32d49853c4374c7fe0d4e186b6d901fe732ca6e8f93792a3c53a66fb13e687d04a923cacfa7c0
|
@@ -8,7 +8,7 @@ module Lita
|
|
8
8
|
|
9
9
|
def cheapshark(response)
|
10
10
|
term = response.matches[0][0]
|
11
|
-
data = connection.get("games", title: term).body
|
11
|
+
data = JSON.parse(connection.get("games", title: term).body)
|
12
12
|
response.reply("No deal found for '#{term}'") && return if data.size == 0
|
13
13
|
deal = data.first
|
14
14
|
response.reply("Cheapest deal for '#{deal['external']}': $#{deal['cheapest']}")
|
data/lita-cheapshark.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-cheapshark"
|
3
|
-
spec.version = "0.
|
3
|
+
spec.version = "0.2.0"
|
4
4
|
spec.authors = ["Magnus Skog"]
|
5
5
|
spec.email = ["magnus.m.skog@gmail.com"]
|
6
6
|
spec.description = "A Lita handler that returns the best deal for a game from http://www.cheapshark.com"
|
@@ -6,7 +6,7 @@ describe Lita::Handlers::Cheapshark, lita_handler: true do
|
|
6
6
|
describe "#cheapshark" do
|
7
7
|
context "with a term with results" do
|
8
8
|
before :each do
|
9
|
-
stub_request(:get, "#{described_class::CHEAPSHARK_URL}/games").with(query: {title: 'batman: arkham city'}).to_return(body:
|
9
|
+
stub_request(:get, "#{described_class::CHEAPSHARK_URL}/games").with(query: {title: 'batman: arkham city'}).to_return(body: File.read('spec/fixtures/games_batman_arkham_city.json'))
|
10
10
|
end
|
11
11
|
|
12
12
|
it "returns the title of the game, the best deal as well as a url to the deal" do
|
@@ -19,7 +19,7 @@ describe Lita::Handlers::Cheapshark, lita_handler: true do
|
|
19
19
|
|
20
20
|
context "with a term without results" do
|
21
21
|
before :each do
|
22
|
-
stub_request(:get, "#{described_class::CHEAPSHARK_URL}/games").with(query: {title: 'foobar'}).to_return(body: [])
|
22
|
+
stub_request(:get, "#{described_class::CHEAPSHARK_URL}/games").with(query: {title: 'foobar'}).to_return(body: "[]")
|
23
23
|
end
|
24
24
|
|
25
25
|
it "returns a helpful message" do
|