desk 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/.gemtest +0 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +3 -0
  4. data/.yardopts +9 -0
  5. data/Gemfile +12 -0
  6. data/HISTORY.mkd +44 -0
  7. data/LICENSE.mkd +20 -0
  8. data/README.mkd +267 -0
  9. data/Rakefile +23 -0
  10. data/desk.gemspec +44 -0
  11. data/lib/desk.rb +26 -0
  12. data/lib/desk/api.rb +28 -0
  13. data/lib/desk/authentication.rb +25 -0
  14. data/lib/desk/client.rb +28 -0
  15. data/lib/desk/client/article.rb +92 -0
  16. data/lib/desk/client/case.rb +55 -0
  17. data/lib/desk/client/customer.rb +146 -0
  18. data/lib/desk/client/interaction.rb +75 -0
  19. data/lib/desk/client/macro.rb +142 -0
  20. data/lib/desk/client/topic.rb +90 -0
  21. data/lib/desk/client/user.rb +38 -0
  22. data/lib/desk/configuration.rb +98 -0
  23. data/lib/desk/connection.rb +39 -0
  24. data/lib/desk/error.rb +67 -0
  25. data/lib/desk/request.rb +44 -0
  26. data/lib/desk/version.rb +4 -0
  27. data/lib/faraday/request/multipart_with_file.rb +30 -0
  28. data/lib/faraday/request/oauth.rb +23 -0
  29. data/lib/faraday/response/raise_http_4xx.rb +45 -0
  30. data/lib/faraday/response/raise_http_5xx.rb +24 -0
  31. data/spec/desk/api_spec.rb +70 -0
  32. data/spec/desk/client/article_spec.rb +134 -0
  33. data/spec/desk/client/case_spec.rb +99 -0
  34. data/spec/desk/client/customer_spec.rb +158 -0
  35. data/spec/desk/client/interaction_spec.rb +191 -0
  36. data/spec/desk/client/macro_spec.rb +204 -0
  37. data/spec/desk/client/topic_spec.rb +135 -0
  38. data/spec/desk/client/user_spec.rb +58 -0
  39. data/spec/desk/client_spec.rb +10 -0
  40. data/spec/desk_spec.rb +127 -0
  41. data/spec/faraday/response_spec.rb +34 -0
  42. data/spec/fixtures/article.json +50 -0
  43. data/spec/fixtures/article_create.json +54 -0
  44. data/spec/fixtures/article_destroy.json +3 -0
  45. data/spec/fixtures/article_update.json +54 -0
  46. data/spec/fixtures/articles.json +58 -0
  47. data/spec/fixtures/case.json +59 -0
  48. data/spec/fixtures/case_update.json +59 -0
  49. data/spec/fixtures/cases.json +182 -0
  50. data/spec/fixtures/customer.json +58 -0
  51. data/spec/fixtures/customer_create.json +56 -0
  52. data/spec/fixtures/customer_create_email.json +15 -0
  53. data/spec/fixtures/customer_update.json +47 -0
  54. data/spec/fixtures/customer_update_email.json +15 -0
  55. data/spec/fixtures/customers.json +98 -0
  56. data/spec/fixtures/interaction_create.json +126 -0
  57. data/spec/fixtures/interactions.json +139 -0
  58. data/spec/fixtures/macro.json +8 -0
  59. data/spec/fixtures/macro_action.json +9 -0
  60. data/spec/fixtures/macro_action_update.json +12 -0
  61. data/spec/fixtures/macro_actions.json +69 -0
  62. data/spec/fixtures/macro_create.json +13 -0
  63. data/spec/fixtures/macro_destroy.json +3 -0
  64. data/spec/fixtures/macro_update.json +13 -0
  65. data/spec/fixtures/macros.json +24 -0
  66. data/spec/fixtures/topic.json +9 -0
  67. data/spec/fixtures/topic_create.json +14 -0
  68. data/spec/fixtures/topic_destroy.json +3 -0
  69. data/spec/fixtures/topic_update.json +14 -0
  70. data/spec/fixtures/topics.json +35 -0
  71. data/spec/fixtures/user.json +15 -0
  72. data/spec/fixtures/users.json +24 -0
  73. data/spec/helper.rb +55 -0
  74. metadata +464 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ "success":true
