desk_api 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +49 -34
  3. data/config.rb +1 -1
  4. data/desk_api.gemspec +3 -3
  5. data/lib/desk.rb +1 -35
  6. data/lib/desk_api.rb +35 -0
  7. data/lib/{desk → desk_api}/action/create.rb +1 -1
  8. data/lib/{desk → desk_api}/action/delete.rb +1 -1
  9. data/lib/{desk → desk_api}/action/embedded.rb +1 -1
  10. data/lib/{desk → desk_api}/action/field.rb +3 -3
  11. data/lib/{desk → desk_api}/action/link.rb +2 -2
  12. data/lib/desk_api/action/resource.rb +14 -0
  13. data/lib/{desk → desk_api}/action/search.rb +1 -1
  14. data/lib/{desk → desk_api}/action/update.rb +2 -2
  15. data/lib/{desk → desk_api}/client.rb +15 -15
  16. data/lib/{desk → desk_api}/configuration.rb +13 -13
  17. data/lib/{desk → desk_api}/default.rb +5 -5
  18. data/lib/{desk → desk_api}/error.rb +5 -5
  19. data/lib/{desk → desk_api}/error/bad_gateway.rb +3 -3
  20. data/lib/{desk → desk_api}/error/bad_request.rb +3 -3
  21. data/lib/{desk → desk_api}/error/client_error.rb +3 -3
  22. data/lib/{desk → desk_api}/error/configuration_error.rb +2 -2
  23. data/lib/{desk → desk_api}/error/conflict.rb +3 -3
  24. data/lib/{desk → desk_api}/error/forbidden.rb +3 -3
  25. data/lib/{desk → desk_api}/error/gateway_timeout.rb +3 -3
  26. data/lib/desk_api/error/internal_server_error.rb +10 -0
  27. data/lib/{desk → desk_api}/error/method_not_allowed.rb +3 -3
  28. data/lib/{desk → desk_api}/error/method_not_supported.rb +3 -3
  29. data/lib/{desk → desk_api}/error/not_acceptable.rb +3 -3
  30. data/lib/{desk → desk_api}/error/not_found.rb +3 -3
  31. data/lib/desk_api/error/parse_error.rb +9 -0
  32. data/lib/desk_api/error/parser_error.rb +9 -0
  33. data/lib/{desk → desk_api}/error/server_error.rb +3 -3
  34. data/lib/desk_api/error/service_unavailable.rb +10 -0
  35. data/lib/{desk → desk_api}/error/too_many_requests.rb +3 -3
  36. data/lib/{desk → desk_api}/error/unauthorized.rb +3 -3
  37. data/lib/{desk → desk_api}/error/unprocessable_entity.rb +3 -3
  38. data/lib/{desk → desk_api}/error/unsupported_media_type.rb +3 -3
  39. data/lib/{desk → desk_api}/rate_limit.rb +1 -1
  40. data/lib/{desk → desk_api}/request/retry.rb +2 -2
  41. data/lib/{desk → desk_api}/resource.rb +16 -16
  42. data/lib/desk_api/resource/article.rb +10 -0
  43. data/lib/desk_api/resource/article_translation.rb +8 -0
  44. data/lib/desk_api/resource/attachment.rb +8 -0
  45. data/lib/desk_api/resource/case.rb +9 -0
  46. data/lib/desk_api/resource/company.rb +8 -0
  47. data/lib/desk_api/resource/customer.rb +9 -0
  48. data/lib/desk_api/resource/integration_url.rb +9 -0
  49. data/lib/desk_api/resource/job.rb +7 -0
  50. data/lib/desk_api/resource/label.rb +9 -0
  51. data/lib/desk_api/resource/macro.rb +9 -0
  52. data/lib/desk_api/resource/macro_action.rb +7 -0
  53. data/lib/desk_api/resource/note.rb +7 -0
  54. data/lib/{desk → desk_api}/resource/page.rb +5 -5
  55. data/lib/desk_api/resource/reply.rb +8 -0
  56. data/lib/desk_api/resource/topic.rb +9 -0
  57. data/lib/desk_api/resource/topic_translation.rb +9 -0
  58. data/lib/desk_api/resource/user_preference.rb +7 -0
  59. data/lib/{desk → desk_api}/resources.json +0 -0
  60. data/lib/desk_api/response/raise_error.rb +34 -0
  61. data/lib/desk_api/version.rb +3 -0
  62. data/spec/cassettes/{Desk_Client → DeskApi_Client}/_delete/deletes_a_resource.yml +5 -5
  63. data/spec/cassettes/{Desk_Client → DeskApi_Client}/_get/fetches_resources.yml +5 -5
  64. data/spec/cassettes/{Desk_Client → DeskApi_Client}/_patch/updates_a_resource.yml +6 -6
  65. data/spec/cassettes/{Desk_Client → DeskApi_Client}/_post/creates_a_resource.yml +8 -8
  66. data/spec/cassettes/{Desk_Error → DeskApi_Error}/_from_response/can_be_created_from_a_faraday_response.yml +5 -5
  67. data/spec/cassettes/{Desk_Error → DeskApi_Error}/_from_response/uses_the_body_message_if_present.yml +5 -5
  68. data/spec/cassettes/{Desk_Resource → DeskApi_Resource}/_by_url/finds_resources_by_url.yml +7 -7
  69. data/spec/cassettes/{Desk_Resource → DeskApi_Resource}/_create/creates_a_new_topic.yml +8 -8
  70. data/spec/cassettes/{Desk_Resource → DeskApi_Resource}/_delete/deletes_a_resource.yml +25 -26
  71. data/spec/cassettes/{Desk_Resource → DeskApi_Resource}/_delete/throws_an_error_deleting_a_non_deletalbe_resource.yml +6 -6
  72. data/spec/cassettes/{Desk_Resource_Page/_page/returns_the_current_page_and_loads_if_page_not_defined.yml → DeskApi_Resource/_exec_/can_be_forced_to_reload.yml} +6 -6
  73. data/spec/cassettes/{Desk_Resource → DeskApi_Resource}/_exec_/loads_the_current_resource.yml +7 -7
  74. data/spec/cassettes/{Desk_Resource/_exec_/can_be_forced_to_reload.yml → DeskApi_Resource/_method_missing/loads_the_resource_to_find_a_suitable_method.yml} +6 -6
  75. data/spec/cassettes/{Desk_Resource/_method_missing/loads_the_resource_to_find_a_suitable_method.yml → DeskApi_Resource/_method_missing/raises_an_error_if_method_does_not_exist.yml} +7 -7
  76. data/spec/cassettes/{Desk_Resource → DeskApi_Resource}/_search/allows_searching_on_search_enabled_resources.yml +5 -5
  77. data/spec/cassettes/DeskApi_Resource/_update/can_update_without_a_hash.yml +116 -0
  78. data/spec/cassettes/{Desk_Resource → DeskApi_Resource}/_update/throws_an_error_updating_a_user.yml +5 -5
  79. data/spec/cassettes/{Desk_Resource → DeskApi_Resource}/_update/updates_a_topic.yml +18 -20
  80. data/spec/cassettes/{Desk_Resource_Page → DeskApi_Resource_Page}/_by_id/loads_the_requested_resource.yml +5 -5
  81. data/spec/cassettes/{Desk_Resource_Page → DeskApi_Resource_Page}/_page/keeps_the_resource_as_loaded.yml +5 -5
  82. data/spec/cassettes/{Desk_Resource/_method_missing/raises_an_error_if_method_does_not_exist.yml → DeskApi_Resource_Page/_page/returns_the_current_page_and_loads_if_page_not_defined.yml} +6 -6
  83. data/spec/cassettes/{Desk_Resource_Page → DeskApi_Resource_Page}/_page/sets_the_resource_to_not_loaded.yml +5 -5
  84. data/spec/{desk → desk_api}/client_spec.rb +14 -14
  85. data/spec/{desk → desk_api}/configuration_spec.rb +23 -23
  86. data/spec/{desk → desk_api}/default_spec.rb +5 -5
  87. data/spec/{desk → desk_api}/error_spec.rb +4 -4
  88. data/spec/{desk → desk_api}/rate_limit_spec.rb +7 -7
  89. data/spec/{desk → desk_api}/request/retry_spec.rb +3 -3
  90. data/spec/{desk → desk_api}/resource_spec.rb +17 -10
  91. data/spec/{desk → desk_api}/resources/page_spec.rb +5 -5
  92. data/spec/{desk_spec.rb → desk_api_spec.rb} +10 -10
  93. data/spec/spec_helper.rb +1 -1
  94. metadata +121 -118
  95. data/lib/desk/action/resource.rb +0 -14
  96. data/lib/desk/error/internal_server_error.rb +0 -10
  97. data/lib/desk/error/parse_error.rb +0 -9
  98. data/lib/desk/error/parser_error.rb +0 -9
  99. data/lib/desk/error/service_unavailable.rb +0 -10
  100. data/lib/desk/resource/article.rb +0 -10
  101. data/lib/desk/resource/article_translation.rb +0 -8
  102. data/lib/desk/resource/attachment.rb +0 -8
  103. data/lib/desk/resource/case.rb +0 -9
  104. data/lib/desk/resource/company.rb +0 -8
  105. data/lib/desk/resource/customer.rb +0 -9
  106. data/lib/desk/resource/integration_url.rb +0 -9
  107. data/lib/desk/resource/job.rb +0 -7
  108. data/lib/desk/resource/label.rb +0 -9
  109. data/lib/desk/resource/macro.rb +0 -9
  110. data/lib/desk/resource/macro_action.rb +0 -7
  111. data/lib/desk/resource/note.rb +0 -7
  112. data/lib/desk/resource/reply.rb +0 -8
  113. data/lib/desk/resource/topic.rb +0 -9
  114. data/lib/desk/resource/topic_translation.rb +0 -9
  115. data/lib/desk/resource/user_preference.rb +0 -7
  116. data/lib/desk/response/raise_error.rb +0 -34
  117. data/lib/desk/version.rb +0 -3
