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.
- .set_app_component(comp, app_name, app_bundle_id, version) ⇒ void
- .set_ea_component(comp, ea_name, version) ⇒ void
-
.set_patch_component_criteria(ted_patch, app_name: nil, app_bundle_id: nil, ea_name: nil) ⇒ void
Given a Windoo::Patch object, and an app_name: & app_bundle_id: or an ea_name: Set the component criteria for the patch to be based either on the app data, or ea.
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 |
.set_app_component(comp, app_name, app_bundle_id, version) ⇒ void
This method returns an undefined value.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/xolo/server/helpers/title_editor.rb', line 104 def self.set_app_component(comp, app_name, app_bundle_id, version) comp.criteria.add_criterion( name: 'Application Title', operator: 'is', value: app_name ) comp.criteria.add_criterion( name: 'Application Bundle ID', operator: 'is', value: app_bundle_id ) comp.criteria.add_criterion( name: 'Application Version', operator: 'is', value: version ) end |
.set_ea_component(comp, ea_name, version) ⇒ void
This method returns an undefined value.
93 94 95 96 97 98 99 100 |
# File 'lib/xolo/server/helpers/title_editor.rb', line 93 def self.set_ea_component(comp, ea_name, version) comp.criteria.add_criterion( type: 'extensionAttribute', name: ea_name, operator: 'is', value: version ) end |
.set_patch_component_criteria(ted_patch, app_name: nil, app_bundle_id: nil, ea_name: nil) ⇒ void
This method returns an undefined value.
Given a Windoo::Patch object, and an app_name: & app_bundle_id: or an ea_name: Set the component criteria for the patch to be based either on the app data, or ea
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/xolo/server/helpers/title_editor.rb', line 77 def self.set_patch_component_criteria(ted_patch, app_name: nil, app_bundle_id: nil, ea_name: nil) # delete any already there and make a new one ted_patch.delete_component ted_patch.add_component name: ted_patch.container.id, version: ted_patch.version comp = ted_patch.component if ea_name set_ea_component(comp, ea_name, ted_patch.version) else set_app_component(comp, app_name, app_bundle_id, ted_patch.version) end 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.
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/xolo/server/helpers/title_editor.rb', line 139 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 |