Class: InstagramConnect::ApiBudget

Inherits:
ApplicationRecord show all
Defined in:
app/models/instagram_connect/api_budget.rb

Overview

One rate-limit bucket for one account, for one window.

Instance Method Summary collapse

Instance Method Details

#blocked?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/models/instagram_connect/api_budget.rb', line 14

def blocked?
  blocked_until.present? && blocked_until > Time.current
end

#exhausted?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/instagram_connect/api_budget.rb', line 18

def exhausted?
  used >= limit_value
end

#window_endObject



10
11
12
# File 'app/models/instagram_connect/api_budget.rb', line 10

def window_end
  window_start + window_seconds
end