Class: VerifyKit::Client

Inherits:
VerifyKit::Core::Service show all
Defined in:
lib/verify_kit/client.rb

Constant Summary collapse

BASE_URL =
'https://web-rest.verifykit.com'
SERVER_KEY_HEADER =
'X-Vfk-Server-Key'

Instance Method Summary collapse

Instance Method Details

#connectionObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/verify_kit/client.rb', line 14

def connection
  @connection ||= Faraday.new(connection_url) do |conn|
    conn.headers[SERVER_KEY_HEADER] = server_key
    conn.request :json
    conn.response :json, content_type: 'application/json'
    conn.adapter adapter

    if VerifyKit.config.debug.enabled
      conn.response :logger, VerifyKit.config.logger, body: true,
                                                      bodies: { request: true, response: true }
    end
  end
end

#smsObject



28
29
30
# File 'lib/verify_kit/client.rb', line 28

def sms
  VerifyKit::Resources::SMS.new(self)
end

#whatsappObject



32
33
34
# File 'lib/verify_kit/client.rb', line 32

def whatsapp
  VerifyKit::Resources::WhatsApp.new(self)
end