@@ -23,9 +23,9 @@ http_interactions:
23
23
  Content-Type:
24
24
  - application/json; charset=utf-8
25
25
  Date:
26
- - Thu, 15 Aug 2013 21:20:33 GMT
26
+ - Mon, 19 Aug 2013 23:51:33 GMT
27
27
  ETag:
28
- - '"6922ce66ea15c1c84d14c5f99cbabbeb"'
28
+ - '"40a205aec2cd1a68c9f59d5bc0043fe1"'
29
29
  Status:
30
30
  - 200 OK
31
31
  Vary:
@@ -37,31 +37,29 @@ http_interactions:
37
37
  X-Rate-Limit-Limit:
38
38
  - '60'
39
39
  X-Rate-Limit-Remaining:
40
- - '44'
40
+ - '51'
41
41
  X-Rate-Limit-Reset:
42
42
  - '27'
43
43
  X-Request-Id:
44
- - c360419287f3889dc0d45ac2287676cf
44
+ - 14315fed191397832541c7f472e296f6
45
45
  Content-Length:
46
- - '2320'
46
+ - '1529'
47
47
  Connection:
48
48
  - keep-alive
49
49
  body:
50
50
  encoding: UTF-8
51
- string: '{"total_entries":5,"_links":{"self":{"href":"/api/v2/topics?page=1&per_page=50","class":"page"},"first":{"href":"/api/v2/topics?page=1&per_page=50","class":"page"},"last":{"href":"/api/v2/topics?page=1&per_page=50","class":"page"},"previous":null,"next":null},"_embedded":{"entries":[{"name":"Testing
52
- English","description":"Some new description","position":1,"allow_questions":true,"in_support_center":true,"created_at":"2013-04-22T23:46:42Z","updated_at":"2013-08-15T21:20:32Z","_links":{"self":{"href":"/api/v2/topics/498301","class":"topic"},"articles":{"href":"/api/v2/topics/498301/articles","class":"article"},"translations":{"href":"/api/v2/topics/498301/translations","class":"topic_translation"}}},{"name":"My
53
- new topic","description":null,"position":2,"allow_questions":true,"in_support_center":null,"created_at":"2013-08-14T19:34:34Z","updated_at":"2013-08-14T19:34:34Z","_links":{"self":{"href":"/api/v2/topics/556401","class":"topic"},"articles":{"href":"/api/v2/topics/556401/articles","class":"article"},"translations":{"href":"/api/v2/topics/556401/translations","class":"topic_translation"}}},{"name":"My
54
- new topic","description":null,"position":3,"allow_questions":true,"in_support_center":null,"created_at":"2013-08-14T19:37:08Z","updated_at":"2013-08-14T19:37:08Z","_links":{"self":{"href":"/api/v2/topics/556402","class":"topic"},"articles":{"href":"/api/v2/topics/556402/articles","class":"article"},"translations":{"href":"/api/v2/topics/556402/translations","class":"topic_translation"}}},{"name":"Test
55
- Topic","description":null,"position":4,"allow_questions":true,"in_support_center":null,"created_at":"2013-08-15T21:20:31Z","updated_at":"2013-08-15T21:20:31Z","_links":{"self":{"href":"/api/v2/topics/556907","class":"topic"},"articles":{"href":"/api/v2/topics/556907/articles","class":"article"},"translations":{"href":"/api/v2/topics/556907/translations","class":"topic_translation"}}},{"name":"My
56
- new topic","description":null,"position":5,"allow_questions":true,"in_support_center":null,"created_at":"2013-08-15T21:20:32Z","updated_at":"2013-08-15T21:20:32Z","_links":{"self":{"href":"/api/v2/topics/556908","class":"topic"},"articles":{"href":"/api/v2/topics/556908/articles","class":"article"},"translations":{"href":"/api/v2/topics/556908/translations","class":"topic_translation"}}}]}}'
51
+ string: '{"total_entries":3,"_links":{"self":{"href":"/api/v2/topics?page=1&per_page=50","class":"page"},"first":{"href":"/api/v2/topics?page=1&per_page=50","class":"page"},"last":{"href":"/api/v2/topics?page=1&per_page=50","class":"page"},"previous":null,"next":null},"_embedded":{"entries":[{"name":"Testing
52
+ English","description":"Another description update.","position":1,"allow_questions":true,"in_support_center":true,"created_at":"2013-04-22T23:46:42Z","updated_at":"2013-08-19T23:51:33Z","_links":{"self":{"href":"/api/v2/topics/498301","class":"topic"},"articles":{"href":"/api/v2/topics/498301/articles","class":"article"},"translations":{"href":"/api/v2/topics/498301/translations","class":"topic_translation"}}},{"name":"Test
53
+ Updated Topic","description":null,"position":2,"allow_questions":true,"in_support_center":null,"created_at":"2013-08-14T19:37:08Z","updated_at":"2013-08-15T21:26:17Z","_links":{"self":{"href":"/api/v2/topics/556402","class":"topic"},"articles":{"href":"/api/v2/topics/556402/articles","class":"article"},"translations":{"href":"/api/v2/topics/556402/translations","class":"topic_translation"}}},{"name":"My
54
+ new topic","description":null,"position":3,"allow_questions":true,"in_support_center":null,"created_at":"2013-08-15T21:20:32Z","updated_at":"2013-08-15T21:25:38Z","_links":{"self":{"href":"/api/v2/topics/556908","class":"topic"},"articles":{"href":"/api/v2/topics/556908/articles","class":"article"},"translations":{"href":"/api/v2/topics/556908/translations","class":"topic_translation"}}}]}}'
57
55
  http_version:
