Class: Harvest::HardyClient

Inherits:
Delegator
  • Object
show all
Defined in:
lib/harvest/hardy_client.rb

Defined Under Namespace

Classes: HardyCollection

Instance Method Summary (collapse)

Constructor Details

- (HardyClient) initialize(client, max_retries)

Returns a new instance of HardyClient



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/harvest/hardy_client.rb', line 3

def initialize(client, max_retries)
  super(client)
  @_sd_obj = @client = client
  @max_retries = max_retries
  (@client.public_methods - Object.public_instance_methods).each do |name|
    instance_eval <<-END
      def #{name}(*args)
        wrap_collection do
          @client.send('#{name}', *args)
        end
      end
    END
  end
end

Instance Method Details

- (Object) __getobj__



18
# File 'lib/harvest/hardy_client.rb', line 18

def __getobj__; @_sd_obj; end

- (Object) __setobj__(obj)



19
# File 'lib/harvest/hardy_client.rb', line 19

def __setobj__(obj); @_sd_obj = obj; end

- (Object) wrap_collection



21
22
23
24
# File 'lib/harvest/hardy_client.rb', line 21

def wrap_collection
  collection = yield
  HardyCollection.new(collection, self, @max_retries)
end