Class: HelpScout::Conversation::Thread

Inherits:
Object
  • Object
show all
Defined in:
lib/helpscout/models.rb

Overview

Conversation::Thread http://developer.helpscout.net/objects/conversation/thread/

Name Type Example Notes id Int 88171881 Unique identifier assignedTo Person User of the Help Scout user to which this conversation has been assigned. status String active Status of the thread. Thread status is only updated when there is a status change. Otherwise, the status will be set to STATUS_NO_CHANGE. createdAt DateTime 2012-07-23T12:34:12Z UTC time when this thread was created. createdBy Person Either the Customer or User that created this conversation. Inspect the Source object for clarification. source Source
fromMailbox Mailbox If the conversation was moved, fromMailbox represents the Mailbox from which it was moved. type String message The type of thread. state String published The state of the thread. customer Person If type is message, this is the Customer of the customer in which the message was sent. If type is customer, this is the Customer of the customer that initiated the thread. body String Thank you.
to Array Collection of Strings representing emails. cc Array Collection of Strings representing emails. bcc Array Collection of Strings representing emails. attachments Array Collection of Attachment objects, if they exist.

Possible values for state include:

  • STATE_PUBLISHED
  • STATE_DRAFT
  • STATE_UNDER_REVIEW

A state of STATE_UNDER_REVIEW means the thread has been stopped by Traffic Cop and is waiting to be confirmed (or discarded) by the person that created the thread.

Traffic Cop is the Help Scout feature that stops a thread from going out if multiple Users act on the same Help Scout simultaneously.

Possible values for status include:

  • STATUS_ACTIVE
  • STATUS_NO_CHANGE
  • STATUS_PENDING
  • STATUS_CLOSED
  • STATUS_SPAM

Possible values for type include:

  • TYPE_NOTE
  • TYPE_MESSAGE
  • TYPE_CUSTOMER
  • TYPE_LINEITEM
  • TYPE_FWD_PARENT
  • TYPE_FWD_CHILD

TYPE_LINEITEM represents a change of state on the conversation. This could include, but not limited to, the conversation was assigned, the status changed, the conversation was moved from one mailbox to another, etc. A line item won't have a body, to/cc/bcc lists, or attachments.

When a conversation is forwarded, a new conversation is created to represent the forwarded conversation.

  • TYPE_FWD_PARENT is the type set on the thread of the original conversation that initiated the forward event.
  • TYPE_FWD_CHILD is the type set on the first thread of the new forwarded conversation.

Constant Summary collapse

STATE_PUBLISHED =
"published"
STATE_DRAFT =
"draft"
STATE_UNDER_REVIEW =
"underreview"
STATUS_ACTIVE =
"active"
STATUS_NO_CHANGE =
"nochange"
STATUS_PENDING =
"pending"
STATUS_CLOSED =
"closed"
STATUS_SPAM =
"spam"
TYPE_NOTE =
"note"
TYPE_MESSAGE =
"message"
TYPE_CUSTOMER =
"customer"
TYPE_LINEITEM =
"lineitem"
TYPE_FWD_PARENT =
"forwardparent"
TYPE_FWD_CHILD =
"forwardchild"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Thread

Creates a new Conversation::Thread object from a Hash of attributes



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/helpscout/models.rb', line 315

def initialize(object)
  @createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]

  @id = object["id"]
  @assignedTo = Person.new(object["assignedTo"]) if object["assignedTo"]
  @createdBy = Person.new(object["createdBy"]) if object["createdBy"]
  @status = object["status"]
  @source = Source.new(object["source"]) if object["source"]
  @fromMailbox = Mailbox.new(object["fromMailbox"]) if object["fromMailbox"]
  @type = object["type"]
  @state = object["state"]
  @customer = Person.new(object["customer"]) if object["customer"]
  @body = object["body"]
  @to = object["to"]
  @cc = object["cc"]
  @bcc = object["bcc"]

  @attachments = []
  if object["attachments"]
    object["attachments"].each do |item|
      @attachments << Attachment.new(item)
    end
  end
end

Instance Attribute Details

#assignedToObject (readonly)

Returns the value of attribute assignedTo.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def assignedTo
  @assignedTo
end

#attachmentsObject (readonly)

Returns the value of attribute attachments.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def attachments
  @attachments
end

#bccObject (readonly)

Returns the value of attribute bcc.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def bcc
  @bcc
end

#bodyObject (readonly)

Returns the value of attribute body.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def body
  @body
end

#ccObject (readonly)

Returns the value of attribute cc.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def cc
  @cc
end

#createdAtObject (readonly)

Returns the value of attribute createdAt.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def createdAt
  @createdAt
end

#createdByObject (readonly)

Returns the value of attribute createdBy.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def createdBy
  @createdBy
end

#customerObject (readonly)

Returns the value of attribute customer.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def customer
  @customer
end

#fromMailboxObject (readonly)

Returns the value of attribute fromMailbox.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def fromMailbox
  @fromMailbox
end

#idObject (readonly)

Returns the value of attribute id.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def id
  @id
end

#sourceObject (readonly)

Returns the value of attribute source.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def source
  @source
end

#stateObject (readonly)

Returns the value of attribute state.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def state
  @state
end

#statusObject (readonly)

Returns the value of attribute status.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def status
  @status
end

#toObject (readonly)

Returns the value of attribute to.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def to
  @to
end

#typeObject (readonly)

Returns the value of attribute type.



295
296
297
# File 'lib/helpscout/models.rb', line 295

def type
  @type
end

Instance Method Details

#to_sObject

Returns a String suitable for display



341
342
343
# File 'lib/helpscout/models.rb', line 341

def to_s
  "#{@customer}: #{@body}"
end