league_of_legends 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb24c25de66e850d9dd608cd235504806d62ed49
4
- data.tar.gz: 62d67bfae1e98d474303a269d424be00a87385b6
3
+ metadata.gz: 21ccfade51ff560e544f548af350cb73be980487
4
+ data.tar.gz: e17006ccee7c79b70ae0418c427a0d566ce3cc97
5
5
  SHA512:
6
- metadata.gz: 6510780255a3e6ad7745438f0c66828dafce5d2b1371a7c93d4dcc1f7ae3b5e8a1b6b8f76e7213a15a7d241e161b13aa020fe57f3bf42cb8f253ca6734747e1a
7
- data.tar.gz: a5ea29655706338120f4f560505219142fc7bcba7623f7e9da82d9ccfa593e8745e86bd940778ce2029586b6135281cd6348045ae276956c5378abe6ec892d18
6
+ metadata.gz: 37538fb217ff6aa93c291041e41fbffec9b884c31f6ec02543708bc4f7d4ba1bd49941d6033a855a1033e0a23e1f9ad036886616223951b0d72bf5773fc1ffdd
7
+ data.tar.gz: 18a64b71895689bdfd267af7006918e7a835d3dad82bb514219ddbc1c78a9c1a346fe86c7e24bac7d19a110ac1a04c53630c0232d5aaac71826dd16ef0f539f6
@@ -1,5 +1,4 @@
1
- require 'league_of_legends/dto/base'
2
- require 'league_of_legends/dto/champion'
1
+ require 'league_of_legends/dto'
3
2
 
4
3
  module ::LeagueOfLegends
5
4
  module DTO
@@ -1,4 +1,4 @@
1
- require 'league_of_legends/dto/aggregated_stats'
1
+ require 'league_of_legends/dto'
2
2
 
3
3
  module ::LeagueOfLegends
4
4
  module DTO
@@ -1,5 +1,4 @@
1
- require 'league_of_legends/dto/player'
2
- require 'league_of_legends/dto/raw_stats'
1
+ require 'league_of_legends/dto'
3
2
 
4
3
  module ::LeagueOfLegends
5
4
  module DTO
@@ -0,0 +1,27 @@
1
+ require 'league_of_legends/dto'
2
+
3
+ module ::LeagueOfLegends
4
+ module DTO
5
+ class League < ::LeagueOfLegends::DTO::Base
6
+
7
+ def self.version
8
+ 'v2.3'
9
+ end
10
+
11
+ attr_reader :entries, :name, :participant_id, :queue, :tier
12
+
13
+ def initialize json
14
+ attributes = build_attributes json
15
+
16
+ @entries = attributes[:entries].map do |entry|
17
+ ::LeagueOfLegends::DTO::LeagueItem.new(entry)
18
+ end
19
+ @name = attributes[:name]
20
+ @participant_id = attributes[:participantId]
21
+ @queue = attributes[:queue]
22
+ @tier = attributes[:tier]
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ require 'league_of_legends/dto'
2
+
3
+ module ::LeagueOfLegends
4
+ module DTO
5
+ class LeagueItem
6
+
7
+ def self.version
8
+ ::LeagueOfLegends::DTO::League.version
9
+ end
10
+
11
+ attr_reader :is_fresh_blood, :is_hot_streak, :is_inactive, :is_veteran, :last_played, :league_name, :league_points, :mini_series, :player_or_team_id, :player_or_team_name, :queue_type, :rank, :tier, :wins
12
+
13
+ def initialize attributes
14
+ @is_fresh_blood = attributes[:isFreshBlood]
15
+ @is_hot_streak = attributes[:isHotStreak]
16
+ @is_inactive = attributes[:isInactive]
17
+ @is_veteran = attributes[:isVeteran]
18
+ @last_played = attributes[:lastPlayed]
19
+ @league_name = attributes[:leagueName]
20
+ @league_points = attributes[:leaguePoints]
21
+ @mini_series = ::LeagueOfLegends::DTO::MiniSeries.new(attributes[:miniSeries]) if attributes[:miniSeries]
22
+ @player_or_team_id = attributes[:playerOrTeamId]
23
+ @player_or_team_name = attributes[:playerOrTeamName]
24
+ @queue_type = attributes[:queueType]
25
+ @rank = attributes[:rank]
26
+ @tier = attributes[:tier]
27
+ @wins = attributes[:wins]
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,23 @@
1
+ require 'league_of_legends/dto'
2
+
3
+ module ::LeagueOfLegends
4
+ module DTO
5
+ class MiniSeries
6
+
7
+ def self.version
8
+ ::LeagueOfLegends::DTO::League.version
9
+ end
10
+
11
+ attr_reader :losses, :progress, :target, :time_left_to_play_millis, :wins
12
+
13
+ def initialize attributes
14
+ @losses = attributes[:losses]
15
+ @progress = attributes[:progress]
16
+ @target = attributes[:target]
17
+ @time_left_to_play_millis = attributes[:timeLeftToPlayMillis]
18
+ @wins = attributes[:wins]
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -4,6 +4,9 @@ require 'league_of_legends/dto/champion'
4
4
  require 'league_of_legends/dto/champion_list'
