class HelpScout::Conversation

Conversation developer.helpscout.net/objects/conversation/

Name         Type        Example               Notes
id           Int         2391938111            Unique identifier
folderId     Int         1234                  ID of the Folder to which 
                                               this conversation resides.
isDraft      Boolean     false                 Is this a draft?
number       Int         349                   The conversation number 
                                               displayed in the UI.
owner        Person                            User of the Help Scout user 
                                               that is currently assigned 
                                               to this conversation
mailbox      Mailbox                           Mailbox to which this 
                                               conversation belongs.
customer     Person                            Customer to which this 
                                               conversation belongs.
threadCount  Int         4                     This count represents the 
                                               number of published threads 
                                               found on the conversation 
                                               (it does not include line 
                                               items, drafts or threads 
                                               held for review by Traffic 
                                               Cop).
status       String      active                Status of the conversation.
subject      String      I need help!   
preview      String      Hello, I...   
createdBy    Person                            Either the Customer or User 
                                               that created this 
                                               conversation. 
                                               Inspect the Source object 
                                               for clarification.
createdAt    DateTime    2012-07-23T12:34:12Z  UTC time when this 
                                               conversation was created.
modifiedAt   DateTime    2012-07-24T20:18:33Z  UTC time when this.
                                               conversation was modified.
closedAt     DateTime                          UTC time when this 
                                               conversation was closed.
                                               Null if not closed.
closedBy     Person                            User of the Help Scout user 
                                               that closed this 
                                               conversation.
source       Source                            Specifies the method in 
                                               which this conversation was 
                                               created.
cc           Array                             Collection of strings 
                                               representing emails.
bcc          Array                             Collection of strings
                                               representing emails.
tags         Array                             Collection of strings
threads      Array                             Collection of Thread 
                                               objects. Only available when
                                               retrieving a single 
                                               Conversation

Possible values for status include:

Constants

STATUS_ACTIVE
STATUS_CLOSED
STATUS_PENDING
STATUS_SPAM

Attributes

bcc[R]
cc[R]
closedAt[R]
closedBy[R]
createdAt[R]
createdBy[R]
customer[R]
folderId[R]
id[R]
isDraft[R]
mailbox[R]
modifiedAt[R]
number[R]
owner[R]
preview[R]
source[R]
status[R]
subject[R]
tags[R]
threadCount[R]
threads[R]
type[R]
url[R]

Public Class Methods

new(object) click to toggle source

Creates a new Conversation object from a Hash of attributes

# File lib/helpscout/models.rb, line 171
def initialize(object)
  @createdAt = DateTime.iso8601(object["createdAt"]) if object["createdAt"]
  @modifiedAt = DateTime.iso8601(object["userModifiedAt"]) if object["userModifiedAt"]
  @closedAt = DateTime.iso8601(object["closedAt"]) if object["closedAt"]

  @id = object["id"]
  @type = object["type"]
  @folderId = object["folderId"]
  @isDraft = object["isDraft"]
  @number = object["number"]
  @owner = Person.new(object["owner"]) if object["owner"]
  @mailbox = Mailbox.new(object["mailbox"]) if object["mailbox"]
  @customer = Person.new(object["customer"]) if object["customer"]
  @threadCount = object["threadCount"]
  @status = object["status"]
  @subject = object["subject"]
  @preview = object["preview"]
  @closedBy = Person.new(object["closedBy"]) if object["closedBy"]
  @createdBy = Person.new(object["person"]) if object["person"]
  @source = Source.new(object["source"]) if object["source"]
  @cc = object["cc"]
  @bcc = object["bcc"]
  @tags = object["tags"]

  @threads = []
  if object["threads"]
    object["threads"].each do |thread|
      @threads << Thread.new(thread)
    end
  end

  @url = "https://secure.helpscout.net/conversation/#{@id}/#{@number}/"
end

Public Instance Methods

to_s() click to toggle source

Returns a String suitable for display

# File lib/helpscout/models.rb, line 206
def to_s
  "Last Modified: #{@modifiedAt}\nStatus: #{@status}\nAssigned to: #{@owner}\nSubject: #{@subject}\n#{@preview}"
end