58
- recorded_at: Thu, 15 Aug 2013 21:20:33 GMT
56
+ recorded_at: Mon, 19 Aug 2013 23:51:33 GMT
59
57
  - request:
60
58
  method: patch
61
59
  uri: https://devel.desk.com/api/v2/topics/498301
62
60
  body:
63
61
  encoding: UTF-8
64
- string: '{"name":"Updated topic name"}'
62
+ string: '{"description":"Some new description","name":"Updated topic name"}'
65
63
  headers:
66
64
  Accept:
67
65
  - application/json
@@ -79,9 +77,9 @@ http_interactions:
79
77
  Content-Type:
80
78
  - application/json; charset=utf-8
81
79
  Date:
82
- - Thu, 15 Aug 2013 21:20:33 GMT
80
+ - Mon, 19 Aug 2013 23:51:33 GMT
83
81
  ETag:
84
- - '"412b99f3cb6900be38fc168929cb5edb"'
82
+ - '"710c8f853c9cb55417e8c1524335a636"'
85
83
  Server:
86
84
  - nginx
87
85
  Status:
@@ -97,13 +95,13 @@ http_interactions:
97
95
  X-Rate-Limit-Limit:
98
96
  - '60'
99
97
  X-Rate-Limit-Remaining:
100
- - '43'
98
+ - '50'
101
99
  X-Rate-Limit-Reset:
