Class: Configuration
- Inherits:
-
Object
- Object
- Configuration
- Defined in:
- lib/apollo_commons_ruby/TemplatesHelper.rb
Instance Attribute Summary collapse
-
#additional_data_file_path ⇒ Object
readonly
Returns the value of attribute additional_data_file_path.
-
#apollo_config_base_url ⇒ Object
readonly
Returns the value of attribute apollo_config_base_url.
-
#base_folder_path ⇒ Object
readonly
Returns the value of attribute base_folder_path.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#collection_id_for_default ⇒ Object
readonly
Returns the value of attribute collection_id_for_default.
-
#collection_id_for_iOS_v2 ⇒ Object
readonly
Returns the value of attribute collection_id_for_iOS_v2.
-
#collection_id_for_iOS_v3 ⇒ Object
readonly
Returns the value of attribute collection_id_for_iOS_v3.
-
#collections_base_folder_path ⇒ Object
readonly
Returns the value of attribute collections_base_folder_path.
-
#common_data_file_path ⇒ Object
readonly
Returns the value of attribute common_data_file_path.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#create_template_url ⇒ Object
readonly
Returns the value of attribute create_template_url.
-
#delete_collection_item_url ⇒ Object
readonly
Returns the value of attribute delete_collection_item_url.
-
#env_data_file_path ⇒ Object
readonly
Returns the value of attribute env_data_file_path.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#get_collection_item_url ⇒ Object
readonly
Returns the value of attribute get_collection_item_url.
-
#get_latest_collection_items_url ⇒ Object
readonly
Returns the value of attribute get_latest_collection_items_url.
-
#get_template_group_details_url ⇒ Object
readonly
Returns the value of attribute get_template_group_details_url.
-
#get_template_url ⇒ Object
readonly
Returns the value of attribute get_template_url.
-
#get_templates_for_view_url ⇒ Object
readonly
Returns the value of attribute get_templates_for_view_url.
-
#post_delete_template_group_url ⇒ Object
readonly
Returns the value of attribute post_delete_template_group_url.
-
#post_delete_template_mappings_url ⇒ Object
readonly
Returns the value of attribute post_delete_template_mappings_url.
-
#post_delete_templates_url ⇒ Object
readonly
Returns the value of attribute post_delete_templates_url.
-
#post_insert_template_group_url ⇒ Object
readonly
Returns the value of attribute post_insert_template_group_url.
-
#post_insert_templates_url ⇒ Object
readonly
Returns the value of attribute post_insert_templates_url.
-
#post_update_template_group_url ⇒ Object
readonly
Returns the value of attribute post_update_template_group_url.
-
#post_update_templates_url ⇒ Object
readonly
Returns the value of attribute post_update_templates_url.
-
#post_upsert_template_mappings_url ⇒ Object
readonly
Returns the value of attribute post_upsert_template_mappings_url.
-
#resources_file_path ⇒ Object
readonly
Returns the value of attribute resources_file_path.
-
#sample_android_uainfo_data_file_path ⇒ Object
readonly
Returns the value of attribute sample_android_uainfo_data_file_path.
-
#sample_ios_uainfo_data_file_path ⇒ Object
readonly
Returns the value of attribute sample_ios_uainfo_data_file_path.
-
#sample_remote_config_data_file_path ⇒ Object
readonly
Returns the value of attribute sample_remote_config_data_file_path.
-
#set_collection_item_url ⇒ Object
readonly
Returns the value of attribute set_collection_item_url.
-
#templated_data_file_path ⇒ Object
readonly
Returns the value of attribute templated_data_file_path.
-
#zebugger_templated_data_file_path ⇒ Object
readonly
Returns the value of attribute zebugger_templated_data_file_path.
Instance Method Summary collapse
- #client_transfomer_file_path_for_template(template_group) ⇒ Object
- #collection_dir_path_for_collection_id(collection_id) ⇒ Object
- #collection_item_file_path_for_collection_id_and_item_id(collection_id, item_id) ⇒ Object
- #data_template_file_path_for_template(template_group, lang, view_type, template_name) ⇒ Object
- #default_content_file_path_for_template(template_group, lang, view_type, template_name) ⇒ Object
- #env_file_path(tenant_id, project_id) ⇒ Object
-
#initialize(environment) ⇒ Configuration
constructor
A new instance of Configuration.
- #language_dir_path_for_template(template_group, language) ⇒ Object
- #language_file_path_for_template(language) ⇒ Object
- #presentation_file_path_for_template(template_group, lang, view_type, template_name) ⇒ Object
- #template_group_details_file_path_for_template(template_group) ⇒ Object
- #template_group_dir_path_for_template(template_group) ⇒ Object
- #template_name_dir_path_for_template(template_group, language, view_type, template_name) ⇒ Object
- #transfomer_file_path_for_template(template_group) ⇒ Object
- #view_type_dir_path_for_template(template_group, language, view_type) ⇒ Object
- #view_type_dir_path_for_template_with_version(template_group, language, view_type, version) ⇒ Object
Constructor Details
#initialize(environment) ⇒ Configuration
Returns a new instance of Configuration.
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 271 def initialize(environment) conf_file = File.read(File.("/var/jenkins_home/template_config/config.json")); conf = JSON.parse conf_file conf = conf[environment.downcase] if (conf["base_url"] == nil or conf["get_template_url"] == nil or conf["create_template_url"] == nil or conf["base_folder_path"] == nil or conf["collections_base_folder_path"] == nil) puts "Required configurations are missing" raise "Required configurations are missing" return nil end @environment = environment @base_url = conf["base_url"] @get_template_url = conf["base_url"] + "/" + conf["get_template_url"] @create_template_url = conf["base_url"] + "/" + conf["create_template_url"] @base_folder_path = conf["base_folder_path"] @collections_base_folder_path = conf["collections_base_folder_path"] @common_data_file_path = conf["common_data_file_path"] @common_data_path = conf["collections_base_folder_path"] @templated_data_file_path = conf["templated_data_file_path"] @zebugger_templated_data_file_path = conf["zebugger_templated_data_file_path"] @additional_data_file_path = conf["additional_data_file_path"] @sample_ios_uainfo_data_file_path = conf["sample_ios_uainfo_data_file_path"] @sample_android_uainfo_data_file_path = conf["sample_android_uainfo_data_file_path"] @sample_remote_config_data_file_path = conf["sample_remote_config_data_file_path"] @env_data_file_path = conf["env_data_file_path"] @get_latest_collection_items_url = conf["base_url"] + "/" + conf["get_latest_collection_items_url"] @set_collection_item_url = conf["base_url"] + "/" + conf["set_collection_item_url"] @get_collection_item_url = conf["base_url"] + "/" + conf["get_collection_item_url"] @delete_collection_item_url = conf["base_url"] + "/" + conf["delete_collection_item_url"] @count = conf["count"] @post_insert_templates_url = conf["base_url"] + "/" + conf["post_insert_templates_url"] @post_insert_template_group_url = conf["base_url"] + "/" + conf["post_insert_template_group_url"] @post_upsert_template_mappings_url = conf["base_url"] + "/" + conf["post_upsert_template_mappings_url"] @get_template_group_details_url = conf["base_url"] + "/" + conf["get_template_group_details_url"] @get_templates_for_view_url = conf["base_url"] + "/" + conf["get_templates_for_view_url"] @post_update_template_group_url = conf["base_url"] + "/" + conf["post_update_template_group_url"] @post_delete_template_group_url = conf["base_url"] + "/" + conf["post_delete_template_group_url"] @post_update_templates_url = conf["base_url"] + "/" + conf["post_update_templates_url"] @post_delete_templates_url = conf["base_url"] + "/" + conf["post_delete_templates_url"] @post_delete_template_mappings_url = conf["base_url"] + "/" + conf["post_delete_template_mappings_url"] @apollo_config_base_url = conf["apollo_config_base_url"] @resources_file_path = conf["resources_file_path"] @collection_id_for_default = conf["collection_id_for_default"] @collection_id_for_iOS_v2 = conf["collection_id_for_iOS_v2"] @collection_id_for_iOS_v3 = conf["collection_id_for_iOS_v3"] end |
Instance Attribute Details
#additional_data_file_path ⇒ Object (readonly)
Returns the value of attribute additional_data_file_path.
244 245 246 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 244 def additional_data_file_path @additional_data_file_path end |
#apollo_config_base_url ⇒ Object (readonly)
Returns the value of attribute apollo_config_base_url.
265 266 267 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 265 def apollo_config_base_url @apollo_config_base_url end |
#base_folder_path ⇒ Object (readonly)
Returns the value of attribute base_folder_path.
239 240 241 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 239 def base_folder_path @base_folder_path end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
236 237 238 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 236 def base_url @base_url end |
#collection_id_for_default ⇒ Object (readonly)
Returns the value of attribute collection_id_for_default.
266 267 268 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 266 def collection_id_for_default @collection_id_for_default end |
#collection_id_for_iOS_v2 ⇒ Object (readonly)
Returns the value of attribute collection_id_for_iOS_v2.
267 268 269 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 267 def collection_id_for_iOS_v2 @collection_id_for_iOS_v2 end |
#collection_id_for_iOS_v3 ⇒ Object (readonly)
Returns the value of attribute collection_id_for_iOS_v3.
268 269 270 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 268 def collection_id_for_iOS_v3 @collection_id_for_iOS_v3 end |
#collections_base_folder_path ⇒ Object (readonly)
Returns the value of attribute collections_base_folder_path.
240 241 242 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 240 def collections_base_folder_path @collections_base_folder_path end |
#common_data_file_path ⇒ Object (readonly)
Returns the value of attribute common_data_file_path.
241 242 243 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 241 def common_data_file_path @common_data_file_path end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
253 254 255 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 253 def count @count end |
#create_template_url ⇒ Object (readonly)
Returns the value of attribute create_template_url.
238 239 240 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 238 def create_template_url @create_template_url end |
#delete_collection_item_url ⇒ Object (readonly)
Returns the value of attribute delete_collection_item_url.
252 253 254 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 252 def delete_collection_item_url @delete_collection_item_url end |
#env_data_file_path ⇒ Object (readonly)
Returns the value of attribute env_data_file_path.
248 249 250 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 248 def env_data_file_path @env_data_file_path end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
235 236 237 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 235 def environment @environment end |
#get_collection_item_url ⇒ Object (readonly)
Returns the value of attribute get_collection_item_url.
251 252 253 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 251 def get_collection_item_url @get_collection_item_url end |
#get_latest_collection_items_url ⇒ Object (readonly)
Returns the value of attribute get_latest_collection_items_url.
249 250 251 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 249 def get_latest_collection_items_url @get_latest_collection_items_url end |
#get_template_group_details_url ⇒ Object (readonly)
Returns the value of attribute get_template_group_details_url.
257 258 259 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 257 def get_template_group_details_url @get_template_group_details_url end |
#get_template_url ⇒ Object (readonly)
Returns the value of attribute get_template_url.
237 238 239 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 237 def get_template_url @get_template_url end |
#get_templates_for_view_url ⇒ Object (readonly)
Returns the value of attribute get_templates_for_view_url.
258 259 260 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 258 def get_templates_for_view_url @get_templates_for_view_url end |
#post_delete_template_group_url ⇒ Object (readonly)
Returns the value of attribute post_delete_template_group_url.
260 261 262 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 260 def post_delete_template_group_url @post_delete_template_group_url end |
#post_delete_template_mappings_url ⇒ Object (readonly)
Returns the value of attribute post_delete_template_mappings_url.
263 264 265 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 263 def post_delete_template_mappings_url @post_delete_template_mappings_url end |
#post_delete_templates_url ⇒ Object (readonly)
Returns the value of attribute post_delete_templates_url.
262 263 264 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 262 def post_delete_templates_url @post_delete_templates_url end |
#post_insert_template_group_url ⇒ Object (readonly)
Returns the value of attribute post_insert_template_group_url.
255 256 257 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 255 def post_insert_template_group_url @post_insert_template_group_url end |
#post_insert_templates_url ⇒ Object (readonly)
Returns the value of attribute post_insert_templates_url.
254 255 256 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 254 def post_insert_templates_url @post_insert_templates_url end |
#post_update_template_group_url ⇒ Object (readonly)
Returns the value of attribute post_update_template_group_url.
259 260 261 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 259 def post_update_template_group_url @post_update_template_group_url end |
#post_update_templates_url ⇒ Object (readonly)
Returns the value of attribute post_update_templates_url.
261 262 263 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 261 def post_update_templates_url @post_update_templates_url end |
#post_upsert_template_mappings_url ⇒ Object (readonly)
Returns the value of attribute post_upsert_template_mappings_url.
256 257 258 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 256 def post_upsert_template_mappings_url @post_upsert_template_mappings_url end |
#resources_file_path ⇒ Object (readonly)
Returns the value of attribute resources_file_path.
264 265 266 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 264 def resources_file_path @resources_file_path end |
#sample_android_uainfo_data_file_path ⇒ Object (readonly)
Returns the value of attribute sample_android_uainfo_data_file_path.
246 247 248 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 246 def sample_android_uainfo_data_file_path @sample_android_uainfo_data_file_path end |
#sample_ios_uainfo_data_file_path ⇒ Object (readonly)
Returns the value of attribute sample_ios_uainfo_data_file_path.
245 246 247 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 245 def sample_ios_uainfo_data_file_path @sample_ios_uainfo_data_file_path end |
#sample_remote_config_data_file_path ⇒ Object (readonly)
Returns the value of attribute sample_remote_config_data_file_path.
247 248 249 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 247 def sample_remote_config_data_file_path @sample_remote_config_data_file_path end |
#set_collection_item_url ⇒ Object (readonly)
Returns the value of attribute set_collection_item_url.
250 251 252 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 250 def set_collection_item_url @set_collection_item_url end |
#templated_data_file_path ⇒ Object (readonly)
Returns the value of attribute templated_data_file_path.
242 243 244 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 242 def templated_data_file_path @templated_data_file_path end |
#zebugger_templated_data_file_path ⇒ Object (readonly)
Returns the value of attribute zebugger_templated_data_file_path.
243 244 245 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 243 def zebugger_templated_data_file_path @zebugger_templated_data_file_path end |
Instance Method Details
#client_transfomer_file_path_for_template(template_group) ⇒ Object
349 350 351 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 349 def client_transfomer_file_path_for_template(template_group) "#{@base_folder_path}/#{template_group}/clientTransformer.js" end |
#collection_dir_path_for_collection_id(collection_id) ⇒ Object
361 362 363 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 361 def collection_dir_path_for_collection_id(collection_id) "#{@collections_base_folder_path}/#{collection_id}/#{ENV['environment']}" end |
#collection_item_file_path_for_collection_id_and_item_id(collection_id, item_id) ⇒ Object
365 366 367 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 365 def collection_item_file_path_for_collection_id_and_item_id(collection_id, item_id) "#{@collections_base_folder_path}/#{collection_id}/#{ENV['environment']}/#{item_id}.json" end |
#data_template_file_path_for_template(template_group, lang, view_type, template_name) ⇒ Object
317 318 319 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 317 def data_template_file_path_for_template(template_group, lang, view_type, template_name) "#{@base_folder_path}/#{template_group}/#{lang}/#{view_type}/#{template_name}/dataTemplate.json" end |
#default_content_file_path_for_template(template_group, lang, view_type, template_name) ⇒ Object
325 326 327 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 325 def default_content_file_path_for_template(template_group, lang, view_type, template_name) "#{@base_folder_path}/#{template_group}/#{lang}/#{view_type}/#{template_name}/defaultContent.json" end |
#env_file_path(tenant_id, project_id) ⇒ Object
373 374 375 376 377 378 379 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 373 def env_file_path(tenant_id, project_id) if file_exists?("./environments/#{@environment}/env_#{tenant_id}_#{project_id}.json") "./environments/#{@environment}/env_#{tenant_id}_#{project_id}.json" else "#{@env_data_file_path}" end end |
#language_dir_path_for_template(template_group, language) ⇒ Object
341 342 343 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 341 def language_dir_path_for_template(template_group, language) "#{@base_folder_path}/#{template_group}/#{language}" end |
#language_file_path_for_template(language) ⇒ Object
369 370 371 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 369 def language_file_path_for_template(language) "#{@resources_file_path}/#{language}.json" end |
#presentation_file_path_for_template(template_group, lang, view_type, template_name) ⇒ Object
321 322 323 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 321 def presentation_file_path_for_template(template_group, lang, view_type, template_name) "#{@base_folder_path}/#{template_group}/#{lang}/#{view_type}/#{template_name}/presentation.json" end |
#template_group_details_file_path_for_template(template_group) ⇒ Object
353 354 355 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 353 def template_group_details_file_path_for_template(template_group) "#{@base_folder_path}/#{template_group}/templateGroupDetails.json" end |
#template_group_dir_path_for_template(template_group) ⇒ Object
357 358 359 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 357 def template_group_dir_path_for_template(template_group) "#{@base_folder_path}/#{template_group}" end |
#template_name_dir_path_for_template(template_group, language, view_type, template_name) ⇒ Object
329 330 331 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 329 def template_name_dir_path_for_template(template_group, language, view_type, template_name) "#{@base_folder_path}/#{template_group}/#{language}/#{view_type}/#{template_name}" end |
#transfomer_file_path_for_template(template_group) ⇒ Object
345 346 347 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 345 def transfomer_file_path_for_template(template_group) "#{@base_folder_path}/#{template_group}/transformer.js" end |
#view_type_dir_path_for_template(template_group, language, view_type) ⇒ Object
333 334 335 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 333 def view_type_dir_path_for_template(template_group, language, view_type) "#{@base_folder_path}/#{template_group}/#{language}/#{view_type}" end |
#view_type_dir_path_for_template_with_version(template_group, language, view_type, version) ⇒ Object
337 338 339 |
# File 'lib/apollo_commons_ruby/TemplatesHelper.rb', line 337 def view_type_dir_path_for_template_with_version(template_group, language, view_type, version) "#{@base_folder_path}/#{template_group}/#{language}/#{view_type}/#{version}" end |