broadcast 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,6 +5,8 @@ require 'bundler'
5
5
 
6
6
  Bundler::GemHelper.install_tasks
7
7
 
8
+ import "lib/broadcast/tasks/broadcast.rake"
9
+
8
10
  begin
9
11
 
10
12
  require 'rspec'
@@ -34,7 +34,7 @@ class Broadcast::Medium::Oauth < Broadcast::Medium
34
34
  puts "\nAuthorization complete! Put the following in your Broadcast configuration file:\n\n"
35
35
  puts "Broadcast.setup do |config|\n\n"
36
36
  puts " config.#{namespace}.consumer_key = '#{consumer.key}'"
37
- puts " config.#{namespace}.consumer_secret = '#{consumer.key}'"
37
+ puts " config.#{namespace}.consumer_secret = '#{consumer.secret}'"
38
38
  puts " config.#{namespace}.access_token = '#{access_token.token}'"
39
39
  puts " config.#{namespace}.access_secret = '#{access_token.secret}'"
40
40
  puts "\nend"
@@ -0,0 +1,22 @@
1
+ # This integration was originally prepared by https://github.com/hmaddocks
2
+ require 'net/http'
3
+
4
+ class Broadcast::Medium::Tumblr < Broadcast::Medium::Oauth
5
+
6
+ self.site = "http://www.tumblr.com"
7
+
8
+ def publish(message)
9
+ @consumer = OAuth::Consumer.new(options.consumer_key,
10
+ options.consumer_secret,
11
+ :site => "http://api.tumblr.com")
12
+
13
+ params = {
14
+ "state" => "published",
15
+ "title" => message.subject,
16
+ "body" => message.body,
17
+ }
18
+
19
+ token.post "/v2/blog/#{options.hostname}/post", params
20
+ end
21
+
22
+ end
@@ -1,7 +1,7 @@
1
1
  namespace "broadcast" do
2
-
2
+
3
3
  namespace "authorize" do
4
-
4
+
5
5
  desc "Authorize Broadcast with Yammer and get access token information"
6
6
  task "yammer" do
7
7
  require 'broadcast'
@@ -13,7 +13,13 @@ namespace "broadcast" do
13
13
  require 'broadcast'
14
14
  Broadcast::Medium::Twitter.new.authorize
15
15
  end
16
-
16
+
17
+ desc "Authorize Broadcast with Tumblr and get access token information"
18
+ task "tumblr" do
19
+ require 'broadcast'
20
+ Broadcast::Medium::Tumblr.new.authorize
21
+ end
22
+
17
23
  end
18
-
24
+
19
25
  end
@@ -1,5 +1,5 @@
1
1
  class Broadcast
2
2
 
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
 
5
5
  end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe Broadcast::Medium::Tumblr do
4
+
5
+ describe '.site' do
6
+
7
+ it "should be set to Tumblr OAuth endpoint" do
8
+ Broadcast::Medium::Tumblr.site.should == "http://www.tumblr.com"
9
+ end
10
+
11
+ end
12
+
13
+ describe '#publish' do
14
+
15
+ it "should send a post to twitter with the message body" do
16
+ message = Broadcast::Message::SpecWithContentAndSubject.new
17
+ medium = Broadcast::Medium::Tumblr.new
18
+ token = mock
19
+ params = {
20
+ "state" => "published",
21
+ "title" => "title",
22
+ "body" => "message",
23
+ }
24
+ token.should_receive(:post).with("/v2/blog/spec.tumblr.com/post", params)
25
+ medium.should_receive(:token).and_return(token)
26
+ medium.publish(message)
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -53,4 +53,14 @@ Broadcast.setup { |config|
53
53
  sms.to = '22222222222'
54
54
  }
55
55
 
56
+ config.tumblr { |tumblr|
57
+
58
+ tumblr.hostname = 'spec.tumblr.com'
59
+ tumblr.consumer_key = 'consumerkey'
60
+ tumblr.consumer_secret = 'consumersecret'
61
+ tumblr.access_token = 'accesstoken'
62
+ tumblr.access_secret = 'accesssecret'
63
+
64
+ }
65
+
56
66
  }
@@ -7,6 +7,15 @@ class Broadcast::Message::SpecWithContent < Broadcast::Message
7
7
  end
8
8
  end
9
9
 
10
+ class Broadcast::Message::SpecWithContentAndSubject < Broadcast::Message
11
+ def subject
12
+ "title"
13
+ end
14
+ def body
15
+ "message"
16
+ end
17
+ end
18
+
10
19
  class Broadcast::Message::SpecWithChagingContent < Broadcast::Message
11
20
  def body
12
21
  "message | " + Time.now.to_s
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: broadcast
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marcin Bunsch
@@ -16,11 +16,10 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-06-11 00:00:00 Z
19
+ date: 2011-10-22 00:00:00 +02:00
20
+ default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
- name: hashie
23
- type: :runtime
24
23
  version_requirements: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
@@ -32,9 +31,9 @@ dependencies:
32
31
  version: "0"
33
32
  prerelease: false
34
33
  requirement: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: oauth
37
34
  type: :runtime
