Sha256: ddcb0270b77d755eba470c4eb7ee5f8d381847ae52fe66d397e0c07a6424120a

Contents?: true

Size: 949 Bytes

Versions: 24

Compression:

Stored size: 949 Bytes

Contents

# encoding: utf-8

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?
        return if self.title =~ /\xF0\x9F\x90\xB6/
        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

24 entries across 24 versions & 1 rubygems

Version Path
doggy-2.0.29 lib/doggy/models/dashboard.rb
doggy-2.0.28 lib/doggy/models/dashboard.rb
doggy-2.0.27 lib/doggy/models/dashboard.rb
doggy-2.0.26 lib/doggy/models/dashboard.rb
doggy-2.0.25 lib/doggy/models/dashboard.rb
doggy-2.0.24 lib/doggy/models/dashboard.rb
doggy-2.0.23 lib/doggy/models/dashboard.rb
doggy-2.0.22 lib/doggy/models/dashboard.rb
doggy-2.0.21 lib/doggy/models/dashboard.rb
doggy-2.0.20 lib/doggy/models/dashboard.rb
doggy-2.0.19 lib/doggy/models/dashboard.rb
doggy-2.0.18 lib/doggy/models/dashboard.rb
doggy-2.0.17 lib/doggy/models/dashboard.rb
doggy-2.0.15 lib/doggy/models/dashboard.rb
doggy-2.0.14 lib/doggy/models/dashboard.rb
doggy-2.0.12 lib/doggy/models/dashboard.rb
doggy-2.0.11 lib/doggy/models/dashboard.rb
doggy-2.0.10 lib/doggy/models/dashboard.rb
doggy-2.0.9 lib/doggy/models/dashboard.rb
doggy-2.0.8 lib/doggy/models/dashboard.rb