class Valnzbn

Constants

VERSION

Public Class Methods

new(number) click to toggle source
# File lib/valnzbn.rb, line 4
def initialize(number)
  @number = number.to_s.gsub(/\W/, '')
end

Public Instance Methods

exists?(options = {}) click to toggle source
# File lib/valnzbn.rb, line 8
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