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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8749694dc4664005095b8ec196c017c35797d53
4
- data.tar.gz: 23756e8276524d3827086e87b2225afb757c3442
3
+ metadata.gz: 708c18aa4e274519bc08c3a9deae56e6dc099668
4
+ data.tar.gz: 068468dbe4dc6666386c5769326b96a52012be06
5
5
  SHA512:
6
- metadata.gz: 8a85f88ec28b3dbc6b1bad3f216fd0f83433a4ad02bd87b3e9e877c9ad1a676209160b0e84e2cd2e9101246417a9a2fb79fb62c068e0c14076ef2209579483ca
7
- data.tar.gz: fdf05afe3b1a90aedbe785ab7589c7806756afb76f8b988607ebfe39fc31bc539005ab05387b6d18bf663c9b1f21f813ec14a8498bea640da76eb6ef8ff99c9c
6
+ metadata.gz: f990c2b130ff55f39f7df452a6495a77b365980aaab9253a53916ffa39ae8cb1f166ddf9f1cc7751f9e79f4f64ca542777f7faa771aabbba928b2038b79d481a
7
+ data.tar.gz: b1531ccfe5e5f3fa317aed49902cb19fd3822a5271606514a029d52500ca0e23c573a35facabab0c39c2d708755b3bf9ad26267410a49002e637bfb8fdfcadb2
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+
7
+ script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,12 +1,15 @@
1
- # LoLBase
1
+ # LoLBase [![Build Status](https://travis-ci.org/Illianthe/lolbase.png?branch=master)](https://travis-ci.org/Illianthe/lolbase) [![Code Climate](https://codeclimate.com/github/Illianthe/lolbase.png)](https://codeclimate.com/github/Illianthe/lolbase) [![Gem Version](https://badge.fury.io/rb/lolbase.png)](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', :github => 'illianthe/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.profileIconId
53
- summoner.revisionDate
54
- summoner.revisionDateStr
55
- summoner.summonerLevel
56
-
57
- ## To Do
58
-
59
- This gem is still missing a lot of functionality, but most of it will be added over time.
60
-
61
- * Champion list
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)
@@ -1,5 +1,7 @@
1
1
  require "lolbase/configuration"
2
2
  require "lolbase/connection"
3
3
  require "lolbase/error"
4
+ require "lolbase/version"
4
5
 
5
- require "lolbase/data/summoner"
6
+ require "lolbase/data/summoner"
7
+ require "lolbase/data/profile_icon"
@@ -0,0 +1,10 @@
1
+ module LoLBase
2
+ class ProfileIcon
3
+ attr_reader :id
4
+
5
+ def initialize(id, summoner)
6
+ @id = id
7
+ @summoner = summoner
8
+ end
9
+ end
10
+ end
@@ -2,7 +2,7 @@ require "json"
2
2
 
3
3
  module LoLBase
4
4
  class Summoner
5
- attr_reader :id, :name, :profileIconId, :revisionDate, :revisionDateStr, :summonerLevel, :region
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
- @profileIconId = data["profileIconId"]
35
- @revisionDate = data["revisionDate"]
36
- @revisionDateStr = data["revisionDateStr"]
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
@@ -1,3 +1,3 @@
1
1
  module LoLBase
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -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.profileIconId).to eq(539)
17
- expect(illianthe.revisionDate).to eq(1386988105000)
18
- expect(illianthe.revisionDateStr).to eq("12/14/2013 02:28 AM UTC")
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.0
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-14 00:00:00.000000000 Z
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