Class: MnoEnterprise::App
Class Method Summary
collapse
Instance Method Summary
collapse
#==, 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
included
Class Method Details
.categories(list = nil) ⇒ Object
Return the list of available categories
48
49
50
51
|
# File 'app/models/mno_enterprise/app.rb', line 48
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
#connec_ready? ⇒ Boolean
78
79
80
|
# File 'app/models/mno_enterprise/app.rb', line 78
def connec_ready?
!!(appinfo.presence && !!appinfo['connecReady'])
end
|
87
88
89
|
# File 'app/models/mno_enterprise/app.rb', line 87
def refresh_metadata!(metadata_url)
self.put(operation: 'refresh_metadata', metadata_url: metadata_url)
end
|
#regenerate_api_key! ⇒ Object
82
83
84
85
|
# File 'app/models/mno_enterprise/app.rb', line 82
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
63
64
65
|
# File 'app/models/mno_enterprise/app.rb', line 63
def sanitized_description
@sanitized_description ||= (self.description || '').gsub(/(?<!cdn\.)(?<!cdn-prd-)maestrano(?!\.com)/i,MnoEnterprise.app_name)
end
|
#star_ready? ⇒ Boolean
74
75
76
|
# File 'app/models/mno_enterprise/app.rb', line 74
def star_ready?
!!(appinfo.presence && appinfo['starReady'])
end
|
#to_audit_event ⇒ Object
53
54
55
56
57
58
59
|
# File 'app/models/mno_enterprise/app.rb', line 53
def to_audit_event
{
app_id: id,
app_nid: nid,
app_name: name
}
end
|