Module: UriService
- Defined in:
- lib/uri_service.rb,
lib/uri_service/version.rb,
lib/uri_service/term_type.rb
Defined Under Namespace
Modules: TermType Classes: CannotChangeTemporaryTermValue, Client, CouldNotGenerateUriError, Error, ExistingUriError, ExistingVocabularyStringKeyError, InvalidAdditionalFieldKeyError, InvalidOptsError, InvalidTemporaryTermUriError, InvalidTermTypeError, InvalidUriError, InvalidVocabularyStringKeyError, NonExistentUriError, NonExistentVocabularyError, Railtie, UnsupportedObjectTypeError, UnsupportedSearchFieldError
Constant Summary collapse
- VOCABULARY =
Constants
:vocabulary- VOCABULARIES =
:vocabularies- TERM =
:term- TERMS =
:terms- VALID_URI_REGEX =
/\A#{URI::regexp}\z/- VERSION =
'0.6.0'
Class Method Summary collapse
- .client ⇒ Object
-
.init(opts) ⇒ Object
Initialize the main instance of UriService::Client opts format: { ‘local_uri_base’ => ‘id.example.com/term/’, temporary_uri_base: ‘temporary:’, ‘solr’ => config…, ‘database’ => config… }.
- .required_tables ⇒ Object
- .root ⇒ Object
-
.solr_escape(str) ⇒ Object
Wrapper around escape method for different versions of RSolr.
- .version ⇒ Object
Class Method Details
.client ⇒ Object
26 27 28 |
# File 'lib/uri_service.rb', line 26 def self.client return @client end |
.init(opts) ⇒ Object
Initialize the main instance of UriService::Client opts format: { ‘local_uri_base’ => ‘id.example.com/term/’, temporary_uri_base: ‘temporary:’, ‘solr’ => config…, ‘database’ => config… }
18 19 20 21 22 23 24 |
# File 'lib/uri_service.rb', line 18 def self.init(opts) if @client && @client.connected? @client.disconnect! end @client = UriService::Client.new(opts) end |
.required_tables ⇒ Object
34 35 36 |
# File 'lib/uri_service.rb', line 34 def self.required_tables return [UriService::VOCABULARIES, UriService::TERMS] end |
.root ⇒ Object
47 48 49 |
# File 'lib/uri_service.rb', line 47 def self.root Pathname.new(File.dirname(__dir__)) end |
.solr_escape(str) ⇒ Object
Wrapper around escape method for different versions of RSolr
39 40 41 42 43 44 45 |
# File 'lib/uri_service.rb', line 39 def self.solr_escape(str) if RSolr.respond_to?(:solr_escape) return RSolr.solr_escape(str) # Newer method else return RSolr.escape(str) # Fall back to older method end end |
.version ⇒ Object
30 31 32 |
# File 'lib/uri_service.rb', line 30 def self.version return UriService::VERSION end |