Class: Foxynews::PressRelease

Inherits:
Object
  • Object
show all
Defined in:
app/services/foxynews/press_release.rb

Instance Method Summary collapse

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_contentObject



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_summaryObject



14
15
16
# File 'app/services/foxynews/press_release.rb', line 14

def short_summary
  summary.split(' ')[0..99].join(' ') + '...'
end