102
100
  - '27'
103
101
  X-Request-Id:
104
- - bfe9319239f06f1225c6db3ca6e78453
102
+ - cbd8a44730d6855c0cc8a90153370dbe
105
103
  X-Runtime:
106
- - '0.078318'
104
+ - '0.090645'
107
105
  X-UA-Compatible:
108
106
  - IE=Edge,chrome=1
109
107
  Content-Length:
@@ -112,7 +110,7 @@ http_interactions:
112
110
  - keep-alive
113
111
  body:
114
112
  encoding: UTF-8
115
- string: '{"name":"Updated topic name","description":"Some new description","position":1,"allow_questions":true,"in_support_center":true,"created_at":"2013-04-22T23:46:42Z","updated_at":"2013-08-15T21:20:32Z","_links":{"self":{"href":"/api/v2/topics/498301","class":"topic"},"articles":{"href":"/api/v2/topics/498301/articles","class":"article"},"translations":{"href":"/api/v2/topics/498301/translations","class":"topic_translation"}}}'
113
+ string: '{"name":"Updated topic name","description":"Some new description","position":1,"allow_questions":true,"in_support_center":true,"created_at":"2013-04-22T23:46:42Z","updated_at":"2013-08-19T23:51:33Z","_links":{"self":{"href":"/api/v2/topics/498301","class":"topic"},"articles":{"href":"/api/v2/topics/498301/articles","class":"article"},"translations":{"href":"/api/v2/topics/498301/translations","class":"topic_translation"}}}'
116
114
  http_version:
117
- recorded_at: Thu, 15 Aug 2013 21:20:33 GMT
115
+ recorded_at: Mon, 19 Aug 2013 23:51:33 GMT
118
116
  recorded_with: VCR 2.5.0
@@ -23,7 +23,7 @@ http_interactions:
23
23
  Content-Type:
24
24
  - application/json; charset=utf-8
25
25
  Date:
26
- - Thu, 15 Aug 2013 21:20:35 GMT
26
+ - Mon, 19 Aug 2013 23:51:31 GMT
27
27
  ETag:
28
28
  - '"cbba64bc7fe9b35611cc745f75671fb6"'
29
29
  Status:
@@ -37,11 +37,11 @@ http_interactions:
37
37
  X-Rate-Limit-Limit:
38
38
  - '60'
39
39
  X-Rate-Limit-Remaining:
40
- - '36'
40
+ - '59'
41
41
  X-Rate-Limit-Reset:
42
- - '25'
42
+ - '29'
43
43
  X-Request-Id:
44
- - c5ed3aaf3d64441ba14a1c51ad44af03
44
+ - e391f97e79ee25cc928aadb97086f3ef
45
45
  Content-Length:
46
46
  - '897'
47
47
  Connection:
@@ -50,5 +50,5 @@ http_interactions:
50
50
  encoding: UTF-8
