social_cleaner 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/social_cleaner/twitr.rb +14 -4
  2. metadata +9 -7
@@ -23,14 +23,24 @@ module SocialCleaner
23
23
  expire_before = Time.now - (delete_after_days * 60 * 60 * 24)
24
24
  expire_ids = []
25
25
 
26
- puts "Expiring all Twitter updates prior to #{expire_before.to_s}."
26
+ $stderr.puts "Expiring all Twitter updates prior to #{expire_before.to_s}."
27
27
 
28
28
  # Iterate through timeline
29
29
  # The old tweet id's don't contain a timestamp. maybe implement this for later?
30
30
  timeline = client.user_timeline
31
31
  timeline.each do |status|
32
32
  if Time.parse(status["created_at"]) < expire_before
33
- puts "Queueing delete status ID #{status["id"]} created at #{status["created_at"]} (#{status["text"]})."
33
+ $stderr.puts "Queueing tweet delete status ID #{status["id"]} created at #{status["created_at"]} (#{status["text"]})."
34
+ $stdout.puts "#{status["id"]}\t\t#{status["created_at"]}\t\t#{status["text"]}"
35
+ expire_ids.push(status["id"])
36
+ end
37
+ end
38
+
39
+ retweets = client.retweeted_by_me
40
+ retweets.each do |retweet|
41
+ if Time.parse(status["created_at"]) < expire_before
42
+ $stderr.puts "Queueing retweet delete status ID #{status["id"]} created at #{status["created_at"]} (#{status["text"]})."
43
+ $stdout.puts "#{status["id"]}\t\t#{status["created_at"]}\t\t#{status["text"]}"
34
44
  expire_ids.push(status["id"])
35
45
  end
36
46
  end
@@ -39,12 +49,12 @@ module SocialCleaner
39
49
  # the list to be deleted.
40
50
  expire_ids.sort!
41
51
 
42
- puts "Deleting #{expire_ids.length} tweets."
52
+ $stderr.puts "Deleting #{expire_ids.length} tweets."
43
53
 
44
54
  # Now let's delete the stuff
45
55
  # Note: the delete method is not rate limited.
46
56
  expire_ids.each do |delete_status|
47
- puts "Deleting #{delete_status}..."
57
+ $stderr.puts "Deleting #{delete_status}..."
48
58
  client.status_destroy(delete_status)
49
59
  end
50
60
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_cleaner
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Micha\xC3\xABl Rigart"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-24 00:00:00 +02:00
18
+ date: 2010-10-26 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,12 +24,14 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ">="
27
+ - - "="
28
28
  - !ruby/object:Gem::Version
29
- hash: 3
29
+ hash: 35
30
30
  segments:
31
31
  - 0
32
- version: "0"
32
+ - 9
33
+ - 12
34
+ version: 0.9.12
33
35
  type: :runtime
34
36
  version_requirements: *id001
35
37
  description: Cleans up your social messages