Class: Rave::Models::User
Overview
A wave client, acting as a wave creator, blip contributor and/or a wavelet participant.
Direct Known Subclasses
Constant Summary collapse
- ROBOT_PATTERN =
:nodoc:
/@appspot\.com$/
- NOBODY_ID =
:nodoc: Used as a default in certain circumstances.
"@@@nobody@@@"
Constants inherited from Component
Component::GENERATED_PATTERN, Component::GENERATED_PREFIX
Instance Attribute Summary
Attributes inherited from Component
Instance Method Summary collapse
-
#generated? ⇒ Boolean
Unlike other components, Users are never generated [Boolean].
-
#image_url ⇒ Object
Url link to the image of the User [String].
-
#initialize(options = {}) ⇒ User
constructor
-
:id - :name - :profile_url - :image_url - :context.
-
-
#name ⇒ Object
Printable name of the User [String].
-
#profile_url ⇒ Object
Url link to the profile of the User [String].
-
#robot? ⇒ Boolean
Is the User a robot client rather than a human client? [Boolean].
-
#to_json ⇒ Object
:nodoc:.
-
#to_s ⇒ Object
Convert to string [String].
Methods inherited from Component
Methods included from Rave::Mixins::Logger
Constructor Details
#initialize(options = {}) ⇒ User
-
:id
-
:name
-
:profile_url
-
:image_url
-
:context
32 33 34 35 36 37 38 |
# File 'lib/models/user.rb', line 32 def initialize( = {}) # :nodoc: [:id].downcase! if [:id] super() @name = [:name] @profile_url = [:profile_url] || '' @image_url = [:image_url] || '' end |
Instance Method Details
#generated? ⇒ Boolean
Unlike other components, Users are never generated [Boolean].
23 24 25 |
# File 'lib/models/user.rb', line 23 def generated? # :nodoc: false end |
#image_url ⇒ Object
Url link to the image of the User [String]. NOTE: Due to a limitation in Wave, for all users except the local robot the url will be empty.
18 19 20 |
# File 'lib/models/user.rb', line 18 def image_url # :nodoc: @image_url.dup end |
#name ⇒ Object
Printable name of the User [String]. NOTE: Due to a limitation in Wave, for all users except the local robot the name is the same as the @id.
43 44 45 |
# File 'lib/models/user.rb', line 43 def name # :nodoc: @name || @id end |
#profile_url ⇒ Object
Url link to the profile of the User [String]. NOTE: Due to a limitation in Wave, for all users except the local robot the url will be empty.
11 12 13 |
# File 'lib/models/user.rb', line 11 def profile_url # :nodoc: @profile_url.dup end |
#robot? ⇒ Boolean
Is the User a robot client rather than a human client? [Boolean]
48 49 50 |
# File 'lib/models/user.rb', line 48 def robot? # :nodoc: not (@id =~ ROBOT_PATTERN).nil? end |
#to_json ⇒ Object
:nodoc:
57 58 59 |
# File 'lib/models/user.rb', line 57 def to_json # :nodoc: @id.to_json end |
#to_s ⇒ Object
Convert to string [String]
53 54 55 |
# File 'lib/models/user.rb', line 53 def to_s @id end |