fileturn 0.0.3 → 0.1.0

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.
Files changed (53) hide show
  1. checksums.yaml +6 -14
  2. data/.gitignore +1 -0
  3. data/README.md +49 -44
  4. data/fileturn.gemspec +1 -0
  5. data/lib/fileturn/errors.rb +14 -0
  6. data/lib/fileturn/http_client.rb +10 -8
  7. data/lib/fileturn/resources/account.rb +11 -35
  8. data/lib/fileturn/resources/conversion.rb +80 -0
  9. data/lib/fileturn/resources/resource.rb +0 -5
  10. data/lib/fileturn/version.rb +1 -1
  11. data/lib/fileturn.rb +6 -7
  12. data/spec/fileturn_spec.rb +5 -5
  13. data/spec/fixtures/vcr_cassettes/account_info.yml +24 -63
  14. data/spec/fixtures/vcr_cassettes/conversion_all_not_authorized.yml +48 -0
  15. data/spec/fixtures/vcr_cassettes/conversion_not_authorized.yml +48 -0
  16. data/spec/fixtures/vcr_cassettes/conversion_not_found.yml +48 -0
  17. data/spec/fixtures/vcr_cassettes/conversion_process_created.yml +52 -0
  18. data/spec/fixtures/vcr_cassettes/conversion_process_no_params.yml +97 -0
  19. data/spec/fixtures/vcr_cassettes/conversion_process_success.yml +50 -0
  20. data/spec/fixtures/vcr_cassettes/conversion_success.yml +50 -0
  21. data/spec/fixtures/vcr_cassettes/conversions_all.yml +50 -0
  22. data/spec/fixtures/vcr_cassettes/conversions_all_second.yml +97 -0
  23. data/spec/fixtures/vcr_cassettes/reload_.yml +52 -0
  24. data/spec/fixtures/vcr_cassettes/reload_done.yml +50 -0
  25. data/spec/resources/account_spec.rb +8 -23
  26. data/spec/resources/conversion_spec.rb +213 -0
  27. data/spec/resources/upload_spec.rb +35 -35
  28. data/spec/spec_helper.rb +1 -1
  29. data/spec/stub_http_client.rb +1 -1
  30. metadata +58 -61
  31. data/lib/fileturn/exceptions.rb +0 -30
  32. data/lib/fileturn/resources/file.rb +0 -112
  33. data/lib/fileturn/resources/notification.rb +0 -16
  34. data/spec/fixtures/vcr_cassettes/file_all.yml +0 -103
  35. data/spec/fixtures/vcr_cassettes/file_all_notifications.yml +0 -103
  36. data/spec/fixtures/vcr_cassettes/file_convert_no_params.yml +0 -87
  37. data/spec/fixtures/vcr_cassettes/file_convert_success.yml +0 -89
  38. data/spec/fixtures/vcr_cassettes/file_doesnt_upload_since_too_big.yml +0 -46
  39. data/spec/fixtures/vcr_cassettes/file_failed_.yml +0 -176
  40. data/spec/fixtures/vcr_cassettes/file_notifications.yml +0 -89
  41. data/spec/fixtures/vcr_cassettes/file_queued_.yml +0 -176
  42. data/spec/fixtures/vcr_cassettes/file_reload.yml +0 -132
  43. data/spec/fixtures/vcr_cassettes/file_success.yml +0 -89
  44. data/spec/fixtures/vcr_cassettes/file_success_.yml +0 -176
  45. data/spec/fixtures/vcr_cassettes/file_time_taken.yml +0 -176
  46. data/spec/fixtures/vcr_cassettes/file_unauthorized.yml +0 -87
  47. data/spec/fixtures/vcr_cassettes/file_upload_doc_queued.yml +0 -782
  48. data/spec/fixtures/vcr_cassettes/file_upload_not_enough_credits.yml +0 -130
  49. data/spec/fixtures/vcr_cassettes/file_upload_queued.yml +0 -203
  50. data/spec/fixtures/vcr_cassettes/upload_all.yml +0 -89
  51. data/spec/fixtures/vcr_cassettes/upload_one.yml +0 -89
  52. data/spec/fixtures/vcr_cassettes/upload_refetch.yml +0 -132
  53. data/spec/resources/file_spec.rb +0 -184
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:5000/api/conversions/123.json?api_token=51d5fc191b2b95f9278becf6b51fa347
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 404
19
+ message: Not Found
20
+ headers:
21
+ X-Frame-Options:
22
+ - SAMEORIGIN
23
+ X-Xss-Protection:
24
+ - 1; mode=block
25
+ X-Content-Type-Options:
26
+ - nosniff
27
+ X-Download-Options:
28
+ - noopen
29
+ X-Permitted-Cross-Domain-Policies:
30
+ - none
31
+ Referrer-Policy:
32
+ - strict-origin-when-cross-origin
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Cache-Control:
36
+ - no-cache
37
+ X-Request-Id:
38
+ - 54b9570d-acd6-45e9-9e8b-7832fe2a76e6
39
+ X-Runtime:
40
+ - '0.014135'
41
+ Transfer-Encoding:
42
+ - chunked
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"errors":["not found"]}'
46
+ http_version:
47
+ recorded_at: Tue, 10 Jul 2018 01:21:40 GMT
48
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:5000/api/conversions.json?api_token=51d5fc191b2b95f9278becf6b51fa347&type=WordToPdf&url=http://iiswc.org/iiswc2013/sample.doc
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Content-Length:
13
+ - '0'
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ X-Frame-Options:
24
+ - SAMEORIGIN
25
+ X-Xss-Protection:
26
+ - 1; mode=block
27
+ X-Content-Type-Options:
28
+ - nosniff
29
+ X-Download-Options:
30
+ - noopen
31
+ X-Permitted-Cross-Domain-Policies:
32
+ - none
33
+ Referrer-Policy:
34
+ - strict-origin-when-cross-origin
35
+ Content-Type:
36
+ - application/json; charset=utf-8
37
+ Etag:
38
+ - W/"51b9aebfdb480412963ff39d91b89074"
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - b8b1b69f-da08-4123-b1f0-5f68c361f881
43
+ X-Runtime:
44
+ - '0.040131'
45
+ Transfer-Encoding:
46
+ - chunked
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"id":"2d9940c1-4651-44ed-869c-9e4d2ab1e3cf","type":"WordToPdf","status":"created","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"temporary_download_urls":[],"processing_time_in_seconds":null,"error_type":null,"error_details":null,"notification_responses":[]}'
50
+ http_version:
51
+ recorded_at: Tue, 10 Jul 2018 01:44:53 GMT
52
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,97 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:5000/api/conversions.json?api_token=51d5fc191b2b95f9278becf6b51fa347
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Content-Length:
13
+ - '0'
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 400
21
+ message: Bad Request
22
+ headers:
23
+ X-Frame-Options:
24
+ - SAMEORIGIN
25
+ X-Xss-Protection:
26
+ - 1; mode=block
27
+ X-Content-Type-Options:
28
+ - nosniff
29
+ X-Download-Options:
30
+ - noopen
31
+ X-Permitted-Cross-Domain-Policies:
32
+ - none
33
+ Referrer-Policy:
34
+ - strict-origin-when-cross-origin
35
+ Content-Type:
36
+ - application/json; charset=utf-8
37
+ Cache-Control:
38
+ - no-cache
39
+ X-Request-Id:
40
+ - bd79ffbf-8f2a-42d1-bd9f-0f2b402f1daa
41
+ X-Runtime:
42
+ - '0.033137'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"errors":["Type can''t be blank","Source files can''t be blank"]}'
48
+ http_version:
49
+ recorded_at: Tue, 10 Jul 2018 01:42:46 GMT
50
+ - request:
51
+ method: post
52
+ uri: http://localhost:5000/api/conversions.json?api_token=51d5fc191b2b95f9278becf6b51fa347
53
+ body:
54
+ encoding: UTF-8
55
+ string: ''
56
+ headers:
57
+ User-Agent:
58
+ - Faraday v0.15.2
59
+ Content-Length:
60
+ - '0'
61
+ Accept-Encoding:
62
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
63
+ Accept:
64
+ - "*/*"
65
+ response:
66
+ status:
67
+ code: 400
68
+ message: Bad Request
69
+ headers:
70
+ X-Frame-Options:
71
+ - SAMEORIGIN
72
+ X-Xss-Protection:
73
+ - 1; mode=block
74
+ X-Content-Type-Options:
75
+ - nosniff
76
+ X-Download-Options:
77
+ - noopen
78
+ X-Permitted-Cross-Domain-Policies:
79
+ - none
80
+ Referrer-Policy:
81
+ - strict-origin-when-cross-origin
82
+ Content-Type:
83
+ - application/json; charset=utf-8
84
+ Cache-Control:
85
+ - no-cache
86
+ X-Request-Id:
87
+ - c30e96e0-85d8-4258-a40f-b49ddbc57324
88
+ X-Runtime:
89
+ - '0.013995'
90
+ Transfer-Encoding:
91
+ - chunked
92
+ body:
93
+ encoding: UTF-8
94
+ string: '{"errors":["Type can''t be blank","Source files can''t be blank"]}'
95
+ http_version:
96
+ recorded_at: Tue, 10 Jul 2018 01:42:46 GMT
97
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:5000/api/conversions/2d9940c1-4651-44ed-869c-9e4d2ab1e3cf.json?api_token=51d5fc191b2b95f9278becf6b51fa347
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ X-Frame-Options:
22
+ - SAMEORIGIN
23
+ X-Xss-Protection:
24
+ - 1; mode=block
25
+ X-Content-Type-Options:
26
+ - nosniff
27
+ X-Download-Options:
28
+ - noopen
29
+ X-Permitted-Cross-Domain-Policies:
30
+ - none
31
+ Referrer-Policy:
32
+ - strict-origin-when-cross-origin
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - W/"7ba2d7f4bb5663b5c5cf8e47d5d06365"
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 2fa326ca-81b8-4fc5-833a-8d947dea2be9
41
+ X-Runtime:
42
+ - '0.141618'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":"2d9940c1-4651-44ed-869c-9e4d2ab1e3cf","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"temporary_download_urls":["http://fileturn-dev.s3.amazonaws.com/c7b8ae4c-ed85-4b0c-9400-77d396e3cb89/sample.pdf?AWSAccessKeyId=AKIAIG4W7R33BAWKUJMQ\u0026Expires=1531190805\u0026Signature=fzy4b3nOw1ujKOQEB9%2BWZxAGcFw%3D"],"processing_time_in_seconds":10,"error_type":null,"error_details":null,"notification_responses":[{"id":"969f7e91-b2d4-4302-9e54-d93b7b69271c","status":"success","type":"webhook","status_code":200,"url":"https://webhook.site/dd5181b8-571f-46ba-914e-21dcedbe9c3b"}]}'
48
+ http_version:
49
+ recorded_at: Tue, 10 Jul 2018 01:46:45 GMT
50
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:5000/api/conversions/b120b954-82b2-41c6-bef2-c83b3462463b.json?api_token=51d5fc191b2b95f9278becf6b51fa347
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ X-Frame-Options:
22
+ - SAMEORIGIN
23
+ X-Xss-Protection:
24
+ - 1; mode=block
25
+ X-Content-Type-Options:
26
+ - nosniff
27
+ X-Download-Options:
28
+ - noopen
29
+ X-Permitted-Cross-Domain-Policies:
30
+ - none
31
+ Referrer-Policy:
32
+ - strict-origin-when-cross-origin
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - W/"95378c9887e5d43c2fe0d1015cf42723"
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 1ca9c1af-9981-4ed9-8a4f-327287833b36
41
+ X-Runtime:
42
+ - '0.092875'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":"b120b954-82b2-41c6-bef2-c83b3462463b","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"temporary_download_urls":["http://fileturn-dev.s3.amazonaws.com/50ad3713-dd05-4dae-adc4-77577cfc49f1/sample.pdf?AWSAccessKeyId=AKIAIG4W7R33BAWKUJMQ\u0026Expires=1531189092\u0026Signature=YVIcYzXAVO2tzR30C%2BF%2F%2Bq6L2SY%3D"],"processing_time_in_seconds":9,"error_type":null,"error_details":null,"notification_responses":[{"id":"6a76af7e-a6e1-44ec-96ed-7936347066f6","status":"success","type":"webhook","status_code":200,"url":"https://webhook.site/dd5181b8-571f-46ba-914e-21dcedbe9c3b"}]}'
48
+ http_version:
49
+ recorded_at: Tue, 10 Jul 2018 01:18:12 GMT
50
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:5000/api/conversions.json?api_token=51d5fc191b2b95f9278becf6b51fa347&page=1&per=20
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ X-Frame-Options:
22
+ - SAMEORIGIN
23
+ X-Xss-Protection:
24
+ - 1; mode=block
25
+ X-Content-Type-Options:
26
+ - nosniff
27
+ X-Download-Options:
28
+ - noopen
29
+ X-Permitted-Cross-Domain-Policies:
30
+ - none
31
+ Referrer-Policy:
32
+ - strict-origin-when-cross-origin
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - W/"77e10965070a89cf2aa4a3804374d962"
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - ea2998b8-36c1-4e09-bc73-4bbcee84a234
41
+ X-Runtime:
42
+ - '0.012913'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"total_conversions":57,"current_page":1,"per_page":20,"total_pages":3,"conversions":[{"id":"2994f782-189f-4da2-adad-6fea90673a04","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"6d0597e4-aa7b-40f2-9234-b3c90a6ba3e3","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"c32430dd-f2f8-4e3a-b49e-a994dec09285","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"6baea88c-fed3-4ccf-9a55-37586a8c9a0f","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":10},{"id":"6bd77fa8-f251-4e93-8c1b-26b1b1c7bcc7","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"f4fbfab0-9086-443d-98b4-7d39794153ff","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"aa8e1b40-0587-40c1-8a1b-d0c08487865c","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"cd7f369b-40eb-433f-9b86-09493624969c","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"c3f838d5-f8e7-4f86-a7eb-7890b0213d0c","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"ff07a237-269b-4d4c-a6d2-bdd0e87fee83","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":8},{"id":"93850d08-be13-48bd-8cf4-3722b30d928b","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":8},{"id":"891dd7a8-5a9b-4a6b-81b3-2ce6a2704e09","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"a7f5c510-e075-4506-a439-7b4158bb3456","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":11},{"id":"c420c03b-1364-4cf1-83bc-f867baefdd7d","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"74568fc0-605d-4ab4-a189-c88dd06806a5","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":8},{"id":"1eaa23c4-cf3f-4e1f-ae04-55375b2bede2","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"6bf6297f-e996-412e-9f47-6915e9073c85","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":8},{"id":"392ad903-c1d0-45d9-8618-3bae7dcd714e","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":8},{"id":"44281b62-baf9-4b56-aa9b-1451a01be830","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":8},{"id":"6d90001a-0c3b-423f-be7c-3de1bd4e3e38","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9}]}'
48
+ http_version:
49
+ recorded_at: Tue, 10 Jul 2018 01:28:11 GMT
50
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,97 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:5000/api/conversions.json?api_token=51d5fc191b2b95f9278becf6b51fa347&page=2&per=5
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ X-Frame-Options:
22
+ - SAMEORIGIN
23
+ X-Xss-Protection:
24
+ - 1; mode=block
25
+ X-Content-Type-Options:
26
+ - nosniff
27
+ X-Download-Options:
28
+ - noopen
29
+ X-Permitted-Cross-Domain-Policies:
30
+ - none
31
+ Referrer-Policy:
32
+ - strict-origin-when-cross-origin
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - W/"36f316727b9e989eb8715c513825e708"
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 76acd0d5-9222-4e75-b87f-e2eb08c2cf2f
41
+ X-Runtime:
42
+ - '0.010065'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"total_conversions":57,"current_page":2,"per_page":5,"total_pages":12,"conversions":[{"id":"f4fbfab0-9086-443d-98b4-7d39794153ff","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"aa8e1b40-0587-40c1-8a1b-d0c08487865c","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"cd7f369b-40eb-433f-9b86-09493624969c","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"c3f838d5-f8e7-4f86-a7eb-7890b0213d0c","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":9},{"id":"ff07a237-269b-4d4c-a6d2-bdd0e87fee83","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"processing_time_in_seconds":8}]}'
48
+ http_version:
49
+ recorded_at: Tue, 10 Jul 2018 01:33:26 GMT
50
+ - request:
51
+ method: get
52
+ uri: http://localhost:5000/api/conversions/f4fbfab0-9086-443d-98b4-7d39794153ff.json?api_token=51d5fc191b2b95f9278becf6b51fa347
53
+ body:
54
+ encoding: US-ASCII
55
+ string: ''
56
+ headers:
57
+ User-Agent:
58
+ - Faraday v0.15.2
59
+ Accept-Encoding:
60
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
61
+ Accept:
62
+ - "*/*"
63
+ response:
64
+ status:
65
+ code: 200
66
+ message: OK
67
+ headers:
68
+ X-Frame-Options:
69
+ - SAMEORIGIN
70
+ X-Xss-Protection:
71
+ - 1; mode=block
72
+ X-Content-Type-Options:
73
+ - nosniff
74
+ X-Download-Options:
75
+ - noopen
76
+ X-Permitted-Cross-Domain-Policies:
77
+ - none
78
+ Referrer-Policy:
79
+ - strict-origin-when-cross-origin
80
+ Content-Type:
81
+ - application/json; charset=utf-8
82
+ Etag:
83
+ - W/"420a625465c48f84884cf90e96bcba02"
84
+ Cache-Control:
85
+ - max-age=0, private, must-revalidate
86
+ X-Request-Id:
87
+ - dccda91e-f758-4610-b214-16de51fdd3ef
88
+ X-Runtime:
89
+ - '0.127611'
90
+ Transfer-Encoding:
91
+ - chunked
92
+ body:
93
+ encoding: UTF-8
94
+ string: '{"id":"f4fbfab0-9086-443d-98b4-7d39794153ff","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"temporary_download_urls":["http://fileturn-dev.s3.amazonaws.com/ab861a88-b50a-454c-b0ec-9ab614df0f1c/sample.pdf?AWSAccessKeyId=AKIAIG4W7R33BAWKUJMQ\u0026Expires=1531192876\u0026Signature=6dggTd4MfCbHdhptWcVumPPmATY%3D"],"processing_time_in_seconds":9,"error_type":null,"error_details":null,"notification_responses":[]}'
95
+ http_version:
96
+ recorded_at: Tue, 10 Jul 2018 02:21:16 GMT
97
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:5000/api/conversions.json?api_token=51d5fc191b2b95f9278becf6b51fa347&type=WordToPdf&url=http://iiswc.org/iiswc2013/sample.doc
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Content-Length:
13
+ - '0'
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ X-Frame-Options:
24
+ - SAMEORIGIN
25
+ X-Xss-Protection:
26
+ - 1; mode=block
27
+ X-Content-Type-Options:
28
+ - nosniff
29
+ X-Download-Options:
30
+ - noopen
31
+ X-Permitted-Cross-Domain-Policies:
32
+ - none
33
+ Referrer-Policy:
34
+ - strict-origin-when-cross-origin
35
+ Content-Type:
36
+ - application/json; charset=utf-8
37
+ Etag:
38
+ - W/"c29a63092f9264662747504709c318d5"
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - 3406a9f8-650d-4ab1-a22a-7b9da97a1413
43
+ X-Runtime:
44
+ - '0.041165'
45
+ Transfer-Encoding:
46
+ - chunked
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"id":"baee70f6-31c0-492f-a757-0744a4bcddd7","type":"WordToPdf","status":"created","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"temporary_download_urls":[],"processing_time_in_seconds":null,"error_type":null,"error_details":null,"notification_responses":[]}'
50
+ http_version:
51
+ recorded_at: Tue, 10 Jul 2018 02:14:31 GMT
52
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:5000/api/conversions/baee70f6-31c0-492f-a757-0744a4bcddd7.json?api_token=51d5fc191b2b95f9278becf6b51fa347
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ X-Frame-Options:
22
+ - SAMEORIGIN
23
+ X-Xss-Protection:
24
+ - 1; mode=block
25
+ X-Content-Type-Options:
26
+ - nosniff
27
+ X-Download-Options:
28
+ - noopen
29
+ X-Permitted-Cross-Domain-Policies:
30
+ - none
31
+ Referrer-Policy:
32
+ - strict-origin-when-cross-origin
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - W/"10732d96399825ca5f4271c8c9eb1c08"
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - db6dc18f-8b39-4592-a6e3-8cb862b11ba0
41
+ X-Runtime:
42
+ - '0.070631'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":"baee70f6-31c0-492f-a757-0744a4bcddd7","type":"WordToPdf","status":"completed","source_files":["http://iiswc.org/iiswc2013/sample.doc"],"temporary_download_urls":["http://fileturn-dev.s3.amazonaws.com/715c0532-f47f-4c12-a180-d0d1a59f7817/sample.pdf?AWSAccessKeyId=AKIAIG4W7R33BAWKUJMQ\u0026Expires=1531192504\u0026Signature=RI8Agfg9MKCqqPx5RVmBx9ZTnKA%3D"],"processing_time_in_seconds":10,"error_type":null,"error_details":null,"notification_responses":[{"id":"df0bf14e-4341-4cc4-8352-fca85846fadb","status":"success","type":"webhook","status_code":200,"url":"https://webhook.site/dd5181b8-571f-46ba-914e-21dcedbe9c3b"}]}'
48
+ http_version:
49
+ recorded_at: Tue, 10 Jul 2018 02:15:04 GMT
50
+ recorded_with: VCR 4.0.0
@@ -3,29 +3,14 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
3
  describe FileTurn::Account do
