neo4apis-twitter 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 777709bbcd9b5227b9814bf1357175bbcfd11bdd
4
- data.tar.gz: 42e40b11332015391da24023af80229b9d03fae0
3
+ metadata.gz: 840743cd0672c0969082835882e1ed4d27b3c107
4
+ data.tar.gz: 4c0cf345be185f73c596e4a112333da92887031f
5
5
  SHA512:
6
- metadata.gz: 41438c3b5ef85bd16e1b696260ef1b6152cb5cafdd2a3ac8982f57ba4c1dc74af61cb5992dff9f614882e9d52a95c686db80bba170d87b84ee7f0fa25cf0a503
7
- data.tar.gz: 4abd1fdf22085bf8b4f821d609cd2dc80ba76618f30f05822e14288b2a07037269a8a8df87df37540fa0dd2fc14e36a35fb983b5c6296d7ce97b6e5a62a32312
6
+ metadata.gz: d7f1c7f459200a76e5099ea52f33346861463d7eac236740fc8ac932fc964f2514a63eaa2081069244a7af1a4bc5d5ee7c44adc0db740bf56c9d3f2bf12e7e81
7
+ data.tar.gz: 4594fd889423d2bda827778c87f5446d38fabd1f76bb5a4b256da5464ec05af3db316076329e5749302464f99a8bf02caefa05d4fd306ba841b09d12e37a36b0
data/README.md CHANGED
@@ -7,7 +7,7 @@ This adapter supports objects created from the `twitter` gem.
7
7
 
8
8
  twitter_client = Twitter::REST::Client.new ...
9
9
 
10
- neo4japis_twitter = Neo4Apis::Twitter.new(Neo4j::Session.open, import_retweets: true)
10
+ neo4japis_twitter = Neo4Apis::Twitter.new(Neo4j::Session.open, import_retweets: true, import_hashtags: true)
11
11
 
12
12
  neo4japis_twitter.batch do
13
13
  twitter_client.search("ebola", :result_type => "recent").take(100).each do |tweet|
@@ -22,3 +22,4 @@ end
22
22
 
23
23
  ```
24
24
 
25
+ Currently supports importing User and Tweet
@@ -4,6 +4,7 @@ module Neo4Apis
4
4
  class Twitter < Base
5
5
  uuid :Tweet, :id
6
6
  uuid :User, :id
7
+ uuid :HashTag, :text
7
8
 
8
9
  importer :Tweet do |tweet|
9
10
  user_node = import :User, tweet.user
@@ -15,8 +16,17 @@ module Neo4Apis
15
16
  text: tweet.text,
16
17
  }
17
18
 
18
- add_relationship(:tweeted, user_node, node)
19
- add_relationship(:retweets, node, retweeted_tweet_node) if options[:import_retweets] && tweet.retweeted_tweet?
19
+ if options[:import_hashtags] && tweet.respond_to?(:hashtags)
20
+ tweet.hashtags.each do |hashtag|
21
+ hashtag_node = import :HashTag, hashtag
22
+
23
+ add_relationship :has_hashtag, node, hashtag_node, text: hashtag.text
24
+ end
25
+ end
26
+
27
+ add_relationship :tweeted, user_node, node
28
+ add_relationship :retweets, node, retweeted_tweet_node if options[:import_retweets] && tweet.retweeted_tweet?
29
+
20
30
 
21
31
  node
22
32
  end
@@ -31,6 +41,16 @@ module Neo4Apis
31
41
  }
32
42
  end
33
43
 
44
+ importer :HashTag do |hashtag|
45
+ add_node :HashTag, {
46
+ text: hashtag.text.downcase
47
+ }
48
+ end
49
+
50
+ def self.default_flush_size
51
+ 3000
52
+ end
53
+
34
54
  end
35
55
  end
36
56
 
@@ -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.0.3'
6
+ s.version = '0.0.4'
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.0.3")
21
+ s.add_dependency('neo4apis', "~> 0.0.4")
22
22
  s.add_dependency('twitter', "~> 5.12.0")
23
23
 
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4apis-twitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Underwood
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.3
19
+ version: 0.0.4
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.0.3
26
+ version: 0.0.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: twitter
29
29
  requirement: !ruby/object:Gem::Requirement