Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add ability for creating a box

  • Loading branch information...
commit cc6e529e3830b185ee6917a8706af504dae3d79c 1 parent 5c29f2e
@suchasurge authored
View
6 lib/rjiffy/box.rb
@@ -12,6 +12,12 @@ def find(id)
result = Result.new(response)
new(result.data)
end
+
+ def create(params = {})
+ response = Configuration.base_uri["/jiffyBoxes"].post_form(params).deserialize
+ result = Result.new(response)
+ new(result.data)
+ end
end
def delete
View
26 spec/fixtures/created_box.json
@@ -0,0 +1,26 @@
+{
+ "messages": [],
+ "result": {
+ "id": 12345,
+ "name": "Test",
+ "ips": {
+ "public": ["188.93.14.211"],
+ "private": ["10.93.14.211"]
+ },
+ "status": "CREATING",
+ "created": 1234567890,
+ "recoverymodeActive": false,
+ "manualBackupRunning": false,
+ "isBeingCopied": false,
+ "running": false,
+ "host": "vmhost-testsys-2-2-9-2",
+ "plan": {
+ "id":1 ,
+ "name": "CloudLevel 2",
+ "diskSizeInMB": 40960,
+ "ramInMB": 1024,
+ "pricePerHour": 0.04,
+ "pricePerHourFrozen": 0.01
+ }
+ }
+}
View
7 spec/rjiffy/box_spec.rb
@@ -34,4 +34,11 @@
backups.day.should == 1
end
+ it "creates a new jiffybox", :create_jiffybox => true do
+ FakeWeb.register_uri(:post, Rjiffy::Configuration.base_uri["/jiffyBoxes"].to_s, :body => fixture_file("created_box.json"), :content_type => "application/json")
+ params = {:name => "Test", :planid => "1", :distribution => "centos_5_6_32bit"}
+ box = Rjiffy::Box.create(params)
+ box.status.should == "CREATING"
+ end
+
end

0 comments on commit cc6e529

Please sign in to comment.
Something went wrong with that request. Please try again.