ruby-lol 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c29561f2fc17f478d2800ff91a85d3c63a0cf07d
4
- data.tar.gz: d6e0a9d9eda054b9e11494f99f4330dbf2beaf6b
3
+ metadata.gz: 5299caf56619ad787d30d86f076a8fd100005036
4
+ data.tar.gz: 7201902288c4e3c4d8a6c22f0721f30b6edbf835
5
5
  SHA512:
6
- metadata.gz: 1376714d91c43d39de86f75f45a2623cfcb4886fea1d0717d095006e06e898dd535414332e087ed5431d6286a61fcf83df0562b95b0105ad24ea074b3dc9f301
7
- data.tar.gz: 0bcf56e415922cb77cbe8341ca821d41d2e0e6b56c6db7232ac36a9fbf6b2e59c4b16ff4c45af716e26f65dc6a6cdc172362b5f6032a932afe7b70f0c2c31521
6
+ metadata.gz: 7bdcb6a21e9c493969974df3ebac981e839a89fbe864d5ed60572a74eedfe5fad0e2007c787f6f7e73126162090283b95c67c411fbc24efb5ca05fa6a64bf13e
7
+ data.tar.gz: 24edf369c35e6a4732f95575d7b51a5acb740c67b8392e102d8a83fdb72933488b91b42acc40ed29561d77e2f97a303c62c64668d828c6923084c6e80b780025
@@ -1,4 +1,4 @@
1
- Dir['lib/lol/*.rb'].each do |file|
1
+ Dir["#{File.expand_path('..', __FILE__)}/*.rb"].each do |file|
2
2
  filename = File.basename file
3
3
  classname = filename.split('.rb').first.camelize
4
4
  Lol.autoload classname, File.expand_path("../#{filename}", __FILE__)
@@ -10,7 +10,8 @@ module Lol
10
10
  # @param [Array] summoner names
11
11
  # @return [Array] matching summoners
12
12
  def by_name *names
13
- perform_request(api_url("summoner/by-name/#{names.join(",")}")).map do |key, data|
13
+ escaped_names = names.flatten.map { |name| CGI.escape name.downcase.gsub(/\s/, '') }
14
+ perform_request(api_url("summoner/by-name/#{escaped_names.join(",")}")).map do |key, data|
14
15
  Summoner.new data
15
16
  end
16
17
  end
data/lib/lol/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lol
2
- VERSION = "0.9.8"
2
+ VERSION = "0.9.9"
3
3
  end
@@ -29,6 +29,21 @@ describe SummonerRequest do
29
29
  it "returns an array of summoners" do
30
30
  expect(subject.map(&:class).uniq).to eq([Summoner])
31
31
  end
32
+
33
+ it 'escapes the given names' do
34
+ expect(request.class).to receive(:get).with(request.api_url("summoner/by-name/f%C3%B2%C3%A5,f%C3%B9%C3%AE")).and_return(by_name)
35
+ request.by_name ['fòå', 'fùî']
36
+ end
37
+
38
+ it 'downcase the given names' do
39
+ expect(request.class).to receive(:get).with(request.api_url("summoner/by-name/foo,bar")).and_return(by_name)
40
+ request.by_name 'FoO', 'BAR'
41
+ end
42
+
43
+ it 'strips spaces from names' do
44
+ expect(request.class).to receive(:get).with(request.api_url("summoner/by-name/foo,bar")).and_return(by_name)
45
+ request.by_name 'Fo o', 'b a r'
46
+ end
32
47
  end
33
48
 
34
49
  describe "#name" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Intini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-25 00:00:00.000000000 Z
11
+ date: 2014-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler