class Kennel::Models::SyntheticTest

Constants

DEFAULTS
LOCATIONS
READONLY_ATTRIBUTES
TRACKING_FIELD

Public Class Methods

api_resource() click to toggle source
# File lib/kennel/models/synthetic_test.rb, line 40
def self.api_resource
  "synthetics/tests"
end
normalize(expected, actual) click to toggle source
Calls superclass method Kennel::Models::Record::normalize
# File lib/kennel/models/synthetic_test.rb, line 52
def self.normalize(expected, actual)
  super

  # tags come in a semi-random order and order is never updated
  expected[:tags]&.sort!
  actual[:tags].sort!

  ignore_default(expected, actual, DEFAULTS)
end
parse_url(url) click to toggle source
# File lib/kennel/models/synthetic_test.rb, line 48
def self.parse_url(url)
  url[/\/synthetics\/details\/([a-z\d-]{11,})/, 1] # id format is 1ab-2ab-3ab
end
url(id) click to toggle source
# File lib/kennel/models/synthetic_test.rb, line 44
def self.url(id)
  Utils.path_to_url "/synthetics/details/#{id}"
end

Public Instance Methods

as_json() click to toggle source
# File lib/kennel/models/synthetic_test.rb, line 19
def as_json
  return @as_json if @as_json
  locations = locations()
  data = {
    message: message,
    tags: tags,
    config: config,
    type: type,
    subtype: subtype,
    options: options,
    name: name,
    locations: locations == :all ? LOCATIONS : locations
  }

  if v = id
    data[:id] = v
  end

  @as_json = data
end