desk_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.rspec +1 -0
- data/.travis.yml +5 -0
- data/.yardopts +3 -0
- data/Gemfile +15 -0
- data/Guardfile +5 -0
- data/LICENSE +7 -0
- data/README.md +185 -0
- data/Rakefile +15 -0
- data/config.rb +7 -0
- data/desk_api.gemspec +36 -0
- data/lib/desk/action/create.rb +15 -0
- data/lib/desk/action/delete.rb +9 -0
- data/lib/desk/action/embedded.rb +12 -0
- data/lib/desk/action/field.rb +33 -0
- data/lib/desk/action/link.rb +29 -0
- data/lib/desk/action/resource.rb +14 -0
- data/lib/desk/action/search.rb +15 -0
- data/lib/desk/action/update.rb +12 -0
- data/lib/desk/client.rb +67 -0
- data/lib/desk/configuration.rb +132 -0
- data/lib/desk/default.rb +67 -0
- data/lib/desk/error/bad_gateway.rb +10 -0
- data/lib/desk/error/bad_request.rb +10 -0
- data/lib/desk/error/client_error.rb +9 -0
- data/lib/desk/error/configuration_error.rb +8 -0
- data/lib/desk/error/conflict.rb +10 -0
- data/lib/desk/error/forbidden.rb +10 -0
- data/lib/desk/error/gateway_timeout.rb +10 -0
- data/lib/desk/error/internal_server_error.rb +10 -0
- data/lib/desk/error/method_not_allowed.rb +10 -0
- data/lib/desk/error/method_not_supported.rb +9 -0
- data/lib/desk/error/not_acceptable.rb +10 -0
- data/lib/desk/error/not_found.rb +10 -0
- data/lib/desk/error/parse_error.rb +9 -0
- data/lib/desk/error/parser_error.rb +9 -0
- data/lib/desk/error/server_error.rb +9 -0
- data/lib/desk/error/service_unavailable.rb +10 -0
- data/lib/desk/error/too_many_requests.rb +10 -0
- data/lib/desk/error/unauthorized.rb +10 -0
- data/lib/desk/error/unprocessable_entity.rb +10 -0
- data/lib/desk/error/unsupported_media_type.rb +10 -0
- data/lib/desk/error.rb +61 -0
- data/lib/desk/rate_limit.rb +26 -0
- data/lib/desk/request/retry.rb +51 -0
- data/lib/desk/resource/article.rb +10 -0
- data/lib/desk/resource/article_translation.rb +8 -0
- data/lib/desk/resource/attachment.rb +8 -0
- data/lib/desk/resource/case.rb +9 -0
- data/lib/desk/resource/company.rb +8 -0
- data/lib/desk/resource/customer.rb +9 -0
- data/lib/desk/resource/integration_url.rb +9 -0
- data/lib/desk/resource/job.rb +7 -0
- data/lib/desk/resource/label.rb +9 -0
- data/lib/desk/resource/macro.rb +9 -0
- data/lib/desk/resource/macro_action.rb +7 -0
- data/lib/desk/resource/note.rb +7 -0
- data/lib/desk/resource/page.rb +81 -0
- data/lib/desk/resource/reply.rb +8 -0
- data/lib/desk/resource/topic.rb +9 -0
- data/lib/desk/resource/topic_translation.rb +9 -0
- data/lib/desk/resource/user_preference.rb +7 -0
- data/lib/desk/resource.rb +53 -0
- data/lib/desk/resources.json +76 -0
- data/lib/desk/response/raise_error.rb +34 -0
- data/lib/desk/version.rb +3 -0
- data/lib/desk.rb +35 -0
- data/spec/cassettes/Desk_Client/_delete/deletes_a_resource.yml +48 -0
- data/spec/cassettes/Desk_Client/_get/fetches_resources.yml +55 -0
- data/spec/cassettes/Desk_Client/_patch/updates_a_resource.yml +62 -0
- data/spec/cassettes/Desk_Client/_post/creates_a_resource.yml +58 -0
- data/spec/cassettes/Desk_Error/_from_response/can_be_created_from_a_faraday_response.yml +54 -0
- data/spec/cassettes/Desk_Error/_from_response/uses_the_body_message_if_present.yml +54 -0
- data/spec/cassettes/Desk_Resource/_by_url/finds_resources_by_url.yml +313 -0
- data/spec/cassettes/Desk_Resource/_create/creates_a_new_topic.yml +58 -0
- data/spec/cassettes/Desk_Resource/_delete/deletes_a_resource.yml +164 -0
- data/spec/cassettes/Desk_Resource/_delete/throws_an_error_deleting_a_non_deletalbe_resource.yml +56 -0
- data/spec/cassettes/Desk_Resource/_exec_/can_be_forced_to_reload.yml +313 -0
- data/spec/cassettes/Desk_Resource/_exec_/loads_the_current_resource.yml +313 -0
- data/spec/cassettes/Desk_Resource/_method_missing/loads_the_resource_to_find_a_suitable_method.yml +313 -0
- data/spec/cassettes/Desk_Resource/_method_missing/raises_an_error_if_method_does_not_exist.yml +313 -0
- data/spec/cassettes/Desk_Resource/_search/allows_searching_on_search_enabled_resources.yml +54 -0
- data/spec/cassettes/Desk_Resource/_update/throws_an_error_updating_a_user.yml +56 -0
- data/spec/cassettes/Desk_Resource/_update/updates_a_topic.yml +118 -0
- data/spec/cassettes/Desk_Resource_Page/_by_id/loads_the_requested_resource.yml +54 -0
- data/spec/cassettes/Desk_Resource_Page/_page/keeps_the_resource_as_loaded.yml +113 -0
- data/spec/cassettes/Desk_Resource_Page/_page/returns_the_current_page_and_loads_if_page_not_defined.yml +313 -0
- data/spec/cassettes/Desk_Resource_Page/_page/sets_the_resource_to_not_loaded.yml +113 -0
- data/spec/desk/client_spec.rb +133 -0
- data/spec/desk/configuration_spec.rb +183 -0
- data/spec/desk/default_spec.rb +69 -0
- data/spec/desk/error_spec.rb +23 -0
- data/spec/desk/rate_limit_spec.rb +42 -0
- data/spec/desk/request/retry_spec.rb +46 -0
- data/spec/desk/resource_spec.rb +119 -0
- data/spec/desk/resources/page_spec.rb +64 -0
- data/spec/desk_spec.rb +43 -0
- data/spec/spec_helper.rb +39 -0
- metadata +347 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'desk/action/create'
|
2
|
+
require 'desk/action/delete'
|
3
|
+
require 'desk/action/embedded'
|
4
|
+
require 'desk/action/field'
|
5
|
+
require 'desk/action/link'
|
6
|
+
require 'desk/action/resource'
|
7
|
+
require 'desk/action/search'
|
8
|
+
require 'desk/action/update'
|
9
|
+
|
10
|
+
require 'desk/error/method_not_supported'
|
11
|
+
|
12
|
+
module Desk
|
13
|
+
class Resource
|
14
|
+
include Desk::Action::Resource
|
15
|
+
include Desk::Action::Link
|
16
|
+
include Desk::Action::Field
|
17
|
+
|
18
|
+
def initialize(client, definition = {}, loaded = false)
|
19
|
+
@client, @loaded, @_changed = client, loaded, {}
|
20
|
+
setup(definition)
|
21
|
+
end
|
22
|
+
|
23
|
+
def by_url(url)
|
24
|
+
definition = client.get(url).body
|
25
|
+
resource(definition._links.self['class']).new(client, definition, true)
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_self
|
29
|
+
@_links.self
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
attr_accessor :client, :loaded, :_changed
|
34
|
+
|
35
|
+
def setup(definition)
|
36
|
+
setup_links(definition._links) if definition._links?
|
37
|
+
setup_fields(definition)
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
def exec!(reload = false)
|
42
|
+
return self if loaded and !reload
|
43
|
+
definition, @loaded = client.get(@_links.self.href).body, true
|
44
|
+
setup(definition)
|
45
|
+
end
|
46
|
+
|
47
|
+
def method_missing(method, *args, &block)
|
48
|
+
self.exec! if !loaded
|
49
|
+
raise Desk::Error::MethodNotSupported unless self.respond_to?(method.to_sym)
|
50
|
+
self.send(method, *args, &block)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
{
|
2
|
+
"_links": {
|
3
|
+
"articles": {
|
4
|
+
"href": "/api/v2/articles",
|
5
|
+
"class": "page"
|
6
|
+
},
|
7
|
+
"cases": {
|
8
|
+
"href": "/api/v2/cases",
|
9
|
+
"class": "page"
|
10
|
+
},
|
11
|
+
"companies": {
|
12
|
+
"href": "/api/v2/companies",
|
13
|
+
"class": "page"
|
14
|
+
},
|
15
|
+
"custom_fields": {
|
16
|
+
"href": "/api/v2/custom_fields",
|
17
|
+
"class": "page"
|
18
|
+
},
|
19
|
+
"customers": {
|
20
|
+
"href": "/api/v2/customers",
|
21
|
+
"class": "page"
|
22
|
+
},
|
23
|
+
"filters": {
|
24
|
+
"href": "/api/v2/filters",
|
25
|
+
"class": "page"
|
26
|
+
},
|
27
|
+
"groups": {
|
28
|
+
"href": "/api/v2/groups",
|
29
|
+
"class": "page"
|
30
|
+
},
|
31
|
+
"inbound_mailboxes": {
|
32
|
+
"href": "/api/v2/inbound_mailboxes",
|
33
|
+
"class": "page"
|
34
|
+
},
|
35
|
+
"integration_urls": {
|
36
|
+
"href": "/api/v2/integration_urls",
|
37
|
+
"class": "page"
|
38
|
+
},
|
39
|
+
"jobs": {
|
40
|
+
"href": "/api/v2/jobs",
|
41
|
+
"class": "page"
|
42
|
+
},
|
43
|
+
"labels": {
|
44
|
+
"href": "/api/v2/labels",
|
45
|
+
"class": "page"
|
46
|
+
},
|
47
|
+
"macros": {
|
48
|
+
"href": "/api/v2/macros",
|
49
|
+
"class": "page"
|
50
|
+
},
|
51
|
+
"rules": {
|
52
|
+
"href": "/api/v2/rules",
|
53
|
+
"class": "page"
|
54
|
+
},
|
55
|
+
"site_settings": {
|
56
|
+
"href": "/api/v2/site_settings",
|
57
|
+
"class": "page"
|
58
|
+
},
|
59
|
+
"system_message": {
|
60
|
+
"href": "/api/v2/system_message",
|
61
|
+
"class": "system_message"
|
62
|
+
},
|
63
|
+
"topics": {
|
64
|
+
"href": "/api/v2/topics",
|
65
|
+
"class": "page"
|
66
|
+
},
|
67
|
+
"twitter_accounts": {
|
68
|
+
"href": "/api/v2/twitter_accounts",
|
69
|
+
"class": "page"
|
70
|
+
},
|
71
|
+
"users": {
|
72
|
+
"href": "/api/v2/users",
|
73
|
+
"class": "page"
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'desk/error/bad_gateway'
|
3
|
+
require 'desk/error/bad_request'
|
4
|
+
require 'desk/error/conflict'
|
5
|
+
require 'desk/error/forbidden'
|
6
|
+
require 'desk/error/gateway_timeout'
|
7
|
+
require 'desk/error/internal_server_error'
|
8
|
+
require 'desk/error/method_not_allowed'
|
9
|
+
require 'desk/error/not_acceptable'
|
10
|
+
require 'desk/error/not_found'
|
11
|
+
require 'desk/error/service_unavailable'
|
12
|
+
require 'desk/error/too_many_requests'
|
13
|
+
require 'desk/error/unauthorized'
|
14
|
+
require 'desk/error/unprocessable_entity'
|
15
|
+
require 'desk/error/unsupported_media_type'
|
16
|
+
|
17
|
+
module Desk
|
18
|
+
module Response
|
19
|
+
class RaiseError < Faraday::Response::Middleware
|
20
|
+
def on_complete(env)
|
21
|
+
status_code = env[:status].to_i
|
22
|
+
error_class = @klass.errors[status_code]
|
23
|
+
raise error_class.from_response(env) if error_class
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(app, klass)
|
27
|
+
@klass = klass
|
28
|
+
super(app)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
Faraday.register_middleware :response, raise_error: lambda { RaiseError}
|
33
|
+
end
|
34
|
+
end
|
data/lib/desk/version.rb
ADDED
data/lib/desk.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'json'
|
3
|
+
require 'forwardable'
|
4
|
+
require 'addressable/uri'
|
5
|
+
|
6
|
+
require 'hashie/mash'
|
7
|
+
require 'active_support/inflector'
|
8
|
+
|
9
|
+
require 'desk/configuration'
|
10
|
+
require 'desk/client'
|
11
|
+
require 'desk/version'
|
12
|
+
|
13
|
+
module Desk
|
14
|
+
class << self
|
15
|
+
include Desk::Configuration
|
16
|
+
|
17
|
+
# Delegate to a Desk::Client
|
18
|
+
#
|
19
|
+
# @return [Desk::Client]
|
20
|
+
def client
|
21
|
+
return @client if instance_variable_defined?(:@client) && @client.hash == options.hash
|
22
|
+
@client = Desk::Client.new(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def method_missing(method_name, *args, &block)
|
26
|
+
return super unless respond_to_missing?(method_name)
|
27
|
+
client.send(method_name, *args, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
def respond_to_missing?(method_name, include_private = false)
|
31
|
+
client.respond_to?(method_name, include_private)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
setup
|
35
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: https://devel.desk.com/api/v2/topics/556401
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
User-Agent:
|
13
|
+
- desk.com Ruby Gem v0.1.0
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 204
|
17
|
+
message:
|
18
|
+
headers:
|
19
|
+
Accept-Ranges:
|
20
|
+
- bytes
|
21
|
+
Cache-Control:
|
22
|
+
- no-cache
|
23
|
+
Date:
|
24
|
+
- Thu, 15 Aug 2013 21:25:38 GMT
|
25
|
+
Status:
|
26
|
+
- 204 No Content
|
27
|
+
Vary:
|
28
|
+
- X-AppVersion
|
29
|
+
X-AppVersion:
|
30
|
+
- '7.9'
|
31
|
+
X-Frame-Options:
|
32
|
+
- SAMEORIGIN
|
33
|
+
X-Rate-Limit-Limit:
|
34
|
+
- '60'
|
35
|
+
X-Rate-Limit-Remaining:
|
36
|
+
- '59'
|
37
|
+
X-Rate-Limit-Reset:
|
38
|
+
- '22'
|
39
|
+
X-Request-Id:
|
40
|
+
- 207b551751f30fa3c1f74de6c8439d47
|
41
|
+
Connection:
|
42
|
+
- keep-alive
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: ''
|
46
|
+
http_version:
|
47
|
+
recorded_at: Thu, 15 Aug 2013 21:25:38 GMT
|
48
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://devel.desk.com/api/v2/cases/3014
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
User-Agent:
|
13
|
+
- desk.com Ruby Gem v0.1.0
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message:
|
18
|
+
headers:
|
19
|
+
Accept-Ranges:
|
20
|
+
- bytes
|
21
|
+
Cache-Control:
|
22
|
+
- must-revalidate, private, max-age=0
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Date:
|
26
|
+
- Thu, 15 Aug 2013 21:20:31 GMT
|
27
|
+
ETag:
|
28
|
+
- '"31cb249bf0be971be83b891b995e19f4"'
|
29
|
+
Status:
|
30
|
+
- 200 OK
|
31
|
+
Vary:
|
32
|
+
- X-AppVersion
|
33
|
+
X-AppVersion:
|
34
|
+
- '7.9'
|
35
|
+
X-Frame-Options:
|
36
|
+
- SAMEORIGIN
|
37
|
+
X-Rate-Limit-Limit:
|
38
|
+
- '60'
|
39
|
+
X-Rate-Limit-Remaining:
|
40
|
+
- '58'
|
41
|
+
X-Rate-Limit-Reset:
|
42
|
+
- '29'
|
43
|
+
X-Request-Id:
|
44
|
+
- 8b43d4f91183871f761bee73f9bca5a7
|
45
|
+
Content-Length:
|
46
|
+
- '942'
|
47
|
+
Connection:
|
48
|
+
- keep-alive
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: '{"external_id":"","subject":"Testing Quick Case","priority":8,"locked_until":null,"description":"Some
|
52
|
+
additional Description regarding this email.","status":"resolved","type":"email","labels":[],"language":"de","active_at":"2013-05-10T19:08:27Z","created_at":"2013-05-10T19:08:10Z","updated_at":"2013-05-10T19:08:10Z","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/3014","class":"case"},"message":{"href":"/api/v2/cases/3014/message","class":"email"},"customer":{"href":"/api/v2/customers/37823480","class":"customer"},"assigned_user":null,"assigned_group":null,"locked_by":null,"replies":{"href":"/api/v2/cases/3014/replies","class":"reply"},"notes":{"href":"/api/v2/cases/3014/notes","class":"note"},"attachments":{"href":"/api/v2/cases/3014/attachments","class":"attachment"}}}'
|
53
|
+
http_version:
|
54
|
+
recorded_at: Thu, 15 Aug 2013 21:20:31 GMT
|
55
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: patch
|
5
|
+
uri: https://devel.desk.com/api/v2/topics/556402
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"name":"Test Updated Topic"}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
User-Agent:
|
13
|
+
- desk.com Ruby Gem v0.1.0
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
Cache-Control:
|
22
|
+
- max-age=0, private, must-revalidate
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Date:
|
26
|
+
- Thu, 15 Aug 2013 21:26:17 GMT
|
27
|
+
ETag:
|
28
|
+
- '"02ad91e6c4bff038228c0649f84e02f2"'
|
29
|
+
Server:
|
30
|
+
- nginx
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
Vary:
|
34
|
+
- X-AppVersion
|
35
|
+
X-AppVersion:
|
36
|
+
- '7.9'
|
37
|
+
X-Frame-Options:
|
38
|
+
- SAMEORIGIN
|
39
|
+
X-Rack-Cache:
|
40
|
+
- invalidate, pass
|
41
|
+
X-Rate-Limit-Limit:
|
42
|
+
- '60'
|
43
|
+
X-Rate-Limit-Remaining:
|
44
|
+
- '59'
|
45
|
+
X-Rate-Limit-Reset:
|
46
|
+
- '43'
|
47
|
+
X-Request-Id:
|
48
|
+
- 7f096fa617be76a27a19e8681eb4ce1c
|
49
|
+
X-Runtime:
|
50
|
+
- '0.109308'
|
51
|
+
X-UA-Compatible:
|
52
|
+
- IE=Edge,chrome=1
|
53
|
+
Content-Length:
|
54
|
+
- '408'
|
55
|
+
Connection:
|
56
|
+
- keep-alive
|
57
|
+
body:
|
58
|
+
encoding: UTF-8
|
59
|
+
string: '{"name":"Test 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"}}}'
|
60
|
+
http_version:
|
61
|
+
recorded_at: Thu, 15 Aug 2013 21:26:17 GMT
|
62
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,58 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://devel.desk.com/api/v2/topics
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"name":"Test Topic"}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
User-Agent:
|
13
|
+
- desk.com Ruby Gem v0.1.0
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 201
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
Accept-Ranges:
|
22
|
+
- bytes
|
23
|
+
Cache-Control:
|
24
|
+
- max-age=0, private, must-revalidate
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Date:
|
28
|
+
- Thu, 15 Aug 2013 21:20:31 GMT
|
29
|
+
ETag:
|
30
|
+
- '"3c4f0bfe1c766352a73767947ef10d16"'
|
31
|
+
Location:
|
32
|
+
- https://devel.desk.com/api/v2/topics/556907
|
33
|
+
Status:
|
34
|
+
- 201 Created
|
35
|
+
Vary:
|
36
|
+
- X-AppVersion
|
37
|
+
X-AppVersion:
|
38
|
+
- '7.9'
|
39
|
+
X-Frame-Options:
|
40
|
+
- SAMEORIGIN
|
41
|
+
X-Rate-Limit-Limit:
|
42
|
+
- '60'
|
43
|
+
X-Rate-Limit-Remaining:
|
44
|
+
- '57'
|
45
|
+
X-Rate-Limit-Reset:
|
46
|
+
- '29'
|
47
|
+
X-Request-Id:
|
48
|
+
- 5674ba3810d8890b8a42aee61fd07310
|
49
|
+
Content-Length:
|
50
|
+
- '400'
|
51
|
+
Connection:
|
52
|
+
- keep-alive
|
53
|
+
body:
|
54
|
+
encoding: UTF-8
|
55
|
+
string: '{"name":"Test 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"}}}'
|
56
|
+
http_version:
|
57
|
+
recorded_at: Thu, 15 Aug 2013 21:20:31 GMT
|
58
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://devel.desk.com/api/v2/articles
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"subject":"Testing","body":"Testing"}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
User-Agent:
|
13
|
+
- desk.com Ruby Gem v0.1.0
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 422
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
Accept-Ranges:
|
22
|
+
- bytes
|
23
|
+
Cache-Control:
|
24
|
+
- no-cache
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Date:
|
28
|
+
- Thu, 15 Aug 2013 21:20:33 GMT
|
29
|
+
Status:
|
30
|
+
- 422 Unprocessable Entity
|
31
|
+
Vary:
|
32
|
+
- X-AppVersion
|
33
|
+
X-AppVersion:
|
34
|
+
- '7.9'
|
35
|
+
X-Frame-Options:
|
36
|
+
- SAMEORIGIN
|
37
|
+
X-Rate-Limit-Limit:
|
38
|
+
- '60'
|
39
|
+
X-Rate-Limit-Remaining:
|
40
|
+
- '41'
|
41
|
+
X-Rate-Limit-Reset:
|
42
|
+
- '27'
|
43
|
+
X-Request-Id:
|
44
|
+
- ea7ad37529e40967a818f50ff549a92f
|
45
|
+
Content-Length:
|
46
|
+
- '71'
|
47
|
+
Connection:
|
48
|
+
- keep-alive
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: '{"message":"Validation Failed","errors":{"_links":{"topic":["blank"]}}}'
|
52
|
+
http_version:
|
53
|
+
recorded_at: Thu, 15 Aug 2013 21:20:33 GMT
|
54
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://devel.desk.com/api/v2/articles
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"subject":"Testing","body":"Testing"}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
User-Agent:
|
13
|
+
- desk.com Ruby Gem v0.1.0
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 422
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
Accept-Ranges:
|
22
|
+
- bytes
|
23
|
+
Cache-Control:
|
24
|
+
- no-cache
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Date:
|
28
|
+
- Thu, 15 Aug 2013 21:20:34 GMT
|
29
|
+
Status:
|
30
|
+
- 422 Unprocessable Entity
|
31
|
+
Vary:
|
32
|
+
- X-AppVersion
|
33
|
+
X-AppVersion:
|
34
|
+
- '7.9'
|
35
|
+
X-Frame-Options:
|
36
|
+
- SAMEORIGIN
|
37
|
+
X-Rate-Limit-Limit:
|
38
|
+
- '60'
|
39
|
+
X-Rate-Limit-Remaining:
|
40
|
+
- '40'
|
41
|
+
X-Rate-Limit-Reset:
|
42
|
+
- '26'
|
43
|
+
X-Request-Id:
|
44
|
+
- 9329fb9e911477d8a2527a0fc833461a
|
45
|
+
Content-Length:
|
46
|
+
- '71'
|
47
|
+
Connection:
|
48
|
+
- keep-alive
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: '{"message":"Validation Failed","errors":{"_links":{"topic":["blank"]}}}'
|
52
|
+
http_version:
|
53
|
+
recorded_at: Thu, 15 Aug 2013 21:20:34 GMT
|
54
|
+
recorded_with: VCR 2.5.0
|