Sha256: 123f4382159a4d84b25ec4387a7acdbc1d7e7e5232240ee29b3f93e70bf4172d

Contents?: true

Size: 455 Bytes

Versions: 1

Compression:

Stored size: 455 Bytes

Contents

require 'httparty'
require 'helpers/routes'
require 'helpers/uwaterlooapi_query'

class UWaterlooAPI
  VERSION = '0.0.1'
  include Routes

  def initialize(api_key)
    get_base_routes.each do |route|
      self.class.send :define_method, route do
        UWaterlooAPIQuery.new "/#{route}", "/#{route}", api_key
      end
    end
  end

private

  def get_base_routes
    @base_routes ||= @@routes.map { |r| r.split('/')[1] }.uniq.map(&:to_sym)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
uwaterlooapi-0.0.3 lib/uwaterlooapi.rb