lolesports-api 0.1.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 (42) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +11 -0
  5. data/Gemfile +4 -0
  6. data/Guardfile +25 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +78 -0
  9. data/Rakefile +1 -0
  10. data/lib/lolesports-api.rb +14 -0
  11. data/lib/lolesports-api/base.rb +23 -0
  12. data/lib/lolesports-api/game.rb +50 -0
  13. data/lib/lolesports-api/league.rb +66 -0
  14. data/lib/lolesports-api/match.rb +52 -0
  15. data/lib/lolesports-api/play.rb +47 -0
  16. data/lib/lolesports-api/player.rb +31 -0
  17. data/lib/lolesports-api/series.rb +35 -0
  18. data/lib/lolesports-api/team.rb +31 -0
  19. data/lib/lolesports-api/tournament.rb +46 -0
  20. data/lib/lolesports-api/version.rb +3 -0
  21. data/lolesports-api.gemspec +33 -0
  22. data/spec/fixtures/vcr/cassettes/LolesportsApi_Game/_find/.yml +66 -0
  23. data/spec/fixtures/vcr/cassettes/LolesportsApi_League/_all/.yml +226 -0
  24. data/spec/fixtures/vcr/cassettes/LolesportsApi_League/_find/.yml +92 -0
  25. data/spec/fixtures/vcr/cassettes/LolesportsApi_Match/_find/.yml +66 -0
  26. data/spec/fixtures/vcr/cassettes/LolesportsApi_Player/_find/.yml +69 -0
  27. data/spec/fixtures/vcr/cassettes/LolesportsApi_Player/_reload/.yml +69 -0
  28. data/spec/fixtures/vcr/cassettes/LolesportsApi_Series/_all/.yml +87 -0
  29. data/spec/fixtures/vcr/cassettes/LolesportsApi_Series/_find/.yml +63 -0
  30. data/spec/fixtures/vcr/cassettes/LolesportsApi_Team/_find/.yml +68 -0
  31. data/spec/fixtures/vcr/cassettes/LolesportsApi_Tournament/_find/.yml +68 -0
  32. data/spec/fixtures/vcr/cassettes/LolesportsApi_Tournament/_find_matches/.yml +84 -0
  33. data/spec/lolesports-api/game_spec.rb +14 -0
  34. data/spec/lolesports-api/league_spec.rb +20 -0
  35. data/spec/lolesports-api/match_spec.rb +14 -0
  36. data/spec/lolesports-api/play_spec.rb +33 -0
  37. data/spec/lolesports-api/player_spec.rb +25 -0
  38. data/spec/lolesports-api/series_spec.rb +17 -0
  39. data/spec/lolesports-api/team_spec.rb +12 -0
  40. data/spec/lolesports-api/tournament_spec.rb +17 -0
  41. data/spec/spec_helper.rb +108 -0
  42. metadata +258 -0
