g5_authentication_client 0.5.5 → 1.0.0.pre.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +9 -2
- data/CHANGELOG.md +8 -0
- data/README.md +2 -2
- data/g5_authentication_client.gemspec +14 -12
- data/lib/g5_authentication_client/version.rb +3 -1
- data/spec/g5_authentication_client/role_spec.rb +13 -15
- data/spec/g5_authentication_client/user_spec.rb +34 -17
- data/spec/spec_helper.rb +2 -5
- 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: ec977846ba08302b591fe6ad9f7b14029df428da
|
4
|
+
data.tar.gz: c4a075849add4076e9a11d8ca1eb9ad609c5b146
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01163f1a683de2961d057164a3d43ae83c783ba2f23c4c26656458547d2fbd84dbaff09a26db98a74ef97e88dc542043d311f677bb416c22ba57d76e5f0044dc
|
7
|
+
data.tar.gz: b00e09b45f75ed1aad18bf5c554d7b77fe79970ab0eea6be53920db1176810820a4a245bf4c9aba0f81eae7d20b23dbc9368f028e64ab31ad6f9624bb4165fb4
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.4
|
data/.travis.yml
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.2.
|
4
|
-
- 2.3.
|
3
|
+
- 2.2.7
|
4
|
+
- 2.3.4
|
5
|
+
- 2.4.1
|
5
6
|
script:
|
6
7
|
- bundle exec rspec spec
|
8
|
+
after_script:
|
9
|
+
- bundle exec codeclimate-test-reporter
|
10
|
+
addons:
|
11
|
+
code_climate:
|
12
|
+
repo_token:
|
13
|
+
secure: "o57YVn0CkxJwlVfYv2faFKT3sF3Xlio21piMFhNu828lkWxmnHREKt89UioQSVtAJWRkAC9dQL24YdsItNEunxozPQ/appw6UfJTNTDP8HrUg3rQjdimryzKFFr731ztpHs12q+PgbRt+WXIl/PW8w6haHf6m6pEsDkt364z8So="
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## v1.0.0.pre.1 (2017-06-08)
|
2
|
+
|
3
|
+
* **Backwards incompatible changes**
|
4
|
+
* Drop support for ruby < 2.2
|
5
|
+
* Enhancements
|
6
|
+
* Upgrade modelish to ensure compatibility with ruby 2.4 and
|
7
|
+
rails 5.x
|
8
|
+
|
1
9
|
## v0.5.5 (2017-01-30)
|
2
10
|
|
3
11
|
* RestClient raises errors on 401.
|
data/README.md
CHANGED
@@ -1,23 +1,25 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
4
|
+
require 'g5_authentication_client/version'
|
3
5
|
|
4
6
|
Gem::Specification.new do |s|
|
5
|
-
s.name =
|
7
|
+
s.name = 'g5_authentication_client'
|
6
8
|
s.version = G5AuthenticationClient::VERSION
|
7
|
-
s.authors = [
|
8
|
-
s.email = [
|
9
|
-
s.homepage =
|
10
|
-
s.summary =
|
11
|
-
s.description =
|
9
|
+
s.authors = ['Rob Revels', 'Maeve Revels']
|
10
|
+
s.email = ['rob.revels@getg5.com', 'maeve.revels@getg5.com']
|
11
|
+
s.homepage = 'https://github.com/G5/g5_authentication_client'
|
12
|
+
s.summary = 'Client for the G5 Auth service'
|
13
|
+
s.description = 'Client for the G5 Auth service'
|
12
14
|
|
13
|
-
s.rubyforge_project =
|
15
|
+
s.rubyforge_project = 'g5_authentication_client'
|
14
16
|
|
15
17
|
s.files = `git ls-files`.split("\n")
|
16
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
19
|
|
18
|
-
s.require_paths = [
|
20
|
+
s.require_paths = ['lib']
|
19
21
|
|
20
|
-
s.add_dependency('modelish', '~> 0.
|
22
|
+
s.add_dependency('modelish', '~> 0.4')
|
21
23
|
s.add_dependency('configlet', '~> 2.1')
|
22
24
|
s.add_dependency('oauth2')
|
23
25
|
s.add_dependency('addressable')
|
@@ -27,7 +29,7 @@ Gem::Specification.new do |s|
|
|
27
29
|
s.add_development_dependency('webmock')
|
28
30
|
s.add_development_dependency('fakefs')
|
29
31
|
s.add_development_dependency('simplecov')
|
30
|
-
s.add_development_dependency('codeclimate-test-reporter')
|
32
|
+
s.add_development_dependency('codeclimate-test-reporter', '~> 1.0')
|
31
33
|
s.add_development_dependency('yard')
|
32
34
|
s.add_development_dependency('rdiscount')
|
33
35
|
s.add_development_dependency('vcr')
|
@@ -1,13 +1,14 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe G5AuthenticationClient::Role do
|
4
6
|
subject(:role) { G5AuthenticationClient::Role.new(attributes) }
|
5
7
|
|
6
|
-
let(:attributes) do
|
7
|
-
name: name,
|
8
|
-
|
9
|
-
|
10
|
-
}
|
8
|
+
let(:attributes) do
|
9
|
+
{ name: name,
|
10
|
+
type: type,
|
11
|
+
urn: urn }
|
11
12
|
end
|
12
13
|
|
13
14
|
let(:name) { 'awesome_role' }
|
@@ -41,7 +42,7 @@ describe G5AuthenticationClient::Role do
|
|
41
42
|
end
|
42
43
|
|
43
44
|
context 'when attributes include unknown properties' do
|
44
|
-
let(:attributes) { {name: name, resource: 'Application'} }
|
45
|
+
let(:attributes) { { name: name, resource: 'Application' } }
|
45
46
|
|
46
47
|
it 'should not raise an error' do
|
47
48
|
expect { role }.to_not raise_error
|
@@ -69,28 +70,27 @@ describe G5AuthenticationClient::Role do
|
|
69
70
|
let(:name) {}
|
70
71
|
|
71
72
|
it 'should raise an error' do
|
72
|
-
expect { validate! }.to raise_error
|
73
|
+
expect { validate! }.to raise_error(ArgumentError,
|
74
|
+
'name must not be nil or blank')
|
73
75
|
end
|
74
76
|
end
|
75
77
|
end
|
76
78
|
|
77
79
|
describe '#validate_for_create!' do
|
78
|
-
subject(:validate_for_create) {role.validate_for_create!}
|
80
|
+
subject(:validate_for_create) { role.validate_for_create! }
|
79
81
|
|
80
82
|
context 'when type not GLOBAL and no urn' do
|
81
|
-
|
82
83
|
let(:type) { 'not_global' }
|
83
|
-
let(:urn) {
|
84
|
+
let(:urn) {}
|
84
85
|
|
85
86
|
it 'will raise an error' do
|
86
|
-
expect { validate_for_create }.to raise_error
|
87
|
+
expect { validate_for_create }.to raise_error(ArgumentError)
|
87
88
|
end
|
88
89
|
end
|
89
90
|
|
90
91
|
context 'when type GLOBAL and no urn' do
|
91
|
-
|
92
92
|
let(:type) { 'GLOBAL' }
|
93
|
-
let(:urn) {
|
93
|
+
let(:urn) {}
|
94
94
|
|
95
95
|
it 'will raise an error' do
|
96
96
|
expect { validate_for_create }.to_not raise_error
|
@@ -98,7 +98,6 @@ describe G5AuthenticationClient::Role do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
context 'when type not GLOBAL and existing urn' do
|
101
|
-
|
102
101
|
let(:type) { 'NOT_GLOBAL' }
|
103
102
|
let(:urn) { 'some_urn' }
|
104
103
|
|
@@ -106,7 +105,6 @@ describe G5AuthenticationClient::Role do
|
|
106
105
|
expect { validate_for_create }.to_not raise_error
|
107
106
|
end
|
108
107
|
end
|
109
|
-
|
110
108
|
end
|
111
109
|
|
112
110
|
describe '#to_hash' do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe G5AuthenticationClient::User do
|
@@ -13,23 +15,24 @@ describe G5AuthenticationClient::User do
|
|
13
15
|
title: title,
|
14
16
|
organization_name: organization_name,
|
15
17
|
phone_number: phone_number,
|
16
|
-
roles: [{name: role_name,
|
17
|
-
|
18
|
+
roles: [{ name: role_name,
|
19
|
+
type: 'G5Updatable::Client',
|
20
|
+
urn: 'someurn' }] }
|
18
21
|
end
|
19
22
|
|
20
23
|
let(:email) { 'foo@blah.com' }
|
21
24
|
let(:password) { 'foobarbaz' }
|
22
25
|
let(:password_confirmation) { 'notamatch' }
|
23
|
-
let(:id) {1}
|
26
|
+
let(:id) { 1 }
|
24
27
|
let(:first_name) { 'Joe' }
|
25
28
|
let(:last_name) { 'Person' }
|
26
29
|
let(:organization_name) { 'Things, Inc.' }
|
27
30
|
let(:phone_number) { '8675309123' }
|
28
31
|
let(:title) { 'Developer' }
|
29
|
-
let(:role_name)
|
32
|
+
let(:role_name) { 'Editor' }
|
30
33
|
|
31
34
|
context 'with default initialization' do
|
32
|
-
let(:attributes){}
|
35
|
+
let(:attributes) {}
|
33
36
|
|
34
37
|
it 'should have nil email' do
|
35
38
|
expect(user.email).to be_nil
|
@@ -102,15 +105,18 @@ describe G5AuthenticationClient::User do
|
|
102
105
|
subject(:validate!) { user.validate! }
|
103
106
|
|
104
107
|
context 'without email' do
|
105
|
-
let(:email){}
|
108
|
+
let(:email) {}
|
106
109
|
|
107
110
|
it 'should raise an error' do
|
108
|
-
expect { validate! }.to raise_error
|
111
|
+
expect { validate! }.to raise_error(
|
112
|
+
ArgumentError,
|
113
|
+
'email must not be nil or blank'
|
114
|
+
)
|
109
115
|
end
|
110
116
|
end
|
111
117
|
|
112
118
|
context 'without password' do
|
113
|
-
let(:password){}
|
119
|
+
let(:password) {}
|
114
120
|
|
115
121
|
it 'should not raise an error' do
|
116
122
|
expect { validate! }.to_not raise_error
|
@@ -118,7 +124,7 @@ describe G5AuthenticationClient::User do
|
|
118
124
|
end
|
119
125
|
|
120
126
|
context 'without id' do
|
121
|
-
let(:id){}
|
127
|
+
let(:id) {}
|
122
128
|
|
123
129
|
it 'should not raise an error' do
|
124
130
|
expect { validate! }.to_not raise_error
|
@@ -185,28 +191,35 @@ describe G5AuthenticationClient::User do
|
|
185
191
|
let(:role_name) {}
|
186
192
|
|
187
193
|
it 'should raise an error' do
|
188
|
-
expect { validate! }.to raise_error
|
194
|
+
expect { validate! }.to raise_error(ArgumentError,
|
195
|
+
'User roles must be valid')
|
189
196
|
end
|
190
197
|
end
|
191
198
|
end
|
192
199
|
|
193
200
|
describe '#validate_for_create!' do
|
194
|
-
subject(:validate_for_create) {user.validate_for_create!}
|
201
|
+
subject(:validate_for_create) { user.validate_for_create! }
|
195
202
|
|
196
203
|
context 'without a password' do
|
197
|
-
let(:password){}
|
204
|
+
let(:password) {}
|
198
205
|
|
199
206
|
it 'should be invalid' do
|
200
|
-
expect { validate_for_create }.to raise_error
|
207
|
+
expect { validate_for_create }.to raise_error(
|
208
|
+
ArgumentError,
|
209
|
+
'Password required for new user.'
|
210
|
+
)
|
201
211
|
end
|
202
212
|
end
|
203
213
|
|
204
214
|
context 'without an email' do
|
205
|
-
let(:email){}
|
206
|
-
let(:password){'foo'}
|
215
|
+
let(:email) {}
|
216
|
+
let(:password) { 'foo' }
|
207
217
|
|
208
218
|
it 'should be invalid' do
|
209
|
-
expect { validate_for_create }.to raise_error
|
219
|
+
expect { validate_for_create }.to raise_error(
|
220
|
+
ArgumentError,
|
221
|
+
'email must not be nil or blank'
|
222
|
+
)
|
210
223
|
end
|
211
224
|
end
|
212
225
|
end
|
@@ -243,7 +256,11 @@ describe G5AuthenticationClient::User do
|
|
243
256
|
end
|
244
257
|
|
245
258
|
it 'should have roles' do
|
246
|
-
expect(to_hash['roles']).to eq(
|
259
|
+
expect(to_hash['roles']).to eq(
|
260
|
+
[{ 'name' => role_name,
|
261
|
+
'type' => 'G5Updatable::Client',
|
262
|
+
'urn' => 'someurn' }]
|
263
|
+
)
|
247
264
|
end
|
248
265
|
end
|
249
266
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'simplecov'
|
2
|
-
require 'codeclimate-test-reporter'
|
3
4
|
SimpleCov.start 'test_frameworks'
|
4
5
|
|
5
6
|
require 'rspec'
|
@@ -11,10 +12,6 @@ Dir[File.join(File.dirname(__FILE__), 'support', '*.rb')].each { |f| require f }
|
|
11
12
|
|
12
13
|
RSpec.configure do |config|
|
13
14
|
config.include FakeFS::SpecHelpers
|
14
|
-
|
15
|
-
# We need to explicitly disable webmock to report
|
16
|
-
# coverage data to Code Climate
|
17
|
-
config.after(:suite) { WebMock.disable! }
|
18
15
|
end
|
19
16
|
|
20
17
|
require 'g5_authentication_client'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: g5_authentication_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Revels
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-09
|
12
|
+
date: 2017-06-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: modelish
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '0.
|
20
|
+
version: '0.4'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '0.
|
27
|
+
version: '0.4'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: configlet
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,16 +141,16 @@ dependencies:
|
|
141
141
|
name: codeclimate-test-reporter
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- - "
|
144
|
+
- - "~>"
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: '0'
|
146
|
+
version: '1.0'
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- - "
|
151
|
+
- - "~>"
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version: '0'
|
153
|
+
version: '1.0'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: yard
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
@@ -244,12 +244,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
244
244
|
version: '0'
|
245
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
246
|
requirements:
|
247
|
-
- - "
|
247
|
+
- - ">"
|
248
248
|
- !ruby/object:Gem::Version
|
249
|
-
version:
|
249
|
+
version: 1.3.1
|
250
250
|
requirements: []
|
251
251
|
rubyforge_project: g5_authentication_client
|
252
|
-
rubygems_version: 2.
|
252
|
+
rubygems_version: 2.5.2
|
253
253
|
signing_key:
|
254
254
|
specification_version: 4
|
255
255
|
summary: Client for the G5 Auth service
|