lifen 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +70 -0
  7. data/License.txt +22 -0
  8. data/README.md +76 -0
  9. data/Rakefile +7 -0
  10. data/lib/lifen.rb +19 -0
  11. data/lib/lifen/app_authenticated_client.rb +32 -0
  12. data/lib/lifen/authentication.rb +29 -0
  13. data/lib/lifen/base.rb +7 -0
  14. data/lib/lifen/client.rb +18 -0
  15. data/lib/lifen/configuration.rb +13 -0
  16. data/lib/lifen/error.rb +26 -0
  17. data/lib/lifen/flow.rb +67 -0
  18. data/lib/lifen/flows.rb +31 -0
  19. data/lib/lifen/user.rb +39 -0
  20. data/lib/lifen/user_authenticated_client.rb +38 -0
  21. data/lib/lifen/version.rb +3 -0
  22. data/lifen.gemspec +29 -0
  23. data/spec/cassettes/flows/attach_users/invalid_flow_uuid.yml +57 -0
  24. data/spec/cassettes/flows/attach_users/invalid_user_uuid.yml +57 -0
  25. data/spec/cassettes/flows/attach_users/valid.yml +57 -0
  26. data/spec/cassettes/flows/create.yml +57 -0
  27. data/spec/cassettes/flows/detach_users/valid.yml +57 -0
  28. data/spec/cassettes/flows/detach_users/valid_again.yml +57 -0
  29. data/spec/cassettes/flows/invalid_token.yml +56 -0
  30. data/spec/cassettes/flows/valid_token.yml +58 -0
  31. data/spec/cassettes/users/create/existing_user.yml +54 -0
  32. data/spec/cassettes/users/create/invalid_token.yml +54 -0
  33. data/spec/cassettes/users/create/missing_fields.yml +55 -0
  34. data/spec/cassettes/users/create/valid_attributes.yml +54 -0
  35. data/spec/cassettes/users/refresh/invalid_user_uuid.yml +55 -0
  36. data/spec/cassettes/users/refresh/valid_user_uuid.yml +54 -0
  37. data/spec/flows_spec.rb +126 -0
  38. data/spec/spec_helper.rb +24 -0
  39. data/spec/users_spec.rb +101 -0
  40. metadata +211 -0
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://develop.lifen.fr/central/api/chats
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ X-Auth-Token:
13
+ - invalid-token
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 401
23
+ message: Unauthorized
24
+ headers:
25
+ Server:
26
+ - Apache-Coyote/1.1
27
+ X-B3-Sampled:
28
+ - '1'
29
+ X-B3-Spanid:
30
+ - c160889f96d914d9
31
+ X-B3-Traceid:
32
+ - c160889f96d914d9
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
+ - Wed, 10 Aug 2016 07:14:48 GMT
49
+ Connection:
50
+ - close
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"timestamp":"2016-08-10T07:14:48.142+0000","status":401,"error":"Unauthorized","code":"error.401","X-B3-TraceId":"c160889f96d914d9","X-B3-SpanId":"c160889f96d914d9"}'
54
+ http_version:
55
+ recorded_at: Wed, 10 Aug 2016 07:14:48 GMT
56
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://develop.lifen.fr/central/api/chats
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ X-Auth-Token:
13
+ - valid_token
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
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
+ - 8c37acfa6432b0c7
31
+ X-B3-Traceid:
32
+ - 8c37acfa6432b0c7
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/hal+json;charset=UTF-8
45
+ Transfer-Encoding:
46
+ - chunked
47
+ Date:
48
+ - Wed, 10 Aug 2016 07:15:12 GMT
49
+ Connection:
50
+ - close
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"_embedded":{"flows":[{"uuid":"11e5c68b-85e9-96e8-9d33-027026ae8c87","version":0,"type":"regular"},{"uuid":"11e5c68c-464b-c5d5-9d33-027026ae8c87","version":0,"title":"Résultats
54
+ de bio disponibles","type":"regular"},{"uuid":"11e5c68c-7dc2-fde8-9d33-027026ae8c87","version":0,"title":"Demande
55
+ d''avis dermato","type":"regular"}]},"_links":{"self":{"href":"http://develop.lifen.fr/central/api/chats"}},"page":{"size":20,"totalElements":3,"totalPages":1,"number":0}}'
56
+ http_version:
57
+ recorded_at: Wed, 10 Aug 2016 07:15:12 GMT
58
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://develop.lifen.fr/authentication/api/register/third_party
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"emailAddress":"existing-user@domain.tld","lastName":null,"firstName":null}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ Secret-Key:
13
+ - valid_secret_key
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 403
23
+ message: Forbidden
24
+ headers:
25
+ Server:
26
+ - Apache-Coyote/1.1
27
+ X-B3-Sampled:
28
+ - '1'
29
+ X-B3-Spanid:
30
+ - ac141a836a7e5444
31
+ X-B3-Traceid:
32
+ - ac141a836a7e5444
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
+ - Wed, 07 Sep 2016 12:40:25 GMT
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"timestamp":"2016-09-07T12:40:25.369+0000","status":403,"error":"Forbidden","code":"email.exists.exception","X-B3-TraceId":"ac141a836a7e5444","X-B3-SpanId":"ac141a836a7e5444"}'
52
+ http_version:
53
+ recorded_at: Wed, 07 Sep 2016 12:40:20 GMT
54
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://develop.lifen.fr/authentication/api/register/third_party
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"emailAddress":"invalid-key-email@test.tld","lastName":null,"firstName":null}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ Secret-Key:
13
+ - invalid-secret-key
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 401
23
+ message: Unauthorized
24
+ headers:
25
+ Server:
26
+ - Apache-Coyote/1.1
27
+ X-B3-Sampled:
28
+ - '1'
29
+ X-B3-Spanid:
30
+ - c27725b2f8083d04
31
+ X-B3-Traceid:
32
+ - c27725b2f8083d04
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
+ - Wed, 07 Sep 2016 12:35:11 GMT
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"timestamp":"2016-09-07T12:35:11.807+0000","status":401,"error":"Unauthorized","code":"authentication.failed","X-B3-TraceId":"c27725b2f8083d04","X-B3-SpanId":"c27725b2f8083d04"}'
52
+ http_version:
53
+ recorded_at: Wed, 07 Sep 2016 12:35:07 GMT
54
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://develop.lifen.fr/authentication/api/register/third_party
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"emailAddress":null,"lastName":null,"firstName":null}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ Secret-Key:
13
+ - valid_secret_key
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
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
+ - ecbe4a68ac59ff06
31
+ X-B3-Traceid:
32
+ - ecbe4a68ac59ff06
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
+ - Wed, 07 Sep 2016 12:35:11 GMT
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"timestamp":"2016-09-07T12:35:11.438+0000","status":400,"error":"Bad
52
+ Request","code":"error.badrequest","X-B3-TraceId":"ecbe4a68ac59ff06","X-B3-SpanId":"ecbe4a68ac59ff06"}'
53
+ http_version:
54
+ recorded_at: Wed, 07 Sep 2016 12:35:07 GMT
55
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://develop.lifen.fr/authentication/api/register/third_party
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"emailAddress":"valid-email-spec@domain.tld","lastName":null,"firstName":null}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ Secret-Key:
13
+ - valid_secret_key
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Server:
26
+ - Apache-Coyote/1.1
27
+ X-B3-Sampled:
28
+ - '1'
29
+ X-B3-Spanid:
30
+ - 2041de101045e2fa
31
+ X-B3-Traceid:
32
+ - 2041de101045e2fa
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/hal+json;charset=UTF-8
45
+ Transfer-Encoding:
46
+ - chunked
47
+ Date:
48
+ - Wed, 07 Sep 2016 12:35:12 GMT
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"token":"O6LaDhXwEt2XrvIJhb2inJx6DQd4zQ6x82okJw2hMGd1HRmlY6qI7ab3yPS6lA/KtkULoMpCninK3gwpCdKpuodR94s6e9naRV1f1g92z7ejemfJdtAN3fWVdd+Obqq0E9cJ3fc3SE3RmoXmhkXJ+ghzj9+i6FQHCb+vscNUdXxJwddp7z0Raoh8abKwJH8glfabZCBbYPkGdp11FshXDx+ssG4caPRy","accountUuid":"valid_uuid"}'
52
+ http_version:
53
+ recorded_at: Wed, 07 Sep 2016 12:35:08 GMT
54
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://develop.lifen.fr/authentication/api/authenticate/third_party
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"accountUuid":"invalid-user-uuid"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ Secret-Key:
13
+ - valid_secret_key
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
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
+ - 7911bb796330c549
31
+ X-B3-Traceid:
32
+ - 7911bb796330c549
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
+ - Wed, 07 Sep 2016 12:46:43 GMT
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"timestamp":"2016-09-07T12:46:43.966+0000","status":400,"error":"Bad
52
+ Request","code":"error.badrequest","X-B3-TraceId":"7911bb796330c549","X-B3-SpanId":"7911bb796330c549"}'
53
+ http_version:
54
+ recorded_at: Wed, 07 Sep 2016 12:46:39 GMT
55
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://develop.lifen.fr/authentication/api/authenticate/third_party
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"accountUuid":"valid_uuid"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ Secret-Key:
13
+ - valid_secret_key
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
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
+ - 510282ea864e9c04
31
+ X-B3-Traceid:
32
+ - 510282ea864e9c04
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/hal+json;charset=UTF-8
45
+ Transfer-Encoding:
46
+ - chunked
47
+ Date:
48
+ - Wed, 07 Sep 2016 12:46:43 GMT
49
+ body:
50
+ encoding: UTF-8
51
+ string: '[{"uuid":"valid_uuid","version":0,"token":"2VHHqKwuYeTsi+N35FAyjhKK3LCVsXbZXqwYpJtCvgRXAYW5/JJxCtHD0O7or9ej/YGYg31tHQhbUiTH+4sCSUzPLkaqw0DSAzgAD1+mSOH9k6C4TggCEieUJqpzXR2ipJ2nt36eOgda8GuqXhvQKpkh5Y8lDbJZEN0G6rj+tTIHim+577ypcoJbSTgTGDnx9DtwkwK3iPZhZOPgh3VIUXcsCjV0LV3u","role":"THIRD_PARTY","profilePicUrl":"","firstName":"N/A","lastName":"N/A","locale":"fr","registered":true,"activated":true,"informed":false,"email":"valid-email-spec@domain.tld","default":true}]'
52
+ http_version:
53
+ recorded_at: Wed, 07 Sep 2016 12:46:40 GMT
54
+ recorded_with: VCR 3.0.3