the_nexus 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +2 -0
- data/lib/nexus.rb +63 -0
- data/lib/nexus/model/masteries.rb +26 -0
- data/lib/nexus/model/runes.rb +27 -0
- data/lib/nexus/model/summoner.rb +14 -0
- data/lib/nexus/summoner.rb +36 -0
- data/lib/nexus/version.rb +3 -0
- data/nexus.gemspec +25 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9b8892b24c71a3e636c7d9eb43b4e47add344a65
|
4
|
+
data.tar.gz: 13c7737ff153e75f7fa7127ac115e87c83bef2b1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 22381496622e1a92bf7eb40d54817415fda81d8a931a05e77274aeb4c570a4c0a26e001905f7227a164e0ecaefdf55c763611a744343f8cb8bcb4722e6ed3fe4
|
7
|
+
data.tar.gz: e1378962b9e32c3796919eb9fc40f8f53ab7daf4cb5e9f843549115c9dd61fa33a37129897cfd85bbfb32cea929e526f9536cca24bcb3015cda93534cbd0309b
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Gui Carneiro
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# _Nexus_
|
2
|
+
|
3
|
+
_Hi =D_
|
4
|
+
|
5
|
+
_In this project I will do a Client for League of Legends API_
|
6
|
+
|
7
|
+
_I'm still just an amateur programmer, but I hope to deliver a good program_
|
8
|
+
|
9
|
+
_I will gradually developing so if there is any thing you wanna do or think it would be cool_
|
10
|
+
|
11
|
+
gui.carneiro15@gmail.com - Come talk with me =D
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
gem 'Nexus'
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install Nexus
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
Soon =P
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork it ( https://github.com/[my-github-username]/Nexus/fork )
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/nexus.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require "httparty"
|
2
|
+
require '../lib/nexus/summoner'
|
3
|
+
|
4
|
+
module Nexus
|
5
|
+
include HTTParty
|
6
|
+
|
7
|
+
attr_accessor :api_key
|
8
|
+
attr_accessor :uri
|
9
|
+
attr_accessor :region
|
10
|
+
|
11
|
+
def self.api_key(api_key)
|
12
|
+
@api_key = api_key.to_s
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.connect_to(region)
|
16
|
+
case region.to_s.downcase
|
17
|
+
|
18
|
+
when "eune", "eu nordic & east", "eu nordic and east"
|
19
|
+
@uri = "https://eune.api.pvp.net/api/lol/eune/"
|
20
|
+
@region = "eune"
|
21
|
+
|
22
|
+
when "euw", "eu west"
|
23
|
+
@uri = "https://euw.api.pvp.net/api/lol/euw/"
|
24
|
+
@region = "euw"
|
25
|
+
|
26
|
+
when "kr", "korea"
|
27
|
+
@uri = "https://kr.api.pvp.net/api/lol/kr/"
|
28
|
+
@region = "kr"
|
29
|
+
|
30
|
+
when "br", "brasil", "brazil"
|
31
|
+
@uri = "https://br.api.pvp.net/api/lol/br/"
|
32
|
+
@region = "br"
|
33
|
+
|
34
|
+
when "lan", "latin america north"
|
35
|
+
@uri = "https://lan.api.pvp.net/api/lol/lan/"
|
36
|
+
@region = "lan"
|
37
|
+
|
38
|
+
when "las", "latin america south"
|
39
|
+
@uri = "https://las.api.pvp.net/api/lol/las/"
|
40
|
+
@region = "las"
|
41
|
+
|
42
|
+
when "na", "north america"
|
43
|
+
@uri = "https://na.api.pvp.net/api/lol/na/"
|
44
|
+
@region = "na"
|
45
|
+
|
46
|
+
when "oce", "oceania"
|
47
|
+
@uri = "https://oce.api.pvp.net/api/lol/oce/"
|
48
|
+
@region = "oce"
|
49
|
+
|
50
|
+
when "ru", "russia"
|
51
|
+
@uri = "https://ru.api.pvp.net/api/lol/ru/"
|
52
|
+
@region = "ru"
|
53
|
+
|
54
|
+
when "tr", "turkey"
|
55
|
+
@uri = "https://tr.api.pvp.net/api/lol/tr/"
|
56
|
+
@region = "tr"
|
57
|
+
|
58
|
+
else
|
59
|
+
nil
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Nexus
|
2
|
+
class Masteries
|
3
|
+
|
4
|
+
attr_reader :id, :name, :pages
|
5
|
+
|
6
|
+
def initialize(params)
|
7
|
+
@id = params["summonerId"]
|
8
|
+
@name = Nexus.get_summoner_name(params["summonerId"].to_s)
|
9
|
+
@pages = Array.new()
|
10
|
+
params["pages"].each do |p|
|
11
|
+
@pages.push(Nexus::PageMasterie.new(p))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
private
|
16
|
+
class PageMasterie
|
17
|
+
attr_reader :id, :name, :current, :slots
|
18
|
+
|
19
|
+
def initialize(params)
|
20
|
+
@id = params["id"]
|
21
|
+
@name = params["name"]
|
22
|
+
@current = params["current"]
|
23
|
+
@slots = params["masteries"]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Nexus
|
2
|
+
class Runes
|
3
|
+
|
4
|
+
attr_reader :id, :name, :pages
|
5
|
+
|
6
|
+
def initialize(params)
|
7
|
+
@id = params["summonerId"]
|
8
|
+
@name = Nexus.get_summoner_name(params["summonerId"].to_s)
|
9
|
+
@pages = Array.new()
|
10
|
+
params["pages"].each do |p|
|
11
|
+
@pages.push(Nexus::PageRune.new(p))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
class PageRune
|
18
|
+
attr_reader :id, :name, :current, :slots
|
19
|
+
|
20
|
+
def initialize(params)
|
21
|
+
@id = params["id"]
|
22
|
+
@name = params["name"]
|
23
|
+
@current = params["current"]
|
24
|
+
@slots = params["slots"]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Nexus
|
2
|
+
class Summoner
|
3
|
+
|
4
|
+
attr_reader :id, :name, :icon, :level, :revisionDate
|
5
|
+
|
6
|
+
def initialize(params)
|
7
|
+
@id = params["id"]
|
8
|
+
@name = params["name"]
|
9
|
+
@icon = params["profileIconId"]
|
10
|
+
@level = params["summonerLevel"]
|
11
|
+
@revisionDate = params["revisionDate"]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "../lib/nexus/model/summoner"
|
2
|
+
require "../lib/nexus/model/runes"
|
3
|
+
require "../lib/nexus/model/masteries"
|
4
|
+
module Nexus
|
5
|
+
VERSION_SUMMONER = "v1.4"
|
6
|
+
|
7
|
+
def self.get_summoner_by_name(name)
|
8
|
+
url = (@uri + VERSION_SUMMONER + "/summoner/by-name/#{name}?api_key=#{@api_key}")
|
9
|
+
return Nexus::Summoner.new(retrieve_url get(url), name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.get_summoner_by_id(id)
|
13
|
+
url = (@uri + VERSION_SUMMONER + "/summoner/#{id}?api_key=#{@api_key}")
|
14
|
+
return Nexus::Summoner.new(retrieve_url get(url), id)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.get_summoner_masteries(id)
|
18
|
+
url = (@uri + VERSION_SUMMONER + "/summoner/#{id}/masteries?api_key=#{@api_key}")
|
19
|
+
return Nexus::Masteries.new(retrieve_url get(url), id)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.get_summoner_name(id)
|
23
|
+
url = (@uri + VERSION_SUMMONER + "/summoner/#{id}/name?api_key=#{@api_key}")
|
24
|
+
return retrieve_url get(url), id
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.get_summoner_runes(id)
|
28
|
+
url = (@uri + VERSION_SUMMONER + "/summoner/#{id}/runes?api_key=#{@api_key}")
|
29
|
+
return Nexus::Runes.new(retrieve_url get(url), id)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def self.retrieve_url(response, ident)
|
34
|
+
response.parsed_response["#{ident.downcase}"]
|
35
|
+
end
|
36
|
+
end
|
data/nexus.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'nexus/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "the_nexus"
|
8
|
+
spec.version = Nexus::VERSION
|
9
|
+
spec.authors = ["Gui Carneiro"]
|
10
|
+
spec.email = ["gui.carneiro15@gmail.com"]
|
11
|
+
spec.summary = %q{League of Legends API Client.}
|
12
|
+
spec.description = %q{}
|
13
|
+
spec.homepage = "https://github.com/GuiCarneiro/Nexus"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
|
24
|
+
spec.add_dependency "httparty", "~> 0.13.1"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: the_nexus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gui Carneiro
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: httparty
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.13.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.13.1
|
55
|
+
description: ''
|
56
|
+
email:
|
57
|
+
- gui.carneiro15@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- lib/nexus.rb
|
68
|
+
- lib/nexus/model/masteries.rb
|
69
|
+
- lib/nexus/model/runes.rb
|
70
|
+
- lib/nexus/model/summoner.rb
|
71
|
+
- lib/nexus/summoner.rb
|
72
|
+
- lib/nexus/version.rb
|
73
|
+
- nexus.gemspec
|
74
|
+
homepage: https://github.com/GuiCarneiro/Nexus
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.2.2
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: League of Legends API Client.
|
98
|
+
test_files: []
|