google_business_api_url_signer 0.1.1 → 0.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d859b39cf4e7e93c7849226802d8d8efc21f1c60
|
4
|
+
data.tar.gz: d99c18313c1cc820de0032eac5505f52460dfe1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a5a5352bdd5f82bad226698616e13b38aa8da5595005832fe88d361e1e52309d29c16c7c3b273e8dbb73a8d15342dcef1239683c806d168b475f75467f1da1a
|
7
|
+
data.tar.gz: 8cf7d649ebcc3f229c020a82ccb68869cb0d90fa136488a870f0507aecdd0fbda7a0b3b8df2b27ab9f4de41f68ff6206d297db4f764b755e5323a448c8df7b28
|
data/.travis.yml
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = GoogleBusinessApiUrlSigner::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency "activesupport", [">= 3.2.0", "
|
19
|
-
gem.add_development_dependency "rspec", "
|
18
|
+
gem.add_dependency "activesupport", [">= 3.2.0", "~> 4.2.0"]
|
19
|
+
gem.add_development_dependency "rspec", "3.1.0"
|
20
20
|
gem.add_development_dependency "rake"
|
21
21
|
end
|
@@ -13,11 +13,25 @@ describe GoogleBusinessApiUrlSigner::Signer do
|
|
13
13
|
)
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
it "has expected URL" do
|
17
|
+
expect(subject.url).to eq url
|
18
|
+
end
|
19
|
+
|
20
|
+
it "has expected private key" do
|
21
|
+
expect(subject.private_key).to eq private_key
|
22
|
+
end
|
23
|
+
|
24
|
+
it "has expected signature" do
|
25
|
+
expect(subject.signature).to eq signature
|
26
|
+
end
|
27
|
+
|
28
|
+
it "has expected signed url" do
|
29
|
+
expect(subject.signed_url).to eq signed_url
|
30
|
+
end
|
31
|
+
|
32
|
+
it "has expected signed url to be HTML safe" do
|
33
|
+
expect(subject.signed_url).to be_html_safe
|
34
|
+
end
|
21
35
|
|
22
36
|
it "ensures that the URL contains a client id" do
|
23
37
|
expect {
|
@@ -44,14 +58,14 @@ describe GoogleBusinessApiUrlSigner::Signer do
|
|
44
58
|
it "uses default private key when set" do
|
45
59
|
described_class.default_private_key = 'default'
|
46
60
|
|
47
|
-
Base64.
|
61
|
+
expect(Base64).to receive(:urlsafe_decode64).with('default').and_return 'decoded'
|
48
62
|
described_class.new(url: url).signature
|
49
63
|
end
|
50
64
|
|
51
65
|
it "uses the private key when options are filled with a blank private key" do
|
52
66
|
described_class.default_private_key = 'default'
|
53
67
|
|
54
|
-
Base64.
|
68
|
+
expect(Base64).to receive(:urlsafe_decode64).with('default').and_return 'decoded'
|
55
69
|
described_class.new(url: url, private_key: nil).signature
|
56
70
|
end
|
57
71
|
end
|
@@ -2,19 +2,20 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe GoogleBusinessApiUrlSigner do
|
4
4
|
describe ".add_signature" do
|
5
|
-
let(:signer) {
|
5
|
+
let(:signer) { double }
|
6
6
|
let(:private_key) { "vNIXE0xscrmjlyV-12Nj_BvUPaw=" }
|
7
7
|
let(:url) { "http://maps.googleapis.com/maps/api/geocode/json?address=New+York&sensor=false&client=clientID" }
|
8
8
|
let(:signed_url) { "http://maps.googleapis.com/maps/api/geocode/json?address=New+York&sensor=false&client=clientID&signature=KrU1TzVQM7Ur0i8i7K3huiw3MsA=" }
|
9
9
|
|
10
10
|
it "delegates to signer" do
|
11
|
-
GoogleBusinessApiUrlSigner::Signer.
|
11
|
+
expect(GoogleBusinessApiUrlSigner::Signer).to receive(:new).with(hash_including(
|
12
12
|
url: url,
|
13
13
|
private_key: private_key
|
14
14
|
)).and_return signer
|
15
|
-
signer.should_receive(:signed_url).and_return signed_url
|
16
15
|
|
17
|
-
|
16
|
+
expect(signer).to receive(:signed_url).and_return signed_url
|
17
|
+
|
18
|
+
expect(described_class.add_signature(url, private_key)).to eq signed_url
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_business_api_url_signer
|
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
|
- Thorbjørn Hermansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -17,9 +17,9 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.2.0
|
20
|
-
- - "
|
20
|
+
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 4.2.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,23 +27,23 @@ dependencies:
|
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 3.2.0
|
30
|
-
- - "
|
30
|
+
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 4.2.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rspec
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - '='
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 3.1.0
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - '='
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 3.1.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
101
|
+
rubygems_version: 2.4.5
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Signs URLs used to call Google's business APIs
|