riot_lol_api 0.3.0 → 0.3.1

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: 5478aba407d784e06d3089a1f799552761e5d3bd
4
- data.tar.gz: 25813f0d58ec6906a16e4a69bca6dec31b4345cf
3
+ metadata.gz: e29d98a8f7702340c689e953c3353462678ab813
4
+ data.tar.gz: b61b304f4e4daf2960a65c725ccab92f1f60f3b0
5
5
  SHA512:
6
- metadata.gz: d8dbde42488d124a7214676564378434dd41fe8d8f7c262c92ec22fc855d7b4a932c380acbd0d8ab079d6f4713301fcb7b79269ff94374d3d7a5ed327117692a
7
- data.tar.gz: 0950cebd986206dfadb7e058007e618e59d485c727da6b3e8e38d487a8f66e6dfe1940ea50506db97201d28a7c4d208a80365c3042a34310aa879d65e1c291fd
6
+ metadata.gz: 0f8af68b5e1994ede72cf635f9ce0ea9cf113bcf86b253a41c98346b1ed8292772f90c9429b4e43aa5a0de81c9191193e6a80bf0e82776b688841e431f7f19f4
7
+ data.tar.gz: faf1e452651caf3df979aaaca73f047fb3ebf9965574c7fcb17435959a7d224be2bb7979acea55fb8f130b378ca3f6d25d358754cd112dad4f5727e76afc676a
data/README.md CHANGED
@@ -23,7 +23,7 @@
23
23
  - league-v2.5 PROGRESS
24
24
  - lol-static-data-v1.2 OK
25
25
  - lol-status-v1.0 NO IMPLEMENT
26
- - match-v2.2 PROGRESS
26
+ - match-v2.2 OK
27
27
  - matchhistory-v2.2 PROGRESS
28
28
  - stats-v1.3 OK
29
29
  - summoner-v1.4 OK
@@ -103,6 +103,7 @@ summoner.current_game
103
103
 
104
104
  ## Change logs
105
105
 
106
+ - v 0.3.1 : Add get match by id methods
106
107
  - v 0.3.0 : Add current game and featured games methods
107
108
  - v 0.2.0 : Add method matchhistory and update SEASON2015
108
109
  - v 0.1.12 : Add class datnum for champion entry
@@ -296,6 +296,15 @@ module RiotLolApi
296
296
  end
297
297
  end
298
298
 
299
+ def match game_id
300
+ response = Client.get("#{@region}/v2.2/match/#{game_id}",@region)
301
+ unless response.nil?
302
+ RiotLolApi::Model::Match.new(response.to_symbol)
303
+ else
304
+ nil
305
+ end
306
+ end
307
+
299
308
  def get_versions
300
309
  response = Client.get("static-data/#{@region}/v1.2/versions","global")
301
310
  unless response.nil?
@@ -0,0 +1,14 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Ban
4
+
5
+ def initialize(options = {})
6
+ options.each do |key, value|
7
+ self.class.send(:attr_accessor, key.to_sym)
8
+ instance_variable_set("@#{key}", value)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -9,6 +9,10 @@ module RiotLolApi
9
9
  end
10
10
  end
11
11
 
12
+ def which_team_win
13
+ self.teams.first.win? ? self.teams.first.team_id : self.teams.last.team_id
14
+ end
15
+
12
16
  end
13
17
  end
14
18
  end
@@ -18,6 +18,8 @@ require 'riot_lol_api/model/players'
18
18
  require 'riot_lol_api/model/observers'
19
19
  require 'riot_lol_api/model/game_lists'
20
20
  require 'riot_lol_api/model/banned_champions'
21
+ require 'riot_lol_api/model/teams'
22
+ require 'riot_lol_api/model/bans'
21
23
 
22
24
 
23
25
  module RiotLolApi
@@ -0,0 +1,18 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Team
4
+
5
+ def initialize(options = {})
6
+ options.each do |key, value|
7
+ self.class.send(:attr_accessor, key.to_sym)
8
+ instance_variable_set("@#{key}", value)
9
+ end
10
+ end
11
+
12
+ def win?
13
+ self.winner
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module RiotLolApi
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/riot_lol_api.gemspec CHANGED
@@ -27,12 +27,12 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
 
