dota 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -6
- data/dota.gemspec +1 -1
- data/lib/dota/api/client.rb +5 -13
- data/lib/dota/version.rb +1 -1
- data/spec/dota/api/hero_spec.rb +1 -1
- data/spec/dota/api/item_spec.rb +1 -1
- data/spec/dota/api/match/draft_spec.rb +1 -1
- data/spec/dota/api/match/player_spec.rb +1 -1
- data/spec/dota/api/match_spec.rb +1 -1
- data/spec/dota_spec.rb +20 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0929acbcb71659706557cfeebf2e9998714e626
|
4
|
+
data.tar.gz: e622e9b46ea78f614bfd5ccbc4e1ac0436c1e52b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
37
|
-
|
38
|
-
api.
|
39
|
-
api.
|
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
|
data/dota.gemspec
CHANGED
@@ -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.
|
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"
|
data/lib/dota/api/client.rb
CHANGED
@@ -12,23 +12,15 @@ module Dota
|
|
12
12
|
yield configuration
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
Hero.new(id)
|
15
|
+
def heroes(id = nil)
|
16
|
+
id ? Hero.new(id) : Hero.all
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
|
19
|
+
def items(id = nil)
|
20
|
+
id ? Item.new(id) : Item.all
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
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
|
data/lib/dota/version.rb
CHANGED
data/spec/dota/api/hero_spec.rb
CHANGED
data/spec/dota/api/item_spec.rb
CHANGED
data/spec/dota/api/match_spec.rb
CHANGED
data/spec/dota_spec.rb
CHANGED
@@ -17,29 +17,33 @@ describe Dota do
|
|
17
17
|
expect(Dota).to receive(:api).and_return(test_client)
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
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 "#
|
44
|
+
specify "#matches" do
|
41
45
|
VCR.use_cassette("GetMatchDetails") do
|
42
|
-
match = api.
|
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
|
+
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.
|
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.
|
26
|
+
version: 0.8.8
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday_middleware
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|