Class: Quickstart
Constant Summary
collapse
- Disabled =
Class.new(StandardError)
- SearchDisabled =
Class.new(StandardError)
Class Method Summary
collapse
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, 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
Class Method Details
.disabled? ⇒ Boolean
80
81
82
|
# File 'app/models/quickstart.rb', line 80
def disabled?
!api_links[:list] rescue true
end
|
.prefix_parameters ⇒ Object
87
88
89
|
# File 'app/models/quickstart.rb', line 87
def prefix_parameters
{}
end
|
58
59
60
61
62
|
# File 'app/models/quickstart.rb', line 58
def promoted(opts={})
all({:from => (api_links[:list] or raise Disabled)}.merge(opts))
rescue Disabled
[]
end
|
.reset! ⇒ Object
91
92
93
|
# File 'app/models/quickstart.rb', line 91
def reset!
@api_links = nil
end
|
.search(terms, opts = {}) ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'app/models/quickstart.rb', line 64
def search(terms, opts={})
all(opts.merge(
:from => (api_links[:search] or raise SearchDisabled),
:params => {
(api_links[:search_param] or raise SearchDisabled) => terms
}
))
rescue SearchDisabled
terms.downcase!
promoted(opts).select do |q|
q.description.downcase.include?(terms) or
q.display_name.downcase.include?(terms) or
(q.tags.include?(terms.to_sym) rescue false)
end
end
|
.site ⇒ Object
84
85
86
|
# File 'app/models/quickstart.rb', line 84
def site
api_links[:site] or RestApi::Info.site
end
|
Instance Method Details
#>>(application) ⇒ Object
49
50
51
52
53
|
# File 'app/models/quickstart.rb', line 49
def >>(application)
application.initial_git_url = initial_git_url
application
end
|
#cartridges_spec ⇒ Object
40
41
42
|
# File 'app/models/quickstart.rb', line 40
def cartridges_spec
entity_decoded(attributes[:cartridges])
end
|
#learn_more_url ⇒ Object
28
29
30
|
# File 'app/models/quickstart.rb', line 28
def learn_more_url
URI.join(self.class.site, href).to_s if href
end
|
#name ⇒ Object
20
21
22
|
# File 'app/models/quickstart.rb', line 20
def name
entity_decoded(super)
end
|
#priority ⇒ Object
24
25
26
|
# File 'app/models/quickstart.rb', line 24
def priority
super.to_i rescue 0
end
|
#scalable ⇒ Object
Also known as:
scalable?
44
45
46
|
# File 'app/models/quickstart.rb', line 44
def scalable
(not tags.include?(:not_scalable) rescue true)
end
|
32
33
34
|
# File 'app/models/quickstart.rb', line 32
def tags
@tags ||= ApplicationType.user_tags(tags_from(attributes[:tags])) + admin_tags + (3.days.ago < updated ? [:new] : [])
end
|
#updated ⇒ Object
36
37
38
|
# File 'app/models/quickstart.rb', line 36
def updated
@updated ||= Time.at(attributes[:updated].to_i)
end
|