Class: SurgeAPI::Resources::Verifications

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

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:



58
59
60
# File 'lib/surge_api/resources/verifications.rb', line 58

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:



44
45
46
47
48
49
50
51
52
53
# File 'lib/surge_api/resources/verifications.rb', line 44

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(account_id, phone_number:, request_options: {}) ⇒ SurgeAPI::Models::Verification

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

Parameters:

  • account_id (String)

    The account to associate with the verification.

  • phone_number (String)

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

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

Returns:

See Also:



20
21
22
23
24
25
26
27
28
29
# File 'lib/surge_api/resources/verifications.rb', line 20

def create(, params)
  parsed, options = SurgeAPI::VerificationCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["accounts/%1$s/verifications", ],
    body: parsed,
    model: SurgeAPI::Verification,
    options: options
  )
end