Class: BatchBook::Person
- Defined in:
- lib/batchbook.rb
Instance Method Summary collapse
-
#add_location(params = {}) ⇒ Object
Add a Location to a Person POST test.batchbook.com/service/people/#id/locations.xml Field Description location Location Name (‘work’, ‘home’, etc.) - REQUIRED location Email Address location Website URL location Phone Number location Cell Phone Number location Fax Number location Street Address location Street Address 2 location City location State location Postal Code location Country.
-
#add_supertag(name, params = {}) ⇒ Object
TODO : Fix supertags Add a SuperTag to a Person.
- #add_tag(name) ⇒ Object
- #add_tags(names = []) ⇒ Object
- #affiliations ⇒ Object
- #comment(id) ⇒ Object
- #comments(scope = :all) ⇒ Object
- #communications ⇒ Object
- #location(label) ⇒ Object
- #locations ⇒ Object
- #remove_tag(name) ⇒ Object
- #supertag(name) ⇒ Object
- #supertags ⇒ Object
- #tags ⇒ Object
- #todos ⇒ Object
Methods inherited from Base
Instance Method Details
#add_location(params = {}) ⇒ Object
Add a Location to a Person POST test.batchbook.com/service/people/#id/locations.xml Field Description location Location Name (‘work’, ‘home’, etc.) - REQUIRED location Email Address location Website URL location Phone Number location Cell Phone Number location Fax Number location Street Address location Street Address 2 location City location State location Postal Code location Country
108 109 110 111 |
# File 'lib/batchbook.rb', line 108 def add_location(params = {}) params.update(:label => 'home') unless params[:label].present? self.post(:locations, :location => params) end |
#add_supertag(name, params = {}) ⇒ Object
TODO : Fix supertags Add a SuperTag to a Person
Add a SuperTag to a Person the same way you add a regular tag to it, via PUT test.batchbook.com/service/people/#id/add_tag/#super_tag_name.xml. Remove a SuperTag from a Person DELETE test.batchbook.com/service/people/#id/super_tags/#super_tag_name.xml
129 130 131 132 133 134 135 136 |
# File 'lib/batchbook.rb', line 129 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
138 139 140 141 |
# File 'lib/batchbook.rb', line 138 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
143 144 145 146 |
# File 'lib/batchbook.rb', line 143 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
161 162 163 |
# File 'lib/batchbook.rb', line 161 def affiliations Affiliation.find(:all, :params => {:person_id => self.id}) end |
#comment(id) ⇒ Object
157 158 159 |
# File 'lib/batchbook.rb', line 157 def comment(id) comments(id) end |
#comments(scope = :all) ⇒ Object
153 154 155 |
# File 'lib/batchbook.rb', line 153 def comments(scope = :all) Comment.find(scope, :params => {:person_id => self.id}) end |
#communications ⇒ Object
165 166 167 |
# File 'lib/batchbook.rb', line 165 def communications Communication.find(:all, :params => {:person_id => self.id}) end |
#location(label) ⇒ Object
88 89 90 91 |
# File 'lib/batchbook.rb', line 88 def location label raise Error, "Location label not specified. Usage: person.location('label_name')" unless label self.get('locations', :label => label) end |
#locations ⇒ Object
84 85 86 |
# File 'lib/batchbook.rb', line 84 def locations self.get('locations') end |
#remove_tag(name) ⇒ Object
148 149 150 151 |
# File 'lib/batchbook.rb', line 148 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
117 118 119 120 |
# File 'lib/batchbook.rb', line 117 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
113 114 115 |
# File 'lib/batchbook.rb', line 113 def self.get('super_tags') end |
#tags ⇒ Object
80 81 82 |
# File 'lib/batchbook.rb', line 80 def Tag.find(:all, :params => {:contact_id => id}) end |
#todos ⇒ Object
169 170 171 |
# File 'lib/batchbook.rb', line 169 def todos Todo.find(:all, :params => {:person_id => self.id}) end |