class Lita::GoogleAccount

A GSuite account

Attributes

address_line1[R]
address_line2[R]
address_line3[R]
alternate_email[R]
contact_name[R]
country_code[R]
created_at[R]
id[R]
language[R]
organization_name[R]
phone_number[R]
postal_code[R]
primary_domain[R]
region[R]

Public Class Methods

from_api(account) click to toggle source
# File lib/lita/google_account.rb, line 9
def self.from_api(account)
  GoogleAccount.new(
    id: account.id,
    alternate_email: account.alternate_email,
    created_at: account.customer_creation_time,
    primary_domain: account.customer_domain,
    language: account.language,
    phone_number: account.phone_number,
    address_line1: account.postal_address.address_line1,
    address_line2: account.postal_address.address_line2,
    address_line3: account.postal_address.address_line3,
    contact_name: account.postal_address.contact_name,
    country_code: account.postal_address.country_code,
    postal_code: account.postal_address.postal_code,
    region: account.postal_address.region
  )
end
new(id:, alternate_email:, primary_domain:, created_at:, language:, phone_number:, address_line1: nil, address_line2: nil, address_line3: nil, contact_name: nil, country_code: nil, organization_name: nil, postal_code: nil, region: nil) click to toggle source
# File lib/lita/google_account.rb, line 27
def initialize(id:, alternate_email:, primary_domain:, created_at:, language:, phone_number:, address_line1: nil, address_line2: nil, address_line3: nil, contact_name: nil, country_code: nil, organization_name: nil, postal_code: nil, region: nil)
  @id, @alternate_email, @created_at = id, alternate_email, created_at
  @primary_domain = primary_domain
  @language, @phone_number = language, phone_number
  @address_line1, @address_line2, @address_line3 = address_line1, address_line2, address_line3
  @contact_name, @country_code, @organization_name = contact_name, country_code, organization_name
  @postal_code, @region = postal_code, region
end

Public Instance Methods

==(other) click to toggle source
# File lib/lita/google_account.rb, line 36
def ==(other)
  @id == other.id
end
address() click to toggle source
# File lib/lita/google_account.rb, line 40
def address
  [
    address_line1,
    address_line2,
    address_line3,
    region,
    postal_code,
    country_code
  ].reject(&:nil?).join(", ")
end
to_s() click to toggle source
# File lib/lita/google_account.rb, line 51
def to_s
  "Account #{@id}"
end