51
51
  string: '{"external_id":null,"subject":"Testing the Tank again","priority":5,"locked_until":null,"description":null,"status":"open","type":"email","labels":[],"language":"de","active_at":"2013-05-13T19:20:59Z","created_at":"2013-05-13T18:13:39Z","updated_at":"2013-05-13T18:13:39Z","received_at":null,"custom_fields":{"my_new_custom_field":null,"my_new_number_field":null,"my_new_date_field":null,"my_new_boolean_field":null,"my_new_list_field":null},"_links":{"self":{"href":"/api/v2/cases/3065","class":"case"},"message":{"href":"/api/v2/cases/3065/message","class":"email"},"customer":{"href":"/api/v2/customers/86101780","class":"customer"},"assigned_user":null,"assigned_group":null,"locked_by":null,"replies":{"href":"/api/v2/cases/3065/replies","class":"reply"},"notes":{"href":"/api/v2/cases/3065/notes","class":"note"},"attachments":{"href":"/api/v2/cases/3065/attachments","class":"attachment"}}}'
52
52
  http_version:
53
- recorded_at: Thu, 15 Aug 2013 21:20:35 GMT
53
+ recorded_at: Mon, 19 Aug 2013 23:51:31 GMT
54
54
  recorded_with: VCR 2.5.0
@@ -23,7 +23,7 @@ http_interactions:
23
23
  Content-Type:
24
24
  - application/json; charset=utf-8
25
25
  Date:
26
- - Thu, 15 Aug 2013 21:20:35 GMT
26
+ - Mon, 19 Aug 2013 23:51:32 GMT
27
27
  ETag:
28
28
  - '"9be8043641e7da379826d5480c34a491"'
29
29
  Status:
@@ -37,11 +37,11 @@ http_interactions:
37
37
  X-Rate-Limit-Limit:
38
38
  - '60'
39
39
  X-Rate-Limit-Remaining:
40
- - '37'
40
+ - '57'
41
41
  X-Rate-Limit-Reset:
42
- - '26'
42
+ - '29'
43
43
  X-Request-Id:
44
- - c2addd2e1c28244528a5aca0ca1e2998
44
+ - 8d4c5327c6ad669e96d250837638af84
45
45
  Content-Length:
46
46
  - '48478'
47
47
  Connection:
@@ -109,5 +109,5 @@ http_interactions:
109
109
  customer create","priority":5,"locked_until":null,"description":null,"status":"open","type":"email","labels":[],"language":"de","active_at":"2013-05-13T19:20:43Z","created_at":"2013-05-13T18:12:07Z","updated_at":"2013-05-13T18:12:07Z","received_at":null,"custom_fields":{"my_new_custom_field":null,"my_new_number_field":null,"my_new_date_field":null,"my_new_boolean_field":null,"my_new_list_field":null},"_links":{"self":{"href":"/api/v2/cases/3064","class":"case"},"message":{"href":"/api/v2/cases/3064/message","class":"email"},"customer":{"href":"/api/v2/customers/86101780","class":"customer"},"assigned_user":null,"assigned_group":null,"locked_by":null,"replies":{"href":"/api/v2/cases/3064/replies","class":"reply"},"notes":{"href":"/api/v2/cases/3064/notes","class":"note"},"attachments":{"href":"/api/v2/cases/3064/attachments","class":"attachment"}}},{"external_id":null,"subject":"Testing
110
110
  the Tank again","priority":5,"locked_until":null,"description":null,"status":"open","type":"email","labels":[],"language":"de","active_at":"2013-05-13T19:20:59Z","created_at":"2013-05-13T18:13:39Z","updated_at":"2013-05-13T18:13:39Z","received_at":null,"custom_fields":{"my_new_custom_field":null,"my_new_number_field":null,"my_new_date_field":null,"my_new_boolean_field":null,"my_new_list_field":null},"_links":{"self":{"href":"/api/v2/cases/3065","class":"case"},"message":{"href":"/api/v2/cases/3065/message","class":"email"},"customer":{"href":"/api/v2/customers/86101780","class":"customer"},"assigned_user":null,"assigned_group":null,"locked_by":null,"replies":{"href":"/api/v2/cases/3065/replies","class":"reply"},"notes":{"href":"/api/v2/cases/3065/notes","class":"note"},"attachments":{"href":"/api/v2/cases/3065/attachments","class":"attachment"}}}]}}'
111
111
  http_version:
112
- recorded_at: Thu, 15 Aug 2013 21:20:35 GMT
112
+ recorded_at: Mon, 19 Aug 2013 23:51:32 GMT
113
113
  recorded_with: VCR 2.5.0
@@ -23,9 +23,9 @@ http_interactions:
23
23
  Content-Type:
24
24
  - application/json; charset=utf-8
25
25
  Date:
26
- - Thu, 15 Aug 2013 21:20:31 GMT
26
+ - Mon, 19 Aug 2013 23:51:31 GMT
27
27
  ETag:
28
- - '"93e82cb9c9be28d0224501f82f2957cd"'
28
+ - '"1962df5310e7d2a59db97d5b68e3c95d"'
29
29
  Status:
