Class: Lita::GoogleAccount
- Inherits:
-
Object
- Object
- Lita::GoogleAccount
- Defined in:
- lib/lita/google_account.rb
Overview
A GSuite account
Instance Attribute Summary collapse
-
#address_line1 ⇒ Object
readonly
Returns the value of attribute address_line1.
-
#address_line2 ⇒ Object
readonly
Returns the value of attribute address_line2.
-
#address_line3 ⇒ Object
readonly
Returns the value of attribute address_line3.
-
#alternate_email ⇒ Object
readonly
Returns the value of attribute alternate_email.
-
#contact_name ⇒ Object
readonly
Returns the value of attribute contact_name.
-
#country_code ⇒ Object
readonly
Returns the value of attribute country_code.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#organization_name ⇒ Object
readonly
Returns the value of attribute organization_name.
-
#phone_number ⇒ Object
readonly
Returns the value of attribute phone_number.
-
#postal_code ⇒ Object
readonly
Returns the value of attribute postal_code.
-
#primary_domain ⇒ Object
readonly
Returns the value of attribute primary_domain.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #address ⇒ Object
-
#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) ⇒ GoogleAccount
constructor
A new instance of GoogleAccount.
- #to_s ⇒ Object
Constructor Details
#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) ⇒ GoogleAccount
27 28 29 30 31 32 33 34 |
# 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 |
Instance Attribute Details
#address_line1 ⇒ Object (readonly)
Returns the value of attribute address_line1.
6 7 8 |
# File 'lib/lita/google_account.rb', line 6 def address_line1 @address_line1 end |
#address_line2 ⇒ Object (readonly)
Returns the value of attribute address_line2.
6 7 8 |
# File 'lib/lita/google_account.rb', line 6 def address_line2 @address_line2 end |
#address_line3 ⇒ Object (readonly)
Returns the value of attribute address_line3.
6 7 8 |
# File 'lib/lita/google_account.rb', line 6 def address_line3 @address_line3 end |
#alternate_email ⇒ Object (readonly)
Returns the value of attribute alternate_email.
4 5 6 |
# File 'lib/lita/google_account.rb', line 4 def alternate_email @alternate_email end |
#contact_name ⇒ Object (readonly)
Returns the value of attribute contact_name.
7 8 9 |
# File 'lib/lita/google_account.rb', line 7 def contact_name @contact_name end |
#country_code ⇒ Object (readonly)
Returns the value of attribute country_code.
7 8 9 |
# File 'lib/lita/google_account.rb', line 7 def country_code @country_code end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/lita/google_account.rb', line 4 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/lita/google_account.rb', line 4 def id @id end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
4 5 6 |
# File 'lib/lita/google_account.rb', line 4 def language @language end |
#organization_name ⇒ Object (readonly)
Returns the value of attribute organization_name.
7 8 9 |
# File 'lib/lita/google_account.rb', line 7 def organization_name @organization_name end |
#phone_number ⇒ Object (readonly)
Returns the value of attribute phone_number.
4 5 6 |
# File 'lib/lita/google_account.rb', line 4 def phone_number @phone_number end |
#postal_code ⇒ Object (readonly)
Returns the value of attribute postal_code.
7 8 9 |
# File 'lib/lita/google_account.rb', line 7 def postal_code @postal_code end |
#primary_domain ⇒ Object (readonly)
Returns the value of attribute primary_domain.
5 6 7 |
# File 'lib/lita/google_account.rb', line 5 def primary_domain @primary_domain end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
7 8 9 |
# File 'lib/lita/google_account.rb', line 7 def region @region end |
Class Method Details
.from_api(account) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 |
Instance Method Details
#==(other) ⇒ Object
36 37 38 |
# File 'lib/lita/google_account.rb', line 36 def ==(other) @id == other.id end |
#address ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# 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 ⇒ Object
51 52 53 |
# File 'lib/lita/google_account.rb', line 51 def to_s "Account #{@id}" end |