class Jimson::Client

Public Class Methods

batch(client) { |batch_client| ... } click to toggle source
# File lib/jimson/client.rb, line 153
def self.batch(client)
  helper = client.instance_variable_get(:@helper)
  batch_client = BatchClient.new(helper)
  yield batch_client
  helper.send_batch
end
new(url, opts = {}, namespace = nil, client_opts = {}) click to toggle source
# File lib/jimson/client.rb, line 160
def initialize(url, opts = {}, namespace = nil, client_opts = {})
  @url, @opts, @namespace, @client_opts = url, opts, namespace, client_opts
  @helper = ClientHelper.new(url, opts, namespace, client_opts)
end

Public Instance Methods

[](method, *args) click to toggle source
# File lib/jimson/client.rb, line 170
def [](method, *args)
  if method.is_a?(Symbol)
    # namespace requested
    new_ns = @namespace.nil? ? "#{method}." : "#@namespace#{method}."
    return Client.new(@url, @opts, new_ns)
  end
  @helper.process_call(method, args) 
end
method_missing(sym, *args, &block) click to toggle source
# File lib/jimson/client.rb, line 165
def method_missing(sym, *args, &block)
  args = args.first if args.size == 1 && args.first.is_a?(Hash)
  @helper.process_call(sym, args) 
end