Class: PleskKit::Client
- Inherits:
-
Object
- Object
- PleskKit::Client
- Defined in:
- app/models/plesk_kit/client.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#pass ⇒ Object
Returns the value of attribute pass.
-
#rpc_version ⇒ Object
Returns the value of attribute rpc_version.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#user ⇒ Object
Returns the value of attribute user.
-
#xml_response ⇒ Object
Returns the value of attribute xml_response.
-
#xml_target ⇒ Object
Returns the value of attribute xml_target.
Instance Method Summary collapse
-
#initialize(server) ⇒ Client
constructor
A new instance of Client.
- #send_to_plesk(xml) ⇒ Object
Constructor Details
#initialize(server) ⇒ Client
Returns a new instance of Client.
4 5 6 |
# File 'app/models/plesk_kit/client.rb', line 4 def initialize(server) @host, @user, @pass, @timeout = server.host, server.username, server.password, 30 end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
3 4 5 |
# File 'app/models/plesk_kit/client.rb', line 3 def host @host end |
#pass ⇒ Object
Returns the value of attribute pass.
3 4 5 |
# File 'app/models/plesk_kit/client.rb', line 3 def pass @pass end |
#rpc_version ⇒ Object
Returns the value of attribute rpc_version.
3 4 5 |
# File 'app/models/plesk_kit/client.rb', line 3 def rpc_version @rpc_version end |
#timeout ⇒ Object
Returns the value of attribute timeout.
3 4 5 |
# File 'app/models/plesk_kit/client.rb', line 3 def timeout @timeout end |
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'app/models/plesk_kit/client.rb', line 3 def user @user end |
#xml_response ⇒ Object
Returns the value of attribute xml_response.
3 4 5 |
# File 'app/models/plesk_kit/client.rb', line 3 def xml_response @xml_response end |
#xml_target ⇒ Object
Returns the value of attribute xml_target.
3 4 5 |
# File 'app/models/plesk_kit/client.rb', line 3 def xml_target @xml_target end |
Instance Method Details
#send_to_plesk(xml) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/plesk_kit/client.rb', line 8 def send_to_plesk(xml) http = Net::HTTP.new(@host, 8443) puts http.inspect http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE @headers = { 'HTTP_AUTH_LOGIN' => @user, 'HTTP_AUTH_PASSWD' => @pass, 'Content-Type' => 'text/xml', } puts @headers path = "/enterprise/control/agent.php" res, data = http.post2(path, xml, @headers) puts res return res.body, xml end |