Class: HelpScout::Conversation

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

Overview

Conversation http://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:

  • STATUS_ACTIVE
  • STATUS_PENDING
  • STATUS_CLOSED
  • STATUS_SPAM

Defined Under Namespace

Classes: Attachment, AttachmentData, Thread

Constant Summary collapse

STATUS_ACTIVE =
"active"
STATUS_PENDING =
"pending"
STATUS_CLOSED =
"closed"
STATUS_SPAM =
"spam"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Conversation

Creates a new Conversation object from a Hash of attributes



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# 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

Instance Attribute Details

#bccObject (readonly)

Returns the value of attribute bcc.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def bcc
  @bcc
end

#ccObject (readonly)

Returns the value of attribute cc.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def cc
  @cc
end

#closedAtObject (readonly)

Returns the value of attribute closedAt.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def closedAt
  @closedAt
end

#closedByObject (readonly)

Returns the value of attribute closedBy.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def closedBy
  @closedBy
end

#createdAtObject (readonly)

Returns the value of attribute createdAt.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def createdAt
  @createdAt
end

#createdByObject (readonly)

Returns the value of attribute createdBy.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def createdBy
  @createdBy
end

#customerObject (readonly)

Returns the value of attribute customer.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def customer
  @customer
end

#folderIdObject (readonly)

Returns the value of attribute folderId.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def folderId
  @folderId
end

#idObject (readonly)

Returns the value of attribute id.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def id
  @id
end

#isDraftObject (readonly)

Returns the value of attribute isDraft.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def isDraft
  @isDraft
end

#mailboxObject (readonly)

Returns the value of attribute mailbox.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def mailbox
  @mailbox
end

#modifiedAtObject (readonly)

Returns the value of attribute modifiedAt.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def modifiedAt
  @modifiedAt
end

#numberObject (readonly)

Returns the value of attribute number.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def number
  @number
end

#ownerObject (readonly)

Returns the value of attribute owner.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def owner
  @owner
end

#previewObject (readonly)

Returns the value of attribute preview.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def preview
  @preview
end

#sourceObject (readonly)

Returns the value of attribute source.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def source
  @source
end

#statusObject (readonly)

Returns the value of attribute status.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def status
  @status
end

#subjectObject (readonly)

Returns the value of attribute subject.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def subject
  @subject
end

#tagsObject (readonly)

Returns the value of attribute tags.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def tags
  @tags
end

#threadCountObject (readonly)

Returns the value of attribute threadCount.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def threadCount
  @threadCount
end

#threadsObject (readonly)

Returns the value of attribute threads.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def threads
  @threads
end

#typeObject (readonly)

Returns the value of attribute type.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url.



163
164
165
# File 'lib/helpscout/models.rb', line 163

def url
  @url
end

Instance Method Details

#to_sObject

Returns a String suitable for display



206
207
208
# File 'lib/helpscout/models.rb', line 206

def to_s
  "Last Modified: #{@modifiedAt}\nStatus: #{@status}\nAssigned to: #{@owner}\nSubject: #{@subject}\n#{@preview}"
end