taskrabbit 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/.env.example +15 -0
  2. data/.gitignore +1 -0
  3. data/.rvmrc +1 -1
  4. data/CHANGELOG.md +4 -0
  5. data/Gemfile +2 -0
  6. data/lib/taskrabbit.rb +1 -0
  7. data/lib/taskrabbit/api.rb +1 -0
  8. data/lib/taskrabbit/offer.rb +15 -0
  9. data/lib/taskrabbit/smash.rb +17 -2
  10. data/lib/taskrabbit/task.rb +11 -1
  11. data/lib/taskrabbit/version.rb +1 -1
  12. data/spec/spec_helper.rb +8 -4
  13. data/spec/support/cassettes/account/no_user.yml +2 -2
  14. data/spec/support/cassettes/account/properties.yml +46 -27
  15. data/spec/support/cassettes/account/tasks.yml +10 -10
  16. data/spec/support/cassettes/account/with_user.yml +5 -5
  17. data/spec/support/cassettes/cities/all.yml +2 -2
  18. data/spec/support/cassettes/cities/find.yml +2 -2
  19. data/spec/support/cassettes/cities/properties.yml +2 -2
  20. data/spec/support/cassettes/errors/404.yml +28 -356
  21. data/spec/support/cassettes/locations/properties.yml +8 -8
  22. data/spec/support/cassettes/tasks/all.yml +2 -2
  23. data/spec/support/cassettes/tasks/create/default.yml +3 -3
  24. data/spec/support/cassettes/tasks/create/using_account.yml +3 -3
  25. data/spec/support/cassettes/tasks/create/with_invalid_params.yml +3 -3
  26. data/spec/support/cassettes/tasks/create/with_location.yml +3 -3
  27. data/spec/support/cassettes/tasks/create/with_times.yml +45 -0
  28. data/spec/support/cassettes/tasks/create/without_credit_card.yml +2 -2
  29. data/spec/support/cassettes/tasks/create/without_user.yml +2 -2
  30. data/spec/support/cassettes/tasks/delete.yml +6 -6
  31. data/spec/support/cassettes/tasks/find.yml +41 -26
  32. data/spec/support/cassettes/tasks/properties.yml +41 -26
  33. data/spec/support/cassettes/tasks/save.yml +6 -6
  34. data/spec/support/cassettes/tasks/update.yml +6 -6
  35. data/spec/support/cassettes/tasks/with_offers_properties.yml +45 -0
  36. data/spec/support/cassettes/tasks/without_client.yml +27 -23
  37. data/spec/support/cassettes/users/find.yml +61 -23
  38. data/spec/support/cassettes/users/properties.yml +35 -27
  39. data/spec/support/cassettes/users/tasks/all.yml +42 -27
  40. data/spec/taskrabbit/account_spec.rb +10 -10
  41. data/spec/taskrabbit/api_spec.rb +1 -1
  42. data/spec/taskrabbit/city_spec.rb +3 -3
  43. data/spec/taskrabbit/location_spec.rb +1 -1
  44. data/spec/taskrabbit/offer_spec.rb +23 -0
  45. data/spec/taskrabbit/smash_spec.rb +19 -0
  46. data/spec/taskrabbit/task_spec.rb +36 -22
  47. data/spec/taskrabbit/user_spec.rb +10 -10
  48. metadata +11 -3
