class Eol::Parser
Attributes
parsed_json[RW]
Public Class Methods
new(json)
click to toggle source
# File lib/eol/parser.rb, line 7 def initialize(json) @parsed_json = JSON.parse(json) rescue JSON::ParserError => e Eol.error "There was an error parsing the response" Eol.error "#{e.class}: #{e.message}" @parsed_json = "" @error_message = "" end
Public Instance Methods
error_message()
click to toggle source
# File lib/eol/parser.rb, line 32 def error_message @error_message ||= begin parsed_json["error"]["message"]["value"] if parsed_json["error"] end end
first_result()
click to toggle source
# File lib/eol/parser.rb, line 38 def first_result results[0] end
metadata()
click to toggle source
# File lib/eol/parser.rb, line 20 def metadata result["__metadata"] if result && result["__metadata"] end
next_page_url()
click to toggle source
# File lib/eol/parser.rb, line 28 def next_page_url result && result["__next"] end
result()
click to toggle source
# File lib/eol/parser.rb, line 24 def result parsed_json["d"] end
results()
click to toggle source
# File lib/eol/parser.rb, line 16 def results result["results"] if result && result["results"] end