Class: OpenKVK::API
- Inherits:
-
Object
- Object
- OpenKVK::API
- Defined in:
- lib/openkvk/api.rb
Class Method Summary collapse
Class Method Details
.query(query) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/openkvk/api.rb', line 20 def query(query) begin result = JSON.parse(get(query)).first["RESULT"] result["ROWS"].map { |row| Hashie::Mash.new(Hash[*result["HEADER"].zip(row).flatten]) } rescue Exception => e raise_exception end end |
.search(keywords) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/openkvk/api.rb', line 12 def search(keywords) begin JSON.parse(get(keywords, "sphinx")).first["RESULT"] rescue Exception => e raise_exception end end |