@@ -0,0 +1,45 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://taskrabbitdev.com:443/api/v1/tasks/52?include[task][]=errors&include[task][]=links&include[task][]=error&include[task][]=id&include[task][]=name&include[task][]=user&include[task][]=runner&include[task][]=runners&include[task][]=named_price&include[task][]=charge_price&include[task][]=cost_in_cents&include[task][]=number_runners_to_fill&include[task][]=state_label&include[task][]=city_id&include[task][]=city&include[task][]=description&include[task][]=private_description&include[task][]=private_runner&include[task][]=virtual&include[task][]=state&include[task][]=assignment_type&include[task][]=complete_by_time&include[task][]=state_changed_at&include[task][]=assign_by_time&include[task][]=location_visits&include[task][]=offers&include[task][]=other_locations_attributes&include[task][]=uploaded_photos_attributes&include[task][]=uploaded_sounds_attributes
6
+ body:
7
+ headers:
8
+ x-client-application:
9
+ - ''
10
+ authorization:
11
+ - OAuth <USER_WITH_CARD>
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ server:
18
+ - nginx/1.0.11
19
+ date:
20
+ - Thu, 13 Sep 2012 00:52:45 GMT
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ status:
24
+ - 200 OK
25
+ set-cookie:
26
+ - current_geo=1053; path=/; expires=Tue, 13-Nov-2012 01:52:45 GMT
27
+ x-runtime:
28
+ - '0.186363'
29
+ content-length:
30
+ - '1245'
31
+ etag:
32
+ - ! '"1bb05d4c694e2dc4ee9b37e66b3175ba"'
33
+ x-ua-compatible:
34
+ - IE=Edge,chrome=1
35
+ cache-control:
36
+ - max-age=0, private, must-revalidate
37
+ body: ! '{"private_runner":false,"links":{"put":"/api/v1/tasks/52","html":"http://s-app1.taskrabbit.com/tasks/house-cleaning-7091","get":"/api/v1/tasks/52","offers":"/api/v1/tasks/52/offers","authenticated":"http://s-app1.taskrabbit.com/go/82d359e524666a2d8b96f6df1fbfcad4a720a0b4fed8c3f0985139a13a4d6433b65f7f05e80360af131d8f9638f8307e035b","delete":"/api/v1/tasks/52"},"charge_price":0,"runners":{"items":[]},"cost_in_cents":0,"id":52,"state_changed_at":1347490579,"assignment_type":"review","description":"I
38
+ need to clean my house","city":{"links":{"get":"/api/v1/cities/3"},"lat":37.77493,"id":1053,"lng":-122.419416,"name":"SF
39
+ Bay Area"},"assign_by_time":1347577200,"name":"House Cleaning","offers":{"items":[{"charge_price":26, "runner_id": 31, "id":7,"created_at":1347493865,"comments":"I
40
+ clean a lot!","state":"sent"}]},"location_visits":{"items":[{"lat":37.7867363,"zip":"94102","id":11,"complete":"213
41
+ Powell Street, San Francisco, CA, San Francisco, CA 94102","partial":"Powell
42
+ Street, San Francisco, CA, San Francisco, CA 94102","location_id":52,"lng":-122.4080542,"city":"San
43
+ Francisco","name":"Home","approximate_radius":0,"address":"213 Powell Street,
44
+ San Francisco, CA","state":"CA"}]},"state_label":"posted","complete_by_time":1347663600,"state":"opened"}'
45
+ http_version: '1.1'
@@ -1,30 +1,34 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: http://localhost:3000/api/v1/tasks?
5
+ uri: https://taskrabbitdev.com:443/api/v1/tasks?include[task][]=errors&include[task][]=links&include[task][]=error&include[task][]=id&include[task][]=name&include[task][]=user&include[task][]=runner&include[task][]=runners&include[task][]=named_price&include[task][]=charge_price&include[task][]=cost_in_cents&include[task][]=number_runners_to_fill&include[task][]=state_label&include[task][]=city_id&include[task][]=city&include[task][]=description&include[task][]=private_description&include[task][]=private_runner&include[task][]=virtual&include[task][]=state&include[task][]=assignment_type&include[task][]=complete_by_time&include[task][]=state_changed_at&include[task][]=assign_by_time&include[task][]=location_visits&include[task][]=offers&include[task][]=other_locations_attributes&include[task][]=uploaded_photos_attributes&include[task][]=uploaded_sounds_attributes
6
6
  body:
7
- headers:
8
- x-client-application:
9
- - ""
10
- authorization:
7
+ headers:
8
+ x-client-application:
9
+ - ''
10
+ authorization:
11
11
  - OAuth
12
- response: !ruby/struct:VCR::Response
13
- status: !ruby/struct:VCR::ResponseStatus
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
14
  code: 403
15
15
  message: Forbidden
16
- headers:
17
- content-type:
16
+ headers:
17
+ server:
18
+ - nginx/1.0.11
19
+ date:
20
+ - Thu, 13 Sep 2012 00:54:52 GMT
21
+ content-type:
18
22
  - application/json; charset=utf-8
