taric 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e7a47c9d9fcc0b6a342967bbcdce1d36df210e3
4
- data.tar.gz: 05d90533b37c099998da7b6c9c49926a53049d48
3
+ metadata.gz: 5d7d5bd2d82c7a170eb90b471c89dbe128e9a4fe
4
+ data.tar.gz: 50920d65ad41b29f90f110e5dc94dad9778c0b22
5
5
  SHA512:
6
- metadata.gz: e15826735122a20bd4bc40aab70f0a6ab792742d11ccd125cea6ffef22be2f888b3b3803798f8cbc3e7f4fc4df24c64b5d62237aad3be7121d88effc054765b3
7
- data.tar.gz: 0865f86f099767656b268235feb4cb6c045362114ae3e783c842666f9321f796647113eea68ba188f6ab948b9cc7b4e26143232c576700dae20d156791ba1432
6
+ metadata.gz: 569901532a3f398f084a33f07adeb48e797a5d01ed4e3cdd339acb18af3bc33587f81fc8eb8d5bfcd2b0d1f0dc61e164931e2ed0cbac481bc6e4ccb4e81da12e
7
+ data.tar.gz: e91429937212e222b021fd0029daf59f5d605de31cf65a5a6c71018f8fec11e9d7397430ee7f743f710138763eed7a0d523e0c31cfa339c4dcf91d38fca0d498
data/bin/console CHANGED
File without changes
data/bin/setup CHANGED
File without changes
@@ -9,7 +9,7 @@ module Taric
9
9
 
10
10
  Faraday::Connection.new(options) do |conn|
11
11
  #conn.use FaradayMiddleware::Mashify
12
- conn.response :raise_error
12
+ #conn.response :raise_error
13
13
  conn.response :json, :content_type => /\bjson$/
14
14
  conn.adapter config.adapter
15
15
  end
@@ -6,6 +6,7 @@ require_relative 'league'
6
6
  require_relative 'lol_static_data'
7
7
  require_relative 'lol_status'
8
8
  require_relative 'match'
9
+ require_relative 'match_history'
9
10
  require_relative 'stats'
10
11
  require_relative 'summoner'
11
12
  module Taric
@@ -19,6 +20,7 @@ module Taric
19
20
  include Taric::Operation::LolStaticData
20
21
  include Taric::Operation::LolStatus
21
22
  include Taric::Operation::Match
23
+ include Taric::Operation::MatchHistory
22
24
  include Taric::Operation::Stats
23
25
  include Taric::Operation::Summoner
24
26
 
@@ -6,20 +6,20 @@ module Taric
6
6
  VERSION = 'v1.2'
7
7
  BASE_STATIC_URL = "https://global.api.pvp.net/api/lol/static-data/{region}/#{VERSION}"
8
8
 
9
- STATIC_CHAMPIONS = Addressable::Template.new "#{BASE_STATIC_URL}/champion{?api_key,dataById}"
10
- STATIC_CHAMPION = Addressable::Template.new "#{STATIC_CHAMPIONS}/{id}{?api_key}"
11
- STATIC_ITEMS = Addressable::Template.new "#{BASE_STATIC_URL}/item{?api_key}"
12
- STATIC_ITEM = Addressable::Template.new "#{STATIC_ITEMS}/{id}{?api_key}"
13
- STATIC_LANGUAGE_STRINGS = Addressable::Template.new "#{BASE_STATIC_URL}/language-strings{?api_key}"
9
+ STATIC_CHAMPIONS = Addressable::Template.new "#{BASE_STATIC_URL}/champion{?api_key,dataById,locale,version}"
10
+ STATIC_CHAMPION = Addressable::Template.new "#{BASE_STATIC_URL}/champion/{id}{?api_key,locale,version}"
11
+ STATIC_ITEMS = Addressable::Template.new "#{BASE_STATIC_URL}/item{?api_key,itemListData,locale,version}"
12
+ STATIC_ITEM = Addressable::Template.new "#{BASE_STATIC_URL}/item/{id}{?api_key,itemData,locale,version}"
13
+ STATIC_LANGUAGE_STRINGS = Addressable::Template.new "#{BASE_STATIC_URL}/language-strings{?api_key,locale,version}"
14
14
  STATIC_LANGUAGES = Addressable::Template.new "#{BASE_STATIC_URL}/languages{?api_key}"
