Class: Valabn

Inherits:
Object
  • Object
show all
Defined in:
lib/valabn.rb,
lib/valabn/utils.rb,
lib/valabn/lookup.rb,
lib/valabn/version.rb

Defined Under Namespace

Classes: Lookup, Utils

Constant Summary collapse

VERSION =
"0.1.3"

Instance Method Summary collapse

Constructor Details

#initialize(number) ⇒ Valabn

Instance methods



5
6
7
# File 'lib/valabn.rb', line 5

def initialize(number)
  @number = number.to_s.gsub(/\W/, '')
end

Instance Method Details

#exists?(options = {}) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/valabn.rb', line 9

def exists?(options = {})
  res = Valabn::Lookup.validate(@number, options)

  if res.any? && res[:search_by_ab_nv201408_response][:abr_payload_search_results][:response].keys.include?(:business_entity201408)
    options[:detail] == true ? res : true
  elsif !res.nil?
    options[:detail] == true ? res : false
  else
    nil
  end
end