19
- x-runtime:
20
- - "628"
21
- server:
22
- - WEBrick/1.3.1 (Ruby/1.8.7/2010-04-19)
23
- date:
24
- - Wed, 02 Nov 2011 02:35:53 GMT
25
- content-length:
26
- - "44"
27
- cache-control:
23
+ status:
24
+ - 403 Forbidden
25
+ x-runtime:
26
+ - '0.021289'
27
+ content-length:
28
+ - '44'
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ cache-control:
28
32
  - no-cache
29
- body: "{\"error\":\"Missing valid client application\"}"
30
- http_version: "1.1"
33
+ body: ! '{"error":"Missing valid client application"}'
34
+ http_version: '1.1'
@@ -1,32 +1,70 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: http://localhost:3000/api/v1/users/49719?
5
+ uri: https://taskrabbitdev.com/api/v1/users/49719?
6
6
  body:
7
- headers:
8
- x-client-application:
9
- - euqmQpzV04GmN1dJTY639PdI7eiSjCjI3lKTkPWn
10
- authorization:
7
+ headers:
8
+ x-client-application:
9
+ - <API_SECRET>
10
+ authorization:
11
11
  - OAuth
12
- response: !ruby/struct:VCR::Response
13
- status: !ruby/struct:VCR::ResponseStatus
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
14
  code: 200
15
15
  message: OK
16
- headers:
17
- etag:
18
- - "\"b17a2574110c83735c6cf13a269251f1\""
19
- content-type:
16
+ headers:
17
+ etag:
18
+ - ! '"b17a2574110c83735c6cf13a269251f1"'
19
+ content-type:
20
20
  - application/json; charset=utf-8
21
- x-runtime:
22
- - "198"
23
- server:
21
+ x-runtime:
22
+ - '198'
23
+ server:
24
24
  - WEBrick/1.3.1 (Ruby/1.8.7/2011-02-18)
25
- date:
25
+ date:
26
26
  - Sat, 17 Mar 2012 23:13:19 GMT
27
- content-length:
28
- - "200"
29
- cache-control:
27
+ content-length:
28
+ - '200'
29
+ cache-control:
30
30
  - private, max-age=0, must-revalidate
31
- body: "{\"id\":49719,\"short_name\":\"John\",\"full_name\":\"John D.\",\"links\":{\"get\":\"/api/v1/users/49719\",\"avatar_url\":\"http://local.taskrabbit.com/images/default_avatars/poster_thumb.png\"},\"display_name\":\"John D.\"}"
32
- http_version: "1.1"
31
+ body: ! '{"id":49719,"short_name":"John","full_name":"John D.","links":{"get":"/api/v1/users/49719","avatar_url":"http://local.taskrabbit.com/images/default_avatars/poster_thumb.png"},"display_name":"John
32
+ D."}'
33
+ http_version: '1.1'
34
+ - !ruby/struct:VCR::HTTPInteraction
35
+ request: !ruby/struct:VCR::Request
36
+ method: :get
37
+ uri: https://taskrabbitdev.com:443/api/v1/users/41?
38
+ body:
39
+ headers:
40
+ x-client-application:
41
+ - <API_SECRET>
42
+ authorization:
43
+ - OAuth
44
+ response: !ruby/struct:VCR::Response
45
+ status: !ruby/struct:VCR::ResponseStatus
46
+ code: 200
47
+ message: OK
48
+ headers:
49
+ server:
50
+ - nginx/1.0.11
51
+ date:
52
+ - Wed, 12 Sep 2012 23:03:43 GMT
53
+ content-type:
54
+ - application/json; charset=utf-8
55
+ status:
56
+ - 200 OK
57
+ x-runtime:
58
+ - '0.078733'
59
+ content-length:
60
+ - '376'
61
+ etag:
62
+ - ! '"c49fc243130e420dca38098f67caa19a"'
63
+ x-ua-compatible:
64
+ - IE=Edge,chrome=1
65
+ cache-control:
66
+ - max-age=0, private, must-revalidate
67
+ body: ! '{"links":{"get":"/api/v1/users/41","avatar_url":"http://s-app1.taskrabbit.com/images/default_avatars/poster_thumb.png"},"friend_code_url":"http://taskrabbit.com/PAL/41","id":41,"short_name":"User
68
+ with no","display_name":"User with no c.","city":{"links":{"get":"/api/v1/cities/3"},"lat":37.77493,"id":1053,"lng":-122.419416,"name":"SF
69
+ Bay Area"},"full_name":"User with no c."}'
70
+ http_version: '1.1'
@@ -1,32 +1,40 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: http://localhost:3000/api/v1/users/49720?
5
+ uri: https://taskrabbitdev.com:443/api/v1/users/40?
6
6
  body:
