Sha256: 33373ae32eea2b207d036965990e0354b66bbe21c8d664905ea7e4c60ac4fe82

Contents?: true

Size: 734 Bytes

Versions: 5

Compression:

Stored size: 734 Bytes

Contents

module Highrise
  class Subject < Base
    def notes
      Note.find_all_across_pages(:from => "/#{self.class.collection_name}/#{id}/notes.xml")
    end

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

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

    def upcoming_tasks
      Task.find(:all, :from => "/#{self.class.collection_name}/#{id}/tasks.xml")
    end
    
    def label
      self.class.name.split('::').last
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
peterosullivan-highrise-3.0.7 lib/highrise/subject.rb
peterosullivan-highrise-3.0.6 lib/highrise/subject.rb
peterosullivan-highrise-3.0.5 lib/highrise/subject.rb
peterosullivan-highrise-3.0.4 lib/highrise/subject.rb
peterosullivan-highrise-3.0.3 lib/highrise/subject.rb