Sha256: 3aabc9500a168a5fa019dca2775054b137cf755008099cd7fcbb4b5456bce136

Contents?: true

Size: 733 Bytes

Versions: 13

Compression:

Stored size: 733 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

13 entries across 13 versions & 2 rubygems

Version Path
highrise-3.2.1 lib/highrise/subject.rb
highrise-3.1.6 lib/highrise/subject.rb
highrise-3.1.5 lib/highrise/subject.rb
highrise-3.1.2 lib/highrise/subject.rb
highrise-3.1.1 lib/highrise/subject.rb
highrise-3.1.0 lib/highrise/subject.rb
highrise-3.1.0.pre lib/highrise/subject.rb
highrise-3.0.5 lib/highrise/subject.rb
highrise-3.0.4 lib/highrise/subject.rb
highrise-3.0.3 lib/highrise/subject.rb
peterosullivan-highrise-3.0.2 lib/highrise/subject.rb
highrise-3.0.1 lib/highrise/subject.rb
highrise-3.0.0 lib/highrise/subject.rb