Sha256: e881be6f600f41d1bbf5b20d0d22a158544a927a92d43381cd1575d00e613dbe

Contents?: true

Size: 697 Bytes

Versions: 13

Compression:

Stored size: 697 Bytes

Contents

require 'scalingo_backups_manager/configuration'

module ScalingoBackupsManager
  class Application

    class << self
      def client
        Configuration.client
      end

      def all
        client.apps.all&.data || []
      end

      def find(id)
        app = client.apps.find(id)&.data
        self.new(app)
      end

    end

    attr_accessor :application

    def initialize(app)
      @application = app
    end

    [:id, :name].each do |attr_name|
      define_method attr_name do
        application[attr_name]
      end
    end

    def client
      self.class.client
    end

    def addons
      self.class.client.addons.for(application[:id])&.data || []
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
scalingo_backups_manager-0.9.2 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.9.0 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.8.0 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.7.0 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.6.5 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.6.4 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.6.3 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.6.2 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.6.1 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.6.0 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.5.0 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.4.0 lib/scalingo_backups_manager/application.rb
scalingo_backups_manager-0.3.0 lib/scalingo_backups_manager/application.rb