Class: SmsRu::CallCheck

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

Overview

Authorizes a user by an incoming call from their own number: SMS.ru hands you a number, the user calls it, SMS.ru drops the call (free for the caller) and marks the check confirmed. Reached via SmsRu#callcheck.

check = client.callcheck.add("79991234567")
# show check.call_phone_pretty to the user, then poll until confirmed:
client.callcheck.status(check.check_id).confirmed?

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ CallCheck

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 CallCheck.

Parameters:

  • request (Method)

    the client’s bound ‘request` method



14
15
16
# File 'lib/sms_ru/call_check.rb', line 14

def initialize(request)
  @request = request
end

Instance Method Details

#add(phone) ⇒ SmsRu::CallCheckResult

Starts a check and returns the number the user must call to authorize.

Parameters:

  • phone (String, Integer)

    the user’s phone number to authorize

Returns:

Raises:



23
# File 'lib/sms_ru/call_check.rb', line 23

def add(phone) = CallCheckResult.build(@request.call("/callcheck/add", phone: phone.to_s))

#status(check_id) ⇒ SmsRu::CallCheckStatus

Polls whether the user has placed the authorizing call yet.

Parameters:

  • check_id (String, Integer)

    the id returned by #add

Returns:

Raises:



30
# File 'lib/sms_ru/call_check.rb', line 30

def status(check_id) = CallCheckStatus.build(@request.call("/callcheck/status", check_id: check_id.to_s))