30
30
  - 200 OK
31
31
  Vary:
@@ -37,11 +37,11 @@ http_interactions:
37
37
  X-Rate-Limit-Limit:
38
38
  - '60'
39
39
  X-Rate-Limit-Remaining:
40
- - '54'
40
+ - '58'
41
41
  X-Rate-Limit-Reset:
42
42
  - '29'
43
43
  X-Request-Id:
44
- - 7fffc856983d1a9ee456d20827f3ec37
44
+ - 09ecfebbe83d9e29e5c81bf77150925f
45
45
  Content-Length:
46
46
  - '21118'
47
47
  Connection:
@@ -307,7 +307,7 @@ http_interactions:
307
307
  Latin words, combined with a handful of model sentence structures, to generate
308
308
  Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore
309
309
  always free from repetition, injected humour, or non-characteristic words
310
- etc.","body_facebook_auto":true,"keywords":"","position":1,"quickcode":null,"in_support_center":true,"internal_notes":"","publish_at":"2013-08-05T01:13:36Z","created_at":"2013-07-05T15:45:25Z","updated_at":"2013-08-14T19:47:37Z","_links":{"self":{"href":"/api/v2/articles/1213277","class":"article"},"topic":{"href":"/api/v2/topics/498301","class":"topic"},"translations":{"href":"/api/v2/articles/1213277/translations","class":"article_translation"}}}]}}'
310
+ etc.","body_facebook_auto":true,"keywords":"","position":1,"quickcode":null,"in_support_center":true,"internal_notes":"","publish_at":"2013-08-05T01:13:36Z","created_at":"2013-07-05T15:45:25Z","updated_at":"2013-08-15T21:24:28Z","_links":{"self":{"href":"/api/v2/articles/1213277","class":"article"},"topic":{"href":"/api/v2/topics/498301","class":"topic"},"translations":{"href":"/api/v2/articles/1213277/translations","class":"article_translation"}}}]}}'
311
311
  http_version:
312
- recorded_at: Thu, 15 Aug 2013 21:20:31 GMT
312
+ recorded_at: Mon, 19 Aug 2013 23:51:31 GMT
313
313
  recorded_with: VCR 2.5.0
@@ -23,7 +23,7 @@ http_interactions:
23
23
  Content-Type:
24
24
  - application/json; charset=utf-8
25
25
  Date:
26
- - Thu, 15 Aug 2013 21:20:34 GMT
26
+ - Mon, 19 Aug 2013 23:51:32 GMT
27
27
  ETag:
28
28
  - '"9be8043641e7da379826d5480c34a491"'
29
29
  Status:
@@ -37,11 +37,11 @@ http_interactions:
37
37
  X-Rate-Limit-Limit:
38
38
  - '60'
39
39
  X-Rate-Limit-Remaining:
40
- - '39'
40
+ - '56'
41
41
  X-Rate-Limit-Reset:
42
- - '26'
42
+ - '28'
43
43
  X-Request-Id:
44
- - 7e6c83d2f868c774e6c4dca43c1ff132
44
+ - 61aef69178ba110ee1014589af9cbae4
45
45
  Content-Length:
46
46
  - '48478'
47
47
  Connection:
@@ -109,5 +109,5 @@ http_interactions:
109
109
  customer create","priority":5,"locked_until":null,"description":null,"status":"open","type":"email","labels":[],"language":"de","active_at":"2013-05-13T19:20:43Z","created_at":"2013-05-13T18:12:07Z","updated_at":"2013-05-13T18:12:07Z","received_at":null,"custom_fields":{"my_new_custom_field":null,"my_new_number_field":null,"my_new_date_field":null,"my_new_boolean_field":null,"my_new_list_field":null},"_links":{"self":{"href":"/api/v2/cases/3064","class":"case"},"message":{"href":"/api/v2/cases/3064/message","class":"email"},"customer":{"href":"/api/v2/customers/86101780","class":"customer"},"assigned_user":null,"assigned_group":null,"locked_by":null,"replies":{"href":"/api/v2/cases/3064/replies","class":"reply"},"notes":{"href":"/api/v2/cases/3064/notes","class":"note"},"attachments":{"href":"/api/v2/cases/3064/attachments","class":"attachment"}}},{"external_id":null,"subject":"Testing
110
110
  the Tank again","priority":5,"locked_until":null,"description":null,"status":"open","type":"email","labels":[],"language":"de","active_at":"2013-05-13T19:20:59Z","created_at":"2013-05-13T18:13:39Z","updated_at":"2013-05-13T18:13:39Z","received_at":null,"custom_fields":{"my_new_custom_field":null,"my_new_number_field":null,"my_new_date_field":null,"my_new_boolean_field":null,"my_new_list_field":null},"_links":{"self":{"href":"/api/v2/cases/3065","class":"case"},"message":{"href":"/api/v2/cases/3065/message","class":"email"},"customer":{"href":"/api/v2/customers/86101780","class":"customer"},"assigned_user":null,"assigned_group":null,"locked_by":null,"replies":{"href":"/api/v2/cases/3065/replies","class":"reply"},"notes":{"href":"/api/v2/cases/3065/notes","class":"note"},"attachments":{"href":"/api/v2/cases/3065/attachments","class":"attachment"}}}]}}'
