Class: KeytechKit::User

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/keytechKit/user.rb

Overview

The user Object This represents a keytech user.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_url, username, password) ⇒ User

Returns a new instance of User.



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

def initialize(base_url, username, password)
  self.class.base_uri(base_url)
  @auth = { username: username, password: password }
end

Instance Attribute Details

#isActiveObject

Returns the value of attribute isActive.



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

def isActive
  @isActive
end

#isAdminObject

Returns the value of attribute isAdmin.



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

def isAdmin
  @isAdmin
end

#isSuperuserObject

Returns the value of attribute isSuperuser.



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

def isSuperuser
  @isSuperuser
end

#languageIDObject

Returns the value of attribute languageID.



16
17
18
# File 'lib/keytechKit/user.rb', line 16

def languageID
  @languageID
end

#longNameObject

Returns the value of attribute longName.



17
18
19
# File 'lib/keytechKit/user.rb', line 17

def longName
  @longName
end

#mailObject

Returns the value of attribute mail.



18
19
20
# File 'lib/keytechKit/user.rb', line 18

def mail
  @mail
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#responseObject

Returns the value of attribute response.



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

def response
  @response
end

Instance Method Details

#favoritesObject



44
45
46
# File 'lib/keytechKit/user.rb', line 44

def favorites
  load_target_links('favorites')
end

#load(username) ⇒ Object

Returns a updated user object username = key of user



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/keytechKit/user.rb', line 27

def load(username)
  options = {}
  options[:basic_auth] = @auth
  response = self.class.get("/user/#{username}", options)
  if response.success?
    self.response = response
    parse_response
    self
  else
    raise response.response
  end
end

#queries(options = {}) ⇒ Object



40
41
42
# File 'lib/keytechKit/user.rb', line 40

def queries(options = {})
  load_target_links('queries', options)
end