Module: Insightly::AddressHelper

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

Instance Method Summary collapse

Instance Method Details

#add_address(address) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/insightly/address_helper.rb', line 12

def add_address(address)
  @data["ADDRESSES"] ||= []
  @data["ADDRESSES"].each do |a|
    if  address.same_address?(Insightly::Address.build(a))

      return false
    end
  end
  @data["ADDRESSES"] << address.remote_data
  true
end

#addressesObject



3
4
5
6
# File 'lib/insightly/address_helper.rb', line 3

def addresses
  @data["ADDRESSES"] ||= []
  @data["ADDRESSES"].collect { |a| Insightly::Address.build(a) }
end

#addresses=(list) ⇒ Object



8
9
10
# File 'lib/insightly/address_helper.rb', line 8

def addresses=(list)
  @data["ADDRESSES"] = list ? list.collect { |a| a.remote_data }  : []
end