trumpcare_tracker 0.1.7 → 0.1.8

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: 5193eb27780e66f83453b9a9c076b8716bfe7793
4
- data.tar.gz: 6773161be3c391e561d4e77fae7eb7b8c90024f9
3
+ metadata.gz: c0ffa59e51d823972675ea02fe2407caa3a441c0
4
+ data.tar.gz: 70af7cf9c1543447b71405cf3d4d72be0a858eda
5
5
  SHA512:
6
- metadata.gz: aaf53a13d50bc167d0d94a5ef60f68cde4942a4922bf4720e9f7595f8ee092ea1820a60be86682237b60411ee8d61fa38e3873fc483c7f96b828eaee94d43f40
7
- data.tar.gz: cb7941d57bed09cb58b059f1fe37ddfaed6a5f7e99f14bc9bb7cb1fda72687e42d98e433c323c1f3548afcc90f53ca64224e91df9ca40f287820fed487487658
6
+ metadata.gz: 4df686c5969023f444d00e43927b5874ac0754625c8e0211a14901d027a713c60180226ee5f16c173300d9e79ff5729dc25cbee7831d6aed22f66477d216124e
7
+ data.tar.gz: 0eb9247b329348dd5fcc91f84c264837a2d31c33f668b4e8a94421dcc79c475d3a4a8c6f2ee7b698f3c17f417dd64ebde1ca386c702a01e57f0f937c50996474
data/README.md CHANGED
@@ -45,7 +45,7 @@ TrumpcareTracker::Reporters.new
45
45
  run the tasks like so
46
46
 
