leggy 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -0
  3. data/Gemfile +4 -0
  4. data/README.md +195 -2
  5. data/Rakefile +4 -0
  6. data/leggy.gemspec +2 -2
  7. data/lib/leggy.rb +14 -5
  8. data/lib/leggy/app.rb +1 -2
  9. data/lib/leggy/crawl.rb +1 -2
  10. data/lib/leggy/crawl_options.rb +1 -2
  11. data/lib/leggy/error.rb +4 -0
  12. data/lib/leggy/error_handler.rb +30 -0
  13. data/lib/leggy/exceptions.rb +30 -0
  14. data/lib/leggy/mapping/app.rb +1 -6
  15. data/lib/leggy/mapping/crawl.rb +1 -1
  16. data/lib/leggy/mapping/crawl_options.rb +1 -1
  17. data/lib/leggy/mapping/url.rb +1 -1
  18. data/lib/leggy/mapping/user.rb +1 -1
  19. data/lib/leggy/resource/app.rb +3 -6
  20. data/lib/leggy/resource/crawl.rb +9 -12
  21. data/lib/leggy/resource/result.rb +20 -0
  22. data/lib/leggy/resource/url.rb +3 -6
  23. data/lib/leggy/resource/user.rb +1 -4
  24. data/lib/leggy/url.rb +1 -2
  25. data/lib/leggy/user.rb +1 -2
  26. data/lib/leggy/version.rb +1 -1
  27. data/spec/cassettes/{leggy.yml → leggy_app.yml} +106 -822
  28. data/spec/cassettes/leggy_crawl_all.yml +39 -0
  29. data/spec/cassettes/leggy_crawl_cancel.yml +147 -0
  30. data/spec/cassettes/leggy_crawl_start.yml +147 -0
  31. data/spec/cassettes/leggy_crawl_status.yml +183 -0
  32. data/spec/cassettes/leggy_exception.yml +38 -0
  33. data/spec/cassettes/leggy_result.yml +147 -0
  34. data/spec/cassettes/leggy_url.yml +373 -0
  35. data/spec/cassettes/leggy_user.yml +38 -0
  36. data/spec/leggy/exceptions_spec.rb +25 -0
  37. data/spec/leggy/leggy_spec.rb +1 -162
  38. data/spec/leggy/resource/app_spec.rb +64 -0
  39. data/spec/leggy/resource/crawl_spec.rb +88 -0
  40. data/spec/leggy/resource/result_spec.rb +46 -0
  41. data/spec/leggy/resource/url_spec.rb +59 -0
  42. data/spec/leggy/resource/user_spec.rb +22 -0
  43. data/spec/spec_helper.rb +37 -31
  44. data/spec/support/helpers.rb +26 -0
  45. data/spec/support/vcr.rb +12 -0
  46. metadata +48 -11
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://<TOKEN>:@api.80legs.com/v2/crawls
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Faraday v0.9.2
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
+ Content-Type:
24
+ - application/json
25
+ Date:
26
+ - Sat, 12 Dec 2015 18:35:46 GMT
27
+ Server:
28
+ - Cowboy
29
+ Content-Length:
30
+ - '10430'
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: '[{"id":167837,"name":"testing_crawl_results","user":"<TOKEN>","user_agent":"voltron","app":"HeaderData.js","urllist":"sample_crawl_list","data":"","max_depth":1,"max_urls":10,"status":"COMPLETED","depth":0,"urls_crawled":3,"date_created":"2015-12-12
36
+ 18:20:25","date_completed":"2015-12-12 18:24:4","date_started":"2015-12-12
37
+ 18:21:16"}]'
38
+ http_version:
39
+ recorded_at: Sat, 12 Dec 2015 18:35:53 GMT
@@ -0,0 +1,147 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://<TOKEN>:@api.80legs.com/v2/urllists/sample_crawl_list
6
+ body:
7
+ encoding: UTF-8
8
+ string: |
9
+ [
10
+ "http://example.com",
11
+ "https://example.org"
12
+ ]
13
+ headers:
14
+ Content-Type:
15
+ - application/octet-stream
16
+ User-Agent:
17
+ - Faraday v0.9.2
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ Accept:
21
+ - "*/*"
22
+ response:
23
+ status:
24
+ code: 204
25
+ message: No Content
26
+ headers:
27
+ Content-Length:
28
+ - '0'
29
+ Content-Type:
30
+ - application/octet-stream
31
+ Date:
32
+ - Sat, 12 Dec 2015 18:15:07 GMT
33
+ Server:
34
+ - Cowboy
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: UTF-8
39
+ string: ''
40
+ http_version:
41
+ recorded_at: Sat, 12 Dec 2015 18:15:13 GMT
42
+ - request:
43
+ method: post
44
+ uri: https://<TOKEN>:@api.80legs.com/v2/crawls/testing_crawl_cancel
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"app":"HeaderData.js","urllist":"sample_crawl_list","max_depth":1,"max_urls":10}'
48
+ headers:
49
+ Content-Type:
50
+ - application/json
51
+ User-Agent:
52
+ - Faraday v0.9.2
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: 204
60
+ message: No Content
61
+ headers:
62
+ Content-Length:
63
+ - '0'
64
+ Content-Type:
65
+ - application/json
66
+ Date:
67
+ - Sat, 12 Dec 2015 18:15:07 GMT
68
+ Server:
69
+ - Cowboy
70
+ Connection:
71
+ - keep-alive
72
+ body:
73
+ encoding: UTF-8
74
+ string: ''
75
+ http_version:
76
+ recorded_at: Sat, 12 Dec 2015 18:15:13 GMT
77
+ - request:
78
+ method: delete
79
+ uri: https://<TOKEN>:@api.80legs.com/v2/crawls/testing_crawl_cancel
80
+ body:
81
+ encoding: US-ASCII
82
+ string: ''
83
+ headers:
84
+ Content-Type:
85
+ - application/json
86
+ User-Agent:
87
+ - Faraday v0.9.2
88
+ Accept-Encoding:
89
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
90
+ Accept:
91
+ - "*/*"
92
+ response:
93
+ status:
94
+ code: 204
95
+ message: No Content
96
+ headers:
97
+ Content-Length:
98
+ - '0'
99
+ Content-Type:
100
+ - application/json
101
+ Date:
102
+ - Sat, 12 Dec 2015 18:15:08 GMT
103
+ Server:
104
+ - Cowboy
105
+ Connection:
106
+ - keep-alive
107
+ body:
108
+ encoding: UTF-8
109
+ string: ''
110
+ http_version:
111
+ recorded_at: Sat, 12 Dec 2015 18:15:14 GMT
112
+ - request:
113
+ method: delete
114
+ uri: https://<TOKEN>:@api.80legs.com/v2/urllists/sample_crawl_list
115
+ body:
116
+ encoding: US-ASCII
117
+ string: ''
118
+ headers:
119
+ Content-Type:
120
+ - application/json
121
+ User-Agent:
122
+ - Faraday v0.9.2
123
+ Accept-Encoding:
124
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
125
+ Accept:
126
+ - "*/*"
127
+ response:
128
+ status:
129
+ code: 204
130
+ message: No Content
131
+ headers:
132
+ Content-Length:
133
+ - '0'
134
+ Content-Type:
135
+ - application/octet-stream
136
+ Date:
137
+ - Sat, 12 Dec 2015 18:15:08 GMT
138
+ Server:
139
+ - Cowboy
140
+ Connection:
141
+ - keep-alive
142
+ body:
143
+ encoding: UTF-8
144
+ string: ''
145
+ http_version:
146
+ recorded_at: Sat, 12 Dec 2015 18:15:15 GMT
147
+ recorded_with: VCR 3.0.0
@@ -0,0 +1,147 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://<TOKEN>:@api.80legs.com/v2/urllists/sample_crawl_list
6
+ body:
7
+ encoding: UTF-8
8
+ string: |
9
+ [
10
+ "http://example.com",
11
+ "https://example.org"
12
+ ]
13
+ headers:
14
+ Content-Type:
15
+ - application/octet-stream
16
+ User-Agent:
17
+ - Faraday v0.9.2
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ Accept:
21
+ - "*/*"
22
+ response:
23
+ status:
24
+ code: 204
25
+ message: No Content
26
+ headers:
27
+ Content-Length:
28
+ - '0'
29
+ Content-Type:
30
+ - application/octet-stream
31
+ Date:
32
+ - Sat, 12 Dec 2015 18:11:13 GMT
33
+ Server:
34
+ - Cowboy
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: UTF-8
39
+ string: ''
40
+ http_version:
41
+ recorded_at: Sat, 12 Dec 2015 18:11:19 GMT
42
+ - request:
43
+ method: post
44
+ uri: https://<TOKEN>:@api.80legs.com/v2/crawls/testing_crawl_start
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"app":"HeaderData.js","urllist":"sample_crawl_list","max_depth":1,"max_urls":10}'
48
+ headers:
49
+ Content-Type:
50
+ - application/json
51
+ User-Agent:
52
+ - Faraday v0.9.2
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: 204
60
+ message: No Content
61
+ headers:
62
+ Content-Length:
63
+ - '0'
64
+ Content-Type:
65
+ - application/json
66
+ Date:
67
+ - Sat, 12 Dec 2015 18:11:13 GMT
68
+ Server:
69
+ - Cowboy
70
+ Connection:
71
+ - keep-alive
72
+ body:
73
+ encoding: UTF-8
74
+ string: ''
75
+ http_version:
76
+ recorded_at: Sat, 12 Dec 2015 18:11:19 GMT
77
+ - request:
78
+ method: delete
79
+ uri: https://<TOKEN>:@api.80legs.com/v2/urllists/sample_crawl_list
80
+ body:
81
+ encoding: US-ASCII
82
+ string: ''
83
+ headers:
84
+ Content-Type:
85
+ - application/json
86
+ User-Agent:
87
+ - Faraday v0.9.2
88
+ Accept-Encoding:
89
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
90
+ Accept:
91
+ - "*/*"
92
+ response:
93
+ status:
94
+ code: 204
95
+ message: No Content
96
+ headers:
97
+ Content-Length:
98
+ - '0'
99
+ Content-Type:
100
+ - application/octet-stream
101
+ Date:
102
+ - Sat, 12 Dec 2015 18:11:14 GMT
103
+ Server:
104
+ - Cowboy
105
+ Connection:
106
+ - keep-alive
107
+ body:
108
+ encoding: UTF-8
109
+ string: ''
110
+ http_version:
111
+ recorded_at: Sat, 12 Dec 2015 18:11:20 GMT
112
+ - request:
113
+ method: delete
114
+ uri: https://<TOKEN>:@api.80legs.com/v2/crawls/testing_crawl_start
115
+ body:
116
+ encoding: US-ASCII
117
+ string: ''
118
+ headers:
119
+ Content-Type:
120
+ - application/json
121
+ User-Agent:
122
+ - Faraday v0.9.2
123
+ Accept-Encoding:
124
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
125
+ Accept:
126
+ - "*/*"
127
+ response:
128
+ status:
129
+ code: 204
130
+ message: No Content
131
+ headers:
132
+ Content-Length:
133
+ - '0'
134
+ Content-Type:
135
+ - application/json
136
+ Date:
137
+ - Sat, 12 Dec 2015 18:11:14 GMT
138
+ Server:
139
+ - Cowboy
140
+ Connection:
141
+ - keep-alive
142
+ body:
143
+ encoding: UTF-8
144
+ string: ''
145
+ http_version:
146
+ recorded_at: Sat, 12 Dec 2015 18:11:20 GMT
147
+ recorded_with: VCR 3.0.0
@@ -0,0 +1,183 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://<TOKEN>:@api.80legs.com/v2/urllists/sample_crawl_list
6
+ body:
7
+ encoding: UTF-8
8
+ string: |
9
+ [
10
+ "http://example.com",
11
+ "https://example.org"
12
+ ]
13
+ headers:
14
+ Content-Type:
15
+ - application/octet-stream
16
+ User-Agent:
17
+ - Faraday v0.9.2
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ Accept:
21
+ - "*/*"
22
+ response:
23
+ status:
24
+ code: 204
25
+ message: No Content
26
+ headers:
27
+ Content-Length:
28
+ - '0'
29
+ Content-Type:
30
+ - application/octet-stream
31
+ Date:
32
+ - Sat, 12 Dec 2015 18:13:10 GMT
33
+ Server:
34
+ - Cowboy
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: UTF-8
39
+ string: ''
40
+ http_version:
41
+ recorded_at: Sat, 12 Dec 2015 18:13:16 GMT
42
+ - request:
43
+ method: post
44
+ uri: https://<TOKEN>:@api.80legs.com/v2/crawls/testing_crawl_status
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"app":"HeaderData.js","urllist":"sample_crawl_list","max_depth":1,"max_urls":10}'
48
+ headers:
49
+ Content-Type:
50
+ - application/json
51
+ User-Agent:
52
+ - Faraday v0.9.2
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: 204
60
+ message: No Content
61
+ headers:
62
+ Content-Length:
63
+ - '0'
64
+ Content-Type:
65
+ - application/json
66
+ Date:
67
+ - Sat, 12 Dec 2015 18:13:11 GMT
68
+ Server:
69
+ - Cowboy
70
+ Connection:
71
+ - keep-alive
72
+ body:
73
+ encoding: UTF-8
74
+ string: ''
75
+ http_version:
76
+ recorded_at: Sat, 12 Dec 2015 18:13:17 GMT
77
+ - request:
78
+ method: get
79
+ uri: https://<TOKEN>:@api.80legs.com/v2/crawls/testing_crawl_status
80
+ body:
81
+ encoding: US-ASCII
82
+ string: ''
83
+ headers:
84
+ Content-Type:
85
+ - application/json
86
+ User-Agent:
87
+ - Faraday v0.9.2
88
+ Accept-Encoding:
89
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
90
+ Accept:
91
+ - "*/*"
92
+ response:
93
+ status:
94
+ code: 200
95
+ message: OK
96
+ headers:
97
+ Content-Type:
98
+ - application/json
99
+ Date:
100
+ - Sat, 12 Dec 2015 18:13:11 GMT
101
+ Server:
102
+ - Cowboy
103
+ Content-Length:
104
+ - '318'
105
+ Connection:
106
+ - keep-alive
107
+ body:
108
+ encoding: UTF-8
109
+ string: '{"id":167834,"name":"testing_crawl_status","user":"<TOKEN>","user_agent":"voltron","app":"HeaderData.js","urllist":"sample_crawl_list","data":"","max_depth":1,"max_urls":10,"status":"QUEUED","depth":0,"urls_crawled":0,"date_created":"2015-12-12
110
+ 18:13:11","date_completed":"","date_started":""}'
111
+ http_version:
112
+ recorded_at: Sat, 12 Dec 2015 18:13:17 GMT
113
+ - request:
114
+ method: delete
115
+ uri: https://<TOKEN>:@api.80legs.com/v2/urllists/sample_crawl_list
116
+ body:
117
+ encoding: US-ASCII
118
+ string: ''
119
+ headers:
120
+ Content-Type:
121
+ - application/json
122
+ User-Agent:
123
+ - Faraday v0.9.2
124
+ Accept-Encoding:
125
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
126
+ Accept:
127
+ - "*/*"
128
+ response:
129
+ status:
130
+ code: 204
131
+ message: No Content
132
+ headers:
133
+ Content-Length:
134
+ - '0'
135
+ Content-Type:
136
+ - application/octet-stream
137
+ Date:
138
+ - Sat, 12 Dec 2015 18:13:12 GMT
139
+ Server:
140
+ - Cowboy
141
+ Connection:
142
+ - keep-alive
143
+ body:
144
+ encoding: UTF-8
145
+ string: ''
146
+ http_version:
147
+ recorded_at: Sat, 12 Dec 2015 18:13:18 GMT
148
+ - request:
149
+ method: delete
150
+ uri: https://<TOKEN>:@api.80legs.com/v2/crawls/testing_crawl_status
151
+ body:
152
+ encoding: US-ASCII
153
+ string: ''
154
+ headers:
155
+ Content-Type:
156
+ - application/json
157
+ User-Agent:
158
+ - Faraday v0.9.2
159
+ Accept-Encoding:
160
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
161
+ Accept:
162
+ - "*/*"
163
+ response:
164
+ status:
165
+ code: 204
166
+ message: No Content
167
+ headers:
168
+ Content-Length:
169
+ - '0'
170
+ Content-Type:
171
+ - application/json
172
+ Date:
173
+ - Sat, 12 Dec 2015 18:13:12 GMT
174
+ Server:
175
+ - Cowboy
176
+ Connection:
177
+ - keep-alive
178
+ body:
179
+ encoding: UTF-8
180
+ string: ''
181
+ http_version:
182
+ recorded_at: Sat, 12 Dec 2015 18:13:18 GMT
183
+ recorded_with: VCR 3.0.0