Class: Verifalia::Client
- Inherits:
-
Object
- Object
- Verifalia::Client
- Defined in:
- lib/verifalia/client.rb
Overview
HTTPS-based REST client for Verifalia.
Constant Summary collapse
- VERSION =
The version of the Verifalia SDK for Ruby.
'2.1.0'
Instance Attribute Summary collapse
-
#credits ⇒ Object
readonly
Manages credit packs, daily free credits and usage consumption for the Verifalia account.
-
#email_validations ⇒ Object
readonly
Allows to verify email addresses and manage email verification jobs using the Verifalia service.
Instance Method Summary collapse
-
#initialize(authenticator: nil, username: nil, password: nil, ssl_client_cert: nil, ssl_client_key: nil, base_urls: nil, logger: nil) ⇒ Client
constructor
Initializes a new HTTPS-based REST client for Verifalia with the specified options.
Constructor Details
#initialize(authenticator: nil, username: nil, password: nil, ssl_client_cert: nil, ssl_client_key: nil, base_urls: nil, logger: nil) ⇒ Client
Initializes a new HTTPS-based REST client for Verifalia with the specified options.
While authenticating with your Verifalia main account credentials is possible, it is strongly advised to create one or more users (formerly known as sub-accounts) with just the required permissions, for improved security. To create a new user or manage existing ones, please visit ‘verifalia.com/client-area#/users’
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/verifalia/client.rb', line 60 def initialize(authenticator: nil, username: nil, password: nil, ssl_client_cert: nil, ssl_client_key: nil, base_urls: nil, logger: nil) @base_urls = base_urls # Initialize the authenticator this client will use while connecting to the Verifalia API if !authenticator.nil? @authenticator = authenticator elsif !username.nil? @authenticator = Verifalia::Security::UsernamePasswordAuthenticator.new(username, password) elsif !ssl_client_cert.nil? @authenticator = Verifalia::Security::CertificateAuthenticator.new(ssl_client_cert, ssl_client_key) @base_urls ||= Verifalia::Rest::BASE_CCA_URLS else raise ArgumentError, 'Username is nil and no other authentication method was specified: please visit https://verifalia.com/client-area to set up a new user, if you don\'t have one.' end @base_urls ||= Verifalia::Rest::BASE_URLS @rest_client = Verifalia::Rest::Client.new(@authenticator, "verifalia-rest-client/ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}/#{VERSION}", @base_urls) @rest_client.logger = logger # Initialize the underlying resource clients @email_validations = Verifalia::EmailValidations::Client.new(@rest_client) @credits = Verifalia::Credits::Client.new(@rest_client) end |
Instance Attribute Details
#credits ⇒ Object (readonly)
Manages credit packs, daily free credits and usage consumption for the Verifalia account.
45 46 47 |
# File 'lib/verifalia/client.rb', line 45 def credits @credits end |
#email_validations ⇒ Object (readonly)
Allows to verify email addresses and manage email verification jobs using the Verifalia service.
42 43 44 |
# File 'lib/verifalia/client.rb', line 42 def email_validations @email_validations end |