twitter_alert 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  module TwitterAlert
2
+
3
+ # This represents the Twitter account you'll use to send DMs from.
2
4
  class Account
5
+
6
+ # Config is a hash that needs :user_name and :password keys.
3
7
  def initialize config
4
8
  # Load hash from yaml file in default location?
5
9
 
@@ -15,6 +19,9 @@ module TwitterAlert
15
19
  )
16
20
  end
17
21
 
22
+ # Sends the text of message to all of the account's followers. Message's class should include the TwitterAlert::Alert Module.
23
+ #
24
+ # Returns true if things went well and false if any DMs failed.
18
25
  def announce message
19
26
  followers.each do |follower|
20
27
  begin
@@ -27,6 +34,7 @@ module TwitterAlert
27
34
  message.mark_sent
28
35
  end
29
36
 
37
+ # Returns an array of ids of all the followers of the account.
30
38
  def followers
31
39
  @client.followers.ids?
32
40
  end
@@ -1,21 +1,35 @@
1
1
  module TwitterAlert
2
+
3
+ # Mix this in to a class you want to represent the messages you'll DM out.
2
4
  module Alert
3
- attr_reader :text, :date, :failed_announcements
4
5
 
6
+ # The text to be DMed out.
7
+ attr_reader :text
8
+
9
+ # The date it should be DMed out.
10
+ attr_reader :date
11
+
12
+ # An array of hashes containing the id and error text of any DMs that didn't work.
13
+ attr_reader :failed_announcements
14
+
15
+ # Text will have to_s called on it. Date will have #to_s and then fed to DateTime.parse
5
16
  def initialize text, date
6
17
  @text = text.to_s
7
18
  @date = DateTime.parse(date.to_s)
8
19
  @failed_announcements = []
9
20
  end
10
21
 
22
+ # Returns boolean based on whether this messages was successfully sent to all followers or not.
11
23
  def sent?
12
24
  @sent
13
25
  end
14
26
 
27
+ # Marks this message as sent unless there are stored failed announcements.
15
28
  def mark_sent
16
29
  @sent = @failed_announcements.empty?
17
30
  end
18
31
 
32
+ # Stores a failed announcement so that you can see who and why the failure occured.
19
33
  def add_failed_announcement follower_id, error_text
20
34
  @failed_announcements << { :follower_id => follower_id, :error_text => error_text }
21
35
  end
