99designs-tasks 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/99designs/tasks/api_client.rb +11 -2
- data/lib/99designs/tasks/version.rb +1 -1
- data/spec/api_client_spec.rb +9 -0
- data/spec/cassettes/my_tasks.yml +50 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f814c3ca6ec3e306eb2ea0813445a59265b6123
|
4
|
+
data.tar.gz: 610603baa5b0846aeeb9e5480de9533c238e7ba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 813c0043221410cd8b100d5a6bc1fcd8dc2f8ed459cad52d4ed3cfd147bad970edff3fb65b09b78b9cd57c0e1b4e4169b56203b3d1f9e3995a67ebc019ba458c
|
7
|
+
data.tar.gz: 33fc314a103ca3de6b7bb8aca78eb1558cd6c7abc60996b69c48517c1c4bbaa97913c95c94cace911f063f4a93ca2d47d167963254804f63c3616ea3815c7848
|
@@ -29,6 +29,13 @@ module NinetyNine
|
|
29
29
|
interpret_response(response)
|
30
30
|
end
|
31
31
|
|
32
|
+
def my_tasks(external_id: nil, page: nil, per_page: nil)
|
33
|
+
params = { external_id: external_id, page: page, per_page: per_page }.delete_if { |k, v| v.nil? }
|
34
|
+
response = request :get, "tasks", nil, params: params
|
35
|
+
|
36
|
+
interpret_response(response)
|
37
|
+
end
|
38
|
+
|
32
39
|
def update_task(task_id, params)
|
33
40
|
response = request :put,"tasks/#{task_id}", { body: params[:body] }
|
34
41
|
|
@@ -68,8 +75,10 @@ module NinetyNine
|
|
68
75
|
|
69
76
|
private
|
70
77
|
|
71
|
-
def request(method, path, body, headers: {})
|
72
|
-
@conn.run_request(method, path, body, headers)
|
78
|
+
def request(method, path, body, headers: {}, params: nil)
|
79
|
+
@conn.run_request(method, path, body, headers) do |request|
|
80
|
+
request.params.update(params) if params
|
81
|
+
end
|
73
82
|
end
|
74
83
|
|
75
84
|
def interpret_response(response)
|
data/spec/api_client_spec.rb
CHANGED
@@ -54,6 +54,15 @@ describe NinetyNine::Tasks::ApiClient do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
it "gets a list of my tasks" do
|
58
|
+
VCR.use_cassette('my_tasks') do
|
59
|
+
api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
|
60
|
+
|
61
|
+
task = api.my_tasks(page: 2, per_page: 1)
|
62
|
+
expect(task[:items]).not_to be_empty
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
57
66
|
it "raises NotFoundError when taskid doesnt exist" do
|
58
67
|
VCR.use_cassette('task_not_found') do
|
59
68
|
api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://xyzzy:@api.99designs.com.dockervm:49881/tasks/v1/tasks?page=2&per_page=1
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
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
|
+
Server:
|
22
|
+
- nginx/1.4.6 (Ubuntu)
|
23
|
+
Content-Type:
|
24
|
+
- application/json
|
25
|
+
Transfer-Encoding:
|
26
|
+
- chunked
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
Vary:
|
30
|
+
- Accept-Encoding
|
31
|
+
Cache-Control:
|
32
|
+
- no-cache
|
33
|
+
- no-transform
|
34
|
+
Date:
|
35
|
+
- Wed, 10 Jun 2015 06:01:19 GMT
|
36
|
+
Access-Control-Allow-Methods:
|
37
|
+
- OPTIONS, GET, PUT, POST, DELETE
|
38
|
+
Access-Control-Allow-Headers:
|
39
|
+
- Authorization
|
40
|
+
X-Debug-Token:
|
41
|
+
- ff1d69
|
42
|
+
body:
|
43
|
+
encoding: UTF-8
|
44
|
+
string: "{\"items\":[{\"id\":\"bbc5a75456722111f2a349852a05c156\",\"state\":{\"code\":\"in_progress\",\"text\":\"In
|
45
|
+
progress\"},\"body\":\"hello\",\"attachments\":[{\"id\":11,\"filename\":\"llama.png\",\"filesize\":51977,\"filetype\":\"image\\/png\",\"source\":\"https:\\/\\/d15rdjgfy8kdl5.cloudfront.net\\/tasks\\/5\\/attachments\\/8586dc6a4730395d504012bd88da7c0b4c7f53827732792b9db5e61b883cf8f8\\/0\\/llama.png\",\"thumbnail\":\"https:\\/\\/d164sa0ywdqq7k.cloudfront.net\\/a9c2a8c3b7649bd8230127997f09459e.preview.png\",\"links\":[{\"rel\":\"delete_attachment\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/bbc5a75456722111f2a349852a05c156\\/attachments\\/11\",\"method\":\"POST\"}]}],\"currentdesigner\":{\"displayname\":\"dev\",\"avatarurl\":\"https:\\/\\/d8u1nmttd4enu.cloudfront.net\\/users\\/1350010\\/avatar\"},\"externalid\":null,\"timeline\":[{\"type\":\"delivery\",\"timecreated\":1427778814,\"id\":1,\"author\":{\"displayname\":\"asdfasd\",\"avatarurl\":\"https:\\/\\/d8u1nmttd4enu.cloudfront.net\\/users\\/1350009\\/avatar\",\"iscustomer\":false},\"state\":{\"code\":\"requestedrevision\",\"text\":\"Revision
|
46
|
+
requested\"},\"comment\":\"hello\",\"attachments\":[{\"id\":1,\"filename\":\"llama.png\",\"filesize\":51977,\"filetype\":\"image\\/png\",\"source\":\"https:\\/\\/d15rdjgfy8kdl5.cloudfront.net\\/tasks\\/5\\/deliveries\\/1\\/adcb8b3903571ba5fd0075a0cfa5869d9d3c324be507d371d630b2eeca854d58\\/0\\/llama.png\",\"thumbnail\":\"https:\\/\\/d164sa0ywdqq7k.cloudfront.net\\/ca49ca12c80de845e434603911f2d363.preview.png\",\"links\":[]}],\"links\":[]},{\"type\":\"revision_request\",\"timecreated\":1427778835,\"author\":{\"iscustomer\":true},\"deliveryid\":1,\"revisiontype\":{\"code\":\"badattachments\",\"text\":\"There\\u0027s
|
47
|
+
a problem with the attachments.\"},\"comment\":\"cool\"},{\"type\":\"comment\",\"timecreated\":1427778841,\"author\":{\"iscustomer\":true},\"comment\":\"hello\"},{\"type\":\"comment\",\"timecreated\":1427780795,\"author\":{\"displayname\":\"asdfasd\",\"avatarurl\":\"https:\\/\\/d8u1nmttd4enu.cloudfront.net\\/users\\/1350009\\/avatar\",\"iscustomer\":false},\"comment\":\"Heya\"}],\"links\":[{\"rel\":\"update_task\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/bbc5a75456722111f2a349852a05c156\",\"method\":\"PUT\"},{\"rel\":\"attach_files\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/bbc5a75456722111f2a349852a05c156\\/attachments\",\"method\":\"POST\"},{\"rel\":\"post_comment\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/bbc5a75456722111f2a349852a05c156\\/comment\",\"method\":\"POST\"},{\"rel\":\"self\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/bbc5a75456722111f2a349852a05c156\",\"method\":\"GET\"}]}],\"links\":[{\"rel\":\"self\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks?page=2\\u0026per_page=1\",\"method\":\"GET\"},{\"rel\":\"first\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks?page=1\\u0026per_page=1\",\"method\":\"GET\"},{\"rel\":\"prev\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks?page=1\\u0026per_page=1\",\"method\":\"GET\"},{\"rel\":\"next\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks?page=3\\u0026per_page=1\",\"method\":\"GET\"},{\"rel\":\"last\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks?page=148\\u0026per_page=1\",\"method\":\"GET\"}]}"
|
48
|
+
http_version:
|
49
|
+
recorded_at: Wed, 10 Jun 2015 06:01:19 GMT
|
50
|
+
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: 99designs-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Hotson
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- spec/cassettes/create_task_no_credits.yml
|
157
157
|
- spec/cassettes/delete_attachment.yml
|
158
158
|
- spec/cassettes/get_task.yml
|
159
|
+
- spec/cassettes/my_tasks.yml
|
159
160
|
- spec/cassettes/post_comment.yml
|
160
161
|
- spec/cassettes/request_revision.yml
|
161
162
|
- spec/cassettes/request_revision_approve_delivery.yml
|
@@ -199,6 +200,7 @@ test_files:
|
|
199
200
|
- spec/cassettes/create_task_no_credits.yml
|
200
201
|
- spec/cassettes/delete_attachment.yml
|
201
202
|
- spec/cassettes/get_task.yml
|
203
|
+
- spec/cassettes/my_tasks.yml
|
202
204
|
- spec/cassettes/post_comment.yml
|
203
205
|
- spec/cassettes/request_revision.yml
|
204
206
|
- spec/cassettes/request_revision_approve_delivery.yml
|