Class: Zm::Client::Contact

Inherits:
Base::Object show all
Includes:
BelongsToFolder, BelongsToTag
Defined in:
lib/zm/client/contact/contact.rb

Overview

class account tag

Constant Summary collapse

GROUP_PATTERN =
'group'

Instance Attribute Summary collapse

Attributes inherited from Base::Object

#parent, #token

Instance Method Summary collapse

Methods included from BelongsToTag

#tags

Methods included from BelongsToFolder

#folder, #folder!, #folder=, #folder_id, #move!, #trash!

Methods inherited from Base::Object

#clone, #inspect, #instance_variables_map, #logger, #recorded?, #save!, #to_h, #to_s, #update_attribute

Constructor Details

#initialize(parent) ⇒ Contact

Returns a new instance of Contact.



15
16
17
18
19
20
# File 'lib/zm/client/contact/contact.rb', line 15

def initialize(parent)
  @l = FolderDefault::CONTACTS[:id]
  @shared_account_id = nil
  @shared_folder_account_id = nil
  super(parent)
end

Instance Attribute Details

#anniversaryObject

Returns the value of attribute anniversary.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def anniversary
  @anniversary
end

#assistantPhoneObject

Returns the value of attribute assistantPhone.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def assistantPhone
  @assistantPhone
end

#birthdayObject

Returns the value of attribute birthday.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def birthday
  @birthday
end

#callbackPhoneObject

Returns the value of attribute callbackPhone.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def callbackPhone
  @callbackPhone
end

#carPhoneObject

Returns the value of attribute carPhone.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def carPhone
  @carPhone
end

#companyObject

Returns the value of attribute company.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def company
  @company
end

#companyPhoneObject

Returns the value of attribute companyPhone.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def companyPhone
  @companyPhone
end

#custom1Object

Returns the value of attribute custom1.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def custom1
  @custom1
end

#departmentObject

Returns the value of attribute department.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def department
  @department
end

#emailObject

Returns the value of attribute email.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def email
  @email
end

#email2Object

Returns the value of attribute email2.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def email2
  @email2
end

#email3Object

Returns the value of attribute email3.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def email3
  @email3
end

#email4Object

Returns the value of attribute email4.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def email4
  @email4
end

#email5Object

Returns the value of attribute email5.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def email5
  @email5
end

#email6Object

Returns the value of attribute email6.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def email6
  @email6
end

#email7Object

Returns the value of attribute email7.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def email7
  @email7
end

#firstNameObject

Returns the value of attribute firstName.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def firstName
  @firstName
end

#fullNameObject

Returns the value of attribute fullName.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def fullName
  @fullName
end

#homeCityObject

Returns the value of attribute homeCity.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def homeCity
  @homeCity
end

#homeCountryObject

Returns the value of attribute homeCountry.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def homeCountry
  @homeCountry
end

#homeFaxObject

Returns the value of attribute homeFax.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def homeFax
  @homeFax
end

#homePhoneObject

Returns the value of attribute homePhone.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def homePhone
  @homePhone
end

#homePostalCodeObject

Returns the value of attribute homePostalCode.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def homePostalCode
  @homePostalCode
end

#homeStateObject

Returns the value of attribute homeState.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def homeState
  @homeState
end

#homeStreetObject

Returns the value of attribute homeStreet.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def homeStreet
  @homeStreet
end

#homeURLObject

Returns the value of attribute homeURL.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def homeURL
  @homeURL
end

#idObject

Returns the value of attribute id.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def id
  @id
end

#imAddress1Object

Returns the value of attribute imAddress1.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def imAddress1
  @imAddress1
end

#imAddress2Object

Returns the value of attribute imAddress2.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def imAddress2
  @imAddress2
end

#imAddress3Object

Returns the value of attribute imAddress3.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def imAddress3
  @imAddress3
end

#imAddress4Object

Returns the value of attribute imAddress4.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def imAddress4
  @imAddress4
end

#imAddress5Object

Returns the value of attribute imAddress5.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def imAddress5
  @imAddress5
end

#imageObject

Returns the value of attribute image.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def image
  @image
end

#jobTitleObject

Returns the value of attribute jobTitle.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def jobTitle
  @jobTitle
end

#lObject

Returns the value of attribute l.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def l
  @l
end

#lastNameObject

Returns the value of attribute lastName.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def lastName
  @lastName
end

#maidenNameObject

Returns the value of attribute maidenName.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def maidenName
  @maidenName
end

#middleNameObject

Returns the value of attribute middleName.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def middleName
  @middleName
end

#mobilePhoneObject

