lifen 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/Gemfile.lock +1 -1
- data/README.md +8 -4
- data/lib/lifen/flow.rb +2 -0
- data/lib/lifen/settings.rb +3 -1
- data/lib/lifen/status.rb +5 -1
- data/lib/lifen/user.rb +38 -3
- data/lib/lifen/version.rb +1 -1
- data/spec/cassettes/settings/{refresh.yml → reload.yml} +0 -0
- data/spec/cassettes/users/find/existing_uuid.yml +56 -0
- data/spec/cassettes/users/find/missing_uuid.yml +57 -0
- data/spec/cassettes/users/reload/existing_uuid.yml +56 -0
- data/spec/cassettes/users/save/existing_uuid.yml +56 -0
- data/spec/cassettes/users/status/{refresh → reload}/invalid_token.yml +0 -0
- data/spec/cassettes/users/status/{refresh → reload}/valid_token.yml +0 -0
- data/spec/settings_spec.rb +1 -1
- data/spec/users_spec.rb +60 -8
- metadata +16 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfa27c22c1d17a8d6ac0bae61dc1e1c566bd32e9
|
4
|
+
data.tar.gz: 5986f0073d029ce33c700520824505b9653f2885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aa7e611af1d416b2633f5808c1e6ad9454d8a388dc7d2eb93d5e4c779be71b4b5b8c260811de0d1f8dd3a6dfcbea3887f2f4b115c1e021ce329f7928fc4b74c
|
7
|
+
data.tar.gz: 5993c5066b88ce9ca004155b1e879b31da46b76a65334a991a1b388e6d7b2cda606c2b107c5aa8ae3b8af40b1e1a921c2687840cc9c2b8246b3419b689c67e98
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -46,14 +46,19 @@ Optionnal configuration:
|
|
46
46
|
user = Lifen::User.new(email: "email@domain.tld", first_name: "Jean", last_name: "Dupont")
|
47
47
|
user.create
|
48
48
|
user.token.refresh
|
49
|
-
user.status.
|
49
|
+
user.status.reload
|
50
|
+
|
51
|
+
other_user = Lifen::User.find("user_uuid")
|
52
|
+
other_user.first_name = "Marc"
|
53
|
+
other_user.save
|
54
|
+
other_user.reload
|
50
55
|
```
|
51
56
|
|
52
57
|
### Managing users' settings
|
53
58
|
|
54
59
|
```ruby
|
55
60
|
user.settings
|
56
|
-
user.settings.
|
61
|
+
user.settings.reload
|
57
62
|
user.settings.push_notifications
|
58
63
|
user.settings.push_notifications = false
|
59
64
|
user.settings.save
|
@@ -65,11 +70,10 @@ user.settings.save
|
|
65
70
|
user = Lifen::User.new(uuid: "valid_uuid")
|
66
71
|
user.flows
|
67
72
|
|
68
|
-
flow = Lifen::Flow.new(user: user, title: "
|
73
|
+
flow = Lifen::Flow.new(user: user, title: "Honestica Rocks !")
|
69
74
|
flow.create
|
70
75
|
flow.attach_users(user)
|
71
76
|
flow.detach_users(user)
|
72
|
-
flow.save
|
73
77
|
|
74
78
|
# alternate strategy
|
75
79
|
flow = Lifen::Flow.new(user: user, title: "honestica Rocks !", users: [user_1, user_2])
|
data/lib/lifen/flow.rb
CHANGED
data/lib/lifen/settings.rb
CHANGED
@@ -8,7 +8,7 @@ module Lifen
|
|
8
8
|
attribute :email_notifications, Boolean
|
9
9
|
attribute :push_notifications, Boolean
|
10
10
|
|
11
|
-
def
|
11
|
+
def reload
|
12
12
|
json = client.get("central/api/settings")
|
13
13
|
|
14
14
|
load_from_json(json)
|
@@ -16,6 +16,8 @@ module Lifen
|
|
16
16
|
self
|
17
17
|
end
|
18
18
|
|
19
|
+
alias refresh reload
|
20
|
+
|
19
21
|
def save
|
20
22
|
params = {"emailNotifications" => email_notifications, "pushNotifications" => push_notifications}
|
21
23
|
|
data/lib/lifen/status.rb
CHANGED
@@ -7,12 +7,16 @@ module Lifen
|
|
7
7
|
|
8
8
|
attribute :unread, Integer, default: 0
|
9
9
|
|
10
|
-
def
|
10
|
+
def reload
|
11
11
|
json = client.get("central/api/chats/status")
|
12
12
|
|
13
13
|
self.unread = json["unread"]
|
14
|
+
|
15
|
+
self
|
14
16
|
end
|
15
17
|
|
18
|
+
alias refresh reload
|
19
|
+
|
16
20
|
private
|
17
21
|
|
18
22
|
def client
|
data/lib/lifen/user.rb
CHANGED
@@ -10,19 +10,50 @@ module Lifen
|
|
10
10
|
attribute :email, String
|
11
11
|
attribute :last_name, String
|
12
12
|
attribute :first_name, String
|
13
|
+
attribute :profile_picture_url, String
|
13
14
|
|
14
15
|
def flows
|
15
16
|
Lifen::Flows.new(user: self).all
|
16
17
|
end
|
17
18
|
|
18
19
|
def create
|
19
|
-
params = {emailAddress: email, lastName: last_name, firstName: first_name}
|
20
|
+
params = {emailAddress: email, lastName: last_name, firstName: first_name, profilePicUrl: profile_picture_url}
|
20
21
|
|
21
22
|
json = application_client.post("authentication/api/register/third_party", params)
|
22
23
|
|
23
24
|
self.uuid = json["accountUuid"]
|
24
25
|
end
|
25
26
|
|
27
|
+
def self.find(uuid)
|
28
|
+
json = application_client.get("docbook/api/thirdParty/person/#{uuid}")
|
29
|
+
|
30
|
+
json[:uuid] = json["uuid"]
|
31
|
+
json[:email] = json["emailAddress"]
|
32
|
+
json[:first_name] = json["firstName"]
|
33
|
+
json[:last_name] = json["lastName"]
|
34
|
+
json[:profile_picture_url] = json["profilePicUrl"]
|
35
|
+
|
36
|
+
new(json)
|
37
|
+
end
|
38
|
+
|
39
|
+
def reload
|
40
|
+
self.class.find(uuid)
|
41
|
+
end
|
42
|
+
|
43
|
+
def save
|
44
|
+
params = {emailAddress: email, lastName: last_name, firstName: first_name, profilePicUrl: profile_picture_url}
|
45
|
+
params[:uuid] = uuid
|
46
|
+
|
47
|
+
json = application_client.put("docbook/api/thirdParty/person/", params)
|
48
|
+
|
49
|
+
self.email = json["emailAddress"]
|
50
|
+
self.first_name = json["firstName"]
|
51
|
+
self.last_name = json["lastName"]
|
52
|
+
self.profile_picture_url = json["profilePicUrl"]
|
53
|
+
|
54
|
+
self
|
55
|
+
end
|
56
|
+
|
26
57
|
def unread_messages
|
27
58
|
status.unread
|
28
59
|
end
|
@@ -37,11 +68,11 @@ module Lifen
|
|
37
68
|
end
|
38
69
|
|
39
70
|
def status
|
40
|
-
@status ||= Lifen::Status.new(user: self)
|
71
|
+
@status ||= Lifen::Status.new(user: self).reload
|
41
72
|
end
|
42
73
|
|
43
74
|
def settings
|
44
|
-
@settings ||= Lifen::Settings.new(user: self).
|
75
|
+
@settings ||= Lifen::Settings.new(user: self).reload
|
45
76
|
end
|
46
77
|
|
47
78
|
def client
|
@@ -54,5 +85,9 @@ module Lifen
|
|
54
85
|
@application_client ||= AppAuthenticatedClient.new
|
55
86
|
end
|
56
87
|
|
88
|
+
def self.application_client
|
89
|
+
@application_client ||= AppAuthenticatedClient.new
|
90
|
+
end
|
91
|
+
|
57
92
|
end
|
58
93
|
end
|
data/lib/lifen/version.rb
CHANGED
File without changes
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://develop.lifen.fr/docbook/api/thirdParty/person/11e6cc11-a78f-ad5d-9506-0242ac110002
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.10.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_application_access_token
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
18
|
+
Accept-Encoding:
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- Apache-Coyote/1.1
|
27
|
+
X-B3-Sampled:
|
28
|
+
- '1'
|
29
|
+
X-B3-Spanid:
|
30
|
+
- 875991660de6f255
|
31
|
+
X-B3-Traceid:
|
32
|
+
- 875991660de6f255
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
X-Xss-Protection:
|
36
|
+
- 1; mode=block
|
37
|
+
Cache-Control:
|
38
|
+
- no-cache, no-store, max-age=0, must-revalidate
|
39
|
+
Pragma:
|
40
|
+
- no-cache
|
41
|
+
Expires:
|
42
|
+
- '0'
|
43
|
+
Content-Type:
|
44
|
+
- application/json;charset=UTF-8
|
45
|
+
Transfer-Encoding:
|
46
|
+
- chunked
|
47
|
+
Date:
|
48
|
+
- Tue, 27 Dec 2016 09:31:01 GMT
|
49
|
+
Connection:
|
50
|
+
- close
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: '{"uuid":"11e6cc11-a78f-ad5c-9506-0242ac110002","version":0,"lastName":"Depaulis","firstName":"Etienne","gender":"Unknown","thirdPartySource":"PDG","emailAddress":"etienne.depaulis@honestica.com"}'
|
54
|
+
http_version:
|
55
|
+
recorded_at: Tue, 27 Dec 2016 09:30:11 GMT
|
56
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://develop.lifen.fr/docbook/api/thirdParty/person/missing_uuid
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.10.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_application_access_token
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
18
|
+
Accept-Encoding:
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 400
|
23
|
+
message: Bad Request
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- Apache-Coyote/1.1
|
27
|
+
X-B3-Sampled:
|
28
|
+
- '1'
|
29
|
+
X-B3-Spanid:
|
30
|
+
- 88f12efa85307c9d
|
31
|
+
X-B3-Traceid:
|
32
|
+
- 88f12efa85307c9d
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
X-Xss-Protection:
|
36
|
+
- 1; mode=block
|
37
|
+
Cache-Control:
|
38
|
+
- no-cache, no-store, max-age=0, must-revalidate
|
39
|
+
Pragma:
|
40
|
+
- no-cache
|
41
|
+
Expires:
|
42
|
+
- '0'
|
43
|
+
Content-Type:
|
44
|
+
- application/json;charset=UTF-8
|
45
|
+
Transfer-Encoding:
|
46
|
+
- chunked
|
47
|
+
Date:
|
48
|
+
- Tue, 27 Dec 2016 09:33:20 GMT
|
49
|
+
Connection:
|
50
|
+
- close
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: '{"timestamp":"2016-12-27T09:33:20.921+0000","status":400,"error":"Bad
|
54
|
+
Request","code":"error.400","X-B3-TraceId":"88f12efa85307c9d","X-B3-SpanId":"88f12efa85307c9d"}'
|
55
|
+
http_version:
|
56
|
+
recorded_at: Tue, 27 Dec 2016 09:32:30 GMT
|
57
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://develop.lifen.fr/docbook/api/thirdParty/person/11e6cc11-a78f-ad5d-9506-0242ac110002
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.10.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_application_access_token
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
18
|
+
Accept-Encoding:
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- Apache-Coyote/1.1
|
27
|
+
X-B3-Sampled:
|
28
|
+
- '1'
|
29
|
+
X-B3-Spanid:
|
30
|
+
- 6750494a4dc54e9c
|
31
|
+
X-B3-Traceid:
|
32
|
+
- 6750494a4dc54e9c
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
X-Xss-Protection:
|
36
|
+
- 1; mode=block
|
37
|
+
Cache-Control:
|
38
|
+
- no-cache, no-store, max-age=0, must-revalidate
|
39
|
+
Pragma:
|
40
|
+
- no-cache
|
41
|
+
Expires:
|
42
|
+
- '0'
|
43
|
+
Content-Type:
|
44
|
+
- application/json;charset=UTF-8
|
45
|
+
Transfer-Encoding:
|
46
|
+
- chunked
|
47
|
+
Date:
|
48
|
+
- Tue, 27 Dec 2016 09:43:56 GMT
|
49
|
+
Connection:
|
50
|
+
- close
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: '{"uuid":"11e6cc11-a78f-ad5c-9506-0242ac110002","version":2,"lastName":"Depaulis","firstName":"Marc","gender":"Unknown","thirdPartySource":"PDG","emailAddress":"etienne.depaulis@honestica.com"}'
|
54
|
+
http_version:
|
55
|
+
recorded_at: Tue, 27 Dec 2016 09:43:05 GMT
|
56
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://develop.lifen.fr/docbook/api/thirdParty/person/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"emailAddress":null,"lastName":null,"firstName":"Marc","profilePicUrl":null,"uuid":"11e6cc11-a78f-ad5d-9506-0242ac110002"}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.10.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_application_access_token
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
18
|
+
Accept-Encoding:
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 202
|
23
|
+
message: Accepted
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- Apache-Coyote/1.1
|
27
|
+
X-B3-Sampled:
|
28
|
+
- '1'
|
29
|
+
X-B3-Spanid:
|
30
|
+
- 945a60d00933971a
|
31
|
+
X-B3-Traceid:
|
32
|
+
- 945a60d00933971a
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
X-Xss-Protection:
|
36
|
+
- 1; mode=block
|
37
|
+
Cache-Control:
|
38
|
+
- no-cache, no-store, max-age=0, must-revalidate
|
39
|
+
Pragma:
|
40
|
+
- no-cache
|
41
|
+
Expires:
|
42
|
+
- '0'
|
43
|
+
Content-Type:
|
44
|
+
- application/json;charset=UTF-8
|
45
|
+
Transfer-Encoding:
|
46
|
+
- chunked
|
47
|
+
Date:
|
48
|
+
- Tue, 27 Dec 2016 09:43:48 GMT
|
49
|
+
Connection:
|
50
|
+
- close
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: '{"uuid":"11e6cc11-a78f-ad5c-9506-0242ac110002","version":2,"lastName":"Depaulis","firstName":"Marc","gender":"Unknown","thirdPartySource":"PDG","emailAddress":"etienne.depaulis@honestica.com"}'
|
54
|
+
http_version:
|
55
|
+
recorded_at: Tue, 27 Dec 2016 09:42:58 GMT
|
56
|
+
recorded_with: VCR 3.0.3
|
File without changes
|
File without changes
|
data/spec/settings_spec.rb
CHANGED
data/spec/users_spec.rb
CHANGED
@@ -17,7 +17,7 @@ describe Lifen::User do
|
|
17
17
|
VCR.use_cassette "users/create/missing_fields" do
|
18
18
|
user.create
|
19
19
|
end
|
20
|
-
}.to raise_error(Lifen::Error, "Error 401, Invalid app bearer, App Client, POST 'https://develop.lifen.fr/authentication/api/register/third_party' with params '{:emailAddress=>nil, :lastName=>nil, :firstName=>\"Marc\"}' and bearer 'valid_application_access******'")
|
20
|
+
}.to raise_error(Lifen::Error, "Error 401, Invalid app bearer, App Client, POST 'https://develop.lifen.fr/authentication/api/register/third_party' with params '{:emailAddress=>nil, :lastName=>nil, :firstName=>\"Marc\", :profilePicUrl=>nil}' and bearer 'valid_application_access******'")
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -36,7 +36,7 @@ describe Lifen::User do
|
|
36
36
|
VCR.use_cassette "users/create/invalid_token" do
|
37
37
|
user.create
|
38
38
|
end
|
39
|
-
}.to raise_error(Lifen::InvalidSecretTokenError, "Error 401, Invalid app bearer, App Client, POST 'https://develop.lifen.fr/authentication/api/register/third_party' with params '{:emailAddress=>\"invalid-key-email@test.tld\", :lastName=>nil, :firstName=>nil}' and bearer 'invalid-secret-key'")
|
39
|
+
}.to raise_error(Lifen::InvalidSecretTokenError, "Error 401, Invalid app bearer, App Client, POST 'https://develop.lifen.fr/authentication/api/register/third_party' with params '{:emailAddress=>\"invalid-key-email@test.tld\", :lastName=>nil, :firstName=>nil, :profilePicUrl=>nil}' and bearer 'invalid-secret-key'")
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -49,7 +49,7 @@ describe Lifen::User do
|
|
49
49
|
VCR.use_cassette "users/create/existing_user" do
|
50
50
|
user.create
|
51
51
|
end
|
52
|
-
}.to raise_error(Lifen::UserAlreadyExistingError, "Error 403, User already existing, App Client, POST 'https://develop.lifen.fr/authentication/api/register/third_party' with params '{:emailAddress=>\"existing-user@domain.tld\", :lastName=>\"User\", :firstName=>\"Existing\"}' and bearer 'valid_application_access******'")
|
52
|
+
}.to raise_error(Lifen::UserAlreadyExistingError, "Error 403, User already existing, App Client, POST 'https://develop.lifen.fr/authentication/api/register/third_party' with params '{:emailAddress=>\"existing-user@domain.tld\", :lastName=>\"User\", :firstName=>\"Existing\", :profilePicUrl=>nil}' and bearer 'valid_application_access******'")
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -103,15 +103,15 @@ describe Lifen::User do
|
|
103
103
|
|
104
104
|
end
|
105
105
|
|
106
|
-
describe ':status.
|
106
|
+
describe ':status.reload' do
|
107
107
|
|
108
108
|
context 'invalid token' do
|
109
109
|
let(:user) { Lifen::User.new(token: invalid_token) }
|
110
110
|
|
111
111
|
it 'raises an error' do
|
112
112
|
expect{
|
113
|
-
VCR.use_cassette "users/status/
|
114
|
-
user.status
|
113
|
+
VCR.use_cassette "users/status/reload/invalid_token" do
|
114
|
+
user.status
|
115
115
|
end
|
116
116
|
}.to raise_error(Lifen::Error, "Error 401, Token is not valid, User Client, GET 'https://develop.lifen.fr/central/api/chats/status' with params '{}' and bearer 'invalid_token'")
|
117
117
|
end
|
@@ -123,8 +123,8 @@ describe Lifen::User do
|
|
123
123
|
let(:user) { Lifen::User.new(token: valid_token) }
|
124
124
|
|
125
125
|
it 'raises an error' do
|
126
|
-
VCR.use_cassette "users/status/
|
127
|
-
user.status
|
126
|
+
VCR.use_cassette "users/status/reload/valid_token" do
|
127
|
+
user.status
|
128
128
|
end
|
129
129
|
|
130
130
|
expect(user.unread_messages).to eq 2
|
@@ -132,4 +132,56 @@ describe Lifen::User do
|
|
132
132
|
end
|
133
133
|
|
134
134
|
end
|
135
|
+
|
136
|
+
describe ':find' do
|
137
|
+
|
138
|
+
context 'existing uuid' do
|
139
|
+
|
140
|
+
it 'finds the user' do
|
141
|
+
VCR.use_cassette "users/find/existing_uuid" do
|
142
|
+
@user = Lifen::User.find("11e6cc11-a78f-ad5d-9506-0242ac110002")
|
143
|
+
end
|
144
|
+
|
145
|
+
expect(@user.first_name).to eq "Etienne"
|
146
|
+
expect(@user.last_name).to eq "Depaulis"
|
147
|
+
expect(@user.email).to eq "etienne.depaulis@honestica.com"
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
context 'missing uuid' do
|
153
|
+
|
154
|
+
it 'raises an error' do
|
155
|
+
expect{
|
156
|
+
VCR.use_cassette "users/find/missing_uuid" do
|
157
|
+
@user = Lifen::User.find("missing_uuid")
|
158
|
+
end
|
159
|
+
}.to raise_error(Lifen::Error, "Error 400, Unknown error, App Client, GET 'https://develop.lifen.fr/docbook/api/thirdParty/person/missing_uuid' with params '{}' and bearer 'valid_application_access******'")
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
describe ':save' do
|
167
|
+
|
168
|
+
let(:user) { Lifen::User.new(uuid: "11e6cc11-a78f-ad5d-9506-0242ac110002") }
|
169
|
+
|
170
|
+
it 'saves the user' do
|
171
|
+
user.first_name = "Marc"
|
172
|
+
|
173
|
+
VCR.use_cassette "users/save/existing_uuid" do
|
174
|
+
user.save
|
175
|
+
end
|
176
|
+
|
177
|
+
VCR.use_cassette "users/reload/existing_uuid" do
|
178
|
+
user.reload
|
179
|
+
end
|
180
|
+
|
181
|
+
expect(user.first_name).to eq "Marc"
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
|
135
187
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lifen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Etienne Depaulis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -181,14 +181,18 @@ files:
|
|
181
181
|
- spec/cassettes/flows/valid_token.yml
|
182
182
|
- spec/cassettes/messages/valid_message.yml
|
183
183
|
- spec/cassettes/settings/initial_state.yml
|
184
|
-
- spec/cassettes/settings/
|
184
|
+
- spec/cassettes/settings/reload.yml
|
185
185
|
- spec/cassettes/settings/update.yml
|
186
186
|
- spec/cassettes/users/create/existing_user.yml
|
187
187
|
- spec/cassettes/users/create/invalid_token.yml
|
188
188
|
- spec/cassettes/users/create/missing_fields.yml
|
189
189
|
- spec/cassettes/users/create/valid_attributes.yml
|
190
|
-
- spec/cassettes/users/
|
191
|
-
- spec/cassettes/users/
|
190
|
+
- spec/cassettes/users/find/existing_uuid.yml
|
191
|
+
- spec/cassettes/users/find/missing_uuid.yml
|
192
|
+
- spec/cassettes/users/reload/existing_uuid.yml
|
193
|
+
- spec/cassettes/users/save/existing_uuid.yml
|
194
|
+
- spec/cassettes/users/status/reload/invalid_token.yml
|
195
|
+
- spec/cassettes/users/status/reload/valid_token.yml
|
192
196
|
- spec/cassettes/users/token/refresh/invalid_user_uuid.yml
|
193
197
|
- spec/cassettes/users/token/refresh/valid_user_uuid.yml
|
194
198
|
- spec/configuration_spec.rb
|
@@ -236,14 +240,18 @@ test_files:
|
|
236
240
|
- spec/cassettes/flows/valid_token.yml
|
237
241
|
- spec/cassettes/messages/valid_message.yml
|
238
242
|
- spec/cassettes/settings/initial_state.yml
|
239
|
-
- spec/cassettes/settings/
|
243
|
+
- spec/cassettes/settings/reload.yml
|
240
244
|
- spec/cassettes/settings/update.yml
|
241
245
|
- spec/cassettes/users/create/existing_user.yml
|
242
246
|
- spec/cassettes/users/create/invalid_token.yml
|
243
247
|
- spec/cassettes/users/create/missing_fields.yml
|
244
248
|
- spec/cassettes/users/create/valid_attributes.yml
|
245
|
-
- spec/cassettes/users/
|
246
|
-
- spec/cassettes/users/
|
249
|
+
- spec/cassettes/users/find/existing_uuid.yml
|
250
|
+
- spec/cassettes/users/find/missing_uuid.yml
|
251
|
+
- spec/cassettes/users/reload/existing_uuid.yml
|
252
|
+
- spec/cassettes/users/save/existing_uuid.yml
|
253
|
+
- spec/cassettes/users/status/reload/invalid_token.yml
|
254
|
+
- spec/cassettes/users/status/reload/valid_token.yml
|
247
255
|
- spec/cassettes/users/token/refresh/invalid_user_uuid.yml
|
248
256
|
- spec/cassettes/users/token/refresh/valid_user_uuid.yml
|
249
257
|
- spec/configuration_spec.rb
|