Sha256: 3ff9c6005f57076a71b1ef4982a96706c19ea5d4e07c4804f5e59501c61591eb

Contents?: true

Size: 879 Bytes

Versions: 1

Compression:

Stored size: 879 Bytes

Contents

module Doggy
  module Models
    class Dashboard < Doggy::Model
      self.root = 'dash'

      attribute :id,          Integer
      attribute :title,       String
      attribute :description, String

      attribute :graphs,             Array[Hash]
      attribute :template_variables, Array[Hash]

      def self.resource_url(id = nil)
        "https://app.datadoghq.com/api/v1/dash".tap do |base_url|
          base_url << "/#{ id }" if id
        end
      end

      def managed?
        !(title =~ Doggy::DOG_SKIP_REGEX)
      end

      def ensure_managed_emoji!
        return unless managed?
        self.title += " \xF0\x9F\x90\xB6"
      end

      def human_url
        "https://app.datadoghq.com/dash/#{ id }"
      end

      # Dashboards don't have a direct edit URL
      alias_method :human_edit_url, :human_url
    end # Dashboard
  end # Models
end # Doggy

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
doggy-2.0.0 lib/doggy/models/dashboard.rb