fileturn 0.0.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.
Files changed (45) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +107 -0
  6. data/Rakefile +1 -0
  7. data/fileturn.gemspec +27 -0
  8. data/lib/fileturn/exceptions.rb +30 -0
  9. data/lib/fileturn/http_client.rb +49 -0
  10. data/lib/fileturn/resources/account.rb +46 -0
  11. data/lib/fileturn/resources/file.rb +112 -0
  12. data/lib/fileturn/resources/notification.rb +16 -0
  13. data/lib/fileturn/resources/resource.rb +17 -0
  14. data/lib/fileturn/resources/upload.rb +77 -0
  15. data/lib/fileturn/version.rb +3 -0
  16. data/lib/fileturn.rb +19 -0
  17. data/spec/.DS_Store +0 -0
  18. data/spec/data/.DS_Store +0 -0
  19. data/spec/data/testfile.docx +0 -0
  20. data/spec/fileturn_spec.rb +16 -0
  21. data/spec/fixtures/vcr_cassettes/account_info.yml +47 -0
  22. data/spec/fixtures/vcr_cassettes/file_all.yml +60 -0
  23. data/spec/fixtures/vcr_cassettes/file_all_notifications.yml +60 -0
  24. data/spec/fixtures/vcr_cassettes/file_convert_no_params.yml +44 -0
  25. data/spec/fixtures/vcr_cassettes/file_convert_success.yml +46 -0
  26. data/spec/fixtures/vcr_cassettes/file_doesnt_upload_since_too_big.yml +46 -0
  27. data/spec/fixtures/vcr_cassettes/file_failed_.yml +133 -0
  28. data/spec/fixtures/vcr_cassettes/file_notifications.yml +46 -0
  29. data/spec/fixtures/vcr_cassettes/file_queued_.yml +133 -0
  30. data/spec/fixtures/vcr_cassettes/file_reload.yml +89 -0
  31. data/spec/fixtures/vcr_cassettes/file_success.yml +46 -0
  32. data/spec/fixtures/vcr_cassettes/file_success_.yml +133 -0
  33. data/spec/fixtures/vcr_cassettes/file_time_taken.yml +133 -0
  34. data/spec/fixtures/vcr_cassettes/file_unauthorized.yml +44 -0
  35. data/spec/fixtures/vcr_cassettes/file_upload_doc_queued.yml +739 -0
  36. data/spec/fixtures/vcr_cassettes/file_upload_not_enough_credits.yml +87 -0
  37. data/spec/fixtures/vcr_cassettes/file_upload_queued.yml +160 -0
  38. data/spec/fixtures/vcr_cassettes/upload_all.yml +46 -0
  39. data/spec/fixtures/vcr_cassettes/upload_one.yml +46 -0
  40. data/spec/fixtures/vcr_cassettes/upload_refetch.yml +89 -0
  41. data/spec/resources/account_spec.rb +31 -0
  42. data/spec/resources/file_spec.rb +184 -0
  43. data/spec/resources/upload_spec.rb +41 -0
  44. data/spec/spec_helper.rb +19 -0
  45. metadata +198 -0
