class NprStories::Story

Attributes

program[RW]
program_title[RW]
story_date[RW]
story_title[RW]
story_url[RW]
teaser[RW]

Public Class Methods

all() click to toggle source
# File lib/npr_stories/story.rb, line 10
def self.all
  @@stories
end

Public Instance Methods

save() click to toggle source
# File lib/npr_stories/story.rb, line 6
def save
  @@stories << self  
end
set_attributes_from_web(nokogiri_story) click to toggle source
# File lib/npr_stories/story.rb, line 14
def set_attributes_from_web(nokogiri_story)#nokogiri story object node?? thing
  self.story_title = nokogiri_story.search('title').first.text
 # new_story.program = ##### add in stoy's relationship to program object
  self.program_title = nokogiri_story.search('program')[0].text
  self.story_date = nokogiri_story.search('storyDate')[0].text
  self.teaser = nokogiri_story.search('teaser')[0].text
  self.story_url = nokogiri_story.search('link')[0].text
  self.save
end