lol_api 1.0.0

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.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.guardfile +11 -0
  4. data/.travis.yml +6 -0
  5. data/Gemfile +10 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +29 -0
  8. data/Rakefile +10 -0
  9. data/lib/lol_api/client.rb +105 -0
  10. data/lib/lol_api/configuration.rb +15 -0
  11. data/lib/lol_api/connection.rb +32 -0
  12. data/lib/lol_api/types/champion.rb +95 -0
  13. data/lib/lol_api/types/dtos/image.rb +33 -0
  14. data/lib/lol_api/types/dtos/info.rb +25 -0
  15. data/lib/lol_api/types/dtos/participant.rb +419 -0
  16. data/lib/lol_api/types/dtos/participant_identity.rb +19 -0
  17. data/lib/lol_api/types/dtos/passive.rb +27 -0
  18. data/lib/lol_api/types/dtos/player.rb +22 -0
  19. data/lib/lol_api/types/dtos/recommended.rb +38 -0
  20. data/lib/lol_api/types/dtos/skin.rb +20 -0
  21. data/lib/lol_api/types/dtos/spell.rb +98 -0
  22. data/lib/lol_api/types/dtos/stat.rb +19 -0
  23. data/lib/lol_api/types/dtos/team.rb +57 -0
  24. data/lib/lol_api/types/dtos/timeline.rb +180 -0
  25. data/lib/lol_api/types/history_match.rb +61 -0
  26. data/lib/lol_api/types/item.rb +126 -0
  27. data/lib/lol_api/types/mastery.rb +39 -0
  28. data/lib/lol_api/types/match.rb +43 -0
  29. data/lib/lol_api/types/summoner.rb +26 -0
  30. data/lib/lol_api/types/summoner_masteries.rb +66 -0
  31. data/lib/lol_api/types/summoner_runes.rb +69 -0
  32. data/lib/lol_api/utils/inspectable.rb +10 -0
  33. data/lib/lol_api/version.rb +3 -0
  34. data/lib/lol_api.rb +12 -0
  35. data/lol_api.gemspec +29 -0
  36. data/spec/champion_spec.rb +48 -0
  37. data/spec/client_spec.rb +67 -0
  38. data/spec/delegation_spec.rb +5 -0
  39. data/spec/factories.rb +43 -0
  40. data/spec/fixtures/champion.json +843 -0
  41. data/spec/fixtures/history.json +127 -0
  42. data/spec/fixtures/item.json +62 -0
  43. data/spec/fixtures/mastery.json +25 -0
  44. data/spec/fixtures/match.json +12167 -0
  45. data/spec/fixtures/match_details.json +13548 -0
  46. data/spec/fixtures/summoner.json +7 -0
  47. data/spec/fixtures/summoner_masteries.json +143 -0
  48. data/spec/fixtures/summoner_runes.json +132 -0
  49. data/spec/history_spec.rb +280 -0
  50. data/spec/item_spec.rb +96 -0
  51. data/spec/mastery_spec.rb +27 -0
  52. data/spec/match_details_spec.rb +72 -0
  53. data/spec/participant_spec.rb +153 -0
  54. data/spec/participant_timeline_spec.rb +80 -0
  55. data/spec/spec_helper.rb +22 -0
  56. data/spec/summoner_spec.rb +120 -0
  57. data/spec/team_spec.rb +38 -0
  58. data/spec/timeline_spec.rb +101 -0
  59. metadata +236 -0
