Sha256: 4516ecce7709ec3d0b79c50e3f3844205efe1df84cf05c32e325d5fadf237fce

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

require 'bundler'
require 'active_support/all'
require 'savon'

# TODO Improve requiring of gems.
# `Bundler.require :default` works for an irb session with `require lib/ecircle` (e.g. Savon exists)
# but this won't work from within the rails project since `Bundler.require :default` uses the current rails
# projects Gemfile, not ecircle's one. Not sure if there is a solution for this problem, but I'd
# rather do requires via bundler instead of explicit requires.

dir = File.dirname(__FILE__)

%w!api version configuration helper job_package wrapped_response!.each do |file|
  require File.join(dir, 'ecircle', file)
end

module Ecircle
  class InvalidLoginCredentials < StandardError; end

  class << self

    #@private
    def configuration
      @configuration ||= Configuration.new
    end

    #@private
    def api
      @api ||= Api.new
    end

    #@private
    def configure &block
      block.call configuration
    end
  end

  (Ecircle::Api.instance_methods(false) - [:client]).each do |meth|
    define_singleton_method meth do |*args|
      api.send meth, *args
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ecircle-0.1.7 lib/ecircle.rb
ecircle-0.1.6 lib/ecircle.rb
ecircle-0.1.5 lib/ecircle.rb
ecircle-0.1.4 lib/ecircle.rb
ecircle-0.1.3 lib/ecircle.rb
ecircle-0.1.2 lib/ecircle.rb