Class: NLBSG::SearchRequest
- Inherits:
-
RequestBase
- Object
- RequestBase
- NLBSG::SearchRequest
- Defined in:
- lib/nlbsg/request/search.rb
Constant Summary collapse
- REQUIRED_SEARCH_FIELDS =
[ :keywords, :author, :subject, :title ]
- OPTIONAL_SEARCH_FIELDS =
[ :branch_ID, :media_code, :language ]
- ALL_SEARCH_FIELDS =
REQUIRED_SEARCH_FIELDS + OPTIONAL_SEARCH_FIELDS
- MODIFIERS =
[ :sort_schema, :start_record_position, :maximum_records, :set_id ]
Instance Attribute Summary
Attributes inherited from RequestBase
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(string_or_hash) ⇒ SearchRequest
constructor
A new instance of SearchRequest.
Constructor Details
#initialize(string_or_hash) ⇒ SearchRequest
Returns a new instance of SearchRequest.
28 29 30 31 32 33 34 35 36 |
# File 'lib/nlbsg/request/search.rb', line 28 def initialize(string_or_hash) if string_or_hash.is_a?(String) @options = { keywords: string_or_hash } elsif string_or_hash.is_a?(Hash) @options = string_or_hash else raise ArgumentError end end |
Instance Method Details
#build ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/nlbsg/request/search.rb', line 38 def build search_items = prepare_search_items modifiers = prepare_modifiers query = prepare_query(search_items, modifiers) super(query) end |