Class: BeenVerified::Response
- Inherits:
-
Object
- Object
- BeenVerified::Response
- Defined in:
- lib/beenverified/response.rb
Instance Method Summary collapse
-
#initialize(doc) ⇒ Response
constructor
Parses the XML response from BeenVerified.
-
#success? ⇒ Boolean
does the response indicate success?.
- #user ⇒ Object
Constructor Details
#initialize(doc) ⇒ Response
Parses the XML response from BeenVerified
5 6 7 8 9 |
# File 'lib/beenverified/response.rb', line 5 def initialize(doc) doc = REXML::Document.new(doc) unless doc.is_a?(REXML::Document || REXML::Element) @doc = doc raise BeenVerified::BeenVerifiedException, @doc.elements['error'].attributes["error_code"] if !success? end |
Instance Method Details
#success? ⇒ Boolean
does the response indicate success?
12 13 14 |
# File 'lib/beenverified/response.rb', line 12 def success? @doc.elements['error'].nil? end |
#user ⇒ Object
16 17 18 |
# File 'lib/beenverified/response.rb', line 16 def user @user ||= BeenVerified::User.new(@doc) end |