require 'valnzbn/lookup' class Valnzbn def initialize(number) @number = number.to_s.gsub(/\W/, '') end def exists?(options = {}) response = Valnzbn::Lookup.validate(@number, options) if !response.nil? && !response[:entityStatusCode].nil? && !%w(62 80).include?(response[:entityStatusCode]) options[:detail] == true ? response : true elsif !response.nil? && (%w(62 80).include?(response[:entityStatusCode]) || !response[:entityStatusCode].nil? || {}.empty?) options[:detail] == true ? response : false else nil end end end