lib/fastly/version.rb in fastly-0.97 vs lib/fastly/version.rb in fastly-0.98

- old
+ new

@@ -52,11 +52,11 @@ # # a free form comment field # Is this Version locked def locked? - return @locked.to_i > 1 + return @locked.to_i > 0 end # Set whether this Version is locked def locked=(is_locked) @locked = is_locked ? "1" : "0" @@ -70,27 +70,29 @@ # Get the Settings object for this Version def settings fetcher.get_settings(service_id, number) end + # Is version active? + def active? + return @active.to_i > 0 + end + # Activate this version def activate! - raise Fastly::FullAuthRequired unless fetcher.fully_authed? hash = fetcher.client.put(Fastly::Version.put_path(self)+"/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! + hash = fetcher.client.put(Fastly::Version.put_path(self)+"/deactivate") + return !hash.nil? + end # Clone this Version def clone - raise Fastly::FullAuthRequired unless fetcher.fully_authed? hash = fetcher.client.put(Fastly::Version.put_path(self)+"/clone") return nil if hash.nil? return Fastly::Version.new(hash, fetcher) end @@ -98,11 +100,10 @@ # # Won't return the content of the VCL unless you pass in # :include_content => true # in the opts def generated_vcl(opts={}) - raise Fastly::FullAuthRequired unless fetcher.fully_authed? hash = fetcher.client.get(Fastly::Version.put_path(self)+"/generated_vcl", opts) opts = { 'content' => hash['vcl'] || hash['content'], 'name' => hash['md5'], 'version' => hash['version'], @@ -111,11 +112,10 @@ return Fastly::VCL.new(opts, fetcher) end # Upload a VCL file for this Version def upload_vcl(name, content) - raise Fastly::FullAuthRequired unless fetcher.fully_authed? hash = fetcher.client.post(Fastly::Version.put_path(self)+"/vcl", :name => name, :content => content) return nil if hash.nil? return Fastly::VCL.new(hash, fetcher) end @@ -123,16 +123,14 @@ # # Won't return the content of the VCL unless you pass in # :include_content => true # in the opts def vcl(name, opts={}) - raise Fastly::FullAuthRequired unless fetcher.fully_authed? fetcher.get_vcl(service_id, number, name, opts) end # Validate this Version def validate - raise Fastly::FullAuthRequired unless fetcher.fully_authed? hash = fetcher.client.get(Fastly::Version.put_path(self)+"/validate") return !hash.nil? end private \ No newline at end of file