helpscout 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/README.markdown +6 -6
- data/VERSION +1 -1
- data/helpscout.gemspec +7 -7
- data/lib/helpscout.rb +1 -1
- data/lib/helpscout/client.rb +758 -0
- data/lib/helpscout/models.rb +654 -164
- metadata +22 -54
- data/lib/helpscout/base.rb +0 -270
data/lib/helpscout/models.rb
CHANGED
@@ -1,49 +1,170 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Help Scout API V1 Client
|
2
|
+
# http://developer.helpscout.net/
|
3
|
+
#
|
4
|
+
# These models are used by the HelpScout client.
|
5
|
+
#
|
6
|
+
# They include wrappers for the three response envelopes, as well as wrappers
|
7
|
+
# for the JSON hashes returned in SingleItemEnvelope and CollectionsEnvelope.
|
8
|
+
#
|
9
|
+
# All date/times returned by the API are in ISO8601 format and in UTC timezone.
|
3
10
|
|
4
11
|
module HelpScout
|
12
|
+
|
13
|
+
# Response Envelopes
|
14
|
+
# http://developer.helpscout.net/
|
15
|
+
#
|
16
|
+
# The Help Scout API will return one of three envelopes, depending upon the
|
17
|
+
# request issued.
|
18
|
+
|
19
|
+
# Single Item Envelope
|
20
|
+
class SingleItemEnvelope
|
21
|
+
attr_reader :item
|
22
|
+
|
23
|
+
# Creates a new SingleItemEnvelope object from a Hash of attributes
|
24
|
+
def initialize(object)
|
25
|
+
@item = object["item"]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Collections Envelope
|
30
|
+
class CollectionsEnvelope
|
31
|
+
attr_reader :page, :pages, :count, :items
|
32
|
+
|
33
|
+
# Creates a new CollectionsEnvelope object from a Hash of attributes
|
34
|
+
def initialize(object)
|
35
|
+
@page = object["page"]
|
36
|
+
@pages = object["pages"]
|
37
|
+
@count = object["count"]
|
38
|
+
@items = object["items"]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Error Envelope
|
43
|
+
class ErrorEnvelope
|
44
|
+
attr_reader :status, :message
|
45
|
+
|
46
|
+
# Creates a new ErrorEnvelope object from a Hash of attributes
|
47
|
+
def initialize(object)
|
48
|
+
@status = object["status"]
|
49
|
+
@message = object["message"]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
# Client Objects
|
55
|
+
|
56
|
+
# Mailbox
|
57
|
+
# http://developer.helpscout.net/objects/mailbox/
|
58
|
+
# http://developer.helpscout.net/objects/mailbox/mailbox-ref/
|
59
|
+
#
|
60
|
+
# MailboxRefs are a subset of a full Mailbox object, and only include the
|
61
|
+
# attributes marked with a *.
|
62
|
+
#
|
63
|
+
# MailboxRefs are returned by endpoints that include multiple mailboxes.
|
64
|
+
# A full Mailbox object can be obtained by fetching a single mailbox directly.
|
65
|
+
#
|
66
|
+
# Name Type Example Notes
|
67
|
+
# *id Int 1234 Unique identifier
|
68
|
+
# *name String Feedback Name of the Mailbox
|
69
|
+
# slug String 47204a026903ce6d Key used to represent this
|
70
|
+
# Mailbox
|
71
|
+
# email String feedback@support.com Email address
|
72
|
+
# createdAt DateTime 2012-07-23T12:34:12Z UTC time when this mailbox was
|
73
|
+
# created.
|
74
|
+
# modifiedAt DateTime 2012-07-24T20:18:33Z UTC time when this mailbox was
|
75
|
+
# modified.
|
76
|
+
|
5
77
|
class Mailbox
|
6
|
-
|
78
|
+
attr_reader :id, :name, :slug, :email, :createdAt, :modifiedAt
|
79
|
+
|
80
|
+
# Creates a new Mailbox object from a Hash of attributes
|
7
81
|
def initialize(object)
|
82
|
+
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
83
|
+
@modifiedAt = DateTime.iso8601(object["modifiedAt"]) if object["modifiedAt"]
|
84
|
+
|
8
85
|
@id = object["id"]
|
9
86
|
@name = object["name"]
|
87
|
+
|
10
88
|
@slug = object["slug"]
|
11
89
|
@email = object["email"]
|
12
|
-
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
13
|
-
@modifiedAt = DateTime.iso8601(object["modifiedAt"]) if object["modifiedAt"]
|
14
90
|
end
|
91
|
+
end
|
15
92
|
|
16
|
-
class Folder
|
17
|
-
attr_accessor :id, :name, :type, :userId, :totalCount, :activeCount, :modifiedAt
|
18
|
-
|
19
|
-
FOLDER_TYPE_UNASSIGNED = "unassigned"
|
20
|
-
FOLDER_TYPE_MY_TICKETS = "mytickets"
|
21
|
-
FOLDER_TYPE_DRAFTS = "drafts"
|
22
|
-
FOLDER_TYPE_ASSIGNED = "assigned"
|
23
|
-
FOLDER_TYPE_CLOSED = "closed"
|
24
|
-
FOLDER_TYPE_SPAM = "spam"
|
25
93
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
94
|
+
# Conversation
|
95
|
+
# http://developer.helpscout.net/objects/conversation/
|
96
|
+
#
|
97
|
+
# Name Type Example Notes
|
98
|
+
# id Int 2391938111 Unique identifier
|
99
|
+
# folderId Int 1234 ID of the Folder to which
|
100
|
+
# this conversation resides.
|
101
|
+
# isDraft Boolean false Is this a draft?
|
102
|
+
# number Int 349 The conversation number
|
103
|
+
# displayed in the UI.
|
104
|
+
# owner User User of the Help Scout user
|
105
|
+
# that is currently assigned
|
106
|
+
# to this conversation
|
107
|
+
# mailbox Mailbox Mailbox to which this
|
108
|
+
# conversation belongs.
|
109
|
+
# customer Customer Customer to which this
|
110
|
+
# conversation belongs.
|
111
|
+
# threadCount Int 4 This count represents the
|
112
|
+
# number of published threads
|
113
|
+
# found on the conversation
|
114
|
+
# (it does not include line
|
115
|
+
# items, drafts or threads
|
116
|
+
# held for review by Traffic
|
117
|
+
# Cop).
|
118
|
+
# status String active Status of the conversation.
|
119
|
+
# subject String I need help!
|
120
|
+
# preview String Hello, I...
|
121
|
+
# createdBy Customer Either the Customer or User
|
122
|
+
# - or - that created this
|
123
|
+
# User conversation.
|
124
|
+
# Inspect the Source object
|
125
|
+
# for clarification.
|
126
|
+
# createdAt DateTime 2012-07-23T12:34:12Z UTC time when this
|
127
|
+
# conversation was created.
|
128
|
+
# modifiedAt DateTime 2012-07-24T20:18:33Z UTC time when this.
|
129
|
+
# conversation was modified.
|
130
|
+
# closedAt DateTime UTC time when this
|
131
|
+
# conversation was closed.
|
132
|
+
# Null if not closed.
|
133
|
+
# closedBy User User of the Help Scout user
|
134
|
+
# that closed this
|
135
|
+
# conversation.
|
136
|
+
# source Source Specifies the method in
|
137
|
+
# which this conversation was
|
138
|
+
# created.
|
139
|
+
# cc Array Collection of strings
|
140
|
+
# representing emails.
|
141
|
+
# bcc Array Collection of strings
|
142
|
+
# representing emails.
|
143
|
+
# tags Array Collection of strings
|
144
|
+
# threads Array Collection of Thread
|
145
|
+
# objects. Only available when
|
146
|
+
# retrieving a single
|
147
|
+
# Conversation
|
148
|
+
#
|
149
|
+
# Possible values for status include:
|
150
|
+
# * STATUS_ACTIVE
|
151
|
+
# * STATUS_PENDING
|
152
|
+
# * STATUS_CLOSED
|
153
|
+
# * STATUS_SPAM
|
37
154
|
|
38
155
|
class Conversation
|
39
|
-
|
156
|
+
attr_reader :id, :folderId, :isDraft, :number, :owner, :mailbox, :customer, :threadCount, :status, :subject, :preview, :createdBy, :createdAt, :modifiedAt, :closedAt, :closedBy, :source, :cc, :bcc, :tags, :threads, :url
|
40
157
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
158
|
+
STATUS_ACTIVE = "active"
|
159
|
+
STATUS_PENDING = "pending"
|
160
|
+
STATUS_CLOSED = "closed"
|
161
|
+
STATUS_SPAM = "spam"
|
45
162
|
|
163
|
+
# Creates a new Conversation object from a Hash of attributes
|
46
164
|
def initialize(object)
|
165
|
+
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
166
|
+
@modifiedAt = DateTime.iso8601(object["userModifiedAt"]) if object["userModifiedAt"]
|
167
|
+
@closedAt = DateTime.iso8601(object["closedAt"]) if object["closedAt"]
|
47
168
|
@id = object["id"]
|
48
169
|
@folderId = object["folderId"]
|
49
170
|
@isDraft = object["isDraft"]
|
@@ -55,9 +176,6 @@ module HelpScout
|
|
55
176
|
@status = object["status"]
|
56
177
|
@subject = object["subject"]
|
57
178
|
@preview = object["preview"]
|
58
|
-
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
59
|
-
@modifiedAt = DateTime.iso8601(object["modifiedAt"]) if object["modifiedAt"]
|
60
|
-
@closedAt = DateTime.iso8601(object["closedAt"]) if object["closedAt"]
|
61
179
|
@closedBy = User.new(object["closedBy"]) if object["closedBy"]
|
62
180
|
|
63
181
|
@source = nil
|
@@ -65,9 +183,9 @@ module HelpScout
|
|
65
183
|
@source = Source.new(object["source"])
|
66
184
|
|
67
185
|
if object["createdBy"]
|
68
|
-
if @source.type == Source::
|
186
|
+
if @source.type == Source::VIA_CUSTOMER
|
69
187
|
@createdBy = Customer.new(object["createdBy"])
|
70
|
-
elsif @source.type == Source::
|
188
|
+
elsif @source.type == Source::VIA_USER
|
71
189
|
@createdBy = User.new(object["createdBy"])
|
72
190
|
end
|
73
191
|
end
|
@@ -83,91 +201,135 @@ module HelpScout
|
|
83
201
|
@threads << Thread.new(thread)
|
84
202
|
end
|
85
203
|
end
|
86
|
-
end
|
87
204
|
|
88
|
-
|
89
|
-
"Last Modified: #{@modifiedAt}\nAssigned to: #{@owner}\nSubject: #{@subject}\n#{@preview}"
|
205
|
+
@url = "https://secure.helpscout.net/conversation/#{@id}/#{@number}/"
|
90
206
|
end
|
91
207
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
def initialize(object)
|
96
|
-
@id = object["id"]
|
97
|
-
@mimeType = object["mimeType"]
|
98
|
-
@filename = object["filename"]
|
99
|
-
@size = object["size"]
|
100
|
-
@width = object["width"]
|
101
|
-
@height = object["height"]
|
102
|
-
@url = object["url"]
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
class AttachmentData
|
107
|
-
attr_accessor :id, :data
|
108
|
-
|
109
|
-
def initialize(object)
|
110
|
-
@id = object["id"]
|
111
|
-
@data = object["data"]
|
112
|
-
end
|
208
|
+
# Returns a String suitable for display
|
209
|
+
def to_s
|
210
|
+
"Last Modified: #{@modifiedAt}\nStatus: #{@status}\nAssigned to: #{@owner}\nSubject: #{@subject}\n#{@preview}"
|
113
211
|
end
|
114
212
|
|
115
|
-
class Source
|
116
|
-
attr_accessor :type, :via
|
117
|
-
|
118
|
-
SOURCE_TYPE_EMAIL = "email"
|
119
|
-
SOURCE_TYPE_WEB = "web"
|
120
|
-
SOURCE_TYPE_NOTIFICATION = "notification"
|
121
|
-
SOURCE_TYPE_EMAIL_FWD = "emailfwd"
|
122
213
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
214
|
+
# Conversation::Thread
|
215
|
+
# http://developer.helpscout.net/objects/conversation/thread/
|
216
|
+
#
|
217
|
+
# Name Type Example Notes
|
218
|
+
# id Int 88171881 Unique identifier
|
219
|
+
# assignedTo User User of the Help Scout user
|
220
|
+
# to which this conversation
|
221
|
+
# has been assigned.
|
222
|
+
# status String active Status of the thread. Thread
|
223
|
+
# status is only updated when
|
224
|
+
# there is a status change.
|
225
|
+
# Otherwise, the status will
|
226
|
+
# be set to STATUS_NO_CHANGE.
|
227
|
+
# createdAt DateTime 2012-07-23T12:34:12Z UTC time when this thread
|
228
|
+
# was created.
|
229
|
+
# createdBy Customer Either the Customer or User
|
230
|
+
# - or - that created this
|
231
|
+
# User conversation. Inspect the
|
232
|
+
# Source object for
|
233
|
+
# clarification.
|
234
|
+
# source Source
|
235
|
+
# fromMailbox Mailbox If the conversation was
|
236
|
+
# moved, fromMailbox
|
237
|
+
# represents the Mailbox from
|
238
|
+
# which it was moved.
|
239
|
+
# type String message The type of thread.
|
240
|
+
# state String published The state of the thread.
|
241
|
+
# customer Customer If type is message, this is
|
242
|
+
# the Customer of the customer
|
243
|
+
# in which the message was
|
244
|
+
# sent. If type is customer,
|
245
|
+
# this is the Customer of the
|
246
|
+
# customer that initiated the
|
247
|
+
# thread.
|
248
|
+
# body String Thank you.
|
249
|
+
# to Array Collection of Strings
|
250
|
+
# representing emails.
|
251
|
+
# cc Array Collection of Strings
|
252
|
+
# representing emails.
|
253
|
+
# bcc Array Collection of Strings
|
254
|
+
# representing emails.
|
255
|
+
# attachments Array Collection of Attachment
|
256
|
+
# objects, if they exist.
|
257
|
+
#
|
258
|
+
# Possible values for state include:
|
259
|
+
# * STATE_PUBLISHED
|
260
|
+
# * STATE_DRAFT
|
261
|
+
# * STATE_UNDER_REVIEW
|
262
|
+
#
|
263
|
+
# A state of STATE_UNDER_REVIEW means the thread has been stopped by Traffic
|
264
|
+
# Cop and is waiting to be confirmed (or discarded) by the person that
|
265
|
+
# created the thread.
|
266
|
+
#
|
267
|
+
# Traffic Cop is the Help Scout feature that stops a thread from going out
|
268
|
+
# if multiple Users act on the same Help Scout simultaneously.
|
269
|
+
#
|
270
|
+
# Possible values for status include:
|
271
|
+
# * STATUS_ACTIVE
|
272
|
+
# * STATUS_NO_CHANGE
|
273
|
+
# * STATUS_PENDING
|
274
|
+
# * STATUS_CLOSED
|
275
|
+
# * STATUS_SPAM
|
276
|
+
#
|
277
|
+
# Possible values for type include:
|
278
|
+
# * TYPE_NOTE
|
279
|
+
# * TYPE_MESSAGE
|
280
|
+
# * TYPE_CUSTOMER
|
281
|
+
# * TYPE_LINEITEM
|
282
|
+
# * TYPE_FWD_PARENT
|
283
|
+
# * TYPE_FWD_CHILD
|
284
|
+
#
|
285
|
+
# TYPE_LINEITEM represents a change of state on the conversation. This could
|
286
|
+
# include, but not limited to, the conversation was assigned, the status
|
287
|
+
# changed, the conversation was moved from one mailbox to another, etc. A
|
288
|
+
# line item won't have a body, to/cc/bcc lists, or attachments.
|
289
|
+
#
|
290
|
+
# When a conversation is forwarded, a new conversation is created to
|
291
|
+
# represent the forwarded conversation.
|
292
|
+
# * TYPE_FWD_PARENT is the type set on the thread of the original
|
293
|
+
# conversation that initiated the forward event.
|
294
|
+
# * TYPE_FWD_CHILD is the type set on the first thread of the new forwarded
|
295
|
+
# conversation.
|
131
296
|
|
132
297
|
class Thread
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
#
|
153
|
-
THREAD_TYPE_FWD_PARENT = "forwardparent" # forwardparent is the type set on the thread of the original conversation that initiated the forward event.
|
154
|
-
THREAD_TYPE_FWD_CHILD = "forwardchild" # forwardchild is the type set on the first thread of the new forwarded conversation.
|
155
|
-
|
156
|
-
|
298
|
+
attr_reader :id, :assignedTo, :status, :createdAt, :createdBy, :source, :fromMailbox, :type, :state, :customer, :body, :to, :cc, :bcc, :attachments
|
299
|
+
|
300
|
+
STATE_PUBLISHED = "published"
|
301
|
+
STATE_DRAFT = "draft"
|
302
|
+
STATE_UNDER_REVIEW = "underreview"
|
303
|
+
|
304
|
+
STATUS_ACTIVE = "active"
|
305
|
+
STATUS_NO_CHANGE = "nochange"
|
306
|
+
STATUS_PENDING = "pending"
|
307
|
+
STATUS_CLOSED = "closed"
|
308
|
+
STATUS_SPAM = "spam"
|
309
|
+
|
310
|
+
TYPE_NOTE = "note"
|
311
|
+
TYPE_MESSAGE = "message"
|
312
|
+
TYPE_CUSTOMER = "customer"
|
313
|
+
TYPE_LINEITEM = "lineitem"
|
314
|
+
TYPE_FWD_PARENT = "forwardparent"
|
315
|
+
TYPE_FWD_CHILD = "forwardchild"
|
316
|
+
|
317
|
+
# Creates a new Conversation::Thread object from a Hash of attributes
|
157
318
|
def initialize(object)
|
319
|
+
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
320
|
+
|
158
321
|
@id = object["id"]
|
159
322
|
@assignedTo = User.new(object["assignedTo"]) if object["assignedTo"]
|
160
323
|
@status = object["status"]
|
161
|
-
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
162
324
|
|
163
325
|
@source = nil
|
164
326
|
if object["source"]
|
165
327
|
@source = Source.new(object["source"])
|
166
328
|
|
167
329
|
if object["createdBy"]
|
168
|
-
if @source.type == Source::
|
330
|
+
if @source.type == Source::VIA_CUSTOMER
|
169
331
|
@createdBy = Customer.new(object["createdBy"])
|
170
|
-
elsif @source.type == Source::
|
332
|
+
elsif @source.type == Source::VIA_USER
|
171
333
|
@createdBy = User.new(object["createdBy"])
|
172
334
|
end
|
173
335
|
end
|
@@ -190,21 +352,102 @@ module HelpScout
|
|
190
352
|
end
|
191
353
|
end
|
192
354
|
|
355
|
+
# Returns a String suitable for display
|
193
356
|
def to_s
|
194
357
|
"#{@customer}: #{@body}"
|
195
358
|
end
|
196
359
|
end
|
197
360
|
|
361
|
+
|
362
|
+
# Conversation::Attachment
|
363
|
+
# http://developer.helpscout.net/objects/conversation/attachment/
|
364
|
+
#
|
365
|
+
# Name Type Example Notes
|
366
|
+
# id Int 12391 Unique identifier
|
367
|
+
# mimeType String image/jpeg
|
368
|
+
# filename String logo.jpg
|
369
|
+
# size Int 22 Size of the attachment in bytes.
|
370
|
+
# width Int 160
|
371
|
+
# height Int 160
|
372
|
+
# url String https://.../logo.jpg Public-facing url where
|
373
|
+
# attachment can be downloaded
|
374
|
+
|
375
|
+
class Attachment
|
376
|
+
attr_reader :id, :mimeType, :filename, :size, :width, :height, :url
|
377
|
+
|
378
|
+
# Creates a new Conversation::Attachment object from a Hash of attributes
|
379
|
+
def initialize(object)
|
380
|
+
@id = object["id"]
|
381
|
+
@mimeType = object["mimeType"]
|
382
|
+
@filename = object["filename"]
|
383
|
+
@size = object["size"]
|
384
|
+
@width = object["width"]
|
385
|
+
@height = object["height"]
|
386
|
+
@url = object["url"]
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
|
391
|
+
# Conversation::AttachmentData
|
392
|
+
# http://developer.helpscout.net/objects/conversation/attachment-data/
|
393
|
+
#
|
394
|
+
# Name Type Example Notes
|
395
|
+
# id Int 887171 Unique identifier
|
396
|
+
# data String base64 encoded data
|
397
|
+
|
398
|
+
class AttachmentData
|
399
|
+
attr_reader :id, :data
|
400
|
+
|
401
|
+
# Creates a new Conversation::AttachmentData object from a Hash of
|
402
|
+
# attributes
|
403
|
+
def initialize(object)
|
404
|
+
@id = object["id"]
|
405
|
+
@data = object["data"]
|
406
|
+
end
|
407
|
+
end
|
198
408
|
end
|
199
409
|
|
410
|
+
|
411
|
+
# User
|
412
|
+
# http://developer.helpscout.net/objects/user/
|
413
|
+
# http://developer.helpscout.net/objects/user/user-ref/
|
414
|
+
#
|
415
|
+
# UserRefs are a subset of a full User object, and only include the attributes
|
416
|
+
# marked with a *.
|
417
|
+
#
|
418
|
+
# UserRefs are returned by endpoints that include multiple users.
|
419
|
+
# A full User object can be obtained by fetching a single user directly.
|
420
|
+
#
|
421
|
+
# Name Type Example Notes
|
422
|
+
# *id Int 1234 Unique identifier
|
423
|
+
# *firstName String Jack
|
424
|
+
# *lastName String Sprout
|
425
|
+
# *email String jack.sprout@gmail.com
|
426
|
+
# role String owner Role of this user.
|
427
|
+
# timezone String America/New_York
|
428
|
+
# photoUrl String http://.../avatar.jpg The user's photo, if one
|
429
|
+
# exists.
|
430
|
+
# createdAt DateTime 2011-04-01T03:18:33Z UTC time when this user was
|
431
|
+
# created.
|
432
|
+
# modifiedAt DateTime 2012-07-24T20:18:33Z UTC time when this user was
|
433
|
+
# modified.
|
434
|
+
#
|
435
|
+
# Possible values for role include:
|
436
|
+
# * ROLE_OWNER
|
437
|
+
# * ROLE_ADMIN
|
438
|
+
# * ROLE_USER
|
439
|
+
|
200
440
|
class User
|
201
|
-
|
441
|
+
attr_reader :id, :firstName, :lastName, :email, :role, :timezone, :photoUrl, :createdAt, :createdBy
|
202
442
|
|
203
|
-
|
204
|
-
|
205
|
-
|
443
|
+
ROLE_OWNER = "owner"
|
444
|
+
ROLE_ADMIN = "admin"
|
445
|
+
ROLE_USER = "user"
|
206
446
|
|
447
|
+
# Creates a new User object from a Hash of attributes
|
207
448
|
def initialize(object)
|
449
|
+
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
450
|
+
|
208
451
|
@id = object["id"]
|
209
452
|
@firstName = object["firstName"]
|
210
453
|
@lastName = object["lastName"]
|
@@ -212,31 +455,80 @@ module HelpScout
|
|
212
455
|
@role = object["role"]
|
213
456
|
@timezone = object["timezone"]
|
214
457
|
@photoUrl = object["photoUrl"]
|
215
|
-
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
216
458
|
@createdBy = object["createdBy"]
|
217
459
|
end
|
218
460
|
|
461
|
+
# Returns a String suitable for display
|
219
462
|
def to_s
|
220
463
|
"#{@firstName} #{@lastName}"
|
221
464
|
end
|
222
465
|
end
|
223
466
|
|
467
|
+
|
468
|
+
# Customer
|
469
|
+
# http://developer.helpscout.net/objects/customer/
|
470
|
+
# http://developer.helpscout.net/objects/customer/customer-ref/
|
471
|
+
#
|
472
|
+
# CustomerRefs are a subset of a full Customer object, and only include the
|
473
|
+
# attributes marked with a *.
|
474
|
+
#
|
475
|
+
# CustomerRefs are returned by endpoints that include multiple customers.
|
476
|
+
#
|
477
|
+
# A full Customer object can be obtained by fetching a single customer
|
478
|
+
# directly.
|
479
|
+
#
|
480
|
+
# Name Type Example Notes
|
481
|
+
# *id Int 29418 Unique identifier
|
482
|
+
# *firstName String Vernon
|
483
|
+
# *lastName String Bear
|
484
|
+
# *email String vbear@mywork.com If the customer has multiple
|
485
|
+
# emails, only one is returned.
|
486
|
+
# photoUrl String http://../avatar.jpg
|
487
|
+
# photoType String twitter Type of photo.
|
488
|
+
# gender String Male Gender of this customer.
|
489
|
+
# age String 30-35
|
490
|
+
# organization String Acme, Inc
|
491
|
+
# jobTitle String CEO and Co-Founder
|
492
|
+
# location String Austin
|
493
|
+
# createdAt DateTime 2012-07-23T12:34:12Z UTC time when this customer
|
494
|
+
# was created.
|
495
|
+
# modifiedAt DateTime 2012-07-24T20:18:33Z UTC time when this customer
|
496
|
+
# was modified.
|
497
|
+
#
|
498
|
+
# Possible values for photoType include:
|
499
|
+
# * PHOTO_TYPE_UNKNOWN
|
500
|
+
# * PHOTO_TYPE_GRAVATAR
|
501
|
+
# * PHOTO_TYPE_TWITTER
|
502
|
+
# * PHOTO_TYPE_FACEBOOK
|
503
|
+
# * PHOTO_TYPE_GOOGLE_PROFILE
|
504
|
+
# * PHOTO_TYPE_GOOGLE_PLUS
|
505
|
+
# * PHOTO_TYPE_LINKEDIN
|
506
|
+
#
|
507
|
+
# Possible values for gender include:
|
508
|
+
# * GENDER_MALE
|
509
|
+
# * GENDER_FEMALE
|
510
|
+
# * GENDER_UNKNOWN
|
511
|
+
|
224
512
|
class Customer
|
225
|
-
|
513
|
+
attr_reader :id, :firstName, :lastName, :photoUrl, :photoType, :gender, :age, :organization, :jobTitle, :location, :createdAt, :modifiedAt, :background, :address, :socialProfiles, :emails, :phones, :chats, :websites
|
226
514
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
515
|
+
PHOTO_TYPE_UNKNOWN = "unknown"
|
516
|
+
PHOTO_TYPE_GRAVATAR = "gravatar"
|
517
|
+
PHOTO_TYPE_TWITTER = "twitter"
|
518
|
+
PHOTO_TYPE_FACEBOOK = "facebook"
|
519
|
+
PHOTO_TYPE_GOOGLE_PROFILE = "googleprofile"
|
520
|
+
PHOTO_TYPE_GOOGLE_PLUS = "googleplus"
|
521
|
+
PHOTO_TYPE_LINKEDIN = "linkedin"
|
234
522
|
|
235
|
-
|
236
|
-
|
237
|
-
|
523
|
+
GENDER_MALE = "male"
|
524
|
+
GENDER_FEMALE = "female"
|
525
|
+
GENDER_UNKNOWN = "unknown"
|
238
526
|
|
527
|
+
# Creates a new Customer object from a Hash of attributes
|
239
528
|
def initialize(object)
|
529
|
+
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
530
|
+
@modifiedAt = DateTime.iso8601(object["modifiedAt"]) if object["modifiedAt"]
|
531
|
+
|
240
532
|
@id = object["id"]
|
241
533
|
@firstName = object["firstName"]
|
242
534
|
@lastName = object["lastName"]
|
@@ -288,42 +580,83 @@ module HelpScout
|
|
288
580
|
@websites << Website.new(item)
|
289
581
|
end
|
290
582
|
end
|
291
|
-
|
292
|
-
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
293
|
-
@modifiedAt = DateTime.iso8601(object["modifiedAt"]) if object["modifiedAt"]
|
294
583
|
end
|
295
584
|
|
585
|
+
# Returns a String suitable for display
|
296
586
|
def to_s
|
297
587
|
"#{@firstName} #{@lastName}"
|
298
588
|
end
|
299
589
|
|
590
|
+
|
591
|
+
# Customer::Address
|
592
|
+
# http://developer.helpscout.net/objects/customer/address/
|
593
|
+
#
|
594
|
+
# Name Type Example Notes
|
595
|
+
# id Int 1234 Unique identifier
|
596
|
+
# lines Array Collection of strings
|
597
|
+
# representing the
|
598
|
+
# customer's street
|
599
|
+
# address.
|
600
|
+
# city String Dallas
|
601
|
+
# state String TX
|
602
|
+
# postalCode String 74206
|
603
|
+
# country String US
|
604
|
+
# createdAt DateTime 2012-07-23T12:34:12Z UTC time when this
|
605
|
+
# address was created.
|
606
|
+
# modifiedAt DateTime 2012-07-24T20:18:33Z UTC time when this
|
607
|
+
# address was modified.
|
608
|
+
|
300
609
|
class Address
|
301
|
-
|
610
|
+
attr_reader :id, :lines, :city, :state, :postalCode, :country, :createdAt, :modifiedAt
|
611
|
+
|
612
|
+
# Creates a new Address object from a Hash of attributes
|
302
613
|
def initialize(object)
|
614
|
+
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
615
|
+
@modifiedAt = DateTime.iso8601(object["modifiedAt"]) if object["modifiedAt"]
|
616
|
+
|
303
617
|
@id = object["id"]
|
304
618
|
@lines = object["lines"]
|
305
619
|
@city = object["city"]
|
306
620
|
@state = object["state"]
|
307
621
|
@postalCode = object["postalCode"]
|
308
622
|
@country = object["country"]
|
309
|
-
@createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
|
310
|
-
@modifiedAt = DateTime.iso8601(object["modifiedAt"]) if object["modifiedAt"]
|
311
623
|
end
|
312
624
|
end
|
313
625
|
|
314
|
-
class Chat
|
315
|
-
attr_accessor :id, :value, :type
|
316
|
-
|
317
|
-
CHAT_TYPE_AIM = "aim"
|
318
|
-
CHAT_TYPE_GTALK = "gtalk"
|
319
|
-
CHAT_TYPE_ICQ = "icq"
|
320
|
-
CHAT_TYPE_XMPP = "xmpp"
|
321
|
-
CHAT_TYPE_MSN = "msn"
|
322
|
-
CHAT_TYPE_SKYPE = "skype"
|
323
|
-
CHAT_TYPE_YAHOO = "yahoo"
|
324
|
-
CHAT_TYPE_QQ = "qq"
|
325
|
-
CHAT_TYPE_OTHER = "other"
|
326
626
|
|
627
|
+
# Customer::Chat
|
628
|
+
# http://developer.helpscout.net/objects/customer/chat/
|
629
|
+
#
|
630
|
+
# Name Type Example Notes
|
631
|
+
# id Int 77183 Unique identifier
|
632
|
+
# value String jsprout
|
633
|
+
# type String aim Chat type
|
634
|
+
#
|
635
|
+
# Possible values for type include:
|
636
|
+
# * TYPE_AIM
|
637
|
+
# * TYPE_GTALK
|
638
|
+
# * TYPE_ICQ
|
639
|
+
# * TYPE_XMPP
|
640
|
+
# * TYPE_MSN
|
641
|
+
# * TYPE_SKYPE
|
642
|
+
# * TYPE_YAHOO
|
643
|
+
# * TYPE_QQ
|
644
|
+
# * TYPE_OTHER
|
645
|
+
|
646
|
+
class Chat
|
647
|
+
attr_reader :id, :value, :type
|
648
|
+
|
649
|
+
TYPE_AIM = "aim"
|
650
|
+
TYPE_GTALK = "gtalk"
|
651
|
+
TYPE_ICQ = "icq"
|
652
|
+
TYPE_XMPP = "xmpp"
|
653
|
+
TYPE_MSN = "msn"
|
654
|
+
TYPE_SKYPE = "skype"
|
655
|
+
TYPE_YAHOO = "yahoo"
|
656
|
+
TYPE_QQ = "qq"
|
657
|
+
TYPE_OTHER = "other"
|
658
|
+
|
659
|
+
# Creates a new Customer::Chat object from a Hash of attributes
|
327
660
|
def initialize(object)
|
328
661
|
@id = object["id"]
|
329
662
|
@value = object["value"]
|
@@ -331,13 +664,29 @@ module HelpScout
|
|
331
664
|
end
|
332
665
|
end
|
333
666
|
|
667
|
+
|
668
|
+
# Customer::Email
|
669
|
+
# http://developer.helpscout.net/objects/customer/email/
|
670
|
+
#
|
671
|
+
# Name Type Example Notes
|
672
|
+
# id Int 98131 Unique identifier
|
673
|
+
# value String vbear@mywork.com
|
674
|
+
# location String work Location for this email address.
|
675
|
+
# Defaults to LOCATION_WORK
|
676
|
+
#
|
677
|
+
# Possible values for location include:
|
678
|
+
# * LOCATION_WORK (Default)
|
679
|
+
# * LOCATION_HOME
|
680
|
+
# * LOCATION_OTHER
|
681
|
+
|
334
682
|
class Email
|
335
|
-
|
683
|
+
attr_reader :id, :value, :location
|
336
684
|
|
337
|
-
|
338
|
-
|
339
|
-
|
685
|
+
LOCATION_WORK = "work"
|
686
|
+
LOCATION_HOME = "home"
|
687
|
+
LOCATION_OTHER = "other"
|
340
688
|
|
689
|
+
# Creates a new Customer::Email object from a Hash of attributes
|
341
690
|
def initialize(object)
|
342
691
|
@id = object["id"]
|
343
692
|
@value = object["value"]
|
@@ -345,16 +694,34 @@ module HelpScout
|
|
345
694
|
end
|
346
695
|
end
|
347
696
|
|
697
|
+
|
698
|
+
# Customer::Phone
|
699
|
+
# http://developer.helpscout.net/objects/customer/phone/
|
700
|
+
#
|
701
|
+
# Name Type Example Notes
|
702
|
+
# id Int 22381 Unique identifier
|
703
|
+
# value String 222-333-4444
|
704
|
+
# location String home Location for this phone
|
705
|
+
#
|
706
|
+
# Possible values for location include:
|
707
|
+
# * LOCATION_HOME
|
708
|
+
# * LOCATION_WORK
|
709
|
+
# * LOCATION_MOBILE
|
710
|
+
# * LOCATION_FAX
|
711
|
+
# * LOCATION_PAGER
|
712
|
+
# * LOCATION_OTHER
|
713
|
+
|
348
714
|
class Phone
|
349
|
-
|
715
|
+
attr_reader :id, :value, :location
|
350
716
|
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
717
|
+
LOCATION_HOME = "home"
|
718
|
+
LOCATION_WORK = "work"
|
719
|
+
LOCATION_MOBILE = "mobile"
|
720
|
+
LOCATION_FAX = "fax"
|
721
|
+
LOCATION_PAGER = "pager"
|
722
|
+
LOCATION_OTHER = "other"
|
357
723
|
|
724
|
+
# Creates a new Customer::Phone object from a Hash of attributes
|
358
725
|
def initialize(object)
|
359
726
|
@id = object["id"]
|
360
727
|
@value = object["value"]
|
@@ -362,36 +729,159 @@ module HelpScout
|
|
362
729
|
end
|
363
730
|
end
|
364
731
|
|
365
|
-
class SocialProfile
|
366
|
-
attr_accessor :id, :value, :type
|
367
|
-
|
368
|
-
SOCIAL_PROFILE_TYPE_TWITTER = "twitter"
|
369
|
-
SOCIAL_PROFILE_TYPE_FACEBOOK = "facebook"
|
370
|
-
SOCIAL_PROFILE_TYPE_LINKEDIN = "linkedin"
|
371
|
-
SOCIAL_PROFILE_TYPE_ABOUTME = "aboutme"
|
372
|
-
SOCIAL_PROFILE_TYPE_GOOGLE = "google"
|
373
|
-
SOCIAL_PROFILE_TYPE_GOOGLE_PLUS = "googleplus"
|
374
|
-
SOCIAL_PROFILE_TYPE_TUNGLEME = "tungleme"
|
375
|
-
SOCIAL_PROFILE_TYPE_QUORA = "quora"
|
376
|
-
SOCIAL_PROFILE_TYPE_FOURSQUARE = "foursquare"
|
377
|
-
SOCIAL_PROFILE_TYPE_YOUTUBE = "youtube"
|
378
|
-
SOCIAL_PROFILE_TYPE_FLICKR = "flickr"
|
379
|
-
SOCIAL_PROFILE_TYPE_OTHER = "other"
|
380
732
|
|
733
|
+
# Customer::SocialProfile
|
734
|
+
# http://developer.helpscout.net/objects/customer/social-profile/
|
735
|
+
#
|
736
|
+
# Name Type Example Notes
|
737
|
+
# id Int 9184 Unique identifier
|
738
|
+
# value String https://twitter.com/helpscout
|
739
|
+
# type String twitter Type of social profile.
|
740
|
+
#
|
741
|
+
# Possible values for type include:
|
742
|
+
# * TYPE_TWITTER
|
743
|
+
# * TYPE_FACEBOOK
|
744
|
+
# * TYPE_LINKEDIN
|
745
|
+
# * TYPE_ABOUTME
|
746
|
+
# * TYPE_GOOGLE
|
747
|
+
# * TYPE_GOOGLE_PLUS
|
748
|
+
# * TYPE_TUNGLEME
|
749
|
+
# * TYPE_QUORA
|
750
|
+
# * TYPE_FOURSQUARE
|
751
|
+
# * TYPE_YOUTUBE
|
752
|
+
# * TYPE_FLICKR
|
753
|
+
# * TYPE_OTHER
|
754
|
+
|
755
|
+
class SocialProfile
|
756
|
+
attr_reader :id, :value, :type
|
757
|
+
|
758
|
+
TYPE_TWITTER = "twitter"
|
759
|
+
TYPE_FACEBOOK = "facebook"
|
760
|
+
TYPE_LINKEDIN = "linkedin"
|
761
|
+
TYPE_ABOUTME = "aboutme"
|
762
|
+
TYPE_GOOGLE = "google"
|
763
|
+
TYPE_GOOGLE_PLUS = "googleplus"
|
764
|
+
TYPE_TUNGLEME = "tungleme"
|
765
|
+
TYPE_QUORA = "quora"
|
766
|
+
TYPE_FOURSQUARE = "foursquare"
|
767
|
+
TYPE_YOUTUBE = "youtube"
|
768
|
+
TYPE_FLICKR = "flickr"
|
769
|
+
TYPE_OTHER = "other"
|
770
|
+
|
771
|
+
# Creates a new Customer::SocialProfile object from a Hash of attributes
|
381
772
|
def initialize(object)
|
382
773
|
@id = object["id"]
|
383
774
|
@value = object["value"]
|
384
|
-
@type = object["type"]
|
775
|
+
@type = object["type"]
|
385
776
|
end
|
386
777
|
end
|
387
778
|
|
779
|
+
|
780
|
+
# Customer::Website
|
781
|
+
# http://developer.helpscout.net/objects/customer/website/
|
782
|
+
#
|
783
|
+
# Name Type Example Notes
|
784
|
+
# id Int 5584 Unique identifier
|
785
|
+
# value String http://www.somewhere.com
|
786
|
+
|
388
787
|
class Website
|
389
|
-
|
788
|
+
attr_reader :id, :value
|
789
|
+
|
790
|
+
# Creates a new Customer::Website object from a Hash of attributes
|
390
791
|
def initialize(object)
|
391
792
|
@id = object["id"]
|
392
793
|
@value = object["value"]
|
393
794
|
end
|
394
795
|
end
|
395
796
|
end
|
396
|
-
end
|
397
797
|
|
798
|
+
|
799
|
+
# Source
|
800
|
+
# http://developer.helpscout.net/objects/source/
|
801
|
+
#
|
802
|
+
# Name Type Example Notes
|
803
|
+
# type String email The method from which this conversation (or thread)
|
804
|
+
# was created.
|
805
|
+
# via String customer
|
806
|
+
#
|
807
|
+
# Possible values for type include:
|
808
|
+
# * TYPE_EMAIL
|
809
|
+
# * TYPE_WEB
|
810
|
+
# * TYPE_NOTIFICATION
|
811
|
+
# * TYPE_FWD
|
812
|
+
#
|
813
|
+
# Possible values for via include:
|
814
|
+
# * VIA_USER
|
815
|
+
# * VIA_CUSTOMER
|
816
|
+
|
817
|
+
class Source
|
818
|
+
attr_reader :type, :via
|
819
|
+
|
820
|
+
TYPE_EMAIL = "email"
|
821
|
+
TYPE_WEB = "web"
|
822
|
+
TYPE_NOTIFICATION = "notification"
|
823
|
+
TYPE_FWD = "emailfwd"
|
824
|
+
|
825
|
+
VIA_USER = "user"
|
826
|
+
VIA_CUSTOMER = "customer"
|
827
|
+
|
828
|
+
# Creates a new Source object from a Hash of attributes
|
829
|
+
def initialize(object)
|
830
|
+
@type = object["type"]
|
831
|
+
@via = object["via"]
|
832
|
+
end
|
833
|
+
end
|
834
|
+
|
835
|
+
|
836
|
+
# Folder
|
837
|
+
# http://developer.helpscout.net/objects/folder/
|
838
|
+
#
|
839
|
+
# Name Type Example Notes
|
840
|
+
# id Int 1234 Unique identifier
|
841
|
+
# name String My Tickets Folder name
|
842
|
+
# type String mytickets The type this folder
|
843
|
+
# represents.
|
844
|
+
# userId Int 4532 If the folder type is
|
845
|
+
# TYPE_MY_TICKETS, userId
|
846
|
+
# represents the Help Scout user
|
847
|
+
# to which this folder belongs.
|
848
|
+
# Otherwise userId is 0.
|
849
|
+
# totalCount Int 2 Total number of conversations
|
850
|
+
# in this folder
|
851
|
+
# activeCount Int 1 Total number of conversations
|
852
|
+
# in this folder that are in an
|
853
|
+
# active state (vs pending).
|
854
|
+
# modifiedAt DateTime 2012-07-24T20:18:33Z UTC time when this folder was
|
855
|
+
# modified.
|
856
|
+
#
|
857
|
+
# Possible values for type include:
|
858
|
+
# * TYPE_UNASSIGNED
|
859
|
+
# * TYPE_MY_TICKETS
|
860
|
+
# * TYPE_DRAFTS
|
861
|
+
# * TYPE_ASSIGNED
|
862
|
+
# * TYPE_CLOSED
|
863
|
+
# * TYPE_SPAM
|
864
|
+
|
865
|
+
class Folder
|
866
|
+
attr_reader :id, :name, :type, :userId, :totalCount, :activeCount, :modifiedAt
|
867
|
+
|
868
|
+
TYPE_UNASSIGNED = "open"
|
869
|
+
TYPE_MY_TICKETS = "mytickets"
|
870
|
+
TYPE_DRAFTS = "drafts"
|
871
|
+
TYPE_ASSIGNED = "assigned"
|
872
|
+
TYPE_CLOSED = "closed"
|
873
|
+
TYPE_SPAM = "spam"
|
874
|
+
|
875
|
+
# Creates a new Folder object from a Hash of attributes
|
876
|
+
def initialize(object)
|
877
|
+
@modifiedAt = DateTime.iso8601(object["modifiedAt"]) if object["modifiedAt"]
|
878
|
+
|
879
|
+
@id = object["id"]
|
880
|
+
@name = object["name"]
|
881
|
+
@type = object["type"]
|
882
|
+
@userId = object["userId"]
|
883
|
+
@totalCount = object["totalCount"]
|
884
|
+
@activeCount = object["activeCount"]
|
885
|
+
end
|
886
|
+
end
|
887
|
+
end
|