4
4
  it 'retrieves account information' do
5
5
  VCR.use_cassette('account_info') do
6
- FileTurn::Account.load
7
- FileTurn::Account.credits.should_not be_nil
8
- FileTurn::Account.time_zone.should_not be_nil
9
- FileTurn::Account.notification_url.should_not be_nil
10
- FileTurn::Account.max_file_size_in_bytes.should == 1048576
11
- FileTurn::Account.created_at.class.should == DateTime
12
- end
13
- end
14
-
15
- it 'makes the call only once' do
16
- VCR.use_cassette('account_info_once') do
17
- FileTurn::Account.conn.should_receive(:get).once
18
- FileTurn::Account.load
19
- FileTurn::Account.credits
20
- end
21
- end
6
+ account = FileTurn::Account.load
22
7
 
23
- it 'makes the call only twice' do
24
- VCR.use_cassette('account_info_twice') do
25
- FileTurn::Account.conn.should_receive(:get).twice
26
- FileTurn::Account.load
27
- FileTurn::Account.load
28
- FileTurn::Account.credits
8
+ expect(account.id).to_not be_nil
9
+ expect(account.email).to_not be_nil
10
+ expect(account.plan.name).to_not be_nil
11
+ expect(account.subscription.billing_cycle_started).to_not be_nil
12
+ expect(account.subscription.billing_cycle_ends).to_not be_nil
13
+ expect(account.subscription.stats.conversions_left).to_not be_nil
29
14
  end
30
15
  end
31
- end
16
+ end