governator 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/bin/console +2 -6
- data/governator.png +0 -0
- data/lib/governator/twitter_client.rb +27 -23
- data/lib/governator/version.rb +1 -1
- data/lib/governator.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42222b98c784c73697e11f2f674eedc3cf5eb83f
|
4
|
+
data.tar.gz: c701edfb91d64cf72ecccf422ca6bc8cae6c2e01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93519716cd823c984c349b2e4733f6bc7f58298b763077243a3e42a3904c5320cb8bc356951c1134808a35f6d78c52d087f7b93c3aad6821732633e2af1db92a
|
7
|
+
data.tar.gz: ecac5f3c8c5dc211e64adbcfd958afe1dba7fb774fa3e8537de8f1c608e46c729415ecded329ce9f988010639e2d68060c8cde4e75247275ed47d59c7e35beaf
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
![Governator](http://msimonborg.com/governator/governator.png)
|
2
2
|
|
3
|
-
Scraper for
|
3
|
+
Scraper for data on US Governors.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -33,12 +33,12 @@ If you want to scrape Twitter handles you will need to initialize the client. Ad
|
|
33
33
|
```ruby
|
34
34
|
Governator.config do |config|
|
35
35
|
config.use_twitter = true
|
36
|
-
|
36
|
+
|
37
37
|
config.twitter do |twitter|
|
38
|
-
twitter.consumer_key =
|
38
|
+
twitter.consumer_key = YOUR_TWITTER_CONSUMER_KEY
|
39
39
|
twitter.consumer_secret = YOUR_TWITTER_CONSUMER_SECRET
|
40
|
-
twitter.access_token =
|
41
|
-
twitter.access_token_secret =
|
40
|
+
twitter.access_token = YOUR_TWITTER_ACCESS_TOKEN
|
41
|
+
twitter.access_token_secret = YOUR_TWITTER_ACCESS_TOKEN_SECRET
|
42
42
|
end
|
43
43
|
end
|
44
44
|
```
|
data/bin/console
CHANGED
@@ -9,14 +9,10 @@ Governator.config do |config|
|
|
9
9
|
config.twitter do |twitter|
|
10
10
|
twitter.consumer_key = ENV['TWITTER_CONSUMER_KEY']
|
11
11
|
twitter.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']
|
12
|
-
twitter.access_token = ENV['
|
13
|
-
twitter.access_token_secret = ENV['
|
12
|
+
twitter.access_token = ENV['TWITTER_ACCESS_TOKEN']
|
13
|
+
twitter.access_token_secret = ENV['TWITTER_ACCESS_TOKEN_SECRET']
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
18
17
|
require 'pry'
|
19
18
|
Pry.start
|
20
|
-
|
21
|
-
# require "irb"
|
22
|
-
# IRB.start(__FILE__)
|
data/governator.png
ADDED
Binary file
|
@@ -2,36 +2,40 @@
|
|
2
2
|
|
3
3
|
class Governator
|
4
4
|
class TwitterClient
|
5
|
-
|
6
|
-
|
7
|
-
end
|
5
|
+
class << self
|
6
|
+
attr_reader :client
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def config(&block)
|
9
|
+
@client = Twitter::REST::Client.new(&block)
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def governors
|
13
|
+
@_governors ||= nga_list_members + rga_list_members + cspan_list_members
|
14
|
+
end
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
def nga_list
|
17
|
+
@_nga_list ||= client.lists('NatlGovsAssoc').detect { |l| l.name == 'Governors' }
|
18
|
+
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
def nga_list_members
|
21
|
+
@_nga_list_members ||= client.list_members(nga_list, count: 100).attrs[:users]
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
def rga_list
|
25
|
+
@_rga_list ||= client.lists('The_RGA').detect { |l| l.name == 'GOP Governors' }
|
26
|
+
end
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
def rga_list_members
|
29
|
+
@_rga_list_members ||= client.list_members(rga_list, count: 100).attrs[:users]
|
30
|
+
end
|
31
|
+
|
32
|
+
def cspan_list
|
33
|
+
@_cspan_list ||= client.lists('cspan').detect { |l| l.name == 'Governors' }
|
34
|
+
end
|
32
35
|
|
33
|
-
|
34
|
-
|
36
|
+
def cspan_list_members
|
37
|
+
@_cspan_list_members ||= client.list_members(cspan_list, count: 100).attrs[:users]
|
38
|
+
end
|
35
39
|
end
|
36
40
|
end
|
37
41
|
end
|
data/lib/governator/version.rb
CHANGED
data/lib/governator.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: governator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- M. Simon Borg
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- bin/console
|
97
97
|
- bin/setup
|
98
98
|
- governator.gemspec
|
99
|
+
- governator.png
|
99
100
|
- lib/governator.rb
|
100
101
|
- lib/governator/bio_page.rb
|
101
102
|
- lib/governator/name_parser.rb
|