buzzsprout 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -17,5 +17,6 @@ tmtags
17
17
  coverage
18
18
  rdoc
19
19
  pkg
20
+ .yardoc
20
21
 
21
22
  ## PROJECT::SPECIFIC
data/.yardopts ADDED
@@ -0,0 +1,7 @@
1
+ --readme README.md
2
+ --markup markdown
3
+ --markup-provider rdiscount
4
+ --default-return nil
5
+ -p ../yardoc_templates
6
+ -o ../../sites/wynn/public/projects/buzzsprout/api
7
+ --no-private
data/README.md CHANGED
@@ -8,19 +8,19 @@ Ruby wrapper for the (yet unreleased, undocumented) [Buzzsprout](http://buzzspro
8
8
 
9
9
  ## Usage
10
10
 
11
- ### Getting a list of episodes
11
+ Getting a list of episodes
12
12
 
13
13
  # get your podcast ID from your RSS feed http://www.buzzsprout.com/105.rss
14
14
  >> Buzzsprout.episodes(105)
15
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
16
 
17
17
 
18
- ### Get a list of tagged episodes
18
+ Get a list of tagged episodes
19
19
  >> tags = %w(git github)
20
20
  >> Buzzsprout.episodes(105, tags)
21
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
22
 
23
- ### Get a single episode
23
+ Get a single episode
24
24
  # podcast_id, episode_id
25
25
  >> Buzzsprout.episodes(105, 2274)
26
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>
data/Rakefile CHANGED
@@ -8,13 +8,13 @@ begin
8
8
  gem.summary = %Q{Ruby wrapper for the stealth mode Buzzsprout API}
9
9
  gem.description = %Q{Ruby wrapper for the stealth mode Buzzsprout API}
10
10
  gem.email = "wynn.netherland@gmail.com"
11
- gem.homepage = "http://github.com/pengwynn/buzzsprout"
11
+ gem.homepage = "http://wynnnetherland.com/projects/buzzsprout"
12
12
  gem.authors = ["Wynn Netherland"]
13
13
  gem.add_dependency('activesupport', '>= 2.3.2')
14
- gem.add_dependency('hashie', '>= 0.1.3')
14
+ gem.add_dependency('hashie', '>= 0.2.0')
15
15
  gem.add_dependency('httparty', '>= 0.5.0')
16
16
 
17
- gem.add_development_dependency('thoughtbot-shoulda', '>= 2.10.1')
17
+ gem.add_development_dependency('shoulda', '>= 2.10.1')
18
18
  gem.add_development_dependency('jnunemaker-matchy', '0.4.0')
19
19
  gem.add_development_dependency('fakeweb', '>= 1.2.5')
20
20
  gem.add_development_dependency "yard", ">= 0"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/lib/buzzsprout.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'time'
3
- gem 'activesupport', '>= 2.3.2'
3
+ gem 'activesupport', '~> 2.3.2'
4
4
  require 'activesupport'
5
5
 
6
6
  gem 'hashie', '>= 0.1.3'
@@ -17,10 +17,20 @@ Hash.send :include, Hashie::HashExtensions
17
17
 
18
18
  module Buzzsprout
19
19
 
20
+ # List all the episodes for a podcast
21
+ #
22
+ # @param [Fixnum] podcast_id The ID for the podcast
23
+ # @param [Array<String>] tags An array of tags to filter episodes
24
+ # @return [Array<Episode>] A list of episodes matching the query
20
25
  def self.episodes(podcast_id, tags=[])
21
26
  Client.episodes(podcast_id, tags)
22
27
  end
23
28
 
29
+ # Retrieve episode details
30
+ #
31
+ # @param [Fixnum] podcast_id The ID for the podcast
32
+ # @param [Fixnum] episode_id The ID for the episode
33
+ # @return [Episode] A list of episodes matching the query
24
34
  def self.episode(podcast_id, episode_id)
25
35
  Client.episode(podcast_id, episode_id)
26
36
  end
@@ -5,6 +5,11 @@ module Buzzsprout
5
5
  format :json
6
6
  base_uri "http://www.buzzsprout.com"
7
7
 
8
+ # List all the episodes for a podcast
9
+ #
10
+ # @param [Fixnum] podcast_id The ID for the podcast
11
+ # @param [Array<String>] tags An array of tags to filter episodes
12
+ # @return [Array<Episode>] A list of episodes matching the query
8
13
  def self.episodes(podcast_id, tags=[])
9
14
  query = {}
10
15
  tags = tags.join(",") if tags.is_a?(Array)
@@ -13,6 +18,11 @@ module Buzzsprout
13
18
  response.map{|item| Buzzsprout::Episode.new(item['episode'])}
14
19
  end
15
20
 
21
+ # Retrieve episode details
22
+ #
23
+ # @param [Fixnum] podcast_id The ID for the podcast
24
+ # @param [Fixnum] episode_id The ID for the episode
25
+ # @return [Episode] A list of episodes matching the query
16
26
  def self.episode(podcast_id, episode_id)
17
27
  Buzzsprout::Episode.new(self.get("/#{podcast_id}/#{episode_id}.json")['episode'])
18
28
  end
@@ -1,7 +1,7 @@
1
-
2
1
  module Buzzsprout
3
2
  class Episode < Hashie::Dash
4
3
  property :s3
4
+ # Gets/sets the episode artist
5
5
  property :artist
6
6
  property :size
7
7
  property :title
@@ -15,30 +15,42 @@ module Buzzsprout
15
15
  property :updated_at
16
16
  property :created_at
17
17
 
18
+ # Has the episode been uploaded to S3?
19
+ # @return [true,false] Boolean indicating whether or not the episode is on S3
18
20
  def s3?
19
21
  !!self[:s3]
20
22
  end
21
23
 
24
+ # Has the episode been published?
25
+ # @return [true,false] Boolean indicating whether or not the episode has been published
22
26
  def live?
23
27
  !!self[:live]
24
28
  end
25
29
 
30
+ # Formatted duration
31
+ # @return [String] duration formatted as time
26
32
  def duration
27
33
  segments = [self[:duration]/60]
28
34
  segments << (self[:duration] % 60 )
29
35
  segments.map {|t| t.to_s.rjust(2, '0')}.join(':')
30
36
  end
31
37
 
38
+ # Set the duration
39
+ # @param [String] duration as time
32
40
  def duration=(value)
33
41
  new_duration = value.to_s.split(":").reverse
34
42
  s, m = new_duration
35
43
  self[:duration] = (s.to_i + (m.to_i*60))
36
44
  end
37
45
 
46
+ # Duration in seconds
47
+ # @return [Integer] duration in seconds
38
48
  def duration_in_seconds
39
49
  self[:duration]
40
50
  end
41
51
 
52
+ # List of tags
53
+ # @return [Array<String>] array of tags for this episode
42
54
  def tags
43
55
  self[:tags].split(",")
44
56
  end
data/test/helper.rb CHANGED
@@ -2,13 +2,14 @@ require 'test/unit'
2
2
  require 'pathname'
3
3
  require 'rubygems'
4
4
 
5
- gem 'thoughtbot-shoulda', '>= 2.10.1'
5
+ gem 'shoulda', '>= 2.10.1'
6
6
  gem 'jnunemaker-matchy', '0.4.0'
7
7
  gem 'fakeweb', '>= 1.2.5'
8
8
 
9
9
  require 'shoulda'
10
10
  require 'matchy'
11
11
  require 'fakeweb'
12
+ require 'redgreen'
12
13
 
13
14
 
14
15
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buzzsprout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 2
9
+ version: 0.0.2
5
10
  platform: ruby
6
11
  authors:
7
12
  - Wynn Netherland
@@ -9,79 +14,105 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-01-26 00:00:00 -06:00
17
+ date: 2010-06-12 00:00:00 -05:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: activesupport
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 3
30
+ - 2
23
31
  version: 2.3.2
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: hashie
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
33
- version: 0.1.3
34
- version:
41
+ segments:
42
+ - 0
43
+ - 2
44
+ - 0
45
+ version: 0.2.0
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
49
  name: httparty
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - ">="
42
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ - 5
58
+ - 0
43
59
  version: 0.5.0
44
- version:
60
+ type: :runtime
61
+ version_requirements: *id003
45
62
  - !ruby/object:Gem::Dependency
46
- name: thoughtbot-shoulda
47
- type: :development
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
63
+ name: shoulda
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
50
66
  requirements:
51
67
  - - ">="
52
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 2
71
+ - 10
72
+ - 1
53
73
  version: 2.10.1
54
- version:
74
+ type: :development
75
+ version_requirements: *id004
55
76
  - !ruby/object:Gem::Dependency
56
77
  name: jnunemaker-matchy
57
- type: :development
58
- version_requirement:
59
- version_requirements: !ruby/object:Gem::Requirement
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
60
80
  requirements:
61
81
  - - "="
62
82
  - !ruby/object:Gem::Version
83
+ segments:
84
+ - 0
85
+ - 4
86
+ - 0
63
87
  version: 0.4.0
64
- version:
88
+ type: :development
89
+ version_requirements: *id005
65
90
  - !ruby/object:Gem::Dependency
66
91
  name: fakeweb
67
- type: :development
68
- version_requirement:
69
- version_requirements: !ruby/object:Gem::Requirement
92
+ prerelease: false
93
+ requirement: &id006 !ruby/object:Gem::Requirement
70
94
  requirements:
71
95
  - - ">="
72
96
  - !ruby/object:Gem::Version
97
+ segments:
98
+ - 1
99
+ - 2
100
+ - 5
73
101
  version: 1.2.5
74
- version:
102
+ type: :development
103
+ version_requirements: *id006
75
104
  - !ruby/object:Gem::Dependency
76
105
  name: yard
77
- type: :development
78
- version_requirement:
79
- version_requirements: !ruby/object:Gem::Requirement
106
+ prerelease: false
107
+ requirement: &id007 !ruby/object:Gem::Requirement
80
108
  requirements:
81
109
  - - ">="
82
110
  - !ruby/object:Gem::Version
111
+ segments:
112
+ - 0
83
113
  version: "0"
84
- version:
114
+ type: :development
115
+ version_requirements: *id007
85
116
  description: Ruby wrapper for the stealth mode Buzzsprout API
86
117
  email: wynn.netherland@gmail.com
87
118
  executables: []
@@ -94,6 +125,7 @@ extra_rdoc_files:
94
125
  files:
95
126
  - .document
96
127
  - .gitignore
128
+ - .yardopts
97
129
  - LICENSE
98
130
  - README.md
99
131
  - Rakefile
@@ -107,7 +139,7 @@ files:
107
139
  - test/helper.rb
108
140
  - test/test_buzzsprout.rb
109
141
  has_rdoc: true
110
- homepage: http://github.com/pengwynn/buzzsprout
142
+ homepage: http://wynnnetherland.com/projects/buzzsprout
111
143
  licenses: []
112
144
 
113
145
  post_install_message:
@@ -119,18 +151,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
151
  requirements:
120
152
  - - ">="
121
153
  - !ruby/object:Gem::Version
154
+ segments:
155
+ - 0
122
156
  version: "0"
123
- version:
124
157
  required_rubygems_version: !ruby/object:Gem::Requirement
125
158
  requirements:
126
159
  - - ">="
127
160
  - !ruby/object:Gem::Version
161
+ segments:
162
+ - 0
128
163
  version: "0"
129
- version:
130
164
  requirements: []
131
165
 
132
166
  rubyforge_project:
133
- rubygems_version: 1.3.5
167
+ rubygems_version: 1.3.6
134
168
  signing_key:
135
169
  specification_version: 3
136
170
  summary: Ruby wrapper for the stealth mode Buzzsprout API