5
5
  require 'league_of_legends/dto/champion_stats'
6
6
  require 'league_of_legends/dto/game'
7
+ require 'league_of_legends/dto/league'
8
+ require 'league_of_legends/dto/league_item'
9
+ require 'league_of_legends/dto/mini_series'
7
10
  require 'league_of_legends/dto/player'
8
11
  require 'league_of_legends/dto/player_stats_summary'
9
12
  require 'league_of_legends/dto/player_stats_summary_list'
@@ -1,3 +1,3 @@
1
1
  module LeagueOfLegends
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -0,0 +1,42 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe ::LeagueOfLegends::DTO::LeagueItem do
4
+
5
+ let(:json) { {
6
+ isHotStreak: false,
7
+ isFreshBlood: true,
8
+ leagueName: "Miss Fortune\'s Weaponmasters",
9
+ isVeteran: false,
10
+ tier: "CHALLENGER",
11
+ lastPlayed: -1,
12
+ playerOrTeamId: "19331582",
13
+ leaguePoints: 248,
14
+ rank: "I",
15
+ isInactive: false,
16
+ queueType: "RANKED_SOLO_5x5",
17
+ playerOrTeamName: "Gripex",
18
+ wins: 85
19
+ } }
20
+ let(:dto){ described_class.new(json) }
21
+
22
+ it "has attributes" do
23
+ expect(dto.is_hot_streak).to be_false
24
+ expect(dto.is_fresh_blood).to be_true
25
+ expect(dto.league_name).to eq "Miss Fortune\'s Weaponmasters"
26
+ expect(dto.is_veteran).to be_false
27
+ expect(dto.tier).to eq "CHALLENGER"
28
+ expect(dto.last_played).to eq -1
29
+ expect(dto.player_or_team_id).to eq "19331582"
30
+ expect(dto.league_points).to eq 248
31
+ expect(dto.rank).to eq "I"
32
+ expect(dto.is_inactive).to be_false
33
+ expect(dto.queue_type).to eq "RANKED_SOLO_5x5"
34
+ expect(dto.player_or_team_name).to eq "Gripex"
35
+ expect(dto.wins).to eq 85
36
+ end
37
+
38
+ it "has a version" do
39
+ expect(described_class.version).to eq 'v2.3'
40
+ end
41
+
42
+ end
@@ -0,0 +1,104 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe ::LeagueOfLegends::DTO::League do
4
+
5
+ let(:json) { '{
6
+ "queue": "RANKED_SOLO_5x5",
7
+ "name": "Miss Fortune\'s Weaponmasters",
8
+ "entries": [
9
+ {
10
+ "isHotStreak": false,
11
+ "isFreshBlood": true,
12
+ "leagueName": "Miss Fortune\'s Weaponmasters",
13
+ "isVeteran": false,
14
+ "tier": "CHALLENGER",
15
+ "lastPlayed": -1,
16
+ "playerOrTeamId": "19331582",
17
+ "leaguePoints": 248,
18
+ "rank": "I",
19
+ "isInactive": false,
20
+ "queueType": "RANKED_SOLO_5x5",
21
+ "playerOrTeamName": "Gripex",
22
+ "wins": 85
23
+ },
24
+ {
25
+ "isHotStreak": false,
26
+ "isFreshBlood": true,
27
+ "leagueName": "Miss Fortune\'s Weaponmasters",
28
+ "isVeteran": false,
29
+ "tier": "CHALLENGER",
30
+ "lastPlayed": -1,
31
+ "playerOrTeamId": "22432605",
32
+ "leaguePoints": 79,
33
+ "rank": "I",
34
+ "isInactive": false,
35
+ "queueType": "RANKED_SOLO_5x5",
36
+ "playerOrTeamName": "Wygon",
37
+ "wins": 141
38
+ },
39
+ {
40
+ "isHotStreak": false,
41
+ "isFreshBlood": false,
42
+ "leagueName": "Miss Fortune\'s Weaponmasters",
43
+ "isVeteran": false,
44
+ "tier": "CHALLENGER",
45
+ "lastPlayed": -1,
46
+ "playerOrTeamId": "20313290",
47
+ "leaguePoints": 306,
48
+ "rank": "I",
49
+ "isInactive": false,
50
+ "queueType": "RANKED_SOLO_5x5",
51
+ "playerOrTeamName": "SK Zvanillan",
52
+ "wins": 66
53
+ },
54
+ {
55
+ "isHotStreak": false,
56
+ "isFreshBlood": false,
57
+ "leagueName": "Miss Fortune\'s Weaponmasters",
58
+ "isVeteran": true,
59
+ "tier": "CHALLENGER",
60
+ "lastPlayed": -1,
61
+ "playerOrTeamId": "39600294",
62
+ "leaguePoints": 664,
63
+ "rank": "I",
64
+ "isInactive": false,
65
+ "queueType": "RANKED_SOLO_5x5",
66
+ "playerOrTeamName": "Krebsen",
67
+ "wins": 107
68
+ },
69
+ {
70
+ "isHotStreak": false,
71
+ "isFreshBlood": false,
72
+ "leagueName": "Miss Fortune\'s Weaponmasters",
73
+ "isVeteran": false,
74
+ "tier": "CHALLENGER",
75
+ "lastPlayed": -1,
76
+ "playerOrTeamId": "20482323",
77
+ "leaguePoints": 274,
78
+ "rank": "I",
79
+ "isInactive": false,
80
+ "queueType": "RANKED_SOLO_5x5",
81
+ "playerOrTeamName": "Esito",
82
+ "wins": 121
83
+ }
84
+ ],
85
+ "tier": "CHALLENGER"
86
+ }' }
87
+ let(:dto){ described_class.new(json) }
88
+
89
+ it "has attributes" do
90
+ expect(dto.queue).to eq "RANKED_SOLO_5x5"
91
+ expect(dto.name).to eq "Miss Fortune\'s Weaponmasters"
92
+ expect(dto.entries).to be_an_instance_of Array
93
+ expect(dto.entries.count).to eq 5
94
+ dto.entries.each do |entry|
95
+ expect(entry).to be_an_instance_of ::LeagueOfLegends::DTO::LeagueItem
96
+ end
97
+ expect(dto.tier).to eq "CHALLENGER"
98
+ end
99
+
100
+ it "has a version" do
101
+ expect(described_class.version).to eq 'v2.3'
102
+ end
103
+
104
+ end
@@ -0,0 +1,26 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe ::LeagueOfLegends::DTO::MiniSeries do
4
+
5
+ let(:json) { { #made up
6
+ losses: 123,
7
+ progress: [],
8
+ target: 123,
9
+ timeLeftToPlayMillis: 123123,
10
+ wins: 123
11
+ } }
12
+ let(:dto){ described_class.new(json) }
13
+
14
+ it "has attributes" do
15
+ expect(dto.losses).to eq 123
16
+ expect(dto.progress).to be_an_instance_of Array
17
+ expect(dto.target).to eq 123
18
+ expect(dto.time_left_to_play_millis).to eq 123123
19
+ expect(dto.wins).to eq 123
20
+ end
21
+
22
+ it "has a version" do
23
+ expect(described_class.version).to eq 'v2.3'
24
+ end
25
+
26
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: league_of_legends
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francisco Orvalho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-15 00:00:00.000000000 Z
11
+ date: 2014-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -113,6 +113,9 @@ files:
113
113
  - lib/league_of_legends/dto/champion_list.rb
