Class: OpenC3::NewsModel
Constant Summary collapse
- PRIMARY_KEY =
'openc3_news'
Instance Attribute Summary
Attributes inherited from Model
#name, #plugin, #scope, #updated_at
Class Method Summary collapse
Methods inherited from Model
#as_json, #check_disable_erb, #create, #deploy, #destroy, #destroyed?, filter, find_all_by_plugin, from_json, get, get_all_models, get_model, handle_config, #initialize, names, store, store_queued, #undeploy, #update
Constructor Details
This class inherits a constructor from OpenC3::Model
Class Method Details
.all ⇒ Object
30 31 32 |
# File 'lib/openc3/models/news_model.rb', line 30 def self.all() Store.get(PRIMARY_KEY) end |
.news_error(response) ⇒ Object
34 35 36 |
# File 'lib/openc3/models/news_model.rb', line 34 def self.news_error(response) Store.set(PRIMARY_KEY, [{ date: Time.now.utc.iso8601, title: 'News Error', body: "Error contacting OpenC3 news feed (status: #{response.status})" }].to_json) end |
.set(news) ⇒ Object
26 27 28 |
# File 'lib/openc3/models/news_model.rb', line 26 def self.set(news) Store.set(PRIMARY_KEY, news) end |