Class: StrawberryAPI::User

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ User

Returns a new instance of User



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/strawberry_api/user.rb', line 17

def initialize(params = {})
  params.each do |k, v|
    if k == 'teams'
      v.map! do |team|
        Team.new(team)
      end
    end
    
    instance_variable_set("@#{k.gsub(/[!@#$%^&*?']/, '')}", v) unless v.nil?
  end
end

Instance Attribute Details

#authentication_tokenObject

Returns the value of attribute authentication_token



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

def authentication_token
  @authentication_token
end

#created_atObject

Returns the value of attribute created_at



8
9
10
# File 'lib/strawberry_api/user.rb', line 8

def created_at
  @created_at
end

#firstnameObject

Returns the value of attribute firstname



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

def firstname
  @firstname
end

#idObject

Returns the value of attribute id



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

def id
  @id
end

#lastnameObject

Returns the value of attribute lastname



11
12
13
# File 'lib/strawberry_api/user.rb', line 11

def lastname
  @lastname
end

#own_team_idObject

Returns the value of attribute own_team_id



12
13
14
# File 'lib/strawberry_api/user.rb', line 12

def own_team_id
  @own_team_id
end

#roleObject

Returns the value of attribute role



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

def role
  @role
end

#role_idObject

Returns the value of attribute role_id



13
14
15
# File 'lib/strawberry_api/user.rb', line 13

def role_id
  @role_id
end

#teamsObject

Returns the value of attribute teams



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

def teams
  @teams
end

#updated_atObject

Returns the value of attribute updated_at



9
10
11
# File 'lib/strawberry_api/user.rb', line 9

def updated_at
  @updated_at
end

#usernameObject

Returns the value of attribute username



6
7
8
# File 'lib/strawberry_api/user.rb', line 6

def username
  @username
end