Permalink
Browse files

Add deactivate

  • Loading branch information...
1 parent fd1602c commit 28e6535eb5a4a33b214192bd3175f90c0df42451 @simonwistow simonwistow committed Feb 2, 2012
Showing with 10 additions and 6 deletions.
  1. +6 −6 lib/fastly/version.rb
  2. +4 −0 test/common.rb
View
12 lib/fastly/version.rb
@@ -79,12 +79,12 @@ def activate!
return !hash.nil?
end
- # XXX Not currently
- # def deactivate!
- # raise Fastly::FullAuthRequired unless fetcher.fully_authed?
- # hash = fetcher.client.put(Fastly::Version.put_path(self)+"/deactivate")
- # return !hash.nil?
- # end
+ # Deactivate this version
+ def deactivate!
+ raise Fastly::FullAuthRequired unless fetcher.fully_authed?
+ hash = fetcher.client.put(Fastly::Version.put_path(self)+"/deactivate")
+ return !hash.nil?
+ end
# Clone this Version
def clone
View
4 test/common.rb
@@ -111,6 +111,10 @@ def test_creating_service_and_backend
# assert_equal origin.version.number.to_s, number.to_s
assert version3.activate!
+ assert version3.deactivate!
+ assert !@fastly.get_service(version3.service_id).version.active
+ assert version3.activate!
+ assert @fastly.get_service(version3.service_id).version.active
generated = version3.generated_vcl
assert generated

0 comments on commit 28e6535

Please sign in to comment.