@@ -0,0 +1,89 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:3000/api/files/212.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
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
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ X-Ua-Compatible:
24
+ - IE=Edge
25
+ Etag:
26
+ - ! '"e0117ff1172a6eeb48dec9a51c619ca6"'
27
+ Cache-Control:
28
+ - max-age=0, private, must-revalidate
29
+ X-Request-Id:
30
+ - dd4a73df646ca9eaba461d7b2e89bea1
31
+ X-Runtime:
32
+ - '0.011115'
33
+ Server:
34
+ - WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
35
+ Date:
36
+ - Sun, 07 Jul 2013 22:46:58 GMT
37
+ Content-Length:
38
+ - '461'
39
+ Connection:
40
+ - Keep-Alive
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"id":212,"url":"http://www.k12.wa.us/rti/implementation/pubdocs/SchoolBlueprint.doc","convert_to":"pdf","created_at":"2013-07-07T03:38:20Z","status":"processed","download_url":"https://fileturn.s3.amazonaws.com/8_212.pdf?AWSAccessKeyId=AKIAIKXW3ZZ5WNURNYMA&Expires=1373259946&Signature=K60jm8kkSkXYjoEi8eVVr%2Bh1bBY%3D","notifications":[{"id":184,"details":null,"parsed_time":"2013-07-07T03:40:06Z","status":"success","time_taken":"105.926075","file_id":212}]}'
44
+ http_version:
45
+ recorded_at: Sun, 07 Jul 2013 22:46:58 GMT
46
+ - request:
47
+ method: get
48
+ uri: http://localhost:3000/api/files/212.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ''
52
+ headers:
53
+ User-Agent:
54
+ - Faraday v0.8.7
55
+ Accept-Encoding:
56
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
57
+ Accept:
58
+ - ! '*/*'
59
+ response:
60
+ status:
61
+ code: 200
62
+ message: ! 'OK '
63
+ headers:
64
+ Content-Type:
65
+ - application/json; charset=utf-8
66
+ X-Ua-Compatible:
67
+ - IE=Edge
68
+ Etag:
69
+ - ! '"e0117ff1172a6eeb48dec9a51c619ca6"'
70
+ Cache-Control:
71
+ - max-age=0, private, must-revalidate
72
+ X-Request-Id:
73
+ - ae5876efe665d3b631855e1248296e75
74
+ X-Runtime:
75
+ - '0.010671'
76
+ Server:
77
+ - WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
78
+ Date:
79
+ - Sun, 07 Jul 2013 22:46:58 GMT
80
+ Content-Length:
81
+ - '461'
82
+ Connection:
83
+ - Keep-Alive
84
+ body:
85
+ encoding: US-ASCII
86
+ string: ! '{"id":212,"url":"http://www.k12.wa.us/rti/implementation/pubdocs/SchoolBlueprint.doc","convert_to":"pdf","created_at":"2013-07-07T03:38:20Z","status":"processed","download_url":"https://fileturn.s3.amazonaws.com/8_212.pdf?AWSAccessKeyId=AKIAIKXW3ZZ5WNURNYMA&Expires=1373259946&Signature=K60jm8kkSkXYjoEi8eVVr%2Bh1bBY%3D","notifications":[{"id":184,"details":null,"parsed_time":"2013-07-07T03:40:06Z","status":"success","time_taken":"105.926075","file_id":212}]}'
87
+ http_version:
88
+ recorded_at: Sun, 07 Jul 2013 22:46:58 GMT
89
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:3000/api/files/212.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
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
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ X-Ua-Compatible:
24
+ - IE=Edge
25
+ Etag:
26
+ - ! '"e0117ff1172a6eeb48dec9a51c619ca6"'
27
+ Cache-Control:
28
+ - max-age=0, private, must-revalidate
29
+ X-Request-Id:
30
+ - eb2cf2d8606fee05cf8550454401a8ba
31
+ X-Runtime:
32
+ - '0.010797'
33
+ Server:
34
+ - WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
35
+ Date:
36
+ - Sun, 07 Jul 2013 22:46:58 GMT
37
+ Content-Length:
38
+ - '461'
39
+ Connection:
40
+ - Keep-Alive
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"id":212,"url":"http://www.k12.wa.us/rti/implementation/pubdocs/SchoolBlueprint.doc","convert_to":"pdf","created_at":"2013-07-07T03:38:20Z","status":"processed","download_url":"https://fileturn.s3.amazonaws.com/8_212.pdf?AWSAccessKeyId=AKIAIKXW3ZZ5WNURNYMA&Expires=1373259946&Signature=K60jm8kkSkXYjoEi8eVVr%2Bh1bBY%3D","notifications":[{"id":184,"details":null,"parsed_time":"2013-07-07T03:40:06Z","status":"success","time_taken":"105.926075","file_id":212}]}'
44
+ http_version:
45
+ recorded_at: Sun, 07 Jul 2013 22:46:58 GMT
46
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,133 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:3000/api/files/212.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
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
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ X-Ua-Compatible:
24
+ - IE=Edge
25
+ Etag:
26
+ - ! '"e0117ff1172a6eeb48dec9a51c619ca6"'
27
+ Cache-Control:
28
+ - max-age=0, private, must-revalidate
29
+ X-Request-Id:
30
+ - 4791e6686aa5fb2d8e1ebdf60e9f522c
31
+ X-Runtime:
32
+ - '0.058963'
33
+ Server:
34
+ - WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
35
+ Date:
36
+ - Sun, 07 Jul 2013 22:46:58 GMT
37
+ Content-Length:
38
+ - '461'
39
+ Connection:
40
+ - Keep-Alive
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"id":212,"url":"http://www.k12.wa.us/rti/implementation/pubdocs/SchoolBlueprint.doc","convert_to":"pdf","created_at":"2013-07-07T03:38:20Z","status":"processed","download_url":"https://fileturn.s3.amazonaws.com/8_212.pdf?AWSAccessKeyId=AKIAIKXW3ZZ5WNURNYMA&Expires=1373259946&Signature=K60jm8kkSkXYjoEi8eVVr%2Bh1bBY%3D","notifications":[{"id":184,"details":null,"parsed_time":"2013-07-07T03:40:06Z","status":"success","time_taken":"105.926075","file_id":212}]}'
44
+ http_version:
45
+ recorded_at: Sun, 07 Jul 2013 22:46:58 GMT
46
+ - request:
47
+ method: get
48
+ uri: http://localhost:3000/api/files/154.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ''
52
+ headers:
53
+ User-Agent:
54
+ - Faraday v0.8.7
55
+ Accept-Encoding:
56
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
57
+ Accept:
58
+ - ! '*/*'
59
+ response:
60
+ status:
61
+ code: 200
62
+ message: ! 'OK '
63
+ headers:
64
+ Content-Type:
65
+ - application/json; charset=utf-8
66
+ X-Ua-Compatible:
67
+ - IE=Edge
68
+ Etag:
69
+ - ! '"ccfff9a55b35efe35cc28aef5e5663b8"'
70
+ Cache-Control:
71
+ - max-age=0, private, must-revalidate
72
+ X-Request-Id:
73
+ - d769e8dfd7849658d93734e08ccf45cc
74
+ X-Runtime:
75
+ - '0.014014'
76
+ Server:
77
+ - WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
78
+ Date:
79
+ - Sun, 07 Jul 2013 22:46:58 GMT
80
+ Content-Length:
81
+ - '290'
82
+ Connection:
83
+ - Keep-Alive
84
+ body:
85
+ encoding: US-ASCII
86
+ string: ! '{"id":154,"url":"http://www.iiswc.org/iiswc2013/sample.docaa","convert_to":"pdf","created_at":"2013-07-06T01:18:31Z","status":"failed","download_url":"","notifications":[{"id":132,"details":"Invalid
87
+ response code: 404","parsed_time":null,"status":"failed","time_taken":null,"file_id":154}]}'
88
+ http_version:
89
+ recorded_at: Sun, 07 Jul 2013 22:46:58 GMT
90
+ - request:
91
+ method: get
92
+ uri: http://localhost:3000/api/files/210.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
93
+ body:
94
+ encoding: US-ASCII
95
+ string: ''
96
+ headers:
97
+ User-Agent:
98
+ - Faraday v0.8.7
99
+ Accept-Encoding:
100
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
101
+ Accept:
102
+ - ! '*/*'
103
+ response:
104
+ status:
105
+ code: 200
106
+ message: ! 'OK '
107
+ headers:
108
+ Content-Type:
109
+ - application/json; charset=utf-8
110
+ X-Ua-Compatible:
111
+ - IE=Edge
112
+ Etag:
113
+ - ! '"23074bb4f5f1834341c4c7f1a6522ffd"'
114
+ Cache-Control:
115
+ - max-age=0, private, must-revalidate
116
+ X-Request-Id:
117
+ - 8fb5db021ab01373ba14d7f91b57cf5e
118
+ X-Runtime:
119
+ - '0.013661'
120
+ Server:
121
+ - WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
122
+ Date:
123
+ - Sun, 07 Jul 2013 22:46:58 GMT
124
+ Content-Length:
125
+ - '196'
126
+ Connection:
127
+ - Keep-Alive
128
+ body:
129
+ encoding: US-ASCII
130
+ string: ! '{"id":210,"url":"http://www.k12.wa.us/rti/implementation/pubdocs/SchoolBlueprint.doc","convert_to":"pdf","created_at":"2013-07-07T02:30:27Z","status":"queued","download_url":"","notifications":[]}'
131
+ http_version:
132
+ recorded_at: Sun, 07 Jul 2013 22:46:58 GMT
133
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,133 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:3000/api/files/212.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
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
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ X-Ua-Compatible:
24
+ - IE=Edge
25
+ Etag:
26
+ - ! '"e0117ff1172a6eeb48dec9a51c619ca6"'
27
+ Cache-Control:
28
+ - max-age=0, private, must-revalidate
29
+ X-Request-Id:
30
+ - dbb13d687cf9fb97a3ec68126f12a858
31
+ X-Runtime:
32
+ - '0.011646'
33
+ Server:
34
+ - WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
35
+ Date:
36
+ - Sun, 07 Jul 2013 22:46:58 GMT
37
+ Content-Length:
38
+ - '461'
39
+ Connection:
40
+ - Keep-Alive
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"id":212,"url":"http://www.k12.wa.us/rti/implementation/pubdocs/SchoolBlueprint.doc","convert_to":"pdf","created_at":"2013-07-07T03:38:20Z","status":"processed","download_url":"https://fileturn.s3.amazonaws.com/8_212.pdf?AWSAccessKeyId=AKIAIKXW3ZZ5WNURNYMA&Expires=1373259946&Signature=K60jm8kkSkXYjoEi8eVVr%2Bh1bBY%3D","notifications":[{"id":184,"details":null,"parsed_time":"2013-07-07T03:40:06Z","status":"success","time_taken":"105.926075","file_id":212}]}'
44
+ http_version:
45
+ recorded_at: Sun, 07 Jul 2013 22:46:58 GMT
46
+ - request:
47
+ method: get
48
+ uri: http://localhost:3000/api/files/154.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ''
52
+ headers:
53
+ User-Agent:
54
+ - Faraday v0.8.7
55
+ Accept-Encoding:
56
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
57
+ Accept:
58
+ - ! '*/*'
59
+ response:
60
+ status:
61
+ code: 200
62
+ message: ! 'OK '
63
+ headers:
64
+ Content-Type:
65
+ - application/json; charset=utf-8
66
+ X-Ua-Compatible:
67
+ - IE=Edge
68
+ Etag:
69
+ - ! '"ccfff9a55b35efe35cc28aef5e5663b8"'
70
+ Cache-Control:
71
+ - max-age=0, private, must-revalidate
72
+ X-Request-Id:
73
+ - 70b9ac81f3aff857ae43b0952d15cfe4
74
+ X-Runtime:
75
+ - '0.010554'
76
+ Server:
77
+ - WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
78
+ Date:
79
+ - Sun, 07 Jul 2013 22:46:58 GMT
80
+ Content-Length:
81
+ - '290'
82
+ Connection:
83
+ - Keep-Alive
84
+ body:
85
+ encoding: US-ASCII
86
+ string: ! '{"id":154,"url":"http://www.iiswc.org/iiswc2013/sample.docaa","convert_to":"pdf","created_at":"2013-07-06T01:18:31Z","status":"failed","download_url":"","notifications":[{"id":132,"details":"Invalid
87
+ response code: 404","parsed_time":null,"status":"failed","time_taken":null,"file_id":154}]}'
88
+ http_version:
89
+ recorded_at: Sun, 07 Jul 2013 22:46:58 GMT
90
+ - request:
91
+ method: get
92
+ uri: http://localhost:3000/api/files/210.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
93
+ body:
94
+ encoding: US-ASCII
95
+ string: ''
96
+ headers:
97
+ User-Agent:
98
+ - Faraday v0.8.7
99
+ Accept-Encoding:
100
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
101
+ Accept:
102
+ - ! '*/*'
103
+ response:
104
+ status:
105
+ code: 200
106
+ message: ! 'OK '
107
+ headers:
108
+ Content-Type:
109
+ - application/json; charset=utf-8
110
+ X-Ua-Compatible:
111
+ - IE=Edge
112
+ Etag:
113
+ - ! '"23074bb4f5f1834341c4c7f1a6522ffd"'
114
+ Cache-Control:
115
+ - max-age=0, private, must-revalidate
116
+ X-Request-Id:
117
+ - 32653444a47aa47da3254099c676c367
118
+ X-Runtime:
119
+ - '0.010277'
120
+ Server:
121
+ - WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
122
+ Date:
123
+ - Sun, 07 Jul 2013 22:46:58 GMT
124
+ Content-Length:
125
+ - '196'
126
+ Connection:
127
+ - Keep-Alive
128
+ body:
129
+ encoding: US-ASCII
130
+ string: ! '{"id":210,"url":"http://www.k12.wa.us/rti/implementation/pubdocs/SchoolBlueprint.doc","convert_to":"pdf","created_at":"2013-07-07T02:30:27Z","status":"queued","download_url":"","notifications":[]}'
131
+ http_version:
132
+ recorded_at: Sun, 07 Jul 2013 22:46:58 GMT
133
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:3000/api/files/123.json?token=blah
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
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: 401
19
+ message: ! 'Unauthorized '
20
+ headers:
21
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ X-Ua-Compatible:
24
+ - IE=Edge
25
+ Cache-Control:
26
+ - no-cache
27
+ X-Request-Id:
28
+ - c814e32f9fbaa2a081c53fbdd24d4479
29
+ X-Runtime:
30
+ - '0.004854'
31
+ Server:
32
+ - WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
33
+ Date:
34
+ - Sun, 07 Jul 2013 22:46:58 GMT
35
+ Content-Length:
36
+ - '46'
37
+ Connection:
38
+ - Keep-Alive
39
+ body:
40
+ encoding: US-ASCII
41
+ string: ! '{"error":"Your token is invalid","status":401}'
42
+ http_version:
43
+ recorded_at: Sun, 07 Jul 2013 22:46:58 GMT
44
+ recorded_with: VCR 2.4.0