Class: Jumble::REST::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/jumble/rest/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ Connection

Returns a new instance of Connection.



7
8
9
10
# File 'lib/jumble/rest/connection.rb', line 7

def initialize(payload)
  @reset_at = Time.now
  @client   = Twitter::REST::Client.new(payload)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/jumble/rest/connection.rb', line 4

def client
  @client
end

#reset_atObject

Returns the value of attribute reset_at.



5
6
7
# File 'lib/jumble/rest/connection.rb', line 5

def reset_at
  @reset_at
end

Instance Method Details

#<=>(other) ⇒ Object



12
13
14
# File 'lib/jumble/rest/connection.rb', line 12

def <=>(other)
  reset_at <=> other.reset_at
end

#alive?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/jumble/rest/connection.rb', line 16

def alive?
  reset_at < Time.now
end

#reset(reset_at) ⇒ Object



20
21
22
# File 'lib/jumble/rest/connection.rb', line 20

def reset(reset_at)
  self.reset_at = reset_at
end