Class: Yt::Models::UserInfo

Inherits:
Base
  • Object
show all
Defined in:
lib/yt/models/user_info.rb

Overview

Provides methods to retrieve an account’s user profile.

Instance Method Summary collapse

Methods included from Associations::HasReports

#has_report

Methods included from Associations::HasOne

#has_one

Methods included from Associations::HasMany

#has_many

Methods included from Associations::HasAuthentication

#has_authentication

Constructor Details

#initialize(options = {}) ⇒ UserInfo

Returns a new instance of UserInfo.



8
9
10
# File 'lib/yt/models/user_info.rb', line 8

def initialize(options = {})
  @data = options[:data]
end

Instance Method Details

#avatar_urlString

Returns the URL of the user’s profile picture.

Returns:

  • (String)

    the URL of the user’s profile picture.



48
49
50
# File 'lib/yt/models/user_info.rb', line 48

def avatar_url
  @avatar_url ||= @data.fetch 'picture', ''
end

#emailString

Returns the user’s email address.

Returns:

  • (String)

    the user’s email address.



18
19
20
# File 'lib/yt/models/user_info.rb', line 18

def email
  @email ||= @data.fetch 'email', ''
end

#family_nameString

Returns the user’s family (last) name.

Returns:

  • (String)

    the user’s family (last) name.



38
39
40
# File 'lib/yt/models/user_info.rb', line 38

def family_name
  @family_name ||= @data.fetch 'family_name', ''
end

#genderString

Returns the person’s gender. Possible values include, but are not limited to, “male”, “female”, “other”.

Returns:

  • (String)

    the person’s gender. Possible values include, but are not limited to, “male”, “female”, “other”.



54
55
56
# File 'lib/yt/models/user_info.rb', line 54

def gender
  @gender ||= @data.fetch 'gender', ''
end

#given_nameString

Returns the user’s given (first) name.

Returns:

  • (String)

    the user’s given (first) name.



33
34
35
# File 'lib/yt/models/user_info.rb', line 33

def given_name
  @given_name ||= @data.fetch 'given_name', ''
end

#has_verified_email?Boolean

Returns whether the email address is verified.

Returns:

  • (Boolean)

    whether the email address is verified.



23
24
25
# File 'lib/yt/models/user_info.rb', line 23

def has_verified_email?
  @verified_email ||= @data.fetch 'verified_email', false
end

#hdString

Returns the hosted domain name for the user’s Google Apps account. For instance, example.com.

Returns:

  • (String)

    the hosted domain name for the user’s Google Apps account. For instance, example.com.



65
66
67
# File 'lib/yt/models/user_info.rb', line 65

def hd
  @hd ||= @data.fetch 'hd', ''
end

#idString

Returns the user’s ID.

Returns:

  • (String)

    the user’s ID.



13
14
15
# File 'lib/yt/models/user_info.rb', line 13

def id
  @id ||= @data.fetch 'id', ''
end

#localeString

Returns the user’s preferred locale.

Returns:

  • (String)

    the user’s preferred locale.



59
60
61
# File 'lib/yt/models/user_info.rb', line 59

def locale
  @locale ||= @data.fetch 'locale', ''
end

#nameString

Returns the user’s full name.

Returns:

  • (String)

    the user’s full name.



28
29
30
# File 'lib/yt/models/user_info.rb', line 28

def name
  @name ||= @data.fetch 'name', ''
end

#profile_urlString

Returns the URL of the user’s profile page.

Returns:

  • (String)

    the URL of the user’s profile page.



43
44
45
# File 'lib/yt/models/user_info.rb', line 43

def profile_url
  @profile_url ||= @data.fetch 'link', ''
end