111
111
  http_version:
112
- recorded_at: Thu, 15 Aug 2013 21:20:34 GMT
112
+ recorded_at: Mon, 19 Aug 2013 23:51:33 GMT
113
113
  recorded_with: VCR 2.5.0
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Desk::Client do
3
+ describe DeskApi::Client do
4
4
  subject do
5
- @client ||= Desk::Client.new Desk::CONFIG
5
+ @client ||= DeskApi::Client.new DeskApi::CONFIG
6
6
  end
7
7
 
8
8
  before do
@@ -28,21 +28,21 @@ describe Desk::Client do
28
28
  end
29
29
 
30
30
  after do
31
- Desk.reset!
31
+ DeskApi.reset!
32
32
  end
33
33
 
34
34
  context 'with module configuration' do
35
35
  before do
36
- Desk.configure do |config|
37
- Desk::Configuration.keys.each do |key|
36
+ DeskApi.configure do |config|
37
+ DeskApi::Configuration.keys.each do |key|
38
38
  config.send("#{key}=", @configuration[key])
39
39
  end
40
40
  end
41
41
  end
42
42
 
43
43
  it 'inherits the module configuration' do
44
- client = Desk::Client.new
45
- Desk::Configuration.keys.each do |key|
44
+ client = DeskApi::Client.new
45
+ DeskApi::Configuration.keys.each do |key|
46
46
  client.instance_variable_get(:"@#{key}").should eq(@configuration[key])
47
47
  end
48
48
  end
@@ -51,8 +51,8 @@ describe Desk::Client do
51
51
  context 'with class configuration' do
52
52
  context "during initialization" do
53
53
  it "overrides the module configuration" do
54
- client = Desk::Client.new(@configuration)
55
- Desk::Configuration.keys.each do |key|
54
+ client = DeskApi::Client.new(@configuration)
55
+ DeskApi::Configuration.keys.each do |key|
56
56
  client.instance_variable_get(:"@#{key}").should eq(@configuration[key])
57
57
  end
58
58
  end
@@ -60,14 +60,14 @@ describe Desk::Client do
60
60
 
61
61
  context "after initialization" do
62
62
  it "overrides the module configuration after initialization" do
63
- client = Desk::Client.new
63
+ client = DeskApi::Client.new
64
64
  client.configure do |config|
65
65
  @configuration.each do |key, value|
66
66
  config.send("#{key}=", value)
67
67
  end
68
68
  end
69
69
 
70
- Desk::Configuration.keys.each do |key|
70
+ DeskApi::Configuration.keys.each do |key|
71
71
  client.instance_variable_get(:"@#{key}").should eq(@configuration[key])
72
72
  end
73
73
  end
@@ -104,7 +104,7 @@ describe Desk::Client do
104
104
 
105
105
  describe '#delete', :vcr do
106
106
  it 'deletes a resource' do
107
- subject.delete('/api/v2/topics/556401').status.should eq(204)
107
+ subject.delete('/api/v2/topics/558245').status.should eq(204)
108
108
  end
109
109
  end
110
110
 
@@ -122,12 +122,12 @@ describe Desk::Client do
122
122
  describe '#request' do
123
123
  it 'catches Faraday errors' do
124
124
  allow(subject).to receive(:connection).and_raise(Faraday::Error::ClientError.new('Oops'))
125
- lambda { subject.send(:request, :get, '/path') }.should raise_error(Desk::Error::ClientError)
125
+ lambda { subject.send(:request, :get, '/path') }.should raise_error(DeskApi::Error::ClientError)
126
126
  end
127
127
 
128
128
  it 'catches JSON::ParserError errors' do
129
129
  allow(subject).to receive(:connection).and_raise(JSON::ParserError.new('unexpected token'))
130
- lambda { subject.send(:request, :get, '/path') }.should raise_error(Desk::Error::ParserError)
130
+ lambda { subject.send(:request, :get, '/path') }.should raise_error(DeskApi::Error::ParserError)
131
131
  end
132
132
  end
133
133
  end
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Desk::Configuration do
3
+ describe DeskApi::Configuration do
4
4
  context '#keys' do
5
5
  it 'returns an array of configuration keys' do
