Sha256: c1f7370bcaf7bc360fb8a501a8892dbb35628121c80680038c93e672b6d9c779
Contents?: true
Size: 552 Bytes
Versions: 5
Compression:
Stored size: 552 Bytes
Contents
require 'yaml' require 'active_resource' class ServiceLocator API_KEY = "Some API KEY" 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 = "Some User" self.password = "Some Password" self.timeout = 30 end end
Version data entries
5 entries across 5 versions & 1 rubygems