lib/fastly/version.rb in fastly-1.4.1 vs lib/fastly/version.rb in fastly-1.4.2

- old
+ new

@@ -48,18 +48,13 @@ # # a free form comment field # Is this Version locked def locked? - @locked.to_i > 0 + true == @locked end - # Set whether this Version is locked - def locked=(is_locked) - @locked = is_locked ? '1' : '0' - end - # Get the Service object this Version belongs to def service fetcher.get(Service, service_id) end @@ -68,11 +63,11 @@ fetcher.get_settings(service_id, number) end # Is version active? def active? - @active.to_i > 0 + true == @active end # Activate this version def activate! hash = fetcher.client.put("#{Version.put_path(self)}/activate") @@ -142,13 +137,21 @@ def delete_vcl(name) hash = fetcher.client.delete("#{Version.put_path(self)}/vcl/#{name}") hash.nil? ? nil : hash end + def dictionaries + fetcher.list_dictionaries(:service_id => service_id, :version => number) + end + # Validate this Version def validate hash = fetcher.client.get("#{Version.put_path(self)}/validate") - !hash.nil? + + valid = ("ok" == hash["status"]) + message = hash['msg'] + + [valid, message] end def self.get_path(service, number) "/service/#{service}/version/#{number}" end