Class: ApplicationTemplate
Instance Method Summary
collapse
alias_attribute, aliased_attributes, allow_anonymous?, #as, #as=, #assign_attributes, attr_alters, #attributes=, calculated_attributes, #clone, configuration=, connection, custom_id, delete, #dup, #duplicate_errors, element_path, exception_for_code, find, find_one, get, #get, #has_exit_code?, headers, #initialize, #load, #load_remote_errors, on_exit_code, #raise_on_invalid, #reload, remote_errors_for, #remote_results, #save!, #save_with_change_tracking, shared_connection, singleton?, #to_json, translate_api_error, use_patch_on_update?, #valid?
#belongs_to, #has_many, #has_one
Constructor Details
This class inherits a constructor from RestApi::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class RestApi::Base
Instance Method Details
#cartridges ⇒ Object
70
71
72
|
# File 'app/models/application_template.rb', line 70
def cartridges
@cartridges ||= descriptor['Requires'] || []
end
|
#credentials ⇒ Object
43
44
45
46
|
# File 'app/models/application_template.rb', line 43
def credentials
creds = metadata.attributes[:credentials]
creds.map{|x| x.attributes.to_hash } unless creds.nil?
end
|
#credentials_message ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'app/models/application_template.rb', line 48
def credentials_message
creds = credentials
return if creds.blank?
str = "Your application contains pre-configured accounts, here are their credentials. " +
"You may want to change them as soon as possible.\n"
credentials.each do |cred|
str << "\n"
[:username, :password].each do |type|
str << "%s: %s\n" % [type.to_s.upcase,cred[type.to_s]]
end
end
str
end
|
#descriptor ⇒ Object
23
24
25
|
# File 'app/models/application_template.rb', line 23
def descriptor
@descriptor ||= YAML.load(descriptor_yaml) || {}
end
|
#display_name ⇒ Object
27
28
29
|
# File 'app/models/application_template.rb', line 27
def display_name
attributes['display_name'] || name
end
|
#initial_git_branch ⇒ Object
75
76
77
|
# File 'app/models/application_template.rb', line 75
def initial_git_branch
nil
end
|
#provides ⇒ Object
35
36
37
|
# File 'app/models/application_template.rb', line 35
def provides
Array(super)
end
|
#scalable ⇒ Object
Also known as:
scalable?
65
66
67
|
# File 'app/models/application_template.rb', line 65
def scalable
false
end
|
30
31
32
|
# File 'app/models/application_template.rb', line 30
def tags
@tags ||= super.map{|t| t.to_sym} << :template
end
|
#template ⇒ Object
39
40
41
|
# File 'app/models/application_template.rb', line 39
def template
self
end
|