Module: HighriseWrapper::ActiveRecord

Defined in:
lib/highrise_wrapper/contact.rb

Instance Method Summary collapse

Instance Method Details

#highrise_removeObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/highrise_wrapper/contact.rb', line 24

def highrise_remove
  logger.info 'Removing #{fullname} from highrise'

  begin
    setup_highrise
    person = Highrise::Person.find(highrise_id)
    person.destroy
    self.highrise_id = nil
    self.save!
  rescue Exception => exception
    logger.error(
      "It was not possible to remove contact from highrise: " +
      "#{exception.class} (#{exception.message})")
    return false
  end
end

#highrise_saveObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/highrise_wrapper/contact.rb', line 7

def highrise_save
  logger.info 'Saving #{fullname} to highrise'

  begin
    setup_highrise
    person = Highrise::Person.new(self.highrise_hash)
    person.save!
    self.highrise_id = person.attributes['id']
    self.save!
  rescue Exception => exception
    logger.error(
      "It was not possible to save contact to highrise: " +
      "#{exception.class} (#{exception.message})")
    return false
  end
end

#on_highrise?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/highrise_wrapper/contact.rb', line 3

def on_highrise?
  !self.highrise_id.nil?
end