Sha256: 42cdc035f36571f14d2884b1de5259c01f25e63ac288249396734bd6c480cbff

Contents?: true

Size: 1004 Bytes

Versions: 5

Compression:

Stored size: 1004 Bytes

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!version configuration client helper job_package!.each do |file|
  require File.join(dir, 'ecircle', file)
end

module Ecircle
  class << self
    def configuration
      @configuration ||= Configuration.new
    end

    def client
      @client ||= Client.new
    end

    def configure &block
      block.call configuration
    end
  end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ecircle-0.0.6 lib/ecircle.rb
ecircle-0.0.5 lib/ecircle.rb
ecircle-0.0.4 lib/ecircle.rb
ecircle-0.0.3 lib/ecircle.rb
ecircle-0.0.2 lib/ecircle.rb