dota 0.0.10 → 0.0.11

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: 5614a7fd9ade0b1abada4e7c16e749673e04f94d
4
- data.tar.gz: 7cd313476bc49a933db85916b7beaff8445eb6b2
3
+ metadata.gz: 9a62df441130d34cd7256896d37e5c526200ab22
4
+ data.tar.gz: 5d7c27f983e4d0691a2e93d33fac19d21c41717c
5
5
  SHA512:
6
- metadata.gz: df17b5190d60affd6f8bd493a9c350c6e681f572325bfe8873546b2826e38e2990fdf52ac0e59accbc95dd32817ddc2276f93db02c0d21ddaf2360f95ae7b7b4
7
- data.tar.gz: a83c8bfe85de2849178501becd1f124b030ac6c3b18f3e966e2fc1ea7baf38352161ec55417cf0eebcad4c72afdfd09b7bcac33ddd8aa037cd944beff77ff4e5
6
+ metadata.gz: 9b13d19087f4d133e1c5ca03963bd7d4e198501bb41406435f1ee91241363a7d5309ef82c76ccd6c01dadec9ea729701bb61b147a6b5877779665c98dc1b59b5
7
+ data.tar.gz: 36ad9a1554a4ca7e2fa974cf1ea793863f141f87aafcc34d66e1e5bb211cf4621cbab7551e8778a8bfccb63fd5f46376067ed233ea7126ed223f3580f0819598
data/README.md CHANGED
@@ -61,40 +61,40 @@ Get your Steam API key [here](http://steamcommunity.com/dev/apikey).
61
61
  ```ruby
62
62
  api = Dota.api
63
63
 
64
- api.heroes(43) # (Cached) A single hero - "Death Prophet"
65
- api.heroes # (Cached) All heroes
64
+ api.heroes(43) # => (Cached) A single hero - "Death Prophet"
65
+ api.heroes # => (Cached) All heroes
66
66
 
67
- api.items(114) # (Cached) A single item - "Heart of Tarrasque"
68
- api.items # (Cached) All items
67
+ api.items(114) # => (Cached) A single item - "Heart of Tarrasque"
68
+ api.items # => (Cached) All items
69
69
 
70
- api.cosmetic_rarities # All cosmetic rarities
70
+ api.cosmetic_rarities # => All cosmetic rarities
71
71
 
72
- api.teams(1375614) # A single team - "Newbee"
73
- api.teams # A list of teams
74
- api.teams(after: 1375614) # Allowed options:
72
+ api.teams(1375614) # => A single team - "Newbee"
73
+ api.teams # => A list of teams
74
+ api.teams(after: 1375614) # Allowed options:
75
75
  #
76
- # :after - Integer, With teams IDs equal or greater than this
77
- # :limit - Integer, Amount of teams to return (default is 100)
76
+ # :after - Integer, With team IDs equal or greater than this
77
+ # :limit - Integer, Amount of teams to return (default is 100)
78
78
 
79
- api.leagues # All leagues
79
+ api.leagues # => All leagues
80
80
 
81
- api.matches(789645621) # A single match - "Newbee vs Vici Gaming"
82
- api.matches # A list of matches
83
- api.matches(hero_id: 43) # Allowed options:
81
+ api.matches(789645621) # => A single match - "Newbee vs Vici Gaming"
82
+ api.matches # => A list of matches
83
+ api.matches(hero_id: 43) # Allowed options:
84
84
  #
85
- # :hero_id - Integer, With this hero. See Dota::API::Hero::MAPPING
86
- # :after - Integer, With match IDs equal or greater than this
87
- # :player_id - Integer, With this player (32-bit Steam ID)
88
- # :league_id - Integer, In this league. Use Dota.leagues to get a list of leagues
89
- # :mode_id - Integer, In this game mode. See Dota::API::Match::MODES
90
- # :skill_level - Integer, In this skill level (ignored if :player_id is provided). See Dota::API::Match::SKILL_LEVELS
91
- # :from - Integer, Minimum timestamp
92
- # :to - Integer, Maximum timestamp
93
- # :min_players - Integer, With at least this number of players
94
- # :league_only - Boolean, Only league matches
95
- # :limit - Integer, Amount of matches to return (default is 100)
96
-
97
- api.friends(76561198052976237) # All friends of user
85
+ # :hero_id - Integer, With this hero. See Dota::API::Hero::MAPPING
86
+ # :after - Integer, With match IDs equal or greater than this
87
+ # :player_id - Integer, With this player (32-bit Steam ID)
88
+ # :league_id - Integer, In this league. Use Dota.leagues to get a list of leagues
89
+ # :mode_id - Integer, In this game mode. See Dota::API::Match::MODES
90
+ # :skill_level - Integer, In this skill level (ignored if :player_id is provided). See Dota::API::Match::SKILL_LEVELS
91
+ # :from - Integer, Minimum timestamp
92
+ # :to - Integer, Maximum timestamp
93
+ # :min_players - Integer, With at least this number of players
94
+ # :league_only - Boolean, Only league matches
95
+ # :limit - Integer, Amount of matches to return (default is 100)
96
+
97
+ api.friends(76561198052976237) # => All friends of user
98
98
  ```
99
99
 
100
100
  #### Custom Requests
@@ -155,51 +155,63 @@ Caveat: Getting a list of matches via `api.matches` will call [GetMatchHistory](
155
155
  When an instance method in a `Dota::API::Match` class returns `nil`, it most likely means the endpoint called doesn't provide it yet.
156
156
 
157
157
  ```ruby
158
- match.id # => 789645621
159
- match.league_id # => 600
160
- match.type # => "Tournament"
161
- match.type_id # => 2
162
- match.mode # => "Captain's Mode"
163
- match.mode_id # => 2
164
- match.drafts # => [Dota::API::Match::Draft, ...]
165
- match.players # => [Dota::API::Match::Player, ...]
166
- match.sequence # => 709365483
167
- match.starts_at # => 2014-07-21 20:12:50 UTC
168
- match.duration # => 908
169
- match.winner # => :radiant
170
- match.first_blood # => 33
171
- match.positive_votes # => 34701
172
- match.negative_votes # => 13291
173
- match.season # => nil
174
- match.players_count # => 10
175
- match.cluster # => 111
176
- match.radiant_tower_status # => 2039
177
- match.dire_tower_status # => 1974
178
- match.radiant_barracks_status # => 63
179
- match.dire_barracks_status # => 63
158
+ match.id # Integer, ID of the match
159
+ match.league_id # Integer, ID of the league this match was a part of
160
+ match.type # String, See Dota::API::Match::TYPES
161
+ match.type_id # Integer, See Dota::API::Match::TYPES
162
+ match.mode # String, See Dota::API::Match::MODES
163
+ match.mode_id # Integer, See Dota::API::Match::MODES
164
+ match.sequence # Integer, A 'sequence number', representing the order in which matches were recorded
165
+ match.season # Integer, Season the match was played in
166
+ match.cluster # Integer, Server cluster the match was played on
167
+ match.drafts # Array[Dota::API::Match::Draft], Picks and bans in the match, if the game mode is "Captains Mode"
168
+ match.players # Array[Dota::API::Match::Player], Players in the match
169
+ match.players_count # Integer, Number of players in the match
170
+ match.starts_at # Time, When the match started
171
+ match.first_blood # Integer, Seconds since the match started when first blood occured
172
+ match.duration # Integer, Length of the match, in seconds since the match began.
173
+ match.winner # Symbol, :radiant or :dire
174
+ match.positive_votes # Integer, Number of thumbs-up the game has received
175
+ match.negative_votes # Integer, Number of thumbs-down the game has received
176
+
177
+ match.radiant_id # Integer, Radiant team's ID
178
+ match.radiant_captain_id # Integer, Radiant captain's ID
179
+ match.radiant_logo_id # Integer, Radiant logo's UGC ID
180
+ match.radiant_name # String, Radiant team's name
181
+ match.radiant_complete? # Boolean, true if the Radiant team's roster is complate
182
+ match.radiant_tower_status # Integer, See https://wiki.teamfortress.com/wiki/WebAPI/GetMatchDetails # Tower_Status
183
+ match.radiant_barracks_status # Integer, See https://wiki.teamfortress.com/wiki/WebAPI/GetMatchDetails # Barracks_Status
184
+
185
+ match.dire_id # Integer, Dire team's ID
186
+ match.dire_captain_id # Integer, Dire captain's ID
187
+ match.dire_logo_id # Integer, Dire logo's UGC ID
188
+ match.dire_name # String, Dire team's name
189
+ match.dire_complete? # Boolean, true if the Dire team's roster is complate
190
+ match.dire_tower_status # Integer, See https://wiki.teamfortress.com/wiki/WebAPI/GetMatchDetails # Tower_Status
191
+ match.dire_barracks_status # Integer, See https://wiki.teamfortress.com/wiki/WebAPI/GetMatchDetails # Barracks_Status
180
192
  ```
181
193
 
182
194
  #### Players
183
195
 
184
196
  ```ruby
185
- player.id # => 98887913
186
- player.hero # => Dota::API::Hero
187
- player.items # => [Dota::API::Item, ...]
188
- player.slot # => 0
189
- player.status # => :played
190
- player.level # => 11
191
- player.kills # => 2
192
- player.deaths # => 1
193
- player.assists # => 13
194
- player.last_hits # => 45
195
- player.denies # => 0
196
- player.gold # => 649
197
- player.gold_spent # => 6670
198
- player.gpm # => 437
199
- player.xpm # => 460
200
- player.hero_damage # => 3577
201
- player.tower_damage # => 153
202
- player.hero_healing # => 526
197
+ player.id # Integer, 32-bit Steam ID
198
+ player.hero # Dota::API::Hero, Player's hero
199
+ player.items # Array[Dota::API::Item], Player's inventory (6 items)
200
+ player.slot # Integer, See https://wiki.teamfortress.com/wiki/WebAPI/GetMatchDetails#Player_Slot
201
+ player.status # Symbol, :played, :left_safe, :abandoned, or :bot
202
+ player.level # Integer, The player's level at match end
203
+ player.kills # Integer, Number of kills attributed to this player
204
+ player.deaths # Integer, Times this player died during the match
205
+ player.assists # Integer, Number of assists the player got
206
+ player.last_hits # Integer, Number of last-hits the player got
207
+ player.denies # Integer, Number of denies the player got
208
+ player.gold # Integer, Amount of gold the player had remaining at the end of the match
209
+ player.gold_spent # Integer, Amount of gold the player spent
210
+ player.gpm # Integer, Player's overall gold/minute
211
+ player.xpm # Integer, Player's overall experience/minute
212
+ player.hero_damage # Integer, Amount of damage the player dealt to heroes
213
+ player.tower_damage # Integer, Amount of damage the player dealt to towers
214
+ player.hero_healing # Integer, Amount of health the player had healed on heroes
203
215
  ```
204
216
 
205
217
  #### Drafts
@@ -208,7 +220,7 @@ player.hero_healing # => 526
208
220
  draft.order # Integer, 1-20
209
221
  draft.pick? # Boolean, true if the draft is a pick, and not a ban
210
222
  draft.team # Symbol, :radiant or :dire
211
- draft.hero # Dota::API::Hero
223
+ draft.hero # Dota::API::Hero, Picked or banned hero
212
224
  ```
213
225
 
214
226
  #### Cosmetic Rarities
@@ -223,9 +235,9 @@ rarity.color # String, The hexadecimal RGB tuple
223
235
  #### Friends
224
236
 
225
237
  ```ruby
226
- friend.id # String, 64-bit Steam ID
227
- friend.relationship # String, Relation to the user
228
- friend.made_at # Time, When the friend was added to the list
238
+ friend.id # Integer, Friend's 64-bit Steam ID
239
+ friend.relationship # String, Relation to the player
240
+ friend.made_at # Time, When the friend was added to the player's friend list
229
241
  ```
230
242
 
231
243
  ## Contributing
@@ -10,7 +10,7 @@ module Dota
10
10
  end
11
11
 
12
12
  def id
13
- raw["steamid"]
13
+ raw["steamid"].to_i
14
14
  end
15
15
 
16
16
  def relationship
@@ -141,6 +141,46 @@ module Dota
141
141
  def dire_barracks_status
142
142
  raw["barracks_status_dire"]
143
143
  end
144
+
145
+ def radiant_id
146
+ raw["radiant_team_id"]
147
+ end
148
+
149
+ def radiant_name
150
+ raw["radiant_name"]
151
+ end
152
+
153
+ def radiant_logo_id
154
+ raw["radiant_logo"]
155
+ end
156
+
157
+ def radiant_complete?
158
+ raw["radiant_team_complete"] == 1
159
+ end
160
+
161
+ def radiant_captain_id
162
+ raw["radiant_captain"]
163
+ end
164
+
165
+ def dire_id
166
+ raw["dire_team_id"]
167
+ end
168
+
169
+ def dire_name
170
+ raw["dire_name"]
171
+ end
172
+
173
+ def dire_logo_id
174
+ raw["dire_logo"]
175
+ end
176
+
177
+ def dire_complete?
178
+ raw["dire_team_complete"] == 1
179
+ end
180
+
181
+ def dire_captain_id
182
+ raw["dire_captain"]
183
+ end
144
184
  end
145
185
  end
146
186
  end
data/lib/dota/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dota
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -6,7 +6,7 @@ describe Dota::API::Friend do
6
6
  end
7
7
 
8
8
  specify "#id" do
9
- expect(friend.id).to eq "76561197992246166"
9
+ expect(friend.id).to eq 76561197992246166
10
10
  end
11
11
 
12
12
  specify "#relationship" do
@@ -96,4 +96,44 @@ describe Dota::API::Match do
96
96
  specify "#dire_barracks_status" do
97
97
  expect(match.dire_barracks_status).to eq 63
98
98
  end
99
+
100
+ specify "#radiant_id" do
101
+ expect(match.radiant_id).to eq 1375614
102
+ end
103
+
104
+ specify "#radiant_name" do
105
+ expect(match.radiant_name).to eq "Newbee"
106
+ end
107
+
108
+ specify "#radiant_logo_id" do
109
+ expect(match.radiant_logo_id).to eq 794064971723724234
110
+ end
111
+
112
+ specify "#radiant_complete?" do
113
+ expect(match.radiant_complete?).to eq true
114
+ end
115
+
116
+ specify "#radiant_captain_id" do
117
+ expect(match.radiant_captain_id).to eq 98887913
118
+ end
119
+
120
+ specify "#dire_id" do
121
+ expect(match.dire_id).to eq 726228
122
+ end
123
+
124
+ specify "#dire_name" do
125
+ expect(match.dire_name).to eq "Vici Gaming"
126
+ end
127
+
128
+ specify "#dire_logo_id" do
129
+ expect(match.dire_logo_id).to eq 34096951715893495
130
+ end
131
+
132
+ specify "#dire_complete?" do
133
+ expect(match.dire_complete?).to eq true
134
+ end
135
+
136
+ specify "#dire_captain_id" do
137
+ expect(match.dire_captain_id).to eq 91698091
138
+ end
99
139
  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.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinni Carlo Caños