29
29
  spec.add_development_dependency "bundler", "~> 1.5"
30
- spec.add_development_dependency "rake"
30
+ spec.add_development_dependency "rake", "~> 10.3.0"
31
31
  spec.add_development_dependency "rspec", "~> 2.14.1"
32
- spec.add_development_dependency "factory_girl"
33
- spec.add_development_dependency "webmock"
34
- spec.add_development_dependency "pry"
32
+ spec.add_development_dependency "factory_girl", "~> 4.4.0"
33
+ spec.add_development_dependency "webmock", "~> 1.17.4"
34
+ spec.add_development_dependency "pry", "~> 0.10.1"
35
35
 
36
- spec.add_dependency "httparty"
37
- spec.add_dependency "activesupport"
36
+ spec.add_dependency "httparty", "~> 0.13.1"
37
+ spec.add_dependency "activesupport", ">= 3.0.0"
38
38
  end
@@ -555,6 +555,30 @@ describe RiotLolApi::Client do
555
555
  end
556
556
  end
557
557
 
558
+ describe "get_match_by_id" do
559
+ before(:each) do
560
+ # Create client
561
+ client = FactoryGirl.build(:client)
562
+
563
+ api_response = File.read 'spec/mock_response/get_match_by_id.json'
564
+ stub_request(:get, "https://#{client.region}.api.pvp.net/api/lol/#{client.region}/v2.2/match/1617870200?api_key=#{RiotLolApi::TOKEN}").to_return(api_response)
565
+
566
+ @get_match_by_id = client.match 1617870200
567
+ end
568
+
569
+ it "should have good attributes" do
570
+ expect(@get_match_by_id.participants.first).to be_a RiotLolApi::Model::Participant
571
+ expect(@get_match_by_id.participants.first.stats).to be_a RiotLolApi::Model::Stat
572
+ expect(@get_match_by_id.participants.first.timeline).to be_a RiotLolApi::Model::Timeline
573
+ expect(@get_match_by_id.participant_identities.first).to be_a RiotLolApi::Model::ParticipantIdentity
574
+ expect(@get_match_by_id.participant_identities.first.player).to be_a RiotLolApi::Model::Player
575
+ end
576
+
577
+ it "should know which team win" do
578
+ expect(@get_match_by_id.which_team_win).to be_a Integer
579
+ end
580
+ end
581
+
558
582
  describe "get_featured_games" do
559
583
  before(:each) do
560
584
  # Create client
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riot_lol_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - francois_blanchard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-20 00:00:00.000000000 Z
11
+ date: 2015-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 10.3.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 10.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,72 +56,72 @@ dependencies:
56
56
  name: factory_girl
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 4.4.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 4.4.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 1.17.4
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 1.17.4
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.10.1
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 0.10.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: httparty
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 0.13.1
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 0.13.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: activesupport
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 3.0.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 3.0.0
125
125
  description: Riot games api wrapper for ruby
126
126
  email:
127
127
  - francois.blanchard1@gmail.com
@@ -144,6 +144,7 @@ files:
144
144
  - lib/riot_lol_api/model/aggregated_stats.rb
145
145
  - lib/riot_lol_api/model/altimages.rb
146
146
  - lib/riot_lol_api/model/banned_champions.rb
147
+ - lib/riot_lol_api/model/bans.rb
147
148
  - lib/riot_lol_api/model/blocks.rb
148
149
  - lib/riot_lol_api/model/champions.rb
149
150
  - lib/riot_lol_api/model/class_base.rb
@@ -183,6 +184,7 @@ files:
183
184
  - lib/riot_lol_api/model/spells.rb
184
185
  - lib/riot_lol_api/model/stats.rb
185
186
  - lib/riot_lol_api/model/summoners.rb
187
+ - lib/riot_lol_api/model/teams.rb
186
188
  - lib/riot_lol_api/model/timelines.rb
187
189
  - lib/riot_lol_api/model/vars.rb
188
190
  - lib/riot_lol_api/model/xpdiffpermindeltas.rb