fileturn 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,176 +0,0 @@
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
- - request:
134
- method: get
135
- uri: http://fileturn.net/api/files/212.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
136
- body:
137
- encoding: US-ASCII
138
- string: ''
139
- headers:
140
- User-Agent:
141
- - Faraday v0.8.7
142
- Accept-Encoding:
143
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
144
- Accept:
145
- - ! '*/*'
146
- response:
147
- status:
148
- code: 401
149
- message: Unauthorized
150
- headers:
151
- Cache-Control:
152
- - no-cache
153
- Content-Type:
154
- - application/json; charset=utf-8
155
- Date:
156
- - Wed, 10 Jul 2013 02:23:46 GMT
157
- Status:
158
- - 401 Unauthorized
159
- X-Rack-Cache:
160
- - miss
161
- X-Request-Id:
162
- - e0cbb48f58fe4fd50ba22b05f6299357
163
- X-Runtime:
164
- - '0.010530'
165
- X-Ua-Compatible:
166
- - IE=Edge,chrome=1
167
- Transfer-Encoding:
168
- - chunked
169
- Connection:
170
- - keep-alive
171
- body:
172
- encoding: US-ASCII
173
- string: ! '{"error":"Your token is invalid","status":401}'
174
- http_version:
175
- recorded_at: Wed, 10 Jul 2013 02:26:15 GMT
176
- recorded_with: VCR 2.4.0
@@ -1,176 +0,0 @@
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
- - request:
134
- method: get
135
- uri: http://fileturn.net/api/files/212.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
136
- body:
137
- encoding: US-ASCII
138
- string: ''
139
- headers:
140
- User-Agent:
141
- - Faraday v0.8.7
142
- Accept-Encoding:
143
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
144
- Accept:
145
- - ! '*/*'
146
- response:
147
- status:
148
- code: 401
149
- message: Unauthorized
150
- headers:
151
- Cache-Control:
152
- - no-cache
153
- Content-Type:
154
- - application/json; charset=utf-8
155
- Date:
156
- - Wed, 10 Jul 2013 02:23:46 GMT
157
- Status:
158
- - 401 Unauthorized
159
- X-Rack-Cache:
160
- - miss
161
- X-Request-Id:
162
- - d730bae2e395f66340a78fcb4a67dae3
163
- X-Runtime:
164
- - '0.010042'
165
- X-Ua-Compatible:
166
- - IE=Edge,chrome=1
167
- Transfer-Encoding:
168
- - chunked
169
- Connection:
170
- - keep-alive
171
- body:
172
- encoding: US-ASCII
173
- string: ! '{"error":"Your token is invalid","status":401}'
174
- http_version:
175
- recorded_at: Wed, 10 Jul 2013 02:26:16 GMT
176
- recorded_with: VCR 2.4.0
@@ -1,87 +0,0 @@
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
- - request:
45
- method: get
46
- uri: http://fileturn.net/api/files/123.json?token=blah
47
- body:
48
- encoding: US-ASCII
49
- string: ''
50
- headers:
51
- User-Agent:
52
- - Faraday v0.8.7
53
- Accept-Encoding:
54
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
55
- Accept:
56
- - ! '*/*'
57
- response:
58
- status:
59
- code: 401
60
- message: Unauthorized
61
- headers:
62
- Cache-Control:
63
- - no-cache
64
- Content-Type:
65
- - application/json; charset=utf-8
66
- Date:
67
- - Wed, 10 Jul 2013 02:23:46 GMT
68
- Status:
69
- - 401 Unauthorized
70
- X-Rack-Cache:
71
- - miss
72
- X-Request-Id:
73
- - ede134fabb5794d8f7b700b49ef4d950
74
- X-Runtime:
75
- - '0.024409'
76
- X-Ua-Compatible:
77
- - IE=Edge,chrome=1
78
- Transfer-Encoding:
79
- - chunked
80
- Connection:
81
- - keep-alive
82
- body:
83
- encoding: US-ASCII
84
- string: ! '{"error":"Your token is invalid","status":401}'
85
- http_version:
86
- recorded_at: Wed, 10 Jul 2013 02:26:16 GMT
87
- recorded_with: VCR 2.4.0