Class: BatchBook::Company

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

Instance Method Summary collapse

Methods inherited from Base

inherited

Instance Method Details

#add_supertag(name, params = {}) ⇒ Object

Raises:



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

Raises:



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

Raises:



211
212
213
214
# File 'lib/batchbook.rb', line 211

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

#affiliationsObject



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

#communicationsObject



238
239
240
# File 'lib/batchbook.rb', line 238

def communications
  Communication.find(:all, :params => {:company_id => self.id})
end

#location(label) ⇒ Object

Raises:



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

#locationsObject



179
180
181
# File 'lib/batchbook.rb', line 179

def locations
  self.get('locations')
end

#peopleObject



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

Raises:



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

Raises:



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

#supertagsObject



188
189
190
# File 'lib/batchbook.rb', line 188

def supertags
  self.get('super_tags')
end

#tagsObject



175
176
177
# File 'lib/batchbook.rb', line 175

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

#todosObject



242
243
244
# File 'lib/batchbook.rb', line 242

def todos
  Todo.find(:all, :params => {:company_id => self.id})
end