Sha256: 692c885f98d7c29edf525f1610ec0494e8c5da06679b3f519c76af63d1062423

Contents?: true

Size: 826 Bytes

Versions: 3

Compression:

Stored size: 826 Bytes

Contents

require "frenchy/client"
require "frenchy/collection"
require "frenchy/instrumentation"
require "frenchy/model"
require "frenchy/request"
require "frenchy/resource"
require "frenchy/veneer"
require "frenchy/version"

module Frenchy
  class Error < ::StandardError; end
  class NotFound < Error; end
  class ServerError < Error; end
  class InvalidResponse < Error; end
  class InvalidRequest < Error; end
  class ConfigurationError < Error; end

  def self.register_service(name, options={})
    @services ||= {}
    @services[name.to_sym] = Frenchy::Client.new(options)
  end

  def self.find_service(name)
    if @services.nil?
      raise(Frenchy::ConfigurationError, "No services have been configured")
    end

    @services[name.to_sym] || raise(Frenchy::ConfigurationError, "No service '#{name}' registered")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
frenchy-0.0.9 lib/frenchy.rb
frenchy-0.0.8 lib/frenchy.rb
frenchy-0.0.7 lib/frenchy.rb