examples/search.rb in collectionspace-client-0.14.1 vs examples/search.rb in collectionspace-client-0.15.0
- old
+ new
@@ -1,34 +1,34 @@
# frozen_string_literal: true
-$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
-require 'awesome_print'
-require 'collectionspace/client'
+$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
+require "awesome_print"
+require "collectionspace/client"
config = CollectionSpace::Configuration.new(
- base_uri: 'https://core.dev.collectionspace.org/cspace-services',
- username: 'admin@core.collectionspace.org',
- password: 'Administrator'
+ base_uri: "https://core.dev.collectionspace.org/cspace-services",
+ username: "admin@core.collectionspace.org",
+ password: "Administrator"
)
client = CollectionSpace::Client.new(config)
search_args = {
- path: 'groups',
- namespace: 'groups_common',
- field: 'title',
+ path: "groups",
+ namespace: "groups_common",
+ field: "title",
expression: "ILIKE '%D%'"
}
-puts 'Search: %D'
+puts "Search: %D"
response = client.search(
CollectionSpace::Search.new.from_hash(search_args),
- { sortBy: CollectionSpace::Search::DEFAULT_SORT }
+ {sortBy: CollectionSpace::Search::DEFAULT_SORT}
)
if response.result.success?
- response.parsed['abstract_common_list']['list_item'].map do |i|
- puts i['uri']
+ response.parsed["abstract_common_list"]["list_item"].map do |i|
+ puts i["uri"]
end
end
-puts 'Object and authority term searches have been moved to spec.'
-puts 'See helpers_spec.rb examples describing find'
+puts "Object and authority term searches have been moved to spec."
+puts "See helpers_spec.rb examples describing find"