Class: NeverBounce::API::Request::SingleCheck

Inherits:
Base
  • Object
show all
Defined in:
lib/never_bounce/api/request/single_check.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#api_key, #api_url, #api_version, #headers, #user_agent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#to_curl, #to_httparty

Instance Attribute Details

#address_infoBoolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/never_bounce/api/request/single_check.rb', line 12

def address_info
  @address_info
end

#credits_infoBoolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/never_bounce/api/request/single_check.rb', line 15

def credits_info
  @credits_info
end

#emailString

Returns:

  • (String)


9
10
11
# File 'lib/never_bounce/api/request/single_check.rb', line 9

def email
  @email
end

#historicalBoolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/never_bounce/api/request/single_check.rb', line 21

def historical
  @historical
end

#timeoutInteger

Returns:

  • (Integer)


18
19
20
# File 'lib/never_bounce/api/request/single_check.rb', line 18

def timeout
  @timeout
end

Class Method Details

.http_methodSymbol

Returns:

  • (Symbol)


28
29
30
# File 'lib/never_bounce/api/request/single_check.rb', line 28

def self.http_method
  :get
end

.pathString

Returns:

  • (String)


33
34
35
# File 'lib/never_bounce/api/request/single_check.rb', line 33

def self.path
  "single/check"
end

.response_klassResponse::SingleCheck



38
39
40
# File 'lib/never_bounce/api/request/single_check.rb', line 38

def self.response_klass
  Response::SingleCheck
end

Instance Method Details

#leverage_historicalObject



23
24
25
# File 'lib/never_bounce/api/request/single_check.rb', line 23

def leverage_historical
  defined?(@historical) ? @historical : true
end

#mode_hHash

Return a ready-to-merge mode attributes hash.

Returns:

  • (Hash)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/never_bounce/api/request/single_check.rb', line 44

def mode_h
  @mode_h ||= {}.tap do |_|
    unless (v = address_info).nil?
      _[:address_info] = v
    end

    unless (v = credits_info).nil?
      _[:credits_info] = v
    end

    unless (v = timeout).nil?
      _[:timeout] = v
    end

    unless historical.nil?
      _[:request_meta_data] = {leverage_historical_data: leverage_historical}
    end
  end
end

#to_hHash

Returns:

  • (Hash)


65
66
67
68
69
70
# File 'lib/never_bounce/api/request/single_check.rb', line 65

def to_h
  {
    email: require_attr(:email),
    key: require_attr(:api_key),
  }.merge(mode_h)
end