dota 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/README.md +9 -7
- data/data/ability.yml +41 -1
- data/data/item.yml +91 -34
- data/dota.gemspec +1 -0
- data/lib/dota.rb +1 -0
- data/lib/dota/api/basic_side.rb +47 -0
- data/lib/dota/api/item.rb +5 -2
- data/lib/dota/api/live_match/side.rb +7 -11
- data/lib/dota/api/match/side.rb +8 -12
- data/lib/dota/version.rb +1 -1
- data/spec/dota/api/ability_spec.rb +2 -2
- data/spec/dota/api/item_spec.rb +1 -1
- data/spec/dota/api/live_match/side_spec.rb +43 -4
- data/spec/dota/api/match/ability_upgrade_spec.rb +2 -2
- data/spec/dota/api/match/draft_spec.rb +1 -1
- data/spec/dota/api/match/player_spec.rb +17 -17
- data/spec/dota/api/match/side_spec.rb +51 -13
- data/spec/dota/api/match/unit_spec.rb +4 -4
- data/spec/dota/api/match_spec.rb +11 -11
- data/spec/dota_spec.rb +1 -1
- data/spec/fixtures/vcr_cassettes/GetMatchDetails.yml +331 -219
- data/spec/spec_helper.rb +4 -1
- data/spec/support/vcr.rb +1 -0
- metadata +17 -4
- data/spec/fixtures/vcr_cassettes/GetMatchDetailsUnits.yml +0 -276
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ff7c49731de8c4814a4135dff2de240853f733f
|
4
|
+
data.tar.gz: 90c8a81064bde49c0e540f9b001ab1c571fbd126
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba9aa6924b85bd9bcca501f3b9c2ab7140a4f5c3cf12ac5a9bed7c802c061f4bd569311b66cfbc1387a139b2a8e9b9718b63fa6a9ae05ec12db980325e38e861
|
7
|
+
data.tar.gz: 1d307e7401ac6b70b3ddf1f1f1d7d7d04742148fa7d40beec0475f557c97d422747090a4f35615f5d2c929ab2575163eac8b5cd0b33e9e75d3611d7ba7457b79
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
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)
|
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) [![Code Climate](https://codeclimate.com/github/vinnicc/dota/badges/gpa.svg)](https://codeclimate.com/github/vinnicc/dota) [![Test Coverage](https://codeclimate.com/github/vinnicc/dota/badges/coverage.svg)](https://codeclimate.com/github/vinnicc/dota/coverage)
|
2
2
|
|
3
3
|
`dota` is a Ruby client for the [Dota 2 WebAPI](https://wiki.teamfortress.com/wiki/WebAPI#Dota_2).
|
4
4
|
|
@@ -219,14 +219,16 @@ scheduled_match.final? # Boolean, true if the game is the last of the serie
|
|
219
219
|
#### Sides - Radiant/Dire
|
220
220
|
|
221
221
|
```ruby
|
222
|
-
radiant.id
|
223
|
-
radiant.logo_id
|
224
|
-
radiant.name
|
225
|
-
radiant.complete?
|
226
|
-
radiant.players
|
222
|
+
radiant.id # Integer, Team's ID
|
223
|
+
radiant.logo_id # Integer, Team logo's UGC ID
|
224
|
+
radiant.name # String, Team's name
|
225
|
+
radiant.complete? # Boolean, true if the team's roster is complete
|
226
|
+
radiant.players # Array[Dota::API::Match::Player|Dota::API::LiveMatch::Player], Players in the match
|
227
|
+
radiant.tower_status # Hash, Status of team's towers (`true` - tower is standing, `false` - tower is destroyed)
|
228
|
+
radiant.barracks_status # Hash, Status of team's barracks (`true` - barrack is standing, `false` - barrack is destroyed)
|
227
229
|
|
228
230
|
# Additional methods in Match::Side
|
229
|
-
radiant.captain_id
|
231
|
+
radiant.captain_id # Integer, Team captain's 32-bit Steam ID
|
230
232
|
|
231
233
|
# Additional methods in LiveMatch::Side
|
232
234
|
radiant.score # Integer, The team's current score
|
data/data/ability.yml
CHANGED
@@ -1874,6 +1874,10 @@
|
|
1874
1874
|
- wisp_tether_break
|
1875
1875
|
- Tether Break
|
1876
1876
|
- Wisp Tether Break
|
1877
|
+
5490:
|
1878
|
+
- wisp_spirits_in
|
1879
|
+
- Spirits In
|
1880
|
+
- Wisp Spirits In
|
1877
1881
|
5491:
|
1878
1882
|
- forest_troll_high_priest_mana_aura
|
1879
1883
|
- Troll High Priest Mana Aura
|
@@ -1882,6 +1886,10 @@
|
|
1882
1886
|
- courier_go_to_secretshop
|
1883
1887
|
- Go To Secret Shop
|
1884
1888
|
- Courier Go To Secret Shop
|
1889
|
+
5493:
|
1890
|
+
- wisp_spirits_out
|
1891
|
+
- Spirits Out
|
1892
|
+
- Wisp Spirits Out
|
1885
1893
|
5494:
|
1886
1894
|
- slark_dark_pact
|
1887
1895
|
- Dark Pact
|
@@ -2222,6 +2230,10 @@
|
|
2222
2230
|
- oracle_false_promise
|
2223
2231
|
- False Promise
|
2224
2232
|
- Oracle False Promise
|
2233
|
+
5641:
|
2234
|
+
- tusk_launch_snowball
|
2235
|
+
- Launch Showball
|
2236
|
+
- Tusk Launch Showball
|
2225
2237
|
5651:
|
2226
2238
|
- winter_wyvern_arctic_burn
|
2227
2239
|
- Arctic Burn
|
@@ -2237,4 +2249,32 @@
|
|
2237
2249
|
5654:
|
2238
2250
|
- winter_wyvern_winters_curse
|
2239
2251
|
- Winters Curse
|
2240
|
-
- Winter Wyvern Winters Curse
|
2252
|
+
- Winter Wyvern Winters Curse
|
2253
|
+
5655:
|
2254
|
+
- life_stealer_control
|
2255
|
+
- Control
|
2256
|
+
- Life Stealer Control
|
2257
|
+
5666:
|
2258
|
+
- nyx_assassin_burrow
|
2259
|
+
- Burrow
|
2260
|
+
- Nyx Assassin Burrow
|
2261
|
+
5671:
|
2262
|
+
- life_stealer_assimilate
|
2263
|
+
- Assimilate
|
2264
|
+
- Life Stealer Assimilate
|
2265
|
+
5672:
|
2266
|
+
- tusk_walrus_kick
|
2267
|
+
- Walrus Kick
|
2268
|
+
- Tusk Walrus Kick
|
2269
|
+
5673:
|
2270
|
+
- nyx_assassin_unburrow
|
2271
|
+
- Unburrow
|
2272
|
+
- Nyx Assassin Unburrow
|
2273
|
+
5674:
|
2274
|
+
- morphling_hybrid
|
2275
|
+
- Hybrid
|
2276
|
+
- Morphling Hybrid
|
2277
|
+
5675:
|
2278
|
+
- life_stealer_assimilate_eject
|
2279
|
+
- Eject
|
2280
|
+
- Life Stealer Eject
|
data/data/item.yml
CHANGED
@@ -641,74 +641,131 @@
|
|
641
641
|
- shadow_amulet
|
642
642
|
- Shadow Amulet
|
643
643
|
216:
|
644
|
+
- enchanted_mango
|
645
|
+
- Enchanted Mango
|
646
|
+
217:
|
647
|
+
- recipe_ward_dispenser
|
648
|
+
- Recipe: Ward Dispenser
|
649
|
+
218:
|
650
|
+
- ward_dispenser
|
651
|
+
- Ward Dispenser
|
652
|
+
219:
|
653
|
+
- recipe_travel_boots_2
|
654
|
+
- Recipe: Upgraded Boots of Travel
|
655
|
+
220:
|
656
|
+
- travel_boots_2
|
657
|
+
- Upgraded Boots of Travel
|
658
|
+
221:
|
659
|
+
- recipe_lotus_orb
|
660
|
+
- Recipe: Lotus Orb
|
661
|
+
226:
|
662
|
+
- lotus_orb
|
663
|
+
- Lotus Orb
|
664
|
+
227:
|
665
|
+
- recipe_solar_crest
|
666
|
+
- Recipe: Solar Crest
|
667
|
+
228:
|
668
|
+
- recipe_octarine_core
|
669
|
+
- Recipe: Octarine Core
|
670
|
+
229:
|
671
|
+
- solar_crest
|
672
|
+
- Solar Crest
|
673
|
+
230:
|
674
|
+
- recipe_guardian_greaves
|
675
|
+
- Recipe: Guardian Greaves
|
676
|
+
231:
|
677
|
+
- guardian_greaves
|
678
|
+
- Guardian Greaves
|
679
|
+
235:
|
680
|
+
- octarine_core
|
681
|
+
- Octarine Core
|
682
|
+
241:
|
683
|
+
- tango_single
|
684
|
+
- Tango (Shared)
|
685
|
+
242:
|
686
|
+
- crimson_guard
|
687
|
+
- Crimson Guard
|
688
|
+
243:
|
689
|
+
- recipe_crimson_guard
|
690
|
+
- Recipe: Crimson Guard
|
691
|
+
246:
|
692
|
+
- recipe_moon_shard
|
693
|
+
- Recipe: Moon Shard
|
694
|
+
247:
|
695
|
+
- moon_shard
|
696
|
+
- Moon Shard
|
697
|
+
248:
|
698
|
+
- recipe_silver_edge
|
699
|
+
- Recipe: Silver Edge
|
700
|
+
249:
|
701
|
+
- silver_edge
|
702
|
+
- Silver Edge
|
703
|
+
253:
|
704
|
+
- recipe_glimmer_cape
|
705
|
+
- Recipe: Glimmer Cape
|
706
|
+
254:
|
707
|
+
- glimmer_cape
|
708
|
+
- Glimmer Cape
|
709
|
+
1000:
|
644
710
|
- halloween_candy_corn
|
645
711
|
- Greevil Taffy
|
646
|
-
|
712
|
+
1001:
|
647
713
|
- mystery_hook
|
648
714
|
- DOTA_Tooltip_Ability_item_mystery_hook
|
649
|
-
|
715
|
+
1002:
|
650
716
|
- mystery_arrow
|
651
717
|
- DOTA_Tooltip_Ability_item_mystery_arrow
|
652
|
-
|
718
|
+
1003:
|
653
719
|
- mystery_missile
|
654
720
|
- DOTA_Tooltip_Ability_item_mystery_missile
|
655
|
-
|
721
|
+
1004:
|
656
722
|
- mystery_toss
|
657
723
|
- DOTA_Tooltip_Ability_item_mystery_toss
|
658
|
-
|
724
|
+
1005:
|
659
725
|
- mystery_vacuum
|
660
726
|
- DOTA_Tooltip_Ability_item_mystery_vacuum
|
661
|
-
|
727
|
+
1006:
|
662
728
|
- halloween_rapier
|
663
729
|
- DOTA_Tooltip_Ability_item_halloween_rapier
|
664
|
-
|
665
|
-
- present
|
666
|
-
- A Gift!
|
667
|
-
228:
|
730
|
+
1007:
|
668
731
|
- greevil_whistle
|
669
732
|
- Greevil Whistle
|
670
|
-
|
733
|
+
1008:
|
734
|
+
- greevil_whistle_toggle
|
735
|
+
- Greevil Whistle
|
736
|
+
1009:
|
737
|
+
- present
|
738
|
+
- A Gift!
|
739
|
+
1010:
|
671
740
|
- winter_stocking
|
672
741
|
- Xmas Stocking
|
673
|
-
|
742
|
+
1011:
|
674
743
|
- winter_skates
|
675
744
|
- Speed Skates
|
676
|
-
|
745
|
+
1012:
|
677
746
|
- winter_cake
|
678
747
|
- Fruit-bit Cake
|
679
|
-
|
748
|
+
1013:
|
680
749
|
- winter_cookie
|
681
750
|
- Wizard Cookie
|
682
|
-
|
751
|
+
1014:
|
683
752
|
- winter_coco
|
684
753
|
- Cocoa with Marshmallows
|
685
|
-
|
754
|
+
1015:
|
686
755
|
- winter_ham
|
687
756
|
- Clove Studded Ham
|
688
|
-
|
689
|
-
- greevil_whistle_toggle
|
690
|
-
- Greevil Whistle
|
691
|
-
236:
|
757
|
+
1016:
|
692
758
|
- winter_kringle
|
693
759
|
- Kringle
|
694
|
-
|
760
|
+
1017:
|
695
761
|
- winter_mushroom
|
696
762
|
- Snow Mushroom
|
697
|
-
|
763
|
+
1018:
|
698
764
|
- winter_greevil_treat
|
699
765
|
- Greevil Treat
|
700
|
-
|
766
|
+
1019:
|
701
767
|
- winter_greevil_garbage
|
702
768
|
- Greevil Chow
|
703
|
-
|
769
|
+
1020:
|
704
770
|
- winter_greevil_chewy
|
705
|
-
- Greevil Blink Bone
|
706
|
-
241:
|
707
|
-
- tango_single
|
708
|
-
- Tango (Shared)
|
709
|
-
242:
|
710
|
-
- crimson_guard
|
711
|
-
- Crimson Guard
|
712
|
-
243:
|
713
|
-
- recipe_crimson_guard
|
714
|
-
- Recipe: Crimson Guard
|
771
|
+
- Greevil Blink Bone
|
data/dota.gemspec
CHANGED
data/lib/dota.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
module Dota
|
2
|
+
module API
|
3
|
+
class BasicSide < Entity
|
4
|
+
TOWERS = [
|
5
|
+
:ancient_top,
|
6
|
+
:ancient_bottom,
|
7
|
+
:bottom_tier_3,
|
8
|
+
:bottom_tier_2,
|
9
|
+
:bottom_tier_1,
|
10
|
+
:middle_tier_3,
|
11
|
+
:middle_tier_2,
|
12
|
+
:middle_tier_1,
|
13
|
+
:top_tier_3,
|
14
|
+
:top_tier_2,
|
15
|
+
:top_tier_1
|
16
|
+
].freeze
|
17
|
+
|
18
|
+
BARRACKS = [
|
19
|
+
:bottom_ranged,
|
20
|
+
:bottom_melee,
|
21
|
+
:middle_ranged,
|
22
|
+
:middle_melee,
|
23
|
+
:top_ranged,
|
24
|
+
:top_melee
|
25
|
+
].freeze
|
26
|
+
|
27
|
+
def id
|
28
|
+
raw["team_id"]
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def format_status(obj, type)
|
34
|
+
target = (type == :barracks ? BARRACKS : TOWERS)
|
35
|
+
# Convert to binary
|
36
|
+
# Leading zeros are stripped, so add them manually
|
37
|
+
obj = obj.to_s(2).rjust(target.length, '0')
|
38
|
+
|
39
|
+
status = {}
|
40
|
+
target.each_with_index do |position, i|
|
41
|
+
status[position] = (obj[i] == '1')
|
42
|
+
end
|
43
|
+
status
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/dota/api/item.rb
CHANGED
@@ -15,8 +15,11 @@ module Dota
|
|
15
15
|
# Possible values for type:
|
16
16
|
# :lg - 85x64 PNG image
|
17
17
|
# :eg - 27x20 PNG image
|
18
|
-
|
19
|
-
|
18
|
+
if internal_name =~ /\Arecipe/
|
19
|
+
"http://cdn.dota2.com/apps/dota2/images/items/recipe_#{type}.png"
|
20
|
+
else
|
21
|
+
"http://cdn.dota2.com/apps/dota2/images/items/#{internal_name}_#{type}.png"
|
22
|
+
end
|
20
23
|
end
|
21
24
|
|
22
25
|
private
|
@@ -1,11 +1,7 @@
|
|
1
1
|
module Dota
|
2
2
|
module API
|
3
3
|
class LiveMatch
|
4
|
-
class Side <
|
5
|
-
def id
|
6
|
-
raw["team_id"]
|
7
|
-
end
|
8
|
-
|
4
|
+
class Side < BasicSide
|
9
5
|
def name
|
10
6
|
raw["team_name"]
|
11
7
|
end
|
@@ -19,26 +15,26 @@ module Dota
|
|
19
15
|
end
|
20
16
|
|
21
17
|
def tower_status
|
22
|
-
raw["tower_state"]
|
18
|
+
format_status raw["tower_state"], :towers
|
23
19
|
end
|
24
20
|
|
25
21
|
def barracks_status
|
26
|
-
raw["barracks_state"]
|
22
|
+
format_status raw["barracks_state"], :barracks
|
27
23
|
end
|
28
24
|
|
29
25
|
def series_wins
|
30
26
|
raw["series_wins"]
|
31
27
|
end
|
32
28
|
|
29
|
+
def score
|
30
|
+
raw["score"]
|
31
|
+
end
|
32
|
+
|
33
33
|
def players
|
34
34
|
raw["players"].map do |raw_player|
|
35
35
|
Player.new(raw_player)
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
39
|
-
def score
|
40
|
-
raw["score"]
|
41
|
-
end
|
42
38
|
end
|
43
39
|
end
|
44
40
|
end
|
data/lib/dota/api/match/side.rb
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
module Dota
|
2
2
|
module API
|
3
3
|
class Match
|
4
|
-
class Side <
|
5
|
-
def id
|
6
|
-
raw["team_id"]
|
7
|
-
end
|
8
|
-
|
4
|
+
class Side < BasicSide
|
9
5
|
def name
|
10
6
|
raw["name"]
|
11
7
|
end
|
@@ -19,11 +15,15 @@ module Dota
|
|
19
15
|
end
|
20
16
|
|
21
17
|
def tower_status
|
22
|
-
raw["tower_status"]
|
18
|
+
format_status raw["tower_status"], :towers
|
23
19
|
end
|
24
20
|
|
25
21
|
def barracks_status
|
26
|
-
raw["barracks_status"]
|
22
|
+
format_status raw["barracks_status"], :barracks
|
23
|
+
end
|
24
|
+
|
25
|
+
def captain_id
|
26
|
+
raw["captain"]
|
27
27
|
end
|
28
28
|
|
29
29
|
def players
|
@@ -31,11 +31,7 @@ module Dota
|
|
31
31
|
Player.new(raw_player)
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
35
|
-
def captain_id
|
36
|
-
raw["captain"]
|
37
|
-
end
|
38
34
|
end
|
39
35
|
end
|
40
36
|
end
|
41
|
-
end
|
37
|
+
end
|