Class: Jelastic::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
REST::API
Defined in:
lib/jelastic/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from REST::Control

#add_docker_volume, #add_docker_volume_by_group, #create_environment, #delete_environment, #get_docker_env_vars, #get_environment, #get_environments, #redeploy_container_by_id, #redeploy_containers_by_group, #set_docker_env_vars

Methods included from REST::Authentication

#signin, #signout

Methods included from REST::Utils

#send_request, #send_request_with_system_appid, #to_json

Constructor Details

#initialize(params = {}) {|_self| ... } ⇒ Client

Returns a new instance of Client.

Yields:

  • (_self)

Yield Parameters:



15
16
17
18
19
20
21
# File 'lib/jelastic/client.rb', line 15

def initialize(params = {})
  params.each do |key, value|
    instance_variable_set("@#{key}", value)
  end

  yield(self) if block_given?
end

Instance Attribute Details

#api_urlObject

Returns the value of attribute api_url.



10
11
12
# File 'lib/jelastic/client.rb', line 10

def api_url
  @api_url
end

#loginObject

Returns the value of attribute login.



10
11
12
# File 'lib/jelastic/client.rb', line 10

def 
  @login
end

#passwordObject

Returns the value of attribute password.



10
11
12
# File 'lib/jelastic/client.rb', line 10

def password
  @password
end

#userObject (readonly)

Returns the value of attribute user.



11
12
13
# File 'lib/jelastic/client.rb', line 11

def user
  @user
end

Instance Method Details

#authenticateObject



27
28
29
30
31
# File 'lib/jelastic/client.rb', line 27

def authenticate
  @user = User.new()

  nil
end

#authenticated?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/jelastic/client.rb', line 23

def authenticated?
  !user.nil?
end

#logoutObject



33
34
35
36
37
38
39
40
# File 'lib/jelastic/client.rb', line 33

def logout
  if authenticated?
    signout
    @user = nil
  end

  nil
end