Class: NPR::Story
Overview
Story represents an NPR story. ruby-npr gives you the following attributes to work with on a Story object:
-
id
- unique NPR identifier for each story -
title
- the title of the story. -
subtitle
- a short description of the story -
bylines
- a listing of the story’s author(s) -
teaser
- summary of the story -
mini_teaser
- an even shorter summary of the story -
slug
- the main association for the returned story, be it a topic, series, column or other list from NPR -
organization
- the owner of the story -
story_date
- the date the story was published -
publication_date
- the date the story was initially published to NPR. Also can be accessed bypub_date
-
last_modified
- the date the story was last modified in any sort of way -
audio
- a story’s audio attachment -
show
- which show this story originated from (if there was one) -
parents
- parent topics for this story, i.e. economy, health & science, etc. -
products
- any associated products that are included with the story. Usually books. -
related_links
- links to NPR content related to the given story -
html_text
- returns an array of the paragraphs of the text of the story. Includes all the HTML links and such as originally included in the body of the story. -
plain_text
- also returns an array of the paragraphs of the text of the story. Does not include any HTML. -
images
- any images associated with a story -
link
- a hash with links to the story. Use@some_story.link[:html]
to access the web page for the given Story. Use@some_story.link[:api]
to access the API representation of the given Story.
Instance Attribute Summary collapse
-
#audio ⇒ Object
Returns the value of attribute audio.
-
#bylines ⇒ Object
Returns the value of attribute bylines.
-
#html_text ⇒ Object
Returns the value of attribute html_text.
-
#id ⇒ Object
Returns the value of attribute id.
-
#images ⇒ Object
Returns the value of attribute images.
-
#keywords ⇒ Object
Returns the value of attribute keywords.
-
#last_modified ⇒ Object
Returns the value of attribute last_modified.
-
#link ⇒ Object
Returns the value of attribute link.
-
#links ⇒ Object
Returns the value of attribute links.
-
#mini_teaser ⇒ Object
Returns the value of attribute mini_teaser.
-
#organization ⇒ Object
(also: #org)
Returns the value of attribute organization.
-
#parents ⇒ Object
Returns the value of attribute parents.
-
#plain_text ⇒ Object
Returns the value of attribute plain_text.
-
#priority_keywords ⇒ Object
Returns the value of attribute priority_keywords.
-
#products ⇒ Object
Returns the value of attribute products.
-
#publication_date ⇒ Object
(also: #pub_date)
Returns the value of attribute publication_date.
-
#related_links ⇒ Object
Returns the value of attribute related_links.
-
#short_title ⇒ Object
Returns the value of attribute short_title.
-
#show ⇒ Object
Returns the value of attribute show.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#story_date ⇒ Object
Returns the value of attribute story_date.
-
#subtitle ⇒ Object
Returns the value of attribute subtitle.
-
#teaser ⇒ Object
Returns the value of attribute teaser.
-
#title ⇒ Object
Returns the value of attribute title.
Method Summary
Methods inherited from Content
Constructor Details
This class inherits a constructor from NPR::Content
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object (private)
84 85 86 87 88 89 |
# File 'lib/rubynpr/story.rb', line 84 def method_missing(method_name, *args) return nil unless method_name.to_s =~ /process_story_(bylines|parents|products|images)/ klass = method_name.to_s.split('_').last instance_variable_set("@#{ klass }", []) if instance_variable_get("@#{ klass }").nil? instance_variable_get("@#{ klass }") << NPR.const_get(klass.capitalize.chop).new(args[0]) end |
Instance Attribute Details
#audio ⇒ Object
Returns the value of attribute audio.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def audio @audio end |
#bylines ⇒ Object
Returns the value of attribute bylines.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def @bylines end |
#html_text ⇒ Object
Returns the value of attribute html_text.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def html_text @html_text end |
#id ⇒ Object
Returns the value of attribute id.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def id @id end |
#images ⇒ Object
Returns the value of attribute images.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def images @images end |
#keywords ⇒ Object
Returns the value of attribute keywords.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def keywords @keywords end |
#last_modified ⇒ Object
Returns the value of attribute last_modified.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def last_modified @last_modified end |
#link ⇒ Object
Returns the value of attribute link.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def link @link end |
#links ⇒ Object
Returns the value of attribute links.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def links @links end |
#mini_teaser ⇒ Object
Returns the value of attribute mini_teaser.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def @mini_teaser end |
#organization ⇒ Object Also known as: org
Returns the value of attribute organization.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def organization @organization end |
#parents ⇒ Object
Returns the value of attribute parents.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def parents @parents end |
#plain_text ⇒ Object
Returns the value of attribute plain_text.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def plain_text @plain_text end |
#priority_keywords ⇒ Object
Returns the value of attribute priority_keywords.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def priority_keywords @priority_keywords end |
#products ⇒ Object
Returns the value of attribute products.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def products @products end |
#publication_date ⇒ Object Also known as: pub_date
Returns the value of attribute publication_date.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def publication_date @publication_date end |
#related_links ⇒ Object
Returns the value of attribute related_links.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def @related_links end |
#short_title ⇒ Object
Returns the value of attribute short_title.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def short_title @short_title end |
#show ⇒ Object
Returns the value of attribute show.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def show @show end |
#slug ⇒ Object
Returns the value of attribute slug.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def slug @slug end |
#story_date ⇒ Object
Returns the value of attribute story_date.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def story_date @story_date end |
#subtitle ⇒ Object
Returns the value of attribute subtitle.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def subtitle @subtitle end |
#teaser ⇒ Object
Returns the value of attribute teaser.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def @teaser end |
#title ⇒ Object
Returns the value of attribute title.
30 31 32 |
# File 'lib/rubynpr/story.rb', line 30 def title @title end |