buzzsprout 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Wynn Netherland
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # buzzsprout
2
+
3
+ Ruby wrapper for the (yet unreleased, undocumented) [Buzzsprout](http://buzzsprout.com) API.
4
+
5
+ ## Installation
6
+
7
+ sudo gem install buzzsprout
8
+
9
+ ## Usage
10
+
11
+ ### Getting a list of episodes
12
+
13
+ # get your podcast ID from your RSS feed http://www.buzzsprout.com/105.rss
14
+ >> Buzzsprout.episodes(105)
15
+ => [<#Buzzsprout::Episode artist="Adam Stacoviak and Wynn Netherland" created_at=Mon Jan 25 11:53:02 -0600 2010 date=Mon, 25 Jan 2010 description="Adam and Wynn talk with Chris Wanstrath aka @defunkt from GitHub about the magic of Git, the past, present and future of GitHub, building a bootstrapped startup and some other cool stuff you'll just have to hear for yourself." duration=4675 id=2274 live=true podcast_id=105 s3=true size=37400482 tags="git, github, interview, bootstrapping, business, startups" title="Episode 0.1.0 - Chris Wanstrath from GitHub" updated_at=Mon Jan 25 13:36:42 -0600 2010>]
16
+
17
+
18
+ ### Get a list of tagged episodes
19
+ >> tags = %w(git github)
20
+ >> Buzzsprout.episodes(105, tags)
21
+ => [<#Buzzsprout::Episode artist="Adam Stacoviak and Wynn Netherland" created_at=Mon Jan 25 11:53:02 -0600 2010 date=Mon, 25 Jan 2010 description="Adam and Wynn talk with Chris Wanstrath aka @defunkt from GitHub about the magic of Git, the past, present and future of GitHub, building a bootstrapped startup and some other cool stuff you'll just have to hear for yourself." duration=4675 id=2274 live=true podcast_id=105 s3=true size=37400482 tags="git, github, interview, bootstrapping, business, startups" title="Episode 0.1.0 - Chris Wanstrath from GitHub" updated_at=Mon Jan 25 13:36:42 -0600 2010>]
22
+
23
+ ### Get a single episode
24
+ # podcast_id, episode_id
25
+ >> Buzzsprout.episodes(105, 2274)
26
+ => <#Buzzsprout::Episode artist="Adam Stacoviak and Wynn Netherland" created_at=Mon Jan 25 11:53:02 -0600 2010 date=Mon, 25 Jan 2010 description="Adam and Wynn talk with Chris Wanstrath aka @defunkt from GitHub about the magic of Git, the past, present and future of GitHub, building a bootstrapped startup and some other cool stuff you'll just have to hear for yourself." duration=4675 id=2274 live=true podcast_id=105 s3=true size=37400482 tags="git, github, interview, bootstrapping, business, startups" title="Episode 0.1.0 - Chris Wanstrath from GitHub" updated_at=Mon Jan 25 13:36:42 -0600 2010>
27
+
28
+ ## Note on Patches/Pull Requests
29
+
30
+ * Fork the project.
31
+ * Make your feature addition or bug fix.
32
+ * Add tests for it. This is important so I don't break it in a
33
+ future version unintentionally.
34
+ * Commit, do not mess with rakefile, version, or history.
35
+ (if you want to have your own version, that is fine but
36
+ bump version in a commit by itself I can ignore when I pull)
37
+ * Send me a pull request. Bonus points for topic branches.
38
+
39
+ ## Copyright
40
+
41
+ Copyright (c) 2010 [Wynn Netherland](http://wynnnetherland.com). See LICENSE for details.
@@ -0,0 +1,59 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "buzzsprout"
8
+ gem.summary = %Q{Ruby wrapper for the stealth mode Buzzsprout API}
9
+ gem.description = %Q{Ruby wrapper for the stealth mode Buzzsprout API}
10
+ gem.email = "wynn.netherland@gmail.com"
11
+ gem.homepage = "http://github.com/pengwynn/buzzsprout"
12
+ gem.authors = ["Wynn Netherland"]
13
+ gem.add_dependency('activesupport', '>= 2.3.2')
14
+ gem.add_dependency('hashie', '>= 0.1.3')
15
+ gem.add_dependency('httparty', '>= 0.5.0')
16
+
17
+ gem.add_development_dependency('thoughtbot-shoulda', '>= 2.10.1')
18
+ gem.add_development_dependency('jnunemaker-matchy', '0.4.0')
19
+ gem.add_development_dependency('fakeweb', '>= 1.2.5')
20
+ gem.add_development_dependency "yard", ">= 0"
21
+ end
22
+ Jeweler::GemcutterTasks.new
23
+ rescue LoadError
24
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
25
+ end
26
+
27
+ require 'rake/testtask'
28
+ Rake::TestTask.new(:test) do |test|
29
+ test.libs << 'lib' << 'test'
30
+ test.pattern = 'test/**/test_*.rb'
31
+ test.verbose = true
32
+ end
33
+
34
+ begin
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ end
41
+ rescue LoadError
42
+ task :rcov do
43
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
44
+ end
45
+ end
46
+
47
+ task :test => :check_dependencies
48
+
49
+ task :default => :test
50
+
51
+ require 'rake/rdoctask'
52
+ Rake::RDocTask.new do |rdoc|
53
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
54
+
55
+ rdoc.rdoc_dir = 'rdoc'
56
+ rdoc.title = "buzzsprout #{version}"
57
+ rdoc.rdoc_files.include('README*')
58
+ rdoc.rdoc_files.include('lib/**/*.rb')
59
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,31 @@
1
+ require 'rubygems'
2
+ require 'time'
3
+ gem 'activesupport', '>= 2.3.2'
4
+ require 'activesupport'
5
+
6
+ gem 'hashie', '>= 0.1.3'
7
+ require 'hashie'
8
+
9
+ gem 'httparty', '>= 0.5.0'
10
+ require 'httparty'
11
+
12
+
13
+
14
+ directory = File.expand_path(File.dirname(__FILE__))
15
+
16
+ Hash.send :include, Hashie::HashExtensions
17
+
18
+ module Buzzsprout
19
+
20
+ def self.episodes(podcast_id, tags=[])
21
+ Client.episodes(podcast_id, tags)
22
+ end
23
+
24
+ def self.episode(podcast_id, episode_id)
25
+ Client.episode(podcast_id, episode_id)
26
+ end
27
+
28
+ end
29
+
30
+ require File.join(directory, 'buzzsprout', 'episode')
31
+ require File.join(directory, 'buzzsprout', 'client')
@@ -0,0 +1,21 @@
1
+ module Buzzsprout
2
+
3
+ class Client
4
+ include HTTParty
5
+ format :json
6
+ base_uri "http://www.buzzsprout.com"
7
+
8
+ def self.episodes(podcast_id, tags=[])
9
+ query = {}
10
+ tags = tags.join(",") if tags.is_a?(Array)
11
+ query[:tags] = tags if tags and not tags.empty?
12
+ response = self.get("/#{podcast_id}.json", :query => query)
13
+ response.map{|item| Buzzsprout::Episode.new(item['episode'])}
14
+ end
15
+
16
+ def self.episode(podcast_id, episode_id)
17
+ Buzzsprout::Episode.new(self.get("/#{podcast_id}/#{episode_id}.json")['episode'])
18
+ end
19
+ end
20
+
21
+ end
@@ -0,0 +1,47 @@
1
+
2
+ module Buzzsprout
3
+ class Episode < Hashie::Dash
4
+ property :s3
5
+ property :artist
6
+ property :size
7
+ property :title
8
+ property :tags
9
+ property :date
10
+ property :podcast_id
11
+ property :live
12
+ property :id
13
+ property :description
14
+ property :duration
15
+ property :updated_at
16
+ property :created_at
17
+
18
+ def s3?
19
+ !!self[:s3]
20
+ end
21
+
22
+ def live?
23
+ !!self[:live]
24
+ end
25
+
26
+ def duration
27
+ segments = [self[:duration]/60]
28
+ segments << (self[:duration] % 60 )
29
+ segments.map {|t| t.to_s.rjust(2, '0')}.join(':')
30
+ end
31
+
32
+ def duration=(value)
33
+ new_duration = value.to_s.split(":").reverse
34
+ s, m = new_duration
35
+ self[:duration] = (s.to_i + (m.to_i*60))
36
+ end
37
+
38
+ def duration_in_seconds
39
+ self[:duration]
40
+ end
41
+
42
+ def tags
43
+ self[:tags].split(",")
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,17 @@
1
+ {
2
+ "episode": {
3
+ "s3": true,
4
+ "artist": "Adam Stacoviak and Wynn Netherland",
5
+ "updated_at": "2010-01-25T14:36:42-05:00",
6
+ "size": 37400482,
7
+ "title": "Episode 0.1.0 - Chris Wanstrath from GitHub",
8
+ "tags": "git, github, interview, bootstrapping, business, startups",
9
+ "date": "2010-01-25",
10
+ "podcast_id": 105,
11
+ "live": true,
12
+ "id": 2274,
13
+ "description": "Adam and Wynn talk with Chris Wanstrath aka @defunkt from GitHub about the magic of Git, the past, present and future of GitHub, building a bootstrapped startup and some other cool stuff you'll just have to hear for yourself.",
14
+ "duration": 4675,
15
+ "created_at": "2010-01-25T12:53:02-05:00"
16
+ }
17
+ }
@@ -0,0 +1,170 @@
1
+ [{
2
+ "episode": {
3
+ "s3": true,
4
+ "artist": "Adam Stacoviak and Wynn Netherland",
5
+ "updated_at": "2010-01-25T14:36:42-05:00",
6
+ "size": 37400482,
7
+ "title": "Episode 0.1.0 - Chris Wanstrath from GitHub",
8
+ "tags": "git, github, interview, bootstrapping, business, startups",
9
+ "date": "2010-01-25",
10
+ "podcast_id": 105,
11
+ "live": true,
12
+ "id": 2274,
13
+ "description": "Adam and Wynn talk with Chris Wanstrath aka @defunkt from GitHub about the magic of Git, the past, present and future of GitHub, building a bootstrapped startup and some other cool stuff you'll just have to hear for yourself.",
14
+ "duration": 4675,
15
+ "created_at": "2010-01-25T12:53:02-05:00"
16
+ }
17
+ },
18
+ {
19
+ "episode": {
20
+ "s3": true,
21
+ "artist": "Adam Stacoviak and Wynn Netherland",
22
+ "updated_at": "2010-01-25T16:31:21-05:00",
23
+ "size": 10392587,
24
+ "title": "Episode 0.0.9 - Fix-me, Configliere, and more Node.js",
25
+ "tags": "node-js, javascript, news, ruby, css",
26
+ "date": "2010-01-19",
27
+ "podcast_id": 105,
28
+ "live": true,
29
+ "id": 2190,
30
+ "description": "Adam and Wynn ran down some news highlights with Marshall Culpepper from Appcelerator.",
31
+ "duration": 1299,
32
+ "created_at": "2010-01-19T22:06:02-05:00"
33
+ }
34
+ },
35
+ {
36
+ "episode": {
37
+ "s3": true,
38
+ "artist": "Adam Stacoviak and Wynn Netherland",
39
+ "updated_at": "2010-01-14T11:01:27-05:00",
40
+ "size": 25148636,
41
+ "title": "Episode 0.0.8 - Marshall Culpepper from Appcelerator Titanium",
42
+ "tags": "javascript, mobile, ruby, python, php, interview",
43
+ "date": "2010-01-14",
44
+ "podcast_id": 105,
45
+ "live": true,
46
+ "id": 2131,
47
+ "description": "Adam and Wynn spoke with Marshall Culpepper from Appcelerator about their open source projects Titanium Desktop and Titanium Mobile. ",
48
+ "duration": 3143,
49
+ "created_at": "2010-01-14T10:50:28-05:00"
50
+ }
51
+ },
52
+ {
53
+ "episode": {
54
+ "s3": true,
55
+ "artist": "Adam Stacoviak and Wynn Netherland",
56
+ "updated_at": "2009-12-17T10:33:18-05:00",
57
+ "size": 19880469,
58
+ "title": "Episode 0.0.7 - Mike Dirolf from 10gen and MongoDB",
59
+ "tags": "mongodb, ruby, python, nosql, javascript, 10gen, jobs",
60
+ "date": "2009-12-17",
61
+ "podcast_id": 105,
62
+ "live": true,
63
+ "id": 1959,
64
+ "description": "Adam and Wynn spoke with Mike Dirolf from 10gen about their fast-growing MongoDB project. Mike gave us insight on how MongoDB came about, design decisions, and the future of this cool NoSQL server.",
65
+ "duration": 2485,
66
+ "created_at": "2009-12-17T10:25:27-05:00"
67
+ }
68
+ },
69
+ {
70
+ "episode": {
71
+ "s3": true,
72
+ "artist": "Adam Stacoviak and Wynn Netherland",
73
+ "updated_at": "2009-12-15T11:20:57-05:00",
74
+ "size": 22376939,
75
+ "title": "Episode 0.0.6 - Steven Bristol from LessEverything and weekly news",
76
+ "tags": "guest-hosts, javascript, ruby, rack, rails, erlang, twitter, less",
77
+ "date": "2009-12-15",
78
+ "podcast_id": 105,
79
+ "live": true,
80
+ "id": 1935,
81
+ "description": "In this episode, Adam, Wynn, and Steven Bristol discuss Erlang, Javascript on the server, Lighthouse, Docsplit, Rackamole/whackamole, unfollowing under-performing Twitter peeps, and suing domain squatters.",
82
+ "duration": 2797,
83
+ "created_at": "2009-12-15T11:11:04-05:00"
84
+ }
85
+ },
86
+ {
87
+ "episode": {
88
+ "s3": true,
89
+ "artist": "Adam Stacoviak and Wynn Netherland",
90
+ "updated_at": "2009-12-06T21:08:00-05:00",
91
+ "size": 17208247,
92
+ "title": "Episode 0.0.5 - DocumentCloud",
93
+ "tags": "javascript, open source, rails, ruby, media",
94
+ "date": "2009-12-06",
95
+ "podcast_id": 105,
96
+ "live": true,
97
+ "id": 1908,
98
+ "description": "We interviewed Jeremy Ashkenas Lead Developer at DocumentCloud about their effort to revolutionize the way media organizations gather news. Jeremy discusses their open source projects CloudCrowd, Underscore.js, and JAMMIT that they've released along the way. ",
99
+ "duration": 2151,
100
+ "created_at": "2009-12-06T21:00:33-05:00"
101
+ }
102
+ },
103
+ {
104
+ "episode": {
105
+ "s3": true,
106
+ "artist": "Adam Stacoviak and Wynn Netherland",
107
+ "updated_at": "2009-12-01T13:38:09-05:00",
108
+ "size": 14668518,
109
+ "title": "Episode 0.0.4 - Chrome OS, Thor, and ROaR (30:34)",
110
+ "tags": "google, handbrake, osx, ruby, rails, javascript, thor, testing",
111
+ "date": "2009-12-01",
112
+ "podcast_id": 105,
113
+ "live": true,
114
+ "id": 1876,
115
+ "description": "In this episode we discuss: <a href=\"http://thechangelog.com/post/255853114/google-chrome-os-chromium-os\">Google Chrome OS</a>, <a href=\"http://thechangelog.com/post/256716884/handbrake-0-9-4-released-64-bit-support\">HandBrake 0.9.4</a>, <a href=\"http://thechangelog.com/post/258093819/functional-cocoa-applications-using-webkit\">CocoUI</a>, <a href=\"http://thechangelog.com/post/259540919/rails-2-3-5-released\">Rails 2.3.5</a>, <a href=\"http://thechangelog.com/post/259598588/restler-for-node-js\">Restler</a> &amp; <a href=\"http://thechangelog.com/post/261021600/nodejs-evented-i-o-for-v8-javascript\">Node.js</a>, <a href=\"http://thechangelog.com/post/259987077/riot-an-extremely-fast-running-unit-testing\">Riot</a>, <a href=\"http://thechangelog.com/post/260932630/thor-git-make-developing-with-git-easier\">Thor-Git</a> and <a href=\"http://thechangelog.com/post/261042337/webroar-ruby-rack-rails-application-server\">WebROaR</a>",
116
+ "duration": 1833,
117
+ "created_at": "2009-12-01T13:31:49-05:00"
118
+ }
119
+ },
120
+ {
121
+ "episode": {
122
+ "s3": true,
123
+ "artist": "Adam Stacoviak and Wynn Netherland",
124
+ "updated_at": "2009-11-27T14:52:18-05:00",
125
+ "size": 10404498,
126
+ "title": "Episode 0.0.3 - Google's Go Programming Language",
127
+ "tags": "go, programing language, google, go code",
128
+ "date": "2009-11-27",
129
+ "podcast_id": 105,
130
+ "live": true,
131
+ "id": 1861,
132
+ "description": "We spoke with <a href=\"http://research.google.com/people/r/\">Rob Pike</a>, Principal Engineer at Google and Tech Lead for the <a href=\"http://go-lang.org/\">Google Go</a> team about <a href=\"http://go-lang.org/\">Go</a>.",
133
+ "duration": 1300,
134
+ "created_at": "2009-11-27T06:10:10-05:00"
135
+ }
136
+ },
137
+ {
138
+ "episode": {
139
+ "s3": true,
140
+ "artist": "Adam Stacoviak and Wynn Netherland",
141
+ "updated_at": "2009-11-30T11:54:21-05:00",
142
+ "size": 10312338,
143
+ "title": "Episode 0.0.2 - First weekly show",
144
+ "tags": "asset packaging, javascript, browser, buttons, compass, sass, google go",
145
+ "date": "2009-11-25",
146
+ "podcast_id": 105,
147
+ "live": true,
148
+ "id": 1859,
149
+ "description": "In this episode we discuss: JAMMIT - Rails plugin for asset packaging, Underscore.js the bowtie for jQuery's tux, Google Go, Firefox 3.6 beta 2, Google Chrome OS and creating \"fancy buttons\" with Compass and Sass.",
150
+ "duration": 1289,
151
+ "created_at": "2009-11-26T05:27:48-05:00"
152
+ }
153
+ },
154
+ {
155
+ "episode": {
156
+ "s3": true,
157
+ "artist": "Adam Stacoviak and Wynn Netherland",
158
+ "updated_at": "2009-11-25T17:21:08-05:00",
159
+ "size": 28656567,
160
+ "title": "Episode 0.0.1 - Haml Sass and Compass",
161
+ "tags": "haml, sass, compass, web design, front-end development, css",
162
+ "date": "2009-11-19",
163
+ "podcast_id": 105,
164
+ "live": true,
165
+ "id": 1805,
166
+ "description": "Wynn and I discuss <a href=\"http://haml-lang.com/\">Haml</a>, <a href=\"http://sass-lang.com/\">Sass</a> and <a href=\"http://compass-style.org/\">Compass</a> with the core developers Nathan Weizenbaum (@nex3) and Chris Eppstein (@chriseppstein).",
167
+ "duration": 3582,
168
+ "created_at": "2009-11-19T13:14:24-05:00"
169
+ }
170
+ }]
@@ -0,0 +1,17 @@
1
+ [{
2
+ "episode": {
3
+ "s3": true,
4
+ "artist": "Adam Stacoviak and Wynn Netherland",
5
+ "updated_at": "2009-12-17T10:33:18-05:00",
6
+ "size": 19880469,
7
+ "title": "Episode 0.0.7 - Mike Dirolf from 10gen and MongoDB",
8
+ "tags": "mongodb, ruby, python, nosql, javascript, 10gen, jobs",
9
+ "date": "2009-12-17",
10
+ "podcast_id": 105,
11
+ "live": true,
12
+ "id": 1959,
13
+ "description": "Adam and Wynn spoke with Mike Dirolf from 10gen about their fast-growing MongoDB project. Mike gave us insight on how MongoDB came about, design decisions, and the future of this cool NoSQL server.",
14
+ "duration": 2485,
15
+ "created_at": "2009-12-17T10:25:27-05:00"
16
+ }
17
+ }]
@@ -0,0 +1,42 @@
1
+ require 'test/unit'
2
+ require 'pathname'
3
+ require 'rubygems'
4
+
5
+ gem 'thoughtbot-shoulda', '>= 2.10.1'
6
+ gem 'jnunemaker-matchy', '0.4.0'
7
+ gem 'fakeweb', '>= 1.2.5'
8
+
9
+ require 'shoulda'
10
+ require 'matchy'
11
+ require 'fakeweb'
12
+
13
+
14
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
16
+ require 'buzzsprout'
17
+
18
+ FakeWeb.allow_net_connect = false
19
+
20
+ class Test::Unit::TestCase
21
+ end
22
+
23
+ def fixture_file(filename)
24
+ return '' if filename == ''
25
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
26
+ File.read(file_path)
27
+ end
28
+
29
+ def buzzsprout_url(url)
30
+ url =~ /^http/ ? url : "http://www.buzzsprout.com#{url}"
31
+ end
32
+
33
+ def stub_get(url, filename, options={})
34
+ opts = {:body => fixture_file(filename)}.merge(options)
35
+
36
+ FakeWeb.register_uri(:get, buzzsprout_url(url), opts)
37
+ end
38
+
39
+ def stub_post(url, filename)
40
+ FakeWeb.register_uri(:post, buzzsprout_url(url), :body => fixture_file(filename))
41
+ end
42
+
@@ -0,0 +1,58 @@
1
+ require 'helper'
2
+
3
+ class TestBuzzsprout < Test::Unit::TestCase
4
+ context "When hitting the Buzzsprout API" do
5
+
6
+ should "return a list of episodes for a podcast" do
7
+ stub_get("/105.json", "episode_list.json")
8
+ list = Buzzsprout.episodes(105)
9
+ list.first.title.should == 'Episode 0.1.0 - Chris Wanstrath from GitHub'
10
+ list.last.id.should == 1805
11
+ end
12
+
13
+ should "return a list of tagged episodes for a podcast" do
14
+ stub_get("/105.json?tags=javascript%2Cgithub", "tagged.json")
15
+ list = Buzzsprout.episodes(105, %w(javascript github))
16
+ list.first.title.should == 'Episode 0.0.7 - Mike Dirolf from 10gen and MongoDB'
17
+ list.last.id.should == 1959
18
+ end
19
+
20
+ context "when fetching info for a single episode" do
21
+
22
+ setup do
23
+ stub_get("/105/2274.json", "episode.json")
24
+ @episode = Buzzsprout.episode(105, 2274)
25
+ end
26
+
27
+ should "return info about an episode for a podcast" do
28
+
29
+ @episode.title.should == 'Episode 0.1.0 - Chris Wanstrath from GitHub'
30
+ @episode.id.should == 2274
31
+ end
32
+
33
+ should "display episode duration in a friendly format" do
34
+ @episode.duration.should == "77:55"
35
+ end
36
+
37
+ should "display episode date in a Ruby Date" do
38
+ @episode.date.year.should == 2010
39
+ @episode.date.month.should == 1
40
+ end
41
+
42
+ should "display a tags array" do
43
+ @episode.tags.size.should == 6
44
+ @episode.tags.first.should == 'git'
45
+ end
46
+
47
+ should "indicate if a lesson is on s3 (and processed)" do
48
+ @episode.s3?.should == true
49
+ end
50
+
51
+ should "indicate if a lesson is live" do
52
+ @episode.live?.should == true
53
+ end
54
+ end
55
+
56
+ end
57
+
58
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: buzzsprout
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Wynn Netherland
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-26 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.3.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: hashie
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.3
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: httparty
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.5.0
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: thoughtbot-shoulda
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 2.10.1
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: jnunemaker-matchy
57
+ type: :development
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "="
62
+ - !ruby/object:Gem::Version
63
+ version: 0.4.0
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: fakeweb
67
+ type: :development
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 1.2.5
74
+ version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: yard
77
+ type: :development
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: "0"
84
+ version:
85
+ description: Ruby wrapper for the stealth mode Buzzsprout API
86
+ email: wynn.netherland@gmail.com
87
+ executables: []
88
+
89
+ extensions: []
90
+
91
+ extra_rdoc_files:
92
+ - LICENSE
93
+ - README.md
94
+ files:
95
+ - .document
96
+ - .gitignore
97
+ - LICENSE
98
+ - README.md
99
+ - Rakefile
100
+ - VERSION
101
+ - lib/buzzsprout.rb
102
+ - lib/buzzsprout/client.rb
103
+ - lib/buzzsprout/episode.rb
104
+ - test/fixtures/episode.json
105
+ - test/fixtures/episode_list.json
106
+ - test/fixtures/tagged.json
107
+ - test/helper.rb
108
+ - test/test_buzzsprout.rb
109
+ has_rdoc: true
110
+ homepage: http://github.com/pengwynn/buzzsprout
111
+ licenses: []
112
+
113
+ post_install_message:
114
+ rdoc_options:
115
+ - --charset=UTF-8
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: "0"
123
+ version:
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: "0"
129
+ version:
130
+ requirements: []
131
+
132
+ rubyforge_project:
133
+ rubygems_version: 1.3.5
134
+ signing_key:
135
+ specification_version: 3
136
+ summary: Ruby wrapper for the stealth mode Buzzsprout API
137
+ test_files:
138
+ - test/helper.rb
139
+ - test/test_buzzsprout.rb