6
- Desk::Configuration.keys.should eq([
6
+ DeskApi::Configuration.keys.should eq([
7
7
  :consumer_key,
8
8
  :consumer_secret,
9
9
  :token,
@@ -19,23 +19,23 @@ describe Desk::Configuration do
19
19
 
20
20
  context '#endpoint' do
21
21
  after(:each) do
22
- Desk.reset!
22
+ DeskApi.reset!
23
23
  end
24
24
 
25
25
  it 'returns the endpoint if set' do
26
- Desk.endpoint = 'https://devel.desk.com'
27
- Desk.endpoint.should eq('https://devel.desk.com')
26
+ DeskApi.endpoint = 'https://devel.desk.com'
27
+ DeskApi.endpoint.should eq('https://devel.desk.com')
28
28
  end
29
29
 
30
30
  it 'returns the subdomain endpoint if subdomain is set' do
31
- Desk.subdomain = 'devel'
32
- Desk.endpoint.should eq('https://devel.desk.com')
31
+ DeskApi.subdomain = 'devel'
32
+ DeskApi.endpoint.should eq('https://devel.desk.com')
33
33
  end
34
34
 
35
35
  it 'gives presidence to the endpoint' do
36
- Desk.subdomain = 'subdomain'
37
- Desk.endpoint = 'https://endpoint.desk.com'
38
- Desk.endpoint.should eq('https://endpoint.desk.com')
36
+ DeskApi.subdomain = 'subdomain'
37
+ DeskApi.endpoint = 'https://endpoint.desk.com'
38
+ DeskApi.endpoint.should eq('https://endpoint.desk.com')
39
39
  end
40
40
  end
41
41
 
@@ -57,20 +57,20 @@ describe Desk::Configuration do
57
57
  end
58
58
 
59
59
  it 'overrides the module configuration' do
60
- client = Desk::Client.new
60
+ client = DeskApi::Client.new
61
61
  client.configure do |config|
62
62
  @configuration.each do |key, value|
63
63
  config.send("#{key}=", value)
64
64
  end
65
65
  end
66
66
 
67
- Desk::Configuration.keys.each do |key|
67
+ DeskApi::Configuration.keys.each do |key|
68
68
  client.instance_variable_get(:"@#{key}").should eq(@configuration[key])
69
69
  end
70
70
  end
71
71
 
72
72
  it 'throws an exception if credentials are not set' do
73
- client = Desk::Client.new
73
+ client = DeskApi::Client.new
74
74
  lambda {
75
75
  client.configure do |config|
76
76
  @configuration.each do |key, value|
@@ -79,11 +79,11 @@ describe Desk::Configuration do
79
79
  config.username = nil
80
80
  config.consumer_key = nil
81
81
  end
82
- }.should raise_error(Desk::Error::ConfigurationError)
82
+ }.should raise_error(DeskApi::Error::ConfigurationError)
83
83
  end
84
84
 
85
85
  it 'throws an exception if basic auth credentials are invalid' do
86
- client = Desk::Client.new
86
+ client = DeskApi::Client.new
87
87
  lambda {
88
88
  client.configure do |config|
89
89
  @configuration.each do |key, value|
@@ -92,11 +92,11 @@ describe Desk::Configuration do
92
92
  config.username = 1
93
93
  config.consumer_key = nil
94
94
  end
95
- }.should raise_error(Desk::Error::ConfigurationError)
95
+ }.should raise_error(DeskApi::Error::ConfigurationError)
96
96
  end
97
97
 
98
98
  it 'throws an exception if oauth credentials are invalid' do
99
- client = Desk::Client.new
99
+ client = DeskApi::Client.new
100
100
  lambda {
101
101
  client.configure do |config|
102
102
  @configuration.each do |key, value|
@@ -105,11 +105,11 @@ describe Desk::Configuration do
105
105
  config.username = nil
106
106
  config.consumer_key = 1
107
107
  end
108
- }.should raise_error(Desk::Error::ConfigurationError)
108
+ }.should raise_error(DeskApi::Error::ConfigurationError)
109
109
  end
110
110
 
111
111
  it 'throws an exception if endpoint is not a valid url' do
112
- client = Desk::Client.new
112
+ client = DeskApi::Client.new
113
113
  lambda {
114
114
  client.configure do |config|
115
115
  @configuration.each do |key, value|
@@ -117,7 +117,7 @@ describe Desk::Configuration do
117
117
  end
118
118
  config.endpoint = 'some_funky_endpoint'
119
119
  end
120
- }.should raise_error(Desk::Error::ConfigurationError)
120
+ }.should raise_error(DeskApi::Error::ConfigurationError)
121
121
  end
122
122
  end
123
123
 
@@ -139,7 +139,7 @@ describe Desk::Configuration do
139
139
  end
140
140
 
141
141
  it 'resets the configuration to module defaults' do
142
- client = Desk::Client.new
142
+ client = DeskApi::Client.new
143
143
  client.configure do |config|
144
144
  @configuration.each do |key, value|
145
145
  config.send("#{key}=", value)
@@ -147,7 +147,7 @@ describe Desk::Configuration do
147
147
  end
148
148
  client.reset!
149
149
 
150
- Desk::Configuration.keys.each do |key|
150
+ DeskApi::Configuration.keys.each do |key|
151
151
  client.instance_variable_get(:"@#{key}").should_not eq(@configuration[key])
152
152
  end
153
153
  end
@@ -155,7 +155,7 @@ describe Desk::Configuration do
155
155
 
156
156
  context '#credentials?' do
157
157
  before do
158
- @client = Desk::Client.new
158
+ @client = DeskApi::Client.new
159
159
  end
160
160
 
161
161
  after do