Class: TokenHawk::RecentQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/token_hawk/recent_query.rb

Instance Method Summary collapse

Constructor Details

#initialize(domain: nil, limit: 50) ⇒ RecentQuery

Returns a new instance of RecentQuery.



5
6
7
8
# File 'lib/token_hawk/recent_query.rb', line 5

def initialize(domain: nil, limit: 50)
  @domain = domain
  @limit  = limit
end

Instance Method Details

#calls ⇒ Object



10
11
12
13
14
# File 'lib/token_hawk/recent_query.rb', line 10

def calls
  scope = CallRecord.order(created_at: :desc).limit(@limit)
  scope = scope.for_domain(@domain) if @domain
  scope
end