Method: IMGSrc::API.extract_info

Defined in:
lib/imgsrc.rb

.extract_info(response) ⇒ Object

Raises:

  • (RuntimeError)


72
73
74
75
76
77
# File 'lib/imgsrc.rb', line 72

def extract_info(response)
    info = XML::Parser.string(response).parse.find_first '/info'
    raise RuntimeError, "Invalid xml:\r\n#{response}" unless info
    raise InfoError, "Unsupported protocol version #{info['proto']}" unless info['proto'] == PROTO_VER
    info
end