Class: SurgeAPI::Resources::Verifications

Inherits:
Object
  • Object
show all
Defined in:
lib/surge_api/resources/verifications.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Verifications

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

Parameters:



55
56
57
# File 'lib/surge_api/resources/verifications.rb', line 55

def initialize(client:)
  @client = client
end

Instance Method Details

#check(id, code:, request_options: {}) ⇒ SurgeAPI::Models::VerificationCheck

Checks the code against a verification.

Parameters:

  • id (String)

    The ID of the verification to check against.

  • code (String)

    The Verification code that was received.

  • request_options (SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



41
42
43
44
45
46
47
48
49
50
# File 'lib/surge_api/resources/verifications.rb', line 41

def check(id, params)
  parsed, options = SurgeAPI::VerificationCheckParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["verifications/%1$s/checks", id],
    body: parsed,
    model: SurgeAPI::VerificationCheck,
    options: options
  )
end

#create(phone_number:, request_options: {}) ⇒ SurgeAPI::Models::Verification

Creates a new Verification and sends the code to the given phone number.

Parameters:

  • phone_number (String)

    The phone number to be verified. In E.164 format.

  • request_options (SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



17
18
19
20
21
22
23
24
25
26
# File 'lib/surge_api/resources/verifications.rb', line 17

def create(params)
  parsed, options = SurgeAPI::VerificationCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "verifications",
    body: parsed,
    model: SurgeAPI::Verification,
    options: options
  )
end