Sha256: d23806d5b8f8b4e8cfcb24213bd338569ba52f9f6a9a06e7b81f25a3818ad41c

Contents?: true

Size: 543 Bytes

Versions: 2

Compression:

Stored size: 543 Bytes

Contents

require 'yaml'
require 'active_resource'

class ServiceLocator

  API_KEY = "kittens"

  def self.services
    return @services if @services
    config_file = File.join(Rails.root.to_s, %w[config services.yml])
    config = YAML.load_file(config_file)
    @services = config[Rails.env]
  end

  def self.[](name)
    "#{services[name.to_s]}"
  end
end

def Service(name)
  Class.new(ActiveResource::Base) do
    self.site = "#{ServiceLocator[name]}"
    self.user = "amberleaf"
    self.password = "includes1"
    self.timeout = 30
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ccs_core_gem-0.0.7 lib/service_locator.rb
ccs_core_gem-0.0.2 lib/service_locator.rb