fetcher-microdata-facebook 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fetcher-microdata-facebook (0.0.0)
4
+ fetcher-microdata-facebook (0.0.2)
5
5
  discoverer
6
6
  fetcher-microdata
7
7
  virtus
@@ -14,6 +14,5 @@ end
14
14
 
15
15
  Then /^I should have post:$/ do |string|
16
16
  @schema = JSON.parse string
17
- binding.pry
18
17
  @translated.to.hash.should == @schema
19
18
  end
@@ -10,58 +10,50 @@ Feature: Translate facebook to schema.org/Person/User + getfetcher.net/Item
10
10
 
11
11
  """
12
12
  {
13
- "id": "735576666_10151298637466667",
14
- "from": {
15
- "name": "Tomás Mehdi",
16
- "id": "735576666"
17
- },
18
- "message": "Be ready for not be ready",
19
- "type": "status",
20
- "status_type": "mobile_status_update",
21
- "created_time": "2012-10-27T15:18:35+0000",
22
- "updated_time": "2012-10-27T15:45:12+0000",
23
- "likes": {
24
- "data": [
25
- {
26
- "name": "Nahuel García Ocampo",
27
- "id": "536017463"
28
- },
29
- {
30
- "name": "Luis Suas",
31
- "id": "1002769970"
32
- },
33
- {
34
- "name": "Sol Laborde",
35
- "id": "1060147124"
36
- }
37
- ],
38
- "count": 3
39
- },
40
- "comments": {
41
- "data": [
42
- {
43
- "id": "735576666_10151298637466667_26116437",
44
- "from": {
45
- "name": "Facu Vivas",
46
- "id": "1265409676"
47
- },
48
- "message": "ser o no ser? jaja",
49
- "created_time": "2012-10-27T15:27:29+0000"
50
- },
51
- {
52
- "id": "735576666_10151298637466667_26116661",
53
- "from": {
54
- "name": "Conrado Mader Blanco",
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
- "735576666_10151298637466667"
76
+ "403075259745940_439408706112595"
85
77
  ],
86
78
  "articleBody": [
87
- "Be ready for not be ready"
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
- "735576666"
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
- "735576666_10151298637466667_26116437"
121
+ "403075259745940_439408706112595_4375492"
133
122
  ],
134
123
  "commentText": [
135
- "ser o no ser? jaja"
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
- "1265409676"
148
- ],
149
- "name": [
150
- "Facu Vivas"
136
+ "403075259745940"
151
137
  ]
152
138
  }
153
139
  }
154
140
  ],
155
141
  "commentTime": [
156
- "2012-10-27T15:27:29+0000"
142
+ "1355249145"
157
143
  ],
158
144
  "url": [
159
- "https://www.facebook.com/10151298637466667?comment_id=26116437"
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
- "735576666_10151298637466667_26116661"
155
+ "403075259745940_439408706112595_4375493"
170
156
  ],
171
157
  "commentText": [
172
- "che vos sabes mucha Inglé no?"
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
- "600129837"
185
- ],
186
- "name": [
187
- "Conrado Mader Blanco"
170
+ "735576666"
188
171
  ]
189
172
  }
190
173
  }
191
174
  ],
192
175
  "commentTime": [
193
- "2012-10-27T15:45:12+0000"
176
+ "1355249161"
194
177
  ],
195
178
  "url": [
196
- "https://www.facebook.com/10151298637466667?comment_id=26116661"
179
+ "https://www.facebook.com/439408706112595?comment_id=4375493"
197
180
  ]
198
181
  }
199
182
  }
200
183
  ],
201
184
  "dateCreated": [
202
- "2012-10-27T15:18:35+0000"
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["id"],
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["from"]),
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"]["data"].each do |like|
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"]["data"].each do |comment|
25
+ post["comments"]["comment_list"].each do |comment|
26
26
  resp[:comments].push UserComments.new :facebook, comment
27
27
  end
28
28
  resp
@@ -1,7 +1,7 @@
1
1
  module Fetcher
2
2
  class Microdata
3
3
  module Facebook
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
6
6
  end
7
7
  end
@@ -2,11 +2,11 @@ module Fetcher
2
2
  class Microdata
3
3
  class PersonUser
4
4
  module Facebook
5
- Coercer = proc { |original_tweet|
5
+ Coercer = proc { |user|
6
6
  {
7
7
  :additionalType => "http://getfetcher.net/Item",
8
- :id => original_tweet["id"],
9
- :name => original_tweet["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["from"]),
9
- :commentText => comment["message"],
8
+ :creator => PersonUser.new(:facebook, { "id" => "#{comment["fromid"]}" }),
9
+ :commentText => comment["text"],
10
10
  :likes_count => comment["likes"],
11
- :commentTime => comment["created_time"]
11
+ :commentTime => "#{comment["time"]}"
12
12
  }
13
13
  }
14
14
  end
@@ -1,9 +1,10 @@
1
1
  {
2
- "id": "735576666_10151298637466667_26116437",
3
- "from": {
4
- "name": "Facu Vivas",
5
- "id": "1265409676"
6
- },
7
- "message": "ser o no ser? jaja",
8
- "created_time": "2012-10-27T15:27:29+0000"
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["id"]
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["message"]
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["created_time"]
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
@@ -1,4 +1,3 @@
1
1
  {
2
- "name": "Nahuel García Ocampo",
3
2
  "id": "536017463"
4
3
  }
@@ -1,53 +1,43 @@
1
1
  {
2
- "id": "735576666_10151298637466667",
3
- "from": {
4
- "name": "Tomás Mehdi",
5
- "id": "735576666"
6
- },
7
- "message": "Be ready for not be ready",
8
- "type": "status",
9
- "status_type": "mobile_status_update",
10
- "created_time": "2012-10-27T15:18:35+0000",
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
- "name": "Nahuel García Ocampo",
16
- "id": "536017463"
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
- "name": "Luis Suas",
20
- "id": "1002769970"
21
- },
22
- {
23
- "name": "Sol Laborde",
24
- "id": "1060147124"
25
- }
26
- ],
27
- "count": 3
28
- },
29
- "comments": {
30
- "data": [
31
- {
32
- "id": "735576666_10151298637466667_26116437",
33
- "from": {
34
- "name": "Facu Vivas",
35
- "id": "1265409676"
36
- },
37
- "message": "ser o no ser? jaja",
38
- "created_time": "2012-10-27T15:27:29+0000"
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
  }
@@ -1,4 +1,4 @@
1
- {
2
- "name": "Tomás Mehdi",
3
- "id": "735576666"
4
- }
1
+ {
2
+ "id": "735576666",
3
+ "name": "Tomás Mehdi"
4
+ }
@@ -1,4 +1,4 @@
1
- {
2
- "id": "735576666",
3
- "name": "Tomás Mehdi"
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.1
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-07 00:00:00.000000000 Z
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
@@ -1,16 +0,0 @@
1
- {
2
- "type": [
3
- "http://schema.org/Person/User"
4
- ],
5
- "properties": {
6
- "additionalType": [
7
- "http://getfetcher.net/Item"
8
- ],
9
- "http://getfetcher.net/Item#id": [
10
- "536017463"
11
- ],
12
- "name": [
13
- "Nahuel García Ocampo"
14
- ]
15
- }
16
- }