Class: BatchBook::Deal
- Defined in:
- lib/batchbook.rb
Instance Method Summary collapse
- #add_related_contact(contact_id) ⇒ Object
- #add_supertag(name, params = {}) ⇒ Object
- #add_tag(name) ⇒ Object
- #add_tags(names = []) ⇒ Object
- #comment(id) ⇒ Object
- #comments(scope = :all) ⇒ Object
- #contacts ⇒ Object
- #remove_related_contact(contact_id) ⇒ Object
- #remove_tag(name) ⇒ Object
- #statuses ⇒ Object
- #supertag(name) ⇒ Object
- #supertags ⇒ Object
- #tags ⇒ Object
Methods inherited from Base
Instance Method Details
#add_related_contact(contact_id) ⇒ Object
313 314 315 316 |
# File 'lib/batchbook.rb', line 313 def (contact_id) raise Error, "Contact not specified. Usage: deal.add_contact(50)" unless contact_id self.put(:add_related_contact, :contact_id => contact_id) end |
#add_supertag(name, params = {}) ⇒ Object
336 337 338 339 340 341 342 343 |
# File 'lib/batchbook.rb', line 336 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
286 287 288 289 |
# File 'lib/batchbook.rb', line 286 def add_tag name raise Error, "Tag name not specified. Usage: deal.add_tag('tag_name')" unless name self.put(:add_tag, :tag => name) end |
#add_tags(names = []) ⇒ Object
291 292 293 294 |
# File 'lib/batchbook.rb', line 291 def names = [] raise Error, "Tag name not specified. Usage: person.add_tag('tag_name')" unless names self.put(:add_tag, :tags => names) end |
#comment(id) ⇒ Object
305 306 307 |
# File 'lib/batchbook.rb', line 305 def comment(id) comments(id) end |
#comments(scope = :all) ⇒ Object
301 302 303 |
# File 'lib/batchbook.rb', line 301 def comments(scope = :all) Comment.find(scope, :params => {:deal_id => self.id}) end |
#contacts ⇒ Object
309 310 311 |
# File 'lib/batchbook.rb', line 309 def contacts Person.find(:all, :params => {:deal_id => self.id}) end |
#remove_related_contact(contact_id) ⇒ Object
318 319 320 321 |
# File 'lib/batchbook.rb', line 318 def (contact_id) raise Error, "Contact not specified. Usage: deal.add_contact(50)" unless contact_id self.delete(:remove_related_contact, :contact_id => contact_id) end |
#remove_tag(name) ⇒ Object
296 297 298 299 |
# File 'lib/batchbook.rb', line 296 def remove_tag name raise Error, "Tag name not specified. Usage: deal.remove_tag('tag_name')" unless name self.delete(:remove_tag, :tag => name) end |
#statuses ⇒ Object
323 324 325 |
# File 'lib/batchbook.rb', line 323 def statuses self.get(:statuses) end |
#supertag(name) ⇒ Object
331 332 333 334 |
# File 'lib/batchbook.rb', line 331 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
327 328 329 |
# File 'lib/batchbook.rb', line 327 def self.get('super_tags') end |
#tags ⇒ Object
282 283 284 |
# File 'lib/batchbook.rb', line 282 def Tag.find(:all, :params => {:deal_id => id}) end |