Sha256: c3553966f662ac946682ea103132a125ea488a610a39ad83d1b0e0ba330c15aa

Contents?: true

Size: 868 Bytes

Versions: 2

Compression:

Stored size: 868 Bytes

Contents

# Subdirs are not automatically loaded. Users must explicitly require them.

module G5K
  class Api
    class << self
      # must be a hash of RestClient resources
      attr_accessor :registered_apis
    end
    
    def self.select(api_name, api_version = nil, api_uri = nil)
      if (registered_apis && api = (registered_apis[api_name] || registered_apis[api_name.to_s] || registered_apis[api_name.to_sym]))
        api = api["/#{api_version}"] if api_version
        api = api[api_uri] if api_uri
        api
      else
        raise ArgumentError, "The API #{api_name} is not available."
      end
    end
  end
  
  class Exception < RuntimeError; end
  class ResourceNotFound < Exception; end
  class BadRequest < Exception; end
end

if ![].respond_to?(:group_by) || ![].respond_to?(:index_by)
  require File.dirname(__FILE__)+"/g5k/enumerable_extensions"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cryx-g5k-0.2.10 lib/g5k.rb
cryx-g5k-0.2.11 lib/g5k.rb