outrageous 0.0.0 → 0.0.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: c34f7aabd31ac9c5fb8db8ca83b94e6b52104c08
4
- data.tar.gz: 164f347f491b2fd13a9d4dbf3021a2112adc07ec
3
+ metadata.gz: 79876b09590ca58d3dc9198a2c4628a8610b1ee6
4
+ data.tar.gz: a7a02b64858e22c1b62c94d0f6368e73c28a9b84
5
5
  SHA512:
6
- metadata.gz: bc71ffcae681ce9c379823bf3fb1521d6fc183298cf81ebfc72bf20b0db0538b01e587406003bb99930c8a31ffd20b2f061b7cd66af1552affbc35e3fd7da254
7
- data.tar.gz: d8340dba22a6d69f642e6b86fcc46ddc1c70ec4cca014043993802543ffcb3a39193308f52b16f4bd7c5dc0a5f7cd562a3e2c7b0bac00bc8f791f40af5a6fd2b
6
+ metadata.gz: d8ccf00bbf15d8a442ce62ce7881bd92a28add9fe5335a858804109ef4548fed5f459c718ee42920dc5abf1f8d071c2c1474d3dcfdde69aaf06f335f2da1653b
7
+ data.tar.gz: 31572dbf7397de742678501eb168bc04f238c5766f06c46976699b58733923fa320f8f4096c0a7a1dd62172385c7a042ba09b8b777ece2a44b328be6c9cf27da
data/README.md CHANGED
@@ -60,7 +60,7 @@ Outrageous::League.new(api_key: 'your-truly-truly-truly-outrageously-api-key').g
60
60
  Outrageous::League.new(api_key: 'your-truly-truly-truly-outrageously-api-key').get_leagues_entry_by_team_id(team_id)
61
61
 
62
62
  # GET /api/lol/{region}/v2.3/league/challenger Retrieves challenger tier leagues. (REST)
