Class: Tact::GoogleContacts::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/tact/google_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info) ⇒ Entry

Returns a new instance of Entry.



13
14
15
# File 'lib/tact/google_client.rb', line 13

def initialize(info)
  @info = info
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



7
8
9
# File 'lib/tact/google_client.rb', line 7

def info
  @info
end

Class Method Details

.allObject



9
10
11
# File 'lib/tact/google_client.rb', line 9

def self.all
  collection
end

Instance Method Details

#emailsObject



36
37
38
39
40
41
42
# File 'lib/tact/google_client.rb', line 36

def emails
  if info[:emailAddresses]
    info[:emailAddresses].map do |email_address|
      Email.new(address: email_address[:value])
    end 
  end
end

#first_nameObject



17
18
19
# File 'lib/tact/google_client.rb', line 17

def first_name
  names[:givenName]
end

#last_nameObject



21
22
23
# File 'lib/tact/google_client.rb', line 21

def last_name
  names[:familyName]
end

#phone_numbersObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/tact/google_client.rb', line 25

def phone_numbers
  if info[:phoneNumbers]
    info[:phoneNumbers].map do |phone_number|
      PhoneNumber.new(
        number: phone_number[:value],
        kind: phone_number[:type]
      )
    end
  end
end