Class: Pubsubhubbub::Subscription

Inherits:
ApplicationRecord show all
Defined in:
app/models/pubsubhubbub/subscription.rb

Instance Method Summary collapse

Instance Method Details

#lease_secondsObject


8
9
10
# File 'app/models/pubsubhubbub/subscription.rb', line 8

def lease_seconds
  (expires_at - Time.now.utc).to_i
end

#lease_seconds=(seconds) ⇒ Object


12
13
14
# File 'app/models/pubsubhubbub/subscription.rb', line 12

def lease_seconds=(seconds)
  self.expires_at = Time.now.utc + [[3600 * 24, seconds.to_i].max, 3600 * 24 * 30].min.seconds
end