Sha256: 0b5992f3c9b3c300f574e3db8163af4968331106d9f3a286e7028668a892a712

Contents?: true

Size: 738 Bytes

Versions: 14

Compression:

Stored size: 738 Bytes

Contents

class AccountDecorator < ApplicationDecorator
  def needs_startup_guide?
    object.apps.count == 0 && object.databases.count == 0
  end

  def cached_permissions
    garner.bind(h.controller.session_token) do
      object.permissions
    end
  end

  # rubocop:disable PredicateName
  def has_scope?(scope)
    cached_permissions.map(&:scope).include? scope
  end
  # rubocop:enable PredicateName

  def syslog_drain_host
    drain = syslog_drain
    drain.drain_host if drain
  end

  def syslog_drain_port
    drain = syslog_drain
    drain.drain_port if drain
  end

  def syslog_drain
    drains = (object.log_drains || []).select do |d|
      d.drain_type == 'syslog_tls_tcp'
    end
    drains.first unless drains.empty?
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
aptible-rails-0.7.3 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.7.2 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.7.1 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.7.0 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.6.13 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.6.12 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.6.11 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.6.10 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.6.9 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.6.8 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.6.7 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.6.6 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.6.5 lib/aptible/rails/decorators/account_decorator.rb
aptible-rails-0.6.4 lib/aptible/rails/decorators/account_decorator.rb