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