fetcher-microdata-facebook 0.0.1 → 0.0.2
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.
- data/Gemfile.lock +1 -1
- data/features/stepdefs/transalte_post_to_schema.rb +0 -1
- data/features/translate_post_to_schema.feature +57 -74
- data/lib/fetcher/microdata/article_small/facebook/coercer.rb +5 -5
- data/lib/fetcher/microdata/facebook/version.rb +1 -1
- data/lib/fetcher/microdata/person_user/facebook/coercer.rb +3 -3
- data/lib/fetcher/microdata/user_comments/facebook/coercer.rb +3 -3
- data/pkg/fetcher-microdata-facebook-0.0.1.gem +0 -0
- data/spec/comment.json +8 -7
- data/spec/fetcher/microdata/article_small/facebook/coercer_spec.rb +2 -2
- data/spec/fetcher/microdata/user_comments/facebook/coercer_spec.rb +2 -2
- data/spec/like.json +0 -1
- data/spec/post.json +38 -48
- data/spec/user.json +4 -4
- data/spec/viewer.json +4 -4
- metadata +3 -4
- data/spec/microdata_like.json +0 -16
data/Gemfile.lock
CHANGED
@@ -10,58 +10,50 @@ Feature: Translate facebook to schema.org/Person/User + getfetcher.net/Item
|
|
10
10
|
|
11
11
|
"""
|
12
12
|
{
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
"
|
21
|
-
"
|
22
|
-
"
|
23
|
-
"
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
"id": "600129837"
|
56
|
-
},
|
57
|
-
"message": "che vos sabes mucha Inglé no?",
|
58
|
-
"created_time": "2012-10-27T15:45:12+0000",
|
59
|
-
"likes": 2
|
60
|
-
}
|
61
|
-
],
|
62
|
-
"count": 2
|
63
|
-
}
|
13
|
+
"post_id": "403075259745940_439408706112595",
|
14
|
+
"message": "dd2",
|
15
|
+
"actor_id": 403075259745940,
|
16
|
+
"viewer_id": 735576666,
|
17
|
+
"created_time": 1355183865,
|
18
|
+
"comments":
|
19
|
+
{
|
20
|
+
"can_remove": true,
|
21
|
+
"can_post": true,
|
22
|
+
"count": 2,
|
23
|
+
"comment_list": [
|
24
|
+
{
|
25
|
+
"fromid": 403075259745940,
|
26
|
+
"time": 1355249145,
|
27
|
+
"text": "hola",
|
28
|
+
"text_tags": [],
|
29
|
+
"id": "403075259745940_439408706112595_4375492",
|
30
|
+
"likes": 2,
|
31
|
+
"user_likes": true,
|
32
|
+
"post_fbid": 439712582748874
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"fromid": 735576666,
|
36
|
+
"time": 1355249161,
|
37
|
+
"text": "hola",
|
38
|
+
"text_tags": [],
|
39
|
+
"id": "403075259745940_439408706112595_4375493",
|
40
|
+
"likes": 1,
|
41
|
+
"user_likes": false,
|
42
|
+
"post_fbid": 439712649415534}
|
43
|
+
]
|
44
|
+
},
|
45
|
+
"updated_time": 1355249161,
|
46
|
+
"type": 46,
|
47
|
+
"likes":
|
48
|
+
{
|
49
|
+
"href": "http://www.facebook.com/browse/likes/?id=439408706112595",
|
50
|
+
"count": 3,
|
51
|
+
"sample": [1513366815, 735576666],
|
52
|
+
"friends": [],
|
53
|
+
"user_likes": true,
|
54
|
+
"can_like": true
|
64
55
|
}
|
56
|
+
}
|
65
57
|
|
66
58
|
"""
|
67
59
|
And the viewer:
|
@@ -81,10 +73,10 @@ Feature: Translate facebook to schema.org/Person/User + getfetcher.net/Item
|
|
81
73
|
],
|
82
74
|
"properties": {
|
83
75
|
"Item#id": [
|
84
|
-
"
|
76
|
+
"403075259745940_439408706112595"
|
85
77
|
],
|
86
78
|
"articleBody": [
|
87
|
-
"
|
79
|
+
"dd2"
|
88
80
|
],
|
89
81
|
"author": [
|
90
82
|
{
|
@@ -96,10 +88,7 @@ Feature: Translate facebook to schema.org/Person/User + getfetcher.net/Item
|
|
96
88
|
"http://getfetcher.net/Item"
|
97
89
|
],
|
98
90
|
"Item#id": [
|
99
|
-
"
|
100
|
-
],
|
101
|
-
"name": [
|
102
|
-
"Tomás Mehdi"
|
91
|
+
"403075259745940"
|
103
92
|
]
|
104
93
|
}
|
105
94
|
}
|
@@ -129,10 +118,10 @@ Feature: Translate facebook to schema.org/Person/User + getfetcher.net/Item
|
|
129
118
|
],
|
130
119
|
"properties": {
|
131
120
|
"Item#id": [
|
132
|
-
"
|
121
|
+
"403075259745940_439408706112595_4375492"
|
133
122
|
],
|
134
123
|
"commentText": [
|
135
|
-
"
|
124
|
+
"hola"
|
136
125
|
],
|
137
126
|
"creator": [
|
138
127
|
{
|
@@ -144,19 +133,16 @@ Feature: Translate facebook to schema.org/Person/User + getfetcher.net/Item
|
|
144
133
|
"http://getfetcher.net/Item"
|
145
134
|
],
|
146
135
|
"Item#id": [
|
147
|
-
"
|
148
|
-
],
|
149
|
-
"name": [
|
150
|
-
"Facu Vivas"
|
136
|
+
"403075259745940"
|
151
137
|
]
|
152
138
|
}
|
153
139
|
}
|
154
140
|
],
|
155
141
|
"commentTime": [
|
156
|
-
"
|
142
|
+
"1355249145"
|
157
143
|
],
|
158
144
|
"url": [
|
159
|
-
"https://www.facebook.com/
|
145
|
+
"https://www.facebook.com/439408706112595?comment_id=4375492"
|
160
146
|
]
|
161
147
|
}
|
162
148
|
},
|
@@ -166,10 +152,10 @@ Feature: Translate facebook to schema.org/Person/User + getfetcher.net/Item
|
|
166
152
|
],
|
167
153
|
"properties": {
|
168
154
|
"Item#id": [
|
169
|
-
"
|
155
|
+
"403075259745940_439408706112595_4375493"
|
170
156
|
],
|
171
157
|
"commentText": [
|
172
|
-
"
|
158
|
+
"hola"
|
173
159
|
],
|
174
160
|
"creator": [
|
175
161
|
{
|
@@ -181,25 +167,22 @@ Feature: Translate facebook to schema.org/Person/User + getfetcher.net/Item
|
|
181
167
|
"http://getfetcher.net/Item"
|
182
168
|
],
|
183
169
|
"Item#id": [
|
184
|
-
"
|
185
|
-
],
|
186
|
-
"name": [
|
187
|
-
"Conrado Mader Blanco"
|
170
|
+
"735576666"
|
188
171
|
]
|
189
172
|
}
|
190
173
|
}
|
191
174
|
],
|
192
175
|
"commentTime": [
|
193
|
-
"
|
176
|
+
"1355249161"
|
194
177
|
],
|
195
178
|
"url": [
|
196
|
-
"https://www.facebook.com/
|
179
|
+
"https://www.facebook.com/439408706112595?comment_id=4375493"
|
197
180
|
]
|
198
181
|
}
|
199
182
|
}
|
200
183
|
],
|
201
184
|
"dateCreated": [
|
202
|
-
"
|
185
|
+
"1355183865"
|
203
186
|
],
|
204
187
|
"provider": [
|
205
188
|
"facebook"
|
@@ -5,24 +5,24 @@ module Fetcher
|
|
5
5
|
Coercer = proc { |post, viewer|
|
6
6
|
resp = {
|
7
7
|
:likes_type => "http://schema.org/AggregateRating/Likes",
|
8
|
-
:id => post["
|
8
|
+
:id => post["post_id"],
|
9
9
|
:comments => [],
|
10
10
|
:likes => [],
|
11
11
|
:articleBody => post["message"],
|
12
|
-
:dateCreated => post["created_time"],
|
13
|
-
:author => PersonUser.new(:facebook, post["
|
12
|
+
:dateCreated => "#{post["created_time"]}",
|
13
|
+
:author => PersonUser.new(:facebook, { "id" => "#{post["actor_id"]}" }),
|
14
14
|
:likes_count => post["likes"]["count"],
|
15
15
|
:comments_count => post["comments"]["count"],
|
16
16
|
:viewer => PersonUser.new(:facebook, viewer),
|
17
17
|
:provider => ["facebook"]
|
18
18
|
}
|
19
19
|
i = 0
|
20
|
-
post["likes"]["
|
20
|
+
post["likes"]["sample"].each do |like|
|
21
21
|
#resp[:likes].push Like.new :facebook, like
|
22
22
|
resp[:likes].push "like#{i}"
|
23
23
|
i = i + 1
|
24
24
|
end
|
25
|
-
post["comments"]["
|
25
|
+
post["comments"]["comment_list"].each do |comment|
|
26
26
|
resp[:comments].push UserComments.new :facebook, comment
|
27
27
|
end
|
28
28
|
resp
|
@@ -2,11 +2,11 @@ module Fetcher
|
|
2
2
|
class Microdata
|
3
3
|
class PersonUser
|
4
4
|
module Facebook
|
5
|
-
Coercer = proc { |
|
5
|
+
Coercer = proc { |user|
|
6
6
|
{
|
7
7
|
:additionalType => "http://getfetcher.net/Item",
|
8
|
-
:id =>
|
9
|
-
:name =>
|
8
|
+
:id => user["id"],
|
9
|
+
:name => user["name"]
|
10
10
|
}
|
11
11
|
}
|
12
12
|
end
|
@@ -5,10 +5,10 @@ module Fetcher
|
|
5
5
|
Coercer = proc { |comment|
|
6
6
|
{
|
7
7
|
:id => comment["id"],
|
8
|
-
:creator => PersonUser.new(:facebook, comment["
|
9
|
-
:commentText => comment["
|
8
|
+
:creator => PersonUser.new(:facebook, { "id" => "#{comment["fromid"]}" }),
|
9
|
+
:commentText => comment["text"],
|
10
10
|
:likes_count => comment["likes"],
|
11
|
-
:commentTime => comment["
|
11
|
+
:commentTime => "#{comment["time"]}"
|
12
12
|
}
|
13
13
|
}
|
14
14
|
end
|
Binary file
|
data/spec/comment.json
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
"
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
"
|
8
|
-
"
|
2
|
+
"fromid": 403075259745940,
|
3
|
+
"time": 1355249145,
|
4
|
+
"text": "hola",
|
5
|
+
"text_tags": [],
|
6
|
+
"id": "403075259745940_439408706112595_4375492",
|
7
|
+
"likes": 2,
|
8
|
+
"user_likes": true,
|
9
|
+
"post_fbid": 439712582748874
|
9
10
|
}
|
@@ -9,7 +9,7 @@ describe 'Fetcher::Microdata::ArticleSmall::Facebook::Coercer' do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should initialize the id" do
|
12
|
-
@translated_post[:id].should == @post["
|
12
|
+
@translated_post[:id].should == @post["post_id"]
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should initialize the likes_type" do
|
@@ -25,7 +25,7 @@ describe 'Fetcher::Microdata::ArticleSmall::Facebook::Coercer' do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should initialize the dateCreated post" do
|
28
|
-
@translated_post[:dateCreated].should == @post["created_time"]
|
28
|
+
@translated_post[:dateCreated].should == "#{@post["created_time"]}"
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should initialize the likes count" do
|
@@ -16,11 +16,11 @@ describe 'Fetcher::Microdata::UserComments::Facebook::Coercer' do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should initialize the message" do
|
19
|
-
@comment[:commentText].should == @comment_ex["
|
19
|
+
@comment[:commentText].should == @comment_ex["text"]
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should initialize the created time" do
|
23
|
-
@comment[:commentTime].should == @comment_ex["
|
23
|
+
@comment[:commentTime].should == "#{@comment_ex["time"]}"
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should initialize the like count if there are likes" do
|
data/spec/like.json
CHANGED
data/spec/post.json
CHANGED
@@ -1,53 +1,43 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
"
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
"updated_time": "2012-10-27T15:45:12+0000",
|
12
|
-
"likes": {
|
13
|
-
"data": [
|
2
|
+
"post_id": "403075259745940_439408706112595",
|
3
|
+
"message": "dd2",
|
4
|
+
"created_time": 1355183865,
|
5
|
+
"comments":
|
6
|
+
{
|
7
|
+
"can_remove": true,
|
8
|
+
"can_post": true,
|
9
|
+
"count": 2,
|
10
|
+
"comment_list": [
|
14
11
|
{
|
15
|
-
"
|
16
|
-
"
|
17
|
-
|
12
|
+
"fromid": 403075259745940,
|
13
|
+
"time": 1355249145,
|
14
|
+
"text": "hola",
|
15
|
+
"text_tags": [],
|
16
|
+
"id": "403075259745940_439408706112595_4375492",
|
17
|
+
"likes": 2,
|
18
|
+
"user_likes": true,
|
19
|
+
"post_fbid": 439712582748874
|
20
|
+
},
|
18
21
|
{
|
19
|
-
"
|
20
|
-
"
|
21
|
-
|
22
|
-
|
23
|
-
"
|
24
|
-
"
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
},
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
},
|
40
|
-
{
|
41
|
-
"id": "735576666_10151298637466667_26116661",
|
42
|
-
"from": {
|
43
|
-
"name": "Conrado Mader Blanco",
|
44
|
-
"id": "600129837"
|
45
|
-
},
|
46
|
-
"message": "che vos sabes mucha Inglé no?",
|
47
|
-
"created_time": "2012-10-27T15:45:12+0000",
|
48
|
-
"likes": 2
|
49
|
-
}
|
50
|
-
],
|
51
|
-
"count": 2
|
22
|
+
"fromid": 735576666,
|
23
|
+
"time": 1355249161,
|
24
|
+
"text": "hola",
|
25
|
+
"text_tags": [],
|
26
|
+
"id": "403075259745940_439408706112595_4375493",
|
27
|
+
"likes": 1,
|
28
|
+
"user_likes": false,
|
29
|
+
"post_fbid": 439712649415534}
|
30
|
+
]
|
31
|
+
},
|
32
|
+
"updated_time": 1355249161,
|
33
|
+
"type": 46,
|
34
|
+
"likes":
|
35
|
+
{
|
36
|
+
"href": "http://www.facebook.com/browse/likes/?id=439408706112595",
|
37
|
+
"count": 3,
|
38
|
+
"sample": [1513366815, 735576666],
|
39
|
+
"friends": [],
|
40
|
+
"user_likes": true,
|
41
|
+
"can_like": true
|
52
42
|
}
|
53
43
|
}
|
data/spec/user.json
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
{
|
2
|
+
"id": "735576666",
|
3
|
+
"name": "Tomás Mehdi"
|
4
|
+
}
|
data/spec/viewer.json
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
{
|
2
|
+
"id": "735576666",
|
3
|
+
"name": "Tomás Mehdi"
|
4
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fetcher-microdata-facebook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-12-
|
13
|
+
date: 2012-12-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: discoverer
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/fetcher/microdata/like/facebook/coercer.rb
|
103
103
|
- lib/fetcher/microdata/person_user/facebook/coercer.rb
|
104
104
|
- lib/fetcher/microdata/user_comments/facebook/coercer.rb
|
105
|
+
- pkg/fetcher-microdata-facebook-0.0.1.gem
|
105
106
|
- samples/agregate_rating_for_forward_steps
|
106
107
|
- spec/comment.json
|
107
108
|
- spec/fetcher/microdata/article_small/facebook/coercer_spec.rb
|
@@ -109,7 +110,6 @@ files:
|
|
109
110
|
- spec/fetcher/microdata/person_user/facebook/coercer_spec.rb
|
110
111
|
- spec/fetcher/microdata/user_comments/facebook/coercer_spec.rb
|
111
112
|
- spec/like.json
|
112
|
-
- spec/microdata_like.json
|
113
113
|
- spec/post.json
|
114
114
|
- spec/spec_helper.rb
|
115
115
|
- spec/user.json
|
@@ -150,7 +150,6 @@ test_files:
|
|
150
150
|
- spec/fetcher/microdata/person_user/facebook/coercer_spec.rb
|
151
151
|
- spec/fetcher/microdata/user_comments/facebook/coercer_spec.rb
|
152
152
|
- spec/like.json
|
153
|
-
- spec/microdata_like.json
|
154
153
|
- spec/post.json
|
155
154
|
- spec/spec_helper.rb
|
156
155
|
- spec/user.json
|
data/spec/microdata_like.json
DELETED