63
- Outrageous::League.new(api_key: 'your-truly-truly-truly-outrageously-api-key').get_challenger_info(type)d
63
+ Outrageous::League.new(api_key: 'your-truly-truly-truly-outrageously-api-key').get_challenger_info(type: RANKED_SOLO_5_X_5')
64
64
 
65
65
  ```
66
66
 
@@ -1,4 +1,5 @@
1
1
  require 'ostruct'
2
+ require 'open-uri'
2
3
 
3
4
  %w(base champion game league stats summoner team).each { |filename| require "outrageous/#{filename}" }
4
5
  %w(base champion item mastery rune summoner_spell).each { |filename| require "outrageous/static_data/#{filename}" }
@@ -1,6 +1,5 @@
1
1
  require 'httparty'
2
2
  require 'json'
3
- require 'debugger'
4
3
 
5
4
  module Outrageous
6
5
 
@@ -9,12 +8,12 @@ module Outrageous
9
8
 
10
9
  base_uri 'https://prod.api.pvp.net'
11
10
 
12
- CHAMPION_VERSION = 'v1.1'
11
+ CHAMPION_VERSION = 'v1.2'
13
12
  GAME_VERSION = 'v1.3'
14
13
  LEAGUE_VERSION = 'v2.3'
15
- STATS_VERSION = 'v1.2'
14
+ STATS_VERSION = 'v1.3'
16
15
  STATIC_DATA_VERSION = 'v1'
17
- SUMMONER_VERSION = 'v1.3'
16
+ SUMMONER_VERSION = 'v1.4'
18
17
  TEAM_VERSION = 'v2.2'
19
18
 
20
19
  attr_accessor :region, :api_key, :version, :response, :status
@@ -26,13 +25,13 @@ module Outrageous
26
25
  end
27
26
 
28
27
  def region
29
- 'euw' if @region.nil? || @region.empty?
28
+ !@region.nil? && !@region.empty? ? @region : 'euw'
30
29
  end
31
30
 
32
- protected
33
- def respond(response)
31
+ def get(url, options = {})
32
+ response = self.class.get(url, query: { api_key: api_key }.merge(options))
34
33
  self.status = response.code
35
- self.response = response.parsed_response
34
+ self.response = response.parsed_response
36
35
  end
37
36
  end
38
37
  end
@@ -1,8 +1,11 @@
1
1
  module Outrageous
2
-
3
2
  class Champion < Base
4
3
  def all(options = {})
5
- respond self.class.get("/api/lol/#{region}/#{version || CHAMPION_VERSION}/champion", query: { api_key: api_key, freeToPlay: options[:freeToPlay] })
4
+ get("/api/lol/#{region}/#{version || CHAMPION_VERSION}/champion", options)
5
+ end
6
+
7
+ def find(id, options = {})
8
+ get("/api/lol/#{region}/#{version || CHAMPION_VERSION}/champion/#{id}", options)
6
9
  end
7
10
  end
8
11
  end
@@ -1,9 +1,7 @@
1
1
  module Outrageous
2
-
3
2
  class Game < Base
4
-
5
- def find(summoner_id)
6
- respond self.class.get("/api/lol/#{region}/#{version || GAME_VERSION}/game/by-summoner/#{summoner_id}/recent", query: { api_key: api_key })
3
+ def find(summoner_id, options = {})
4
+ get("/api/lol/#{region}/#{version || GAME_VERSION}/game/by-summoner/#{summoner_id}/recent", options)
7
5
  end
8
6
  end
9
7
  end
@@ -1,38 +1,39 @@
1
1
  module Outrageous
2
-
3
2
  class League < Base
4
3
 
5
- def get_leagues_with_team_by_summoner_id(summoner_id)
6
- respond self.class.get("/api/lol/#{region}/#{version || LEAGUE_VERSION}/league/by-summoner/#{summoner_id}", query: { api_key: api_key })
4
+ def get_leagues_with_team_by_summoner_id(summoner_id, options = {})
5
+ get("/api/lol/#{region}/#{version || LEAGUE_VERSION}/league/by-summoner/#{summoner_id}", options)
7
6
  end
8
7
 
9
- def get_leagues_entry_by_summoner_id(summoner_id)
10
- respond self.class.get("/api/lol/#{region}/#{version || LEAGUE_VERSION}/league/by-summoner/#{summoner_id}/entry", query: { api_key: api_key })
8
+ def get_leagues_entry_by_summoner_id(summoner_id, options = {})
9
+ get("/api/lol/#{region}/#{version || LEAGUE_VERSION}/league/by-summoner/#{summoner_id}/entry", options)
11
10
  end
12
11
 
13
- def get_leagues_by_team_id(team_id)
14
- respond self.class.get("/api/lol/#{region}/#{version || LEAGUE_VERSION}/league/by-team/#{team_id}", query: { api_key: api_key })
12
+ def get_leagues_by_team_id(team_id, options = {})
13
+ get("/api/lol/#{region}/#{version || LEAGUE_VERSION}/league/by-team/#{team_id}", options)
15
14
  end
16
15
 
17
- def get_leagues_entry_by_team_id(team_id)
18
- respond self.class.get("/api/lol/#{region}/#{version || LEAGUE_VERSION}/league/by-team/#{team_id}/entry", query: { api_key: api_key })
16
+ def get_leagues_entry_by_team_id(team_id, options = {})
17
+ get("/api/lol/#{region}/#{version || LEAGUE_VERSION}/league/by-team/#{team_id}/entry", options)
18
+ end
19
+
20
+ def get_challenger_info(options = { type: 'RANKED_SOLO_5x5' })
21
+ get("/api/lol/#{region}/#{version || LEAGUE_VERSION}/league/challenger", options)
19
22
  end
20
23
 
21
- def get_challenger_solo_q()
22
- get_challenger_info('RANKED_SOLO_5_X_5')
24
+ # Premade methods
25
+ def get_challenger_solo_q
26
+ RANKED_SOLO_5x5
27
+ get_challenger_info(type: 'RANKED_SOLO_5x5')
23
28
  end
24
29
 
25
- def get_challenger_team_3_vs_3()
26
- get_challenger_info('RANKED_TEAM_3_X_3')
30
+ def get_challenger_team_3_vs_3
31
+ get_challenger_info(type: 'RANKED_TEAM_3x3')
27
32
  end
28
33
 
29
- def get_challenger_team_5_vs_5()
30
- get_challenger_info('RANKED_TEAM_5_X_5')
34
+ def get_challenger_team_5_vs_5
35
+ get_challenger_info(type: 'RANKED_TEAM_5x5')
31
36
  end
32
-
33
- def get_challenger_info(type)
34
- respond self.class.get("/api/lol/#{region}/#{version || LEAGUE_VERSION}/league/challenger", query: { api_key: api_key, type: type })
35
- end
36
37
  end
37
38
  end
38
39
 
@@ -14,12 +14,12 @@ module Outrageous
14
14
 
15
15
  # List elements
16
16
  def all(options = {})
17
- respond self.class.get("/api/lol/static-data/#{region}/#{version || STATIC_DATA_VERSION}/#{self.class.api_model}", query: { api_key: api_key, version: options[:version], self.class.data_key => options[self.class.data_key.to_s], locale: options[:locale] })
17
+ get("/api/lol/static-data/#{region}/#{version || STATIC_DATA_VERSION}/#{self.class.api_model}", options)
18
18
  end
19
19
 
20
20
  # Show a specific element
21
21
  def find(id, options = {})
22
- respond self.class.get("/api/lol/static-data/#{region}/#{version || STATIC_DATA_VERSION}/#{self.class.api_model}/#{id}", query: { api_key: api_key, version: options[:version], self.class.data_key => options[self.class.data_key.to_s], locale: options[:locale] })
22
+ get("/api/lol/static-data/#{region}/#{version || STATIC_DATA_VERSION}/#{self.class.api_model}/#{id}", options)
23
23
  end
24
24
 
25
25
  protected
@@ -35,19 +35,6 @@ module Outrageous
35
35
  end
36
36
  END
37
37
  end
38
-
39
- def self.data_key(key)
40
- instance_eval <<-END
41
- def data_key
42
- '#{key}'
43
- end
44
- END
45
- class_eval <<-END
46
- def data_key
47
- '#{key}'
48
- end
49
- END
50
- end
51
38
  end
52
39
  end
53
40
  end
@@ -2,7 +2,6 @@ module Outrageous
2
2
  module StaticData
3
3
  class Champion < Base
4
4
  api_model 'champion'
5
- data_key 'champData'
6
5
  end
7
6
  end
8
7
  end
@@ -2,7 +2,6 @@ module Outrageous
2
2
  module StaticData
3
3
  class Item < Base
4
4
  api_model 'item'
5
- data_key 'itemData'
6
5
  end
7
6
  end
8
7
  end
@@ -2,7 +2,6 @@ module Outrageous
2
2
  module StaticData
3
3
  class Mastery < Base
4
4
  api_model 'mastery'
5
- data_key 'masteryListData'
6
5
  end
7
6
  end
8
7
  end
@@ -2,7 +2,6 @@ module Outrageous
2
2
  module StaticData
3
3
  class Realm < Base
4
4
  api_model 'realm'
5
- data_key 'r'
6
5
  end
7
6
  end
8
7
  end
@@ -2,7 +2,6 @@ module Outrageous
2
2
  module StaticData
3
3
  class Rune < Base
4
4
  api_model 'rune'
5
- data_key 'runeListData'
6
5
  end
7
6
  end
8
7
  end
@@ -2,7 +2,6 @@ module Outrageous
2
2
  module StaticData
3
3
  class SummonerSpell < Base
4
4
  api_model 'summoner-spell'
5
- data_key 'spellData'
6
5
  end
7
6
  end
8
7
  end
@@ -1,13 +1,12 @@
1
1
  module Outrageous
2
-
3
2
  class Stats < Base
4
3
 
5
- def player_ranked_by_season(summoner_id, season = 4)
6
- respond self.class.get("/api/lol/#{region}/#{version || STATS_VERSION}/stats/by-summoner/#{summoner_id}/ranked", query: { api_key: api_key, season: "SEASON#{season}" })
4
+ def player_ranked_by_season(summoner_id, options = { season: 'SEASON4'})
5
+ get("/api/lol/#{region}/#{version || STATS_VERSION}/stats/by-summoner/#{summoner_id}/ranked", options)
7
6
  end
8
7
 
9
- def player_summary_by_season(summoner_id, season = 4)
10
- respond self.class.get("/api/lol/#{region}/#{version || STATS_VERSION}/stats/by-summoner/#{summoner_id}/summary", query: { api_key: api_key, season: "SEASON#{season}" })
8
+ def player_summary_by_season(summoner_id, options = { season: 'SEASON4'})
9
+ get("/api/lol/#{region}/#{version || STATS_VERSION}/stats/by-summoner/#{summoner_id}/summary", options)
11
10
  end
12
11
  end
13
12
  end
@@ -1,30 +1,30 @@
1
1
  module Outrageous
2
-
3
2
  class Summoner < Base
4
3
 
5
- def find_by_names(summoner_names = [])
4
+ def find_by_names(summoner_names = [], options = {})
5
+ summoner_names =
6
6
  summoner_names = [summoner_names] if !summoner_names.is_a? Array
7
- respond self.class.get("/api/lol/#{region}/#{version || SUMMONER_VERSION}/summoner/by-name/#{summoner_names.join(',')}", query: { api_key: api_key })
7
+ get("/api/lol/#{region}/#{version || SUMMONER_VERSION}/summoner/by-name/#{summoner_names.map { |s| URI::encode(s) }.join(',')}", options)
8
8
  end
9
9
 
10
- def find_by_ids(summoner_ids = [])
10
+ def find_by_ids(summoner_ids = [], options = {})
11
11
  summoner_ids = [summoner_ids] if !summoner_ids.is_a? Array
12
- respond self.class.get("/api/lol/#{region}/#{version || SUMMONER_VERSION}/summoner/#{summoner_ids.join(',')}", query: { api_key: api_key })
12
+ get("/api/lol/#{region}/#{version || SUMMONER_VERSION}/summoner/#{summoner_ids.join(',')}", options)
13
13
  end
14
14
 
15
- def find_masteries(summoner_ids = [])
15
+ def find_masteries(summoner_ids = [], options = {})
16
16
  summoner_ids = [summoner_ids] if !summoner_ids.is_a? Array
17
- respond self.class.get("/api/lol/#{region}/#{version || SUMMONER_VERSION}/summoner/#{summoner_ids.join(',')}/masteries", query: { api_key: api_key })
17
+ get("/api/lol/#{region}/#{version || SUMMONER_VERSION}/summoner/#{summoner_ids.join(',')}/masteries", options)
18
18
  end
19
19
 
20
- def find_names(summoner_ids = [])
20
+ def find_names(summoner_ids = [], options = {})
21
21
  summoner_ids = [summoner_ids] if !summoner_ids.is_a? Array
22
- respond self.class.get("/api/lol/#{region}/#{version || SUMMONER_VERSION}/summoner/#{summoner_ids.join(',')}/name", query: { api_key: api_key })
22
+ get("/api/lol/#{region}/#{version || SUMMONER_VERSION}/summoner/#{summoner_ids.join(',')}/name", options)
23
23
  end
24
24
 
25
- def find_runes(summoner_ids = [])
25
+ def find_runes(summoner_ids = [], options = {})
26
26
  summoner_ids = [summoner_ids] if !summoner_ids.is_a? Array
27
- respond self.class.get("/api/lol/#{region}/#{version || SUMMONER_VERSION}/summoner/#{summoner_ids.join(',')}/runes", query: { api_key: api_key })
27
+ get("/api/lol/#{region}/#{version || SUMMONER_VERSION}/summoner/#{summoner_ids.join(',')}/runes", options)
28
28
  end
29
29
  end
30
30
  end
@@ -2,16 +2,16 @@ module Outrageous
2
2
 
3
3
  class Team < Base
4
4
 
5
- # GET /api/lol/{region}/v2.2/team/by-summoner/{summonerId} Retrieves teams for given summoner ID. (REST)
6
- def find_by_summoner_id(summoner_id)
7
- respond self.class.get("/api/lol/#{region}/#{version || TEAM_VERSION}/team/by-summoner/#{summoner_id}", query: { api_key: api_key })
8
- end
5
+ # GET /api/lol/{region}/v2.2/team/by-summoner/{summonerId} Retrieves teams for given summoner ID. (REST)
6
+ def find_by_summoner_id(summoner_id, options = {})
7
+ get("/api/lol/#{region}/#{version || TEAM_VERSION}/team/by-summoner/#{summoner_id}", options)
8
+ end
9
9
 
10
- # GET /api/lol/{region}/v2.2/team/{teamIds} Get teams mapped by team ID for a given list of team IDs. (REST)
11
- def find_by_ids(teams_ids)
12
- teams_ids = [teams_ids] if !teams_ids.is_a? Array
13
- respond self.class.get("/api/lol/#{region}/#{version || TEAM_VERSION}/team/#{teams_ids.join(',')}", query: { api_key: api_key })
14
- end
10
+ # GET /api/lol/{region}/v2.2/team/{teamIds} Get teams mapped by team ID for a given list of team IDs. (REST)
11
+ def find_by_ids(teams_ids, options = {})
12
+ teams_ids = [teams_ids] if !teams_ids.is_a? Array
13
+ get("/api/lol/#{region}/#{version || TEAM_VERSION}/team/#{teams_ids.join(',')}", options)
14
+ end
15
15
  end
16
16
  end
17
17
 
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outrageous
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - xxswingxx
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-31 00:00:00.000000000 Z
11
+ date: 2014-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '0.13'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '0.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: shoulda
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '3'
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: '3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rdoc
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,28 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.0.1
75
+ version: '2.0'
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: 2.0.1
82
+ version: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '0.8'
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.8'
97
97
  description: A ruby wrapper for the official League of Legends API in an outrageous
98
98
  package
99
99
  email: vidadelaempresa@gmail.com
@@ -124,7 +124,7 @@ homepage: http://github.com/xxswingxx/outrageous
124
124
  licenses:
125
125
  - MIT
126
126
  metadata: {}
127
- post_install_message:
127
+ post_install_message: Gems are truly, truly, truly outrageous...
128
128
  rdoc_options: []
129
129
  require_paths:
130
130
  - lib