Class: HangoutsJsonParser::User

Inherits:
Object
  • Object
show all
Defined in:
lib/hangouts_json_parser/user.rb

Overview

A chat user

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name) ⇒ User

Returns a new instance of User.



14
15
16
17
# File 'lib/hangouts_json_parser/user.rb', line 14

def initialize id, name
	@id = id
	@name = name
end

Instance Attribute Details

#idString (readonly)

Returns Google id of the user.

Returns:

  • (String)

    Google id of the user



5
6
7
# File 'lib/hangouts_json_parser/user.rb', line 5

def id
  @id
end

#nameString (readonly)

Returns in-chat name of the user.

Returns:

  • (String)

    in-chat name of the user



7
8
9
# File 'lib/hangouts_json_parser/user.rb', line 7

def name
  @name
end

Class Method Details

.from_participant_data(data) ⇒ Object

Creates a user from participant data



20
21
22
23
# File 'lib/hangouts_json_parser/user.rb', line 20

def self.from_participant_data data
	# TODO: Use the Google+ API to actually look up this person?
	User.new data['id']['gaia_id'], data['fallback_name']
end

Instance Method Details

#profileString

Returns the Google+ profile of the user.

Returns:

  • (String)

    the Google+ profile of the user



10
11
12
# File 'lib/hangouts_json_parser/user.rb', line 10

def profile
	"https://plus.google.com/#{id}"
end