Module: Insightly::LinkHelper

Included in:
Contact, Opportunity, Organisation
Defined in:
lib/insightly/link_helper.rb

Instance Method Summary collapse

Instance Method Details



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_idsObject



18
19
20
# File 'lib/insightly/link_helper.rb', line 18

def contact_ids
  self.links.collect { |link| link.contact_id}.compact
end

#contactsObject



27
28
29
# File 'lib/insightly/link_helper.rb', line 27

def contacts
  self.contact_ids.collect { |id| Insightly::Contact.new(id)}
end


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

#opportunitiesObject



30
31
32
# File 'lib/insightly/link_helper.rb', line 30

def opportunities
  self.opportunity_ids.collect { |id| Insightly::Opportunity.new(id)}
end

#opportunity_idsObject



21
22
23
# File 'lib/insightly/link_helper.rb', line 21

def opportunity_ids
  self.links.collect { |link| link.opportunity_id}.compact
end

#organisation_idsObject



24
25
26
# File 'lib/insightly/link_helper.rb', line 24

def organisation_ids
  self.links.collect { |link| link.organisation_id}.compact
end

#organisationsObject



33
34
35
# File 'lib/insightly/link_helper.rb', line 33

def organisations
  self.organisation_ids.collect { |id| Insightly::Organisation.new(id)}
end