Permalink
Browse files

Add Feature to create recurring backups for a box

  • Loading branch information...
1 parent 52dce3e commit 633caa7a6c4b965209f987fd536d2640e1cf9ba1 @suchasurge committed Oct 14, 2011
Showing with 19 additions and 1 deletion.
  1. +4 −0 lib/rjiffy/box.rb
  2. +1 −1 spec/fixtures/backup_from_box.json
  3. +7 −0 spec/fixtures/recurring_box_backup.json
  4. +7 −0 spec/rjiffy/box_spec.rb
View
@@ -28,6 +28,10 @@ def backups
Backup.new(Request.get_data("/backups/#{id}"))
end
+ def create_recurring_backup(date_time_id = {})
+ Backup.new(Request.post_data("/backups/#{id}", date_time_id))
+ end
+
def thaw(planid)
merge!(Request.put_data("/jiffyBoxes/#{id}", "status=THAW&planid=#{planid}"))
end
@@ -14,6 +14,6 @@
"created": 1234567890
},
"day": 1,
- "time": 1
+ "time": 2
}
}
@@ -0,0 +1,7 @@
+{
+ "messages": [],
+ "result": {
+ "dayid": 1,
+ "timeid": 2
+ }
+}
View
@@ -70,5 +70,12 @@
box.plan.id.should == 2
end
+ it "creates a recurring backup", :create_box_backup => true do
+ FakeWeb.register_uri(:post, Rjiffy::Configuration.base_uri["/backups/#{@id}"].to_s, :body => fixture_file("recurring_box_backup.json"), :content_type => "application/json")
+ backup = @box.create_recurring_backup({"dayid" => 1, "timeid" => 2})
+ backup.class.should == Rjiffy::Backup
+ backup.dayid.should == 1
+ backup.timeid.should == 2
+ end
end

0 comments on commit 633caa7

Please sign in to comment.