7
- headers:
8
- x-client-application:
9
- - euqmQpzV04GmN1dJTY639PdI7eiSjCjI3lKTkPWn
10
- authorization:
11
- - OAuth RhyRtRg1bRNyqmdozkY6JJJ3eGDpoRGTm9AXUudp
12
- response: !ruby/struct:VCR::Response
13
- status: !ruby/struct:VCR::ResponseStatus
7
+ headers:
8
+ x-client-application:
9
+ - <API_SECRET>
10
+ authorization:
11
+ - OAuth <USER_WITH_CARD>
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
14
  code: 200
15
15
  message: OK
16
- headers:
17
- etag:
18
- - "\"d6539897f406d89d093ac69eadc07e59\""
19
- content-type:
16
+ headers:
17
+ server:
18
+ - nginx/1.0.11
19
+ date:
20
+ - Wed, 12 Sep 2012 23:03:42 GMT
21
+ content-type:
20
22
  - application/json; charset=utf-8
21
- x-runtime:
22
- - "644"
23
- server:
24
- - WEBrick/1.3.1 (Ruby/1.8.7/2011-02-18)
25
- date:
26
- - Sat, 17 Mar 2012 23:13:18 GMT
27
- content-length:
28
- - "397"
29
- cache-control:
30
- - private, max-age=0, must-revalidate
31
- body: "{\"city\":{\"name\":\"SF Bay Area\",\"lng\":-122.419416,\"id\":3,\"links\":{\"get\":\"/api/v1/cities/3\"},\"lat\":37.77493},\"zip_code\":\"64321\",\"id\":49720,\"short_name\":\"Bob\",\"full_name\":\"Bob Sponge\",\"last_name\":\"Sponge\",\"links\":{\"get\":\"/api/v1/users/49720\",\"avatar_url\":\"http://local.taskrabbit.com/images/default_avatars/poster_thumb.png\"},\"display_name\":\"Bob S.\",\"email\":\"bobsponge@example.com\",\"first_name\":\"Bob\"}"
32
- http_version: "1.1"
23
+ status:
24
+ - 200 OK
25
+ set-cookie:
26
+ - current_geo=1053; path=/; expires=Tue, 13-Nov-2012 00:03:42 GMT
27
+ x-runtime:
28
+ - '0.087765'
29
+ content-length:
30
+ - '466'
31
+ etag:
32
+ - ! '"c9d1f78611ffb0dd20f73d8b07432075"'
33
+ x-ua-compatible:
34
+ - IE=Edge,chrome=1
35
+ cache-control:
36
+ - max-age=0, private, must-revalidate
37
+ body: ! '{"links":{"get":"/api/v1/users/40","avatar_url":"http://s-app1.taskrabbit.com/images/default_avatars/poster_thumb.png"},"first_name":"UserWith","friend_code_url":"http://taskrabbit.com/PAL/40","id":40,"short_name":"UserWith","display_name":"UserWith
38
+ c.","last_name":"card","city":{"links":{"get":"/api/v1/cities/3"},"lat":37.77493,"id":1053,"lng":-122.419416,"name":"SF
39
+ Bay Area"},"zip_code":"12345","full_name":"UserWith card","email":"userwithcard@taskrabbit.com"}'
40
+ http_version: '1.1'
@@ -1,32 +1,47 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: http://localhost:3000/api/v1/users/49720/tasks?
5
+ uri: https://taskrabbitdev.com/api/v1/users/40/tasks?include[task][]=errors&include[task][]=links&include[task][]=error&include[task][]=id&include[task][]=name&include[task][]=user&include[task][]=runner&include[task][]=runners&include[task][]=named_price&include[task][]=charge_price&include[task][]=cost_in_cents&include[task][]=number_runners_to_fill&include[task][]=state_label&include[task][]=city_id&include[task][]=city&include[task][]=description&include[task][]=private_description&include[task][]=private_runner&include[task][]=virtual&include[task][]=state&include[task][]=assignment_type&include[task][]=complete_by_time&include[task][]=state_changed_at&include[task][]=assign_by_time&include[task][]=location_visits&include[task][]=offers&include[task][]=other_locations_attributes&include[task][]=uploaded_photos_attributes&include[task][]=uploaded_sounds_attributes
6
6
  body:
