Class: RedTape::Validators::DE

Inherits:
RedTape::Validator show all
Defined in:
lib/red_tape/validators/de.rb

Constant Summary collapse

API_BASE =
'https://api.evatr.vies.bzst.de/app/v1'.freeze
QUERY_URL =
"#{API_BASE}/abfrage".freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(own, other, options = {}) ⇒ DE

Returns a new instance of DE.



11
12
13
# File 'lib/red_tape/validators/de.rb', line 11

def initialize(own, other, options = {})
  @own, @other, @options = own, other, options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/red_tape/validators/de.rb', line 7

def options
  @options
end

#otherObject (readonly)

Returns the value of attribute other.



7
8
9
# File 'lib/red_tape/validators/de.rb', line 7

def other
  @other
end

#ownObject (readonly)

Returns the value of attribute own.



7
8
9
# File 'lib/red_tape/validators/de.rb', line 7

def own
  @own
end

#statusObject (readonly)

Returns the value of attribute status.



7
8
9
# File 'lib/red_tape/validators/de.rb', line 7

def status
  @status
end

Class Method Details

.countryObject



9
# File 'lib/red_tape/validators/de.rb', line 9

def self.country; 'DE'; end

Instance Method Details

#resultObject



15
16
17
# File 'lib/red_tape/validators/de.rb', line 15

def result
  @result ||= {}
end

#status_codeObject



19
20
21
# File 'lib/red_tape/validators/de.rb', line 19

def status_code
  result['status']
end

#valid?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
# File 'lib/red_tape/validators/de.rb', line 23

def valid?
  validate
rescue => e
  raise ValidationError.new(e)
end