Sha256: 5b6c5b7cc418f5b48bf986027d2cd71a06aa3f626be1c668387ac910a3338ee3

Contents?: true

Size: 997 Bytes

Versions: 15

Compression:

Stored size: 997 Bytes

Contents

# encoding: utf-8

module Doggy
  module Models
    class Screen < Doggy::Model
      attribute :id,          Integer
      attribute :board_title, String

      attribute :board_bgtype, String
      attribute :templated,    Boolean
      attribute :widgets,      Array[Hash]
      attribute :height,       String
      attribute :width,        String

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

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

      def ensure_managed_emoji!
        return unless managed?
        return if self.board_title =~ /\xF0\x9F\x90\xB6/
        self.board_title += " \xF0\x9F\x90\xB6"
      end

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

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
doggy-2.0.20 lib/doggy/models/screen.rb
doggy-2.0.19 lib/doggy/models/screen.rb
doggy-2.0.18 lib/doggy/models/screen.rb
doggy-2.0.17 lib/doggy/models/screen.rb
doggy-2.0.15 lib/doggy/models/screen.rb
doggy-2.0.14 lib/doggy/models/screen.rb
doggy-2.0.12 lib/doggy/models/screen.rb
doggy-2.0.11 lib/doggy/models/screen.rb
doggy-2.0.10 lib/doggy/models/screen.rb
doggy-2.0.9 lib/doggy/models/screen.rb
doggy-2.0.8 lib/doggy/models/screen.rb
doggy-2.0.7 lib/doggy/models/screen.rb
doggy-2.0.6 lib/doggy/models/screen.rb
doggy-2.0.5 lib/doggy/models/screen.rb
doggy-2.0.4 lib/doggy/models/screen.rb