7
- headers:
8
- x-client-application:
9
- - euqmQpzV04GmN1dJTY639PdI7eiSjCjI3lKTkPWn
10
- authorization:
11
- - OAuth RhyRtRg1bRNyqmdozkY6JJJ3eGDpoRGTm9AXUudp
12
- response: !ruby/struct:VCR::Response
13
- status: !ruby/struct:VCR::ResponseStatus
7
+ headers:
8
+ x-client-application:
9
+ - <API_SECRET>
10
+ authorization:
11
+ - OAuth <USER_WITH_CARD>
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
14
  code: 200
15
15
  message: OK
16
- headers:
17
- etag:
18
- - "\"81c43af66182714b81997a339b33bbd0\""
19
- content-type:
16
+ headers:
17
+ server:
18
+ - nginx/1.0.11
19
+ date:
20
+ - Wed, 12 Sep 2012 23:03:44 GMT
21
+ content-type:
20
22
  - application/json; charset=utf-8
21
- x-runtime:
22
- - "6667"
23
- server:
24
- - WEBrick/1.3.1 (Ruby/1.8.7/2011-02-18)
25
- date:
26
- - Sat, 17 Mar 2012 23:13:27 GMT
27
- content-length:
28
- - "4186"
29
- cache-control:
30
- - private, max-age=0, must-revalidate
31
- body: "{\"items\":[{\"city\":{\"name\":\"New York City\",\"lng\":-74.005973,\"id\":4,\"links\":{\"get\":\"/api/v1/cities/4\"},\"lat\":40.714353},\"name\":\"My First Task\",\"charge_price\":20,\"named_price\":20,\"private_runner\":false,\"complete_by_time\":1332093600,\"cost_in_cents\":0,\"state_changed_at\":1332025380,\"id\":22673,\"runners\":{\"items\":[]},\"links\":{\"html\":\"http://local.taskrabbit.com/tasks/my-first-task--47\",\"get\":\"/api/v1/tasks/22673\",\"delete\":\"/api/v1/tasks/22673\",\"put\":\"/api/v1/tasks/22673\",\"authenticated\":\"http://local.taskrabbit.com/go/2f249e87a04016d741f163fe991468737e367c8e334eb5d5a53a63d741ce0019ba1a9c33366a76cadc06bdcb9259c5549a44\"},\"state_label\":\"posted\",\"assign_by_time\":1332082800,\"state\":\"opened\"},{\"city\":{\"name\":\"New York City\",\"lng\":-74.005973,\"id\":4,\"links\":{\"get\":\"/api/v1/cities/4\"},\"lat\":40.714353},\"name\":\"New Name\",\"charge_price\":20,\"named_price\":20,\"private_runner\":false,\"complete_by_time\":1332093600,\"cost_in_cents\":0,\"state_changed_at\":1332025387,\"id\":22674,\"runners\":{\"items\":[]},\"links\":{\"html\":\"http://local.taskrabbit.com/tasks/new-name--3\",\"get\":\"/api/v1/tasks/22674\",\"delete\":\"/api/v1/tasks/22674\",\"put\":\"/api/v1/tasks/22674\",\"authenticated\":\"http://local.taskrabbit.com/go/459b5e05e7a6542891148717ed9cdd4a25fb5d5f71f094c098a93beb25ba26303c4ea5e2c8e01da3743703abbe1da5b46980\"},\"state_label\":\"posted\",\"assign_by_time\":1332082800,\"state\":\"opened\"},{\"city\":{\"name\":\"New York City\",\"lng\":-74.005973,\"id\":4,\"links\":{\"get\":\"/api/v1/cities/4\"},\"lat\":40.714353},\"name\":\"My First Task\",\"charge_price\":20,\"named_price\":20,\"private_runner\":false,\"complete_by_time\":1332093600,\"cost_in_cents\":0,\"state_changed_at\":1332025394,\"id\":22675,\"runners\":{\"items\":[]},\"links\":{\"html\":\"http://local.taskrabbit.com/tasks/my-first-task--49\",\"get\":\"/api/v1/tasks/22675\",\"delete\":\"/api/v1/tasks/22675\",\"put\":\"/api/v1/tasks/22675\",\"authenticated\":\"http://local.taskrabbit.com/go/a89862d84f6a3b8b3175c46bc824ba3c4086519395730898237d56ef90ad672e540e62370c6a87b6c6ec2f601c10e2486ba7\"},\"state_label\":\"posted\",\"assign_by_time\":1332082800,\"state\":\"opened\"},{\"city\":{\"name\":\"New York City\",\"lng\":-74.005973,\"id\":4,\"links\":{\"get\":\"/api/v1/cities/4\"},\"lat\":40.714353},\"name\":\"My First Task\",\"charge_price\":20,\"named_price\":20,\"private_runner\":false,\"complete_by_time\":1332093600,\"cost_in_cents\":0,\"state_changed_at\":1332025970,\"id\":22679,\"runners\":{\"items\":[]},\"links\":{\"html\":\"http://local.taskrabbit.com/tasks/my-first-task--53\",\"get\":\"/api/v1/tasks/22679\",\"delete\":\"/api/v1/tasks/22679\",\"put\":\"/api/v1/tasks/22679\",\"authenticated\":\"http://local.taskrabbit.com/go/5a5d27db65887f4b787f19c3c32dbfcf59aabd1943575f7b5d9030f9b984573dbbca1e58d2cd4297b6bf0ec7ccaa3e849db9\"},\"state_label\":\"posted\",\"assign_by_time\":1332082800,\"state\":\"opened\"},{\"city\":{\"name\":\"New York City\",\"lng\":-74.005973,\"id\":4,\"links\":{\"get\":\"/api/v1/cities/4\"},\"lat\":40.714353},\"name\":\"New Name\",\"charge_price\":20,\"named_price\":20,\"private_runner\":false,\"complete_by_time\":1332093600,\"cost_in_cents\":0,\"state_changed_at\":1332025978,\"id\":22680,\"runners\":{\"items\":[]},\"links\":{\"html\":\"http://local.taskrabbit.com/tasks/new-name--4\",\"get\":\"/api/v1/tasks/22680\",\"delete\":\"/api/v1/tasks/22680\",\"put\":\"/api/v1/tasks/22680\",\"authenticated\":\"http://local.taskrabbit.com/go/78196cf7905ad6c4b1fb0e4df943b284253a8880163ee3675cdf4b06a9b9de63f6b1cc198064ac121d7afce702d81be0fb03\"},\"state_label\":\"posted\",\"assign_by_time\":1332082800,\"state\":\"opened\"},{\"city\":{\"name\":\"New York City\",\"lng\":-74.005973,\"id\":4,\"links\":{\"get\":\"/api/v1/cities/4\"},\"lat\":40.714353},\"name\":\"My First Task\",\"charge_price\":20,\"named_price\":20,\"private_runner\":false,\"complete_by_time\":1332093600,\"cost_in_cents\":0,\"state_changed_at\":1332025986,\"id\":22681,\"runners\":{\"items\":[]},\"links\":{\"html\":\"http://local.taskrabbit.com/tasks/my-first-task--55\",\"get\":\"/api/v1/tasks/22681\",\"delete\":\"/api/v1/tasks/22681\",\"put\":\"/api/v1/tasks/22681\",\"authenticated\":\"http://local.taskrabbit.com/go/aee487c3c205df11defb1eeb83dab50de7f670769edcd82455eae92f776d6e6ef0dd7b1aacbea7c05ede923baf3a1343bcc6\"},\"state_label\":\"posted\",\"assign_by_time\":1332082800,\"state\":\"opened\"}],\"links\":{\"get\":\"/api/v1/users/49720/tasks\",\"last\":\"/api/v1/users/49720/tasks?page=1\",\"first\":\"/api/v1/users/49720/tasks?page=1\"}}"
32
- http_version: "1.1"
23
+ status:
24
+ - 200 OK
25
+ set-cookie:
26
+ - current_geo=1053; path=/; expires=Tue, 13-Nov-2012 00:03:44 GMT
27
+ x-runtime:
28
+ - '0.242963'
29
+ content-length:
30
+ - '1552'
31
+ etag:
32
+ - ! '"bb6fe1c81c51df832fa9f184dc72c50a"'
33
+ x-ua-compatible:
34
+ - IE=Edge,chrome=1
35
+ cache-control:
36
+ - max-age=0, private, must-revalidate
37
+ body: ! '{"links":{"first":"/api/v1/users/40/tasks?page=1","last":"/api/v1/users/40/tasks?page=1","get":"/api/v1/users/40/tasks"},"items":[{"links":{"put":"/api/v1/tasks/52","html":"http://s-app1.taskrabbit.com/tasks/house-cleaning-7091","get":"/api/v1/tasks/52","authenticated":"http://s-app1.taskrabbit.com/go/82d359e524666a2d8b96f6df1fbfcad4a720a0b4fed8c3f0985139a13a4d6433b65f7f05e80360af131d8f9638f8307e035b","delete":"/api/v1/tasks/52"},"private_runner":false,"charge_price":23,"runners":{"items":[]},"id":52,"cost_in_cents":0,"state_changed_at":1347490579,"named_price":23,"description":"I
38
+ need to clean my house","assignment_type":"auto","name":"House Cleaning","assign_by_time":1347577200,"city":{"links":{"get":"/api/v1/cities/3"},"lat":37.77493,"id":1053,"lng":-122.419416,"name":"SF
39
+ Bay Area"},"runner_fee":0,"complete_by_time":1347663600,"state_label":"posted","description_properties":[{"value":"I
40
+ need to clean my house","key":"description","title":"Description"},{"value":null,"key":"private_description","title":"Private
41
+ description"},{"value":"Regular Maintenance","key":"task_field_16","title":"Level
42
+ of cleaning"},{"value":"Multiple Rooms, 1 Bathroom","key":"task_field_17","title":"Size
43
+ of house"},{"value":"Cleaning supplies are already in the house","key":"task_field_18","title":"Do
44
+ you have all the necessary cleaning supplies at your house"},{"value":1347577200,"key":"assign_by_time","title":"If
45
+ unassigned, Task will expire on"},{"value":1347663600,"key":"complete_by_time","title":"Task
46
+ should be completed by"}],"state":"opened"}]}'
47
+ http_version: '1.1'
@@ -4,7 +4,7 @@ describe Taskrabbit::Account do
4
4
  describe "account properties" do
