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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adb79effd365cfddfeccab6653bc8ebeaa17b448
4
- data.tar.gz: 866ea82ef3fb0f8e44e053c6bbcb4b4912d226c2
3
+ metadata.gz: 6c0e4caa6d634db5ba4d35b82acb4582384ce963
4
+ data.tar.gz: c1a00ca1d4afc08dfc37b2ab80e5fa18695720f8
5
5
  SHA512:
6
- metadata.gz: 1628d277437c89febddd92971c60284e4617eb04eb3a9cc50f9f235fe7b5572b7ab96ff996a0c11967e91eb3888c3fc673e5b18fe9d35c07801f4d2c2fc34738
7
- data.tar.gz: f0d9529ab46fa3adc765faa8df0c455857c910d3d3867c60110c5bcd11247370514d847a6d6fdad7b5d7bd0c3f4e87720c1b2994cb60acb7bb8b52107e69daf1
6
+ metadata.gz: 91426673b41ecbebdb84a66d640b9d46debf98206d4b6686080717a67678d6eeca155cd26e39aab9d0042cd484bcbadd8ca6cd1111ed294ddbefb073dad0beb2
7
+ data.tar.gz: aa2c2e18dea696d7be459fb45ab89fd0ec3182c54bf18812ef1d0b57196a2c58fce9ce9662a773c68cab751b5800ca0e7ed482b3129a9c6c5a8486dffbf03536
data/README.md CHANGED
@@ -1,36 +1,23 @@
1
1
  # Dota [![Gem Version](https://badge.fury.io/rb/dota.svg)](http://badge.fury.io/rb/dota) [![Build Status](https://travis-ci.org/vinnicc/dota.svg?branch=master)](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). It provides an easy way to access matches, players, heroes, items, and other public Dota 2 objects in an opinionated manner.
3
+ `dota` is a Ruby client for the [Dota 2 WebAPI](https://wiki.teamfortress.com/wiki/WebAPI#Dota_2).
4
4
 
5
- Currently supported endpoints:
5
+ ## Requests
6
6
 
7
- - [GetLeagueListing](https://wiki.teamfortress.com/wiki/WebAPI/GetLeagueListing)
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
- This gem is in alpha, keep that in mind when upgrading.
21
-
22
- ## TODO
9
+ - GetLeagueListing
10
+ - GetMatchDetails
11
+ - GetMatchHistory
12
+ - GetFriendList
13
+ - GetHeroes
14
+ - GetGameItems
15
+ - GetRarities
16
+ - GetTeamInfoByTeamID
17
+ - GetLiveLeagueGames
18
+ - GetScheduledLeagueGames
23
19
 
24
- - Support for more endpoints
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
- Get your Steam API key [here](http://steamcommunity.com/dev/apikey).
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
- ## Contributing
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
- 1. [Fork it!](https://github.com/vinnicc/dota/fork)
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).
@@ -325,3 +325,6 @@
325
325
  111:
326
326
  - oracle
327
327
  - Oracle
328
+ 112:
329
+ - winter_wyvern
330
+ - Winter Wyvern
File without changes
@@ -3,7 +3,8 @@ require 'yaml'
3
3
  require 'dota/configuration'
4
4
  require 'dota/version'
5
5
 
6
- require 'dota/utils/inspect'
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
@@ -1,18 +1,14 @@
1
1
  module Dota
2
2
  module API
3
3
  class Hero
4
- MAPPING = YAML.load_file("data/heroes.yml").freeze
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 = MAPPING[id][0]
15
- @name = MAPPING[id][1]
10
+ @internal_name = mapping[id][0]
11
+ @name = mapping[id][1]
16
12
  end
17
13
 
18
14
  def image_url(type = :full)
@@ -1,18 +1,14 @@
1
1
  module Dota
2
2
  module API
3
3
  class Item
4
- MAPPING = YAML.load_file("data/items.yml").freeze
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 = MAPPING[id][0]
15
- @name = MAPPING[id][1]
10
+ @internal_name = mapping[id][0]
11
+ @name = mapping[id][1]
16
12
  end
17
13
 
18
14
  def image_url(type = :lg)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Dota
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
@@ -4,7 +4,7 @@ describe Dota::API::Hero do
4
4
  specify ".all" do
5
5
  heroes = described_class.all
6
6
  expect(heroes.first).to be_a described_class
7
- expect(heroes.count).to eq 109
7
+ expect(heroes.count).to eq 110
8
8
  end
9
9
 
10
10
  specify "#id" do
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.14
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-01-12 00:00:00.000000000 Z
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/heroes.yml
156
- - data/items.yml
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/inspect.rb
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.2.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