lib/fastly/settings.rb in fastly-1.00 vs lib/fastly/settings.rb in fastly-1.01
- old
+ new
@@ -17,11 +17,10 @@
##
# :attr: service
#
# Return a hash containing key/value pairs of settings
#
-
# :nodoc:
def self.get_path(service, number)
"/service/#{service}/version/#{number}/settings"
end
@@ -36,16 +35,16 @@
nil
end
# :nodoc:
def self.post_path
- raise "You can't POST to an invoice"
+ raise "You can't POST to an setting"
end
# :nodoc:
def self.delete_path
- raise "You can't DELETE to an invoice"
+ raise "You can't DELETE to an setting"
end
# :nodoc:
def delete!
raise "You can't delete an invoice"
@@ -57,10 +56,16 @@
end
end
# Get the Settings object for the specified Version
def get_settings(service, number)
- get(Fastly::Settings, service, number)
+ klass = Fastly::Settings
+ hash = client.get(Fastly::Settings.get_path(service, number))
+
+ return nil if hash.nil?
+ hash["settings"] = Hash[["general.default_host", "general.default_ttl"].collect { |var| [var, hash.delete(var)] }]
+
+ return klass.new(hash, self)
end
# Update the Settings object for the specified Version
def update_settings(opts={})
update(Fastly::Settings, opts)
\ No newline at end of file