Module: Insightly::LinkHelper
- Included in:
- Contact, Opportunity, Organisation
- Defined in:
- lib/insightly/link_helper.rb
Instance Method Summary collapse
- #add_link(link) ⇒ Object
- #contact_ids ⇒ Object
- #contacts ⇒ Object
- #links ⇒ Object
- #links=(list) ⇒ Object
- #opportunities ⇒ Object
- #opportunity_ids ⇒ Object
- #organisation_ids ⇒ Object
- #organisations ⇒ Object
Instance Method Details
#add_link(link) ⇒ Object
13 14 15 16 17 |
# File 'lib/insightly/link_helper.rb', line 13 def add_link(link) @data["LINKS"] ||= [] @data["LINKS"] << fix_for_link(link).remote_data true end |
#contact_ids ⇒ Object
18 19 20 |
# File 'lib/insightly/link_helper.rb', line 18 def contact_ids self.links.collect { |link| link.contact_id}.compact end |
#contacts ⇒ Object
27 28 29 |
# File 'lib/insightly/link_helper.rb', line 27 def contacts self.contact_ids.collect { |id| Insightly::Contact.new(id)} end |
#links ⇒ Object
4 5 6 7 |
# File 'lib/insightly/link_helper.rb', line 4 def links @data["LINKS"] ||= [] @data["LINKS"].collect { |a| Insightly::Link.build(a) } end |
#links=(list) ⇒ Object
9 10 11 |
# File 'lib/insightly/link_helper.rb', line 9 def links=(list) @data["LINKS"] = list ? list.collect { |a| fix_for_link(a).remote_data } : [] end |
#opportunities ⇒ Object
30 31 32 |
# File 'lib/insightly/link_helper.rb', line 30 def opportunities self.opportunity_ids.collect { |id| Insightly::Opportunity.new(id)} end |
#opportunity_ids ⇒ Object
21 22 23 |
# File 'lib/insightly/link_helper.rb', line 21 def opportunity_ids self.links.collect { |link| link.opportunity_id}.compact end |
#organisation_ids ⇒ Object
24 25 26 |
# File 'lib/insightly/link_helper.rb', line 24 def organisation_ids self.links.collect { |link| link.organisation_id}.compact end |
#organisations ⇒ Object
33 34 35 |
# File 'lib/insightly/link_helper.rb', line 33 def organisations self.organisation_ids.collect { |id| Insightly::Organisation.new(id)} end |