Sha256: 3006205b9e0abbb3a8da3189b6257b87a16290b173dff81fde9d5d13e647dc9f
Contents?: true
Size: 1.95 KB
Versions: 5
Compression:
Stored size: 1.95 KB
Contents
class TestServer < Sinatra::Base CON_1 = <<-EOF { "class":["concepts"], "rel":["/rels/concepts"], "properties":{ "id": 1, "text":"barack obama", "category":"PERSON" }, "links":[ { "rel":["self"], "href":"#{@@url}/concepts/1" } ] } EOF CON_2 = <<-EOF { "class":["concepts"], "rel":["/rels/concepts"], "properties":{ "id": 2, "text":"tennessee", "category":"LOCATION" }, "links":[ { "rel":["self"], "href":"#{@@url}/concepts/2" } ] } EOF post '/concepts/?' do query = (request.query_string.length > 0 ? '?' : '') + request.query_string <<-EOF { "class":["concepts","collection"], "properties": { "count": 1 }, "entities": [#{CON_1}], "links": [ { "rel": ["self"], "href": "#{@@url}/concepts#{query}" } ] } EOF end delete '/concepts/?' do <<-EOF { "class":["status"], "properties": { "success": true } } EOF end get '/concepts/?' do query = (request.query_string.length > 0 ? '?' : '') + request.query_string # search=obama if request.params['search'] <<-EOF { "class":["concepts","collection"], "properties": { "count": 1 }, "entities": [#{CON_1}], "links": [ { "rel": ["self"], "href": "#{@@url}/concepts#{query}" } ] } EOF else <<-EOF { "class":["concepts","collection"], "properties":{ "count":2 }, "entities":[#{CON_1}, #{CON_2}], "links":[ { "rel":["self"], "href":"#{@@url}/concepts#{query}" } ] } EOF end end end
Version data entries
5 entries across 5 versions & 1 rubygems