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
14
15
# 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]

  HTTParty::Basement.default_options.update(verify: false)
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

#add_bandwidth(request) ⇒ Object



39
40
41
42
43
# File 'lib/kloxo/api/service.rb', line 39

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

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

#add_domain(request) ⇒ Object



33
34
35
36
37
# File 'lib/kloxo/api/service.rb', line 33

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

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

#change_password(request) ⇒ Object



81
82
83
84
85
# File 'lib/kloxo/api/service.rb', line 81

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

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

#change_plan(request) ⇒ Object



45
46
47
48
49
# File 'lib/kloxo/api/service.rb', line 45

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

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

#create(request) ⇒ Object



27
28
29
30
31
# File 'lib/kloxo/api/service.rb', line 27

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

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

#delete(request) ⇒ Object



63
64
65
66
67
# File 'lib/kloxo/api/service.rb', line 63

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

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

#delete_domain(request) ⇒ Object



51
52
53
54
55
# File 'lib/kloxo/api/service.rb', line 51

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

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

#disable(request) ⇒ Object



75
76
77
78
79
# File 'lib/kloxo/api/service.rb', line 75

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

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

#enable(request) ⇒ Object



69
70
71
72
73
# File 'lib/kloxo/api/service.rb', line 69

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

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

#info(request) ⇒ Object



21
22
23
24
25
# File 'lib/kloxo/api/service.rb', line 21

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

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

#resource(request) ⇒ Object



57
58
59
60
61
# File 'lib/kloxo/api/service.rb', line 57

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

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