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.5.6'
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
-
.solr_escape(str) ⇒ Object
Wrapper around escape method for different versions of RSolr.
- .version ⇒ Object
Class Method Details
.client ⇒ Object
27 28 29 |
# File 'lib/uri_service.rb', line 27 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… }
19 20 21 22 23 24 25 |
# File 'lib/uri_service.rb', line 19 def self.init(opts) if @client && @client.connected? @client.disconnect! end @client = UriService::Client.new(opts) end |
.required_tables ⇒ Object
35 36 37 |
# File 'lib/uri_service.rb', line 35 def self.required_tables return [UriService::VOCABULARIES, UriService::TERMS] end |
.solr_escape(str) ⇒ Object
Wrapper around escape method for different versions of RSolr
40 41 42 43 44 45 46 |
# File 'lib/uri_service.rb', line 40 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
31 32 33 |
# File 'lib/uri_service.rb', line 31 def self.version return UriService::VERSION end |