99designs-tasks 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 (38) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/99designs-tasks.gemspec +30 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +37 -0
  9. data/Rakefile +7 -0
  10. data/lib/99designs/errors/api_error.rb +4 -0
  11. data/lib/99designs/errors/authentication_error.rb +4 -0
  12. data/lib/99designs/errors/base_error.rb +15 -0
  13. data/lib/99designs/errors/invalid_state_error.rb +4 -0
  14. data/lib/99designs/errors/not_found_error.rb +4 -0
  15. data/lib/99designs/errors/payment_error.rb +4 -0
  16. data/lib/99designs/errors/validation_error.rb +7 -0
  17. data/lib/99designs/tasks/api_client.rb +133 -0
  18. data/lib/99designs/tasks/version.rb +5 -0
  19. data/lib/99designs/tasks.rb +10 -0
  20. data/spec/api_client_spec.rb +144 -0
  21. data/spec/cassettes/approve_delivery.yml +45 -0
  22. data/spec/cassettes/attach_files.yml +91 -0
  23. data/spec/cassettes/create_task.yml +60 -0
  24. data/spec/cassettes/create_task_blank_body.yml +47 -0
  25. data/spec/cassettes/create_task_invalid_apikey.yml +48 -0
  26. data/spec/cassettes/create_task_no_credits.yml +46 -0
  27. data/spec/cassettes/delete_attachment.yml +127 -0
  28. data/spec/cassettes/get_task.yml +45 -0
  29. data/spec/cassettes/post_comment.yml +45 -0
  30. data/spec/cassettes/request_revision.yml +45 -0
  31. data/spec/cassettes/request_revision_approve_delivery.yml +46 -0
  32. data/spec/cassettes/server_having_problems.yml +121 -0
  33. data/spec/cassettes/task_not_found.yml +46 -0
  34. data/spec/cassettes/update_task.yml +87 -0
  35. data/spec/spec_helper.rb +91 -0
  36. data/spec/support/sample.txt +1 -0
  37. data/spec/support/vcr.rb +10 -0
  38. metadata +210 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8194a33ea6e40490dc91612503be45a0dcb8c999