114
114
  - lib/league_of_legends/dto/champion_stats.rb
115
115
  - lib/league_of_legends/dto/game.rb
116
+ - lib/league_of_legends/dto/league.rb
117
+ - lib/league_of_legends/dto/league_item.rb
118
+ - lib/league_of_legends/dto/mini_series.rb
116
119
  - lib/league_of_legends/dto/player.rb
117
120
  - lib/league_of_legends/dto/player_stats_summary.rb
118
121
  - lib/league_of_legends/dto/player_stats_summary_list.rb
@@ -141,6 +144,9 @@ files:
141
144
  - spec/league_of_legends/dto/champion_spec.rb
142
145
  - spec/league_of_legends/dto/champion_stats_spec.rb
143
146
  - spec/league_of_legends/dto/game_spec.rb
147
+ - spec/league_of_legends/dto/league_item_spec.rb
148
+ - spec/league_of_legends/dto/league_spec.rb
149
+ - spec/league_of_legends/dto/mini_series_spec.rb
144
150
  - spec/league_of_legends/dto/player_spec.rb
145
151
  - spec/league_of_legends/dto/player_stats_summary_list_spec.rb
146
152
  - spec/league_of_legends/dto/player_stats_summary_spec.rb
@@ -193,6 +199,9 @@ test_files:
193
199
  - spec/league_of_legends/dto/champion_spec.rb
194
200
  - spec/league_of_legends/dto/champion_stats_spec.rb
195
201
  - spec/league_of_legends/dto/game_spec.rb
202
+ - spec/league_of_legends/dto/league_item_spec.rb
203
+ - spec/league_of_legends/dto/league_spec.rb
204
+ - spec/league_of_legends/dto/mini_series_spec.rb
196
205
  - spec/league_of_legends/dto/player_spec.rb
197
206
  - spec/league_of_legends/dto/player_stats_summary_list_spec.rb
198
207
  - spec/league_of_legends/dto/player_stats_summary_spec.rb
@@ -207,4 +216,3 @@ test_files:
207
216
  - spec/league_of_legends/request/stats/by_summoner/summary_spec.rb
208
217
  - spec/league_of_legends/spec_helper.rb
209
218
  - spec/setup_vcr.rb
210
- has_rdoc: