Module: ThreeScale::Backend::Transactor::LimitHeaders

Defined in:
lib/3scale/backend/transactor/limit_headers.rb

Class Method Summary collapse

Class Method Details

.get(reports, now = Time.now.utc) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/3scale/backend/transactor/limit_headers.rb', line 12

def get(reports, now = Time.now.utc)
  report = most_constrained_report reports
  if report && report.remaining_same_calls != -1
    {
      remaining: report.remaining_same_calls,
      reset: report.remaining_time(now),
      'max-value': report.max_value
    }
  else
    UNCONSTRAINED
  end
end