Class: HipChat::Api

Inherits:
Object
  • Object
show all
Includes:
CommonMethods
Defined in:
lib/hip_chat/api.rb

Constant Summary

Constants included from CommonMethods

CommonMethods::BASE_URL, CommonMethods::OK_CODES

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Api

Returns a new instance of Api.



11
12
13
14
# File 'lib/hip_chat/api.rb', line 11

def initialize(token)
  @token = token
  validate_token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



9
10
11
# File 'lib/hip_chat/api.rb', line 9

def token
  @token
end

#usersObject (readonly)

Returns the value of attribute users.



9
10
11
# File 'lib/hip_chat/api.rb', line 9

def users
  @users
end

Instance Method Details

#refresh_usersObject



16
17
18
19
20
21
# File 'lib/hip_chat/api.rb', line 16

def refresh_users
  response = get_request(User::URL, auth_hash)
  users_list = validate_response(response)["items"]

  @users = Relation.new(token, users_list, User)
end