3
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "success":true,
3
+ "results":
4
+ {
5
+ "article":
6
+ {
7
+ "id":13,
8
+ "subject":"API Tips",
9
+ "show_in_portal":true,
10
+ "main_content":"Tips on using our API",
11
+ "agent_content":null,
12
+ "email":"Tips on using our API",
13
+ "chat":"Tips on using our API",
14
+ "twitter":"Tips on using our API",
15
+ "question_answer":"Tips on using our API",
16
+ "phone":"Tips on using our API",
17
+ "quickcode":null,
18
+ "created_by":
19
+ {
20
+ "user":
21
+ {
22
+ "id":1,
23
+ "name":"API User",
24
+ "name_public":"API User",
25
+ "email":"apiuser@yoursite.com",
26
+ "created_at":"2011-01-13T22:41:42Z",
27
+ "updated_at":"2011-01-19T22:04:33Z",
28
+ "user_level":"admin",
29
+ "login_count":9,
30
+ "time_zone":"Pacific Time (US & Canada)",
31
+ "last_login_at":"2011-01-19T18:21:52Z",
32
+ "current_login_at":"2011-01-19T22:04:33Z"
33
+ }
34
+ },
35
+ "updated_by":
36
+ {
37
+ "user":
38
+ {
39
+ "id":1,
40
+ "name":"API User",
41
+ "name_public":"API User",
42
+ "email":"apiuser@yoursite.com",
43
+ "created_at":"2011-01-13T22:41:42Z",
44
+ "updated_at":"2011-01-19T22:04:33Z",
45
+ "user_level":"admin",
46
+ "login_count":9,
47
+ "time_zone":"Pacific Time (US & Canada)",
48
+ "last_login_at":"2011-01-19T18:21:52Z",
49
+ "current_login_at":"2011-01-19T22:04:33Z"
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "results":
3
+ [
4
+ {
5
+ "article":
6
+ {
7
+ "id":13,
8
+ "subject":"API Tips",
9
+ "show_in_portal":true,
10
+ "main_content":"Tips on using our API",
11
+ "agent_content":null,
12
+ "email":"Tips on using our API",
13
+ "chat":"Tips on using our API",
14
+ "twitter":"Tips on using our API",
15
+ "question_answer":"Tips on using our API",
16
+ "phone":"Tips on using our API",
17
+ "quickcode":null,
18
+ "created_by":
19
+ {
20
+ "user":
21
+ {
22
+ "id":1,
23
+ "name":"API User",
24
+ "name_public":"API User",
25
+ "email":"apiuser@yoursite.com",
26
+ "created_at":"2011-01-13T22:41:42Z",
27
+ "updated_at":"2011-01-19T22:04:33Z",
28
+ "user_level":"admin",
29
+ "login_count":9,
30
+ "time_zone":"Pacific Time (US & Canada)",
31
+ "last_login_at":"2011-01-19T18:21:52Z",
32
+ "current_login_at":"2011-01-19T22:04:33Z"
33
+ }
34
+ },
35
+ "updated_by":
36
+ {
37
+ "user":
38
+ {
39
+ "id":1,
40
+ "name":"API User",
41
+ "name_public":"API User",
42
+ "email":"apiuser@yoursite.com",
43
+ "created_at":"2011-01-13T22:41:42Z",
44
+ "updated_at":"2011-01-19T22:04:33Z",
45
+ "user_level":"admin",
46
+ "login_count":9,
47
+ "time_zone":"Pacific Time (US & Canada)",
48
+ "last_login_at":"2011-01-19T18:21:52Z",
49
+ "current_login_at":"2011-01-19T22:04:33Z"
50
+ }
51
+ }
52
+ }
53
+ }
54
+ ],
55
+ "page":1,
56
+ "count":20,
57
+ "total":1
58
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "case":
3
+ {
4
+ "id":1,
5
+ "external_id":"123",
6
+ "last_available_at":"2011-02-22T22:30:09Z",
7
+ "created_at":"2011-02-09T17:06:24Z",
8
+ "active_at":"2011-02-22T20:27:31Z",
9
+ "route_at":"2011-02-09T17:06:24Z",
10
+ "first_resolved_at":null,
11
+ "active_user":null,
12
+ "updated_at":"2011-02-22T22:30:09Z",
13
+ "case_status_at":"2011-02-14T17:28:31Z",
14
+ "priority":4,
15
+ "last_saved_by_id":null,
16
+ "interaction_in_at":"2011-02-09T09:06:27Z",
17
+ "assigned_at":"2011-02-09T17:06:24Z",
18
+ "subject":"Welcome to Desk.com",
19
+ "routed_at":null,
20
+ "group":
21
+ {
22
+ "id":1,
23
+ "name":"General",
24
+ "created_at":"2011-02-09T17:06:04Z",
25
+ "updated_at":"2011-02-09T17:06:04Z"
26
+ },
27
+ "user":
28
+ {
29
+ "id":1,
30
+ "name":"Joslyn Esser",
31
+ "name_public":"Joslyn Esser",
32
+ "email":"joslyn@example.com",
33
+ "created_at":"2011-02-09T17:02:46Z",
34
+ "updated_at":"2011-02-16T19:25:10Z",
35
+ "user_level":"agent",
36
+ "login_count":15,
37
+ "time_zone":"Pacific Time (US & Canada)",
38
+ "last_login_at":"2011-02-15T23:32:51Z",
39
+ "current_login_at":"2011-02-16T19:25:10Z"
40
+ },
41
+ "first_opened_at":"2011-02-14T17:28:31Z",
42
+ "channel":"email",
43
+ "resolved_at":null,
44
+ "description":null,
45
+ "customer_id":1,
46
+ "closed_at":null,
47
+ "changed_at":"2011-02-14T17:28:31Z",
48
+ "case_status_type":"open",
49
+ "labels":["Example"],
50
+ "pending_at":null,
51
+ "opened_at":"2011-02-14T17:28:31Z",
52
+ "route_status":"available",
53
+ "thread_count":1,
54
+ "note_count":0,
55
+ "preview":"Thanks for trying Desk.com. We hope your trial goes well and you decide to use Desk.com to wow your customers. Please let us know if there is anything we can do to make your experience better. In the meantime see the tips below for getting started",
56
+ "macros":null,
57
+ "articles":null
58
+ }
59
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "case":
3
+ {
4
+ "id":1,
5
+ "external_id":"123",
6
+ "last_available_at":"2011-02-22T22:30:09Z",
7
+ "created_at":"2011-02-09T17:06:24Z",
8
+ "active_at":"2011-02-22T20:27:31Z",
9
+ "route_at":"2011-02-09T17:06:24Z",
10
+ "first_resolved_at":null,
11
+ "active_user":null,
12
+ "updated_at":"2011-02-22T22:30:09Z",
13
+ "case_status_at":"2011-02-14T17:28:31Z",
14
+ "priority":4,
15
+ "last_saved_by_id":null,
16
+ "interaction_in_at":"2011-02-09T09:06:27Z",
17
+ "assigned_at":"2011-02-09T17:06:24Z",
18
+ "subject":"Welcome to Desk.com",
19
+ "routed_at":null,
20
+ "group":
21
+ {
22
+ "id":1,
23
+ "name":"General",
24
+ "created_at":"2011-02-09T17:06:04Z",
25
+ "updated_at":"2011-02-09T17:06:04Z"
26
+ },
27
+ "user":
28
+ {
29
+ "id":1,
30
+ "name":"Joslyn Esser",
31
+ "name_public":"Joslyn Esser",
32
+ "email":"joslyn@example.com",
33
+ "created_at":"2011-02-09T17:02:46Z",
34
+ "updated_at":"2011-02-16T19:25:10Z",
35
+ "user_level":"agent",
36
+ "login_count":15,
37
+ "time_zone":"Pacific Time (US & Canada)",
38
+ "last_login_at":"2011-02-15T23:32:51Z",
39
+ "current_login_at":"2011-02-16T19:25:10Z"
40
+ },
41
+ "first_opened_at":"2011-02-14T17:28:31Z",
42
+ "channel":"email",
43
+ "resolved_at":null,
44
+ "description":null,
45
+ "customer_id":1,
46
+ "closed_at":null,
47
+ "changed_at":"2011-02-14T17:28:31Z",
48
+ "case_status_type":"open",
49
+ "labels":["Example"],
50
+ "pending_at":null,
51
+ "opened_at":"2011-02-14T17:28:31Z",
52
+ "route_status":"available",
53
+ "thread_count":1,
54
+ "note_count":0,
55
+ "preview":"Thanks for trying Desk.com. We hope your trial goes well and you decide to use Desk.com to wow your customers. Please let us know if there is anything we can do to make your experience better. In the meantime see the tips below for getting started",
56
+ "macros":null,
57
+ "articles":null
58
+ }
59
+ }
@@ -0,0 +1,182 @@
1
+ {
2
+ "results": [
3
+ {
4
+ "case":
5
+ {
6
+ "id":1,
7
+ "last_available_at":"2010-05-11T18:44:39Z",
8
+ "created_at":"2009-11-25T15:00:41Z",
9
+ "active_at":"2010-05-11T18:42:53Z",
10
+ "route_at":"2009-11-25T15:00:41Z",
11
+ "first_resolved_at":"2010-03-10T16:31:21Z",
12
+ "active_user":null,
13
+ "updated_at":"2010-05-11T19:35:57Z",
14
+ "case_status_at":"2010-05-11T19:35:57Z",
15
+ "priority":9,
16
+ "last_saved_by_id":1,
17
+ "interaction_in_at":"2009-11-25T15:00:41Z",
18
+ "assigned_at":"2010-03-12T20:01:43Z",
19
+ "subject":"Andr\u00e9 M\u00fcller test",
20
+ "routed_at":null,
21
+ "group":null,
22
+ "user": {
23
+ "id":1,
24
+ "name":"Jeremy Suriel",
25
+ "name_public":"Jeremy Suriel",
26
+ "email":"jeremysuriel+agent1@gmail.com",
27
+ "created_at":"2009-11-25T14:58:39Z",
28
+ "updated_at":"2010-07-19T02:36:21Z",
29
+ "user_level":"sysadmin",
30
+ "login_count":561,
31
+ "time_zone":"Eastern Time (US & Canada)",
32
+ "last_login_at":"2010-07-18T02:06:08Z"
33
+ },
34
+ "first_opened_at":"2010-03-09T15:27:00Z",
35
+ "channel":"chat",
36
+ "resolved_at":"2010-03-10T16:31:21Z",
37
+ "description":"test",
38
+ "customer_id":2,
39
+ "closed_at":"2010-05-11T19:35:57Z",
40
+ "changed_at":"2010-05-11T19:35:57Z",
41
+ "case_status_type":"closed",
42
+ "labels":"test, reload",
43
+ "pending_at":null,
44
+ "opened_at":"2010-03-09T15:27:00Z",
45
+ "route_status":"available",
46
+ "thread_count":1,
47
+ "note_count":1,
48
+ "preview":null,
49
+ "macros":["Example Macros"],
50
+ "articles":["Example Kb Article"],
51
+ "custom_c":"",
52
+ "custom_order":""
53
+ }
54
+ },
55
+ {
56
+ "case":
57
+ {
58
+ "id":2,
59
+ "last_available_at":"2010-03-09T16:08:51Z",
60
+ "created_at":"2009-11-25T15:35:57Z",
61
+ "active_at":"2010-03-09T16:08:43Z",
62
+ "route_at":"2009-11-25T15:35:57Z",
63
+ "first_resolved_at":null,
64
+ "active_user":null,
65
+ "updated_at":"2010-03-18T15:45:34Z",
66
+ "case_status_at":"2010-03-09T16:08:43Z",
67
+ "priority":5,
68
+ "last_saved_by_id":null,
69
+ "interaction_in_at":"2009-11-25T15:35:57Z",
70
+ "assigned_at":null,
71
+ "subject":"test2",
72
+ "routed_at":null,
73
+ "group":null,
74
+ "user":null,
75
+ "first_opened_at":"2010-03-09T16:08:43Z",
76
+ "channel":"twitter",
77
+ "resolved_at":null,
78
+ "description":"test2",
79
+ "customer_id":8,
80
+ "closed_at":null,
81
+ "changed_at":"2010-03-18T15:45:34Z",
82
+ "case_status_type":"open",
83
+ "labels":"",
84
+ "pending_at":null,
85
+ "opened_at":"2010-03-09T16:08:43Z",
86
+ "route_status":"available",
87
+ "thread_count":1,
88
+ "note_count":1,
89
+ "preview":null,
90
+ "macros":null,
91
+ "articles":null,
92
+ "custom_c":null,
93
+ "custom_order":null
94
+ }
95
+ },
96
+ {
97
+ "case":
98
+ {
99
+ "id":3,
100
+ "last_available_at":null,
101
+ "created_at":"2009-11-25T15:35:59Z",
102
+ "active_at":null,
103
+ "route_at":"2009-11-25T15:35:59Z",
104
+ "first_resolved_at":null,
105
+ "active_user":null,
106
+ "updated_at":"2010-03-18T15:45:34Z",
107
+ "case_status_at":"2010-02-23T01:26:59Z",
108
+ "priority":5,
109
+ "last_saved_by_id":1,
110
+ "interaction_in_at":"2009-11-25T15:35:59Z",
111
+ "assigned_at":null,
112
+ "subject":"yo",
113
+ "routed_at":null,
114
+ "group":null,
115
+ "user":null,
116
+ "first_opened_at":"2009-11-26T15:09:01Z",
117
+ "channel":"twitter",
118
+ "resolved_at":null,
119
+ "description":"yo",
120
+ "customer_id":8,
121
+ "closed_at":null,
122
+ "changed_at":"2010-03-18T15:45:34Z",
123
+ "case_status_type":"open",
124
+ "labels":"",
125
+ "pending_at":null,
126
+ "opened_at":"2009-11-26T15:09:01Z",
127
+ "route_status":"available",
128
+ "thread_count":3,
129
+ "note_count":1,
130
+ "preview":"yo",
131
+ "macros":null,
132
+ "articles":null,
133
+ "custom_c":null,
134
+ "custom_order":null
135
+ }
136
+ },
137
+ {
138
+ "case":
139
+ {
140
+ "id":4,
141
+ "last_available_at":null,
142
+ "created_at":"2009-11-25T15:36:01Z",
143
+ "active_at":null,
144
+ "route_at":"2009-11-25T15:36:01Z",
145
+ "first_resolved_at":null,
146
+ "active_user":null,
147
+ "updated_at":"2010-03-18T15:45:34Z",
148
+ "case_status_at":"2010-02-23T01:26:59Z",
149
+ "priority":5,
150
+ "last_saved_by_id":1,
151
+ "interaction_in_at":"2009-11-25T15:36:01Z",
152
+ "assigned_at":null,
153
+ "subject":"Yo yo",
154
+ "routed_at":null,
155
+ "group":null,
156
+ "user":null,
157
+ "first_opened_at":"2009-11-27T17:44:29Z",
158
+ "channel":"twitter",
159
+ "resolved_at":null,
160
+ "description":"Yo yo",
161
+ "customer_id":8,
162
+ "closed_at":null,
163
+ "changed_at":"2010-03-18T15:45:34Z",
164
+ "case_status_type":"open",
165
+ "labels":"",
166
+ "pending_at":null,
167
+ "opened_at":"2009-11-27T17:44:29Z",
168
+ "route_status":"available",
169
+ "thread_count":1,
170
+ "note_count":1,
171
+ "preview":null,
172
+ "macros":null,
173
+ "articles":null,
174
+ "custom_c":null,
175
+ "custom_order":null
176
+ }
177
+ }
178
+ ],
179
+ "page":1,
180
+ "count":4,
181
+ "total":150
182
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "customer": {
3
+ "custom_test": null,
4
+ "first_name": "Jeremy",
5
+ "last_name": "Suriel",
6
+ "phones": [
7
+
8
+ ],
9
+ "custom_order": "4",
10
+ "custom_t2": "",
11
+ "custom_i": "",
12
+ "emails": [
13
+ {
14
+ "email": {
15
+ "verified_at": "2009-11-27T21:41:11-05:00",
16
+ "created_at": "2009-11-27T21:40:55-05:00",
17
+ "updated_at": "2009-11-27T21:41:11-05:00",
18
+ "customer_contact_type": "home",
19
+ "email": "jeremysuriel@...com"
20
+ }
21
+ }
22
+ ],
23
+ "custom_t3": null,
24
+ "custom_t": "",
25
+ "addresses": [
26
+ {
27
+ "address": {
28
+ "region": "NY",
29
+ "city": "Commack",
30
+ "location": "67 Harned Road, Commack, NY 11725, USA",
31
+ "created_at": "2009-12-22T16:21:23-05:00",
32
+ "street_2": null,
33
+ "country": "US",
34
+ "updated_at": "2009-12-22T16:32:37-05:00",
35
+ "postalcode": "11730",
36
+ "street": "67 Harned Road",
37
+ "lng": "-73.196225",
38
+ "customer_contact_type": "home",
39
+ "lat": "40.716894"
40
+ }
41
+ }
42
+ ],
43
+ "twitters": [
44
+ {
45
+ "twitter": {
46
+ "profile_image_url": "http://a3.twimg.com...",
47
+ "created_at": "2009-11-25T10:35:56-05:00",
48
+ "updated_at": "2010-05-29T22:41:55-04:00",
49
+ "twitter_user_id": 12267802,
50
+ "followers_count": 93,
51
+ "verified": false,
52
+ "login": "jrmey"
53
+ }
54
+ }
55
+ ],
56
+ "id": 8
57
+ }
58
+ }