Class: ZeusClient::V1::Auth

Inherits:
Object
  • Object
show all
Includes:
HTTParty, ServiceBase
Defined in:
lib/zeus/v1/client/auth.rb

Constant Summary collapse

SUBDOMAIN =
"auth"
LOCAL_PORT =
3003

Instance Attribute Summary

Attributes included from ServiceBase

#environment_id, #project_id, #public_key, #scope, #secret_key, #zeus_auth_key

Instance Method Summary collapse

Methods included from ServiceBase

#create_project_environment, #destroy_project_environment, #get_headers, #get_project_environment, #get_project_environments, included, #initialize

Instance Method Details

#get_user(id) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/zeus/v1/client/auth.rb', line 35

def get_user(id)
    resp = self.class.get("/api/v1/users/#{id}", headers: self.get_headers).parsed_response
    if resp["success"] == true
        return User.new(resp["object"])
    else
        return nil
    end
end

#get_users(query) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/zeus/v1/client/auth.rb', line 25

def get_users(query)
    resp = self.class.get("/api/v1/users", query: query, headers: self.get_headers).parsed_response

    if resp["success"] == true
        return resp["objects"].map {|u| User.new(u) }
    else
        return nil
    end
end

#list_users(query) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/zeus/v1/client/auth.rb', line 12

def list_users(query)
    resp = self.class.get("/api/v1/users", query: query, headers: self.get_headers).parsed_response
    if resp["success"] == true
        return resp["objects"].map {|u| User.new(u) }
    else
        return nil
    end
end

#signup_with_email_password(user) ⇒ Object



21
22
23
# File 'lib/zeus/v1/client/auth.rb', line 21

def (user)
    resp = self.class.post("/api/v1/users", body: {user: user}.to_json, headers: self.get_headers).parsed_response
end