Class: Foxynews::PressRelease
- Inherits:
-
Object
- Object
- Foxynews::PressRelease
- Defined in:
- app/services/foxynews/press_release.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ PressRelease
constructor
A new instance of PressRelease.
- #parsed_content ⇒ Object
- #short_summary ⇒ Object
Constructor Details
#initialize(args) ⇒ PressRelease
Returns a new instance of PressRelease.
3 4 5 6 7 8 9 10 11 12 |
# File 'app/services/foxynews/press_release.rb', line 3 def initialize(args) if args.is_a? Hash args.each do |name, value| instance_variable_set("@#{name}", value) self.class.send(:attr_accessor, name) end else false end end |
Instance Method Details
#parsed_content ⇒ Object
18 19 20 21 |
# File 'app/services/foxynews/press_release.rb', line 18 def parsed_content json = JSON.parse(content_as_json) return json['data'] end |
#short_summary ⇒ Object
14 15 16 |
# File 'app/services/foxynews/press_release.rb', line 14 def short_summary summary.split(' ')[0..99].join(' ') + '...' end |