Sha256: 04d58e876a143c783d4c3c6837d8fd78c6ac8f189cd5b1baa9ea13e703d87cd6

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

module Adminix
  module Entities
    class Variable
      attr_reader :key, :value

      def self.all(service)
        return [] unless Adminix.config.credentials_defined?

        success, result = Helpers::NetHTTP.get("services/#{service.id}/options")
        return [] unless success

        variables = result.map do |o|
          Variable.new(
            key: o['key'],
            value: o['value']
          )
        end

        variables
      end

      def initialize(opts = {})
        @key = opts[:key]
        @value = opts[:value]
      end

      def to_bash_export
        "export #{key}=\"#{value}\""
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adminix-0.2 lib/adminix/entities/variable.rb