15
15
  STATIC_MAP = Addressable::Template.new "#{BASE_STATIC_URL}/map{?api_key}"
16
- STATIC_MASTERIES = Addressable::Template.new "#{BASE_STATIC_URL}/mastery{?api_key}"
17
- STATIC_MASTERY = Addressable::Template.new "#{STATIC_MASTERIES}/{id}{?api_key}"
16
+ STATIC_MASTERIES = Addressable::Template.new "#{BASE_STATIC_URL}/mastery{?api_key,masteryListData,locale,version}"
17
+ STATIC_MASTERY = Addressable::Template.new "#{BASE_STATIC_URL}/mastery/{id}{?api_key,masteryData,locale,version}"
18
18
  STATIC_REALM = Addressable::Template.new "#{BASE_STATIC_URL}/realm{?api_key}"
19
- STATIC_RUNES = Addressable::Template.new "#{BASE_STATIC_URL}/rune{?api_key}"
20
- STATIC_RUNE = Addressable::Template.new "#{STATIC_RUNES}/{id}{?api_key}"
21
- STATIC_SUMMONER_SPELLS = Addressable::Template.new "#{BASE_STATIC_URL}/summoner-spell{?api_key}"
22
- STATIC_SUMMONER_SPELL = Addressable::Template.new "#{STATIC_SUMMONER_SPELLS}/{id}{?api_key}"
19
+ STATIC_RUNES = Addressable::Template.new "#{BASE_STATIC_URL}/rune{?api_key,runeListData,locale,version}"
20
+ STATIC_RUNE = Addressable::Template.new "#{BASE_STATIC_URL}/rune/{id}{?api_key,runeData,locale,version}"
21
+ STATIC_SUMMONER_SPELLS = Addressable::Template.new "#{BASE_STATIC_URL}/summoner-spell{?api_key,spellData,locale,version}"
22
+ STATIC_SUMMONER_SPELL = Addressable::Template.new "#{BASE_STATIC_URL}/summoner-spell/{id}{?api_key,spellData,locale,version}"
23
23
  STATIC_VERSIONS = Addressable::Template.new "#{BASE_STATIC_URL}/versions{?api_key}"
24
24
 