Returns the value of attribute mobilePhone.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def mobilePhone
  @mobilePhone
end

#nameObject

Returns the value of attribute name.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def name
  @name
end

#namePrefixObject

Returns the value of attribute namePrefix.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def namePrefix
  @namePrefix
end

#nameSuffixObject

Returns the value of attribute nameSuffix.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def nameSuffix
  @nameSuffix
end

#nicknameObject

Returns the value of attribute nickname.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def nickname
  @nickname
end

#notesObject

Returns the value of attribute notes.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def notes
  @notes
end

#otherCityObject

Returns the value of attribute otherCity.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def otherCity
  @otherCity
end

#otherCountryObject

Returns the value of attribute otherCountry.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def otherCountry
  @otherCountry
end

#otherFaxObject

Returns the value of attribute otherFax.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def otherFax
  @otherFax
end

#otherPhoneObject

Returns the value of attribute otherPhone.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def otherPhone
  @otherPhone
end

#otherPostalCodeObject

Returns the value of attribute otherPostalCode.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def otherPostalCode
  @otherPostalCode
end

#otherStateObject

Returns the value of attribute otherState.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def otherState
  @otherState
end

#otherStreetObject

Returns the value of attribute otherStreet.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def otherStreet
  @otherStreet
end

#otherURLObject

Returns the value of attribute otherURL.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def otherURL
  @otherURL
end

#pagerObject

Returns the value of attribute pager.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def pager
  @pager
end

#shared_account_idObject

Returns the value of attribute shared_account_id.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def 
  @shared_account_id
end

#shared_folder_account_idObject

Returns the value of attribute shared_folder_account_id.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def 
  @shared_folder_account_id
end

#tnObject

Returns the value of attribute tn.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def tn
  @tn
end

#typeObject

Returns the value of attribute type.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def type
  @type
end

#workCityObject

Returns the value of attribute workCity.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def workCity
  @workCity
end

#workCountryObject

Returns the value of attribute workCountry.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def workCountry
  @workCountry
end

#workFaxObject

Returns the value of attribute workFax.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def workFax
  @workFax
end

#workPhoneObject

Returns the value of attribute workPhone.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def workPhone
  @workPhone
end

#workPostalCodeObject

Returns the value of attribute workPostalCode.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def workPostalCode
  @workPostalCode
end

#workStateObject

Returns the value of attribute workState.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def workState
  @workState
end

#workStreetObject

Returns the value of attribute workStreet.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def workStreet
  @workStreet
end

#workURLObject

Returns the value of attribute workURL.



12
13
14
# File 'lib/zm/client/contact/contact.rb', line 12

def workURL
  @workURL
end

Instance Method Details

#add_custom_property(key, value) ⇒ Object



30
31
32
# File 'lib/zm/client/contact/contact.rb', line 30

def add_custom_property(key, value)
  instance_variable_set(Utils.arrow_name(key), value)
end

#create!Object



34
35
36
37
38
39
# File 'lib/zm/client/contact/contact.rb', line 34

def create!
  rep = @parent.sacc.invoke(jsns_builder.to_jsns)
  ContactJsnsInitializer.update(self, rep[:CreateContactResponse][:cn].first)

  @id
end

#delete!Object



62
63
64
65
66
67
# File 'lib/zm/client/contact/contact.rb', line 62

def delete!
  return false if @id.nil?

  @parent.sacc.invoke(jsns_builder.to_delete)
  @id = nil
end

#emailsObject



26
27
28
# File 'lib/zm/client/contact/contact.rb', line 26

def emails
  [email, email2, email3, email4, email5, email6, email7].compact
end

#group?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/zm/client/contact/contact.rb', line 22

def group?
  @type == GROUP_PATTERN
end

#modify!Object



41
42
43
44
# File 'lib/zm/client/contact/contact.rb', line 41

def modify!
  @parent.sacc.invoke(jsns_builder.to_update)
  true
end

#reload!Object

Raises:

  • (NotImplementedError)


69
70
71
# File 'lib/zm/client/contact/contact.rb', line 69

def reload!
  raise NotImplementedError
end

#rename!(*args) ⇒ Object

Raises:

  • (NotImplementedError)


58
59
60
# File 'lib/zm/client/contact/contact.rb', line 58

def rename!(*args)
  raise NotImplementedError
end

#update!(hash) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/zm/client/contact/contact.rb', line 46

def update!(hash)
  return false if hash.delete_if { |k, v| v.nil? || !respond_to?(k) }.empty?

  do_update!(hash)

  hash.each do |key, value|
    update_attribute(key, value)
  end

  true
end