Class: OpenSearchEngine
- Inherits:
-
Object
- Object
- OpenSearchEngine
- Includes:
- Restfulie::Client::HTTP::RequestMarshaller
- Defined in:
- lib/opensearch_mediatype.rb
Instance Method Summary collapse
- #get!(content) ⇒ Object
-
#initialize(uri) ⇒ OpenSearchEngine
constructor
A new instance of OpenSearchEngine.
- #post!(terms) ⇒ Object
Constructor Details
#initialize(uri) ⇒ OpenSearchEngine
Returns a new instance of OpenSearchEngine.
3 4 5 |
# File 'lib/opensearch_mediatype.rb', line 3 def initialize(uri) @description = Restfulie.accepts("application/opensearchdescription+xml").at(uri).get! end |
Instance Method Details
#get!(content) ⇒ Object
7 8 9 |
# File 'lib/opensearch_mediatype.rb', line 7 def get!(content) post!(content) end |
#post!(terms) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/opensearch_mediatype.rb', line 11 def post!(terms) urls = @description["OpenSearchDescription"]["Url"] uri = urls["template"].gsub("{searchTerms}", terms).gsub("{startPage?}","1") type = urls["type"] Restfulie.at(uri).accepts(type).get! end |