dota 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11288c0fc061bc33de74cf9379a13804e8bcd107
4
- data.tar.gz: 8b5d300d111c113ad9dfd47b81049a09255fcca7
3
+ metadata.gz: e0929acbcb71659706557cfeebf2e9998714e626
4
+ data.tar.gz: e622e9b46ea78f614bfd5ccbc4e1ac0436c1e52b
5
5
  SHA512:
6
- metadata.gz: 35e922c63323700c2ee13150a6c15f3b180fab00ea3be03b180b251537a3816771c6b5f618b28dcb4d1cc88f998bddf6692af70973e38b0cc4dae64e32dd19a6
7
- data.tar.gz: 986209bba2d1454a4ab413d19727f0e8c02da98996e72a344920ad8de8de84705dbdf34655ddf9edbaaff2efa063327b3d14e0b231f4356cab31187cb7bdba00
6
+ metadata.gz: 59de68568da26209342d2493e3782040206771fcb2a193284d7461c5ff038967548f794365a8af92503a1a8763632b80a38f602befb5d6fa7db2801e12b62fc4
7
+ data.tar.gz: d339be5b0d92733109105f8ccbde21f25e39ed820dfa638ba16d69b79bb04328a5f66838d2c9b4711a8311f533471f8363b3fa349998ac8558e3178bed65bd04
data/README.md CHANGED
@@ -26,17 +26,22 @@ Or install it yourself as:
26
26
  Dota.configure do |config|
27
27
  config.api_key = "YOUR_STEAM_API_KEY"
28
28
  end
29
-
30
- api = Dota.api
31
29
  ```
32
30
 
33
31
  Get your Steam API key [here](http://steamcommunity.com/dev/apikey). What follows is a list of API methods currently available:
34
32
 
35
33
  ```ruby
36
- api.hero(43) # => Dota::API::Hero
37
- api.item(114) # => Dota::API::Item
38
- api.match(789645621) # => Dota::API::Match
39
- api.leagues # => [Dota::API::League, ...]
34
+ api = Dota.api
35
+
36
+ api.heroes # => All heroes
37
+ api.heroes(43) # => A single hero (Death Prophet)
38
+
39
+ api.items # => All items
40
+ api.items(114) # => A single item (Heart of Tarrasque)
41
+
42
+ api.matches(789645621) # => A single match (Newbee vs Vici Gaming)
43
+
44
+ api.leagues # => All leagues
40
45
  ```
41
46
 
42
47
  ### API Objects
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "faraday", "~> 0.9.0"
21
+ spec.add_dependency "faraday", "~> 0.8.8"
22
22
  spec.add_dependency "faraday_middleware", "~> 0.9.1"
23
23
 
24
24
  spec.add_development_dependency "rake"
@@ -12,23 +12,15 @@ module Dota
12
12
  yield configuration
13
13
  end
14
14
 
15
- def hero(id)
16
- Hero.new(id)
15
+ def heroes(id = nil)
16
+ id ? Hero.new(id) : Hero.all
17
17
  end
18
18
 
19
- def heroes
20
- Hero.all
19
+ def items(id = nil)
20
+ id ? Item.new(id) : Item.all
21
21
  end
22
22
 
23
- def item(id)
24
- Item.new(id)
25
- end
26
-
27
- def items
28
- Item.all
29
- end
30
-
31
- def match(id)
23
+ def matches(id)
32
24
  response = do_request("GetMatchDetails", match_id: id)["result"]
33
25
  Match.new(response) if response
34
26
  end
@@ -1,3 +1,3 @@
1
1
  module Dota
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  describe Dota::API::Hero do
2
2
  let(:hero) do
3
3
  VCR.use_cassette("GetMatchDetails") do
4
- test_client.match(sample_match_id).players.first.hero
4
+ test_client.matches(sample_match_id).players.first.hero
5
5
  end
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  describe Dota::API::Item do
2
2
  let(:item) do
3
3
  VCR.use_cassette("GetMatchDetails") do
4
- test_client.match(sample_match_id).players.first.items.first
4
+ test_client.matches(sample_match_id).players.first.items.first
5
5
  end
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  describe Dota::API::Match::Draft do
2
2
  let(:draft) do
3
3
  VCR.use_cassette("GetMatchDetails") do
4
- test_client.match(sample_match_id).drafts.last
4
+ test_client.matches(sample_match_id).drafts.last
5
5
  end
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  describe Dota::API::Match::Player do
2
2
  let(:player) do
3
3
  VCR.use_cassette("GetMatchDetails") do
4
- test_client.match(sample_match_id).players.first
4
+ test_client.matches(sample_match_id).players.first
5
5
  end
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  describe Dota::API::Match do
2
2
  let(:match) do
3
3
  VCR.use_cassette("GetMatchDetails") do
4
- test_client.match(sample_match_id)
4
+ test_client.matches(sample_match_id)
5
5
  end
6
6
  end
7
7
 
@@ -17,29 +17,33 @@ describe Dota do
17
17
  expect(Dota).to receive(:api).and_return(test_client)
18
18
  end
19
19
 
20
- specify "#hero" do
21
- hero = api.hero(43)
22
- expect(hero).to be_a Dota::API::Hero
23
- end
20
+ describe "#heroes" do
21
+ it "given an id returns a single hero" do
22
+ hero = api.heroes(43)
23
+ expect(hero).to be_a Dota::API::Hero
24
+ end
24
25
 
25
- specify "#heroes" do
26
- hero = api.heroes.first
27
- expect(hero).to be_a Dota::API::Hero
26
+ it "without params returns all heroes" do
27
+ hero = api.heroes.first
28
+ expect(hero).to be_a Dota::API::Hero
29
+ end
28
30
  end
29
31
 
30
- specify "#item" do
31
- item = api.item(114)
32
- expect(item).to be_a Dota::API::Item
33
- end
32
+ describe "#items" do
33
+ it "given an id returns a single item" do
34
+ item = api.items(114)
35
+ expect(item).to be_a Dota::API::Item
36
+ end
34
37
 
35
- specify "#items" do
36
- item = api.items.first
37
- expect(item).to be_a Dota::API::Item
38
+ it "without params returns all items" do
39
+ item = api.items.first
40
+ expect(item).to be_a Dota::API::Item
41
+ end
38
42
  end
39
43
 
40
- specify "#match" do
44
+ specify "#matches" do
41
45
  VCR.use_cassette("GetMatchDetails") do
42
- match = api.match(sample_match_id)
46
+ match = api.matches(sample_match_id)
43
47
  expect(match).to be_a Dota::API::Match
44
48
  end
45
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dota
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinni Carlo Caños
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.9.0
19
+ version: 0.8.8
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.0
26
+ version: 0.8.8
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_middleware
29
29
  requirement: !ruby/object:Gem::Requirement