5
5
  before :all do
6
6
  tr = Taskrabbit::Api.new(TR_USERS[:with_card][:secret])
7
- VCR.use_cassette('account/properties', :record => :new_episodes) do
7
+ VCR.use_cassette('account/properties', :record => :none) do
8
8
  @user = tr.account
9
9
  @user.fetch
10
10
  end
@@ -13,17 +13,17 @@ describe Taskrabbit::Account do
13
13
  subject { @user }
14
14
 
15
15
  its(:id) { should == TR_USERS[:with_card][:id] }
16
- its(:short_name) { should == "Bob" }
17
- its(:first_name) { should == "Bob" }
18
- its(:full_name) { should == "Bob Sponge" }
19
- its(:display_name) { should == "Bob S." }
16
+ its(:short_name) { should == "UserWith" }
17
+ its(:first_name) { should == "UserWith" }
18
+ its(:full_name) { should == "UserWith card" }
19
+ its(:display_name) { should == "UserWith c." }
20
20
  its(:runner) { should == false }
21
- its(:email) { should == 'bobsponge@example.com' }
21
+ its(:email) { should == 'userwithcard@taskrabbit.com' }
22
22
  its(:mobile_phone) { should == nil }
23
23
  its(:home_phone) { should == nil }
24
24
  its(:tasks) { should be_a(Taskrabbit::Collection) } # TaskRabbit returns tasks in the json
