Module: KickboxRails
- Defined in:
- lib/kickbox_rails.rb,
lib/kickbox_rails/version.rb,
lib/generators/kickbox_rails/install_generator.rb
Defined Under Namespace
Modules: Generators
Classes: Configuration
Constant Summary
collapse
- VERSION =
"1.0.0"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
8
9
10
|
# File 'lib/kickbox_rails.rb', line 8
def configuration
@configuration
end
|
.provider ⇒ Object
Returns the value of attribute provider.
8
9
10
|
# File 'lib/kickbox_rails.rb', line 8
def provider
@provider
end
|
Class Method Details
10
11
12
13
14
15
16
|
# File 'lib/kickbox_rails.rb', line 10
def configure
@configuration ||= Configuration.new
yield(configuration)
@provider = KickboxApi.new(url: @configuration.api_url,
end_point: @configuration.api_resource,
token: @configuration.api_key)
end
|
.invalid?(email) ⇒ Boolean
37
38
39
|
# File 'lib/kickbox_rails.rb', line 37
def invalid? email
!valid? email
end
|
.valid?(email) ⇒ Boolean
32
33
34
35
|
# File 'lib/kickbox_rails.rb', line 32
def valid? email
response = validate(email)
response['result'] == 'valid' ? true : false
end
|
.validate(email) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/kickbox_rails.rb', line 18
def validate email
begin
response = @provider.verify(email||String.new)
throw Exception unless response['success']
response
rescue Exception => e
basic_email_validation email
end
end
|