Class: Highrise::Subject

Inherits:
Base
  • Object
show all
Defined in:
lib/highrise/subject.rb

Direct Known Subclasses

Company, Deal, Kase, Person

Instance Method Summary collapse

Methods inherited from Base

headers, oauth_token=

Instance Method Details

#add_note(attrs = {}) ⇒ Object



8
9
10
11
12
# File 'lib/highrise/subject.rb', line 8

def add_note(attrs={})
  attrs[:subject_id] = self.id
  attrs[:subject_type] = self.label
  Note.create attrs
end

#add_task(attrs = {}) ⇒ Object



14
15
16
17
18
# File 'lib/highrise/subject.rb', line 14

def add_task(attrs={})
  attrs[:subject_id] = self.id
  attrs[:subject_type] = self.label
  Task.create attrs
end

#emails(options = {}) ⇒ Object



20
21
22
23
# File 'lib/highrise/subject.rb', line 20

def emails(options={})
  options.merge!(:from => "/#{self.class.collection_name}/#{id}/emails.xml")
  Email.find_all_across_pages(options)
end

#labelObject



30
31
32
# File 'lib/highrise/subject.rb', line 30

def label
  self.class.name.split('::').last
end

#notes(options = {}) ⇒ Object



3
4
5
6
# File 'lib/highrise/subject.rb', line 3

def notes(options={})
  options.merge!(:from => "/#{self.class.collection_name}/#{id}/notes.xml")
  Note.find_all_across_pages(options)
end

#upcoming_tasks(options = {}) ⇒ Object



25
26
27
28
# File 'lib/highrise/subject.rb', line 25

def upcoming_tasks(options={})
  options.merge!(:from => "/#{self.class.collection_name}/#{id}/tasks.xml")
  Task.find(:all, options)
end