Module: Xolo::Server::Helpers::TitleEditor
Overview
constants and methods for accessing the Title Editor server
This is both uses as a ‘helper’ in the Sinatra server, and an included mixin for the Xolo::Server::Title and Xolo::Server::Version classes.
This means methods here are available in instances of those classes, and in all routes, views, and helpers in Sinatra.
NOTE: The names of various attributes of Title Editor SoftwareTitles and Xolo Titles are not always in sync. For example:
- the :display_name of the Xolo Title is the :name of a SoftwareTitle
- the :title of a Xolo Title id the :id of a SoftwareTitle
- the numeric :softwareTitleId of the SoftwareTitle doesn't exist in a Xolo Title
See Windoo::SoftwareTitle::JSON_ATTRIBUTES for more details about them. The Xolo server code will deal with all the translations.
Class Method Summary collapse
-
.included(includer) ⇒ Object
when this module is included.
Instance Method Summary collapse
-
#ted_cnx ⇒ Windoo::Connection
A connection to the Title Editor via Windoo We don’t use the Windoo default connection but use this method to create standalone ones as needed and ensure they are disconnected, (or will timeout) when we are done.
Class Method Details
.included(includer) ⇒ Object
when this module is included
49 50 51 |
# File 'lib/xolo/server/helpers/title_editor.rb', line 49 def self.included(includer) Xolo.verbose_include includer, self end |
Instance Method Details
#ted_cnx ⇒ Windoo::Connection
A connection to the Title Editor via Windoo We don’t use the Windoo default connection but use this method to create standalone ones as needed and ensure they are disconnected, (or will timeout) when we are done.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/xolo/server/helpers/title_editor.rb', line 68 def ted_cnx return @ted_cnx if @ted_cnx @ted_cnx = Windoo::Connection.new( name: "title-editor-cnx-#{Time.now.strftime('%F-%T')}", host: Xolo::Server.config.ted_hostname, user: Xolo::Server.config.ted_api_user, pw: Xolo::Server.config.ted_api_pw, open_timeout: Xolo::Server.config.ted_open_timeout, timeout: Xolo::Server.config.ted_timeout, keep_alive: false ) log_debug "Title Editor: Connected at #{@ted_cnx.base_url}, user '#{Xolo::Server.config.ted_api_user}'. KeepAlive: #{@ted_cnx.keep_alive?}, Expires: #{@ted_cnx.token.expires}. cnxID: #{@ted_cnx.object_id}" @ted_cnx end |