statement 1.3 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/lib/statement/facebook.rb +4 -4
- data/lib/statement/tweets.rb +5 -5
- data/lib/statement/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -39,6 +39,8 @@ Statement.configure(:oauth_token => token, :oauth_token_secret => secret, ...) #
|
|
39
39
|
Statement.configure_with("config.yml") # option 2
|
40
40
|
```
|
41
41
|
|
42
|
+
If you don't need to use the Twitter or Facebook APIs, you don't need to setup configuration.
|
43
|
+
|
42
44
|
### Press Releases
|
43
45
|
|
44
46
|
To parse an RSS feed, simply pass the URL to Statement's Feed class:
|
data/lib/statement/facebook.rb
CHANGED
@@ -8,16 +8,16 @@ module Statement
|
|
8
8
|
attr_accessor :graph, :feed, :batch
|
9
9
|
|
10
10
|
def initialize
|
11
|
-
@@config =
|
12
|
-
app_id =
|
13
|
-
app_secret =
|
11
|
+
@@config = Statement.config rescue nil || {}
|
12
|
+
app_id = @@config[:app_id] || ENV['APP_ID']
|
13
|
+
app_secret = @@config[:app_secret] || ENV['APP_SECRET']
|
14
14
|
oauth = Koala::Facebook::OAuth.new(app_id, app_secret)
|
15
15
|
@graph = Koala::Facebook::API.new(oauth.get_app_access_token)
|
16
16
|
end
|
17
17
|
|
18
18
|
def feed(member_id)
|
19
19
|
results = graph.get_connection(member_id, 'feed')
|
20
|
-
process_results(results.select{|r| r['from']['id'] == r['
|
20
|
+
process_results(results.select{|r| r['from']['id'] == r['id'].split('_').first})
|
21
21
|
end
|
22
22
|
|
23
23
|
# given an array of congressional facebook ids, pulls feeds in slices.
|
data/lib/statement/tweets.rb
CHANGED
@@ -6,12 +6,12 @@ module Statement
|
|
6
6
|
attr_accessor :client, :timeline, :bulk_timeline
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
@@config =
|
9
|
+
@@config = Statement.config rescue nil || {}
|
10
10
|
@client = Twitter::Client.new(
|
11
|
-
:consumer_key =>
|
12
|
-
:consumer_secret =>
|
13
|
-
:oauth_token =>
|
14
|
-
:oauth_token_secret =>
|
11
|
+
:consumer_key => @@config[:consumer_key] || ENV['CONSUMER_KEY'],
|
12
|
+
:consumer_secret => @@config[:consumer_secret] || ENV['CONSUMER_SECRET'],
|
13
|
+
:oauth_token => @@config[:oauth_token] || ENV['OAUTH_TOKEN'],
|
14
|
+
:oauth_token_secret => @@config[:oauth_token_secret] || ENV['OAUTH_TOKEN_SECRET']
|
15
15
|
)
|
16
16
|
end
|
17
17
|
|
data/lib/statement/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statement
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.4'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -214,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
segments:
|
216
216
|
- 0
|
217
|
-
hash:
|
217
|
+
hash: 1154048383946030559
|
218
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
219
|
none: false
|
220
220
|
requirements:
|
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
version: '0'
|
224
224
|
segments:
|
225
225
|
- 0
|
226
|
-
hash:
|
226
|
+
hash: 1154048383946030559
|
227
227
|
requirements: []
|
228
228
|
rubyforge_project:
|
229
229
|
rubygems_version: 1.8.25
|