Class: UwsgiItClient

Inherits:
Object
  • Object
show all
Defined in:
lib/uwsgi_it_client.rb,
lib/uwsgi_it_client/cli.rb,
lib/uwsgi_it_client/getter.rb,
lib/uwsgi_it_client/poster.rb,
lib/uwsgi_it_client/deleter.rb,
lib/uwsgi_it_client/version.rb,
lib/uwsgi_it_client/error_hash.rb,
lib/uwsgi_it_client/client_helpers.rb

Defined Under Namespace

Modules: ClientHelpers Classes: CLI, Deleter, ErrorHash, Getter, Poster

Constant Summary collapse

API =
{
  me:         'me/',
  containers: 'me/containers/',
  container:  'containers',
  distros:    'distros/',
  domains:    'domains/',
}
VERSION =
"0.0.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ UwsgiItClient

Returns a new instance of UwsgiItClient.



17
18
19
20
21
# File 'lib/uwsgi_it_client.rb', line 17

def initialize(opts)
  @url      = opts.fetch :url
  @username = opts.fetch :username
  @password = opts.fetch :password
end

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



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

def password
  @password
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

#usernameObject (readonly)

Returns the value of attribute username.



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

def username
  @username
end

Instance Method Details

#delete(api_name, payload, opts = {}) ⇒ Object



42
43
44
# File 'lib/uwsgi_it_client.rb', line 42

def delete(api_name, payload, opts={})
  Deleter.new send("#{api_name}_url", opts[:id]), payload, auth_data
end

#post(api_name, payload, opts = {}) ⇒ Object



38
39
40
# File 'lib/uwsgi_it_client.rb', line 38

def post(api_name, payload, opts={})
  Poster.new send("#{api_name}_url", opts[:id]), payload, auth_data
end