Sha256: bd1683c9241004284a9897dccb00d2e9df36780f6b66eff8795fc57e1b67d0b5
Contents?: true
Size: 837 Bytes
Versions: 1
Compression:
Stored size: 837 Bytes
Contents
module Parliament module Builder # OpenSearch response builder using Feedjira to parse the response. # # @since 0.1.0 class OpenSearchResponseBuilder < Parliament::Builder::BaseResponseBuilder OPEN_SEARCH_ELEMENTS = %w(totalResults Query startIndex itemsPerPage).freeze # Builds a Feedjira::Feed response. It adds the extra OpenSearch feed elements, then parses the HTTP Response. def build OPEN_SEARCH_ELEMENTS.each do |element| Feedjira::Feed.add_common_feed_element(element) end # Add custom parser entries for hints Feedjira::Parser::AtomEntry.element(:hints) Feedjira::Parser::AtomEntry.element(:hint) Feedjira::Parser::AtomEntry.element(:Name, as: :hint_type) Feedjira::Feed.parse(@response.body) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
parliament-opensearch-0.3.0 | lib/parliament/builder/open_search_response_builder.rb |