47
47
  ```
48
- bundle exec rake tracker:tweet # Audit tweets and post to Twitter timeline with Senator's phone numbers
48
+ bundle exec rake tracker:tweet_bot # Audit tweets and post to Twitter timeline with Senator's phone numbers
49
49
 
50
50
  bundle exec rake tracker:export # Audit tweets and export to CSV
51
51
 
@@ -26,18 +26,18 @@ class TrumpcareTracker
26
26
  task :export do
27
27
  csv_tweet_report = CSV.generate do |csv|
28
28
  csv << %w[
29
- senator
30
- official_user_name
31
- alt_user_name
32
- tweets_in_last_seven_days
33
- trumpcare_tweets
34
- tct_percentage
35
- russia_tweets
36
- rt_percentage
37
- tct_to_rt_ratio
38
- trumpcare_tweet_urls
39
- russia_tweet_urls
40
- ]
29
+ senator
30
+ official_user_name
31
+ alt_user_name
32
+ tweets_in_last_seven_days
33
+ trumpcare_tweets
34
+ tct_percentage
35
+ russia_tweets
36
+ rt_percentage
37
+ tct_to_rt_ratio
38
+ trumpcare_tweet_urls
39
+ russia_tweet_urls
40
+ ]
41
41
  audit_tweets(reps) { |tracker| csv << tracker.to_h.values }
42
42
  end
43
43
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TrumpcareTracker
4
- VERSION = '0.1.7'
4
+ VERSION = '0.1.8'
5
5
  end
@@ -22,7 +22,7 @@ class TrumpcareTracker
22
22
  end
23
23
 
24
24
  def self.trumpcare_keyword_regex
25
- /(ahca|trumpcare|healthcare|health|care|drug|medication|prescription|vaccine|obamacare|cbo|premiums|insurance|deductibles)/
25
+ /(ahca|trumpcare|healthcare|health|care|drug|medication|prescription|vaccine|obamacare|cbo|premiums|insurance|deductibles|aca|o-care|a.h.c.a|a.c.a)/
26
26
  end
27
27
 
28
28
  def self.russia_keyword_regex
@@ -71,8 +71,20 @@ class TrumpcareTracker
71
71
 
72
72
  def reduce_by_keywords(regex)
73
73
  recent_tweets.each_with_object([]) do |tweet, memo|
74
- full_text = client.status(tweet.id, tweet_mode: 'extended').attrs[:full_text]
75
- memo << tweet if full_text.downcase.match?(regex)
74
+ tweet_with_full_text = client.status(tweet.id, tweet_mode: 'extended')
75
+ memo << tweet if tweet_match?(tweet_with_full_text, regex)
76
+ end
77
+ end
78
+
79
+ def tweet_match?(tweet, regex)
80
+ full_text = tweet.attrs[:full_text]
81
+ if full_text.downcase.match?(regex)
82
+ true
83
+ elsif tweet.quoted_tweet?
84
+ quoted_tweet = client.status(tweet.quoted_tweet.id, tweet_mode: 'extended')
85
+ tweet_match?(quoted_tweet, regex)
86
+ else
87
+ false
76
88
  end
77
89
  end
78
90
 
@@ -1,49 +1,49 @@
1
1
  senator,url,trumpcare_mentions,russia_mentions,trumpcare_to_russia_ratio
2
- Sherrod Brown,https://www.brown.senate.gov,5,1,5.0
3
- Tammy Baldwin,https://www.baldwin.senate.gov,3,0,0.0
2
+ Sherrod Brown,https://www.brown.senate.gov,4,1,4.0
3
+ Tammy Baldwin,https://www.baldwin.senate.gov,0,0,0.0
4
4
  Michael F. Bennet,https://www.bennet.senate.gov,2,5,0.4
5
5
  Richard Blumenthal,https://www.blumenthal.senate.gov,1,0,0.0
6
6
  Cory A. Booker,https://www.booker.senate.gov,1,2,0.5
7
7
  Maria Cantwell,https://www.cantwell.senate.gov,2,0,0.0
8
8
  Benjamin L. Cardin,https://www.cardin.senate.gov,0,1,0.0
9
9
  Thomas R. Carper,https://www.carper.senate.gov/public,7,0,0.0
10
- "Robert P. Casey, Jr.",https://www.casey.senate.gov,2,2,1.0
11
- Christopher A. Coons,https://www.coons.senate.gov,2,1,2.0
10
+ "Robert P. Casey, Jr.",https://www.casey.senate.gov,1,2,0.5
11
+ Christopher A. Coons,https://www.coons.senate.gov,1,1,1.0
12
12
  Catherine Cortez Masto,https://www.cortezmasto.senate.gov,0,0,0.0
13
- Richard J. Durbin,https://www.durbin.senate.gov,2,0,0.0
14
- Joe Donnelly,https://www.donnelly.senate.gov,4,1,4.0
13
+ Richard J. Durbin,https://www.durbin.senate.gov,1,0,0.0
14
+ Joe Donnelly,https://www.donnelly.senate.gov,2,1,2.0
15
15
  Tammy Duckworth,https://www.duckworth.senate.gov,0,1,0.0
16
16
  Dianne Feinstein,https://www.feinstein.senate.gov,0,0,0.0
17
- Al Franken,https://www.franken.senate.gov,10,2,5.0
18
- Kirsten E. Gillibrand,https://www.gillibrand.senate.gov,1,0,0.0
17
+ Al Franken,https://www.franken.senate.gov,7,2,3.5
18
+ Kirsten E. Gillibrand,https://www.gillibrand.senate.gov,0,0,0.0
19
19
  Mazie K. Hirono,https://www.hirono.senate.gov,0,0,0.0
20
- Martin Heinrich,https://www.heinrich.senate.gov,5,3,1.6667
21
- Heidi Heitkamp,https://www.heitkamp.senate.gov/public,4,0,0.0
20
+ Martin Heinrich,https://www.heinrich.senate.gov,4,3,1.3333
21
+ Heidi Heitkamp,https://www.heitkamp.senate.gov/public,2,0,0.0
22
22
  Kamala D. Harris,https://www.harris.senate.gov,0,2,0.0
23
- Margaret Wood Hassan,https://www.hassan.senate.gov,2,0,0.0
23
+ Margaret Wood Hassan,https://www.hassan.senate.gov,1,0,0.0
24
24
  Amy Klobuchar,https://www.klobuchar.senate.gov,0,0,0.0
25
- Tim Kaine,https://www.kaine.senate.gov,7,0,0.0
26
- Patrick J. Leahy,https://www.leahy.senate.gov,2,3,0.6667
27
- Edward J. Markey,https://www.markey.senate.gov,13,0,0.0
28
- Robert Menendez,https://www.menendez.senate.gov,3,0,0.0
29
- Patty Murray,https://www.murray.senate.gov/public,6,0,0.0
25
+ Tim Kaine,https://www.kaine.senate.gov,4,0,0.0
26
+ Patrick J. Leahy,https://www.leahy.senate.gov,1,3,0.3333
27
+ Edward J. Markey,https://www.markey.senate.gov,8,0,0.0
28
+ Robert Menendez,https://www.menendez.senate.gov,2,0,0.0
29
+ Patty Murray,https://www.murray.senate.gov/public,5,0,0.0
30
30
  Christopher Murphy,https://www.murphy.senate.gov,0,0,0.0
31
31
  Claire McCaskill,https://www.mccaskill.senate.gov,1,0,0.0
32
32
  Jeff Merkley,https://www.merkley.senate.gov,1,1,1.0
33
33
  "Joe Manchin, III",https://www.manchin.senate.gov/public,4,4,1.0
34
- Bill Nelson,https://www.billnelson.senate.gov,4,0,0.0
34
+ Bill Nelson,https://www.billnelson.senate.gov,3,0,0.0
35
35
  Gary C. Peters,https://www.peters.senate.gov,0,0,0.0
36
36
  Jack Reed,https://www.reed.senate.gov,3,1,3.0
37
37
  Charles E. Schumer,https://www.schumer.senate.gov,0,0,0.0
38
- Debbie Stabenow,https://www.stabenow.senate.gov,4,0,0.0
38
+ Debbie Stabenow,https://www.stabenow.senate.gov,1,0,0.0
39
39
  Jeanne Shaheen,https://www.shaheen.senate.gov,2,0,0.0
40
- Brian Schatz,https://www.schatz.senate.gov,6,1,6.0
40
+ Brian Schatz,https://www.schatz.senate.gov,3,1,3.0
41
41
  Jon Tester,https://www.tester.senate.gov,3,0,0.0
42
42
  Tom Udall,https://www.tomudall.senate.gov,1,0,0.0
43
- Chris Van Hollen,https://www.vanhollen.senate.gov,2,1,2.0
44
- Ron Wyden,https://www.wyden.senate.gov,10,1,10.0
43
+ Chris Van Hollen,https://www.vanhollen.senate.gov,1,1,1.0
44
+ Ron Wyden,https://www.wyden.senate.gov,7,1,7.0
45
45
  Sheldon Whitehouse,https://www.whitehouse.senate.gov,0,1,0.0
46
46
  Mark R. Warner,https://www.warner.senate.gov,0,0,0.0
47
47
  Elizabeth Warren,https://www.warren.senate.gov,1,5,0.2
48
- "Angus S. King, Jr.",https://www.king.senate.gov,4,0,0.0
49
- Bernard Sanders,https://www.sanders.senate.gov,2,5,0.4
48
+ "Angus S. King, Jr.",https://www.king.senate.gov,2,0,0.0
49
+ Bernard Sanders,https://www.sanders.senate.gov,0,5,0.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trumpcare_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - M. Simon Borg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2017-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: twitter