Class: BatchBook::Deal

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

Instance Method Summary collapse

Methods inherited from Base

inherited

Instance Method Details

Raises:



313
314
315
316
# File 'lib/batchbook.rb', line 313

def add_related_contact(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

Raises:



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

Raises:



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

Raises:



291
292
293
294
# File 'lib/batchbook.rb', line 291

def add_tags 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

#contactsObject



309
310
311
# File 'lib/batchbook.rb', line 309

def contacts
  Person.find(:all, :params => {:deal_id => self.id})
end

Raises:



318
319
320
321
# File 'lib/batchbook.rb', line 318

def remove_related_contact(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

Raises:



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

#statusesObject



323
324
325
# File 'lib/batchbook.rb', line 323

def statuses
  self.get(:statuses)      
end

#supertag(name) ⇒ Object

Raises:



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

#supertagsObject



327
328
329
# File 'lib/batchbook.rb', line 327

def supertags
  self.get('super_tags')
end

#tagsObject



282
283
284
# File 'lib/batchbook.rb', line 282

def tags
  Tag.find(:all, :params => {:deal_id => id})
end