Class: GdsApi::Rummager
- Inherits:
-
Base
- Object
- Base
- GdsApi::Rummager
show all
- Defined in:
- lib/gds_api/rummager.rb
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
Methods inherited from Base
#client, #create_client, #get_list!, #initialize, #url_for_slug
Constructor Details
This class inherits a constructor from GdsApi::Base
Instance Method Details
#add_document(type, id, document) ⇒ Object
27
28
29
30
31
32
33
34
35
|
# File 'lib/gds_api/rummager.rb', line 27
def add_document(type, id, document)
post_json!(
documents_url,
document.merge(
_type: type,
_id: id,
)
)
end
|
#advanced_search(args) ⇒ Object
17
18
19
20
21
|
# File 'lib/gds_api/rummager.rb', line 17
def advanced_search(args)
raise ArgumentError.new("Args cannot be blank") if args.nil? || args.empty?
request_path = "#{base_url}/advanced_search?#{Rack::Utils.build_nested_query(args)}"
get_json!(request_path)
end
|
#delete_document(type, id) ⇒ Object
37
38
39
40
41
42
|
# File 'lib/gds_api/rummager.rb', line 37
def delete_document(type, id)
delete_json!(
"#{documents_url}/#{id}",
_type: type,
)
end
|
#organisations ⇒ Object
23
24
25
|
# File 'lib/gds_api/rummager.rb', line 23
def organisations
get_json!("#{base_url}/organisations")
end
|
#search(query, extra_params = {}) ⇒ Object
7
8
9
10
|
# File 'lib/gds_api/rummager.rb', line 7
def search(query, ={})
raise ArgumentError.new("Query cannot be blank") if query.nil? || query.strip.empty?
get_json!(search_url(:search, query, ))
end
|
#unified_search(args) ⇒ Object
12
13
14
15
|
# File 'lib/gds_api/rummager.rb', line 12
def unified_search(args)
request_url = "#{base_url}/unified_search.json?#{Rack::Utils.build_nested_query(args)}"
get_json!(request_url)
end
|