Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add ability for creating a box

  • Loading branch information...
commit cc6e529e3830b185ee6917a8706af504dae3d79c 1 parent 5c29f2e
Frank Müller authored
6 lib/rjiffy/box.rb
@@ -12,6 +12,12 @@ def find(id)
12 12 result = Result.new(response)
13 13 new(result.data)
14 14 end
  15 +
  16 + def create(params = {})
  17 + response = Configuration.base_uri["/jiffyBoxes"].post_form(params).deserialize
  18 + result = Result.new(response)
  19 + new(result.data)
  20 + end
15 21 end
16 22
17 23 def delete
26 spec/fixtures/created_box.json
... ... @@ -0,0 +1,26 @@
  1 +{
  2 + "messages": [],
  3 + "result": {
  4 + "id": 12345,
  5 + "name": "Test",
  6 + "ips": {
  7 + "public": ["188.93.14.211"],
  8 + "private": ["10.93.14.211"]
  9 + },
  10 + "status": "CREATING",
  11 + "created": 1234567890,
  12 + "recoverymodeActive": false,
  13 + "manualBackupRunning": false,
  14 + "isBeingCopied": false,
  15 + "running": false,
  16 + "host": "vmhost-testsys-2-2-9-2",
  17 + "plan": {
  18 + "id":1 ,
  19 + "name": "CloudLevel 2",
  20 + "diskSizeInMB": 40960,
  21 + "ramInMB": 1024,
  22 + "pricePerHour": 0.04,
  23 + "pricePerHourFrozen": 0.01
  24 + }
  25 + }
  26 +}
7 spec/rjiffy/box_spec.rb
@@ -34,4 +34,11 @@
34 34 backups.day.should == 1
35 35 end
36 36
  37 + it "creates a new jiffybox", :create_jiffybox => true do
  38 + FakeWeb.register_uri(:post, Rjiffy::Configuration.base_uri["/jiffyBoxes"].to_s, :body => fixture_file("created_box.json"), :content_type => "application/json")
  39 + params = {:name => "Test", :planid => "1", :distribution => "centos_5_6_32bit"}
  40 + box = Rjiffy::Box.create(params)
  41 + box.status.should == "CREATING"
  42 + end
  43 +
37 44 end

0 comments on commit cc6e529

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