lolbase 0.1.0 → 0.1.2
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 +4 -4
- data/.travis.yml +7 -0
- data/README.md +20 -26
- data/lib/lolbase.rb +3 -1
- data/lib/lolbase/data/profile_icon.rb +10 -0
- data/lib/lolbase/data/summoner.rb +4 -5
- data/lib/lolbase/version.rb +1 -1
- data/spec/data_spec.rb +4 -5
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 708c18aa4e274519bc08c3a9deae56e6dc099668
|
4
|
+
data.tar.gz: 068468dbe4dc6666386c5769326b96a52012be06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f990c2b130ff55f39f7df452a6495a77b365980aaab9253a53916ffa39ae8cb1f166ddf9f1cc7751f9e79f4f64ca542777f7faa771aabbba928b2038b79d481a
|
7
|
+
data.tar.gz: b1531ccfe5e5f3fa317aed49902cb19fd3822a5271606514a029d52500ca0e23c573a35facabab0c39c2d708755b3bf9ad26267410a49002e637bfb8fdfcadb2
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
-
# LoLBase
|
1
|
+
# LoLBase [](https://travis-ci.org/Illianthe/lolbase) [](https://codeclimate.com/github/Illianthe/lolbase) [](http://badge.fury.io/rb/lolbase)
|
2
2
|
|
3
3
|
A basic Ruby wrapper for the League of Legends API.
|
4
4
|
|
5
|
+
* GitHub: [https://github.com/Illianthe/lolbase](https://github.com/Illianthe/lolbase)
|
6
|
+
* RubyGems: [https://rubygems.org/gems/lolbase](https://rubygems.org/gems/lolbase)
|
7
|
+
|
5
8
|
## Installation
|
6
9
|
|
7
10
|
Add this line to your application's Gemfile:
|
8
11
|
|
9
|
-
gem 'lolbase'
|
12
|
+
gem 'lolbase'
|
10
13
|
|
11
14
|
And in the console, execute:
|
12
15
|
|
@@ -19,8 +22,11 @@ And in the console, execute:
|
|
19
22
|
LoLBase can be globally configured through the *LoLBase::configure* method. The values shown are the defaults set by the gem.
|
20
23
|
|
21
24
|
LoLBase.configure do |config|
|
22
|
-
config.default_region = "na"
|
23
|
-
config.default_key = nil
|
25
|
+
config.default_region = "na" # Default region for summoner lookup
|
26
|
+
config.default_key = nil # Default API key
|
27
|
+
|
28
|
+
# Latest versions of the API provided by Riot. These values can
|
29
|
+
# be changed for backward compatibility.
|
24
30
|
config.version_champion = "1.1"
|
25
31
|
config.version_game = "1.1"
|
26
32
|
config.version_league = "2.1"
|
@@ -49,25 +55,13 @@ All connections begin by calling *LoLBase::new* which takes an API key as an arg
|
|
49
55
|
summoner.id
|
50
56
|
summoner.name
|
51
57
|
summoner.region
|
52
|
-
summoner.
|
53
|
-
summoner.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
*
|
62
|
-
* Recent games
|
63
|
-
* League data
|
64
|
-
* Stats
|
65
|
-
* Summary
|
66
|
-
* Ranked
|
67
|
-
* Summoner
|
68
|
-
* Masteries
|
69
|
-
* Runes
|
70
|
-
* ~~Find by name~~
|
71
|
-
* ~~Find by ID~~
|
72
|
-
* List of names by ID
|
73
|
-
* Teams
|
58
|
+
summoner.level
|
59
|
+
summoner.last_modified
|
60
|
+
|
61
|
+
#### 3.2 Profile Icon
|
62
|
+
|
63
|
+
summoner.profile_icon.id
|
64
|
+
|
65
|
+
## Resources
|
66
|
+
|
67
|
+
* Official API Reference: [https://developer.riotgames.com/api/methods](https://developer.riotgames.com/api/methods)
|
data/lib/lolbase.rb
CHANGED
@@ -2,7 +2,7 @@ require "json"
|
|
2
2
|
|
3
3
|
module LoLBase
|
4
4
|
class Summoner
|
5
|
-
attr_reader :id, :name, :
|
5
|
+
attr_reader :id, :name, :profile_icon, :last_modified, :level, :region
|
6
6
|
|
7
7
|
# Input
|
8
8
|
# - params - A hash containing either a summoner name or ID and the region that they belong to
|
@@ -31,10 +31,9 @@ module LoLBase
|
|
31
31
|
data = JSON.parse(response)
|
32
32
|
@id = data["id"]
|
33
33
|
@name = data["name"]
|
34
|
-
@
|
35
|
-
@
|
36
|
-
@
|
37
|
-
@summonerLevel = data["summonerLevel"]
|
34
|
+
@profile_icon = ProfileIcon.new data["profileIconId"], self
|
35
|
+
@last_modified = Time.at(data["revisionDate"] / 1000)
|
36
|
+
@level = data["summonerLevel"]
|
38
37
|
|
39
38
|
self
|
40
39
|
end
|
data/lib/lolbase/version.rb
CHANGED
data/spec/data_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe "LoLBase Data" do
|
|
4
4
|
before do
|
5
5
|
@connection = LoLBase.new "random-key"
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
context "Summoner" do
|
9
9
|
it "should return summoner data when requested" do
|
10
10
|
file = File.read(File.expand_path("../json/summoner.json", __FILE__))
|
@@ -13,10 +13,9 @@ describe "LoLBase Data" do
|
|
13
13
|
illianthe = @connection.summoner("illianthe")
|
14
14
|
expect(illianthe.id).to eq(19578577)
|
15
15
|
expect(illianthe.name).to eq("Illianthe")
|
16
|
-
expect(illianthe.
|
17
|
-
expect(illianthe.
|
18
|
-
expect(illianthe.
|
19
|
-
expect(illianthe.summonerLevel).to eq(30)
|
16
|
+
expect(illianthe.profile_icon.id).to eq(539)
|
17
|
+
expect(illianthe.last_modified).to eq(Time.at(1386988105))
|
18
|
+
expect(illianthe.level).to eq(30)
|
20
19
|
expect(illianthe.region).to eq("na")
|
21
20
|
end
|
22
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Regan Chan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,6 +88,7 @@ extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
90
|
- .gitignore
|
91
|
+
- .travis.yml
|
91
92
|
- Gemfile
|
92
93
|
- LICENSE.txt
|
93
94
|
- README.md
|
@@ -95,6 +96,7 @@ files:
|
|
95
96
|
- lib/lolbase.rb
|
96
97
|
- lib/lolbase/configuration.rb
|
97
98
|
- lib/lolbase/connection.rb
|
99
|
+
- lib/lolbase/data/profile_icon.rb
|
98
100
|
- lib/lolbase/data/summoner.rb
|
99
101
|
- lib/lolbase/error.rb
|
100
102
|
- lib/lolbase/version.rb
|