worochi 0.0.0 → 0.0.1

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 +4 -4
  2. data/LICENSE +20 -0
  3. data/lib/worochi/agent/dropbox.rb +26 -4
  4. data/lib/worochi/agent/github.rb +14 -9
  5. data/lib/worochi/agent/sample.rb +8 -3
  6. data/lib/worochi/agent.rb +64 -23
  7. data/lib/worochi/config.rb +34 -2
  8. data/lib/worochi/error.rb +1 -0
  9. data/lib/worochi/helper/github.rb +1 -0
  10. data/lib/worochi/helper.rb +10 -8
  11. data/lib/worochi/item.rb +18 -9
  12. data/lib/worochi/log.rb +11 -0
  13. data/lib/worochi/version.rb +4 -0
  14. data/lib/worochi.rb +23 -16
  15. data/spec/cassettes/Worochi_Agent_Dropbox/_list/works_with_absolute_paths.yml +60 -0
  16. data/spec/cassettes/Worochi_Agent_Dropbox/_push_item/pushes_a_single_item.yml +303 -0
  17. data/spec/cassettes/Worochi_Agent_Dropbox/_push_item_chunked/pushes_a_single_item_in_chunks.yml +349 -0
  18. data/spec/cassettes/Worochi_Agent_Dropbox/it_should_behave_like_a_service_agent/_files/accepts_a_different_path.yml +60 -0
  19. data/spec/cassettes/Worochi_Agent_Dropbox/it_should_behave_like_a_service_agent/_files/accepts_a_different_relative_path.yml +60 -0
  20. data/spec/cassettes/Worochi_Agent_Dropbox/it_should_behave_like_a_service_agent/_files/contains_file1.yml +79 -0
  21. data/spec/cassettes/Worochi_Agent_Dropbox/it_should_behave_like_a_service_agent/_folders/accepts_a_different_path.yml +60 -0
  22. data/spec/cassettes/Worochi_Agent_Dropbox/it_should_behave_like_a_service_agent/_folders/accepts_a_different_relative_path.yml +60 -0
  23. data/spec/cassettes/Worochi_Agent_Dropbox/it_should_behave_like_a_service_agent/_folders/contains_folder1.yml +79 -0
  24. data/spec/cassettes/Worochi_Agent_Github/_list/works_with_absolute_paths.yml +133 -0
  25. data/spec/cassettes/Worochi_Agent_Github/_push_all/pushes_a_list_of_items_to_create_a_new_commit.yml +989 -0
  26. data/spec/cassettes/Worochi_Agent_Github/_push_all/pushes_the_file_to_the_right_place.yml +687 -0
  27. data/spec/cassettes/Worochi_Agent_Github/_source_branch/retrieves_the_master_branch_correctly.yml +68 -0
  28. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_files/accepts_a_different_path.yml +133 -0
  29. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_files/accepts_a_different_relative_path.yml +133 -0
  30. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_files/contains_file1.yml +133 -0
  31. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_folders/accepts_a_different_path.yml +133 -0
  32. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_folders/accepts_a_different_relative_path.yml +133 -0
  33. data/spec/cassettes/Worochi_Agent_Github/it_should_behave_like_a_service_agent/_folders/contains_folder1.yml +133 -0
  34. data/spec/cassettes/Worochi_Item/_open/opens_a_single_file/with_Hash_parameter.yml +107 -0
  35. data/spec/cassettes/Worochi_Item/_open/opens_a_single_file/with_String_parameter.yml +107 -0
  36. data/spec/cassettes/Worochi_Item/_open/opens_multiple_files/with_Hash_parameters.yml +211 -0
  37. data/spec/cassettes/Worochi_Item/_open/opens_multiple_files/with_String_parameters.yml +107 -0
  38. data/spec/cassettes/Worochi_Item/_open_single/accepts_a_String.yml +107 -0
  39. data/spec/cassettes/Worochi_Item/_open_single/works_with_AWS_S3_paths.yml +46 -0
  40. data/spec/helper.rb +46 -0
  41. data/spec/support/aws_uri_matcher.rb +12 -0
  42. data/spec/support/shared_exampes_for_agents.rb +36 -0
  43. data/spec/support/test_file +1 -0
  44. data/spec/support/test_files.rb +34 -0
  45. data/spec/worochi/agent/dropbox_spec.rb +48 -0
  46. data/spec/worochi/agent/github_spec.rb +77 -0
  47. data/spec/worochi/agent_spec.rb +2 -0
  48. data/spec/worochi/helper/github_spec.rb +57 -0
  49. data/spec/worochi/helper_spec.rb +23 -0
  50. data/spec/worochi/item_spec.rb +85 -0
  51. data/spec/worochi_spec.rb +109 -0
  52. data/worochi.gemspec +27 -4
  53. metadata +193 -4
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.dropbox.com/1/metadata/auto/Dev/test/folder2/subfolder/test?file_limit=25000&include_deleted=false&list=true
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - OfficialDropboxRubySDK/1.6.1
16
+ Authorization:
17
+ - Bearer <DROPBOX_TOKEN>
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Fri, 09 Aug 2013 23:24:51 GMT
27
+ Content-Type:
28
+ - text/javascript
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ X-Server-Response-Time:
34
+ - '57'
35
+ X-Dropbox-Request-Id:
36
+ - 3a0b6f386997828b5f69cde074f3dbf8
37
+ Pragma:
38
+ - no-cache
39
+ Cache-Control:
40
+ - no-cache
41
+ X-Dropbox-Http-Protocol:
42
+ - None
43
+ X-Frame-Options:
44
+ - SAMEORIGIN
45
+ X-Requestid:
46
+ - 316517c1253a3489bc2c40a52e92c1d5
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"hash": "e2a5276afbca27af08338f959cddf1aa", "revision": 913528517,
50
+ "rev": "367356c5002426b8", "thumb_exists": false, "bytes": 0, "modified":
51
+ "Fri, 09 Aug 2013 23:22:25 +0000", "path": "/Dev/test/folder2/subfolder/test",
52
+ "is_dir": true, "icon": "folder", "root": "dropbox", "contents": [{"revision":
53
+ 913528523, "rev": "367356cb002426b8", "thumb_exists": false, "bytes": 32,
54
+ "modified": "Fri, 09 Aug 2013 23:22:59 +0000", "client_mtime": "Fri, 09 Aug
55
+ 2013 23:22:50 +0000", "path": "/Dev/test/folder2/subfolder/test/abc.txt",
56
+ "is_dir": false, "icon": "page_white_text", "root": "dropbox", "mime_type":
57
+ "text/plain", "size": "32 bytes"}], "size": "0 bytes"}'
58
+ http_version:
59
+ recorded_at: Fri, 09 Aug 2013 23:24:51 GMT
60
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,303 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.dropbox.com/1/fileops/delete?path=/Dev/test/test_file&root=auto
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - OfficialDropboxRubySDK/1.6.1
16
+ Authorization:
17
+ - Bearer <DROPBOX_TOKEN>
18
+ response:
19
+ status:
20
+ code: 404
21
+ message: Not Found
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Fri, 09 Aug 2013 22:27:47 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: '{"error": "Path ''/dev/test/test_file'' not found"}'
36
+ http_version:
37
+ recorded_at: Fri, 09 Aug 2013 22:27:47 GMT
38
+ - request:
39
+ method: get
40
+ uri: https://api.dropbox.com/1/metadata/auto/Dev/test?file_limit=25000&include_deleted=false&list=true
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ''
44
+ headers:
45
+ Accept-Encoding:
46
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
47
+ Accept:
48
+ - '*/*'
49
+ User-Agent:
50
+ - OfficialDropboxRubySDK/1.6.1
51
+ Authorization:
52
+ - Bearer <DROPBOX_TOKEN>
53
+ response:
54
+ status:
55
+ code: 200
56
+ message: OK
57
+ headers:
58
+ Server:
59
+ - nginx
60
+ Date:
61
+ - Fri, 09 Aug 2013 22:27:47 GMT
62
+ Content-Type:
63
+ - text/javascript
64
+ Transfer-Encoding:
65
+ - chunked
66
+ Connection:
67
+ - keep-alive
68
+ X-Server-Response-Time:
69
+ - '41'
70
+ X-Dropbox-Request-Id:
71
+ - a647a2a5f64603e3932e668082e85a8b
72
+ Pragma:
73
+ - no-cache
74
+ Cache-Control:
75
+ - no-cache
76
+ X-Dropbox-Http-Protocol:
77
+ - None
78
+ X-Frame-Options:
79
+ - SAMEORIGIN
80
+ X-Requestid:
81
+ - ab40dd522d15fab775c855e9affe3a3b
82
+ body:
83
+ encoding: UTF-8
84
+ string: '{"hash": "89d2d8d15943787964a340cd8a044e02", "revision": 913527043,
85
+ "rev": "36735103002426b8", "thumb_exists": false, "bytes": 0, "modified":
86
+ "Fri, 09 Aug 2013 00:17:26 +0000", "path": "/Dev/test", "is_dir": true, "icon":
87
+ "folder", "root": "dropbox", "contents": [{"revision": 913527044, "rev": "36735104002426b8",
88
+ "thumb_exists": false, "bytes": 0, "modified": "Fri, 09 Aug 2013 00:17:28
89
+ +0000", "path": "/Dev/test/.git", "is_dir": true, "icon": "folder", "root":
90
+ "dropbox", "size": "0 bytes"}, {"revision": 913527128, "rev": "36735158002426b8",
91
+ "thumb_exists": false, "bytes": 18, "modified": "Fri, 09 Aug 2013 00:17:36
92
+ +0000", "client_mtime": "Thu, 08 Aug 2013 20:44:11 +0000", "path": "/Dev/test/file1",
93
+ "is_dir": false, "icon": "page_white", "root": "dropbox", "mime_type": "application/octet-stream",
94
+ "size": "18 bytes"}, {"revision": 913527046, "rev": "36735106002426b8", "thumb_exists":
95
+ false, "bytes": 0, "modified": "Fri, 09 Aug 2013 00:17:28 +0000", "path":
96
+ "/Dev/test/folder1", "is_dir": true, "icon": "folder", "root": "dropbox",
97
+ "size": "0 bytes"}, {"revision": 913527047, "rev": "36735107002426b8", "thumb_exists":
98
+ false, "bytes": 0, "modified": "Fri, 09 Aug 2013 00:17:28 +0000", "path":
99
+ "/Dev/test/folder2", "is_dir": true, "icon": "folder", "root": "dropbox",
100
+ "size": "0 bytes"}, {"revision": 913527045, "rev": "36735105002426b8", "thumb_exists":
101
+ false, "bytes": 0, "modified": "Fri, 09 Aug 2013 00:17:28 +0000", "path":
102
+ "/Dev/test/folder3", "is_dir": true, "icon": "folder", "root": "dropbox",
103
+ "size": "0 bytes"}, {"revision": 913527152, "rev": "36735170002426b8", "thumb_exists":
104
+ false, "bytes": 1078, "modified": "Fri, 09 Aug 2013 00:17:36 +0000", "client_mtime":
105
+ "Thu, 08 Aug 2013 20:38:22 +0000", "path": "/Dev/test/LICENSE", "is_dir":
106
+ false, "icon": "page_white", "root": "dropbox", "mime_type": "application/octet-stream",
107
+ "size": "1.1 KB"}, {"revision": 913527129, "rev": "36735159002426b8", "thumb_exists":
108
+ false, "bytes": 20, "modified": "Fri, 09 Aug 2013 00:17:36 +0000", "client_mtime":
109
+ "Thu, 08 Aug 2013 20:38:22 +0000", "path": "/Dev/test/README.md", "is_dir":
110
+ false, "icon": "page_white_text", "root": "dropbox", "mime_type": "application/octet-stream",
111
+ "size": "20 bytes"}], "size": "0 bytes"}'
112
+ http_version:
113
+ recorded_at: Fri, 09 Aug 2013 22:27:48 GMT
114
+ - request:
115
+ method: put
116
+ uri: https://api-content.dropbox.com/1/files_put/auto/Dev/test/test_file?overwrite=true
117
+ body:
118
+ encoding: UTF-8
119
+ string: This is a file used for RSpec tests involving Worochi::Item.
120
+ headers:
121
+ Content-Type:
122
+ - application/octet-stream
123
+ Accept-Encoding:
124
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
125
+ Accept:
126
+ - '*/*'
127
+ User-Agent:
128
+ - OfficialDropboxRubySDK/1.6.1
129
+ Content-Length:
130
+ - '60'
131
+ Authorization:
132
+ - Bearer <DROPBOX_TOKEN>
133
+ response:
134
+ status:
135
+ code: 200
136
+ message: OK
137
+ headers:
138
+ Server:
139
+ - nginx
140
+ Date:
141
+ - Fri, 09 Aug 2013 22:27:49 GMT
142
+ Content-Type:
143
+ - text/javascript
144
+ Transfer-Encoding:
145
+ - chunked
146
+ Connection:
147
+ - keep-alive
148
+ X-Server-Response-Time:
149
+ - '459'
150
+ X-Dropbox-Request-Id:
151
+ - c87825da15d67b1d139a52ffce45fc62
152
+ Pragma:
153
+ - no-cache
154
+ Cache-Control:
155
+ - no-cache
156
+ X-Requestid:
157
+ - 9b0f6ff4a2d3f7e8944603d104f8afa8
158
+ body:
159
+ encoding: UTF-8
160
+ string: '{"revision": 913528118, "rev": "36735536002426b8", "thumb_exists":
161
+ false, "bytes": 60, "modified": "Fri, 09 Aug 2013 22:27:48 +0000", "client_mtime":
162
+ "Fri, 09 Aug 2013 22:27:48 +0000", "path": "/Dev/test/test_file", "is_dir":
163
+ false, "icon": "page_white", "root": "dropbox", "mime_type": "application/octet-stream",
164
+ "size": "60 bytes"}'
165
+ http_version:
166
+ recorded_at: Fri, 09 Aug 2013 22:27:49 GMT
167
+ - request:
168
+ method: get
169
+ uri: https://api.dropbox.com/1/metadata/auto/Dev/test?file_limit=25000&include_deleted=false&list=true
170
+ body:
171
+ encoding: US-ASCII
172
+ string: ''
173
+ headers:
174
+ Accept-Encoding:
175
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
176
+ Accept:
177
+ - '*/*'
178
+ User-Agent:
179
+ - OfficialDropboxRubySDK/1.6.1
180
+ Authorization:
181
+ - Bearer <DROPBOX_TOKEN>
182
+ response:
183
+ status:
184
+ code: 200
185
+ message: OK
186
+ headers:
187
+ Server:
188
+ - nginx
189
+ Date:
190
+ - Fri, 09 Aug 2013 22:27:49 GMT
191
+ Content-Type:
192
+ - text/javascript
193
+ Transfer-Encoding:
194
+ - chunked
195
+ Connection:
196
+ - keep-alive
197
+ X-Server-Response-Time:
198
+ - '58'
199
+ X-Dropbox-Request-Id:
200
+ - 0a6181c0756c9dae2045f5784a90fe60
201
+ Pragma:
202
+ - no-cache
203
+ Cache-Control:
204
+ - no-cache
205
+ X-Dropbox-Http-Protocol:
206
+ - None
207
+ X-Frame-Options:
208
+ - SAMEORIGIN
209
+ X-Requestid:
210
+ - cf510a3665036074c310702a57854fd9
211
+ body:
212
+ encoding: UTF-8
213
+ string: '{"hash": "d015e0a4db14e4022000cff412e644e7", "revision": 913527043,
214
+ "rev": "36735103002426b8", "thumb_exists": false, "bytes": 0, "modified":
215
+ "Fri, 09 Aug 2013 00:17:26 +0000", "path": "/Dev/test", "is_dir": true, "icon":
216
+ "folder", "root": "dropbox", "contents": [{"revision": 913527044, "rev": "36735104002426b8",
217
+ "thumb_exists": false, "bytes": 0, "modified": "Fri, 09 Aug 2013 00:17:28
218
+ +0000", "path": "/Dev/test/.git", "is_dir": true, "icon": "folder", "root":
219
+ "dropbox", "size": "0 bytes"}, {"revision": 913527128, "rev": "36735158002426b8",
220
+ "thumb_exists": false, "bytes": 18, "modified": "Fri, 09 Aug 2013 00:17:36
221
+ +0000", "client_mtime": "Thu, 08 Aug 2013 20:44:11 +0000", "path": "/Dev/test/file1",
222
+ "is_dir": false, "icon": "page_white", "root": "dropbox", "mime_type": "application/octet-stream",
223
+ "size": "18 bytes"}, {"revision": 913527046, "rev": "36735106002426b8", "thumb_exists":
224
+ false, "bytes": 0, "modified": "Fri, 09 Aug 2013 00:17:28 +0000", "path":
225
+ "/Dev/test/folder1", "is_dir": true, "icon": "folder", "root": "dropbox",
226
+ "size": "0 bytes"}, {"revision": 913527047, "rev": "36735107002426b8", "thumb_exists":
227
+ false, "bytes": 0, "modified": "Fri, 09 Aug 2013 00:17:28 +0000", "path":
228
+ "/Dev/test/folder2", "is_dir": true, "icon": "folder", "root": "dropbox",
229
+ "size": "0 bytes"}, {"revision": 913527045, "rev": "36735105002426b8", "thumb_exists":
230
+ false, "bytes": 0, "modified": "Fri, 09 Aug 2013 00:17:28 +0000", "path":
231
+ "/Dev/test/folder3", "is_dir": true, "icon": "folder", "root": "dropbox",
232
+ "size": "0 bytes"}, {"revision": 913527152, "rev": "36735170002426b8", "thumb_exists":
233
+ false, "bytes": 1078, "modified": "Fri, 09 Aug 2013 00:17:36 +0000", "client_mtime":
234
+ "Thu, 08 Aug 2013 20:38:22 +0000", "path": "/Dev/test/LICENSE", "is_dir":
235
+ false, "icon": "page_white", "root": "dropbox", "mime_type": "application/octet-stream",
236
+ "size": "1.1 KB"}, {"revision": 913527129, "rev": "36735159002426b8", "thumb_exists":
237
+ false, "bytes": 20, "modified": "Fri, 09 Aug 2013 00:17:36 +0000", "client_mtime":
238
+ "Thu, 08 Aug 2013 20:38:22 +0000", "path": "/Dev/test/README.md", "is_dir":
239
+ false, "icon": "page_white_text", "root": "dropbox", "mime_type": "application/octet-stream",
240
+ "size": "20 bytes"}, {"revision": 913528118, "rev": "36735536002426b8", "thumb_exists":
241
+ false, "bytes": 60, "modified": "Fri, 09 Aug 2013 22:27:48 +0000", "client_mtime":
242
+ "Fri, 09 Aug 2013 22:27:48 +0000", "path": "/Dev/test/test_file", "is_dir":
243
+ false, "icon": "page_white", "root": "dropbox", "mime_type": "application/octet-stream",
244
+ "size": "60 bytes"}], "size": "0 bytes"}'
245
+ http_version:
246
+ recorded_at: Fri, 09 Aug 2013 22:27:49 GMT
247
+ - request:
248
+ method: post
249
+ uri: https://api.dropbox.com/1/fileops/delete?path=/Dev/test/test_file&root=auto
250
+ body:
251
+ encoding: UTF-8
252
+ string: ''
253
+ headers:
254
+ Accept-Encoding:
255
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
256
+ Accept:
257
+ - '*/*'
258
+ User-Agent:
259
+ - OfficialDropboxRubySDK/1.6.1
260
+ Authorization:
261
+ - Bearer <DROPBOX_TOKEN>
262
+ response:
263
+ status:
264
+ code: 200
265
+ message: OK
266
+ headers:
267
+ Server:
268
+ - nginx
269
+ Date:
270
+ - Fri, 09 Aug 2013 22:27:49 GMT
271
+ Content-Type:
272
+ - text/javascript
273
+ Transfer-Encoding:
274
+ - chunked
275
+ Connection:
276
+ - keep-alive
277
+ Set-Cookie:
278
+ - gvc=MTY1MDMxMDgzMTgwMjY0NjEwODI1ODQyOTk4Mzg2MDQzMjY1NTE1; expires=Wed, 08
279
+ Aug 2018 22:27:49 GMT; Path=/; httponly
280
+ X-Server-Response-Time:
281
+ - '187'
282
+ X-Dropbox-Request-Id:
283
+ - 6dadf75a7d47b5407ee0d140a572a044
284
+ Pragma:
285
+ - no-cache
286
+ Cache-Control:
287
+ - no-cache
288
+ X-Dropbox-Http-Protocol:
289
+ - None
290
+ X-Frame-Options:
291
+ - SAMEORIGIN
292
+ X-Requestid:
293
+ - 890ae3d1ecaa745b3a1c805e8434d15a
294
+ body:
295
+ encoding: UTF-8
296
+ string: '{"is_deleted": true, "revision": 913528119, "rev": "36735537002426b8",
297
+ "thumb_exists": false, "bytes": 0, "modified": "Fri, 09 Aug 2013 22:27:49
298
+ +0000", "client_mtime": "Wed, 31 Dec 1969 23:59:59 +0000", "path": "/Dev/test/test_file",
299
+ "is_dir": false, "icon": "page_white", "root": "dropbox", "mime_type": "application/octet-stream",
300
+ "size": "0 bytes"}'
301
+ http_version:
302
+ recorded_at: Fri, 09 Aug 2013 22:27:50 GMT
303
+ recorded_with: VCR 2.5.0