@@ -0,0 +1,68 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://na.lolesports.com/api/team/304.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Wed, 05 Aug 2015 05:13:33 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Content-Length:
26
+ - '393'
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=de771f1db6d002794526572affea495441438751612; expires=Thu, 04-Aug-16
31
+ 05:13:32 GMT; path=/; domain=.lolesports.com; HttpOnly
32
+ Cache-Control:
33
+ - public, max-age=1800
34
+ Etag:
35
+ - '"1438751166-1"'
36
+ Expires:
37
+ - Wed, 05 Aug 2015 05:43:33 GMT
38
+ Last-Modified:
39
+ - Wed, 05 Aug 2015 05:06:06 GMT
40
+ Vary:
41
+ - Accept-Encoding
42
+ Via:
43
+ - 1.1 varnish
44
+ X-Drupal-Cache:
45
+ - MISS
46
+ X-Varnish:
47
+ - 1377982057 1377979533
48
+ X-Varnish-Cache:
49
+ - HIT
50
+ Cf-Cache-Status:
51
+ - EXPIRED
52
+ Accept-Ranges:
53
+ - bytes
54
+ Server:
55
+ - cloudflare-nginx
56
+ Cf-Ray:
57
+ - 2110036c1d66286a-SJC
58
+ body:
59
+ encoding: ASCII-8BIT
60
+ string: '{"name":"Cloud9 ","bio":null,"noPlayers":"0","roster":{"players0":{"playerId":"328","name":"Balls","role":"Top
61
+ Lane","isStarter":1},"players1":{"playerId":"330","name":"Hai","role":"Jungler","isStarter":1},"players2":{"playerId":"331","name":"Sneaky","role":"AD
62
+ Carry","isStarter":1},"players3":{"playerId":"332","name":"LemonNation","role":"Support","isStarter":1},"players4":{"playerId":"329","name":"Meteos","role":"Jungler","isStarter":0},"players5":{"playerId":"1144","name":"Westrice","role":"Top
63
+ Lane","isStarter":0},"players6":{"playerId":"4330","name":"Incarnati0n","role":"Mid
64
+ Lane","isStarter":1},"players7":{"playerId":"1313","name":"Sheep","role":"Support","isStarter":0},"players8":{"playerId":"1353","name":"Yusui","role":"Mid
65
+ Lane","isStarter":0},"players9":{"playerId":"2551","name":"Hard","role":"Jungler","isStarter":0}},"logoUrl":"http://riot-web-cdn.s3-us-west-1.amazonaws.com/lolesports/s3fs-public/cloud9-logo.png","profileUrl":"http://na.lolesports.com/node/304","teamPhotoUrl":"http://na.lolesports.com/","acronym":"C9"}'
66
+ http_version:
67
+ recorded_at: Wed, 05 Aug 2015 05:13:32 GMT
68
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,68 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://na.lolesports.com/api/tournament/102.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Mon, 10 Aug 2015 02:47:45 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Content-Length:
26
+ - '331'
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=dad0c4258d5805a752f6a014b805760e51439174865; expires=Tue, 09-Aug-16
31
+ 02:47:45 GMT; path=/; domain=.lolesports.com; HttpOnly
32
+ Cache-Control:
33
+ - public, max-age=1800
34
+ Etag:
35
+ - '"1439174870-1"'
36
+ Expires:
37
+ - Mon, 10 Aug 2015 03:17:45 GMT
38
+ Last-Modified:
39
+ - Mon, 10 Aug 2015 02:47:50 GMT
40
+ Vary:
41
+ - Accept-Encoding
42
+ Via:
43
+ - 1.1 varnish
44
+ X-Drupal-Cache:
45
+ - MISS
46
+ X-Varnish:
47
+ - '975588137'
48
+ X-Varnish-Cache:
49
+ - MISS
50
+ Cf-Cache-Status:
51
+ - EXPIRED
52
+ Accept-Ranges:
53
+ - bytes
54
+ Server:
55
+ - cloudflare-nginx
56
+ Cf-Ray:
57
+ - 213860ba7c730d85-SJC
58
+ body:
59
+ encoding: ASCII-8BIT
60
+ string: '{"namePublic":"EU LCS Summer Split","contestants":{"contestant1":{"id":"1100","name":"Copenhagen
61
+ Wolves","acronym":"CW"},"contestant2":{"id":"1242","name":"ROCCAT","acronym":"ROC"},"contestant3":{"id":"1243","name":"Millenium","acronym":"MIL"},"contestant4":{"id":"589","name":"Meet
62
+ Your Makers","acronym":"MYM"},"contestant5":{"id":"70","name":"Alliance","acronym":"ALL"},"contestant6":{"id":"67","name":"SK
63
+ Gaming","acronym":"SK"},"contestant7":{"id":"68","name":"Fnatic","acronym":"FNC"},"contestant8":{"id":"69","name":"Gambit
64
+ Gaming","acronym":"GMB"}},"isFinished":true,"dateBegin":"2014-05-20T15:00Z","dateEnd":"2014-07-31T15:00Z","noVods":0,"season":"2014","published":true,"winner":"69","name":"EU
65
+ LCS Summer Split"}'
66
+ http_version:
67
+ recorded_at: Mon, 10 Aug 2015 02:47:45 GMT
68
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,84 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://na.lolesports.com/api/schedule.json?tournamentId=241
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Wed, 12 Aug 2015 04:58:03 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Content-Length:
26
+ - '885'
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=df8ad6408c6103455912202618279f7f21439355482; expires=Thu, 11-Aug-16
31
+ 04:58:02 GMT; path=/; domain=.lolesports.com; HttpOnly
32
+ Cache-Control:
33
+ - public, max-age=1800
34
+ Etag:
35
+ - '"1439355481-1"'
36
+ Expires:
37
+ - Wed, 12 Aug 2015 05:28:03 GMT
38
+ Last-Modified:
39
+ - Wed, 12 Aug 2015 04:58:01 GMT
40
+ Vary:
41
+ - Accept-Encoding
42
+ Via:
43
+ - 1.1 varnish
44
+ X-Drupal-Cache:
45
+ - MISS
46
+ X-Varnish:
47
+ - '306123803'
48
+ X-Varnish-Cache:
49
+ - MISS
50
+ Cf-Cache-Status:
51
+ - EXPIRED
52
+ Accept-Ranges:
53
+ - bytes
54
+ Server:
55
+ - cloudflare-nginx
56
+ Cf-Ray:
57
+ - 21499a579bc82846-SJC
58
+ body:
59
+ encoding: ASCII-8BIT
60
+ string: '{"Match5334":{"dateTime":"2015-08-09T19:00Z","winnerId":"1","matchId":"5334","url":"/tourney/match/5334","maxGames":"5","isLive":false,"isFinished":"1","tournament":{"id":"241","name":"2015
61
+ NA LCS Summer Playoffs","round":"1"},"contestants":{"blue":{"id":"3656","name":"Gravity","logoURL":"http://riot-web-cdn.s3-us-west-1.amazonaws.com/lolesports/s3fs-public/styles/grid_medium_square/public/gravity-logo.png?itok=5v3hjeIU","acronym":"GV","wins":1,"losses":3},"red":{"id":"1","name":"Team
62
+ SoloMid","logoURL":"http://riot-web-cdn.s3-us-west-1.amazonaws.com/lolesports/s3fs-public/styles/grid_medium_square/public/TSM%20logovector%20-white.png?itok=uAifgYKt","acronym":"TSM","wins":3,"losses":1}},"liveStreams":false,"polldaddyId":"8998184:40947505:40947506","games":{"game0":{"id":"7067","winnerId":"1","noVods":0,"hasVod":1},"game1":{"id":"7273","winnerId":"3656","noVods":0,"hasVod":1},"game2":{"id":"7274","winnerId":"1","noVods":0,"hasVod":1},"game3":{"id":"7284","winnerId":"1","noVods":0,"hasVod":1}},"name":"Gravity
63
+ vs Team SoloMid"},"Match5335":{"dateTime":"2015-08-08T19:00Z","winnerId":"3657","matchId":"5335","url":"/tourney/match/5335","maxGames":"5","isLive":false,"isFinished":"1","tournament":{"id":"241","name":"2015
64
+ NA LCS Summer Playoffs","round":"1"},"contestants":{"blue":{"id":"3657","name":"Team
65
+ Impulse","logoURL":"http://riot-web-cdn.s3-us-west-1.amazonaws.com/lolesports/s3fs-public/styles/grid_medium_square/public/TIP_Logo.png?itok=xSnhbv8a","acronym":"TIP","wins":3,"losses":0},"red":{"id":"3","name":"Team
66
+ Dignitas","logoURL":"http://riot-web-cdn.s3-us-west-1.amazonaws.com/lolesports/s3fs-public/styles/grid_medium_square/public/dig_logo_1.png?itok=t1mfuQzI","acronym":"DIG","wins":0,"losses":3}},"liveStreams":false,"polldaddyId":"8998183:40947503:40947504","games":{"game0":{"id":"7068","winnerId":"3657","noVods":0,"hasVod":1},"game1":{"id":"7258","winnerId":"3657","noVods":0,"hasVod":1},"game2":{"id":"7259","winnerId":"3657","noVods":0,"hasVod":1}},"name":"Team
67
+ Impulse vs Team Dignitas"},"Match5336":{"dateTime":"2015-08-16T19:00Z","winnerId":"","matchId":"5336","url":"/tourney/match/5336","maxGames":"5","isLive":false,"isFinished":"0","tournament":{"id":"241","name":"2015
68
+ NA LCS Summer Playoffs","round":"2"},"contestants":{"blue":{"id":"3654","name":"Team
69
+ Liquid","logoURL":"http://riot-web-cdn.s3-us-west-1.amazonaws.com/lolesports/s3fs-public/styles/grid_medium_square/public/teamliquid-logo.png?itok=ElClHuYD","acronym":"TL","wins":0,"losses":0},"red":{"id":"1","name":"Team
70
+ SoloMid","logoURL":"http://riot-web-cdn.s3-us-west-1.amazonaws.com/lolesports/s3fs-public/styles/grid_medium_square/public/TSM%20logovector%20-white.png?itok=uAifgYKt","acronym":"TSM","wins":3,"losses":1}},"liveStreams":false,"polldaddyId":"9018654:41041548:41041549","games":{"game0":{"id":"7069","winnerId":"","noVods":0,"hasVod":0}},"name":"Team
71
+ Liquid vs TBD"},"Match5337":{"dateTime":"2015-08-15T19:00Z","winnerId":"","matchId":"5337","url":"/tourney/match/5337","maxGames":"5","isLive":false,"isFinished":"0","tournament":{"id":"241","name":"2015
72
+ NA LCS Summer Playoffs","round":"2"},"contestants":{"blue":{"id":"2","name":"Counter
73
+ Logic Gaming","logoURL":"http://riot-web-cdn.s3-us-west-1.amazonaws.com/lolesports/s3fs-public/styles/grid_medium_square/public/600px-Clg_logo2.png?itok=IMlyyajm","acronym":"CLG","wins":0,"losses":0},"red":{"id":"3657","name":"Team
74
+ Impulse","logoURL":"http://riot-web-cdn.s3-us-west-1.amazonaws.com/lolesports/s3fs-public/styles/grid_medium_square/public/TIP_Logo.png?itok=xSnhbv8a","acronym":"TIP","wins":3,"losses":0}},"liveStreams":false,"polldaddyId":"9017580:41036511:41036512","games":{"game0":{"id":"7070","winnerId":"","noVods":0,"hasVod":0}},"name":"Counter
75
+ Logic Gaming vs TBD"},"Match5338":{"dateTime":"2015-08-23T20:00Z","winnerId":"","matchId":"5338","url":"/tourney/match/5338","maxGames":"5","isLive":false,"isFinished":"0","tournament":{"id":"241","name":"2015
76
+ NA LCS Summer Playoffs","round":"3"},"contestants":null,"liveStreams":false,"polldaddyId":"
77
+ ","games":{"game0":{"id":"7071","winnerId":"","noVods":0,"hasVod":0}},"name":"TBD
78
+ vs TBD"},"Match5339":{"dateTime":"2015-08-22T22:00Z","winnerId":"","matchId":"5339","url":"/tourney/match/5339","maxGames":"5","isLive":false,"isFinished":"0","tournament":{"id":"241","name":"2015
79
+ NA LCS Summer Playoffs","round":"1"},"contestants":null,"liveStreams":false,"polldaddyId":"
80
+ ","games":{"game0":{"id":"7072","winnerId":"","noVods":0,"hasVod":0}},"name":"TBD
81
+ vs TBD"}}'
82
+ http_version:
83
+ recorded_at: Wed, 12 Aug 2015 04:58:02 GMT
84
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,14 @@
1
+ describe LolesportsApi::Game do
2
+ describe '.find', vcr: true do
3
+ let(:game) { LolesportsApi::Game.find(2782) }
4
+ it { expect(game.class).to eq LolesportsApi::Game }
5
+ it { expect(game.game_length).to eq 1414 }
6
+ it { expect(game.id).to eq 2782 }
7
+ it { expect(game.players.first.class).to eq LolesportsApi::Play }
8
+ it { expect(game.players[4].total_gold).to eq 7975 }
9
+ it { expect(game.players[4].player_id).to eq 79 }
10
+ it { expect(game.blue_team.id).to eq 67 }
11
+ it { expect(game.red_team.name).to eq 'Copenhagen Wolves' }
12
+ it { expect(game.date_time).to eq DateTime.new(2014, 5, 21, 15) }
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ describe LolesportsApi::League do
2
+ describe '.find', vcr: true do
3
+ let(:league) { LolesportsApi::League.find(1) }
4
+ it { expect(league.class).to eq LolesportsApi::League }
5
+ it { expect(league.label).to eq 'NA LCS' }
6
+ it { expect(league.id).to eq 1 }
7
+ it { expect(league.tournaments[0].id).to eq 7 }
8
+ it { expect(league.name).to eq 'NA LCS' }
9
+ it { expect(league.series[0].id).to eq 20 }
10
+ it { expect(league.tournaments).to eq league.league_tournaments }
11
+ it { expect(league.series).to eq league.league_series }
12
+ end
13
+
14
+ describe '.all', vcr: true do
15
+ let(:leagues) { LolesportsApi::League.all }
16
+ it { expect(leagues.class).to eq Array }
17
+ it { expect(leagues[0].class).to eq LolesportsApi::League }
18
+ it { expect(leagues[0].id).to eq 1 }
19
+ end
20
+ end
@@ -0,0 +1,14 @@
1
+ describe LolesportsApi::Match do
2
+ describe '.find', vcr: true do
3
+ let(:match) { LolesportsApi::Match.find(2299) }
4
+ it { expect(match.class).to eq LolesportsApi::Match }
5
+ it { expect(match.name).to eq 'SK Gaming vs Copenhagen Wolves' }
6
+ it { expect(match.id).to eq 2299 }
7
+ it { expect(match.blue_team.acronym).to eq 'SK' }
8
+ it { expect(match.red_team.id).to eq 1100 }
9
+ it { expect(match.date_time.class).to eq DateTime }
10
+ it { expect(match.games[0].id).to eq 2782 }
11
+ it { expect(match.tournament.id).to eq 102 }
12
+ it { expect(match.tournament.name).to eq 'EU LCS Summer Split' }
13
+ end
14
+ end
@@ -0,0 +1,33 @@
1
+ describe LolesportsApi::Play do
2
+ describe '#initialize' do
3
+ let(:attributes) do
4
+ {
5
+ 'assists' => 2,
6
+ 'championId' => 117,
7
+ 'deaths' => 5,
8
+ 'endLevel' => 11,
9
+ 'id' => 1101,
10
+ 'items0' => '1056',
11
+ 'items1' => '3028',
12
+ 'items2' => '1056',
13
+ 'items3' => '3108',
14
+ 'items4' => '3020',
15
+ 'items5' => '1056',
16
+ 'kda' => 0.4,
17
+ 'kills' => 0,
18
+ 'minionsKilled' => 124,
19
+ 'name' => 'YoungBuck',
20
+ 'photoURL' => 'http://riot-web-cdn.s3-us-west-1.amazonaws.com/lolesports/s3fs-public/CW-youngbuck-2015.jpg',
21
+ 'spell0' => '4',
22
+ 'spell1' => '12',
23
+ 'teamId' => 1100,
24
+ 'totalGold' => 5788
25
+ }
26
+ end
27
+ let(:play) { LolesportsApi::Play.new(attributes) }
28
+ it { expect(play.player_id).to eq 1101 }
29
+ it { expect(play.items).to eq [1056, 3028, 1056, 3108, 3020, 1056] }
30
+ it { expect([play.spell0, play.spell1]).to eq [4, 12] }
31
+ it { expect(play.player.class).to eq LolesportsApi::Player }
32
+ end
33
+ end
@@ -0,0 +1,25 @@
1
+ describe LolesportsApi::Player do
2
+ describe '.find', vcr: true do
3
+ let(:player) { LolesportsApi::Player.find(330) }
4
+ it { expect(player.class).to eq LolesportsApi::Player }
5
+ it { expect(player.first_name).to eq 'Hai' }
6
+ it { expect(player.id).to eq 330 }
7
+ end
8
+
9
+ describe '.all' do
10
+ it 'raises an error that no endpoint is available' do
11
+ expect do
12
+ @players = LolesportsApi::Player.all
13
+ end.to raise_exception StandardError
14
+ end
15
+ end
16
+
17
+ describe '#reload', vcr: true, focus: true do
18
+ let(:player) { LolesportsApi::Player.new('playerId' => '329') }
19
+ before(:each) do
20
+ player.reload
21
+ end
22
+ it { expect(player.class).to eq LolesportsApi::Player }
23
+ it { expect(player.first_name).to eq 'William' }
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ describe LolesportsApi::Series do
2
+ describe '.find', vcr: true do
3
+ let(:series) { LolesportsApi::Series.find(20) }
4
+ it { expect(series.class).to eq LolesportsApi::Series }
5
+ it { expect(series.label).to eq 'NA LCS Expansion' }
6
+ it { expect(series.id).to eq 20 }
7
+ it { expect(series.tournaments[0].id).to eq 181 }
8
+ end
9
+
10
+ describe '.all', vcr: true do
11
+ let(:series) { LolesportsApi::Series.all }
12
+ it { expect(series.class).to eq Array }
13
+ it { expect(series[0].class).to eq LolesportsApi::Series }
14
+ it { expect(series[0].id).to eq 1 }
15
+ it { expect(series[0].label).to eq 'World Championship' }
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ describe LolesportsApi::Team do
2
+ describe '.find', vcr: true do
3
+ let(:team) { LolesportsApi::Team.find(304) }
4
+ it { expect(team.class).to eq LolesportsApi::Team }
5
+ it { expect(team.acronym).to eq 'C9' }
6
+ it { expect(team.id).to eq 304 }
7
+ it { expect(team.roster.class).to eq Array }
8
+ it { expect(team.roster.first.class).to eq LolesportsApi::Player }
9
+ it { expect(team.roster[4].name).to eq 'Meteos' }
10
+ it { expect(team.roster[4].id).to eq 329 }
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ describe LolesportsApi::Tournament do
2
+ describe '.find', vcr: true do
3
+ let(:tournament) { LolesportsApi::Tournament.find(102) }
4
+ it { expect(tournament.class).to eq LolesportsApi::Tournament }
5
+ it { expect(tournament.name).to eq 'EU LCS Summer Split' }
6
+ it { expect(tournament.id).to eq 102 }
7
+ it { expect(tournament.contestants[0].id).to eq 1100 }
8
+ end
9
+
10
+ describe '#find_matches', vcr: true do
11
+ let(:tournament) do
12
+ LolesportsApi::Tournament.new('id' => 241).tap(&:find_matches)
13
+ end
14
+ it { expect(tournament.matches[0].id).to eq 5334 }
15
+ it { expect(tournament.matches[0].games[0].id).to eq 7067 }
16
+ end
17
+ end
@@ -0,0 +1,108 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+
20
+ require 'webmock/rspec'
21
+ require 'vcr'
22
+ require 'pry'
23
+
24
+ require 'lolesports-api'
25
+
26
+ RSpec.configure do |config|
27
+ # rspec-expectations config goes here. You can use an alternate
28
+ # assertion/expectation library such as wrong or the stdlib/minitest
29
+ # assertions if you prefer.
30
+ config.expect_with :rspec do |expectations|
31
+ # This option will default to `true` in RSpec 4. It makes the `description`
32
+ # and `failure_message` of custom matchers include text for helper methods
33
+ # defined using `chain`, e.g.:
34
+ # be_bigger_than(2).and_smaller_than(4).description
35
+ # # => "be bigger than 2 and smaller than 4"
36
+ # ...rather than:
37
+ # # => "be bigger than 2"
38
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
39
+ end
40
+
41
+ # rspec-mocks config goes here. You can use an alternate test double
42
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
43
+ config.mock_with :rspec do |mocks|
44
+ # Prevents you from mocking or stubbing a method that does not exist on
45
+ # a real object. This is generally recommended, and will default to
46
+ # `true` in RSpec 4.
47
+ mocks.verify_partial_doubles = true
48
+ end
49
+
50
+ # The settings below are suggested to provide a good initial experience
51
+ # with RSpec, but feel free to customize to your heart's content.
52
+
53
+ # These two settings work together to allow you to limit a spec run
54
+ # to individual examples or groups you care about by tagging them with
55
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
56
+ # get run.
57
+ # config.filter_run :focus
58
+ # config.run_all_when_everything_filtered = true
59
+ #
60
+ # # Allows RSpec to persist some state between runs in order to support
61
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
62
+ # # you configure your source control system to ignore this file.
63
+ # config.example_status_persistence_file_path = "spec/examples.txt"
64
+ #
65
+ # # Limits the available syntax to the non-monkey patched syntax that is
66
+ # # recommended. For more details, see:
67
+ # # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
68
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
69
+ # # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
70
+ # config.disable_monkey_patching!
71
+ #
72
+ # # This setting enables warnings. It's recommended, but in some cases may
73
+ # # be too noisy due to issues in dependencies.
74
+ # config.warnings = true
75
+ #
76
+ # # Many RSpec users commonly either run the entire suite or an individual
77
+ # # file, and it's useful to allow more verbose output when running an
78
+ # # individual spec file.
79
+ # if config.files_to_run.one?
80
+ # # Use the documentation formatter for detailed output,
81
+ # # unless a formatter has already been configured
82
+ # # (e.g. via a command-line flag).
83
+ # config.default_formatter = 'doc'
84
+ # end
85
+ #
86
+ # # Print the 10 slowest examples and example groups at the
87
+ # # end of the spec run, to help surface which specs are running
88
+ # # particularly slow.
89
+ # config.profile_examples = 10
90
+ #
91
+ # # Run specs in random order to surface order dependencies. If you find an
92
+ # # order dependency and want to debug it, you can fix the order by providing
93
+ # # the seed, which is printed after each run.
94
+ # # --seed 1234
95
+ # config.order = :random
96
+ #
97
+ # # Seed global randomization in this process using the `--seed` CLI option.
98
+ # # Setting this allows you to use `--seed` to deterministically reproduce
99
+ # # test failures related to randomization by passing the same `--seed` value
100
+ # # as the one that triggered the failure.
101
+ # Kernel.srand config.seed
102
+ end
103
+
104
+ VCR.configure do |config|
105
+ config.cassette_library_dir = 'spec/fixtures/vcr/cassettes'
106
+ config.hook_into :webmock
107
+ config.configure_rspec_metadata!
108
+ end