Initial working version of the BurstNet test API.

This commit is contained in:
dlage committed 2013-06-02 16:06:53 +01:00
commit 74d5b88ecd
34 files changed
+611

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
module BurstNet
class Backup < BurstNet::Model
end
end
+4
View File
@@ -0,0 +1,4 @@
module BurstNet
class CP < BurstNet::Model
end
end
+24
View File
@@ -0,0 +1,24 @@
module BurstNet
class Product < BurstNet::Model
attr_accessor :id
def initialize(params)
self.id = params['id']
end
def self.all
orders = self.burstnet.get_orders
orders_objs = []
orders['order'].each do |order|
orders_objs << self.new(order)
end
orders_objs
end
# Find a particular product, based on its name
def self.find(id)
order = self.burstnet.get_order(id)
self.new(order['order'])
end
end
end
+4
View File
@@ -0,0 +1,4 @@
module BurstNet
class OS < BurstNet::Model
end
end
+27
View File
@@ -0,0 +1,27 @@
module BurstNet
class Product < BurstNet::Model
attr_accessor :id, :name, :description, :config
def initialize(params)
self.id = params['id']
self.name = params['name']
self.description = params['description']
self.config = params['config'] unless params['config'].nil?
end
def self.all
products = self.burstnet.get_products
products_objs = []
products['product'].each do |prod|
products_objs << self.new(prod)
end
products_objs
end
# Find a particular product, based on its name
def self.find(id)
product = self.burstnet.get_product(id)
self.new(product['product'])
end
end
end
+34
View File
@@ -0,0 +1,34 @@
module BurstNet
class Service < BurstNet::Model
attr_accessor :id, :name, :hostname, :order_id, :status, :product_id, :dedicatedip, :assignedips, :username, :password
def initialize(params)
self.id = params['id']
self.name = params['name']
self.hostname = params['hostname']
self.order_id = params['order']
self.status = params['status']
self.product_id = params['pid ']
self.dedicatedip = params['dedicatedip']
self.assignedips = params['assignedips']
self.username = params['username']
self.password = params['password']
end
def self.all
services = self.burstnet.get_services
services_objs = []
yield services_objs unless services.kind_of?(Array)
services.each do |serv|
services_objs << self.new(serv)
end
services_objs
end
# Find a particular service, based on its name
def self.find(id)
service = self.burstnet.get_service(id)
self.new(service)
end
end
end
+4
View File
@@ -0,0 +1,4 @@
module BurstNet
class Site < BurstNet::Model
end
end