@@ -0,0 +1,96 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{twitter_alert}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ben Hamill"]
12
+ s.date = %q{2010-05-14}
13
+ s.description = %q{Create messages, assign a time, then DM all Followers of a Twitter account with those messages as the assigned time.}
14
+ s.email = %q{twitteralert@benhamill.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "doc/LICENSE.html",
27
+ "doc/README_rdoc.html",
28
+ "doc/TwitterAlert.html",
29
+ "doc/TwitterAlert/Account.html",
30
+ "doc/TwitterAlert/Alert.html",
31
+ "doc/created.rid",
32
+ "doc/images/brick.png",
33
+ "doc/images/brick_link.png",
34
+ "doc/images/bug.png",
35
+ "doc/images/bullet_black.png",
36
+ "doc/images/bullet_toggle_minus.png",
37
+ "doc/images/bullet_toggle_plus.png",
38
+ "doc/images/date.png",
39
+ "doc/images/find.png",
40
+ "doc/images/loadingAnimation.gif",
41
+ "doc/images/macFFBgHack.png",
42
+ "doc/images/package.png",
43
+ "doc/images/page_green.png",
44
+ "doc/images/page_white_text.png",
45
+ "doc/images/page_white_width.png",
46
+ "doc/images/plugin.png",
47
+ "doc/images/ruby.png",
48
+ "doc/images/tag_green.png",
49
+ "doc/images/wrench.png",
50
+ "doc/images/wrench_orange.png",
51
+ "doc/images/zoom.png",
52
+ "doc/index.html",
53
+ "doc/js/darkfish.js",
54
+ "doc/js/jquery.js",
55
+ "doc/js/quicksearch.js",
56
+ "doc/js/thickbox-compressed.js",
57
+ "doc/lib/twitter_alert/account_rb.html",
58
+ "doc/lib/twitter_alert/alert_rb.html",
59
+ "doc/lib/twitter_alert_rb.html",
60
+ "doc/rdoc.css",
61
+ "lib/twitter_alert.rb",
62
+ "lib/twitter_alert/account.rb",
63
+ "lib/twitter_alert/alert.rb",
64
+ "test/helper.rb",
65
+ "test/test_account.rb",
66
+ "test/test_alert.rb",
67
+ "twitter_alert.gemspec"
68
+ ]
69
+ s.homepage = %q{http://github.com/BenHamill/twitter_alert}
70
+ s.rdoc_options = ["--charset=UTF-8"]
71
+ s.require_paths = ["lib"]
72
+ s.rubygems_version = %q{1.3.6}
73
+ s.summary = %q{Send scheduled Direct Messages to all Twitter Followers.}
74
+ s.test_files = [
75
+ "test/helper.rb",
76
+ "test/test_account.rb",
77
+ "test/test_alert.rb"
78
+ ]
79
+
80
+ if s.respond_to? :specification_version then
81
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
82
+ s.specification_version = 3
83
+
84
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
85
+ s.add_development_dependency(%q<fakeweb>, [">= 1.2.8"])
86
+ s.add_runtime_dependency(%q<grackle>, [">= 0.1.9"])
87
+ else
88
+ s.add_dependency(%q<fakeweb>, [">= 1.2.8"])
89
+ s.add_dependency(%q<grackle>, [">= 0.1.9"])
90
+ end
91
+ else
92
+ s.add_dependency(%q<fakeweb>, [">= 1.2.8"])
93
+ s.add_dependency(%q<grackle>, [">= 0.1.9"])
94
+ end
95
+ end
96
+
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ben Hamill
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-06 00:00:00 -05:00
17
+ date: 2010-05-14 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -61,12 +61,48 @@ files:
61
61
  - README.rdoc
62
62
  - Rakefile
63
63
  - VERSION
64
+ - doc/LICENSE.html
65
+ - doc/README_rdoc.html
66
+ - doc/TwitterAlert.html
67
+ - doc/TwitterAlert/Account.html
68
+ - doc/TwitterAlert/Alert.html
69
+ - doc/created.rid
70
+ - doc/images/brick.png
71
+ - doc/images/brick_link.png
72
+ - doc/images/bug.png
73
+ - doc/images/bullet_black.png
74
+ - doc/images/bullet_toggle_minus.png
75
+ - doc/images/bullet_toggle_plus.png
76
+ - doc/images/date.png
77
+ - doc/images/find.png
78
+ - doc/images/loadingAnimation.gif
79
+ - doc/images/macFFBgHack.png
80
+ - doc/images/package.png
81
+ - doc/images/page_green.png
82
+ - doc/images/page_white_text.png
83
+ - doc/images/page_white_width.png
84
+ - doc/images/plugin.png
85
+ - doc/images/ruby.png
86
+ - doc/images/tag_green.png
87
+ - doc/images/wrench.png
88
+ - doc/images/wrench_orange.png
89
+ - doc/images/zoom.png
90
+ - doc/index.html
91
+ - doc/js/darkfish.js
92
+ - doc/js/jquery.js
93
+ - doc/js/quicksearch.js
94
+ - doc/js/thickbox-compressed.js
95
+ - doc/lib/twitter_alert/account_rb.html
96
+ - doc/lib/twitter_alert/alert_rb.html
97
+ - doc/lib/twitter_alert_rb.html
98
+ - doc/rdoc.css
64
99
  - lib/twitter_alert.rb
65
100
  - lib/twitter_alert/account.rb
66
101
  - lib/twitter_alert/alert.rb
67
102
  - test/helper.rb
68
103
  - test/test_account.rb
69
104
  - test/test_alert.rb
105
+ - twitter_alert.gemspec
70
106
  has_rdoc: true
71
107
  homepage: http://github.com/BenHamill/twitter_alert
72
108
  licenses: []