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.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.guardfile +11 -0
- data/.travis.yml +6 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +10 -0
- data/lib/lol_api/client.rb +105 -0
- data/lib/lol_api/configuration.rb +15 -0
- data/lib/lol_api/connection.rb +32 -0
- data/lib/lol_api/types/champion.rb +95 -0
- data/lib/lol_api/types/dtos/image.rb +33 -0
- data/lib/lol_api/types/dtos/info.rb +25 -0
- data/lib/lol_api/types/dtos/participant.rb +419 -0
- data/lib/lol_api/types/dtos/participant_identity.rb +19 -0
- data/lib/lol_api/types/dtos/passive.rb +27 -0
- data/lib/lol_api/types/dtos/player.rb +22 -0
- data/lib/lol_api/types/dtos/recommended.rb +38 -0
- data/lib/lol_api/types/dtos/skin.rb +20 -0
- data/lib/lol_api/types/dtos/spell.rb +98 -0
- data/lib/lol_api/types/dtos/stat.rb +19 -0
- data/lib/lol_api/types/dtos/team.rb +57 -0
- data/lib/lol_api/types/dtos/timeline.rb +180 -0
- data/lib/lol_api/types/history_match.rb +61 -0
- data/lib/lol_api/types/item.rb +126 -0
- data/lib/lol_api/types/mastery.rb +39 -0
- data/lib/lol_api/types/match.rb +43 -0
- data/lib/lol_api/types/summoner.rb +26 -0
- data/lib/lol_api/types/summoner_masteries.rb +66 -0
- data/lib/lol_api/types/summoner_runes.rb +69 -0
- data/lib/lol_api/utils/inspectable.rb +10 -0
- data/lib/lol_api/version.rb +3 -0
- data/lib/lol_api.rb +12 -0
- data/lol_api.gemspec +29 -0
- data/spec/champion_spec.rb +48 -0
- data/spec/client_spec.rb +67 -0
- data/spec/delegation_spec.rb +5 -0
- data/spec/factories.rb +43 -0
- data/spec/fixtures/champion.json +843 -0
- data/spec/fixtures/history.json +127 -0
- data/spec/fixtures/item.json +62 -0
- data/spec/fixtures/mastery.json +25 -0
- data/spec/fixtures/match.json +12167 -0
- data/spec/fixtures/match_details.json +13548 -0
- data/spec/fixtures/summoner.json +7 -0
- data/spec/fixtures/summoner_masteries.json +143 -0
- data/spec/fixtures/summoner_runes.json +132 -0
- data/spec/history_spec.rb +280 -0
- data/spec/item_spec.rb +96 -0
- data/spec/mastery_spec.rb +27 -0
- data/spec/match_details_spec.rb +72 -0
- data/spec/participant_spec.rb +153 -0
- data/spec/participant_timeline_spec.rb +80 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/summoner_spec.rb +120 -0
- data/spec/team_spec.rb +38 -0
- data/spec/timeline_spec.rb +101 -0
- metadata +236 -0
data/spec/client_spec.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Client returns ' do
|
4
|
+
describe 'champions' do
|
5
|
+
champions = LolApi.champions
|
6
|
+
subject { champions }
|
7
|
+
it { should_not be_empty }
|
8
|
+
describe 'by id' do
|
9
|
+
champion = LolApi.champion_by_id(35, champData: "all")
|
10
|
+
subject { champion }
|
11
|
+
it { should be_kind_of(LolApi::Champion) }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
describe 'items' do
|
15
|
+
items = LolApi.items
|
16
|
+
subject { items }
|
17
|
+
it { should_not be_empty }
|
18
|
+
describe 'by id' do
|
19
|
+
item = LolApi.item_by_id(3020, itemData: "all")
|
20
|
+
subject { item }
|
21
|
+
it { should be_kind_of(LolApi::Item) }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
describe 'masteries' do
|
25
|
+
masteries = LolApi.masteries
|
26
|
+
subject { masteries }
|
27
|
+
it { should_not be_empty }
|
28
|
+
|
29
|
+
describe 'by id' do
|
30
|
+
mastery = LolApi.mastery_by_id(4353)
|
31
|
+
subject { mastery }
|
32
|
+
it { should be_kind_of(LolApi::Mastery)}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'history' do
|
36
|
+
history = LolApi.history_by_id(332541)
|
37
|
+
subject { history }
|
38
|
+
it { should_not be_empty }
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'summoner' do
|
42
|
+
describe 'by name' do
|
43
|
+
summoner = LolApi.summoner_by_name('furryballs')
|
44
|
+
subject { summoner }
|
45
|
+
it { should be_kind_of(LolApi::Summoner) }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'by id' do
|
49
|
+
summoner = LolApi.summoner_by_id(332541)
|
50
|
+
subject { summoner }
|
51
|
+
it { should be_kind_of(LolApi::Summoner) }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'summoner masteries' do
|
56
|
+
masteries = LolApi.summoner_masteries(332541)
|
57
|
+
subject { masteries }
|
58
|
+
it { should be_kind_of(LolApi::SummonerMasteries) }
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'summoner runes' do
|
62
|
+
runes = LolApi.summoner_runes(332541)
|
63
|
+
subject { runes }
|
64
|
+
it { should be_kind_of(LolApi::SummonerRunes) }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
data/spec/factories.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
FactoryGirl.define do
|
4
|
+
|
5
|
+
factory :champion, :class => LolApi::Champion do |f|
|
6
|
+
skip_create
|
7
|
+
initialize_with { new(read_fixture("champion.json")) }
|
8
|
+
end
|
9
|
+
factory :item, :class => LolApi::Item do |f|
|
10
|
+
skip_create
|
11
|
+
initialize_with { new(read_fixture("item.json")) }
|
12
|
+
end
|
13
|
+
factory :mastery, :class => LolApi::Mastery do |f|
|
14
|
+
skip_create
|
15
|
+
initialize_with { new(read_fixture("mastery.json")) }
|
16
|
+
end
|
17
|
+
factory :summoner, :class => LolApi::Summoner do |f|
|
18
|
+
skip_create
|
19
|
+
initialize_with { new(read_fixture("summoner.json")) }
|
20
|
+
end
|
21
|
+
factory :history_match, :class => LolApi::HistoryMatch do |f|
|
22
|
+
skip_create
|
23
|
+
initialize_with { new(read_fixture("history.json")) }
|
24
|
+
end
|
25
|
+
factory :match, :class => LolApi::Match do |f|
|
26
|
+
skip_create
|
27
|
+
initialize_with { new(read_fixture("match.json")) }
|
28
|
+
end
|
29
|
+
factory :summoner_masteries, :class => LolApi::SummonerMasteries do |f|
|
30
|
+
skip_create
|
31
|
+
initialize_with { new(read_fixture("summoner_masteries.json")) }
|
32
|
+
end
|
33
|
+
factory :summoner_runes, :class => LolApi::SummonerRunes do |f|
|
34
|
+
skip_create
|
35
|
+
initialize_with { new(read_fixture("summoner_runes.json")) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def read_fixture(name)
|
40
|
+
path = File.expand_path("../fixtures/#{name}", __FILE__)
|
41
|
+
JSON.parse(File.read(path))
|
42
|
+
end
|
43
|
+
|