Class: GemStream::Follower
- Inherits:
-
Object
- Object
- GemStream::Follower
- Defined in:
- lib/gem_stream/follower.rb
Constant Summary collapse
- RUBYGEMS_ENDPOINT =
'https://rubygems.org/api/v1/timeframe_versions.json'.freeze
- MAX_RUBY_GEMS_QUERY_RANGE_IN_SECONDS =
It's actually 7 days, but use 6 to be safe
6 * 86400
Instance Attribute Summary collapse
-
#synced_up_to_time ⇒ Object
readonly
Returns the value of attribute synced_up_to_time.
Class Method Summary collapse
Instance Method Summary collapse
- #follow ⇒ Object
-
#initialize(start_time) ⇒ Follower
constructor
A new instance of Follower.
Constructor Details
#initialize(start_time) ⇒ Follower
Returns a new instance of Follower.
16 17 18 19 20 21 22 |
# File 'lib/gem_stream/follower.rb', line 16 def initialize(start_time) @synced_up_to_time = start_time @on_version = GemStream.configuration.on_version.dup @on_synced = GemStream.configuration.on_synced.dup @api_call_interval = GemStream.configuration.api_call_interval.dup @keep_streaming = true end |
Instance Attribute Details
#synced_up_to_time ⇒ Object (readonly)
Returns the value of attribute synced_up_to_time.
7 8 9 |
# File 'lib/gem_stream/follower.rb', line 7 def synced_up_to_time @synced_up_to_time end |
Class Method Details
.follow_from(start_time) ⇒ Object
12 13 14 |
# File 'lib/gem_stream/follower.rb', line 12 def self.follow_from(start_time) self.new(start_time).tap(&:follow) end |
Instance Method Details
#follow ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/gem_stream/follower.rb', line 24 def follow while keep_streaming? query_rubygems increment_query_window end synced end |