lifen 0.2.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/README.md +11 -11
- data/lib/lifen.rb +7 -4
- data/lib/lifen/app_authenticated_client.rb +15 -27
- data/lib/lifen/client.rb +44 -0
- data/lib/lifen/configuration.rb +1 -1
- data/lib/lifen/error.rb +1 -0
- data/lib/lifen/flow.rb +41 -44
- data/lib/lifen/flows.rb +4 -8
- data/lib/lifen/status.rb +5 -3
- data/lib/lifen/token.rb +44 -0
- data/lib/lifen/user.rb +34 -23
- data/lib/lifen/user_authenticated_client.rb +17 -27
- data/lib/lifen/version.rb +1 -1
- data/lifen.gemspec +1 -0
- data/spec/cassettes/flows/attach_users/invalid_flow_uuid.yml +11 -13
- data/spec/cassettes/flows/attach_users/invalid_user_uuid.yml +12 -14
- data/spec/cassettes/flows/attach_users/valid.yml +14 -16
- data/spec/cassettes/flows/create.yml +13 -15
- data/spec/cassettes/flows/create_with_users.yml +12 -13
- data/spec/cassettes/flows/detach_users/valid.yml +14 -16
- data/spec/cassettes/flows/internal_error.yml +4 -2
- data/spec/cassettes/flows/internal_error_without_trace_id.yml +4 -2
- data/spec/cassettes/flows/invalid_token.yml +18 -14
- data/spec/cassettes/flows/valid_token.yml +14 -17
- data/spec/cassettes/messages/valid_message.yml +13 -15
- data/spec/cassettes/users/create/existing_user.yml +11 -11
- data/spec/cassettes/users/create/invalid_token.yml +16 -10
- data/spec/cassettes/users/create/missing_fields.yml +19 -14
- data/spec/cassettes/users/create/valid_attributes.yml +12 -12
- data/spec/cassettes/users/{refresh_unread_messages → status/refresh}/invalid_token.yml +16 -12
- data/spec/cassettes/users/{refresh_unread_messages → status/refresh}/valid_token.yml +10 -12
- data/spec/cassettes/users/token/refresh/invalid_user_uuid.yml +40 -0
- data/spec/cassettes/users/{refresh/invalid_user_uuid.yml → token/refresh/valid_user_uuid.yml} +16 -15
- data/spec/flows_spec.rb +43 -25
- data/spec/messages_spec.rb +10 -5
- data/spec/spec_helper.rb +1 -1
- data/spec/users_spec.rb +46 -26
- metadata +25 -13
- data/lib/lifen/authentication.rb +0 -29
- data/spec/cassettes/flows/detach_users/valid_again.yml +0 -57
- data/spec/cassettes/users/refresh/valid_user_uuid.yml +0 -54
@@ -9,10 +9,12 @@ http_interactions:
|
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.10.0
|
12
|
-
|
13
|
-
- valid_token
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_token
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
16
18
|
Accept-Encoding:
|
17
19
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
20
|
Accept:
|
@@ -9,10 +9,12 @@ http_interactions:
|
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.10.0
|
12
|
-
|
13
|
-
- valid_token
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_token
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
16
18
|
Accept-Encoding:
|
17
19
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
20
|
Accept:
|
@@ -4,19 +4,19 @@ http_interactions:
|
|
4
4
|
method: get
|
5
5
|
uri: https://develop.lifen.fr/central/api/chats
|
6
6
|
body:
|
7
|
-
encoding:
|
8
|
-
string:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- Faraday v0.
|
12
|
-
|
13
|
-
-
|
11
|
+
- Faraday v0.10.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer invalid_token
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
16
18
|
Accept-Encoding:
|
17
19
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
Accept:
|
19
|
-
- "*/*"
|
20
20
|
response:
|
21
21
|
status:
|
22
22
|
code: 401
|
@@ -27,30 +27,34 @@ http_interactions:
|
|
27
27
|
X-B3-Sampled:
|
28
28
|
- '1'
|
29
29
|
X-B3-Spanid:
|
30
|
-
-
|
30
|
+
- f2418d87dec85bf1
|
31
31
|
X-B3-Traceid:
|
32
|
-
-
|
32
|
+
- f2418d87dec85bf1
|
33
33
|
X-Content-Type-Options:
|
34
34
|
- nosniff
|
35
35
|
X-Xss-Protection:
|
36
36
|
- 1; mode=block
|
37
37
|
Cache-Control:
|
38
38
|
- no-cache, no-store, max-age=0, must-revalidate
|
39
|
+
- no-store
|
39
40
|
Pragma:
|
40
41
|
- no-cache
|
42
|
+
- no-cache
|
41
43
|
Expires:
|
42
44
|
- '0'
|
45
|
+
Www-Authenticate:
|
46
|
+
- 'Bearer realm="oauth", error="invalid_token", error_description="Invalid access
|
47
|
+
token: invalid_token"'
|
43
48
|
Content-Type:
|
44
49
|
- application/json;charset=UTF-8
|
45
50
|
Transfer-Encoding:
|
46
51
|
- chunked
|
47
52
|
Date:
|
48
|
-
-
|
49
|
-
Connection:
|
50
|
-
- close
|
53
|
+
- Fri, 09 Dec 2016 14:00:45 GMT
|
51
54
|
body:
|
52
55
|
encoding: UTF-8
|
53
|
-
string: '{"
|
56
|
+
string: '{"error":"invalid_token","error_description":"Invalid access token:
|
57
|
+
invalid_token"}'
|
54
58
|
http_version:
|
55
|
-
recorded_at:
|
59
|
+
recorded_at: Fri, 09 Dec 2016 13:58:54 GMT
|
56
60
|
recorded_with: VCR 3.0.3
|
@@ -4,19 +4,19 @@ http_interactions:
|
|
4
4
|
method: get
|
5
5
|
uri: https://develop.lifen.fr/central/api/chats
|
6
6
|
body:
|
7
|
-
encoding:
|
8
|
-
string:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- Faraday v0.
|
12
|
-
|
13
|
-
- valid_token
|
11
|
+
- Faraday v0.10.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_token
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
16
18
|
Accept-Encoding:
|
17
19
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
Accept:
|
19
|
-
- "*/*"
|
20
20
|
response:
|
21
21
|
status:
|
22
22
|
code: 200
|
@@ -27,9 +27,9 @@ http_interactions:
|
|
27
27
|
X-B3-Sampled:
|
28
28
|
- '1'
|
29
29
|
X-B3-Spanid:
|
30
|
-
-
|
30
|
+
- f8575522955e00fa
|
31
31
|
X-B3-Traceid:
|
32
|
-
-
|
32
|
+
- f8575522955e00fa
|
33
33
|
X-Content-Type-Options:
|
34
34
|
- nosniff
|
35
35
|
X-Xss-Protection:
|
@@ -41,18 +41,15 @@ http_interactions:
|
|
41
41
|
Expires:
|
42
42
|
- '0'
|
43
43
|
Content-Type:
|
44
|
-
- application/
|
44
|
+
- application/json;charset=UTF-8
|
45
45
|
Transfer-Encoding:
|
46
46
|
- chunked
|
47
47
|
Date:
|
48
|
-
-
|
49
|
-
Connection:
|
50
|
-
- close
|
48
|
+
- Fri, 09 Dec 2016 14:06:09 GMT
|
51
49
|
body:
|
52
50
|
encoding: UTF-8
|
53
|
-
string: '{"_embedded":{"flows":[{"uuid":"
|
54
|
-
|
55
|
-
d''avis dermato","type":"regular"}]},"_links":{"self":{"href":"https://develop.lifen.fr/central/api/chats"}},"page":{"size":20,"totalElements":3,"totalPages":1,"number":0}}'
|
51
|
+
string: '{"_embedded":{"flows":[{"uuid":"11e6be18-7a35-d759-9177-0242ac110002","version":0,"title":"Rspec
|
52
|
+
Flow","type":"regular"}]},"_links":{"self":{"href":"https://develop.lifen.fr/central/api/chats"}},"page":{"size":20,"totalElements":1,"totalPages":1,"number":0}}'
|
56
53
|
http_version:
|
57
|
-
recorded_at:
|
54
|
+
recorded_at: Fri, 09 Dec 2016 14:04:18 GMT
|
58
55
|
recorded_with: VCR 3.0.3
|
@@ -2,21 +2,21 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: post
|
5
|
-
uri: https://develop.lifen.fr/central/api/chats/
|
5
|
+
uri: https://develop.lifen.fr/central/api/chats/11e6be18-7a35-d759-9177-0242ac110002/messages
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"content":"Bonjour Lifen"}'
|
8
|
+
string: '{"content":"Bonjour Lifen","type":"regular"}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.10.0
|
12
|
-
|
13
|
-
-
|
12
|
+
Authorization:
|
13
|
+
- Bearer valide_token
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
16
18
|
Accept-Encoding:
|
17
19
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
Accept:
|
19
|
-
- "*/*"
|
20
20
|
response:
|
21
21
|
status:
|
22
22
|
code: 200
|
@@ -27,9 +27,9 @@ http_interactions:
|
|
27
27
|
X-B3-Sampled:
|
28
28
|
- '1'
|
29
29
|
X-B3-Spanid:
|
30
|
-
-
|
30
|
+
- a92fe22c2aff6b2
|
31
31
|
X-B3-Traceid:
|
32
|
-
-
|
32
|
+
- a92fe22c2aff6b2
|
33
33
|
X-Content-Type-Options:
|
34
34
|
- nosniff
|
35
35
|
X-Xss-Protection:
|
@@ -41,17 +41,15 @@ http_interactions:
|
|
41
41
|
Expires:
|
42
42
|
- '0'
|
43
43
|
Content-Type:
|
44
|
-
- application/
|
44
|
+
- application/json;charset=UTF-8
|
45
45
|
Transfer-Encoding:
|
46
46
|
- chunked
|
47
47
|
Date:
|
48
|
-
- Fri,
|
49
|
-
Connection:
|
50
|
-
- close
|
48
|
+
- Fri, 09 Dec 2016 15:01:17 GMT
|
51
49
|
body:
|
52
50
|
encoding: UTF-8
|
53
|
-
string: '{"uuid":"
|
54
|
-
Lifen","sentDate":"2016-12-
|
51
|
+
string: '{"uuid":"11e6be20-5647-8f9b-9177-0242ac110002","version":0,"content":"Bonjour
|
52
|
+
Lifen","sentDate":"2016-12-09T15:01:17.727Z","read":true,"type":"regular","modificationDate":"2016-12-09T15:01:17.714Z","updateable":true}'
|
55
53
|
http_version:
|
56
|
-
recorded_at: Fri,
|
54
|
+
recorded_at: Fri, 09 Dec 2016 14:59:27 GMT
|
57
55
|
recorded_with: VCR 3.0.3
|
@@ -5,18 +5,18 @@ http_interactions:
|
|
5
5
|
uri: https://develop.lifen.fr/authentication/api/register/third_party
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"emailAddress":"existing-user@domain.tld","lastName":
|
8
|
+
string: '{"emailAddress":"existing-user@domain.tld","lastName":"User","firstName":"Existing"}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- Faraday v0.
|
12
|
-
|
13
|
-
-
|
11
|
+
- Faraday v0.10.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_application_access_token
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
16
18
|
Accept-Encoding:
|
17
19
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
Accept:
|
19
|
-
- "*/*"
|
20
20
|
response:
|
21
21
|
status:
|
22
22
|
code: 403
|
@@ -27,9 +27,9 @@ http_interactions:
|
|
27
27
|
X-B3-Sampled:
|
28
28
|
- '1'
|
29
29
|
X-B3-Spanid:
|
30
|
-
-
|
30
|
+
- db693c7f15e89e58
|
31
31
|
X-B3-Traceid:
|
32
|
-
-
|
32
|
+
- db693c7f15e89e58
|
33
33
|
X-Content-Type-Options:
|
34
34
|
- nosniff
|
35
35
|
X-Xss-Protection:
|
@@ -45,10 +45,10 @@ http_interactions:
|
|
45
45
|
Transfer-Encoding:
|
46
46
|
- chunked
|
47
47
|
Date:
|
48
|
-
-
|
48
|
+
- Fri, 09 Dec 2016 13:39:42 GMT
|
49
49
|
body:
|
50
50
|
encoding: UTF-8
|
51
|
-
string: '{"timestamp":"2016-
|
51
|
+
string: '{"timestamp":"2016-12-09T13:39:42.918+0000","status":403,"error":"Forbidden","code":"email.exists.exception","X-B3-TraceId":"db693c7f15e89e58","X-B3-SpanId":"db693c7f15e89e58"}'
|
52
52
|
http_version:
|
53
|
-
recorded_at:
|
53
|
+
recorded_at: Fri, 09 Dec 2016 13:37:51 GMT
|
54
54
|
recorded_with: VCR 3.0.3
|
@@ -8,15 +8,15 @@ http_interactions:
|
|
8
8
|
string: '{"emailAddress":"invalid-key-email@test.tld","lastName":null,"firstName":null}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- Faraday v0.
|
12
|
-
|
13
|
-
- invalid-secret-key
|
11
|
+
- Faraday v0.10.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer invalid-secret-key
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
16
18
|
Accept-Encoding:
|
17
19
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
Accept:
|
19
|
-
- "*/*"
|
20
20
|
response:
|
21
21
|
status:
|
22
22
|
code: 401
|
@@ -27,28 +27,34 @@ http_interactions:
|
|
27
27
|
X-B3-Sampled:
|
28
28
|
- '1'
|
29
29
|
X-B3-Spanid:
|
30
|
-
-
|
30
|
+
- d0655043bd3b7d47
|
31
31
|
X-B3-Traceid:
|
32
|
-
-
|
32
|
+
- d0655043bd3b7d47
|
33
33
|
X-Content-Type-Options:
|
34
34
|
- nosniff
|
35
35
|
X-Xss-Protection:
|
36
36
|
- 1; mode=block
|
37
37
|
Cache-Control:
|
38
38
|
- no-cache, no-store, max-age=0, must-revalidate
|
39
|
+
- no-store
|
39
40
|
Pragma:
|
40
41
|
- no-cache
|
42
|
+
- no-cache
|
41
43
|
Expires:
|
42
44
|
- '0'
|
45
|
+
Www-Authenticate:
|
46
|
+
- 'Bearer realm="oauth", error="invalid_token", error_description="Invalid access
|
47
|
+
token: invalid-secret-key"'
|
43
48
|
Content-Type:
|
44
49
|
- application/json;charset=UTF-8
|
45
50
|
Transfer-Encoding:
|
46
51
|
- chunked
|
47
52
|
Date:
|
48
|
-
-
|
53
|
+
- Fri, 09 Dec 2016 09:48:23 GMT
|
49
54
|
body:
|
50
55
|
encoding: UTF-8
|
51
|
-
string: '{"
|
56
|
+
string: '{"error":"invalid_token","error_description":"Invalid access token:
|
57
|
+
invalid-secret-key"}'
|
52
58
|
http_version:
|
53
|
-
recorded_at:
|
59
|
+
recorded_at: Fri, 09 Dec 2016 09:46:32 GMT
|
54
60
|
recorded_with: VCR 3.0.3
|
@@ -5,51 +5,56 @@ http_interactions:
|
|
5
5
|
uri: https://develop.lifen.fr/authentication/api/register/third_party
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"emailAddress":null,"lastName":null,"firstName":
|
8
|
+
string: '{"emailAddress":null,"lastName":null,"firstName":"Marc"}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- Faraday v0.
|
12
|
-
|
13
|
-
-
|
11
|
+
- Faraday v0.10.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_application_access_token
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
16
18
|
Accept-Encoding:
|
17
19
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
Accept:
|
19
|
-
- "*/*"
|
20
20
|
response:
|
21
21
|
status:
|
22
|
-
code:
|
23
|
-
message:
|
22
|
+
code: 401
|
23
|
+
message: Unauthorized
|
24
24
|
headers:
|
25
25
|
Server:
|
26
26
|
- Apache-Coyote/1.1
|
27
27
|
X-B3-Sampled:
|
28
28
|
- '1'
|
29
29
|
X-B3-Spanid:
|
30
|
-
-
|
30
|
+
- 5f594a52a125cb57
|
31
31
|
X-B3-Traceid:
|
32
|
-
-
|
32
|
+
- 5f594a52a125cb57
|
33
33
|
X-Content-Type-Options:
|
34
34
|
- nosniff
|
35
35
|
X-Xss-Protection:
|
36
36
|
- 1; mode=block
|
37
37
|
Cache-Control:
|
38
38
|
- no-cache, no-store, max-age=0, must-revalidate
|
39
|
+
- no-store
|
39
40
|
Pragma:
|
40
41
|
- no-cache
|
42
|
+
- no-cache
|
41
43
|
Expires:
|
42
44
|
- '0'
|
45
|
+
Www-Authenticate:
|
46
|
+
- 'Bearer realm="oauth", error="invalid_token", error_description="Invalid access
|
47
|
+
token: valid_application_access_token"'
|
43
48
|
Content-Type:
|
44
49
|
- application/json;charset=UTF-8
|
45
50
|
Transfer-Encoding:
|
46
51
|
- chunked
|
47
52
|
Date:
|
48
|
-
-
|
53
|
+
- Fri, 09 Dec 2016 09:48:27 GMT
|
49
54
|
body:
|
50
55
|
encoding: UTF-8
|
51
|
-
string: '{"
|
52
|
-
|
56
|
+
string: '{"error":"invalid_token","error_description":"Invalid access token:
|
57
|
+
valid_application_access_token"}'
|
53
58
|
http_version:
|
54
|
-
recorded_at:
|
59
|
+
recorded_at: Fri, 09 Dec 2016 09:46:36 GMT
|
55
60
|
recorded_with: VCR 3.0.3
|
@@ -5,18 +5,18 @@ http_interactions:
|
|
5
5
|
uri: https://develop.lifen.fr/authentication/api/register/third_party
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"emailAddress":"valid-email-spec@domain.tld","lastName":
|
8
|
+
string: '{"emailAddress":"valid-email-spec@domain.tld","lastName":"User","firstName":"Valid"}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- Faraday v0.
|
12
|
-
|
13
|
-
-
|
11
|
+
- Faraday v0.10.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer valid_application_access_token
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
Accept:
|
17
|
+
- application/json
|
16
18
|
Accept-Encoding:
|
17
19
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
Accept:
|
19
|
-
- "*/*"
|
20
20
|
response:
|
21
21
|
status:
|
22
22
|
code: 201
|
@@ -27,9 +27,9 @@ http_interactions:
|
|
27
27
|
X-B3-Sampled:
|
28
28
|
- '1'
|
29
29
|
X-B3-Spanid:
|
30
|
-
-
|
30
|
+
- cfda70747616828e
|
31
31
|
X-B3-Traceid:
|
32
|
-
-
|
32
|
+
- cfda70747616828e
|
33
33
|
X-Content-Type-Options:
|
34
34
|
- nosniff
|
35
35
|
X-Xss-Protection:
|
@@ -41,14 +41,14 @@ http_interactions:
|
|
41
41
|
Expires:
|
42
42
|
- '0'
|
43
43
|
Content-Type:
|
44
|
-
- application/
|
44
|
+
- application/json;charset=UTF-8
|
45
45
|
Transfer-Encoding:
|
46
46
|
- chunked
|
47
47
|
Date:
|
48
|
-
-
|
48
|
+
- Fri, 09 Dec 2016 16:47:48 GMT
|
49
49
|
body:
|
50
50
|
encoding: UTF-8
|
51
|
-
string: '{"
|
51
|
+
string: '{"accountUuid":"11e6be2f-3766-246f-9a9f-0242ac110002"}'
|
52
52
|
http_version:
|
53
|
-
recorded_at:
|
53
|
+
recorded_at: Fri, 09 Dec 2016 16:45:57 GMT
|
54
54
|
recorded_with: VCR 3.0.3
|