Class: SmsRu::Auth

Inherits:
Object
  • Object
show all
Defined in:
lib/sms_ru/auth.rb

Overview

Authentication checks against the account. Reached via SmsRu#auth, e.g. ‘client.auth.ok?`.

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Auth

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Auth.

Parameters:

  • request (Method)

    the client’s bound ‘request` method



9
10
11
# File 'lib/sms_ru/auth.rb', line 9

def initialize(request)
  @request = request
end

Instance Method Details

#ok?Boolean

Returns true when the configured api_id is valid.

Returns:

  • (Boolean)

    true when the configured api_id is valid



14
15
16
17
18
19
# File 'lib/sms_ru/auth.rb', line 14

def ok?
  @request.call("/auth/check")
  true
rescue AuthError
  false
end