Class: Kloxo::API::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/kloxo/api/service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Service

Returns a new instance of Service.



8
9
10
11
12
13
# File 'lib/kloxo/api/service.rb', line 8

def initialize params = {}
  self.address = params[:address]
  self.port = params[:port]
  self.username = params[:username]
  self.password = params[:password]
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



6
7
8
# File 'lib/kloxo/api/service.rb', line 6

def address
  @address
end

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/kloxo/api/service.rb', line 6

def password
  @password
end

#portObject

Returns the value of attribute port.



6
7
8
# File 'lib/kloxo/api/service.rb', line 6

def port
  @port
end

#queryObject

Returns the value of attribute query.



6
7
8
# File 'lib/kloxo/api/service.rb', line 6

def query
  @query
end

#usernameObject

Returns the value of attribute username.



6
7
8
# File 'lib/kloxo/api/service.rb', line 6

def username
  @username
end

Instance Method Details

#create(request) ⇒ Object



25
26
27
28
29
# File 'lib/kloxo/api/service.rb', line 25

def create request
  response = HTTParty.post (self.query + request.param)

  Kloxo::API::Client::CreateResponse.new(response)
end

#delete(request) ⇒ Object



37
38
39
40
41
# File 'lib/kloxo/api/service.rb', line 37

def delete request
  response = HTTParty.post (self.query + request.param)

  Kloxo::API::Client::DeleteResponse.new(response)
end

#disable(request) ⇒ Object



49
50
51
52
53
# File 'lib/kloxo/api/service.rb', line 49

def disable request
  response = HTTParty.post (self.query + request.param)

  Kloxo::API::Client::DisableResponse.new(response)
end

#enable(request) ⇒ Object



43
44
45
46
47
# File 'lib/kloxo/api/service.rb', line 43

def enable request
  response = HTTParty.post (self.query + request.param)

  Kloxo::API::Client::EnableResponse.new(response)
end

#info(request) ⇒ Object



19
20
21
22
23
# File 'lib/kloxo/api/service.rb', line 19

def info request
  response = HTTParty.get (self.query + request.param)

  Kloxo::API::Client::InfoResponse.new(response)
end

#resource(request) ⇒ Object



31
32
33
34
35
# File 'lib/kloxo/api/service.rb', line 31

def resource request
  response = HTTParty.post (self.query + request.param)

  Kloxo::API::ResourceResponse.new(response)
end