Class: PleskKit::Communicator
- Inherits:
-
Object
- Object
- PleskKit::Communicator
- Defined in:
- app/models/plesk_kit/communicator.rb
Class Method Summary collapse
- .get_server_stats(server) ⇒ Object
- .get_service_plan(service_plan, server) ⇒ Object
- .get_subscription_guid(subscription) ⇒ Object
- .get_subscription_id(subscription) ⇒ Object
- .pack_and_play_with_customer_or_reseller(account) ⇒ Object
- .pack_and_play_with_subscription(subscription, customer_account) ⇒ Object
- .pack_and_switch_subscription(subscription, new_plan_guid, plesk_sub_id) ⇒ Object
- .push_service_plan(service_plan, server) ⇒ Object
- .push_windows_service_plan(service_plan, server) ⇒ Object
-
.shell ⇒ Object
The shell for the XML.
- .sync_subscription(sub, sub_guid, customer_account) ⇒ Object
-
.transportation_for(packet, server) ⇒ Object
Sends packet to plesk.
Class Method Details
.get_server_stats(server) ⇒ Object
73 74 75 76 77 78 |
# File 'app/models/plesk_kit/communicator.rb', line 73 def self.get_server_stats server packet = server.pack_this shell response = transportation_for(packet,server) server.analyse_this response[0] #response[0] end |
.get_service_plan(service_plan, server) ⇒ Object
55 56 57 58 59 |
# File 'app/models/plesk_kit/communicator.rb', line 55 def self.get_service_plan service_plan, server packet = service_plan.build_xml_for_get shell response = transportation_for packet, server service_plan.analyse response[0], server end |
.get_subscription_guid(subscription) ⇒ Object
41 42 43 44 45 46 |
# File 'app/models/plesk_kit/communicator.rb', line 41 def self.get_subscription_guid subscription packet = subscription.id_pack shell, subscription.name server = subscription.customer_account.server response = transportation_for(packet,server) subscription.analyse response[0] end |
.get_subscription_id(subscription) ⇒ Object
48 49 50 51 52 53 |
# File 'app/models/plesk_kit/communicator.rb', line 48 def self.get_subscription_id subscription packet = subscription.id_pack shell, subscription.name server = subscription.customer_account.server response = transportation_for(packet,server) subscription.analyse_for_id response[0] end |
.pack_and_play_with_customer_or_reseller(account) ⇒ Object
13 14 15 16 17 18 |
# File 'app/models/plesk_kit/communicator.rb', line 13 def self.pack_and_play_with_customer_or_reseller account server = PleskKit::Server.most_suitable_for_new_customer(account.platform) packet = account.pack_this shell response = transportation_for packet,server account.analyse response[0], server.id end |
.pack_and_play_with_subscription(subscription, customer_account) ⇒ Object
20 21 22 23 24 25 |
# File 'app/models/plesk_kit/communicator.rb', line 20 def self.pack_and_play_with_subscription subscription, customer_account server = customer_account.server packet = subscription.pack_this shell, customer_account response = transportation_for packet,server subscription.analyse response[0],customer_account end |
.pack_and_switch_subscription(subscription, new_plan_guid, plesk_sub_id) ⇒ Object
27 28 29 30 31 32 |
# File 'app/models/plesk_kit/communicator.rb', line 27 def self.pack_and_switch_subscription subscription, new_plan_guid, plesk_sub_id server = subscription.customer_account.server packet = subscription.switch_pack shell, new_plan_guid, plesk_sub_id response = transportation_for packet,server subscription.analyse response[0] end |
.push_service_plan(service_plan, server) ⇒ Object
61 62 63 64 65 |
# File 'app/models/plesk_kit/communicator.rb', line 61 def self.push_service_plan service_plan, server packet = service_plan.build_xml_for_add shell response = transportation_for packet, server service_plan.analyse response[0], server end |
.push_windows_service_plan(service_plan, server) ⇒ Object
67 68 69 70 71 |
# File 'app/models/plesk_kit/communicator.rb', line 67 def self.push_windows_service_plan service_plan, server packet = service_plan.build_windows_xml_for_add shell response = transportation_for packet, server service_plan.analyse response[0], server end |
.shell ⇒ Object
The shell for the XML
9 10 11 |
# File 'app/models/plesk_kit/communicator.rb', line 9 def self.shell Builder::XmlMarkup.new end |
.sync_subscription(sub, sub_guid, customer_account) ⇒ Object
34 35 36 37 38 39 |
# File 'app/models/plesk_kit/communicator.rb', line 34 def self.sync_subscription sub, sub_guid, customer_account server = customer_account.server packet = sub.sync_pack shell,sub_guid response = transportation_for packet,server sub.analyse response[0] end |