25
25
  CHAMP_DATA_OPTIONS = [
@@ -131,8 +131,9 @@ module Taric
131
131
 
132
132
  LOCALE_KEYS = LOCALE.keys
133
133
 
134
- # Static champion data
134
+ # Static data for champions
135
135
  #
136
+ # @see https://developer.riotgames.com/api/methods#!/968/3326
136
137
  # @param data_by_id [Boolean] optional, if true, champion data keyed to IDs
137
138
  # @param champ_data_option [String] optional, filter from [CHAMP_DATA_OPTIONS]
138
139
  # @param locale [Symbol] optional, results will be in locale [LOCALE], or default for region if nil
@@ -141,64 +142,130 @@ module Taric
141
142
  # @return [Hash] of static champion data
142
143
  #
143
144
  # @example
145
+ # # Defaults
144
146
  # champions = client.static_champions
145
- # champions_mapped_by_id = client.static_champions(data_by_id: true)
147
+ # # Mapped by IDs
148
+ # champions = client.static_champions(data_by_id: true)
146
149
  def static_champions(data_by_id: nil, champ_data_option: nil, locale: nil, version: nil)
147
150
  response_for STATIC_CHAMPIONS, {dataById: data_by_id, champData: champ_data_option, locale: locale, version: version}
148
151
  end
149
152
 
153
+ # Static data for champion by id
154
+ #
155
+ # @see https://developer.riotgames.com/api/methods#!/968/3322
156
+ # @param id [Fixnum] id of champion
157
+ # @param champ_data_option [String] optional, filter from [CHAMP_DATA_OPTIONS]
158
+ # @param locale [Symbol] optional, results will be in locale [LOCALE], or default for region if nil
159
+ # @param version [String] optional, enforces version of static data, or latest if nil
160
+ #
161
+ # @return [Hash] of static champion data
162
+ #
163
+ # @example
164
+ # champions = client.static_champions(id: 44)
150
165
  def static_champion(id:, champ_data_option: nil, locale: nil, version: nil)
151
166
  response_for STATIC_CHAMPION, {id: id, champData: champ_data_option, locale: locale, version: version}
152
167
  end
153
168
 
169
+ # Static data for items
170
+ #
171
+ # @see https://developer.riotgames.com/api/methods#!/968/3314
172
+ # @param item_data_option [String] optional, filter from [ITEM_DATA_OPTIONS]
173
+ # @param locale [Symbol] optional, results will be in locale [LOCALE], or default for region if nil
174
+ # @param version [String] optional, enforces version of static data, or latest if nil
175
+ #
176
+ # @return [Hash] of static item data
177
+ #
178
+ # @example
179
+ # # Defaults
180
+ # champions = client.static_items
154
181
  def static_items(item_data_option: nil, locale: nil, version: nil)
155
- response_for STATIC_ITEMS, {itemListData: item_data_option, locale: locale, version: version,}
182
+ response_for STATIC_ITEMS, {itemListData: item_data_option, locale: locale, version: version}
156
183
  end
157
184
 
185
+ # Static data for item by id
186
+ #
187
+ # @see https://developer.riotgames.com/api/methods#!/968/3319
188
+ # @param id [Fixnum] id of item
189
+ # @param item_data_option [String] optional, filter from [ITEM_DATA_OPTIONS]
190
+ # @param locale [Symbol] optional, results will be in locale [LOCALE], or default for region if nil
191
+ # @param version [String] optional, enforces version of static data, or latest if nil
192
+ #
193
+ # @return [Hash] of static item data for id
194
+ #
195
+ # @example
196
+ # item = client.static_item(id: 2049)
158
197
  def static_item(id:, item_data_option: nil, locale: nil, version: nil)
159
198
  response_for STATIC_ITEM, {id: id, itemData: item_data_option, locale: locale, version: version}
160
199
  end
161
200
 
201
+ # Returns [Hash] of language string data.
202
+ #
203
+ # @see https://developer.riotgames.com/api/methods#!/968/3316
204
+ # @param locale [Symbol] optional, results will be in locale [LOCALE], or default for region if nil
205
+ # @param version [String] optional, enforces version of static data, or latest if nil
206
+ # @return [Hash] of language string data
207
+ # @example
208
+ # language_strings = client.static_language_strings
162
209
  def static_language_strings(locale: nil, version: nil)
163
210
  response_for STATIC_LANGUAGE_STRINGS, {locale: locale, version: version}
164
211
  end
165
212
 
213
+ # Returns [Array] of languages.
214
+ #
215
+ # @see https://developer.riotgames.com/api/methods#!/968/3324
216
+ # @return [Array] of languages
217
+ # @example
218
+ # languages = client.static_languages
166
219
  def static_languages
167
220
  response_for STATIC_LANGUAGES
168
221
  end
169
222
 
223
+ # @see https://developer.riotgames.com/api/methods#!/968/3328
170
224
  def static_map(locale: nil, version: nil)
171
225
  response_for STATIC_MAP, {locale: locale, version: version}
172
226
  end
173
227
 
228
+ # @see https://developer.riotgames.com/api/methods#!/968/3317
174
229
  def static_masteries(mastery_data_option: nil, locale: nil, version: nil)
175
230
  response_for STATIC_MASTERIES, {masteryListData: mastery_data_option, locale: locale, version: version}
176
231
  end
177
232
 
233
+ # @see https://developer.riotgames.com/api/methods#!/968/3318
178
234
  def static_mastery(id:, mastery_data_option: nil, locale: nil, version: nil)
179
235
  response_for STATIC_MASTERY, {id: id, masteryData: mastery_data_option, locale:locale, version: version}
180
236
  end
181
237
 
238
+ # @see https://developer.riotgames.com/api/methods#!/968/3325
182
239
  def static_realm
183
240
  response_for STATIC_REALM
184
241
  end
185
242
 
243
+ # @see https://developer.riotgames.com/api/methods#!/968/3315
186
244
  def static_runes(rune_data_option: nil, locale: nil, version: nil)
187
245
  response_for STATIC_RUNES, {runeListData: rune_data_option, locale: locale, version: version}
188
246
  end
189
247
 
248
+ # @see https://developer.riotgames.com/api/methods#!/968/3321
190
249
  def static_rune(id:, rune_data_option: nil, locale: nil, version: nil)
191
250
  response_for STATIC_RUNE, {id: id, runeData: rune_data_option, locale: locale, version: version}
192
251
  end
193
252
 
253
+ # @see https://developer.riotgames.com/api/methods#!/968/3327
194
254
  def static_summoner_spells(data_by_id: nil, spell_data_option: nil, locale: nil, version: nil)
195
255
  response_for STATIC_SUMMONER_SPELLS, {dataById: data_by_id, spellData: spell_data_option, locale: locale, version: version}
196
256
  end
197
257
 
258
+ # @see https://developer.riotgames.com/api/methods#!/968/3320
198
259
  def static_summoner_spell(id:, spell_data_option: nil, locale: nil, version: nil)
199
260
  response_for STATIC_SUMMONER_SPELL, {id: id, spellData: spell_data_option, locale: locale, version: version}
200
261
  end
201
262
 
263
+ # Returns [Array] of static data version numbers.
264
+ #
265
+ # @see https://developer.riotgames.com/api/methods#!/968/3323
266
+ # @return [Array] of version numbers
267
+ # @example
268
+ # versions = client.static_versions
202
269
  def static_versions
203
270
  response_for STATIC_VERSIONS
204
271
  end
@@ -5,8 +5,13 @@ module Taric
5
5
  include Taric::Operation::Base
6
6
 
7
7
  MATCH_VERSION = 'v2.2'
8
- MATCH = Addressable::Template.new "#{BASE_URL_FN.(MATCH_VERSION)}/match/{matchId}"
8
+ MATCH = Addressable::Template.new "#{BASE_URL_FN.(MATCH_VERSION)}/match/{matchId}{?api_key,includeTimeline}"
9
9
 
10
+ # Match data for id.
11
+ #
12
+ # @see https://developer.riotgames.com/api/methods#!/967/3313
13
+ # @param id [Fixnum] id of match
14
+ # @param include_timeline [Boolean] optional, true includes timestamps on events
10
15
  def match(id:, include_timeline: nil)
11
16
  response_for MATCH, {matchId: id, includeTimeline: include_timeline}
12
17
  end
@@ -0,0 +1,17 @@
1
+ require_relative 'base'
2
+ module Taric
3
+ module Operation
4
+ module MatchHistory
5
+ include Taric::Operation::Base
6
+
7
+ MATCH_HISTORY_VERSION = 'v2.2'
8
+ MATCH_HISTORY = Addressable::Template.new "#{BASE_URL_FN.(MATCH_HISTORY_VERSION)}/matchhistory/{summonerId}{?api_key,championIds,rankedQueues,beginIndex,endIndex}"
9
+
10
+ # @see https://developer.riotgames.com/api/methods#!/966/3312
11
+ def match_history(summoner_id:, champion_ids: nil, ranked_queues: nil, begin_index: nil, end_index: nil)
12
+ response_for MATCH_HISTORY,
13
+ {summonerId: summoner_id, championIds: champion_ids, rankedQueues: ranked_queues, beginIndex: begin_index, endIndex: end_index}
14
+ end
15
+ end
16
+ end
17
+ end
@@ -5,15 +5,17 @@ module Taric
5
5
  include Taric::Operation::Base
6
6
 
7
7
  STATS_VERSION = 'v1.3'.freeze
8
- BASE_STATS_URL = Addressable::Template.new "#{BASE_URL_FN.(STATS_VERSION)}/stats/by-summoner/{summonerId}{?api_key}"
9
- RANKED = Addressable::Template.new "#{BASE_STATS_URL}/ranked{?api_key}"
10
- SUMMARY = Addressable::Template.new "#{BASE_STATS_URL}/summary{?api_key}"
8
+ BASE_STATS_URL = "#{BASE_URL_FN.(STATS_VERSION)}/stats/by-summoner/{summonerId}"
9
+ RANKED = Addressable::Template.new "#{BASE_STATS_URL}/ranked{?api_key,season}"
10
+ SUMMARY = Addressable::Template.new "#{BASE_STATS_URL}/summary{?api_key,season}"
11
11
 
12
- def ranked(summoner_id: , season: nil)
12
+ # @see https://developer.riotgames.com/api/methods#!/961/3297
13
+ def ranked_stats(summoner_id: , season: nil)
13
14
  response_for RANKED, {summonerId: summoner_id, season: season}
14
15
  end
15
16
 
16
- def summary(summoner_id: , season: nil)
17
+ # @see https://developer.riotgames.com/api/methods#!/961/3298
18
+ def summary_stats(summoner_id: , season: nil)
17
19
  response_for SUMMARY, {summonerId: summoner_id, season: season}
18
20
  end
19
21
  end
@@ -6,8 +6,9 @@ module Taric
6
6
 
7
7
  VERSION = 'v1.4'
8
8
  BASE_SUMMONER_URL = "#{BASE_URL_FN.(VERSION)}/summoner"
9
- BY_NAMES = Addressable::Template.new "#{BASE_SUMMONER_URL}/by-name/{summonerNames}{?api_key}"
10
9
  BASE_SUMMONERS_BY_IDS = "#{BASE_SUMMONER_URL}/{summonerIds}"
10
+
11
+ SUMMONERS_BY_NAMES = Addressable::Template.new "#{BASE_SUMMONER_URL}/by-name/{summonerNames}{?api_key}"
11
12
  SUMMONERS_BY_IDS = Addressable::Template.new "#{BASE_SUMMONERS_BY_IDS}{?api_key}"
12
13
  MASTERIES = Addressable::Template.new "#{BASE_SUMMONERS_BY_IDS}/masteries{?api_key}"
13
14
  NAMES = Addressable::Template.new "#{BASE_SUMMONERS_BY_IDS}/name{?api_key}"
@@ -23,7 +24,7 @@ module Taric
23
24
  # summoners = client.summoners_by_name(summoner_names: 'orlyzomg,ipa,dbanksdesign,lzrface,doodiediddle')
24
25
  # summoner = summoners['orlyzomg']
25
26
  def summoners_by_names(summoner_names:)
26
- response_for BY_NAMES, {summonerNames: summoner_names}
27
+ response_for SUMMONERS_BY_NAMES, {summonerNames: summoner_names}
27
28
  end
28
29
 
29
30
  # Returns [Hash] of summoner data hashes keyed by summoner ID
data/lib/taric/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Taric
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Yi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-03-17 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -215,6 +215,7 @@ files:
215
215
  - lib/taric/operation/lol_static_data.rb
216
216
  - lib/taric/operation/lol_status.rb
217
217
  - lib/taric/operation/match.rb
218
+ - lib/taric/operation/match_history.rb
218
219
  - lib/taric/operation/stats.rb
219
220
  - lib/taric/operation/summoner.rb
220
221
  - lib/taric/operation/team.rb