25
25
  its(:city) { should be_instance_of(Taskrabbit::City) }
26
- its(:zip_code) { should == "64321" }
26
+ its(:zip_code) { should == "12345" }
27
27
  its(:locations) { should be_a(Taskrabbit::Collection) } # TaskRabbit returns locations in the json
28
28
  its(:links) { should be_instance_of(Hash) }
29
29
  end
@@ -32,7 +32,7 @@ describe Taskrabbit::Account do
32
32
  describe ".account" do
33
33
  it "should return an error if the user is not passed" do
34
34
  tr = Taskrabbit::Api.new
35
- VCR.use_cassette('account/no_user', :record => :new_episodes) do
35
+ VCR.use_cassette('account/no_user', :record => :none) do
36
36
  tr_account = nil
37
37
  expect { tr_account = tr.account }.to_not raise_error
38
38
  expect { tr_account = tr_account.short_name }.to raise_error(Taskrabbit::Error, 'There must be an authenticated user for this action')
@@ -41,7 +41,7 @@ describe Taskrabbit::Account do
41
41
 
42
42
  it "should return the account of the user" do
43
43
  tr = Taskrabbit::Api.new(TR_USERS[:with_card][:secret])
44
- VCR.use_cassette('account/with_user', :record => :new_episodes) do
44
+ VCR.use_cassette('account/with_user', :record => :none) do
45
45
  tr_account = nil
