Class: MnoEnterprise::App
- Inherits:
-
BaseResource
- Object
- BaseResource
- MnoEnterprise::App
- Defined in:
- app/models/mno_enterprise/app.rb
Class Method Summary collapse
-
.categories(list = nil) ⇒ Object
Return the list of available categories.
Instance Method Summary collapse
- #refresh_metadata!(metadata_url) ⇒ Object
- #regenerate_api_key! ⇒ Object
-
#sanitized_description ⇒ Object
Sanitize the app description E.g.: replace any mention of Maestrano by the tenant name.
- #to_audit_event ⇒ Object
Methods inherited from BaseResource
#==, base_class, #cache_key, #clear_association_cache, #clear_attribute_changes!, exists?, find_by, first, last, #max_updated_column_timestamp, #read_attribute, #reload, #save, #save!, #update, #write_attribute
Methods included from HerExtension::Validations::RemoteUniquenessValidation
Class Method Details
.categories(list = nil) ⇒ Object
Return the list of available categories
47 48 49 50 |
# File 'app/models/mno_enterprise/app.rb', line 47 def self.categories(list = nil) app_list = list || self.all.to_a app_list.select { |a| a.categories.present? }.map(&:categories).flatten.uniq { |e| e.downcase }.sort end |
Instance Method Details
#refresh_metadata!(metadata_url) ⇒ Object
78 79 80 |
# File 'app/models/mno_enterprise/app.rb', line 78 def () self.put(operation: 'refresh_metadata', metadata_url: ) end |
#regenerate_api_key! ⇒ Object
73 74 75 76 |
# File 'app/models/mno_enterprise/app.rb', line 73 def regenerate_api_key! data = self.put(operation: 'regenerate_api_key') self.api_key = data[:data][:api_key] end |
#sanitized_description ⇒ Object
Sanitize the app description E.g.: replace any mention of Maestrano by the tenant name
62 63 64 |
# File 'app/models/mno_enterprise/app.rb', line 62 def sanitized_description @sanitized_description ||= (self.description || '').gsub(/maestrano/i,MnoEnterprise.app_name) end |
#to_audit_event ⇒ Object
52 53 54 55 56 57 58 |
# File 'app/models/mno_enterprise/app.rb', line 52 def to_audit_event { app_id: id, app_nid: nid, app_name: name } end |