npr 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/.travis.yml +13 -0
  2. data/{LICENSE → MIT-LICENSE} +1 -1
  3. data/README.md +115 -3
  4. data/Rakefile +6 -0
  5. data/gemfiles/Gemfile.rb-1.8.7 +6 -0
  6. data/lib/npr/api/client.rb +87 -0
  7. data/lib/npr/api/message.rb +38 -0
  8. data/lib/npr/api/query_builder.rb +222 -0
  9. data/lib/npr/api/response.rb +32 -0
  10. data/lib/npr/api.rb +7 -0
  11. data/lib/npr/concern/attr_typecast.rb +59 -0
  12. data/lib/npr/concern/relation.rb +103 -0
  13. data/lib/npr/concern/shallow_attributes.rb +71 -0
  14. data/lib/npr/concern.rb +9 -0
  15. data/lib/npr/configuration.rb +120 -0
  16. data/lib/npr/core_ext/array/wrap.rb +15 -0
  17. data/lib/npr/entity/audio.rb +28 -0
  18. data/lib/npr/entity/author.rb +22 -0
  19. data/lib/npr/entity/base.rb +19 -0
  20. data/lib/npr/entity/book.rb +21 -0
  21. data/lib/npr/entity/book_edition.rb +26 -0
  22. data/lib/npr/entity/byline.rb +18 -0
  23. data/lib/npr/entity/collection.rb +11 -0
  24. data/lib/npr/entity/crop.rb +20 -0
  25. data/lib/npr/entity/enlargement.rb +20 -0
  26. data/lib/npr/entity/formats.rb +19 -0
  27. data/lib/npr/entity/image.rb +33 -0
  28. data/lib/npr/entity/intro_text.rb +21 -0
  29. data/lib/npr/entity/link.rb +23 -0
  30. data/lib/npr/entity/list.rb +28 -0
  31. data/lib/npr/entity/list_text.rb +19 -0
  32. data/lib/npr/entity/member.rb +23 -0
  33. data/lib/npr/entity/member_byline.rb +17 -0
  34. data/lib/npr/entity/member_promo_art.rb +17 -0
  35. data/lib/npr/entity/mp3.rb +23 -0
  36. data/lib/npr/entity/organization.rb +18 -0
  37. data/lib/npr/entity/paragraph.rb +27 -0
  38. data/lib/npr/entity/permissions.rb +18 -0
  39. data/lib/npr/entity/program.rb +24 -0
  40. data/lib/npr/entity/promo_art.rb +17 -0
  41. data/lib/npr/entity/promo_art_book_edition.rb +18 -0
  42. data/lib/npr/entity/provider.rb +23 -0
  43. data/lib/npr/entity/pull_quote.rb +16 -0
  44. data/lib/npr/entity/related_link.rb +21 -0
  45. data/lib/npr/entity/show.rb +19 -0
  46. data/lib/npr/entity/story.rb +179 -0
  47. data/lib/npr/entity/text.rb +22 -0
  48. data/lib/npr/entity/title.rb +21 -0
  49. data/lib/npr/entity/transcript.rb +16 -0
  50. data/lib/npr/entity.rb +7 -0
  51. data/lib/npr/errors.rb +17 -0
  52. data/lib/npr/version.rb +1 -1
  53. data/lib/npr.rb +64 -3
  54. data/npr.gemspec +12 -2
  55. data/spec/fixtures/README.md +30 -0
  56. data/spec/fixtures/atom/01_story_full_media.atom +36 -0
  57. data/spec/fixtures/atom/02_story_multiple_images.atom +32 -0
  58. data/spec/fixtures/atom/03_no_results.atom +10 -0
  59. data/spec/fixtures/atom/04_invalid_id.atom +344 -0
  60. data/spec/fixtures/atom/05_no_api_key.atom +9 -0
  61. data/spec/fixtures/atom/06_story_multiple_ids.atom +59 -0
  62. data/spec/fixtures/fetch_formats.rb +65 -0
  63. data/spec/fixtures/html/01_story_full_media.html +54 -0
  64. data/spec/fixtures/html/02_story_multiple_images.html +55 -0
  65. data/spec/fixtures/html/03_no_results.html +38 -0
  66. data/spec/fixtures/html/04_invalid_id.html +82 -0
  67. data/spec/fixtures/html/05_no_api_key.html +8 -0
  68. data/spec/fixtures/html/06_story_multiple_ids.html +69 -0
  69. data/spec/fixtures/js/01_story_full_media.js +1 -0
  70. data/spec/fixtures/js/02_story_multiple_images.js +1 -0
  71. data/spec/fixtures/js/03_no_results.js +1 -0
  72. data/spec/fixtures/js/04_invalid_id.js +1 -0
  73. data/spec/fixtures/js/05_no_api_key.js +8 -0
  74. data/spec/fixtures/js/06_story_multiple_ids.js +1 -0
  75. data/spec/fixtures/json/01_story_full_media.json +1 -0
  76. data/spec/fixtures/json/02_story_multiple_images.json +1 -0
  77. data/spec/fixtures/json/03_no_results.json +1 -0
  78. data/spec/fixtures/json/04_invalid_id.json +1 -0
  79. data/spec/fixtures/json/05_no_api_key.json +1 -0
  80. data/spec/fixtures/json/06_story_multiple_ids.json +1 -0
  81. data/spec/fixtures/json/list.json +1 -0
  82. data/spec/fixtures/mediarss/01_story_full_media.rss +31 -0
  83. data/spec/fixtures/mediarss/02_story_multiple_images.rss +40 -0
  84. data/spec/fixtures/mediarss/03_no_results.rss +17 -0
  85. data/spec/fixtures/mediarss/04_invalid_id.rss +279 -0
  86. data/spec/fixtures/mediarss/05_no_api_key.rss +31 -0
  87. data/spec/fixtures/mediarss/06_story_multiple_ids.rss +65 -0
  88. data/spec/fixtures/nprml/01_story_full_media.xml +271 -0
  89. data/spec/fixtures/nprml/02_story_multiple_images.xml +165 -0
  90. data/spec/fixtures/nprml/03_no_results.xml +14 -0
  91. data/spec/fixtures/nprml/04_invalid_id.xml +1780 -0
  92. data/spec/fixtures/nprml/05_no_api_key.xml +9 -0
  93. data/spec/fixtures/nprml/06_story_multiple_ids.xml +435 -0
  94. data/spec/fixtures/nprml/list.xml +440 -0
  95. data/spec/fixtures/podcast/01_story_full_media.rss +30 -0
  96. data/spec/fixtures/podcast/02_story_multiple_images.rss +32 -0
  97. data/spec/fixtures/podcast/03_no_results.rss +19 -0
  98. data/spec/fixtures/podcast/04_invalid_id.rss +186 -0
  99. data/spec/fixtures/podcast/05_no_api_key.rss +31 -0
  100. data/spec/fixtures/podcast/06_story_multiple_ids.rss +43 -0
  101. data/spec/fixtures/rss/01_story_full_media.rss +25 -0
  102. data/spec/fixtures/rss/02_story_multiple_images.rss +25 -0
  103. data/spec/fixtures/rss/03_no_results.rss +17 -0
  104. data/spec/fixtures/rss/04_invalid_id.rss +137 -0
  105. data/spec/fixtures/rss/05_no_api_key.rss +31 -0
  106. data/spec/fixtures/rss/06_story_multiple_ids.rss +33 -0
  107. data/spec/spec_helper.rb +23 -0
  108. data/spec/support/config_helper.rb +64 -0
  109. data/spec/support/fake_response.rb +54 -0
  110. data/spec/support/fixture_helper.rb +23 -0
  111. data/spec/unit/api/client_spec.rb +42 -0
  112. data/spec/unit/api/message_spec.rb +68 -0
  113. data/spec/unit/api/query_builder_spec.rb +195 -0
  114. data/spec/unit/api/response_spec.rb +45 -0
  115. data/spec/unit/configuration_spec.rb +63 -0
  116. data/spec/unit/entity/audio_spec.rb +75 -0
  117. data/spec/unit/entity/author_spec.rb +30 -0
  118. data/spec/unit/entity/base_spec.rb +87 -0
  119. data/spec/unit/entity/book_edition_spec.rb +57 -0
  120. data/spec/unit/entity/book_spec.rb +31 -0
  121. data/spec/unit/entity/byline_spec.rb +23 -0
  122. data/spec/unit/entity/collection_spec.rb +39 -0
  123. data/spec/unit/entity/crop_spec.rb +25 -0
  124. data/spec/unit/entity/englargement_spec.rb +21 -0
  125. data/spec/unit/entity/formats_spec.rb +41 -0
  126. data/spec/unit/entity/image_spec.rb +82 -0
  127. data/spec/unit/entity/intro_text_spec.rb +25 -0
  128. data/spec/unit/entity/link_spec.rb +25 -0
  129. data/spec/unit/entity/list_spec.rb +22 -0
  130. data/spec/unit/entity/list_text_spec.rb +31 -0
  131. data/spec/unit/entity/member_byline_spec.rb +21 -0
  132. data/spec/unit/entity/member_promo_art_spec.rb +21 -0
  133. data/spec/unit/entity/member_spec.rb +59 -0
  134. data/spec/unit/entity/mp3_spec.rb +25 -0
  135. data/spec/unit/entity/organization_spec.rb +29 -0
  136. data/spec/unit/entity/paragraph_spec.rb +25 -0
  137. data/spec/unit/entity/permissions_spec.rb +56 -0
  138. data/spec/unit/entity/program_spec.rb +27 -0
  139. data/spec/unit/entity/promo_art_book_edition_spec.rb +21 -0
  140. data/spec/unit/entity/promo_art_spec.rb +42 -0
  141. data/spec/unit/entity/pull_quote_spec.rb +29 -0
  142. data/spec/unit/entity/related_link_spec.rb +55 -0
  143. data/spec/unit/entity/show_spec.rb +41 -0
  144. data/spec/unit/entity/story_spec.rb +154 -0
  145. data/spec/unit/entity/text_spec.rb +54 -0
  146. data/spec/unit/entity/title_spec.rb +25 -0
  147. data/spec/unit/entity/transcript_spec.rb +22 -0
  148. metadata +340 -8
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom" xmlns:nprml="http://api.npr.org/nprml">
3
+ <title type="text">NPR: Stories from NPR</title>
4
+ <subtitle type="text">Custom NPR News Feed API. Visit http://www.npr.org/templates/apidoc/index.php for more information.</subtitle>
5
+ <id>http://api.npr.org/query?id=167019577</id>
6
+ <link rel="self" type="application/atom+xml" href="http://api.npr.org/query?id=167019577&amp;apiKey=API_KEY"/>
7
+ <rights>Copyright(c) 2012, NPR</rights>
8
+ <generator uri="http://api.npr.org/query" version="0.94">NPR API</generator>
9
+ <updated>2012-12-12T00:30:00-05:00</updated>
10
+ <entry>
11
+ <title>Ravi Shankar, Who Brought Eastern Music To Western Legends, Dies</title>
12
+ <summary>When he was just 10 years old, Shankar began performing in Europe and the US with his family's Indian dance troupe. But at age 18, Shankar gave up all the glitter to study with a guru who taught him the sitar. He became a master, and introduced the West to his country's music.</summary>
13
+ <id>http://api.npr.org/query?id=167019577</id>
14
+ <category term="161375941" label="The Musicians"/>
15
+ <category term="128494978" label="The Record"/>
16
+ <category term="100920965" label="Music Articles"/>
17
+ <category term="10004" label="World"/>
18
+ <category term="1106" label="Music News"/>
19
+ <category term="1062" label="Remembrances"/>
20
+ <category term="1039" label="Music"/>
21
+ <category term="1002" label="Home Page Top Stories"/>
22
+ <published>2012-12-12T00:30:00-05:00</published>
23
+ <updated>2012-12-12T01:00:06-05:00</updated>
24
+ <author>
25
+ <name>National Public Radio</name>
26
+ <uri>http://www.npr.org/</uri>
27
+ </author>
28
+ <contributor>
29
+ <name>Susan Stamberg</name>
30
+ </contributor>
31
+ <link href="http://api.npr.org/query?id=167019577&amp;apiKey=API_KEY" rel="alternate"/>
32
+ <link href="http://www.npr.org/templates/story/story.php?storyId=125507150" rel="related" type="text/html" title=" Ravi Shankar At 90: The Man And His Music"/>
33
+ <link href="http://www.npr.org/templates/story/story.php?storyId=125512689" rel="related" type="text/html" title=" Indian Classical Music 101 With Ravi Shankar"/>
34
+ <link href="http://media.npr.org/assets/img/2012/12/12/gettyimages_84882815-0e02bde00f7b2ac036374e2874fc6b5ee6de4352.jpg" rel="related" title="Ravi Shankar circa 1960 in the U.K." length="100000"/>
35
+ </entry>
36
+ </feed>
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom" xmlns:nprml="http://api.npr.org/nprml">
3
+ <title type="text">NPR: Stories from NPR</title>
4
+ <subtitle type="text">Custom NPR News Feed API. Visit http://www.npr.org/templates/apidoc/index.php for more information.</subtitle>
5
+ <id>http://api.npr.org/query?id=166884441</id>
6
+ <link rel="self" type="application/atom+xml" href="http://api.npr.org/query?id=166884441&amp;apiKey=API_KEY"/>
7
+ <rights>Copyright(c) 2012, NPR</rights>
8
+ <generator uri="http://api.npr.org/query" version="0.94">NPR API</generator>
9
+ <updated>2012-12-11T15:24:00-05:00</updated>
10
+ <entry>
11
+ <title>In Freedom, Ex-Felon Becomes Probation Counselor </title>
12
+ <summary>The federal probation office in St. Louis has one of the biggest caseloads of violent offenders in the country — and one of the lowest recidivism rates. That's in part because of a former felon who knows how to keep ex-offenders from returning to prison.</summary>
13
+ <id>http://api.npr.org/query?id=166884441</id>
14
+ <category term="1091" label="Around the Nation"/>
15
+ <category term="1003" label="U.S."/>
16
+ <category term="1002" label="Home Page Top Stories"/>
17
+ <published>2012-12-11T15:24:00-05:00</published>
18
+ <updated>2012-12-11T21:34:27-05:00</updated>
19
+ <author>
20
+ <name>KWMU-FM</name>
21
+ <uri>http://www.stlpublicradio.org</uri>
22
+ </author>
23
+ <contributor>
24
+ <name>Julie Bierach</name>
25
+ </contributor>
26
+ <link href="http://api.npr.org/query?id=166884441&amp;apiKey=API_KEY" rel="alternate"/>
27
+ <link href="http://media.npr.org/assets/img/2012/12/11/clark_composite_custom-7a789655986f08866836381751bd592fd4cfca2d.jpg" rel="related" title="Clark Porter was 17 when he was sentenced to 35 years in prison for robbing a downtown post office at gunpoint. He spent 15 years in prison and today helps some of the toughest ex-offenders turn their lives around." length="100000"/>
28
+ <link href="http://media.npr.org/assets/img/2012/12/10/f_clark_porter_alumnus_1_custom-35bad304f3f860d830fd400fe48eea92115cc29e.jpg" rel="related" title="Porter was hired by Chief U.S. Probation Officer Douglas Burris, who was initially taken aback by the idea of an ex-felon working for the probation office." length="100000"/>
29
+ <link href="http://pd.npr.org/anon.npr-mp3/npr/atc/2012/12/20121211_atc_07.mp3?orgId=278&amp;topicId=1003" rel="enclosure" type="audio/mp3" title="Story Segment Audio" length="290"/>
30
+ <link href="http://api.npr.org/m3u/1167000584-5e6998.m3u?orgId=278&amp;topicId=1003" rel="enclosure" type="audio/mp3" title="Story Segment Audio" length="290"/>
31
+ </entry>
32
+ </feed>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom" xmlns:nprml="http://api.npr.org/nprml">
3
+ <title type="text">NPR: Stories from NPR</title>
4
+ <subtitle type="text">Custom NPR News Feed API. Visit http://www.npr.org/templates/apidoc/index.php for more information.</subtitle>
5
+ <id>http://api.npr.org/query?id=167016221</id>
6
+ <link rel="self" type="application/atom+xml" href="http://api.npr.org/query?id=167016221&amp;apiKey=API_KEY"/>
7
+ <rights>Copyright(c) 2012, NPR</rights>
8
+ <generator uri="http://api.npr.org/query" version="0.94">NPR API</generator>
9
+ <updated/>
10
+ </feed>
@@ -0,0 +1,344 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom" xmlns:nprml="http://api.npr.org/nprml">
3
+ <title type="text">NPR: Stories from NPR</title>
4
+ <subtitle type="text">Custom NPR News Feed API. Visit http://www.npr.org/templates/apidoc/index.php for more information.</subtitle>
5
+ <id>http://api.npr.org/query?id=1</id>
6
+ <link rel="self" type="application/atom+xml" href="http://api.npr.org/query?id=1&amp;apiKey=API_KEY"/>
7
+ <rights>Copyright(c) 2012, NPR</rights>
8
+ <generator uri="http://api.npr.org/query" version="0.94">NPR API</generator>
9
+ <updated>2012-12-13T11:25:00-05:00</updated>
10
+ <entry>
11
+ <title>On 'Fiscal Cliff,' Majority Of Public Sides With Democrats, Pew Poll Says</title>
12
+ <summary>Fifty-five percent of those surveyed said President Obama is making a "serious effort" to work with Republicans. Just 32 percent said Republicans are making a serious effort to work with the Democratic president.</summary>
13
+ <id>http://api.npr.org/query?id=167159547</id>
14
+ <category term="164716837" label="Two-Way Featured Post Two"/>
15
+ <category term="164475099" label="fiscal cliff"/>
16
+ <category term="137769525" label="deficit reduction "/>
17
+ <category term="128111167" label="taxes"/>
18
+ <category term="127602855" label="America"/>
19
+ <category term="125939328" label="Pew Research Center"/>
20
+ <category term="103943429" label="The Two-Way"/>
21
+ <category term="1091" label="Around the Nation"/>
22
+ <category term="1014" label="Politics"/>
23
+ <category term="1003" label="U.S."/>
24
+ <category term="1002" label="Home Page Top Stories"/>
25
+ <category term="1001" label="News"/>
26
+ <published>2012-12-13T11:25:00-05:00</published>
27
+ <updated>2012-12-13T12:33:32-05:00</updated>
28
+ <author>
29
+ <name>National Public Radio</name>
30
+ <uri>http://www.npr.org/</uri>
31
+ </author>
32
+ <contributor>
33
+ <name>Mark Memmott</name>
34
+ </contributor>
35
+ <link href="http://api.npr.org/query?id=167159547&amp;apiKey=API_KEY" rel="alternate"/>
36
+ <link href="http://media.npr.org/assets/img/2012/12/13/twosides132way-0600cdf9eefdbc0d5c1021c23a48a9a6f8b9c719.jpg" rel="related" title="President Obama, with House Speaker John Boehner (R-Ohio) behind him, delivering his State of the Union address last January." length="100000"/>
37
+ </entry>
38
+ <entry>
39
+ <title>It's ScuttleButton Time!</title>
40
+ <summary>This is the last ScuttleButton puzzle for 2012 — and your last chance to win a Political Junkie t-shirt and Official No-Prize button! (until next year, of course)</summary>
41
+ <id>http://api.npr.org/query?id=167177687</id>
42
+ <category term="126925951" label="Political Junkie"/>
43
+ <category term="125961350" label="ScuttleButton"/>
44
+ <category term="97248522" label="Political Junkie"/>
45
+ <category term="1014" label="Politics"/>
46
+ <published>2012-12-13T13:48:00-05:00</published>
47
+ <updated>2012-12-13T13:53:53-05:00</updated>
48
+ <author>
49
+ <name>National Public Radio</name>
50
+ <uri>http://www.npr.org/</uri>
51
+ </author>
52
+ <contributor>
53
+ <name>Ken Rudin</name>
54
+ </contributor>
55
+ <link href="http://api.npr.org/query?id=167177687&amp;apiKey=API_KEY" rel="alternate"/>
56
+ <link href="http://media.npr.org/assets/img/2012/12/13/button_1207_1_custom-2ea6e50cae5f62fcad63b4d42ff47f515d5f5302.jpg" rel="related" length="100000"/>
57
+ </entry>
58
+ <entry>
59
+ <title>Sales Soar In Gaza Of Fragrance Named For Rocket Fired At Israel </title>
60
+ <summary>M75 fragrances for men and women get their name from rockets fired from Gaza into Israel in November. Sales have been soaring, shopkeepers say. No, they don't smell like rocket fuel. They're citrus-scented.</summary>
61
+ <id>http://api.npr.org/query?id=167171524</id>
62
+ <category term="167171561" label="perfume"/>
63
+ <category term="127602464" label="International"/>
64
+ <category term="125940539" label="Israel"/>
65
+ <category term="125940537" label="Gaza"/>
66
+ <category term="103943429" label="The Two-Way"/>
67
+ <category term="1002" label="Home Page Top Stories"/>
68
+ <category term="1001" label="News"/>
69
+ <published>2012-12-13T13:15:00-05:00</published>
70
+ <updated>2012-12-13T13:17:51-05:00</updated>
71
+ <author>
72
+ <name>National Public Radio</name>
73
+ <uri>http://www.npr.org/</uri>
74
+ </author>
75
+ <contributor>
76
+ <name>Mark Memmott</name>
77
+ </contributor>
78
+ <link href="http://api.npr.org/query?id=167171524&amp;apiKey=API_KEY" rel="alternate"/>
79
+ <link href="http://media.npr.org/assets/img/2012/12/13/m75132way_custom-cc8a08679d92851f23eb4e23542a4c14ac7f9803.jpg" rel="related" title="Bottles of M75 on sale at a shop in Gaza City. The fragrance is named for the rockets fired from Gaza into Israel." length="100000"/>
80
+ </entry>
81
+ <entry>
82
+ <title>One Photo, 126 Frames, 2 Billion Leaves, 247 Feet</title>
83
+ <summary>Those numbers represent one giant sequoia. Oh, also: The "President," as it's called, is more than 3,000 years old.</summary>
84
+ <id>http://api.npr.org/query?id=167163801</id>
85
+ <category term="125399511" label="National Geographic"/>
86
+ <category term="125399052" label="Daily Picture Show"/>
87
+ <category term="97635953" label="The Picture Show"/>
88
+ <category term="1143" label="Photography"/>
89
+ <category term="1047" label="Art &amp; Design"/>
90
+ <category term="1002" label="Home Page Top Stories"/>
91
+ <published>2012-12-13T13:01:00-05:00</published>
92
+ <updated>2012-12-13T13:01:35-05:00</updated>
93
+ <author>
94
+ <name>National Public Radio</name>
95
+ <uri>http://www.npr.org/</uri>
96
+ </author>
97
+ <contributor>
98
+ <name>Claire O'Neill</name>
99
+ </contributor>
100
+ <link href="http://api.npr.org/query?id=167163801&amp;apiKey=API_KEY" rel="alternate"/>
101
+ <link href="http://media.npr.org/assets/img/2012/12/13/giant_sequoias_mm7946_002_custom-ecf623469ff776e037de22f1d3b67fa590a57c88.jpg" rel="related" title="The giant sequoia is a snow tree, says scientist Steve Sillett, adapted for long winters in the Sierra Nevada. But it's a fire tree, too. Thick bark protects it from burning in lightning-caused fires, which open cones and clear the understory, allowing saplings to find light and prosper." length="100000"/>
102
+ <link href="http://media.npr.org/assets/img/2012/12/13/tree_custom-490978178ed5b70330c46529a5e3d3ca585f88a7.jpg" rel="related" title="Cloaked in the snows of California's Sierra Nevada, the 3,200-year-old giant sequoia called the President rises 247 feet. Two other sequoias have wider trunks, but none has a larger crown, say the scientists who climbed it. The figure at top seems taller than the other climbers because he's standing forward on one of the great limbs." length="100000"/>
103
+ <link href="http://media.npr.org/assets/img/2012/12/13/natgeo-mag-1col_custom-a808c9c7d76afd6167e2533a63817c408fd4ec60.gif" rel="related" length="100000"/>
104
+ </entry>
105
+ <entry>
106
+ <title>NCAA Shake-Up: The Future Of College Athletics</title>
107
+ <summary>In 2013 and 2014, there will be a number of substantial realignments in the NCAA conferences. Some believe that the realignment process will ultimately result in the creation of four "super conferences." NPR's Mike Pesca talks about how conference shifts could effect the future of college athletics.</summary>
108
+ <id>http://api.npr.org/query?id=167180401</id>
109
+ <category term="1091" label="Around the Nation"/>
110
+ <category term="1055" label="Sports"/>
111
+ <published>2012-12-13T13:00:00-05:00</published>
112
+ <updated>2012-12-13T14:15:23-05:00</updated>
113
+ <author>
114
+ <name>National Public Radio</name>
115
+ <uri>http://www.npr.org/</uri>
116
+ </author>
117
+ <link href="http://api.npr.org/query?id=167180401&amp;apiKey=API_KEY" rel="alternate"/>
118
+ <link href="http://www.npr.org/2012/04/11/150285525/the-ncaa-is-membership-worth-it" rel="related" type="text/html" title=" The NCAA: Is Membership Worth It?"/>
119
+ <link href="http://www.npr.org/2012/03/26/149411848/in-ncaa-tournament-a-kentucky-showdown" rel="related" type="text/html" title=" In NCAA Tournament, A Kentucky Showdown"/>
120
+ </entry>
121
+ <entry>
122
+ <title>10 Artists You Should Have Known In 2012</title>
123
+ <summary>It's hard to keep track of new artists these days. So we asked our colleagues around the country to recommend recent discoveries from their communities. Download 10 songs that helped put these musicians on the map in 2012.</summary>
124
+ <id>http://api.npr.org/query?id=166745766</id>
125
+ <category term="166027976" label="Lists"/>
126
+ <category term="166026576" label="Best Music Of 2012"/>
127
+ <category term="160609993" label="Heavy Rotation"/>
128
+ <category term="100920965" label="Music Articles"/>
129
+ <category term="10001" label="Rock"/>
130
+ <category term="1039" label="Music"/>
131
+ <category term="1002" label="Home Page Top Stories"/>
132
+ <published>2012-12-13T13:00:00-05:00</published>
133
+ <updated>2012-12-13T13:16:48-05:00</updated>
134
+ <author>
135
+ <name>National Public Radio</name>
136
+ <uri>http://www.npr.org/</uri>
137
+ </author>
138
+ <link href="http://api.npr.org/query?id=166745766&amp;apiKey=API_KEY" rel="alternate"/>
139
+ <link href="http://media.npr.org/assets/img/2012/12/07/1343246959_heddy_bergsman-phillies-1f72671b8717dd80c9eae8e8da5f47cbc4247450.jpg" rel="related" title="Philadelphia's Aaron Brown." length="100000"/>
140
+ <link href="http://media.npr.org/assets/img/2012/12/07/grahamdechter1-aef349a21423cc9ce62fe6c5aa49b55d5f70187c.jpg" rel="related" title="Los Angeles jazz guitarist Graham Dechter." length="100000"/>
141
+ <link href="http://media.npr.org/assets/img/2012/12/07/f010-fullbright-bdshoot-mar2012-033-vrf_20120330_144008-c5f81e4871348ab24f78ddad77b6f86f02e4671a.jpg" rel="related" title="Oklahoma's John Fullbright." length="100000"/>
142
+ <link href="http://media.npr.org/assets/img/2012/12/07/lord-huron-credit-ben-schneider-2daa81da0de3641bcfa08d642fa0ca5d3af2d5e2.jpg" rel="related" title="L.A.'s Ben Schneider." length="100000"/>
143
+ <link href="http://media.npr.org/assets/img/2012/12/07/6839382744_22a459a1a5_b-03ab159cbdaebd8469c1d24694ac029078324802.jpg" rel="related" title="Poliça lead singer Channy Leaneagh." length="100000"/>
144
+ <link href="http://media.npr.org/assets/img/2012/12/07/1323796924radiation_img05_hires-6b42c22378ee8b13e882a67b6cf2685e40d41c1d.jpg" rel="related" title="From left, Radiation City's Cameron Spies, Lizzy Ellison, Randy Bemrose, Patti King and Matt Rafferty." length="100000"/>
145
+ <link href="http://media.npr.org/assets/img/2012/12/07/savoiradore_ournaturephoto4_4-2eed3db56a2ace1f58226e7efb473bb9c609d415.jpg" rel="related" title="Savoir Adore's Deidre Muro and Paul Hammer." length="100000"/>
146
+ <link href="http://media.npr.org/assets/img/2012/12/07/theesatisfaction_2012_1_davidbelisle_print-ea933f9b1882066e917ec566dc1ea51bfdddbeda.jpg" rel="related" title="THEESatisfaction's Catherine Harris-White and Stasia Irons." length="100000"/>
147
+ <link href="http://media.npr.org/assets/img/2012/12/07/20090617_pedromoraes_025-edit_saraiva_1251942567-51c6af0972c6078bf725a3a5e95bde727f13e5d9.jpg" rel="related" title="Brazilian guitarist and composer Pedro Moraes." length="100000"/>
148
+ <link href="http://media.npr.org/assets/img/2012/12/07/shakeygraves_credit-kirkstewart-f9eba33e7bbd8f61b3e508e60e1698bfde75f68f.jpeg" rel="related" title="Austin's Alejandro Rose-Garcia" length="100000"/>
149
+ <link href="http://media.npr.org/assets/img/2012/12/09/7838896508_7caae34cb0_k_wide-8d7bb036235dd240c33cfd79ffe309b169fc95c3.jpg" rel="related" title="Stasia Irons of THEESatisfaction performs at an All Songs Considered party at KEXP on August 20, 2012." length="100000"/>
150
+ </entry>
151
+ <entry>
152
+ <title>Options For Intervention In Mali's Growing Crisis</title>
153
+ <summary>A military coup brought down Mali's prime minister in March, allowing radical Islamists from Mali and surrounding areas to take hold of an area the size of Texas. As al-Qaida-linked militants take over the northern part of the country, many wonder what the U.S. and other can do to intervene.</summary>
154
+ <id>http://api.npr.org/query?id=167180399</id>
155
+ <category term="1126" label="Africa"/>
156
+ <category term="1004" label="World"/>
157
+ <published>2012-12-13T13:00:00-05:00</published>
158
+ <updated>2012-12-13T14:13:31-05:00</updated>
159
+ <author>
160
+ <name>National Public Radio</name>
161
+ <uri>http://www.npr.org/</uri>
162
+ </author>
163
+ <link href="http://api.npr.org/query?id=167180399&amp;apiKey=API_KEY" rel="alternate"/>
164
+ <link href="http://www.npr.org/2012/12/06/166593065/why-no-ones-going-to-timbuktu-these-days" rel="related" type="text/html" title=" Why No One's Going To Timbuktu These Days"/>
165
+ <link href="http://www.npr.org/2012/12/04/166519642/morocco-warns-of-growing-terrorist-threat-in-mali" rel="related" type="text/html" title=" Morocco Warns Of Growing Terrorist Threat In Mali"/>
166
+ <link href="http://www.npr.org/2012/08/07/157998664/mali-in-crisis-fractures-along-twin-fault-lines" rel="related" type="text/html" title=" Mali In Crisis Fractures Along Twin Fault Lines"/>
167
+ </entry>
168
+ <entry>
169
+ <title>Drought Continues: Farmers, Shippers Feel Pressure</title>
170
+ <summary>The United States is facing its worst drought since the 1950s, according to the National Oceanic and Atmospheric Administration. With little to no signs of relief on the horizon, many analysts expect conditions to worsen well into next year.</summary>
171
+ <id>http://api.npr.org/query?id=167180403</id>
172
+ <category term="1091" label="Around the Nation"/>
173
+ <category term="1025" label="Environment"/>
174
+ <published>2012-12-13T13:00:00-05:00</published>
175
+ <updated>2012-12-13T14:17:06-05:00</updated>
176
+ <author>
177
+ <name>National Public Radio</name>
178
+ <uri>http://www.npr.org/</uri>
179
+ </author>
180
+ <link href="http://api.npr.org/query?id=167180403&amp;apiKey=API_KEY" rel="alternate"/>
181
+ <link href="http://www.npr.org/2012/11/23/165667600/an-arbor-embolism-why-trees-die-in-drought" rel="related" type="text/html" title=" An Arbor Embolism? Why Trees Die In Drought"/>
182
+ <link href="http://www.npr.org/2012/10/03/162232865/planning-for-a-sustainable-mississippi-river" rel="related" type="text/html" title=" Planning For A Sustainable Mississippi River"/>
183
+ <link href="http://www.npr.org/2012/08/21/159485936/drought-dries-up-crops-but-not-airline-schedules" rel="related" type="text/html" title=" Drought Dries Up Crops, But Not Airline Schedules"/>
184
+ </entry>
185
+ <entry>
186
+ <title>Open Or Closed-Book Exams: Which Style Works Best?</title>
187
+ <summary>Afshin Gharib, a psychology professor at Dominican University of California, prefers to give open-book tests. His colleague William Phillips only lets students use cheat sheets. After several arguments about the techniques, they decided to conduct an experiment to find out which method works best.</summary>
188
+ <id>http://api.npr.org/query?id=167180405</id>
189
+ <category term="1057" label="Opinion"/>
190
+ <category term="1013" label="Education"/>
191
+ <published>2012-12-13T13:00:00-05:00</published>
192
+ <updated>2012-12-13T14:08:02-05:00</updated>
193
+ <author>
194
+ <name>National Public Radio</name>
195
+ <uri>http://www.npr.org/</uri>
196
+ </author>
197
+ <link href="http://api.npr.org/query?id=167180405&amp;apiKey=API_KEY" rel="alternate"/>
198
+ </entry>
199
+ <entry>
200
+ <title>No Alarm Sounded When The West Virginia Pipeline Exploded</title>
201
+ <summary>The NTSB is investigating why no warning sounded in the control center of pipeline operator, Columbia Gas Transmission, when the explosion occurred.</summary>
202
+ <id>http://api.npr.org/query?id=167169109</id>
203
+ <category term="167169585" label="West Virginia explosion"/>
204
+ <category term="130208826" label="gas pipeline explosion"/>
205
+ <category term="127602855" label="America"/>
206
+ <category term="127602334" label="Accidents and Disasters"/>
207
+ <category term="103943429" label="The Two-Way"/>
208
+ <published>2012-12-13T12:26:00-05:00</published>
209
+ <updated>2012-12-13T12:26:24-05:00</updated>
210
+ <author>
211
+ <name>National Public Radio</name>
212
+ <uri>http://www.npr.org/</uri>
213
+ </author>
214
+ <contributor>
215
+ <name>Korva Coleman</name>
216
+ </contributor>
217
+ <link href="http://api.npr.org/query?id=167169109&amp;apiKey=API_KEY" rel="alternate"/>
218
+ <link href="http://media.npr.org/assets/img/2012/12/13/ntsb_custom-146b1ff151f7305817057c0d852f726ce62e9367.jpg" rel="related" title="Investigators examine a 20-foot long section of gas pipeline found more than 40 feet from the rupture site north of Charleston, W. Va." length="100000"/>
219
+ <link href="http://media.npr.org/assets/img/2012/12/13/sissonvilletwoway2012_custom-8a3e86fa855d7d86a73adda5f930bca5b0d97248.jpg" rel="related" title="A fireball over Interstate 77 after a gas line ruptured in Sissonville, W. Va. on Tuesday, Dec. 11." length="100000"/>
220
+ </entry>
221
+ <entry>
222
+ <title>Caution: Walking Under The Influence Of Mobile Devices</title>
223
+ <summary>Nearly a third of pedestrians crossing som of Seattle's most dangerous intersections were were doing something distracting at the same time. People texting were four times more likely to cross the street without looking both ways.</summary>
224
+ <id>http://api.npr.org/query?id=167150785</id>
225
+ <category term="133783954" label="pedestrians"/>
226
+ <category term="128466483" label="accident"/>
227
+ <category term="126567525" label="Your Health"/>
228
+ <category term="103537970" label="Shots - Health News"/>
229
+ <category term="1128" label="Health"/>
230
+ <category term="1066" label="Your Health"/>
231
+ <category term="1002" label="Home Page Top Stories"/>
232
+ <category term="1001" label="News"/>
233
+ <published>2012-12-13T12:18:00-05:00</published>
234
+ <updated>2012-12-13T12:18:10-05:00</updated>
235
+ <author>
236
+ <name>National Public Radio</name>
237
+ <uri>http://www.npr.org/</uri>
238
+ </author>
239
+ <contributor>
240
+ <name>Scott Hensley</name>
241
+ </contributor>
242
+ <link href="http://api.npr.org/query?id=167150785&amp;apiKey=API_KEY" rel="alternate"/>
243
+ <link href="http://www.npr.org/blogs/alltechconsidered/2012/11/11/164876282/distracted-driving-were-all-guilty-so-what-should-we-do-about-it" rel="related" type="text/html" title=" Distracted Driving: We're All Guilty, So What Should We Do About It?"/>
244
+ <link href="http://media.npr.org/assets/img/2012/12/13/pedestrians_custom-c59de5330e61059f6396761a4dfab8643b308cc6.jpg" rel="related" title="He better not be talking to his mom." length="100000"/>
245
+ </entry>
246
+ <entry>
247
+ <title>From A Life Of Crime To Designing Jewelry, All In A Nairobi Slum </title>
248
+ <summary>Zakale Creations is a jewelry-designing operation that employs 30 young people — former thieves and prostitutes. The Nairobi-based operation is the brainchild of John Mucheru, himself a former mugger.</summary>
249
+ <id>http://api.npr.org/query?id=167120895</id>
250
+ <category term="127602464" label="International"/>
251
+ <category term="126947040" label="Kenya"/>
252
+ <category term="125941912" label="Africa"/>
253
+ <category term="103943429" label="The Two-Way"/>
254
+ <category term="1126" label="Africa"/>
255
+ <category term="1004" label="World"/>
256
+ <category term="1001" label="News"/>
257
+ <published>2012-12-13T12:16:00-05:00</published>
258
+ <updated>2012-12-13T12:17:00-05:00</updated>
259
+ <author>
260
+ <name>National Public Radio</name>
261
+ <uri>http://www.npr.org/</uri>
262
+ </author>
263
+ <contributor>
264
+ <name>John Burnett</name>
265
+ </contributor>
266
+ <link href="http://api.npr.org/query?id=167120895&amp;apiKey=API_KEY" rel="alternate"/>
267
+ <link href="http://media.npr.org/assets/img/2012/12/12/working-1f2f198931504fc70af17a09bb28a3f77080de2c.jpg" rel="related" title="Zakale Creations is a jewelry-designing operation that employs 30 young people who were previously involved in crime. The Nairobi-based operation is the brainchild of John Mucheru, himself a former mugger." length="100000"/>
268
+ <link href="http://media.npr.org/assets/img/2012/12/12/mucheru_vert-4fbf6208b5a39dcf8b99aa8ecabad3463e8db372.jpg" rel="related" title="John Mucheru of Zakale Creations poses with his jewelry designs in Nairobi's Huruma slum." length="100000"/>
269
+ </entry>
270
+ <entry>
271
+ <title>Here's Some Good News: Volunteering Is On The Rise </title>
272
+ <summary>A holiday reminder of how generous many Americans are: More than 64 million people volunteered through a formal organization in 2011, a new report shows. That was up from the year before and part of a trend.</summary>
273
+ <id>http://api.npr.org/query?id=167165264</id>
274
+ <category term="167165375" label="good news"/>
275
+ <category term="164716592" label="Two-Way Featured Post One"/>
276
+ <category term="157646475" label="volunteering"/>
277
+ <category term="127602855" label="America"/>
278
+ <category term="103943429" label="The Two-Way"/>
279
+ <category term="1091" label="Around the Nation"/>
280
+ <category term="1003" label="U.S."/>
281
+ <category term="1002" label="Home Page Top Stories"/>
282
+ <category term="1001" label="News"/>
283
+ <published>2012-12-13T12:09:00-05:00</published>
284
+ <updated>2012-12-13T12:33:09-05:00</updated>
285
+ <author>
286
+ <name>National Public Radio</name>
287
+ <uri>http://www.npr.org/</uri>
288
+ </author>
289
+ <contributor>
290
+ <name>Mark Memmott</name>
291
+ </contributor>
292
+ <link href="http://api.npr.org/query?id=167165264&amp;apiKey=API_KEY" rel="alternate"/>
293
+ <link href="http://media.npr.org/assets/img/2012/12/13/volunteers132way-a7599584b2168b2873ae249f672d829257d64800.jpg" rel="related" title="Nov. 22: Volunteers prepared Thanksgiving dinners for people in the Queens borough of New York City, which was hit hard by Superstorm Sandy." length="100000"/>
294
+ </entry>
295
+ <entry>
296
+ <title>Promiscuous Males And Choosy Females? Challenging A Classic Experiment</title>
297
+ <summary>We've all heard them: explanations rooted in evolutionary biology for why "promiscuous" males mate with many more partners than "choosy" females. Barbara J. King traces these widespread assumptions to a famous 1948 study on fruitflies — a study that a group of modern-day scientists now say was badly flawed.</summary>
298
+ <id>http://api.npr.org/query?id=166953517</id>
299
+ <category term="167156988" label="Wyatt Anderson"/>
300
+ <category term="167156940" label="Yong-Kyu Kim"/>
301
+ <category term="167156938" label="Patricia Gowaty"/>
302
+ <category term="167156899" label="Sarah Hrdy"/>
303
+ <category term="167156864" label="Robert Trivers"/>
304
+ <category term="167156862" label="Discover Magazine"/>
305
+ <category term="167156858" label="A.J. Bateman"/>
306
+ <category term="155796397" label="sexuality"/>
307
+ <category term="140934343" label="fruit flies"/>
308
+ <category term="129859342" label="Science"/>
309
+ <category term="114424647" label="13.7: Cosmos And Culture"/>
310
+ <category term="1060" label="Commentary"/>
311
+ <published>2012-12-13T12:01:00-05:00</published>
312
+ <updated>2012-12-13T12:01:11-05:00</updated>
313
+ <author>
314
+ <name>National Public Radio</name>
315
+ <uri>http://www.npr.org/</uri>
316
+ </author>
317
+ <contributor>
318
+ <name>Barbara J. King</name>
319
+ </contributor>
320
+ <link href="http://api.npr.org/query?id=166953517&amp;apiKey=API_KEY" rel="alternate"/>
321
+ <link href="http://media.npr.org/assets/img/2012/12/13/istock-000006634650-fruit-fly_brick-2ba2bc40bc5cc957bab4ec52fedc36c04d290d67.jpg" rel="related" title="A male fruit fly (Drosophila melanogaster)" length="100000"/>
322
+ </entry>
323
+ <entry>
324
+ <title>The Steamy Inspiration Of Miguel's Music</title>
325
+ <summary>Six-time Grammy nominee Miguel is heating up the airwaves with his newest album, &lt;em&gt;Kaleidoscope Dream&lt;/em&gt;. Miguel sat down with host Michel Martin to discuss his musical style and why he wants to challenge stereotypes about R&amp;B. &lt;strong&gt;*Advisory: &lt;/strong&gt; This conversation may not be suitable for all listeners.</summary>
326
+ <id>http://api.npr.org/query?id=167164055</id>
327
+ <category term="1105" label="Music Interviews"/>
328
+ <category term="1039" label="Music"/>
329
+ <published>2012-12-13T14:07:00-05:00</published>
330
+ <updated>2012-12-13T14:08:52-05:00</updated>
331
+ <author>
332
+ <name>National Public Radio</name>
333
+ <uri>http://www.npr.org/</uri>
334
+ </author>
335
+ <contributor>
336
+ <name>NPR Staff</name>
337
+ </contributor>
338
+ <link href="http://api.npr.org/query?id=167164055&amp;apiKey=API_KEY" rel="alternate"/>
339
+ <link href="http://media.npr.org/assets/img/2012/12/13/miguel1_wide-791460d0789668dbaa029da55d20b28ae1d7fc66.jpg" rel="related" length="100000"/>
340
+ <link href="http://media.npr.org/assets/img/2012/12/13/miguelbwjpg_sq-53ce7fde44c7f4e16dfc7278a94a9a6afaf82159.jpg" rel="related" length="100000"/>
341
+ <link href="http://pd.npr.org/anon.npr-mp3/npr/tmm/2012/12/20121213_tmm_04.mp3?orgId=1&amp;topicId=1105" rel="enclosure" type="audio/mp3" title="Story Segment Audio" length="784"/>
342
+ <link href="http://api.npr.org/m3u/1167165903-7bb3c6.m3u?orgId=1&amp;topicId=1105" rel="enclosure" type="audio/mp3" title="Story Segment Audio" length="784"/>
343
+ </entry>
344
+ </feed>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+
4
+ <title>An unexpected error has occurred</title>
5
+ <subtitle>Please visit http://www.npr.org/contact/ and select the office 'Online / Technical Support' to contact us for assistance.</subtitle>
6
+ <id>http://www.npr.org/query</id>
7
+ <updated>2008-01-01T01:00:00Z</updated>
8
+
9
+ </feed>
@@ -0,0 +1,59 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom" xmlns:nprml="http://api.npr.org/nprml">
3
+ <title type="text">NPR: Stories from NPR</title>
4
+ <subtitle type="text">Custom NPR News Feed API. Visit http://www.npr.org/templates/apidoc/index.php for more information.</subtitle>
5
+ <id>http://api.npr.org/query?id=166956822,167055503</id>
6
+ <link rel="self" type="application/atom+xml" href="http://api.npr.org/query?id=166956822,167055503&amp;apiKey=API_KEY"/>
7
+ <rights>Copyright(c) 2012, NPR</rights>
8
+ <generator uri="http://api.npr.org/query" version="0.94">NPR API</generator>
9
+ <updated>2012-12-13T14:53:00-05:00</updated>
10
+ <entry>
11
+ <title>Why Legos Are So Expensive — And So Popular</title>
12
+ <summary>Legos often cost twice as much as similar blocks from a rival toymaker. So why are Legos so much more popular than other brands?</summary>
13
+ <id>http://api.npr.org/query?id=167055503</id>
14
+ <category term="127424471" label="Trade"/>
15
+ <category term="93559255" label="Planet Money"/>
16
+ <category term="1090" label="Story of the Day"/>
17
+ <category term="1006" label="Business"/>
18
+ <category term="1002" label="Home Page Top Stories"/>
19
+ <published>2012-12-13T14:53:00-05:00</published>
20
+ <updated>2012-12-13T20:19:03-05:00</updated>
21
+ <author>
22
+ <name>National Public Radio</name>
23
+ <uri>http://www.npr.org/</uri>
24
+ </author>
25
+ <contributor>
26
+ <name>Chana Joffe-Walt</name>
27
+ </contributor>
28
+ <link href="http://api.npr.org/query?id=167055503&amp;apiKey=API_KEY" rel="alternate"/>
29
+ <link href="http://media.npr.org/assets/img/2012/12/13/lego-bd8bfadf3ae10931a86b1b0c0377ffdda6118511.jpg" rel="related" title="Lego vs. Mega" length="100000"/>
30
+ <link href="http://pd.npr.org/anon.npr-mp3/npr/atc/2012/12/20121213_atc_17.mp3?orgId=1&amp;topicId=1006" rel="enclosure" type="audio/mp3" title="Story Segment Audio" length="295"/>
31
+ <link href="http://api.npr.org/m3u/1167199727-2d6035.m3u?orgId=1&amp;topicId=1006" rel="enclosure" type="audio/mp3" title="Story Segment Audio" length="295"/>
32
+ </entry>
33
+ <entry>
34
+ <title>How The Rich Feel About Paying More Taxes</title>
35
+ <summary>Many people earning more than $250,000 a year — the 2 percent — admit they can afford to pay more in taxes. However, they don't necessarily like the idea, especially when they're made to feel like skinflints even though they're already sending significant sums to Washington.</summary>
36
+ <id>http://api.npr.org/query?id=166956822</id>
37
+ <category term="1091" label="Around the Nation"/>
38
+ <category term="1018" label="Your Money"/>
39
+ <category term="1017" label="Economy"/>
40
+ <category term="1014" label="Politics"/>
41
+ <category term="1003" label="U.S."/>
42
+ <category term="1002" label="Home Page Top Stories"/>
43
+ <category term="1001" label="News"/>
44
+ <published>2012-12-13T11:22:00-05:00</published>
45
+ <updated>2012-12-13T11:30:47-05:00</updated>
46
+ <author>
47
+ <name>National Public Radio</name>
48
+ <uri>http://www.npr.org/</uri>
49
+ </author>
50
+ <contributor>
51
+ <name>Alan Greenblatt</name>
52
+ </contributor>
53
+ <link href="http://api.npr.org/query?id=166956822&amp;apiKey=API_KEY" rel="alternate"/>
54
+ <link href="http://media.npr.org/assets/img/2012/12/13/2_percent_wide-351306ded352abaae0744bc5b0de67eafc1dda81.jpg" rel="related" title="How much income tax should the top 2 percent of U.S. earners pay? Just about everyone has an opinion, but the opinions that count are those of President Obama and House Speaker John Boehner." length="100000"/>
55
+ <link href="http://media.npr.org/assets/img/2012/12/13/JeffreyFisher-7ffa28181086a95e38f694233f2c84e61e1b89f9.jpg" rel="related" title="Jeffrey Fisher of Florida says any tax increase ought to be accompanied by cuts to government programs." length="100000"/>
56
+ <link href="http://media.npr.org/assets/img/2012/12/13/MarkAnderson-b3c3af4fdc78893f06579a533f2495064da41dff.jpg" rel="related" title="Mark Anderson of St. Louis thinks President Obama and other Democrats make being rich &quot;sound like a bad thing,&quot; something he says is a mistake." length="100000"/>
57
+ <link href="http://media.npr.org/assets/img/2012/12/13/StephenPrince-3321230cfed09a1c5277ce228931b15056bc0d09.jpg" rel="related" title="Stephen Prince of Tennessee says the conditions that create wealth are at risk if the rich are too &quot;greedy&quot; to pay more in taxes." length="100000"/>
58
+ </entry>
59
+ </feed>
@@ -0,0 +1,65 @@
1
+ ##
2
+ # A script to automatically fetch fixtures from
3
+ # the NPR API. Also removes API Key in responses.
4
+ #
5
+ # ARGS:
6
+ # 1. -k / --key API Key
7
+ # 2. -i / --id Story ID
8
+ # 3. -f / --filename Filename (no dir or ext, eg. 03_story_multiple)
9
+ #
10
+ # Run from command line from the +fixtures+ folder. Example:
11
+ #
12
+ # export KEY="YOUR_API_KEY"
13
+ # ruby fetch_formats.rb --key `echo $KEY` --id 166946294 --filename 04_story_multiple_bylines
14
+ #
15
+ require "optparse"
16
+ require "net/http"
17
+ require "uri"
18
+
19
+ # Parse command line arguments
20
+ options = {}
21
+
22
+ OptionParser.new do |opts|
23
+ opts.banner = "Usage: ruby fetch_formats.rb [ARGS]"
24
+
25
+ opts.on('-k', '--key KEY', 'Your NPR API Key') do |key|
26
+ options[:key] = key
27
+ end
28
+
29
+ opts.on('-i', '--id ID', 'The ID of the story to fetch') do |id|
30
+ options[:id] = id
31
+ end
32
+
33
+ opts.on('-f', '--filename [FILENAME]', 'The filename to write to (no extension)') do |filename|
34
+ options[:filename] = filename || "story_#{options[:id]}"
35
+ end
36
+ end.parse!
37
+
38
+
39
+ # Map of outputs => extensions
40
+ ext_map = {
41
+ "nprml" => "xml",
42
+ "json" => "json",
43
+ "js" => "js",
44
+ "html" => "html",
45
+ "rss" => "rss",
46
+ "mediarss" => "rss",
47
+ "podcast" => "rss",
48
+ "atom" => "atom"
49
+ }
50
+
51
+ # The fun stuff
52
+ ext_map.keys.each do |output|
53
+ puts "Fetching #{output}..."
54
+
55
+ uri = URI.parse("http://api.npr.org/query?apiKey=#{options[:key]}&id=#{options[:id]}&output=#{output}")
56
+ response = Net::HTTP.get_response(uri).body
57
+
58
+ # Remove API Key from responses
59
+ if !options[:key].empty? && !options[:key].nil?
60
+ response.gsub!(/#{options[:key]}/, "API_KEY")
61
+ end
62
+
63
+ file = "#{output}/#{options[:filename]}.#{ext_map[output]}"
64
+ File.open(file, "w") { |f| f.puts response }
65
+ end