Class: Crowdkit::Client

Inherits:
API
  • Object
show all
Defined in:
lib/crowdkit/client.rb

Overview

The top level client, all API access starts here. It’s unlike the other subclasses of API as it overrides the initialize method and sets us up for chaining.

Defined Under Namespace

Classes: Account, Jobs, Judgments, Poll, Statuses, Units, Workers, Worksets

Instance Attribute Summary collapse

Attributes inherited from API

#auto_pagination, #client, #stored_params

Instance Method Summary collapse

Methods inherited from API

#arguments, extract_class_name, #id_key, namespace, #set, #with

Methods included from API::RequestMethods

#agent, #method

Constructor Details

#initialize(overrides, &block) ⇒ Client

Accepts a hash of configuration overrides or a Config object



10
11
12
13
14
# File 'lib/crowdkit/client.rb', line 10

def initialize(overrides, &block)
  @config = overrides.is_a?(Config) ? overrides : Config.new(overrides, &block)
  @client = self
  @stored_params = {}
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/crowdkit/client.rb', line 7

def config
  @config
end

#last_responseObject

Returns the value of attribute last_response.



6
7
8
# File 'lib/crowdkit/client.rb', line 6

def last_response
  @last_response
end

Instance Method Details

#rootObject



16
17
18
# File 'lib/crowdkit/client.rb', line 16

def root
  do_get("")
end