riot_api_ruby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MWNhY2FiNGVhZmZmZWU5MGY1Yzg1NGEwMjcyN2M1OTFiYTg1NTNkMQ==
5
+ data.tar.gz: !binary |-
6
+ YjFlNzk5OGNmNjljMjIxZDNiNmQxM2ExYzIzOTJhNjcyMDE0N2Q3ZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZTFkZGUwZGVjYmYyMDVlNzIwY2U2MzQyOTdkYWQyOTE3YjA0M2NiMTgxMTFm
10
+ OWRhNGI2MGVjZGNlYzMxMTJlMTRiNWMyNWVmOWU5NWZhNTE5NzVmNDJhMWM3
11
+ MTZiYWI3MWNjYWUzYWU4NDlmYjU5MzViYmY1YzBmMTk1Y2QwNjU=
12
+ data.tar.gz: !binary |-
13
+ NjlmZWMxMTllMTQwOGUyNmRjNWZmOTg1MDU4MDZlMTQyMWJjNDM3NTcxZjYy
14
+ NmNiZTE0ZDM3ZjM5ZjhkNTM0YmM3Yjg0ZTA5YzVjNTg0YTk1ZTZjYjFiMmQ4
15
+ MmM3MTc0NjliNGE3MGVlMWIxMmE4MDAxNDdiMTI5OTUzMTc2OGQ=
data/lib/riot_api.rb ADDED
@@ -0,0 +1,17 @@
1
+ module RiotAPI
2
+ require 'faraday'
3
+ require 'extlib'
4
+
5
+ require_relative 'riot_api/strategies/default'
6
+ require_relative 'riot_api/strategies/summoner'
7
+ require_relative 'riot_api/strategies/team'
8
+ require_relative 'riot_api/strategies/champion'
9
+ require_relative 'riot_api/strategies/game'
10
+ require_relative 'riot_api/strategies/league'
11
+ require_relative 'riot_api/strategies/stats'
12
+ require_relative 'riot_api/strategies/lol_static_data'
13
+
14
+ require_relative 'riot_api/api'
15
+ require_relative 'riot_api/requester'
16
+
17
+ end
@@ -0,0 +1,47 @@
1
+ module RiotAPI
2
+ module API
3
+
4
+ class StrategyNotRegistered < StandardError; end
5
+
6
+ extend self
7
+
8
+ def key
9
+ @key
10
+ end
11
+
12
+ def setup(key)
13
+ @key = key
14
+ end
15
+
16
+ # register all strategies using the files in strategies folder
17
+ def register_all
18
+ dirs = Dir.entries File.join(File.expand_path(File.dirname(__FILE__)), "strategies")
19
+ dirs.delete(".")
20
+ dirs.delete("..")
21
+ dirs.map! { |dir| dir.sub(".rb", "") }
22
+ dirs.each { |stra| register(stra) }
23
+ end
24
+
25
+ # register a strategy
26
+ def register(strategy)
27
+ stra_sym = :"@#{strategy}"
28
+ stra = instance_variable_get stra_sym
29
+ if stra.nil?
30
+ strategy_class = eval("RiotAPI::Strategies::#{strategy.camel_case}")
31
+ instance_variable_set stra_sym, strategy_class.new.extend(RiotAPI::Requester)
32
+ define_method(strategy) { instance_variable_get stra_sym }
33
+ end
34
+ end
35
+
36
+ # call strategy with action and arguments
37
+ def call(strategy, action, *args)
38
+ stra = instance_variable_get :"@#{strategy}"
39
+ if stra.nil?
40
+ raise StrategyNotRegistered
41
+ else
42
+ stra.send action, args
43
+ end
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,27 @@
1
+ module RiotAPI
2
+ module Requester
3
+
4
+ def conn
5
+ @conn ||= Faraday.new
6
+ end
7
+
8
+ def call(action, *args, &block)
9
+ if action =~ /by_(.+)$/
10
+ url = self.send action, *args[0]
11
+ else
12
+ url = self.send action
13
+ end
14
+ response = conn.get url + "?api_key=#{API.key}"
15
+ response.body
16
+ end
17
+
18
+ def method_missing(meth, *args, &block)
19
+ if meth.to_s =~ /^find_(.+)$/
20
+ call($1, *args, &block)
21
+ else
22
+ super
23
+ end
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+ # champion-v1.2
2
+
3
+ module RiotAPI
4
+ module Strategies
5
+
6
+ class Champion < Default
7
+
8
+ def initialize(params={})
9
+ options = {
10
+ version: "v1.2",
11
+ type: "champion"
12
+ }.merge(params)
13
+ super options
14
+ end
15
+
16
+ def all
17
+ request_url
18
+ end
19
+
20
+ def by_id(id)
21
+ request_url + "/" + id
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,28 @@
1
+ module RiotAPI
2
+ module Strategies
3
+ class StrategyNotFound < StandardError; end
4
+
5
+ class Default
6
+
7
+ def initialize(params={})
8
+ @options = {
9
+ host: "https://prod.api.pvp.net/api",
10
+ game: "lol",
11
+ region: "na",
12
+ }.merge(params)
13
+ end
14
+
15
+ def api_url
16
+ @api_url ||= @options[:host] + "/" + @options[:game] + "/" + @options[:region]
17
+ end
18
+
19
+ def request_url
20
+ raise StrategyNotFound, "Strategy not provided!" \
21
+ if @options[:type].nil? || @options[:version].nil?
22
+ @request_url ||= api_url + "/" + @options[:version] + "/" + @options[:type]
23
+ end
24
+
25
+ end
26
+ end
27
+
28
+ end
@@ -0,0 +1,22 @@
1
+ # game-v1.3
2
+
3
+ module RiotAPI
4
+ module Strategies
5
+
6
+ class Game < Default
7
+
8
+ def initialize(params={})
9
+ options = {
10
+ version: "v1.3",
11
+ type: "game"
12
+ }.merge(params)
13
+ super options
14
+ end
15
+
16
+ def recent_by_summoner_id(id)
17
+ request_url + "/by-summoner/" + id + "/recent"
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,38 @@
1
+ # league-v2.4
2
+
3
+ module RiotAPI
4
+ module Strategies
5
+
6
+ class League < Default
7
+
8
+ def initialize(params={})
9
+ options = {
10
+ version: "v2.4",
11
+ type: "league"
12
+ }.merge(params)
13
+ super options
14
+ end
15
+
16
+ def by_summoner_ids(ids)
17
+ request_url + "/by-summoner/" + ids
18
+ end
19
+
20
+ def entries_by_summoner_ids(ids)
21
+ request_url + "/by-summoner/" + ids + "/entry"
22
+ end
23
+
24
+ def by_team_ids(ids)
25
+ request_url + "/by-team/" + ids
26
+ end
27
+
28
+ def entries_by_team_ids(ids)
29
+ request_url + "/by-team/" + ids + "/entry"
30
+ end
31
+
32
+ def challenger
33
+ request_url + "/challenger"
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,44 @@
1
+ # lol-static-data-v1.2
2
+
3
+ module RiotAPI
4
+ module Strategies
5
+
6
+ class LolStaticData < Default
7
+
8
+ def initialize(params={})
9
+ options = {
10
+ version: "v1.2",
11
+ type: "static-data"
12
+ }.merge(params)
13
+ super options
14
+ end
15
+
16
+ [:champion, :item, :mastery, :rune, :summoner_spell].each do |action|
17
+ meth = action.to_s
18
+ meth_dash = meth.sub('_','-')
19
+ define_method(meth) { request_url + "/#{meth_dash}" }
20
+ define_method("#{meth}_by_id") do |id|
21
+ request_url + "/#{meth_dash}/" + id
22
+ end
23
+ end
24
+
25
+ def api_url
26
+ @api_url ||= @options[:host] + "/" + @options[:game] + "/" + \
27
+ @options[:type] + "/" + @options[:region]
28
+ end
29
+
30
+ def request_url
31
+ @request_url ||= api_url + "/" + @options[:version]
32
+ end
33
+
34
+ def versions
35
+ request_url + "/versions"
36
+ end
37
+
38
+ def realm
39
+ request_url + "/realm"
40
+ end
41
+
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,26 @@
1
+ # stats-v2.3
2
+
3
+ module RiotAPI
4
+ module Strategies
5
+
6
+ class Stats < Default
7
+
8
+ def initialize(params={})
9
+ options = {
10
+ version: "v1.3",
11
+ type: "stats"
12
+ }.merge(params)
13
+ super options
14
+ end
15
+
16
+ def ranked_by_summoner_id(id)
17
+ request_url + "/by-summoner/" + id + "/ranked"
18
+ end
19
+
20
+ def summary_by_summoner_id(id)
21
+ request_url + "/by-summoner/" + id + "/summary"
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,49 @@
1
+ # summoner-v1.4
2
+
3
+ module RiotAPI
4
+ module Strategies
5
+
6
+ class Summoner < Default
7
+
8
+ def initialize(params={})
9
+ options = {
10
+ version: "v1.4",
11
+ type: "summoner"
12
+ }.merge(params)
13
+ super options
14
+ end
15
+
16
+ # Get summoner objects mapped by standardized summoner name
17
+ # for a given list of summoner names
18
+ def by_names(names)
19
+ request_url + "/by-name/" + names
20
+ end
21
+
22
+ # Get summoner objects mapped by summoner ID for a given
23
+ # list of summoner IDs
24
+ def by_ids(ids)
25
+ request_url + "/" + ids
26
+ end
27
+
28
+ # Get mastery pages mapped by summoner ID for a given list
29
+ # of summoner IDs
30
+ def masteries_by_ids(ids)
31
+ request_url + "/" + ids + "/masteries"
32
+ end
33
+
34
+ # Get summoner names mapped by summoner ID for a given list
35
+ # of summoner IDs
36
+ def names_by_ids(ids)
37
+ request_url + "/" + ids + "/name"
38
+ end
39
+
40
+ # Get rune pages mapped by summoner ID for a given list
41
+ # of summoner IDs
42
+ def runes_by_ids(ids)
43
+ request_url + "/" + ids + "/runes"
44
+ end
45
+
46
+ end
47
+
48
+ end
49
+ end
@@ -0,0 +1,26 @@
1
+ # team-v2.3
2
+
3
+ module RiotAPI
4
+ module Strategies
5
+
6
+ class Team < Default
7
+
8
+ def initialize(params={})
9
+ options = {
10
+ version: "v2.3",
11
+ type: "team"
12
+ }.merge(params)
13
+ super options
14
+ end
15
+
16
+ def by_summoner_ids(ids)
17
+ request_url + "/by-summoner/" + ids
18
+ end
19
+
20
+ def by_ids(ids)
21
+ request_url + "/" + ids
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ module RiotAPI
2
+
3
+ VERSION = '0.0.1'
4
+
5
+ end
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ describe RiotAPI::API do
4
+
5
+ before { RiotAPI::API.setup("abc") }
6
+
7
+ it "returns key" do
8
+ RiotAPI::API.key.should eq("abc")
9
+ end
10
+
11
+ let(:summoner) { RiotAPI::Strategies::Summoner.new }
12
+
13
+ describe "#call" do
14
+
15
+ it "raise strategy not registered error" do
16
+ expect { RiotAPI::API.call("summoner", "find_by_names", "1") }.to \
17
+ raise_error(RiotAPI::API::StrategyNotRegistered)
18
+ end
19
+
20
+ describe "#registed strategy" do
21
+
22
+ before do
23
+ RiotAPI::API.register("summoner")
24
+ class MockFaraday; def get(url); OpenStruct.new(body: "foo"); end; end
25
+ Faraday.stub(:new) { MockFaraday.new }
26
+ end
27
+
28
+ it "calls summoner's method" do
29
+ expect(RiotAPI::API.summoner).to \
30
+ receive(:by_names).with("1").and_return("url")
31
+
32
+ RiotAPI::API.call("summoner", "find_by_names", "1")
33
+ end
34
+
35
+ it "uses summoner directly" do
36
+ expect(RiotAPI::API.summoner).to \
37
+ receive(:by_names).with("1").and_return("url")
38
+
39
+ RiotAPI::API.summoner.find_by_names "1"
40
+ end
41
+
42
+ end
43
+
44
+ describe "#register_all" do
45
+ before { RiotAPI::API.register_all }
46
+
47
+ it "registers all strategies" do
48
+ RiotAPI::API.respond_to?(:team).should be(true)
49
+ end
50
+ end
51
+
52
+ end
53
+
54
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe RiotAPI::Requester do
4
+
5
+ let(:request_url) { "https://prod.api.pvp.net/api/lol/na/v1.4/summoner/by-name/tiqoo" }
6
+ let(:mock_strategy) { OpenStruct.new summoner: request_url }
7
+ let(:requester) { mock_strategy.extend(RiotAPI::Requester) }
8
+ let(:conn) { requester.conn }
9
+ let(:file) { File.read File.join(File.expand_path(File.dirname(__FILE__)), "../fixtures/summoner.json") }
10
+ let(:response) { OpenStruct.new body: JSON.parse(file) }
11
+
12
+ before do
13
+ RiotAPI::API.stub(:key) { "abc" }
14
+ end
15
+
16
+ describe "#find" do
17
+
18
+ it "calls only when find is present" do
19
+ url = "#{request_url}?api_key=abc"
20
+ expect(conn).to receive(:get).with(url).and_return(response)
21
+ requester.find_summoner
22
+ end
23
+
24
+ it 'returns error if strategy do not respond to the action' do
25
+ expect{ requester.find_unkown }.to raise_error
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe RiotAPI::Strategies::Champion do
4
+
5
+ let(:strategy) { RiotAPI::Strategies::Champion.new }
6
+
7
+ it "returns request url" do
8
+ strategy.request_url.should eq("https://prod.api.pvp.net/api/lol/na/v1.2/champion")
9
+ end
10
+
11
+ it "returns all champions url" do
12
+ strategy.all.should \
13
+ eq("https://prod.api.pvp.net/api/lol/na/v1.2/champion")
14
+ end
15
+
16
+ it "returns by champion id url" do
17
+ strategy.by_id("c1").should \
18
+ eq("https://prod.api.pvp.net/api/lol/na/v1.2/champion/c1")
19
+ end
20
+
21
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe RiotAPI::Strategies::Default do
4
+
5
+ let(:strategy) { RiotAPI::Strategies::Default.new(type: "default", version: "0.1") }
6
+
7
+ it "returns api url" do
8
+ strategy.api_url.should eq("https://prod.api.pvp.net/api/lol/na")
9
+ end
10
+
11
+ it "returns request url" do
12
+ strategy.request_url.should eq("https://prod.api.pvp.net/api/lol/na/0.1/default")
13
+ end
14
+
15
+ describe "#raise_error" do
16
+
17
+ it "raise strategy not found if type is not provided" do
18
+ expect { RiotAPI::Strategies::Default.new.request_url }.to \
19
+ raise_error(RiotAPI::Strategies::StrategyNotFound)
20
+ end
21
+
22
+ it "raise strategy not found if version is not provided" do
23
+ expect { RiotAPI::Strategies::Default.new(type: "default").request_url }.to \
24
+ raise_error(RiotAPI::Strategies::StrategyNotFound)
25
+ end
26
+
27
+ it "raise error if method is not provided" do
28
+ expect { strategy.send "unkown method" }.to raise_error
29
+ end
30
+
31
+ end
32
+
33
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe RiotAPI::Strategies::Game do
4
+
5
+ let(:strategy) { RiotAPI::Strategies::Game.new }
6
+
7
+ it "returns request url" do
8
+ strategy.request_url.should eq("https://prod.api.pvp.net/api/lol/na/v1.3/game")
9
+ end
10
+
11
+ it "returns recent games by summoner url" do
12
+ strategy.recent_by_summoner_id("1").should \
13
+ eq("https://prod.api.pvp.net/api/lol/na/v1.3/game/by-summoner/1/recent")
14
+ end
15
+
16
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe RiotAPI::Strategies::League do
4
+
5
+ let(:strategy) { RiotAPI::Strategies::League.new }
6
+
7
+ it "returns request url" do
8
+ strategy.request_url.should eq("https://prod.api.pvp.net/api/lol/na/v2.4/league")
9
+ end
10
+
11
+ it "returns by summoner ids url" do
12
+ strategy.by_summoner_ids("1,2").should \
13
+ eq("https://prod.api.pvp.net/api/lol/na/v2.4/league/by-summoner/1,2")
14
+ end
15
+
16
+ it "returns league entries by summoner ids url" do
17
+ strategy.entries_by_summoner_ids("1,2").should \
18
+ eq("https://prod.api.pvp.net/api/lol/na/v2.4/league/by-summoner/1,2/entry")
19
+ end
20
+
21
+ it "returns by team ids url" do
22
+ strategy.by_team_ids("t1,t2").should \
23
+ eq("https://prod.api.pvp.net/api/lol/na/v2.4/league/by-team/t1,t2")
24
+ end
25
+
26
+ it "returns entries by team ids url" do
27
+ strategy.entries_by_team_ids("t1,t2").should \
28
+ eq("https://prod.api.pvp.net/api/lol/na/v2.4/league/by-team/t1,t2/entry")
29
+ end
30
+
31
+ it "returns challenger tier leagues" do
32
+ strategy.challenger.should \
33
+ eq("https://prod.api.pvp.net/api/lol/na/v2.4/league/challenger")
34
+ end
35
+
36
+ end
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+
3
+ describe RiotAPI::Strategies::LolStaticData do
4
+
5
+ let(:strategy) { RiotAPI::Strategies::LolStaticData.new }
6
+
7
+ it "returns request url" do
8
+ strategy.request_url.should eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2")
9
+ end
10
+
11
+ it "returns versions" do
12
+ strategy.versions.should \
13
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/versions")
14
+ end
15
+
16
+ it "returns realm" do
17
+ strategy.realm.should \
18
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/realm")
19
+ end
20
+
21
+ it "returns champion list" do
22
+ strategy.champion.should \
23
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/champion")
24
+ end
25
+
26
+ it "returns champion by id" do
27
+ strategy.champion_by_id("1").should \
28
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/champion/1")
29
+ end
30
+
31
+ it "returns item list" do
32
+ strategy.item.should \
33
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/item")
34
+ end
35
+
36
+ it "returns item by id" do
37
+ strategy.item_by_id("1").should \
38
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/item/1")
39
+ end
40
+
41
+ it "returns mastery list" do
42
+ strategy.mastery.should \
43
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/mastery")
44
+ end
45
+
46
+ it "returns mastery by id" do
47
+ strategy.mastery_by_id("1").should \
48
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/mastery/1")
49
+ end
50
+
51
+ it "returns rune list" do
52
+ strategy.rune.should \
53
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/rune")
54
+ end
55
+
56
+ it "returns rune by id" do
57
+ strategy.rune_by_id("1").should \
58
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/rune/1")
59
+ end
60
+
61
+ it "returns summoner-spell list" do
62
+ strategy.summoner_spell.should \
63
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/summoner-spell")
64
+ end
65
+
66
+ it "returns summoner-spell by id" do
67
+ strategy.summoner_spell_by_id("1").should \
68
+ eq("https://prod.api.pvp.net/api/lol/static-data/na/v1.2/summoner-spell/1")
69
+ end
70
+
71
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe RiotAPI::Strategies::Stats do
4
+
5
+ let(:strategy) { RiotAPI::Strategies::Stats.new }
6
+
7
+ it "returns request url" do
8
+ strategy.request_url.should eq("https://prod.api.pvp.net/api/lol/na/v1.3/stats")
9
+ end
10
+
11
+ it "returns ranked by-summoner url" do
12
+ strategy.ranked_by_summoner_id("1").should \
13
+ eq("https://prod.api.pvp.net/api/lol/na/v1.3/stats/by-summoner/1/ranked")
14
+ end
15
+
16
+ it "returns summary by-summoner url" do
17
+ strategy.summary_by_summoner_id("1").should \
18
+ eq("https://prod.api.pvp.net/api/lol/na/v1.3/stats/by-summoner/1/summary")
19
+ end
20
+
21
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe RiotAPI::Strategies::Summoner do
4
+
5
+ let(:strategy) { RiotAPI::Strategies::Summoner.new }
6
+
7
+ it "returns request url" do
8
+ strategy.request_url.should eq("https://prod.api.pvp.net/api/lol/na/v1.4/summoner")
9
+ end
10
+
11
+ it "returns by-name url" do
12
+ strategy.by_names("tiqoo,lanjj").should \
13
+ eq("https://prod.api.pvp.net/api/lol/na/v1.4/summoner/by-name/tiqoo,lanjj")
14
+ end
15
+
16
+ it "returns by ids url" do
17
+ strategy.by_ids("1,2").should \
18
+ eq("https://prod.api.pvp.net/api/lol/na/v1.4/summoner/1,2")
19
+ end
20
+
21
+ it "returns by masteries url" do
22
+ strategy.masteries_by_ids("1,2").should \
23
+ eq("https://prod.api.pvp.net/api/lol/na/v1.4/summoner/1,2/masteries")
24
+ end
25
+
26
+ it "returns by names url" do
27
+ strategy.names_by_ids("1,2").should \
28
+ eq("https://prod.api.pvp.net/api/lol/na/v1.4/summoner/1,2/name")
29
+ end
30
+
31
+ it "returns by runes url" do
32
+ strategy.runes_by_ids("1,2").should \
33
+ eq("https://prod.api.pvp.net/api/lol/na/v1.4/summoner/1,2/runes")
34
+ end
35
+
36
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe RiotAPI::Strategies::Team do
4
+
5
+ let(:strategy) { RiotAPI::Strategies::Team.new }
6
+
7
+ it "returns request url" do
8
+ strategy.request_url.should eq("https://prod.api.pvp.net/api/lol/na/v2.3/team")
9
+ end
10
+
11
+ it "returns by-summoner url" do
12
+ strategy.by_summoner_ids("1,2").should \
13
+ eq("https://prod.api.pvp.net/api/lol/na/v2.3/team/by-summoner/1,2")
14
+ end
15
+
16
+ it "returns by team ids url" do
17
+ strategy.by_ids("team1,team2").should \
18
+ eq("https://prod.api.pvp.net/api/lol/na/v2.3/team/team1,team2")
19
+ end
20
+
21
+ end
@@ -0,0 +1,3 @@
1
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
2
+
3
+ require "riot_api"
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: riot_api_ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Qi He
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: extlib
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.16
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.16
41
+ description: ! ' Yet another ruby Riot game league of legend api wrapper.
42
+
43
+ '
44
+ email: qihe229@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - lib/riot_api.rb
50
+ - lib/riot_api/api.rb
51
+ - lib/riot_api/requester.rb
52
+ - lib/riot_api/strategies/champion.rb
53
+ - lib/riot_api/strategies/default.rb
54
+ - lib/riot_api/strategies/game.rb
55
+ - lib/riot_api/strategies/league.rb
56
+ - lib/riot_api/strategies/lol_static_data.rb
57
+ - lib/riot_api/strategies/stats.rb
58
+ - lib/riot_api/strategies/summoner.rb
59
+ - lib/riot_api/strategies/team.rb
60
+ - lib/riot_api/version.rb
61
+ - spec/riot_api/api_spec.rb
62
+ - spec/riot_api/requester_spec.rb
63
+ - spec/riot_api/strategies/champion_spec.rb
64
+ - spec/riot_api/strategies/default_spec.rb
65
+ - spec/riot_api/strategies/game_spec.rb
66
+ - spec/riot_api/strategies/league_spec.rb
67
+ - spec/riot_api/strategies/lol_static_data_spec.rb
68
+ - spec/riot_api/strategies/stats_spec.rb
69
+ - spec/riot_api/strategies/summoner_spec.rb
70
+ - spec/riot_api/strategies/team_spec.rb
71
+ - spec/spec_helper.rb
72
+ homepage: http://github.com/he9qi/riot_api
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.2.2
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Ruby Riot Game API Wrapper.
96
+ test_files:
97
+ - spec/riot_api/api_spec.rb
98
+ - spec/riot_api/requester_spec.rb
99
+ - spec/riot_api/strategies/champion_spec.rb
100
+ - spec/riot_api/strategies/default_spec.rb
101
+ - spec/riot_api/strategies/game_spec.rb
102
+ - spec/riot_api/strategies/league_spec.rb
103
+ - spec/riot_api/strategies/lol_static_data_spec.rb
104
+ - spec/riot_api/strategies/stats_spec.rb
105
+ - spec/riot_api/strategies/summoner_spec.rb
106
+ - spec/riot_api/strategies/team_spec.rb
107
+ - spec/spec_helper.rb