35
+ name: hashie
36
+ - !ruby/object:Gem::Dependency
38
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
39
38
  none: false
40
39
  requirements:
@@ -46,9 +45,9 @@ dependencies:
46
45
  version: "0"
47
46
  prerelease: false
48
47
  requirement: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: xmpp4r
51
48
  type: :runtime
49
+ name: oauth
50
+ - !ruby/object:Gem::Dependency
52
51
  version_requirements: &id003 !ruby/object:Gem::Requirement
53
52
  none: false
54
53
  requirements:
@@ -60,9 +59,9 @@ dependencies:
60
59
  version: "0"
61
60
  prerelease: false
62
61
  requirement: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: mail
65
62
  type: :runtime
63
+ name: xmpp4r
64
+ - !ruby/object:Gem::Dependency
66
65
  version_requirements: &id004 !ruby/object:Gem::Requirement
67
66
  none: false
68
67
  requirements:
@@ -74,9 +73,9 @@ dependencies:
74
73
  version: "0"
75
74
  prerelease: false
76
75
  requirement: *id004
77
- - !ruby/object:Gem::Dependency
78
- name: broach
79
76
  type: :runtime
77
+ name: mail
78
+ - !ruby/object:Gem::Dependency
80
79
  version_requirements: &id005 !ruby/object:Gem::Requirement
81
80
  none: false
82
81
  requirements:
@@ -88,9 +87,9 @@ dependencies:
88
87
  version: "0"
89
88
  prerelease: false
90
89
  requirement: *id005
91
- - !ruby/object:Gem::Dependency
92
- name: shout-bot
93
90
  type: :runtime
91
+ name: broach
92
+ - !ruby/object:Gem::Dependency
94
93
  version_requirements: &id006 !ruby/object:Gem::Requirement
95
94
  none: false
96
95
  requirements:
@@ -102,9 +101,9 @@ dependencies:
102
101
  version: "0"
103
102
  prerelease: false
104
103
  requirement: *id006
105
- - !ruby/object:Gem::Dependency
106
- name: koala
107
104
  type: :runtime
105
+ name: shout-bot
106
+ - !ruby/object:Gem::Dependency
108
107
  version_requirements: &id007 !ruby/object:Gem::Requirement
109
108
  none: false
110
109
  requirements:
@@ -116,9 +115,9 @@ dependencies:
116
115
  version: "0"
117
116
  prerelease: false
118
117
  requirement: *id007
119
- - !ruby/object:Gem::Dependency
120
- name: smsified
121
118
  type: :runtime
119
+ name: koala
120
+ - !ruby/object:Gem::Dependency
122
121
  version_requirements: &id008 !ruby/object:Gem::Requirement
123
122
  none: false
124
123
  requirements:
@@ -130,6 +129,8 @@ dependencies:
130
129
  version: "0"
131
130
  prerelease: false
132
131
  requirement: *id008
132
+ type: :runtime
133
+ name: smsified
133
134
  description: A broadcasting microframework making publishing of messages to different services easy
134
135
  email:
135
136
  - marcin@futuresimple.com
@@ -157,6 +158,7 @@ files:
157
158
  - lib/broadcast/media/log.rb
158
159
  - lib/broadcast/media/oauth.rb
159
160
  - lib/broadcast/media/sms.rb
161
+ - lib/broadcast/media/tumblr.rb
160
162
  - lib/broadcast/media/twitter.rb
161
163
  - lib/broadcast/media/yammer.rb
162
164
  - lib/broadcast/medium.rb
@@ -172,6 +174,7 @@ files:
172
174
  - spec/lib/broadcast/media/log_spec.rb
173
175
  - spec/lib/broadcast/media/oauth_spec.rb
174
176
  - spec/lib/broadcast/media/sms_spec.rb
177
+ - spec/lib/broadcast/media/tumblr_spec.rb
175
178
  - spec/lib/broadcast/media/twitter_spec.rb
176
179
  - spec/lib/broadcast/media/yammer_spec.rb
177
180
  - spec/lib/broadcast/medium_spec.rb
@@ -180,6 +183,7 @@ files:
180
183
  - spec/spec_helper.rb
181
184
  - spec/support/config.rb
182
185
  - spec/support/examples.rb
186
+ has_rdoc: true
183
187
  homepage: http://github.com/futuresimple/broadcast
184
188
  licenses: []
185
189
 
@@ -209,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
213
  requirements: []
210
214
 
211
215
  rubyforge_project:
212
- rubygems_version: 1.7.2
216
+ rubygems_version: 1.6.2
213
217
  signing_key:
214
218
  specification_version: 3
215
219
  summary: A broadcasting microframework making publishing of messages to different services easy
@@ -222,6 +226,7 @@ test_files:
222
226
  - spec/lib/broadcast/media/log_spec.rb
223
227
  - spec/lib/broadcast/media/oauth_spec.rb
224
228
  - spec/lib/broadcast/media/sms_spec.rb
229
+ - spec/lib/broadcast/media/tumblr_spec.rb
225
230
  - spec/lib/broadcast/media/twitter_spec.rb
226
231
  - spec/lib/broadcast/media/yammer_spec.rb
227
232
  - spec/lib/broadcast/medium_spec.rb