neo4apis-twitter 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/neo4apis/cli/twitter.rb +3 -1
- data/lib/neo4apis/twitter.rb +10 -1
- data/neo4apis-twitter.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c8be4b5bfaae76a81157797e34dd4565a939ec2
|
4
|
+
data.tar.gz: 10542478383cdcf161003cc746ec4e20414d5f2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 503ba611328dc21c6fcfb03e84c1efb100899a356a83dcb44303003fd7cfc8857a859806c6ae48a0119965d99147328687f981c43a4e4e8893675dad5ac93b65
|
7
|
+
data.tar.gz: cdf50c105718208e443888792dae59c50099f27f6b00f4ac11c07e9275f6673af63017198db9b826d07dac70e38cf44671488df2835c8d4a996e934f090536cb
|
data/lib/neo4apis/cli/twitter.rb
CHANGED
@@ -9,6 +9,7 @@ module Neo4Apis
|
|
9
9
|
|
10
10
|
class_option :import_retweets, type: :boolean, default: false
|
11
11
|
class_option :import_hashtags, type: :boolean, default: false
|
12
|
+
class_option :import_user_mentions, type: :boolean, default: false
|
12
13
|
|
13
14
|
desc "filter TRACK", "Streams tweets via a filter"
|
14
15
|
def filter(track)
|
@@ -22,6 +23,7 @@ module Neo4Apis
|
|
22
23
|
option :locale, type: :string
|
23
24
|
option :result_type, type: :string
|
24
25
|
option :until, type: :string
|
26
|
+
option :count, type: :numeric
|
25
27
|
desc "search QUERY COUNT", "Import tweets via a search query"
|
26
28
|
def search(query, count)
|
27
29
|
neo4apis_client.batch do
|
@@ -46,7 +48,7 @@ module Neo4Apis
|
|
46
48
|
NEO4APIS_CLIENT_CLASS = ::Neo4Apis::Twitter
|
47
49
|
|
48
50
|
def neo4apis_client
|
49
|
-
@neo4apis_client ||= NEO4APIS_CLIENT_CLASS.new(Neo4j::Session.open(:server_db, parent_options[:neo4j_url]), import_retweets: options[:import_retweets], import_hashtags: options[:import_hashtags])
|
51
|
+
@neo4apis_client ||= NEO4APIS_CLIENT_CLASS.new(Neo4j::Session.open(:server_db, parent_options[:neo4j_url]), import_retweets: options[:import_retweets], import_hashtags: options[:import_hashtags], import_user_mentions: options[:import_user_mentions])
|
50
52
|
end
|
51
53
|
|
52
54
|
def twitter_client(streaming)
|
data/lib/neo4apis/twitter.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'neo4apis'
|
2
|
+
require 'ostruct'
|
2
3
|
|
3
4
|
module Neo4Apis
|
4
5
|
class Twitter < Base
|
@@ -15,7 +16,7 @@ module Neo4Apis
|
|
15
16
|
|
16
17
|
retweeted_tweet_node = import :Tweet, tweet.retweeted_tweet if options[:import_retweets] && tweet.retweeted_tweet?
|
17
18
|
|
18
|
-
node = add_node :Tweet, tweet, %w{id text reply? geo urls media lang source created_at}
|
19
|
+
node = add_node :Tweet, tweet, %w{id text reply? geo urls media lang source favorite_count retweet_count created_at}
|
19
20
|
|
20
21
|
if options[:import_hashtags] && tweet.respond_to?(:hashtags)
|
21
22
|
tweet.hashtags.each do |hashtag|
|
@@ -25,6 +26,14 @@ module Neo4Apis
|
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
29
|
+
if options[:import_user_mentions] && tweet.respond_to?(:user_mentions)
|
30
|
+
tweet.user_mentions.each do |user_mention|
|
31
|
+
user_mention_node = import :User, OpenStruct.new(user_mention.attrs)
|
32
|
+
|
33
|
+
add_relationship :mentions_user, node, user_mention_node
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
28
37
|
add_relationship :tweeted, user_node, node
|
29
38
|
add_relationship :retweets, node, retweeted_tweet_node if options[:import_retweets] && tweet.retweeted_tweet?
|
30
39
|
|
data/neo4apis-twitter.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.unshift lib unless $:.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "neo4apis-twitter"
|
6
|
-
s.version = '0.
|
6
|
+
s.version = '0.7.0'
|
7
7
|
s.required_ruby_version = ">= 1.9.1"
|
8
8
|
|
9
9
|
s.authors = "Brian Underwood"
|
@@ -18,7 +18,7 @@ A ruby gem using neo4apis to make importing twitter data to neo4j easy
|
|
18
18
|
s.require_path = 'lib'
|
19
19
|
s.files = Dir.glob("{bin,lib,config}/**/*") + %w(README.md Gemfile neo4apis-twitter.gemspec)
|
20
20
|
|
21
|
-
s.add_dependency('neo4apis', '~> 0.
|
21
|
+
s.add_dependency('neo4apis', '~> 0.4.0')
|
22
22
|
s.add_dependency('twitter', '~> 5.12.0')
|
23
23
|
|
24
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4apis-twitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Underwood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: neo4apis
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: twitter
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|