Module: Insightly::TaskLinkHelper
- Included in:
- Task
- Defined in:
- lib/insightly/task_link_helper.rb
Instance Method Summary collapse
- #add_contact(contact) ⇒ Object
- #add_contact_id(contact_id) ⇒ Object
- #add_opportunity(opportunity) ⇒ Object
- #add_opportunity_id(opportunity_id) ⇒ Object
- #add_organisation(organisation) ⇒ Object
- #add_organisation_id(organisation_id) ⇒ Object
- #add_task_link(link) ⇒ Object
- #contact_ids ⇒ Object
- #contacts ⇒ Object
- #opportunities ⇒ Object
- #opportunity_ids ⇒ Object
- #organisation_ids ⇒ Object
- #organisations ⇒ Object
- #task_links ⇒ Object
- #task_links=(list) ⇒ Object
Instance Method Details
#add_contact(contact) ⇒ Object
31 32 33 |
# File 'lib/insightly/task_link_helper.rb', line 31 def add_contact(contact) add_by_obj("contact", contact) end |
#add_contact_id(contact_id) ⇒ Object
27 28 29 |
# File 'lib/insightly/task_link_helper.rb', line 27 def add_contact_id(contact_id) add_by_id("contact", contact_id) end |
#add_opportunity(opportunity) ⇒ Object
49 50 51 |
# File 'lib/insightly/task_link_helper.rb', line 49 def add_opportunity(opportunity) add_by_obj("opportunity", opportunity) end |
#add_opportunity_id(opportunity_id) ⇒ Object
45 46 47 |
# File 'lib/insightly/task_link_helper.rb', line 45 def add_opportunity_id(opportunity_id) add_by_id("opportunity", opportunity_id) end |
#add_organisation(organisation) ⇒ Object
64 65 66 |
# File 'lib/insightly/task_link_helper.rb', line 64 def add_organisation(organisation) add_by_obj("organisation", organisation) end |
#add_organisation_id(organisation_id) ⇒ Object
60 61 62 |
# File 'lib/insightly/task_link_helper.rb', line 60 def add_organisation_id(organisation_id) add_by_id("organisation", organisation_id) end |
#add_task_link(link) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/insightly/task_link_helper.rb', line 13 def add_task_link(link) raise(ScriptError, "You must save the #{self.class} before adding a link.") if !remote_id @data["TASKLINKS"] ||= [] @data["TASKLINKS"] << fix_for_link(link).remote_data true end |
#contact_ids ⇒ Object
19 20 21 |
# File 'lib/insightly/task_link_helper.rb', line 19 def contact_ids list_ids_by_type("contact") end |
#contacts ⇒ Object
23 24 25 |
# File 'lib/insightly/task_link_helper.rb', line 23 def contacts list_objs_by_type("contact", Insightly::Contact) end |
#opportunities ⇒ Object
41 42 43 |
# File 'lib/insightly/task_link_helper.rb', line 41 def opportunities list_objs_by_type("opportunity", Insightly::Opportunity) end |
#opportunity_ids ⇒ Object
37 38 39 |
# File 'lib/insightly/task_link_helper.rb', line 37 def opportunity_ids list_ids_by_type("opportunity") end |
#organisation_ids ⇒ Object
52 53 54 |
# File 'lib/insightly/task_link_helper.rb', line 52 def organisation_ids list_ids_by_type("organisation") end |
#organisations ⇒ Object
56 57 58 |
# File 'lib/insightly/task_link_helper.rb', line 56 def organisations list_objs_by_type("organisation", Insightly::Organisation) end |
#task_links ⇒ Object
4 5 6 7 |
# File 'lib/insightly/task_link_helper.rb', line 4 def task_links @data["TASKLINKS"] ||= [] @data["TASKLINKS"].collect { |a| Insightly::TaskLink.build(a) } end |
#task_links=(list) ⇒ Object
9 10 11 |
# File 'lib/insightly/task_link_helper.rb', line 9 def task_links=(list) @data["TASKLINKS"] = list ? list.collect { |a| fix_for_link(a).remote_data } : [] end |