Class: Lockstep::Status

Inherits:
Object
  • Object
show all
Defined in:
app/models/lockstep/status.rb

Class Method Summary collapse

Class Method Details

.ping(query_params = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'app/models/lockstep/status.rb', line 4

def self.ping(query_params = {})
  resp = Lockstep::ApiRecord.resource.get('', params: query_params)
  raise Lockstep::Exceptions::BadRequestError, 'Endpoint not found' if resp.code == '404'

  status = JSON.parse(resp.body)
  raise Lockstep::Exceptions::UnauthorizedError, status['errorMessage'] unless status['loggedIn']

  status.deep_transform_keys!(&:underscore).deep_symbolize_keys!
end