Class: Valnzbn
- Inherits:
-
Object
- Object
- Valnzbn
- Defined in:
- lib/valnzbn.rb,
lib/valnzbn/utils.rb,
lib/valnzbn/lookup.rb,
lib/valnzbn/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.1.4"
Instance Method Summary collapse
- #exists?(options = {}) ⇒ Boolean
-
#initialize(number) ⇒ Valnzbn
constructor
A new instance of Valnzbn.
Constructor Details
#initialize(number) ⇒ Valnzbn
Returns a new instance of Valnzbn.
4 5 6 |
# File 'lib/valnzbn.rb', line 4 def initialize(number) @number = number.to_s.gsub(/\W/, '') end |
Instance Method Details
#exists?(options = {}) ⇒ Boolean
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/valnzbn.rb', line 8 def exists?( = {}) response = Valnzbn::Lookup.validate(@number, ) if !response.nil? && !response[:entityStatusCode].nil? && !%w(62 80).include?(response[:entityStatusCode]) [:detail] == true ? response : true elsif !response.nil? && (%w(62 80).include?(response[:entityStatusCode]) || !response[:entityStatusCode].nil? || {}.empty?) [:detail] == true ? response : false else nil end end |