class EveBadger::Response
Public Class Methods
new(content)
click to toggle source
# File lib/eve_badger/response.rb, line 7 def initialize(content) @content = content end
Public Instance Methods
api_errors()
click to toggle source
fetch any <error> tag in the document, helpful for api error checking
# File lib/eve_badger/response.rb, line 32 def api_errors document = Nokogiri::XML(@content) document.xpath('//error') end
as_json()
click to toggle source
returns the response content as ruby hash representing badgerfish notation JSON
# File lib/eve_badger/response.rb, line 12 def as_json Badgerfish::Parser.new.load(@content) end
as_xml()
click to toggle source
returns the response content as raw XML which you can feed into your favorite parser
# File lib/eve_badger/response.rb, line 17 def as_xml @content end
result_as_json()
click to toggle source
same as as_json
, but only returns the content of the <result> tag
# File lib/eve_badger/response.rb, line 27 def result_as_json Badgerfish::Parser.new.load(@content)['eveapi']['result'] end
result_as_xml()
click to toggle source
same as as_xml
, but only returns the content of the <result> tag
# File lib/eve_badger/response.rb, line 22 def result_as_xml Nokogiri::XML(@content).xpath("//result/*").to_s end