Class: Asana::User
- Inherits:
-
Object
- Object
- Asana::User
- Defined in:
- lib/asana-client.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ User
constructor
A new instance of User.
- #to_s ⇒ Object
Constructor Details
#initialize(hash) ⇒ User
Returns a new instance of User.
290 291 292 293 |
# File 'lib/asana-client.rb', line 290 def initialize(hash) self.id = hash[:id] || 0 self.name = hash[:name] || "" end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
288 289 290 |
# File 'lib/asana-client.rb', line 288 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
288 289 290 |
# File 'lib/asana-client.rb', line 288 def name @name end |
Class Method Details
.find(workspace, name) ⇒ Object
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/asana-client.rb', line 295 def self.find(workspace, name) # if given string for workspace, convert to object if workspace.is_a? String workspace = Asana::Workspace.find workspace end # check if any workspace contains the given name, and return first hit name.downcase! workspace.users.each do |user| if user.name.downcase.include? name return user end end nil end |
Instance Method Details
#to_s ⇒ Object
312 313 314 |
# File 'lib/asana-client.rb', line 312 def to_s self.name end |