class Fastly::Service
Represents something you want to serve - this can be, for example, a whole web site, a Wordpress site, or just your image servers
def customer
def customer fetcher.get(Customer, customer_id) end
def details(opts = {})
def details(opts = {}) fetcher.client.get("#{Service.get_path(id)}/details", opts) end
def invoice(year = nil, month = nil)
If a year and month are passed in returns the invoice for that whole month.
Return a Invoice object representing the invoice for this service
def invoice(year = nil, month = nil) opts = { service_id: id } unless year.nil? || month.nil? opts[:year] = year opts[:month] = month end fetcher.get(Invoice, opts) end
def purge_all
Purge all assets from this service.
def purge_all fetcher.client.post("#{Service.get_path(id)}/purge_all") end
def purge_by_key(key, soft=false)
Purge anything with the specific key from the given service.
def purge_by_key(key, soft=false) require_api_key! fetcher.client.post("#{Service.get_path(id)}/purge/#{key}", soft ? { headers: { 'Fastly-Soft-Purge' => "1"} } : {}) end
def stats(type = :all, opts = {})
* daily
* hourly
* minutely
Type can be one of
Get a hash of stats from different data centers.
#
def stats(type = :all, opts = {}) fail Error, "Unknown stats type #{type}" unless [:minutely, :hourly, :daily, :all].include?(type.to_sym) fetcher.client.get("#{Service.get_path(id)}/stats/#{type}", opts) end
def version(number = -1)
def version(number = -1) versions[number] end
def versions
def versions @versions.map { |v| Version.new(v, fetcher) }.sort { |a, b| a.number.to_i <=> b.number.to_i } end