dota 0.0.14 → 0.0.15
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 +28 -35
- data/data/{heroes.yml → hero.yml} +3 -0
- data/data/{items.yml → item.yml} +0 -0
- data/lib/dota.rb +6 -1
- data/lib/dota/api/hero.rb +3 -7
- data/lib/dota/api/item.rb +3 -7
- data/lib/dota/utils/{inspect.rb → inspectable.rb} +0 -0
- data/lib/dota/utils/mapped.rb +29 -0
- data/lib/dota/version.rb +1 -1
- data/spec/dota/api/hero_spec.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c0e4caa6d634db5ba4d35b82acb4582384ce963
|
4
|
+
data.tar.gz: c1a00ca1d4afc08dfc37b2ab80e5fa18695720f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91426673b41ecbebdb84a66d640b9d46debf98206d4b6686080717a67678d6eeca155cd26e39aab9d0042cd484bcbadd8ca6cd1111ed294ddbefb073dad0beb2
|
7
|
+
data.tar.gz: aa2c2e18dea696d7be459fb45ab89fd0ec3182c54bf18812ef1d0b57196a2c58fce9ce9662a773c68cab751b5800ca0e7ed482b3129a9c6c5a8486dffbf03536
|
data/README.md
CHANGED
@@ -1,36 +1,23 @@
|
|
1
1
|
# Dota [](http://badge.fury.io/rb/dota) [](https://travis-ci.org/vinnicc/dota)
|
2
2
|
|
3
|
-
`dota` is a Ruby client for the [Dota 2 WebAPI](https://wiki.teamfortress.com/wiki/WebAPI#Dota_2).
|
3
|
+
`dota` is a Ruby client for the [Dota 2 WebAPI](https://wiki.teamfortress.com/wiki/WebAPI#Dota_2).
|
4
4
|
|
5
|
-
|
5
|
+
## Requests
|
6
6
|
|
7
|
-
|
8
|
-
- [GetMatchDetails](https://wiki.teamfortress.com/wiki/WebAPI/GetMatchDetails)
|
9
|
-
- [GetMatchHistory](https://wiki.teamfortress.com/wiki/WebAPI/GetMatchHistory)
|
10
|
-
- [GetFriendList](https://wiki.teamfortress.com/wiki/WebAPI/GetFriendList)
|
11
|
-
- [GetHeroes](https://wiki.teamfortress.com/wiki/WebAPI/GetHeroes)
|
12
|
-
- GetGameItems
|
13
|
-
- [GetRarities](https://wiki.teamfortress.com/wiki/WebAPI/GetRarities)
|
14
|
-
- [GetTeamInfoByTeamID](https://wiki.teamfortress.com/wiki/WebAPI/GetTeamInfoByTeamID)
|
15
|
-
- [GetLiveLeagueGames](https://wiki.teamfortress.com/wiki/WebAPI/GetLiveLeagueGames)
|
16
|
-
- [GetScheduledLeagueGames](https://wiki.teamfortress.com/wiki/WebAPI/GetScheduledLeagueGames)
|
17
|
-
|
18
|
-
Unsupported endpoints can still be queried via [custom requests](#custom-requests).
|
7
|
+
Valve provides a `GetSupportedAPIList` endpoint that returns all the available endpoints in their API you can use, along with the parameters they accept. The following are supported by `dota`:
|
19
8
|
|
20
|
-
|
21
|
-
|
22
|
-
|
9
|
+
- GetLeagueListing
|
10
|
+
- GetMatchDetails
|
11
|
+
- GetMatchHistory
|
12
|
+
- GetFriendList
|
13
|
+
- GetHeroes
|
14
|
+
- GetGameItems
|
15
|
+
- GetRarities
|
16
|
+
- GetTeamInfoByTeamID
|
17
|
+
- GetLiveLeagueGames
|
18
|
+
- GetScheduledLeagueGames
|
23
19
|
|
24
|
-
|
25
|
-
- [GetMatchHistoryBySequenceNum](https://wiki.teamfortress.com/wiki/WebAPI/GetMatchHistoryBySequenceNum)
|
26
|
-
- [GetPlayerSummaries](https://wiki.teamfortress.com/wiki/WebAPI/GetPlayerSummaries)
|
27
|
-
- [GetTournamentPlayerStats](https://wiki.teamfortress.com/wiki/WebAPI/GetTournamentPlayerStats)
|
28
|
-
- [GetTournamentPrizePool](https://wiki.teamfortress.com/wiki/WebAPI/GetTournamentPrizePool)
|
29
|
-
- Validations and error classes
|
30
|
-
- More configuration options
|
31
|
-
- Move API documentation to [readthedocs.org](https://readthedocs.org/) or somewhere else
|
32
|
-
- Better search filters
|
33
|
-
- Computed attributes such as win rates, hero usage, etc.
|
20
|
+
Unsupported endpoints (including `GetSupportedAPIList`) can still be queried via [custom requests](#custom-requests) using `Dota.api.get`.
|
34
21
|
|
35
22
|
## Installation
|
36
23
|
|
@@ -50,13 +37,15 @@ Or install it yourself as:
|
|
50
37
|
|
51
38
|
## Usage
|
52
39
|
|
40
|
+
Get your Steam API key [here](http://steamcommunity.com/dev/apikey) and make sure the gem is configured to use it. If you're using Rails, this might go in an initializer like `config/initializers/dota.rb`.
|
41
|
+
|
53
42
|
```ruby
|
54
43
|
Dota.configure do |config|
|
55
44
|
config.api_key = ENV.fetch("STEAM_API_KEY")
|
56
45
|
end
|
57
46
|
```
|
58
47
|
|
59
|
-
|
48
|
+
Then use the client:
|
60
49
|
|
61
50
|
```ruby
|
62
51
|
api = Dota.api
|
@@ -216,7 +205,7 @@ live_match.roshan_timer # Integer, Seconds until Roshan respawns
|
|
216
205
|
#### Scheduled Matches
|
217
206
|
|
218
207
|
```ruby
|
219
|
-
scheduled_match.league_id # Integer, ID of the league
|
208
|
+
scheduled_match.league_id # Integer, ID of the league
|
220
209
|
scheduled_match.game_id # Integer, ID of the game
|
221
210
|
scheduled_match.teams # Array[Dota::API::Team], List of teams who are playing each other
|
222
211
|
scheduled_match.starts_at # Time, When the match is scheduled to start
|
@@ -292,10 +281,14 @@ friend.relationship # String, Relation to the player
|
|
292
281
|
friend.made_at # Time, When the friend was added to the player's friend list
|
293
282
|
```
|
294
283
|
|
295
|
-
##
|
284
|
+
## Resources
|
285
|
+
|
286
|
+
- [Dota 2 WebAPI Wiki](https://wiki.teamfortress.com/wiki/WebAPI#Dota_2) (wiki.teamfortress.com)
|
287
|
+
- [Dota 2 WebAPI Forums](http://dev.dota2.com/forumdisplay.php?f=411) (dev.dota2.com)
|
288
|
+
- [MuppetMaster42's "Things You Should Know Before Starting API Development"](http://dev.dota2.com/showthread.php?t=58317) (dev.dota2.com)
|
289
|
+
|
290
|
+
## License
|
291
|
+
|
292
|
+
Copyright © Vinni Carlo Caños
|
296
293
|
|
297
|
-
|
298
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
299
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
300
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
301
|
-
5. Create a new Pull Request
|
294
|
+
Distributed under the [MIT License](http://www.opensource.org/licenses/MIT).
|
data/data/{items.yml → item.yml}
RENAMED
File without changes
|
data/lib/dota.rb
CHANGED
@@ -3,7 +3,8 @@ require 'yaml'
|
|
3
3
|
require 'dota/configuration'
|
4
4
|
require 'dota/version'
|
5
5
|
|
6
|
-
require 'dota/utils/
|
6
|
+
require 'dota/utils/mapped'
|
7
|
+
require 'dota/utils/inspectable'
|
7
8
|
|
8
9
|
require 'dota/api/entity'
|
9
10
|
|
@@ -40,5 +41,9 @@ module Dota
|
|
40
41
|
def configuration
|
41
42
|
api.configuration
|
42
43
|
end
|
44
|
+
|
45
|
+
def root
|
46
|
+
Gem::Specification.find_by_name("dota").gem_dir
|
47
|
+
end
|
43
48
|
end
|
44
49
|
end
|
data/lib/dota/api/hero.rb
CHANGED
@@ -1,18 +1,14 @@
|
|
1
1
|
module Dota
|
2
2
|
module API
|
3
3
|
class Hero
|
4
|
-
|
4
|
+
include Utilities::Mapped
|
5
5
|
|
6
6
|
attr_reader :id, :name
|
7
7
|
|
8
|
-
def self.all
|
9
|
-
@all ||= MAPPING.keys.map { |id| new(id) }
|
10
|
-
end
|
11
|
-
|
12
8
|
def initialize(id)
|
13
9
|
@id = id
|
14
|
-
@internal_name =
|
15
|
-
@name =
|
10
|
+
@internal_name = mapping[id][0]
|
11
|
+
@name = mapping[id][1]
|
16
12
|
end
|
17
13
|
|
18
14
|
def image_url(type = :full)
|
data/lib/dota/api/item.rb
CHANGED
@@ -1,18 +1,14 @@
|
|
1
1
|
module Dota
|
2
2
|
module API
|
3
3
|
class Item
|
4
|
-
|
4
|
+
include Utilities::Mapped
|
5
5
|
|
6
6
|
attr_reader :id, :name
|
7
7
|
|
8
|
-
def self.all
|
9
|
-
MAPPING.keys.map { |id| new(id) }
|
10
|
-
end
|
11
|
-
|
12
8
|
def initialize(id)
|
13
9
|
@id = id
|
14
|
-
@internal_name =
|
15
|
-
@name =
|
10
|
+
@internal_name = mapping[id][0]
|
11
|
+
@name = mapping[id][1]
|
16
12
|
end
|
17
13
|
|
18
14
|
def image_url(type = :lg)
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Dota
|
2
|
+
module Utilities
|
3
|
+
module Mapped
|
4
|
+
def self.included(base)
|
5
|
+
base.extend ClassMethods
|
6
|
+
|
7
|
+
base.class_eval do
|
8
|
+
def mapping
|
9
|
+
self.class.mapping
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def mapping
|
16
|
+
@mapping ||= begin
|
17
|
+
filename = "#{name.split("::").last.downcase}.yml"
|
18
|
+
path = File.join(Dota.root, "data", filename)
|
19
|
+
YAML.load_file(path).freeze
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def all
|
24
|
+
@all ||= mapping.keys.map { |id| new(id) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/dota/version.rb
CHANGED
data/spec/dota/api/hero_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vinni Carlo Caños
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -152,8 +152,8 @@ files:
|
|
152
152
|
- LICENSE.txt
|
153
153
|
- README.md
|
154
154
|
- Rakefile
|
155
|
-
- data/
|
156
|
-
- data/
|
155
|
+
- data/hero.yml
|
156
|
+
- data/item.yml
|
157
157
|
- dota.gemspec
|
158
158
|
- lib/dota.rb
|
159
159
|
- lib/dota/api/basic_match.rb
|
@@ -175,7 +175,8 @@ files:
|
|
175
175
|
- lib/dota/api/scheduled_match.rb
|
176
176
|
- lib/dota/api/team.rb
|
177
177
|
- lib/dota/configuration.rb
|
178
|
-
- lib/dota/utils/
|
178
|
+
- lib/dota/utils/inspectable.rb
|
179
|
+
- lib/dota/utils/mapped.rb
|
179
180
|
- lib/dota/version.rb
|
180
181
|
- spec/dota/api/cosmetic/rarity_spec.rb
|
181
182
|
- spec/dota/api/friend_spec.rb
|
@@ -223,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
224
|
version: '0'
|
224
225
|
requirements: []
|
225
226
|
rubyforge_project:
|
226
|
-
rubygems_version: 2.
|
227
|
+
rubygems_version: 2.4.5
|
227
228
|
signing_key:
|
228
229
|
specification_version: 4
|
229
230
|
summary: Ruby client for the Dota 2 WebAPI
|