@@ -0,0 +1,72 @@
1
+ require 'spec_helper'
2
+
3
+ describe LolApi::HistoryMatch do
4
+ before do
5
+ @match = FactoryGirl.build(:match)
6
+ end
7
+ subject { @match }
8
+
9
+ it { should be_kind_of(LolApi::Match)}
10
+ it { should respond_to(:map_id) }
11
+ it { should respond_to(:match_creation) }
12
+ it { should respond_to(:match_duration) }
13
+ it { should respond_to(:match_type) }
14
+ it { should respond_to(:match_mode) }
15
+ it { should respond_to(:match_id) }
16
+ it { should respond_to(:match_version) }
17
+ it { should respond_to(:participant_identities) }
18
+ it { should respond_to(:participants) }
19
+ it { should respond_to(:queue_type) }
20
+ it { should respond_to(:region) }
21
+ it { should respond_to(:season) }
22
+ it { should respond_to(:teams) }
23
+ it { should respond_to(:timeline) }
24
+
25
+ describe "should return" do
26
+ its(:map_id) { should eq 1 }
27
+ its(:match_creation) { should eq 1403301139393 }
28
+ its(:match_duration) { should eq 2615 }
29
+ its(:match_type){ should eq "MATCHED_GAME" }
30
+ its(:match_mode){ should eq "CLASSIC" }
31
+ its(:match_id) { should eq 1535572376 }
32
+ its(:match_version) { should eq "4.10.0.379" }
33
+ its(:participant_identities) { should_not be_empty}
34
+ its(:participants) { should_not be_empty }
35
+ its(:queue_type) { should eq "RANKED_SOLO_5x5" }
36
+ its(:region) { should eq "EUW" }
37
+ its(:season) { should eq "SEASON2014" }
38
+ its(:teams) { should_not be_empty }
39
+ its(:timeline) { should be_kind_of(LolApi::Timeline) }
40
+ end
41
+ describe "participant identites" do
42
+ subject { @match.participant_identities.first }
43
+
44
+ describe "should respond to" do
45
+ it { should respond_to(:participant_id) }
46
+ it { should respond_to(:player) }
47
+ end
48
+
49
+ describe "must return" do
50
+ its(:participant_id) { should eq 1 }
51
+ its(:player) { should be_kind_of(LolApi::Player) }
52
+ end
53
+
54
+ describe "participant player" do
55
+ subject { @match.participant_identities[0].player }
56
+
57
+ describe "should respond to" do
58
+ it { should respond_to(:match_history_uri) }
59
+ it { should respond_to(:profile_icon) }
60
+ it { should respond_to(:summoner_name) }
61
+ end
62
+
63
+ describe "must return" do
64
+ its(:match_history_uri) { should eq "/v1/stats/player_history/EUW1/25448172" }
65
+ its(:profile_icon) { should eq 588}
66
+ its(:summoner_name) { should eq "alexroswel" }
67
+ end
68
+ end
69
+ end
70
+
71
+
72
+ end
@@ -0,0 +1,153 @@
1
+ require 'spec_helper'
2
+
3
+ describe LolApi::Participant do
4
+
5
+ before do
6
+ @match = FactoryGirl.build(:match)
7
+ end
8
+ subject(:participant) { @match.participants.first }
9
+
10
+ it { should be_kind_of(LolApi::Participant)}
11
+ it { should respond_to(:champion_id) }
12
+ it { should respond_to(:masteries) }
13
+ it { should respond_to(:participant_id) }
14
+ it { should respond_to(:runes) }
15
+ it { should respond_to(:spell_1) }
16
+ it { should respond_to(:spell_2) }
17
+ it { should respond_to(:stats) }
18
+ it { should respond_to(:team_id) }
19
+ it { should respond_to(:timeline) }
20
+
21
+ describe "should return" do
22
+ its(:champion_id) { should eq 157 }
23
+ its(:masteries) { should eq nil }
24
+ its(:participant_id) { should eq 1 }
25
+ its(:runes) { should eq nil }
26
+ its(:spell_1) { should eq 12 }
27
+ its(:spell_2) { should eq 4 }
28
+ its(:stats) { should be_kind_of(LolApi::ParticipantStats) }
29
+ its(:team_id) { should eq 100 }
30
+ its(:timeline) { should be_kind_of(LolApi::ParticipantTimeline) }
31
+ end
32
+
33
+ describe "stats" do
34
+ subject { participant.stats }
35
+
36
+ it { should respond_to(:assists) }
37
+ it { should respond_to(:champ_level) }
38
+ it { should respond_to(:combat_player_score) }
39
+ it { should respond_to(:deaths) }
40
+ it { should respond_to(:double_kills) }
41
+ it { should respond_to(:first_blood_assist) }
42
+ it { should respond_to(:first_blood_kill) }
43
+ it { should respond_to(:first_inhibitor_assist) }
44
+ it { should respond_to(:first_inhibitor_kill) }
45
+ it { should respond_to(:first_tower_assist) }
46
+ it { should respond_to(:first_tower_kill) }
47
+ it { should respond_to(:gold_earned) }
48
+ it { should respond_to(:gold_spent) }
49
+ it { should respond_to(:inhibitor_kills) }
50
+ it { should respond_to(:inventory) }
51
+ it { should respond_to(:killing_sprees) }
52
+ it { should respond_to(:kills) }
53
+ it { should respond_to(:largest_crit) }
54
+ it { should respond_to(:largest_killing_spree) }
55
+ it { should respond_to(:largest_multi_kill) }
56
+ it { should respond_to(:magic_damage_dealt) }
57
+ it { should respond_to(:magic_damage_dealt_to_chanpions) }
58
+ it { should respond_to(:magic_damage_taken) }
59
+ it { should respond_to(:minions_killed) }
60
+ it { should respond_to(:neutral_minions_killed) }
61
+ it { should respond_to(:netural_minions_killed_enemy_jungle) }
62
+ it { should respond_to(:netural_minions_killed_team_jungle) }
63
+ it { should respond_to(:node_capture) }
64
+ it { should respond_to(:node_capture_assist) }
65
+ it { should respond_to(:node_neutralize) }
66
+ it { should respond_to(:objective_player_score) }
67
+ it { should respond_to(:penta_kills) }
68
+ it { should respond_to(:physical_damage_dealt) }
69
+ it { should respond_to(:physical_damage_dealt_to_champions) }
70
+ it { should respond_to(:physical_damage_taken) }
71
+ it { should respond_to(:quadra_kills) }
72
+ it { should respond_to(:sight_wards_bought) }
73
+ it { should respond_to(:team_objective) }
74
+ it { should respond_to(:total_damage_dealt) }
75
+ it { should respond_to(:total_damage_dealt_to_champions) }
76
+ it { should respond_to(:total_damage_taken) }
77
+ it { should respond_to(:total_heal) }
78
+ it { should respond_to(:total_player_score) }
79
+ it { should respond_to(:total_score_rank) }
80
+ it { should respond_to(:total_time_crowd_control_dealt) }
81
+ it { should respond_to(:total_units_healed) }
82
+ it { should respond_to(:tower_kills) }
83
+ it { should respond_to(:triple_kills) }
84
+ it { should respond_to(:true_damage_dealt) }
85
+ it { should respond_to(:true_damage_dealt_to_champions) }
86
+ it { should respond_to(:true_damage_taken) }
87
+ it { should respond_to(:unreal_kills) }
88
+ it { should respond_to(:vision_wards_bought) }
89
+ it { should respond_to(:wards_killed) }
90
+ it { should respond_to(:wards_placed) }
91
+ it { should respond_to(:winner) }
92
+
93
+ describe "should return " do
94
+ its(:assists) { should eq 9 }
95
+ its(:champ_level) { should eq 18 }
96
+ its(:combat_player_score) { should eq 0 }
97
+ its(:deaths) { should eq 8 }
98
+ its(:double_kills) { should eq 1 }
99
+ its(:first_blood_assist) { should eq false }
100
+ its(:first_blood_kill) { should eq false }
101
+ its(:first_inhibitor_assist) { should eq false }
102
+ its(:first_inhibitor_kill) { should eq false }
103
+ its(:first_tower_assist) { should eq false }
104
+ its(:first_tower_kill) { should eq true }
105
+ its(:gold_earned) { should eq 14856 }
106
+ its(:gold_spent) { should eq 15065 }
107
+ its(:inhibitor_kills) { should eq 0 }
108
+ its(:inventory) { should be_kind_of(LolApi::Inventory) }
109
+ its(:killing_sprees) { should eq 1 }
110
+ its(:kills) { should eq 3 }
111
+ its(:largest_crit) { should eq 710 }
112
+ its(:largest_killing_spree) { should eq 2 }
113
+ its(:largest_multi_kill) { should eq 2 }
114
+ its(:magic_damage_dealt) { should eq 50388 }
115
+ its(:magic_damage_dealt_to_chanpions) { should eq 2234 }
116
+ its(:magic_damage_taken) { should eq 10892 }
117
+ its(:minions_killed) { should eq 256 }
118
+ its(:neutral_minions_killed) { should eq 42 }
119
+ its(:netural_minions_killed_enemy_jungle) { should eq 15 }
120
+ its(:netural_minions_killed_team_jungle) { should eq 27 }
121
+ its(:node_capture) { should eq 0}
122
+ its(:node_capture_assist) { should eq 0 }
123
+ its(:node_neutralize) { should eq 0 }
124
+ its(:objective_player_score) { should eq 0 }
125
+ its(:penta_kills) { should eq 0 }
126
+ its(:physical_damage_dealt) { should eq 196614 }
127
+ its(:physical_damage_dealt_to_champions) { should eq 11763 }
128
+ its(:physical_damage_taken) { should eq 15730 }
129
+ its(:quadra_kills) { should eq 0 }
130
+ its(:sight_wards_bought) { should eq 2 }
131
+ its(:team_objective) { should eq 0 }
132
+ its(:total_damage_dealt) { should eq 247073}
133
+ its(:total_damage_dealt_to_champions) { should eq 14068 }
134
+ its(:total_damage_taken) { should eq 27775 }
135
+ its(:total_heal) { should eq 1094 }
136
+ its(:total_player_score) { should eq 0 }
137
+ its(:total_score_rank) { should eq 0 }
138
+ its(:total_time_crowd_control_dealt) { should eq 151 }
139
+ its(:total_units_healed) { should eq 1 }
140
+ its(:tower_kills) { should eq 1 }
141
+ its(:triple_kills) { should eq 0 }
142
+ its(:true_damage_dealt) { should eq 70 }
143
+ its(:true_damage_dealt_to_champions) { should eq 70 }
144
+ its(:true_damage_taken) { should eq 1152 }
145
+ its(:unreal_kills) { should eq 0 }
146
+ its(:vision_wards_bought) { should eq 0 }
147
+ its(:wards_killed) { should eq 0 }
148
+ its(:wards_placed) { should eq 22 }
149
+ its(:winner) { should eq true }
150
+ end
151
+
152
+ end
153
+ end
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+
3
+ describe "timelines" do
4
+ before do
5
+ @participant = FactoryGirl.build(:match).participants.first
6
+ end
7
+ subject(:timeline) { @participant.timeline }
8
+
9
+ it { should respond_to(:ancient_golem_assists) }
10
+ it { should respond_to(:ancient_golem_kills) }
11
+ it { should respond_to(:assisted_lane_deaths_delta) }
12
+ it { should respond_to(:assisted_lane_kills_delta) }
13
+ it { should respond_to(:baron_assists) }
14
+ it { should respond_to(:barron_kills) }
15
+ it { should respond_to(:creeps_delta) }
16
+ it { should respond_to(:creep_diff_delta) }
17
+ it { should respond_to(:damage_taken_diff_delta) }
18
+ it { should respond_to(:damage_take_delta) }
19
+ it { should respond_to(:dragon_assists) }
20
+ it { should respond_to(:dragon_kills) }
21
+ it { should respond_to(:elder_lizard_assists) }
22
+ it { should respond_to(:eler_lizard_kills) }
23
+ it { should respond_to(:gpm_delta) }
24
+ it { should respond_to(:inhibitor_assists) }
25
+ it { should respond_to(:inhibitor_kills) }
26
+ it { should respond_to(:lane) }
27
+ it { should respond_to(:role) }
28
+ it { should respond_to(:tower_assists) }
29
+ it { should respond_to(:tower_kills) }
30
+ it { should respond_to(:vilemaw_assists) }
31
+ it { should respond_to(:vilemaw_kills) }
32
+ it { should respond_to(:wards_delta) }
33
+ it { should respond_to(:xp_diff_delta) }
34
+ it { should respond_to(:xp_delta) }
35
+
36
+ describe "should return" do
37
+ its(:ancient_golem_assists) { should be_kind_of(LolApi::TimelineData) }
38
+ its(:ancient_golem_kills) { should be_kind_of(LolApi::TimelineData) }
39
+ its(:assisted_lane_deaths_delta) { should be_kind_of(LolApi::TimelineData) }
40
+ its(:assisted_lane_kills_delta) { should be_kind_of(LolApi::TimelineData) }
41
+ its(:baron_assists) { should be_kind_of(LolApi::TimelineData) }
42
+ its(:barron_kills) { should be_kind_of(LolApi::TimelineData) }
43
+ its(:creeps_delta) { should be_kind_of(LolApi::TimelineData) }
44
+ its(:creep_diff_delta) { should be_kind_of(LolApi::TimelineData) }
45
+ its(:damage_taken_diff_delta) { should be_kind_of(LolApi::TimelineData) }
46
+ its(:damage_take_delta) { should be_kind_of(LolApi::TimelineData) }
47
+ its(:dragon_assists) { should be_kind_of(LolApi::TimelineData) }
48
+ its(:dragon_kills) { should be_kind_of(LolApi::TimelineData) }
49
+ its(:elder_lizard_assists) { should be_kind_of(LolApi::TimelineData) }
50
+ its(:eler_lizard_kills) { should be_kind_of(LolApi::TimelineData) }
51
+ its(:gpm_delta) { should be_kind_of(LolApi::TimelineData) }
52
+ its(:inhibitor_assists) { should be_kind_of(LolApi::TimelineData) }
53
+ its(:inhibitor_kills) { should be_kind_of(LolApi::TimelineData) }
54
+ its(:lane) { should eq "TOP" }
55
+ its(:role) { should eq "SOLO"}
56
+ its(:tower_assists) { should be_kind_of(LolApi::TimelineData) }
57
+ its(:tower_kills) { should be_kind_of(LolApi::TimelineData) }
58
+ its(:vilemaw_assists) { should be_kind_of(LolApi::TimelineData) }
59
+ its(:vilemaw_kills) { should be_kind_of(LolApi::TimelineData) }
60
+ its(:wards_delta) { should be_kind_of(LolApi::TimelineData) }
61
+ its(:xp_diff_delta) { should be_kind_of(LolApi::TimelineData) }
62
+ its(:xp_delta) { should be_kind_of(LolApi::TimelineData) }
63
+ end
64
+
65
+ describe 'creeps delta' do
66
+ subject { timeline.creeps_delta }
67
+
68
+ it { should respond_to(:ten_to_twenty) }
69
+ it { should respond_to(:thirty_to_end) }
70
+ it { should respond_to(:twenty_to_thirty) }
71
+ it { should respond_to(:zero_to_ten) }
72
+
73
+ describe "should return" do
74
+ its(:ten_to_twenty) { should eq 8.1 }
75
+ its(:thirty_to_end) { should eq 4.5 }
76
+ its(:twenty_to_thirty) { should eq 5.3 }
77
+ its(:zero_to_ten) { should eq 6.9 }
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,22 @@
1
+ require 'lol_api'
2
+ require 'rubygems'
3
+ require 'json_spec'
4
+ require 'rspec'
5
+ require 'rspec/its'
6
+ require 'factory_girl_rspec'
7
+ require 'factories'
8
+ require 'capybara'
9
+ LolApi.configure do |config|
10
+ config.api_key = '1cef001f-554c-4750-85da-7404492b8b22'
11
+ end
12
+
13
+ JsonSpec.configure do |config|
14
+ config.exclude_keys "created_at", "updated_at"
15
+ end
16
+ RSpec.configure do |config|
17
+
18
+ config.include FactoryGirl::Syntax::Methods
19
+ config.color = true
20
+ config.formatter = :documentation
21
+ config.include Capybara::DSL
22
+ end
@@ -0,0 +1,120 @@
1
+ require 'spec_helper'
2
+
3
+ describe "A summoners" do
4
+ before do
5
+ @summoner = FactoryGirl.build(:summoner)
6
+ end
7
+ subject { @summoner }
8
+
9
+ it { should be_kind_of(LolApi::Summoner) }
10
+ it { should respond_to(:id) }
11
+ it { should respond_to(:name) }
12
+ it { should respond_to(:profile_icon_id) }
13
+ it { should respond_to(:revision_date) }
14
+ it {should respond_to(:level) }
15
+
16
+ describe "must return" do
17
+ its(:id) { should eq 332541}
18
+ its(:name) { should eq "furryballs" }
19
+ its(:profile_icon_id) { should eq 28 }
20
+ its(:revision_date) { should eq 1408047409000 }
21
+ its(:level) { should eq 30}
22
+ end
23
+
24
+ describe "masteries" do
25
+
26
+ before do
27
+ @masteries = FactoryGirl.build(:summoner_masteries)
28
+ end
29
+
30
+ subject { @masteries }
31
+
32
+ it { should be_kind_of(LolApi::SummonerMasteries)}
33
+ it { should respond_to(:pages) }
34
+ it { should respond_to(:summoner_id) }
35
+
36
+ describe "should return" do
37
+ its(:pages) { should_not be_empty }
38
+ its(:summoner_id) { should eq 332541 }
39
+ end
40
+
41
+ describe "page" do
42
+
43
+ subject(:page) { @masteries.pages.first }
44
+
45
+ it { should be_kind_of(LolApi::MasteryPage) }
46
+ it { should respond_to(:current) }
47
+ it { should respond_to(:id) }
48
+ it { should respond_to(:masteries) }
49
+ it { should respond_to(:name) }
50
+
51
+ describe "should return" do
52
+ its(:current) { should eq false }
53
+ its(:id) { should eq 43675928 }
54
+ its(:masteries) { should_not be_empty }
55
+ its(:name) { should eq "AP Carry" }
56
+ end
57
+
58
+ describe "mastery" do
59
+ subject { page.masteries.first }
60
+
61
+ it { should be_kind_of(LolApi::MasteryItem) }
62
+ it { should respond_to(:id) }
63
+ it { should respond_to(:rank) }
64
+
65
+ describe "should return" do
66
+ its(:id) { should eq 4212 }
67
+ its(:rank) { should eq 2 }
68
+ end
69
+ end
70
+ end
71
+
72
+ end
73
+
74
+ describe "rune" do
75
+ before do
76
+ @runes = FactoryGirl.build(:summoner_runes)
77
+ end
78
+
79
+ subject { @runes }
80
+
81
+ it { should be_kind_of(LolApi::SummonerRunes) }
82
+ it { should respond_to(:pages) }
83
+ it { should respond_to(:summoner_id) }
84
+
85
+ describe "should return" do
86
+ its(:pages) { should_not be_empty }
87
+ its(:summoner_id) { should eq 332541 }
88
+ end
89
+
90
+ describe "pages" do
91
+ subject(:page) { @runes.pages.first }
92
+
93
+ it { should be_kind_of(LolApi::RunePage) }
94
+ it { should respond_to(:current) }
95
+ it { should respond_to(:id) }
96
+ it { should respond_to(:name) }
97
+ it { should respond_to(:runes) }
98
+
99
+ describe "should return" do
100
+ its(:current) { should eq true }
101
+ its(:id) { should eq 14741205 }
102
+ its(:name) { should eq "AD Carry" }
103
+ its(:runes) { should_not be_empty }
104
+ end
105
+
106
+ describe "slotted" do
107
+ subject { page.runes.first }
108
+
109
+ it { should be_kind_of(LolApi::SlottedRune) }
110
+ it { should respond_to(:id) }
111
+ it { should respond_to(:slot_id) }
112
+
113
+ describe "should return" do
114
+ its(:id) { should eq 5246 }
115
+ its(:slot_id) { should eq 1 }
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
data/spec/team_spec.rb ADDED
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ describe "teams" do
5
+ before do
6
+ @match = FactoryGirl.build(:match)
7
+ end
8
+ subject(:team) { @match.teams.first}
9
+
10
+ it { should be_kind_of(LolApi::Team) }
11
+ it { should respond_to(:bans) }
12
+ it { should respond_to(:baron_kills) }
13
+ it { should respond_to(:dragon_kills) }
14
+ it { should respond_to(:first_baron) }
15
+ it { should respond_to(:first_blood) }
16
+ it { should respond_to(:first_inhibitor) }
17
+ it { should respond_to(:first_tower) }
18
+ it { should respond_to(:inhibitor_kills) }
19
+ it { should respond_to(:team_id) }
20
+ it { should respond_to(:tower_kills) }
21
+ it { should respond_to(:vilemaw_kills) }
22
+ it { should respond_to(:winner) }
23
+
24
+ describe "should return" do
25
+ its(:bans) { should_not be_empty }
26
+ its(:baron_kills) { should eq 1 }
27
+ its(:dragon_kills) { should eq 1 }
28
+ its(:first_baron) { should eq true }
29
+ its(:first_blood) { should eq false }
30
+ its(:first_inhibitor) { should eq false }
31
+ its(:first_tower) { should eq true }
32
+ its(:inhibitor_kills) { should eq 1 }
33
+ its(:team_id) { should eq 100 }
34
+ its(:tower_kills) { should eq 8 }
35
+ its(:vilemaw_kills) { should eq 0 }
36
+ its(:winner) { should eq true }
37
+ end
38
+ end
@@ -0,0 +1,101 @@
1
+ require 'spec_helper'
2
+
3
+ describe LolApi::Timeline do
4
+ before do
5
+ @match = FactoryGirl.build(:match)
6
+ end
7
+ subject(:timeline) { @match.timeline }
8
+
9
+ it { should respond_to(:interval)}
10
+ it {should respond_to(:frames) }
11
+
12
+ describe "should return" do
13
+ its(:interval) { should eq 60000 }
14
+ its(:frames) { should_not be_empty }
15
+ end
16
+
17
+ describe "frame" do
18
+ subject(:frame) { timeline.frames[1] }
19
+
20
+ it { should respond_to(:events) }
21
+ it { should respond_to(:participant_frames) }
22
+ it { should respond_to(:timestamp) }
23
+
24
+ describe "should return" do
25
+ its(:events) { should_not be_empty }
26
+ its(:participant_frames) { should_not be_empty }
27
+ its(:timestamp) { should eq 60016 }
28
+ end
29
+
30
+ describe "event" do
31
+ subject(:event) { frame.events.first }
32
+
33
+ it { should be_kind_of(LolApi::Event)}
34
+ it { should respond_to(:assisting_participant_ids) }
35
+ it { should respond_to(:building_type) }
36
+ it { should respond_to(:creator_id) }
37
+ it { should respond_to(:event_type) }
38
+ it { should respond_to(:item_after) }
39
+ it { should respond_to(:item_before) }
40
+ it { should respond_to(:item_id) }
41
+ it { should respond_to(:killer_id) }
42
+ it { should respond_to(:lane_type) }
43
+ it { should respond_to(:level_up_type) }
44
+ it { should respond_to(:monster_type) }
45
+ it { should respond_to(:participant_id) }
46
+ it { should respond_to(:position) }
47
+ it { should respond_to(:skill_slot) }
48
+ it { should respond_to(:team_id) }
49
+ it { should respond_to(:timestamp) }
50
+ it { should respond_to(:tower_type) }
51
+ it { should respond_to(:victim_id) }
52
+ it { should respond_to(:ward_type) }
53
+
54
+ describe "should return" do
55
+ its(:assisting_participant_ids) {should eq nil}
56
+ its(:building_type) {should eq nil }
57
+ its(:creator_id) {should eq nil }
58
+ its(:event_type) {should eq "ITEM_PURCHASED" }
59
+ its(:item_after) {should eq nil }
60
+ its(:item_before) {should eq nil }
61
+ its(:item_id) {should eq 1029 }
62
+ its(:killer_id) {should eq nil }
63
+ its(:lane_type) {should eq nil }
64
+ its(:level_up_type) {should eq nil }
65
+ its(:monster_type) {should eq nil }
66
+ its(:participant_id) {should eq 10 }
67
+ its(:position) {should eq nil }
68
+ its(:skill_slot) {should eq nil }
69
+ its(:team_id) {should eq nil }
70
+ its(:timestamp) {should eq 7736 }
71
+ its(:tower_type) {should eq nil }
72
+ its(:victim_id) {should eq nil }
73
+ its(:ward_type) {should eq nil }
74
+ end
75
+ end
76
+ describe "participant frames" do
77
+ subject(:participant_frame) { frame.participant_frames.first }
78
+
79
+ it { should be_kind_of(LolApi::ParticipantFrame)}
80
+ it { should respond_to(:current_gold) }
81
+ it { should respond_to(:jungle_minions_killed) }
82
+ it { should respond_to(:level) }
83
+ it { should respond_to(:minions_killed) }
84
+ it { should respond_to(:participant_id) }
85
+ it { should respond_to(:position) }
86
+ it { should respond_to(:total_gold) }
87
+ it { should respond_to(:xp) }
88
+
89
+ describe "should return" do
90
+ its(:current_gold) { should eq 0 }
91
+ its(:jungle_minions_killed) { should eq 0 }
92
+ its(:level) { should eq 1 }
93
+ its(:minions_killed) { should eq 0 }
94
+ its(:participant_id) { should eq 3 }
95
+ its(:position) { should be_kind_of(LolApi::Position) }
96
+ its(:total_gold) { should eq 475 }
97
+ its(:xp) { should eq 0 }
98
+ end
99
+ end
100
+ end
101
+ end