class Tact::GoogleContacts::Entry

Attributes

info[R]

Public Class Methods

all() click to toggle source
# File lib/tact/google_client.rb, line 9
def self.all
  collection
end
new(info) click to toggle source
# File lib/tact/google_client.rb, line 13
def initialize(info)
  @info = info
end

Private Class Methods

collection() click to toggle source
# File lib/tact/google_client.rb, line 50
def self.collection
  @@collection ||= Fetcher.info_list.reduce(EntriesCollection.new) do |collection, info|
    collection << new(info)
  end
end

Public Instance Methods

emails() click to toggle source
# 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_name() click to toggle source
# File lib/tact/google_client.rb, line 17
def first_name
  names[:givenName]
end
last_name() click to toggle source
# File lib/tact/google_client.rb, line 21
def last_name
  names[:familyName]
end
phone_numbers() click to toggle source
# 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

Private Instance Methods

names() click to toggle source
# File lib/tact/google_client.rb, line 46
def names
  info[:names][0]
end