4
+ data.tar.gz: 1f95cc4cc33895bb8af4cb85fc198bf8d6f9d780
5
+ SHA512:
6
+ metadata.gz: 0ed8394be3f0b01ce143f9206e91df55cc6c5cac4eeb3367f759855fc2b724d9579e2d431c43b7859c9118f6249441e6efaa6ddd8d59ff3f931c759622645fc8
7
+ data.tar.gz: 1387aebfef81ea528c93ad4b0b62f6300bbb838abf56238abb507f426781285b9d0d5e623a0ada4441a965fd77064c6733080eb48a2eae7cc2679c92d4e24368
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ nguage: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1
5
+ - 2.2
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require '99designs/tasks/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "99designs-tasks"
8
+ spec.version = NinetyNine::Tasks::VERSION
9
+ spec.authors = ["Dennis Hotson"]
10
+ spec.email = ["dennis@99designs.com"]
11
+ spec.summary = %q{99designs Tasks API client}
12
+ spec.description = %q{99designs Tasks API client}
13
+ spec.homepage = "https://github.com/99designs/tasks-api-ruby"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "faraday", "~> 0.8"
22
+ spec.add_runtime_dependency "faraday_middleware"
23
+ spec.add_runtime_dependency "mime-types"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.6"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "rspec"
28
+ spec.add_development_dependency "vcr"
29
+ spec.add_development_dependency "webmock"
30
+ end
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in 99designs-tasks.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Dennis Hotson
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # 99designs Tasks
2
+
3
+ 99designs Tasks API client for Ruby
4
+
5
+ [![Build Status](https://travis-ci.org/99designs/tasks-api-ruby.svg)](https://travis-ci.org/99designs/tasks-api-ruby)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem '99designs-tasks'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install 99designs-tasks
20
+
21
+ ## Usage
22
+
23
+ Simple usage looks like:
24
+
25
+ ```ruby
26
+ require '99designs/tasks'
27
+ api = NinetyNine::ApiClient.new('yourapikey')
28
+ task = api.create_task body: 'hello', filenames: ['/path/to/file.pdf'], urls: ['http://example.org/file.png']
29
+ ```
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it ( https://github.com/[my-github-username]/99designs-tasks/fork )
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
@@ -0,0 +1,4 @@
1
+ module NinetyNine
2
+ class ApiError < BaseError
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module NinetyNine
2
+ class AuthenticationError < BaseError
3
+ end
4
+ end
@@ -0,0 +1,15 @@
1
+ module NinetyNine
2
+ class BaseError < StandardError
3
+ def initialize(message=nil, http_status=nil, http_body=nil, json_body=nil)
4
+ @message = message
5
+ @http_status = http_status
6
+ @http_body = http_body
7
+ @json_body = json_body
8
+ end
9
+
10
+ def to_s
11
+ status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
12
+ "#{status_string}#{@message}"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ module NinetyNine
2
+ class InvalidStateError < BaseError
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module NinetyNine
2
+ class NotFoundError < BaseError
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module NinetyNine
2
+ class PaymentError < BaseError
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module NinetyNine
2
+ class ValidationError < BaseError
3
+ def errors
4
+ @json_body['errors']
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,133 @@
1
+ require 'faraday'
2
+ require 'faraday_middleware'
3
+ require 'mime/types'
4
+ require 'json'
5
+
6
+ module NinetyNine
7
+ module Tasks
8
+ class ApiClient
9
+ def initialize(apikey, base_url: 'https://api.99designs.com/tasks/v1')
10
+ @apikey = apikey
11
+ @conn = Faraday.new(base_url) do |f|
12
+ f.basic_auth apikey, ''
13
+ f.request :multipart
14
+ f.request :url_encoded
15
+ # f.response :logger # DELETEME
16
+ f.adapter Faraday.default_adapter
17
+ end
18
+ end
19
+
20
+ def create_task(body: nil, urls: [], filenames: [], webhook_url: nil)
21
+ response = request :post, "tasks", { body: body, file: files(urls, filenames), webhook_url: webhook_url }
22
+
23
+ interpret_response(response)
24
+ end
25
+
26
+ def get_task(task_id)
27
+ response = request :get, "tasks/#{task_id}", nil
28
+
29
+ interpret_response(response)
30
+ end
31
+
32
+ def update_task(task_id, params)
33
+ response = request :put,"tasks/#{task_id}", { body: params[:body] }
34
+
35
+ interpret_response(response)
36
+ end
37
+
38
+ def attach_files(task_id, urls: [], filenames: [])
39
+ response = request :post, "tasks/#{task_id}/attachments", { file: files(urls, filenames) }
40
+
41
+ interpret_response(response)
42
+ end
43
+
44
+ def delete_attachment(task_id, attachment_id)
45
+ response = request :delete, "tasks/#{task_id}/attachments/#{attachment_id}", nil
46
+
47
+ interpret_response(response)
48
+ end
49
+
50
+ def post_comment(task_id, comment)
51
+ response = request :post, "tasks/#{task_id}/comment", { comment: comment }
52
+
53
+ interpret_response(response)
54
+ end
55
+
56
+ def request_revision(task_id, delivery_id, type, reason)
57
+ response = request :post, "tasks/#{task_id}/deliveries/#{delivery_id}/request_revision", { type: type, reason: reason }
58
+
59
+ interpret_response(response)
60
+ end
61
+
62
+ def approve_delivery(task_id, delivery_id)
63
+ response = request :post, "tasks/#{task_id}/deliveries/#{delivery_id}/approve", nil
64
+
65
+ interpret_response(response)
66
+ end
67
+
68
+
69
+ private
70
+
71
+ def request(method, path, body, headers: {})
72
+ @conn.run_request(method, path, body, headers)
73
+ end
74
+
75
+ def interpret_response(response)
76
+ status = response.status
77
+ body = response.body
78
+
79
+ begin
80
+ json = JSON.parse(body, symbolize_names: true) if body != ''
81
+ rescue JSON::ParserError
82
+ raise NinetyNine::ApiError.new("Unexpected response: \"#{body}\" (http status: #{status})", status, body, nil)
83
+ end
84
+
85
+ if response_ok?(status)
86
+ return json
87
+ else
88
+ raise error_for_response(status, body, json)
89
+ end
90
+ end
91
+
92
+ def response_ok?(status)
93
+ (200..299).include?(status)
94
+ end
95
+
96
+ def error_for_response(status, body, json)
97
+ case status
98
+ when 400
99
+ NinetyNine::ValidationError.new(json['message'], status, body, json)
100
+ when 401
101
+ NinetyNine::AuthenticationError.new(json['message'], status, body, json)
102
+ when 402
103
+ NinetyNine::PaymentError.new(json['message'], status, body, json)
104
+ when 404
105
+ NinetyNine::NotFoundError.new(json['message'], status, body, json)
106
+ when 422
107
+ NinetyNine::InvalidStateError.new(json['message'], status, body, json)
108
+ else
109
+ NinetyNine::ApiError.new(json['message'] || "Unexpected error: \"#{body}\" (http status: #{status})", status, body, json)
110
+ end
111
+ end
112
+
113
+ def files(urls, filenames)
114
+ uploads = filenames.map do |filename|
115
+ Faraday::UploadIO.new(filename, content_type(filename))
116
+ end
117
+
118
+ urls + uploads
119
+ end
120
+
121
+ def content_type(filename)
122
+ types = MIME::Types.type_for(filename)
123
+
124
+ if types.empty?
125
+ 'application/octet-stream'
126
+ else
127
+ types.first.content_type
128
+ end
129
+ end
130
+
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,5 @@
1
+ module NinetyNine
2
+ module Tasks
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ require "99designs/tasks/version"
2
+ require "99designs/tasks/api_client"
3
+
4
+ require "99designs/errors/base_error"
5
+ require "99designs/errors/api_error"
6
+ require "99designs/errors/validation_error"
7
+ require "99designs/errors/authentication_error"
8
+ require "99designs/errors/payment_error"
9
+ require "99designs/errors/not_found_error"
10
+ require "99designs/errors/invalid_state_error"
@@ -0,0 +1,144 @@
1
+ require '99designs/tasks'
2
+ require 'support/vcr'
3
+
4
+ describe NinetyNine::Tasks::ApiClient do
5
+ it "creates a task" do
6
+ VCR.use_cassette('create_task') do
7
+
8
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
9
+
10
+ task = api.create_task body: 'hello', urls: ['http://dn.ht/money.svg'], filenames: ['spec/support/sample.txt']
11
+
12
+ expect(task[:body]).to match('hello')
13
+ end
14
+ end
15
+
16
+ it "should raise AuthenticationError when apikey is incorrect" do
17
+ VCR.use_cassette('create_task_invalid_apikey') do
18
+
19
+ api = NinetyNine::Tasks::ApiClient.new('fakeapikey', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
20
+
21
+ expect {
22
+ api.create_task body: 'hello', urls: ['http://dn.ht/money.svg']
23
+ }.to raise_error(NinetyNine::AuthenticationError)
24
+ end
25
+ end
26
+
27
+ it "should raise ValidationError when body is blank" do
28
+ VCR.use_cassette('create_task_blank_body') do
29
+
30
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
31
+
32
+ expect {
33
+ api.create_task body: '', urls: ['http://dn.ht/money.svg']
34
+ }.to raise_error(NinetyNine::ValidationError)
35
+ end
36
+ end
37
+
38
+ it "should raise PaymentError when user is out of credits" do
39
+ VCR.use_cassette('create_task_no_credits') do
40
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
41
+
42
+ expect {
43
+ api.create_task body: 'hello', urls: ['http://dn.ht/money.svg']
44
+ }.to raise_error(NinetyNine::PaymentError)
45
+ end
46
+ end
47
+
48
+ it "gets a task" do
49
+ VCR.use_cassette('get_task') do
50
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
51
+
52
+ task = api.get_task('84cc6f1d34d60f14d42389a0ae92740a')
53
+ expect(task[:body]).to match('hello')
54
+ end
55
+ end
56
+
57
+ it "raises NotFoundError when taskid doesnt exist" do
58
+ VCR.use_cassette('task_not_found') do
59
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
60
+
61
+ expect {
62
+ api.get_task('fakeade6a144db4cdf680d89251bd7e2594c10b6')
63
+ }.to raise_error(NinetyNine::NotFoundError)
64
+ end
65
+ end
66
+
67
+ it "updates a task" do
68
+ VCR.use_cassette('update_task') do
69
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
70
+
71
+ api.update_task('84cc6f1d34d60f14d42389a0ae92740a', body: 'updated')
72
+ task = api.get_task('84cc6f1d34d60f14d42389a0ae92740a')
73
+ expect(task[:body]).to match('updated')
74
+ end
75
+ end
76
+
77
+ it "attaches files" do
78
+ VCR.use_cassette('attach_files') do
79
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
80
+
81
+ api.attach_files('84cc6f1d34d60f14d42389a0ae92740a', urls: ['http://dn.ht/money.svg'], filenames: ['spec/support/sample.txt'])
82
+ task = api.get_task('84cc6f1d34d60f14d42389a0ae92740a')
83
+ expect(task[:attachments].length).to match(4)
84
+ end
85
+ end
86
+
87
+ it "deletes an attachment" do
88
+ VCR.use_cassette('delete_attachment') do
89
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
90
+
91
+ task = api.get_task('84cc6f1d34d60f14d42389a0ae92740a')
92
+ api.delete_attachment('84cc6f1d34d60f14d42389a0ae92740a', task[:attachments][0][:id])
93
+ task = api.get_task('84cc6f1d34d60f14d42389a0ae92740a')
94
+ expect(task[:attachments].length).to match(3)
95
+ end
96
+ end
97
+
98
+ it "posts a comment" do
99
+ VCR.use_cassette('post_comment') do
100
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
101
+
102
+ api.post_comment('84cc6f1d34d60f14d42389a0ae92740a', 'hello')
103
+ end
104
+ end
105
+
106
+ it "requests a revision" do
107
+ VCR.use_cassette('request_revision') do
108
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
109
+
110
+ api.request_revision('84cc6f1d34d60f14d42389a0ae92740a', 13, 'other', 'Can I have it in pdf too please?')
111
+ end
112
+ end
113
+
114
+ it "approves a delivery" do
115
+ VCR.use_cassette('approve_delivery') do
116
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
117
+
118
+ api.approve_delivery('84cc6f1d34d60f14d42389a0ae92740a', 14)
119
+ end
120
+ end
121
+
122
+ it "raises InvalidStateError when requesting revision on approved delivery" do
123
+ VCR.use_cassette('request_revision_approve_delivery') do
124
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
125
+
126
+ expect {
127
+ api.request_revision('84cc6f1d34d60f14d42389a0ae92740a', 14, 'other', 'Is this too late?')
128
+ }.to raise_error(NinetyNine::InvalidStateError)
129
+ end
130
+ end
131
+
132
+ it "raises generic ApiError when server returns internal server error" do
133
+ VCR.use_cassette('server_having_problems') do
134
+ api = NinetyNine::Tasks::ApiClient.new('xyzzy', base_url: 'http://api.99designs.com.dockervm:49881/tasks/v1')
135
+
136
+ expect {
137
+ api.get_task('84cc6f1d34d60f14d42389a0ae92740a')
138
+ }.to raise_error(NinetyNine::ApiError)
139
+ end
140
+ end
141
+
142
+
143
+
144
+ end
@@ -0,0 +1,45 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://xyzzy:@api.99designs.com.dockervm:49881/tasks/v1/tasks/84cc6f1d34d60f14d42389a0ae92740a/deliveries/14/approve
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Length:
13
+ - '0'
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: 204
21
+ message: No Content
22
+ headers:
23
+ Server:
24
+ - nginx/1.4.6 (Ubuntu)
25
+ Content-Type:
26
+ - application/json
27
+ Connection:
28
+ - keep-alive
29
+ Cache-Control:
30
+ - no-cache
31
+ - no-transform
32
+ Date:
33
+ - Tue, 26 May 2015 01:32:10 GMT
34
+ Access-Control-Allow-Methods:
35
+ - OPTIONS, GET, PUT, POST, DELETE
36
+ Access-Control-Allow-Headers:
37
+ - Authorization
38
+ X-Debug-Token:
39
+ - ffbb00
40
+ body:
41
+ encoding: UTF-8
42
+ string: ''
43
+ http_version:
44
+ recorded_at: Tue, 26 May 2015 01:32:10 GMT
45
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,91 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://xyzzy:@api.99designs.com.dockervm:49881/tasks/v1/tasks/84cc6f1d34d60f14d42389a0ae92740a/attachments
6
+ body:
7
+ encoding: UTF-8
8
+ string: "-------------RubyMultipartPost\r\nContent-Disposition: form-data; name=\"file[]\"\r\n\r\nhttp://dn.ht/money.svg\r\n-------------RubyMultipartPost\r\nContent-Disposition:
9
+ form-data; name=\"file[]\"; filename=\"sample.txt\"\r\nContent-Length: 12\r\nContent-Type:
10
+ text/plain\r\nContent-Transfer-Encoding: binary\r\n\r\nhello world\n\r\n-------------RubyMultipartPost--\r\n\r\n"
11
+ headers:
12
+ User-Agent:
13
+ - Faraday v0.9.1
14
+ Content-Type:
15
+ - multipart/form-data; boundary=-----------RubyMultipartPost
16
+ Content-Length:
17
+ - '340'
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
+ Server:
28
+ - nginx/1.4.6 (Ubuntu)
29
+ Content-Type:
30
+ - application/json
31
+ Connection:
32
+ - keep-alive
33
+ Cache-Control:
34
+ - no-cache
35
+ - no-transform
36
+ Date:
37
+ - Tue, 26 May 2015 01:20:17 GMT
38
+ Access-Control-Allow-Methods:
39
+ - OPTIONS, GET, PUT, POST, DELETE
40
+ Access-Control-Allow-Headers:
41
+ - Authorization
42
+ X-Debug-Token:
43
+ - 73bc08
44
+ body:
45
+ encoding: UTF-8
46
+ string: ''
47
+ http_version:
48
+ recorded_at: Tue, 26 May 2015 01:20:16 GMT
49
+ - request:
50
+ method: get
51
+ uri: http://xyzzy:@api.99designs.com.dockervm:49881/tasks/v1/tasks/84cc6f1d34d60f14d42389a0ae92740a
52
+ body:
53
+ encoding: US-ASCII
54
+ string: ''
55
+ headers:
56
+ User-Agent:
57
+ - Faraday v0.9.1
58
+ Accept-Encoding:
59
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
60
+ Accept:
61
+ - "*/*"
62
+ response:
63
+ status:
64
+ code: 200
65
+ message: OK
66
+ headers:
67
+ Server:
68
+ - nginx/1.4.6 (Ubuntu)
69
+ Content-Type:
70
+ - application/vnd.99designs.task+json; profile=http://api.99designs.com.dockervm:49881/tasks/v1/schema#/Task
71
+ Transfer-Encoding:
72
+ - chunked
73
+ Connection:
74
+ - keep-alive
75
+ Cache-Control:
76
+ - no-cache
77
+ - no-transform
78
+ Date:
79
+ - Tue, 26 May 2015 01:20:17 GMT
80
+ Access-Control-Allow-Methods:
81
+ - OPTIONS, GET, PUT, POST, DELETE
82
+ Access-Control-Allow-Headers:
83
+ - Authorization
84
+ X-Debug-Token:
85
+ - 8e27ff
86
+ body:
87
+ encoding: UTF-8
88
+ string: "{\"id\":\"84cc6f1d34d60f14d42389a0ae92740a\",\"state\":{\"code\":\"available\",\"text\":\"Available\"},\"body\":\"updated\",\"attachments\":[{\"id\":193,\"filename\":\"money.svg\",\"filesize\":19039,\"filetype\":\"image\\/svg+xml\",\"source\":\"https:\\/\\/d15rdjgfy8kdl5.cloudfront.net\\/tasks\\/128\\/attachments\\/779318b249ffe555976bda74dc200cbb553ae4a0\\/0\\/money.svg\",\"thumbnail\":null,\"links\":[{\"rel\":\"delete_attachment\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/84cc6f1d34d60f14d42389a0ae92740a\\/attachments\\/193\",\"method\":\"POST\"}]},{\"id\":194,\"filename\":\"sample.txt\",\"filesize\":12,\"filetype\":\"text\\/plain\",\"source\":\"https:\\/\\/d15rdjgfy8kdl5.cloudfront.net\\/tasks\\/128\\/attachments\\/236e2740391c4302e157e804bbde597949b48543\\/0\\/sample.txt\",\"thumbnail\":null,\"links\":[{\"rel\":\"delete_attachment\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/84cc6f1d34d60f14d42389a0ae92740a\\/attachments\\/194\",\"method\":\"POST\"}]},{\"id\":195,\"filename\":\"money.svg\",\"filesize\":19039,\"filetype\":\"image\\/svg+xml\",\"source\":\"https:\\/\\/d15rdjgfy8kdl5.cloudfront.net\\/tasks\\/128\\/attachments\\/170d14123703814358cbf3a57725e4d913f4f176\\/0\\/money.svg\",\"thumbnail\":null,\"links\":[{\"rel\":\"delete_attachment\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/84cc6f1d34d60f14d42389a0ae92740a\\/attachments\\/195\",\"method\":\"POST\"}]},{\"id\":196,\"filename\":\"sample.txt\",\"filesize\":12,\"filetype\":\"text\\/plain\",\"source\":\"https:\\/\\/d15rdjgfy8kdl5.cloudfront.net\\/tasks\\/128\\/attachments\\/626d51f649df9e3b2eae472d2f6cfea5e209d3f7\\/0\\/sample.txt\",\"thumbnail\":null,\"links\":[{\"rel\":\"delete_attachment\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/84cc6f1d34d60f14d42389a0ae92740a\\/attachments\\/196\",\"method\":\"POST\"}]}],\"currentdesigner\":null,\"timeline\":[],\"links\":[{\"rel\":\"update_task\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/84cc6f1d34d60f14d42389a0ae92740a\",\"method\":\"PUT\"},{\"rel\":\"attach_files\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/84cc6f1d34d60f14d42389a0ae92740a\\/attachments\",\"method\":\"POST\"},{\"rel\":\"post_comment\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/84cc6f1d34d60f14d42389a0ae92740a\\/comment\",\"method\":\"POST\"},{\"rel\":\"self\",\"href\":\"http:\\/\\/api.99designs.com.dockervm:49881\\/tasks\\/v1\\/tasks\\/84cc6f1d34d60f14d42389a0ae92740a\",\"method\":\"GET\"}]}"
89
+ http_version:
90
+ recorded_at: Tue, 26 May 2015 01:20:16 GMT
91
+ recorded_with: VCR 2.9.3