Sha256: 63c482b8fc5933dec4f18c873ca6dde5589fe6796c707105fb08f929619d88f5

Contents?: true

Size: 895 Bytes

Versions: 3

Compression:

Stored size: 895 Bytes

Contents

# frozen_string_literal: true

module Telnyx
  class Verification < APIResource
    # Type for verification responses
    class Response < TelnyxObject; end

    extend APIOperations::Create
    extend APIOperations::NestedResource

    nested_resource_class_methods "by_telephone",
                                  path: "by_tn",
                                  operations: [:retrieve],
                                  instance_methods: {
                                    retrieve: "by_telephone",
                                  }

    def self.submit_code(phone_number: nil, code: nil)
      url = "#{resource_url}/by_phone_number/#{CGI.escape phone_number}/actions/verify"
      resp, _opts = request(:post, url, code: code)
      Response.construct_from resp.data[:data]
    end

    OBJECT_NAME = "verify_verification".freeze
    RESOURCE_PATH = "verifications".freeze
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
telnyx-2.6.0 lib/telnyx/verification.rb
telnyx-2.5.0 lib/telnyx/verification.rb
telnyx-2.4.0 lib/telnyx/verification.rb