tweet_watch 0.2.2.pre → 0.2.3.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 135cdd71414f49d5d20d43045756999d72663523
4
- data.tar.gz: b37e262046f535e2a3837e6e3c00b1857bd8d6c9
3
+ metadata.gz: 0e73e51822890ec3d5333a74fd2dcd25cb433394
4
+ data.tar.gz: 0255ff95f17eef5ae53c56c156646a98134997f6
5
5
  SHA512:
6
- metadata.gz: df719fbcba7108cf2e4098771e3654ffc487747c3c23b38d09ee504a2d3a70efc326dd1264036e933c442f499cb5e982436b33cbc915cd26a710444ae6e6b1ee
7
- data.tar.gz: 2237e7a3a4ec298b422d2749e5ac3ac5be4bfca71f5ae242bfc7a1c69aa986cdf4b353b551898650a1c554a16deec81627044271ed3d1404bb72834b8a4da14f
6
+ metadata.gz: f811bbb8d2c24a4b53c93ed7d3d2e517fee9e8e966b85562fdbf17c6d514ac5cc2699923ca11fe404aca6a4caa9b2cdbbd5496480d7bd76fe14f763b99c1ad93
7
+ data.tar.gz: feb5ef50129e4dd00ab490ac032143d76619a78662de7ad80567df0d0679b81aa54a0deb24ce22c295add93690e76aab599705c4f88fe732f8b0ada5a452da77
@@ -102,9 +102,12 @@ module TweetWatch
102
102
  end
103
103
 
104
104
  desc "monitor", "Monitors target tweeters tweets and provided account timelines."
105
- def monitor
105
+ option :interval, aliases: "-i", desc: "Time delay between each monitoring run. Default = 15 mins."
106
+ option :initial_tweet_history, aliases: "-hn", desc: "When started Monitor will collect 200 tweets by defaul for each tweeter."
107
+ option :timeline_count, aliases: "-n", desc: "For each monitor run, how many tweets should be collected. 200 by default is also the max."
108
+ def monitor
106
109
  load_config(options)
107
- m = TweetWatch::Monitor.new
110
+ m = TweetWatch::Monitor.new(options)
108
111
  m.run
109
112
  end
110
113
 
@@ -9,7 +9,11 @@ module TweetWatch
9
9
  include TweetWatch::Client
10
10
  include TweetWatch::Utils
11
11
 
12
- def initialize
12
+ def initialize(options = {})
13
+ @options = {interval: (15*60),
14
+ initial_tweet_history: 200,
15
+ timeline_count: 200}.merge(options)
16
+
13
17
  @new_tweeter_tweets = 0
14
18
 
15
19
  if TweetWatch.config.tweeters.empty?
@@ -37,7 +41,7 @@ module TweetWatch
37
41
 
38
42
  @new_tweeter_tweets = 0
39
43
 
40
- sleep(20)
44
+ sleep(@options[:interval])
41
45
  self.run
42
46
  end
43
47
 
@@ -48,7 +52,7 @@ module TweetWatch
48
52
 
49
53
  c = client({screen_name: account.screen_name})
50
54
  time = Time.now.utc
51
- timeline = c.home_timeline({count: 200})
55
+ timeline = c.home_timeline({count: @options[:timeline_count]})
52
56
 
53
57
  file = CSV.open("account_timeline.csv", "a+")
54
58
  unless File.size("account_timeline.csv") > 0
@@ -66,7 +70,7 @@ module TweetWatch
66
70
  puts "collecting @#{tweeter} tweets..."
67
71
  time = Time.now.utc
68
72
 
69
- opts = {count: 200}
73
+ opts = {count: @options[:initial_tweet_history]}
70
74
  if @tweeter_state[tweeter]
71
75
  opts[:since_id] = @tweeter_state[tweeter]
72
76
  end
@@ -1,3 +1,3 @@
1
1
  module TweetWatch
2
- VERSION = "0.2.2.pre"
2
+ VERSION = "0.2.3.pre"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tweet_watch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2.pre
4
+ version: 0.2.3.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ajo Abraham