Sha256: d951070c65e85ca4adbdfcffb5e8d849641c25b1e0cb13b89019d8f0aef39578

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

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

module Ecircle
  class << self

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

    #@private
    def client
      @client ||= Client.new
    end

    #@private
    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

1 entries across 1 versions & 1 rubygems

Version Path
ecircle-0.0.7 lib/ecircle.rb