class Fastly
def stats(opts)
region:: restrict query to a particular region
by:: the sampling rate used to produce the result set (minute, hour, day)
to:: latest time from which to fetch historical statistics
from:: earliest time from which to fetch historical statistics
Other options available are:
If you pass in an :aggregate flag then fetches historical stats information aggregated across all of your Fastly services. This cannot be combined with :field and :service.
The :field and :service opts can be combined.
If you pass in a :service opt then fetches only the specified service.
If you pass in a :field opt then fetches only the specified field.
Fetches historical stats for each of your fastly services and groups the results by service id.
def stats(opts) if opts[:aggregate] && (opts[:field] || opts[:service]) fail Error, "You can't specify a field or a service for an aggregate request" end url = '/stats' url += '/aggregate' if opts.delete(:aggregate) if service = opts.delete(:service) url += "/service/#{service}" end if field = opts.delete(:field) url += "/field/#{field}" end client.get_stats(url, opts) end