46
46
  expect { tr_account = tr.account }.to_not raise_error
47
47
  tr_account.short_name.should == 'Bob'
@@ -52,7 +52,7 @@ describe Taskrabbit::Account do
52
52
  describe ".tasks" do
53
53
  it "should fetch the tasks of the user" do
54
54
  tr = Taskrabbit::Api.new(TR_USERS[:with_card][:secret])
55
- VCR.use_cassette('account/tasks', :record => :new_episodes) do
55
+ VCR.use_cassette('account/tasks', :record => :none) do
56
56
  tr_account = nil
57
57
  expect { tr_account = tr.account }.to_not raise_error
58
58
  account_tasks = tr_account.tasks.all
@@ -28,7 +28,7 @@ describe Taskrabbit::Api do
28
28
  it "should return an error if the client is not set" do
29
29
  tr = Taskrabbit::Api.new
30
30
  VCR.use_cassette('errors/404', :record => :new_episodes) do
31
- expect { tr.tasks.find('something-that-doesnot-exists').name }.to raise_error(Taskrabbit::Error, '404 Not Found')
31
+ expect { tr.tasks.find('something-that-doesnot-exists').name }.to raise_error(Taskrabbit::Error, 'The requested resource could not be found')
32
32
  end
33
33
  end
34
34
  end
@@ -6,7 +6,7 @@ describe Taskrabbit::City do
6
6
 
7
7
  before :all do
8
8
  tr = Taskrabbit::Api.new
9
- VCR.use_cassette('cities/properties', :record => :new_episodes) do
9
+ VCR.use_cassette('cities/properties', :record => :none) do
10
10
  @city = tr.cities.find(3)
11
11
  @city.fetch
12
12
  end
@@ -25,7 +25,7 @@ describe Taskrabbit::City do
25
25
  describe "#all" do
26
26
  it "should fetch all cities" do
27
27
  tr = Taskrabbit::Api.new
28
- VCR.use_cassette('cities/all', :record => :new_episodes) do
28
+ VCR.use_cassette('cities/all', :record => :none) do
29
29
  cities = nil
30
30
  expect { cities = tr.cities }.to_not raise_error
31
31
  cities.should == Taskrabbit::City
@@ -49,7 +49,7 @@ describe Taskrabbit::City do
49
49
 
50
50
  it "should should fetch the city" do
51
51
  tr = Taskrabbit::Api.new
52
- VCR.use_cassette('cities/find', :record => :new_episodes) do
52
+ VCR.use_cassette('cities/find', :record => :none) do
53
53
  city = nil
54
54
  expect { city = tr.cities.find(3) }.to_not raise_error
55
55
  city.id.should == 3
@@ -6,7 +6,7 @@ describe Taskrabbit::Location do
6
6
 
7
7
  before :all do
8
8
  tr = Taskrabbit::Api.new(TR_USERS[:with_card][:secret])
9
- VCR.use_cassette('locations/properties', :record => :new_episodes) do
9
+ VCR.use_cassette('locations/properties', :record => :none) do
10
10
  @location = tr.account.locations.first
11
11
  end
12
12
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Taskrabbit::Location do
4
+
5
+ describe "offers properties" do
6
+
7
+ before :all do
8
+ tr = Taskrabbit::Api.new(TR_USERS[:with_card][:secret])
9
+ VCR.use_cassette('tasks/with_offers_properties', :record => :none) do
10
+ @tr_task = tr.tasks.find(ENV["TASK_ID"])
11
+ @tr_task.fetch
12
+ end
13
+ @offer = @tr_task.offers.first
14
+ end
15
+
16
+ subject { @offer }
17
+
18
+ its(:id ) { should == 7 }
19
+ its(:charge_price ) { should == 26 }
20
+ its(:state ) { should == "sent" }
21
+ its(:runner_id ) { should == 31 }
22
+ end
23
+ end