identity-api-client 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +32 -30
- data/README.md +6 -0
- data/VERSION +1 -1
- data/identity-api-client.gemspec +8 -8
- data/lib/identity-api-client/member.rb +4 -1
- data/spec/fixtures/details_with_consents.json +18 -0
- data/spec/member_spec.rb +28 -7
- metadata +8 -8
- data/spec/fixtures/request.json +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e59ebb9f0609ddf1998b4637a1782cd7a808e934
|
4
|
+
data.tar.gz: 1163c52bd8f1bd553da7f06748d86652da8b6f72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52cbafc1abfbeebe9c0e7c48d68820249cf39be2278d9817692fc4eda6106064c5232f108db123fabb84087d36dc65c1a2532f69c7083c5473956c66c76c0f19
|
7
|
+
data.tar.gz: 92bb38bbfa96713105602e96dce6cd593c2bba585cd5d9f8b3f383f2733e8d304796f198b6c4a51410ff195e168b62f73668fd338e895b975dbe383a3a9036fa
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.1
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (5.
|
4
|
+
activesupport (5.1.3)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
6
|
i18n (~> 0.7)
|
7
7
|
minitest (~> 5.1)
|
@@ -19,19 +19,20 @@ GEM
|
|
19
19
|
docile (1.1.5)
|
20
20
|
faraday (0.9.2)
|
21
21
|
multipart-post (>= 1.2, < 3)
|
22
|
-
faraday_middleware (0.
|
22
|
+
faraday_middleware (0.12.2)
|
23
23
|
faraday (>= 0.7.4, < 1.0)
|
24
24
|
git (1.3.0)
|
25
|
-
github_api (0.
|
25
|
+
github_api (0.17.0)
|
26
26
|
addressable (~> 2.4.0)
|
27
27
|
descendants_tracker (~> 0.0.4)
|
28
28
|
faraday (~> 0.8, < 0.10)
|
29
29
|
hashie (>= 3.4)
|
30
|
+
mime-types (>= 1.16, < 3.0)
|
30
31
|
oauth2 (~> 1.0)
|
31
|
-
hashdiff (0.3.
|
32
|
-
hashie (3.5.
|
32
|
+
hashdiff (0.3.5)
|
33
|
+
hashie (3.5.6)
|
33
34
|
highline (1.7.8)
|
34
|
-
i18n (0.8.
|
35
|
+
i18n (0.8.6)
|
35
36
|
json (1.8.6)
|
36
37
|
juwelier (2.1.3)
|
37
38
|
builder
|
@@ -45,15 +46,16 @@ GEM
|
|
45
46
|
semver
|
46
47
|
jwt (1.5.6)
|
47
48
|
method_source (0.8.2)
|
48
|
-
|
49
|
-
|
49
|
+
mime-types (2.99.3)
|
50
|
+
mini_portile2 (2.3.0)
|
51
|
+
minitest (5.10.3)
|
50
52
|
multi_json (1.12.1)
|
51
53
|
multi_xml (0.6.0)
|
52
54
|
multipart-post (2.0.0)
|
53
|
-
nokogiri (1.
|
54
|
-
mini_portile2 (~> 2.
|
55
|
-
oauth2 (1.
|
56
|
-
faraday (>= 0.8, < 0.
|
55
|
+
nokogiri (1.8.2)
|
56
|
+
mini_portile2 (~> 2.3.0)
|
57
|
+
oauth2 (1.4.0)
|
58
|
+
faraday (>= 0.8, < 0.13)
|
57
59
|
jwt (~> 1.0)
|
58
60
|
multi_json (~> 1.3)
|
59
61
|
multi_xml (~> 0.5)
|
@@ -65,40 +67,40 @@ GEM
|
|
65
67
|
pry-byebug (3.4.2)
|
66
68
|
byebug (~> 9.0)
|
67
69
|
pry (~> 0.10)
|
68
|
-
rack (2.0.
|
70
|
+
rack (2.0.3)
|
69
71
|
rake (12.0.0)
|
70
72
|
rdoc (3.12.2)
|
71
73
|
json (~> 1.4)
|
72
|
-
rspec (3.
|
73
|
-
rspec-core (~> 3.
|
74
|
-
rspec-expectations (~> 3.
|
75
|
-
rspec-mocks (~> 3.
|
76
|
-
rspec-core (3.
|
77
|
-
rspec-support (~> 3.
|
78
|
-
rspec-expectations (3.
|
74
|
+
rspec (3.6.0)
|
75
|
+
rspec-core (~> 3.6.0)
|
76
|
+
rspec-expectations (~> 3.6.0)
|
77
|
+
rspec-mocks (~> 3.6.0)
|
78
|
+
rspec-core (3.6.0)
|
79
|
+
rspec-support (~> 3.6.0)
|
80
|
+
rspec-expectations (3.6.0)
|
79
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
|
-
rspec-support (~> 3.
|
81
|
-
rspec-mocks (3.
|
82
|
+
rspec-support (~> 3.6.0)
|
83
|
+
rspec-mocks (3.6.0)
|
82
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-support (3.
|
85
|
+
rspec-support (~> 3.6.0)
|
86
|
+
rspec-support (3.6.0)
|
85
87
|
safe_yaml (1.0.4)
|
86
88
|
semver (1.0.1)
|
87
|
-
simplecov (0.
|
89
|
+
simplecov (0.15.0)
|
88
90
|
docile (~> 1.1.0)
|
89
91
|
json (>= 1.8, < 3)
|
90
92
|
simplecov-html (~> 0.10.0)
|
91
|
-
simplecov-html (0.10.
|
93
|
+
simplecov-html (0.10.2)
|
92
94
|
slop (3.6.0)
|
93
95
|
thread_safe (0.3.6)
|
94
|
-
tzinfo (1.2.
|
96
|
+
tzinfo (1.2.3)
|
95
97
|
thread_safe (~> 0.1)
|
96
98
|
vertebrae (0.4.1)
|
97
99
|
activesupport
|
98
100
|
faraday (>= 0.9.2)
|
99
101
|
faraday_middleware
|
100
102
|
hashie
|
101
|
-
webmock (
|
103
|
+
webmock (3.0.1)
|
102
104
|
addressable (>= 2.3.6)
|
103
105
|
crack (>= 0.3.2)
|
104
106
|
hashdiff
|
@@ -112,10 +114,10 @@ DEPENDENCIES
|
|
112
114
|
pry
|
113
115
|
pry-byebug
|
114
116
|
rdoc (~> 3.12)
|
115
|
-
rspec
|
117
|
+
rspec
|
116
118
|
simplecov
|
117
119
|
vertebrae
|
118
120
|
webmock
|
119
121
|
|
120
122
|
BUNDLED WITH
|
121
|
-
1.
|
123
|
+
1.16.1
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/identity-api-client.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: identity-api-client 0.0.
|
5
|
+
# stub: identity-api-client 0.0.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "identity-api-client".freeze
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Nathan Woodhull".freeze]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2018-05-01"
|
15
15
|
s.description = "Provides a simple ruby binding to 38dgs identity API".freeze
|
16
16
|
s.email = "nathan@controlshiftlabs.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -37,13 +37,13 @@ Gem::Specification.new do |s|
|
|
37
37
|
"lib/identity-api-client/member.rb",
|
38
38
|
"spec/client_spec.rb",
|
39
39
|
"spec/fixtures/details.json",
|
40
|
-
"spec/fixtures/
|
40
|
+
"spec/fixtures/details_with_consents.json",
|
41
41
|
"spec/member_spec.rb",
|
42
42
|
"spec/spec_helper.rb"
|
43
43
|
]
|
44
44
|
s.homepage = "http://github.com/controlshift/identity-api-client".freeze
|
45
45
|
s.licenses = ["MIT".freeze]
|
46
|
-
s.rubygems_version = "2.6.
|
46
|
+
s.rubygems_version = "2.6.13".freeze
|
47
47
|
s.summary = "API Client for 38 Degree's Identity API".freeze
|
48
48
|
|
49
49
|
if s.respond_to? :specification_version then
|
@@ -54,7 +54,7 @@ Gem::Specification.new do |s|
|
|
54
54
|
s.add_development_dependency(%q<pry>.freeze, [">= 0"])
|
55
55
|
s.add_development_dependency(%q<pry-byebug>.freeze, [">= 0"])
|
56
56
|
s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
|
57
|
-
s.add_development_dependency(%q<rspec>.freeze, ["
|
57
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
58
58
|
s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
59
59
|
s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
60
60
|
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
@@ -64,7 +64,7 @@ Gem::Specification.new do |s|
|
|
64
64
|
s.add_dependency(%q<pry>.freeze, [">= 0"])
|
65
65
|
s.add_dependency(%q<pry-byebug>.freeze, [">= 0"])
|
66
66
|
s.add_dependency(%q<webmock>.freeze, [">= 0"])
|
67
|
-
s.add_dependency(%q<rspec>.freeze, ["
|
67
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
68
68
|
s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
69
69
|
s.add_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
70
70
|
s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
@@ -75,7 +75,7 @@ Gem::Specification.new do |s|
|
|
75
75
|
s.add_dependency(%q<pry>.freeze, [">= 0"])
|
76
76
|
s.add_dependency(%q<pry-byebug>.freeze, [">= 0"])
|
77
77
|
s.add_dependency(%q<webmock>.freeze, [">= 0"])
|
78
|
-
s.add_dependency(%q<rspec>.freeze, ["
|
78
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
79
79
|
s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
80
80
|
s.add_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
81
81
|
s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
@@ -1,7 +1,10 @@
|
|
1
1
|
module IdentityApiClient
|
2
2
|
class Member < Base
|
3
|
-
def details(guid)
|
3
|
+
def details(guid, load_current_consents: false)
|
4
4
|
params = {'guid' => guid, 'api_token' => client.connection.configuration.options[:api_token]}
|
5
|
+
if load_current_consents
|
6
|
+
params['load_current_consents'] = true
|
7
|
+
end
|
5
8
|
|
6
9
|
resp = client.post_request('/api/member/details', params)
|
7
10
|
resp.body
|
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"first_name": "Joe",
|
3
|
+
"last_name": "Bloggs",
|
4
|
+
"email": "joe@bloggs.com",
|
5
|
+
|
6
|
+
"consents": [
|
7
|
+
{
|
8
|
+
"public_id": "terms_of_service_1.0",
|
9
|
+
"consent_level": "explicit_opt_in",
|
10
|
+
"consent_created_at": "2016-12-30 23:30:13 +0000"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"public_id": "privacy_policy_2.6",
|
14
|
+
"consent_level": "implicit",
|
15
|
+
"consent_created_at": "2015-01-01 10:10:10 +0000"
|
16
|
+
}
|
17
|
+
]
|
18
|
+
}
|
data/spec/member_spec.rb
CHANGED
@@ -4,21 +4,42 @@ describe IdentityApiClient::Member do
|
|
4
4
|
subject { IdentityApiClient.new(host: 'test.com', api_token: '1234567890abcdef') }
|
5
5
|
|
6
6
|
let(:request_path) { '/api/member/details' }
|
7
|
-
let(:request_body) { fixture('request.json').chomp }
|
8
7
|
|
9
8
|
describe 'success' do
|
10
9
|
let(:status) { 200 }
|
11
|
-
let(:body) { fixture('details.json') }
|
12
10
|
|
13
11
|
before(:each) do
|
14
|
-
stub_post(request_path).with(body:
|
15
|
-
|
12
|
+
stub_post(request_path).with(body: expected_request).to_return(:body => body, :status => status,
|
13
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
16
14
|
end
|
17
15
|
|
18
|
-
|
19
|
-
|
16
|
+
context 'without load_current_consents' do
|
17
|
+
let(:expected_request) { {'guid' => 'abcdef1234567890', 'api_token' => '1234567890abcdef'}.to_json }
|
18
|
+
let(:body) { fixture('details.json') }
|
20
19
|
|
21
|
-
|
20
|
+
it 'should get member details back from the API' do
|
21
|
+
resp = subject.member.details('abcdef1234567890')
|
22
|
+
|
23
|
+
expect(resp.first_name).to eq('Joe')
|
24
|
+
expect(resp.last_name).to eq('Bloggs')
|
25
|
+
expect(resp.email).to eq('joe@bloggs.com')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'with load_current_consents' do
|
30
|
+
let(:expected_request) { {'guid' => 'abcdef1234567890', 'api_token' => '1234567890abcdef', 'load_current_consents' => true}.to_json }
|
31
|
+
let(:body) { fixture('details_with_consents.json') }
|
32
|
+
|
33
|
+
it 'should get member details with consents back from the API' do
|
34
|
+
resp = subject.member.details('abcdef1234567890', load_current_consents: true)
|
35
|
+
|
36
|
+
expect(resp.first_name).to eq('Joe')
|
37
|
+
expect(resp.last_name).to eq('Bloggs')
|
38
|
+
expect(resp.email).to eq('joe@bloggs.com')
|
39
|
+
|
40
|
+
expect(resp.consents.count).to eq 2
|
41
|
+
expect(resp.consents[0].public_id).to eq 'terms_of_service_1.0'
|
42
|
+
end
|
22
43
|
end
|
23
44
|
end
|
24
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: identity-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Woodhull
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vertebrae
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rdoc
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +162,7 @@ files:
|
|
162
162
|
- lib/identity-api-client/member.rb
|
163
163
|
- spec/client_spec.rb
|
164
164
|
- spec/fixtures/details.json
|
165
|
-
- spec/fixtures/
|
165
|
+
- spec/fixtures/details_with_consents.json
|
166
166
|
- spec/member_spec.rb
|
167
167
|
- spec/spec_helper.rb
|
168
168
|
homepage: http://github.com/controlshift/identity-api-client
|
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
version: '0'
|
186
186
|
requirements: []
|
187
187
|
rubyforge_project:
|
188
|
-
rubygems_version: 2.6.
|
188
|
+
rubygems_version: 2.6.13
|
189
189
|
signing_key:
|
190
190
|
specification_version: 4
|
191
191
|
summary: API Client for 38 Degree's Identity API
|
data/spec/fixtures/request.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"guid":"abcdef1234567890","api_token":"1234567890abcdef"}
|