da_face 0.0.1
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 +7 -0
- data/.gitignore +20 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +51 -0
- data/LICENSE.txt +22 -0
- data/README.md +114 -0
- data/Rakefile +2 -0
- data/da_face.gemspec +27 -0
- data/lib/da_face/api/adapter.rb +42 -0
- data/lib/da_face/api/adapters/base.rb +59 -0
- data/lib/da_face/api/adapters/em_http_request_adapter.rb +8 -0
- data/lib/da_face/api/adapters/excon_adapter.rb +33 -0
- data/lib/da_face/api/core.rb +0 -0
- data/lib/da_face/api/push.rb +77 -0
- data/lib/da_face/api/push_log.rb +11 -0
- data/lib/da_face/api/push_log_entry.rb +15 -0
- data/lib/da_face/api/push_subscription.rb +141 -0
- data/lib/da_face/configuration.rb +11 -0
- data/lib/da_face/datasift/da_object.rb +35 -0
- data/lib/da_face/datasift/demographic.rb +12 -0
- data/lib/da_face/datasift/errors.rb +9 -0
- data/lib/da_face/datasift/interaction.rb +33 -0
- data/lib/da_face/datasift/language.rb +14 -0
- data/lib/da_face/datasift/link.rb +34 -0
- data/lib/da_face/datasift/links.rb +38 -0
- data/lib/da_face/datasift/parser.rb +35 -0
- data/lib/da_face/datasift/salience.rb +16 -0
- data/lib/da_face/datasift/twitter.rb +46 -0
- data/lib/da_face/datasift/twitter_delete_notification.rb +16 -0
- data/lib/da_face/datasift/twitter_user_status.rb +37 -0
- data/lib/da_face/errors.rb +7 -0
- data/lib/da_face/twitter/parser.rb +16 -0
- data/lib/da_face/twitter/tweet.rb +49 -0
- data/lib/da_face/twitter/user.rb +55 -0
- data/lib/da_face/utilities.rb +41 -0
- data/lib/da_face/version.rb +3 -0
- data/lib/da_face.rb +69 -0
- data/spec/da_face/api/adapter_spec.rb +58 -0
- data/spec/da_face/api/adapters/base_spec.rb +125 -0
- data/spec/da_face/api/push_log_spec.rb +34 -0
- data/spec/da_face/api/push_spec.rb +108 -0
- data/spec/da_face/api/push_subscription_spec.rb +220 -0
- data/spec/da_face/configuration_spec.rb +15 -0
- data/spec/da_face/datasift/da_object_spec.rb +191 -0
- data/spec/da_face/datasift/demographic_spec.rb +30 -0
- data/spec/da_face/datasift/interaction_spec.rb +93 -0
- data/spec/da_face/datasift/language_spec.rb +45 -0
- data/spec/da_face/datasift/link_spec.rb +80 -0
- data/spec/da_face/datasift/links_spec.rb +70 -0
- data/spec/da_face/datasift/parser_spec.rb +5 -0
- data/spec/da_face/datasift/salience_spec.rb +33 -0
- data/spec/da_face/datasift/twitter_delete_notification_spec.rb +45 -0
- data/spec/da_face/datasift/twitter_spec.rb +56 -0
- data/spec/da_face/datasift/twitter_user_status_spec.rb +36 -0
- data/spec/da_face/twitter/parser_spec.rb +16 -0
- data/spec/da_face/twitter/tweet_spec.rb +77 -0
- data/spec/da_face/twitter/user_spec.rb +116 -0
- data/spec/da_face/utilities_spec.rb +74 -0
- data/spec/da_face_spec.rb +120 -0
- data/spec/fixtures/api_responses/get_subscriptions.json +26 -0
- data/spec/fixtures/api_responses/log.json +126 -0
- data/spec/fixtures/api_responses/validate_success.json +4 -0
- data/spec/fixtures/demographic/simple.json +5 -0
- data/spec/fixtures/interaction/simple.json +28 -0
- data/spec/fixtures/interactions/collection.json +1 -0
- data/spec/fixtures/interactions/simple.json +102 -0
- data/spec/fixtures/language/simple.json +5 -0
- data/spec/fixtures/links/multiples.json +69 -0
- data/spec/fixtures/links/simple.json +65 -0
- data/spec/fixtures/links/simple_failing.json +65 -0
- data/spec/fixtures/notifications/delete.json +10 -0
- data/spec/fixtures/notifications/user_delete.json +16 -0
- data/spec/fixtures/notifications/user_protect.json +16 -0
- data/spec/fixtures/notifications/user_suspend.json +16 -0
- data/spec/fixtures/notifications/user_undelete.json +16 -0
- data/spec/fixtures/notifications/user_unprotect.json +16 -0
- data/spec/fixtures/notifications/user_unsuspend.json +16 -0
- data/spec/fixtures/salience/simple.json +5 -0
- data/spec/fixtures/twitter/retweet.json +70 -0
- data/spec/fixtures/twitter/simple.json +33 -0
- data/spec/integration/stress_spec.rb +16 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/test_spec.rb +7 -0
- metadata +259 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"demographic": {
|
|
3
|
+
"gender": "male"
|
|
4
|
+
},
|
|
5
|
+
"interaction": {
|
|
6
|
+
"author": {
|
|
7
|
+
"avatar": "http://something.com/asdasdasd.jpg",
|
|
8
|
+
"id": 1231231231231,
|
|
9
|
+
"language": "en",
|
|
10
|
+
"link": "http://twitter.com/SomeOne",
|
|
11
|
+
"name": "Some One",
|
|
12
|
+
"username": "SomeOe"
|
|
13
|
+
},
|
|
14
|
+
"content": "alskf askldjfl ñasdjñfksjd ñlksjfñkalsjdñ fkajñsdkf j",
|
|
15
|
+
"created_at": "Fri, 16 May 2014 00:24:08 +0000",
|
|
16
|
+
"id": "9asfa09sd8'f098ssd89f7s98df78d7f",
|
|
17
|
+
"link": "http://twitter.com/SomeOne/status/00000000000000000",
|
|
18
|
+
"received_at": 1400199848.5762,
|
|
19
|
+
"schema": {
|
|
20
|
+
"version": 3
|
|
21
|
+
},
|
|
22
|
+
"source": "dlvr.it",
|
|
23
|
+
"type": "twitter",
|
|
24
|
+
"tags": [
|
|
25
|
+
"trader"
|
|
26
|
+
],
|
|
27
|
+
"tag_tree": {
|
|
28
|
+
"sentiment_score": 700,
|
|
29
|
+
"quality_score": 950
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"language": {
|
|
33
|
+
"confidence": 98,
|
|
34
|
+
"tag": "en",
|
|
35
|
+
"tag_extended": "en"
|
|
36
|
+
},
|
|
37
|
+
"links": {
|
|
38
|
+
"code": [
|
|
39
|
+
403
|
|
40
|
+
],
|
|
41
|
+
"created_at": [
|
|
42
|
+
"Fri, 16 May 2014 00:24:09 +0000"
|
|
43
|
+
],
|
|
44
|
+
"hops": [
|
|
45
|
+
[
|
|
46
|
+
"http://failing-link.com"
|
|
47
|
+
]
|
|
48
|
+
],
|
|
49
|
+
"normalized_url": [
|
|
50
|
+
null
|
|
51
|
+
],
|
|
52
|
+
"retweet_count": [
|
|
53
|
+
0
|
|
54
|
+
],
|
|
55
|
+
"title": [
|
|
56
|
+
null
|
|
57
|
+
],
|
|
58
|
+
"url": [
|
|
59
|
+
"http://failing-link.com"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"salience": {
|
|
63
|
+
"content": {
|
|
64
|
+
"sentiment": 0
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"twitter": {
|
|
68
|
+
"created_at": "Fri, 16 May 2014 00:24:08 +0000",
|
|
69
|
+
"display_urls": [
|
|
70
|
+
"some-link.com/asdas90da08d…"
|
|
71
|
+
],
|
|
72
|
+
"domains": [
|
|
73
|
+
"some-link.com"
|
|
74
|
+
],
|
|
75
|
+
"id": "0000000000000000000",
|
|
76
|
+
"lang": "en",
|
|
77
|
+
"links": [
|
|
78
|
+
"http://failing-link.com/asdasdasd"
|
|
79
|
+
],
|
|
80
|
+
"source": "<a href=\"http://dlvr.it\" rel=\"nofollow\">dlvr.it</a>",
|
|
81
|
+
"text": "some text",
|
|
82
|
+
"user": {
|
|
83
|
+
"created_at": "Mon, 09 Sep 2013 22:23:08 +0000",
|
|
84
|
+
"favourites_count": 0,
|
|
85
|
+
"followers_count": 169,
|
|
86
|
+
"friends_count": 0,
|
|
87
|
+
"geo_enabled": false,
|
|
88
|
+
"id": 1000000000000,
|
|
89
|
+
"id_str": "1000000000000",
|
|
90
|
+
"lang": "en",
|
|
91
|
+
"listed_count": 13,
|
|
92
|
+
"name": "Some One",
|
|
93
|
+
"profile_image_url": "http://somewhere/someimage.jpg",
|
|
94
|
+
"profile_image_url_https": "http://somewhere/someimage.jpg",
|
|
95
|
+
"screen_name": "SomeOne",
|
|
96
|
+
"statuses_count": 180136,
|
|
97
|
+
"time_zone": "Atlantic Time (Canada)",
|
|
98
|
+
"utc_offset": -10800,
|
|
99
|
+
"verified": false
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": [
|
|
3
|
+
200,
|
|
4
|
+
200
|
|
5
|
+
],
|
|
6
|
+
"created_at": [
|
|
7
|
+
"Fri, 16 May 2014 00:47:34 +0000",
|
|
8
|
+
"Fri, 16 May 2014 00:47:34 +0000"
|
|
9
|
+
],
|
|
10
|
+
"hops": [
|
|
11
|
+
[
|
|
12
|
+
"http://www.something.com"
|
|
13
|
+
],
|
|
14
|
+
[ ]
|
|
15
|
+
],
|
|
16
|
+
"meta": {
|
|
17
|
+
"charset": [
|
|
18
|
+
"UTF-8",
|
|
19
|
+
"UTF-8"
|
|
20
|
+
],
|
|
21
|
+
"content_type": [
|
|
22
|
+
"text/html",
|
|
23
|
+
"text/html"
|
|
24
|
+
],
|
|
25
|
+
"description": [
|
|
26
|
+
"Some title",
|
|
27
|
+
""
|
|
28
|
+
],
|
|
29
|
+
"lang": [
|
|
30
|
+
"en-us",
|
|
31
|
+
"en"
|
|
32
|
+
],
|
|
33
|
+
"opengraph": [
|
|
34
|
+
{
|
|
35
|
+
"site_name": "Some Site",
|
|
36
|
+
"type": "website",
|
|
37
|
+
"description": "some description",
|
|
38
|
+
"url": "http://somewhere.com/somthing",
|
|
39
|
+
"title": "Other title"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"site_name": "Other site",
|
|
43
|
+
"description": "Other description",
|
|
44
|
+
"type": "instapp:photo",
|
|
45
|
+
"url": "http://notinstagram.com/p/notreal/",
|
|
46
|
+
"image": "http://tottallynotinstagram.com/p/a/e/reaaaaaaallllyyy-looooooooooooong-url.jpg",
|
|
47
|
+
"title": ""
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"normalized_url": [
|
|
52
|
+
"http://somwehere.com",
|
|
53
|
+
"http://notinstagram.com/p/lolcat"
|
|
54
|
+
],
|
|
55
|
+
"retweet_count": [
|
|
56
|
+
0,
|
|
57
|
+
0
|
|
58
|
+
],
|
|
59
|
+
"title": [
|
|
60
|
+
"title",
|
|
61
|
+
"NotLol"
|
|
62
|
+
],
|
|
63
|
+
"url": [
|
|
64
|
+
"http://somwehere.com/",
|
|
65
|
+
"http://something.com/p/lol/"
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": [
|
|
3
|
+
200
|
|
4
|
+
],
|
|
5
|
+
"created_at": [
|
|
6
|
+
"Fri, 16 May 2014 00:44:43 +0000"
|
|
7
|
+
],
|
|
8
|
+
"hops": [
|
|
9
|
+
[
|
|
10
|
+
"http://lolcat.com"
|
|
11
|
+
]
|
|
12
|
+
],
|
|
13
|
+
"meta": {
|
|
14
|
+
"charset": [
|
|
15
|
+
"UTF-8"
|
|
16
|
+
],
|
|
17
|
+
"content_type": [
|
|
18
|
+
"text/html"
|
|
19
|
+
],
|
|
20
|
+
"description": [
|
|
21
|
+
"LOL LOL LOL"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
[
|
|
25
|
+
"Tech",
|
|
26
|
+
"Hulu",
|
|
27
|
+
"Netflix"
|
|
28
|
+
]
|
|
29
|
+
],
|
|
30
|
+
"lang": [
|
|
31
|
+
"en"
|
|
32
|
+
],
|
|
33
|
+
"opengraph": [
|
|
34
|
+
{
|
|
35
|
+
"site_name": "Some Where",
|
|
36
|
+
"description": "Some desc",
|
|
37
|
+
"type": "article",
|
|
38
|
+
"url": "http://someurl.com/somthing/nothing",
|
|
39
|
+
"image": "http://somelongimage.com/image.jpg",
|
|
40
|
+
"title": "Some title"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"twitter": [
|
|
44
|
+
{
|
|
45
|
+
"card": "summary_large_image",
|
|
46
|
+
"creator": "@THR",
|
|
47
|
+
"url": "http://moredomains.com",
|
|
48
|
+
"site": "@THR"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"normalized_url": [
|
|
53
|
+
"http://i-m-tired-of-writing-this.com"
|
|
54
|
+
],
|
|
55
|
+
"retweet_count": [
|
|
56
|
+
0
|
|
57
|
+
],
|
|
58
|
+
"title": [
|
|
59
|
+
"There should be a better way to do this"
|
|
60
|
+
],
|
|
61
|
+
"url": [
|
|
62
|
+
"http://but-im-lazy-lol.com/lolololol'"
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": [
|
|
3
|
+
200
|
|
4
|
+
],
|
|
5
|
+
"created_at": [
|
|
6
|
+
"Fri, 16 May 2014 00:44:43 +0000"
|
|
7
|
+
],
|
|
8
|
+
"hops": [
|
|
9
|
+
[
|
|
10
|
+
"http://lolcat.com"
|
|
11
|
+
]
|
|
12
|
+
],
|
|
13
|
+
"meta": {
|
|
14
|
+
"charset": [
|
|
15
|
+
"UTF-8"
|
|
16
|
+
],
|
|
17
|
+
"content_type": [
|
|
18
|
+
"text/html"
|
|
19
|
+
],
|
|
20
|
+
"description": [
|
|
21
|
+
"LOL LOL LOL"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
[
|
|
25
|
+
"Tech",
|
|
26
|
+
"Hulu",
|
|
27
|
+
"Netflix"
|
|
28
|
+
]
|
|
29
|
+
],
|
|
30
|
+
"lang": [
|
|
31
|
+
"en"
|
|
32
|
+
],
|
|
33
|
+
"opengraph": [
|
|
34
|
+
{
|
|
35
|
+
"site_name": "Some Where",
|
|
36
|
+
"description": "Some desc",
|
|
37
|
+
"type": "article",
|
|
38
|
+
"url": "http://someurl.com/somthing/nothing",
|
|
39
|
+
"image": "http://somelongimage.com/image.jpg",
|
|
40
|
+
"title": "Some title"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"twitter": [
|
|
44
|
+
{
|
|
45
|
+
"card": "summary_large_image",
|
|
46
|
+
"creator": "@THR",
|
|
47
|
+
"url": "http://moredomains.com",
|
|
48
|
+
"site": "@THR"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"normalized_url": [
|
|
53
|
+
"http://you-thought-i-paste-this.com/right?haha=true"
|
|
54
|
+
],
|
|
55
|
+
"retweet_count": [
|
|
56
|
+
0
|
|
57
|
+
],
|
|
58
|
+
"title": [
|
|
59
|
+
"If you find this, it means I'm really bored now'"
|
|
60
|
+
],
|
|
61
|
+
"url": [
|
|
62
|
+
"http://i-hope-someone-uses-this-someday.com/sometime/somewhere.jpg"
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"interaction": {
|
|
3
|
+
"id": "1e16ebc90331a780e0748d58940628be",
|
|
4
|
+
"type": "twitter",
|
|
5
|
+
"created_at": "Thu, 15 Mar 2012 16:33:15 +0000",
|
|
6
|
+
"author": {
|
|
7
|
+
"id": 15005238
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"twitter": {
|
|
11
|
+
"user": {
|
|
12
|
+
"id": 15005238
|
|
13
|
+
},
|
|
14
|
+
"status": "user_delete"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"interaction": {
|
|
3
|
+
"id": "1e16ebc90331a780e0748d58940628be",
|
|
4
|
+
"type": "twitter",
|
|
5
|
+
"created_at": "Thu, 15 Mar 2012 16:33:15 +0000",
|
|
6
|
+
"author": {
|
|
7
|
+
"id": 15005238
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"twitter": {
|
|
11
|
+
"user": {
|
|
12
|
+
"id": 15005238
|
|
13
|
+
},
|
|
14
|
+
"status": "user_protect"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"interaction": {
|
|
3
|
+
"id": "1e16ebc90331a780e0748d58940628be",
|
|
4
|
+
"type": "twitter",
|
|
5
|
+
"created_at": "Thu, 15 Mar 2012 16:33:15 +0000",
|
|
6
|
+
"author": {
|
|
7
|
+
"id": 15005238
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"twitter": {
|
|
11
|
+
"user": {
|
|
12
|
+
"id": 15005238
|
|
13
|
+
},
|
|
14
|
+
"status": "user_suspend"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"interaction": {
|
|
3
|
+
"id": "1e16ebc90331a780e0748d58940628be",
|
|
4
|
+
"type": "twitter",
|
|
5
|
+
"created_at": "Thu, 15 Mar 2012 16:33:15 +0000",
|
|
6
|
+
"author": {
|
|
7
|
+
"id": 15005238
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"twitter": {
|
|
11
|
+
"user": {
|
|
12
|
+
"id": 15005238
|
|
13
|
+
},
|
|
14
|
+
"status": "user_undelete"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"interaction": {
|
|
3
|
+
"id": "1e16ebc90331a780e0748d58940628be",
|
|
4
|
+
"type": "twitter",
|
|
5
|
+
"created_at": "Thu, 15 Mar 2012 16:33:15 +0000",
|
|
6
|
+
"author": {
|
|
7
|
+
"id": 15005238
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"twitter": {
|
|
11
|
+
"user": {
|
|
12
|
+
"id": 15005238
|
|
13
|
+
},
|
|
14
|
+
"status": "user_unprotect"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"interaction": {
|
|
3
|
+
"id": "1e16ebc90331a780e0748d58940628be",
|
|
4
|
+
"type": "twitter",
|
|
5
|
+
"created_at": "Thu, 15 Mar 2012 16:33:15 +0000",
|
|
6
|
+
"author": {
|
|
7
|
+
"id": 15005238
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"twitter": {
|
|
11
|
+
"user": {
|
|
12
|
+
"id": 15005238
|
|
13
|
+
},
|
|
14
|
+
"status": "user_unsuspend"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "123456789012345",
|
|
3
|
+
"retweet": {
|
|
4
|
+
"count": 3,
|
|
5
|
+
"created_at": "Fri, 16 May 2014 00:24:11 +0000",
|
|
6
|
+
"display_urls": [
|
|
7
|
+
"someurl.com/lol"
|
|
8
|
+
],
|
|
9
|
+
"domains": [
|
|
10
|
+
"someurl.com"
|
|
11
|
+
],
|
|
12
|
+
"id": "123456789012345",
|
|
13
|
+
"lang": "en",
|
|
14
|
+
"links": [
|
|
15
|
+
"http://someurl.com/lol"
|
|
16
|
+
],
|
|
17
|
+
"mentions": [
|
|
18
|
+
"what"
|
|
19
|
+
],
|
|
20
|
+
"source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>",
|
|
21
|
+
"text": "Once again, writing lies to make things work. Now that's ironic. http://someurl.com/lol",
|
|
22
|
+
"user": {
|
|
23
|
+
"created_at": "Wed, 11 Mar 2009 22:09:17 +0000",
|
|
24
|
+
"description": "I'm Rayko, impersonating a fictional character that no one knows, just to make my tests pasts",
|
|
25
|
+
"favourites_count": 144,
|
|
26
|
+
"followers_count": 2273,
|
|
27
|
+
"friends_count": 702,
|
|
28
|
+
"geo_enabled": true,
|
|
29
|
+
"id": 12345678,
|
|
30
|
+
"id_str": "12345678",
|
|
31
|
+
"lang": "en",
|
|
32
|
+
"listed_count": 122,
|
|
33
|
+
"location": "LOL",
|
|
34
|
+
"name": "Rayko Diarghi",
|
|
35
|
+
"profile_image_url": "http://some-twitter-image.com/1212312312.jpg",
|
|
36
|
+
"profile_image_url_https": "https://some-twitter-image.com/1212312312.jpg?secure=true",
|
|
37
|
+
"screen_name": "raykodrg",
|
|
38
|
+
"statuses_count": 2608,
|
|
39
|
+
"time_zone": "Eastern Time (US & Canada)",
|
|
40
|
+
"url": "http://someurl.com/lol",
|
|
41
|
+
"utc_offset": -14400,
|
|
42
|
+
"verified": true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"retweeted": {
|
|
46
|
+
"created_at": "Fri, 16 May 2014 00:21:09 +0000",
|
|
47
|
+
"id": "1129319238091283",
|
|
48
|
+
"source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>",
|
|
49
|
+
"user": {
|
|
50
|
+
"created_at": "Mon, 26 Apr 2010 10:25:46 +0000",
|
|
51
|
+
"description": "Oh, lol, I made a fake retweet of my fake self being. Now that's sad.",
|
|
52
|
+
"favourites_count": 41,
|
|
53
|
+
"followers_count": 4243,
|
|
54
|
+
"friends_count": 2056,
|
|
55
|
+
"geo_enabled": false,
|
|
56
|
+
"id": 123123123123,
|
|
57
|
+
"id_str": "123123123123",
|
|
58
|
+
"lang": "en",
|
|
59
|
+
"listed_count": 145,
|
|
60
|
+
"location": "New York",
|
|
61
|
+
"name": "almar latour",
|
|
62
|
+
"profile_image_url": "http://more-twitter-images.com/lol.png",
|
|
63
|
+
"profile_image_url_https": "https://more-twitter-images.com/lol.png?secure=true",
|
|
64
|
+
"screen_name": "raykodrg2",
|
|
65
|
+
"statuses_count": 478,
|
|
66
|
+
"url": "http://someurl.com/lol",
|
|
67
|
+
"verified": true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"created_at": "Fri, 16 May 2014 04:07:34 +0000",
|
|
3
|
+
"display_urls": [
|
|
4
|
+
"top10stocks2buy.com/i.php?http://w…"
|
|
5
|
+
],
|
|
6
|
+
"domains": [
|
|
7
|
+
"top10stocks2buy.com"
|
|
8
|
+
],
|
|
9
|
+
"id": "467154364369350659",
|
|
10
|
+
"lang": "en",
|
|
11
|
+
"links": [
|
|
12
|
+
"http://top10stocks2buy.com/i.php?http://www.tricities.com/gallery/featured/collection_b6b3cfcc-dc46-11e3-8051-0017a43b2370.html&t6t=SCX"
|
|
13
|
+
],
|
|
14
|
+
"source": "<a href=\"http://dlvr.it\" rel=\"nofollow\">dlvr.it</a>",
|
|
15
|
+
"text": "$SCX Avoca Field Day http://t.co/co8QigktOJ",
|
|
16
|
+
"user": {
|
|
17
|
+
"created_at": "Thu, 22 Aug 2013 16:34:22 +0000",
|
|
18
|
+
"favourites_count": 0,
|
|
19
|
+
"followers_count": 148,
|
|
20
|
+
"friends_count": 0,
|
|
21
|
+
"geo_enabled": false,
|
|
22
|
+
"id": 1691490972,
|
|
23
|
+
"id_str": "1691490972",
|
|
24
|
+
"lang": "en",
|
|
25
|
+
"listed_count": 7,
|
|
26
|
+
"name": "Viva Sobek",
|
|
27
|
+
"profile_image_url": "http://pbs.twimg.com/profile_images/378800000372103417/2617d282327358a73d9d5eda143a5877_normal.jpeg",
|
|
28
|
+
"profile_image_url_https": "https://pbs.twimg.com/profile_images/378800000372103417/2617d282327358a73d9d5eda143a5877_normal.jpeg",
|
|
29
|
+
"screen_name": "VivaSobek",
|
|
30
|
+
"statuses_count": 77225,
|
|
31
|
+
"verified": false
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe DaFace::Datasift do
|
|
4
|
+
context 'with lots of valid data' do
|
|
5
|
+
before do
|
|
6
|
+
@data = fixture('interactions/collection.json')
|
|
7
|
+
@parser = DaFace::Datasift::Parser.new
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'does not raise errors' do
|
|
11
|
+
expect(Proc.new{@result = @parser.parse_collection(@data)}).not_to raise_error
|
|
12
|
+
expect(@result.kind_of?(Array)).to eq(true)
|
|
13
|
+
expect(@result.size).not_to eq(0)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'simplecov'
|
|
2
|
+
SimpleCov.start
|
|
3
|
+
|
|
4
|
+
require 'da_face'
|
|
5
|
+
|
|
6
|
+
def fixture_path
|
|
7
|
+
File.expand_path('../fixtures', __FILE__)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def fixture(file)
|
|
11
|
+
File.read(fixture_path + '/' + file)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def json_fixture(file)
|
|
15
|
+
JSON.parse File.read(fixture_path + '/' + file)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
RSpec.configure do |config|
|
|
19
|
+
config.after :each do
|
|
20
|
+
DaFace.reset_config
|
|
21
|
+
Excon.stubs.clear
|
|
22
|
+
end
|
|
23
|
+
end
|