Sha256: 494c707f1e38e5de11722f51cba5744a79d648ae7ed0d73d5b7ffa4975514248

Contents?: true

Size: 493 Bytes

Versions: 2

Compression:

Stored size: 493 Bytes

Contents

require 'valabn/lookup'

class Valabn
  # Instance methods
  def initialize(number)
    @number = number.to_s.gsub(/\W/, '')
  end

  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
valabn-0.1.3 lib/valabn.rb
valabn-0.1.2 lib/valabn.rb