Class: Jumble::REST::Client

Inherits:
BasicObject
Defined in:
lib/jumble/rest/client.rb

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object (private)



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/jumble/rest/client.rb', line 24

def method_missing(*args, &block)
  connection.client.send(*args, &block)
rescue ::Twitter::Error::TooManyRequests => e
  connection.reset(e.rate_limit.reset_at)

  if connections.any?(&:alive?)
    @connection = next_connection
    retry
  else
    raise TooManyRequests.new(next_connection.reset_at)
  end
end