growviral-keystore 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/growviral-keystore.gemspec +2 -1
- data/lib/growviral/keystore.rb +11 -8
- data/lib/{growviral → keystore}/account.rb +0 -0
- data/lib/{growviral → keystore}/account_creator.rb +0 -0
- data/lib/{growviral → keystore}/account_fetcher.rb +6 -4
- data/lib/{growviral → keystore}/application.rb +0 -0
- data/lib/{growviral → keystore}/application_fetcher.rb +0 -0
- data/lib/{growviral → keystore}/client.rb +0 -0
- data/lib/{growviral → keystore}/configuration.rb +0 -0
- data/lib/{growviral/keystore → keystore}/version.rb +1 -1
- data/test/account_fetcher_test.rb +7 -2
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b7f2c80c08f7de11508489e93a4136088d7453d
|
4
|
+
data.tar.gz: 6f1437985f5049051c63c8616576c7777738123a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b91c9cf5e114edc8ed8905e890b9e7d6c8ed69d5ffaeee38840dd612f57f7fa3e50f53907880593476cc1ce71abba342af5f25df803999f6d880bd92abbf184c
|
7
|
+
data.tar.gz: 4fde4fdfcd1b86e1f90fe8613153a4f9856e038b3f8905aa07700ddfe87a4a7c97982730632e54d577fa010cce5531041a98ee9c0befe600956173877ca91924
|
data/README.md
CHANGED
data/growviral-keystore.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'keystore/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "growviral-keystore"
|
@@ -9,6 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Jeremy Walker"]
|
10
10
|
spec.email = ["jez.walker@gmail.com"]
|
11
11
|
spec.summary = %q{A wrapper for the GrowViral keystore functionality.}
|
12
|
+
spec.description = ""
|
12
13
|
spec.homepage = ""
|
13
14
|
spec.license = "MIT"
|
14
15
|
|
data/lib/growviral/keystore.rb
CHANGED
@@ -2,18 +2,21 @@ require "net/http"
|
|
2
2
|
require "uri"
|
3
3
|
require 'json'
|
4
4
|
|
5
|
-
require "
|
6
|
-
require "
|
7
|
-
require "
|
5
|
+
require "keystore/version"
|
6
|
+
require "keystore/client"
|
7
|
+
require "keystore/configuration"
|
8
8
|
|
9
|
-
require "
|
10
|
-
require "
|
9
|
+
require "keystore/application"
|
10
|
+
require "keystore/application_fetcher"
|
11
11
|
|
12
|
-
require "
|
13
|
-
require "
|
14
|
-
require "
|
12
|
+
require "keystore/account"
|
13
|
+
require "keystore/account_fetcher"
|
14
|
+
require "keystore/account_creator"
|
15
15
|
|
16
16
|
module GrowViral
|
17
17
|
module Keystore
|
18
18
|
end
|
19
|
+
|
20
|
+
class HandleNotUidError < RuntimeError
|
21
|
+
end
|
19
22
|
end
|
File without changes
|
File without changes
|
@@ -5,10 +5,12 @@ module GrowViral
|
|
5
5
|
new(*args).fetch
|
6
6
|
end
|
7
7
|
|
8
|
-
attr_reader :application_id, :
|
9
|
-
def initialize(application_id,
|
8
|
+
attr_reader :application_id, :uid, :config
|
9
|
+
def initialize(application_id, uid, deps)
|
10
|
+
raise HandleNotUidError unless uid.is_a? Numeric
|
11
|
+
|
10
12
|
@application_id = application_id
|
11
|
-
@
|
13
|
+
@uid = uid
|
12
14
|
@config = deps[:config]
|
13
15
|
end
|
14
16
|
|
@@ -18,7 +20,7 @@ module GrowViral
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def uri
|
21
|
-
@uri ||= URI.parse("#{config.host}/applications/#{application_id}/accounts/#{
|
23
|
+
@uri ||= URI.parse("#{config.host}/applications/#{application_id}/accounts/#{uid}")
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,11 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
3
|
class AccountFetcherTest < Minitest::Test
|
4
|
+
def test_raises_for_a_handle
|
5
|
+
client = GrowViral::Keystore::Client.new(:development)
|
6
|
+
assert_raises(GrowViral::HandleNotUidError) { client.fetch_account(213, "string") }
|
7
|
+
end
|
8
|
+
|
4
9
|
def test_response_is_correct
|
5
10
|
application_id = 43
|
6
11
|
uid = 1231212
|
@@ -16,11 +21,11 @@ class AccountFetcherTest < Minitest::Test
|
|
16
21
|
"secret" => secret
|
17
22
|
}
|
18
23
|
|
19
|
-
uri = URI.parse("http://localhost:3000/applications/#{application_id}/accounts/#{
|
24
|
+
uri = URI.parse("http://localhost:3000/applications/#{application_id}/accounts/#{uid}")
|
20
25
|
Net::HTTP.expects(:get_response).with(uri).returns(mock(body: output.to_json))
|
21
26
|
|
22
27
|
client = GrowViral::Keystore::Client.new(:development)
|
23
|
-
account = client.fetch_account(application_id,
|
28
|
+
account = client.fetch_account(application_id, uid)
|
24
29
|
|
25
30
|
assert_equal application_id, account.application_id
|
26
31
|
assert_equal uid, account.uid
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: growviral-keystore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Walker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
69
|
+
description: ''
|
70
70
|
email:
|
71
71
|
- jez.walker@gmail.com
|
72
72
|
executables: []
|
@@ -80,15 +80,15 @@ files:
|
|
80
80
|
- README.md
|
81
81
|
- Rakefile
|
82
82
|
- growviral-keystore.gemspec
|
83
|
-
- lib/growviral/account.rb
|
84
|
-
- lib/growviral/account_creator.rb
|
85
|
-
- lib/growviral/account_fetcher.rb
|
86
|
-
- lib/growviral/application.rb
|
87
|
-
- lib/growviral/application_fetcher.rb
|
88
|
-
- lib/growviral/client.rb
|
89
|
-
- lib/growviral/configuration.rb
|
90
83
|
- lib/growviral/keystore.rb
|
91
|
-
- lib/
|
84
|
+
- lib/keystore/account.rb
|
85
|
+
- lib/keystore/account_creator.rb
|
86
|
+
- lib/keystore/account_fetcher.rb
|
87
|
+
- lib/keystore/application.rb
|
88
|
+
- lib/keystore/application_fetcher.rb
|
89
|
+
- lib/keystore/client.rb
|
90
|
+
- lib/keystore/configuration.rb
|
91
|
+
- lib/keystore/version.rb
|
92
92
|
- test/account_creator_test.rb
|
93
93
|
- test/account_fetcher_test.rb
|
94
94
|
- test/account_test.rb
|