Class: BatchBook::Company
- Defined in:
- lib/batchbook.rb
Instance Method Summary collapse
- #add_supertag(name, params = {}) ⇒ Object
- #add_tag(name) ⇒ Object
- #add_tags(names = []) ⇒ Object
- #affiliations ⇒ Object
- #comment(id) ⇒ Object
- #comments(scope = :all) ⇒ Object
- #communications ⇒ Object
- #location(label) ⇒ Object
- #locations ⇒ Object
- #people ⇒ Object
- #remove_tag(name) ⇒ Object
- #supertag(name) ⇒ Object
- #supertags ⇒ Object
- #tags ⇒ Object
- #todos ⇒ Object
Methods inherited from Base
Instance Method Details
#add_supertag(name, params = {}) ⇒ Object
197 198 199 200 201 202 203 204 |
# File 'lib/batchbook.rb', line 197 def add_supertag name, params = {} raise Error, "Tag name not specified. Usage: person.add_supertag('tag_name')" unless name self.put(:add_tag, :tag => name) unless params.empty? self.put("super_tags/#{name.gsub(/ /, '%20')}", :super_tag => params) end end |
#add_tag(name) ⇒ Object
206 207 208 209 |
# File 'lib/batchbook.rb', line 206 def add_tag name raise Error, "Tag name not specified. Usage: person.add_tag('tag_name')" unless name self.put(:add_tag, :tag => name) end |
#add_tags(names = []) ⇒ Object
211 212 213 214 |
# File 'lib/batchbook.rb', line 211 def names = [] raise Error, "Tag name not specified. Usage: person.add_tag('tag_name')" unless names self.put(:add_tag, :tags => names) end |
#affiliations ⇒ Object
234 235 236 |
# File 'lib/batchbook.rb', line 234 def affiliations Affiliation.find(:all, :params => {:company_id => self.id}) end |
#comment(id) ⇒ Object
225 226 227 |
# File 'lib/batchbook.rb', line 225 def comment(id) comments(id) end |
#comments(scope = :all) ⇒ Object
221 222 223 |
# File 'lib/batchbook.rb', line 221 def comments(scope = :all) Comment.find(scope, :params => {:company_id => self.id}) end |
#communications ⇒ Object
238 239 240 |
# File 'lib/batchbook.rb', line 238 def communications Communication.find(:all, :params => {:company_id => self.id}) end |
#location(label) ⇒ Object
183 184 185 186 |
# File 'lib/batchbook.rb', line 183 def location label raise Error, "Location label not specified. Usage: person.location('label_name')" unless label self.get('locations', :label => label) end |
#locations ⇒ Object
179 180 181 |
# File 'lib/batchbook.rb', line 179 def locations self.get('locations') end |
#people ⇒ Object
229 230 231 232 |
# File 'lib/batchbook.rb', line 229 def people Person.find(:all, :params => {:company_id => self.id}) # self.get(:people) end |
#remove_tag(name) ⇒ Object
216 217 218 219 |
# File 'lib/batchbook.rb', line 216 def remove_tag name raise Error, "Tag name not specified. Usage: person.remove_tag('tag_name')" unless name self.delete(:remove_tag, :tag => name) end |
#supertag(name) ⇒ Object
192 193 194 195 |
# File 'lib/batchbook.rb', line 192 def supertag name raise Error, "SuperTag name not specified. Usage: person.supertag('tag_name')" unless name self.get('super_tags', :name => name) end |
#supertags ⇒ Object
188 189 190 |
# File 'lib/batchbook.rb', line 188 def self.get('super_tags') end |
#tags ⇒ Object
175 176 177 |
# File 'lib/batchbook.rb', line 175 def Tag.find(:all, :params => {:contact_id => id}) end |
#todos ⇒ Object
242 243 244 |
# File 'lib/batchbook.rb', line 242 def todos Todo.find(:all, :params => {:company_id => self.id}) end |