bouncer-client 0.3.1 → 0.3.2
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/lib/bouncer-client/activation.rb +4 -5
- data/lib/bouncer-client/version.rb +1 -1
- data/spec/model/activation_spec.rb +10 -0
- data/spec/model/user_spec.rb +5 -8
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32d93c1192da325437b8fc12ca10b5da56142c22
|
4
|
+
data.tar.gz: 831ce5a22205a3c9db3bcaf306411bd018b3b563
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a66e9dc0ab9ded482191bfb877605c2a08b6381444fb5926b4df98f2b816dba32ed11112ea030bf46da2c2900c495fff2cd23db87961ca5a695a610e629f3834
|
7
|
+
data.tar.gz: 89879a266475e2285e36a6a565a8449cb8159d229b45fc0be9ebd1b91a9504f27817529582317b1984603c19d57384b9926d826d111868772e4348a95bbba6c7
|
@@ -5,11 +5,10 @@ module Bouncer
|
|
5
5
|
|
6
6
|
def self.from_json json
|
7
7
|
activation = Activation.new
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
activation.user_id = json['links']['user']
|
8
|
+
json.keys.map do |key|
|
9
|
+
activation.class.class_eval { attr_accessor key.to_sym }
|
10
|
+
activation.send("#{key}=", json[key])
|
11
|
+
end
|
13
12
|
activation
|
14
13
|
end
|
15
14
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bouncer::Activation do
|
4
|
+
it 'is created dynamically from a JSON payload' do
|
5
|
+
user = Bouncer::Activation.from_json({ foo: 'foo', links: { unit_id: SecureRandom.uuid }})
|
6
|
+
expect(user).to respond_to :foo
|
7
|
+
expect(user).to respond_to :links
|
8
|
+
expect(user.links[:unit_id]).not_to be_nil
|
9
|
+
end
|
10
|
+
end
|
data/spec/model/user_spec.rb
CHANGED
@@ -10,13 +10,10 @@ describe Bouncer::User do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'is created dynamically from a JSON payload' do
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
expect(user).to respond_to :role
|
19
|
-
expect(user).to_not respond_to :foo
|
20
|
-
end
|
13
|
+
user = Bouncer::User.from_json({ email: 'foo@example.com', super_admin: false, role: 'manager' })
|
14
|
+
expect(user).to respond_to :email
|
15
|
+
expect(user).to respond_to :super_admin
|
16
|
+
expect(user).to respond_to :role
|
17
|
+
expect(user).to_not respond_to :foo
|
21
18
|
end
|
22
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bouncer-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kurt Nelson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -253,6 +253,7 @@ files:
|
|
253
253
|
- spec/cassettes/bouncer/valid_admin.yml
|
254
254
|
- spec/cassettes/bouncer/valid_user.yml
|
255
255
|
- spec/mixins/controller_mixin_spec.rb
|
256
|
+
- spec/model/activation_spec.rb
|
256
257
|
- spec/model/token_spec.rb
|
257
258
|
- spec/model/user_spec.rb
|
258
259
|
- spec/spec_helper.rb
|
@@ -287,6 +288,7 @@ test_files:
|
|
287
288
|
- spec/cassettes/bouncer/valid_admin.yml
|
288
289
|
- spec/cassettes/bouncer/valid_user.yml
|
289
290
|
- spec/mixins/controller_mixin_spec.rb
|
291
|
+
- spec/model/activation_spec.rb
|
290
292
|
- spec/model/token_spec.rb
|
291
293
|
- spec/model/user_spec.rb
|
292
294
|
- spec/spec_helper.rb
|