fetcher-microdata-facebook 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ # A sample Gemfile
2
+ source "https://rubygems.org"
3
+
4
+
5
+
6
+ source 'https://rubygems.org'
7
+
8
+ gemspec
9
+
10
+ gem "virtus"
11
+ gem "json"
12
+ gem "discoverer"
13
+ gem 'rake'
14
+ gem 'fetcher-microdata'
15
+ gem 'twitter'
16
+ gem 'symbolmatrix'
17
+
18
+ group :cucumber do
19
+ gem "rspec"
20
+ gem 'pry'
21
+ gem 'cucumber'
22
+ end
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fetcher-microdata-facebook (0.0.0)
5
+ discoverer
6
+ fetcher-microdata
7
+ virtus
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ backports (2.6.5)
14
+ builder (3.1.4)
15
+ coderay (1.0.8)
16
+ cucumber (1.2.1)
17
+ builder (>= 2.1.2)
18
+ diff-lcs (>= 1.1.3)
19
+ gherkin (~> 2.11.0)
20
+ json (>= 1.4.6)
21
+ diff-lcs (1.1.3)
22
+ discoverer (0.0.1)
23
+ virtus
24
+ faraday (0.8.4)
25
+ multipart-post (~> 1.1)
26
+ fetcher-microdata (0.0.13)
27
+ discoverer
28
+ gherkin (2.11.5)
29
+ json (>= 1.4.6)
30
+ json (1.7.5)
31
+ method_source (0.8.1)
32
+ multi_json (1.4.0)
33
+ multipart-post (1.1.5)
34
+ pry (0.9.10)
35
+ coderay (~> 1.0.5)
36
+ method_source (~> 0.8)
37
+ slop (~> 3.3.1)
38
+ rake (10.0.2)
39
+ rspec (2.12.0)
40
+ rspec-core (~> 2.12.0)
41
+ rspec-expectations (~> 2.12.0)
42
+ rspec-mocks (~> 2.12.0)
43
+ rspec-core (2.12.1)
44
+ rspec-expectations (2.12.0)
45
+ diff-lcs (~> 1.1.3)
46
+ rspec-mocks (2.12.0)
47
+ simple_oauth (0.1.9)
48
+ slop (3.3.3)
49
+ symbolmatrix (0.0.1)
50
+ twitter (4.4.0)
51
+ faraday (~> 0.8)
52
+ multi_json (~> 1.3)
53
+ simple_oauth (~> 0.1.6)
54
+ virtus (0.5.2)
55
+ backports (~> 2.6.1)
56
+
57
+ PLATFORMS
58
+ ruby
59
+
60
+ DEPENDENCIES
61
+ cucumber
62
+ discoverer
63
+ fetcher-microdata
64
+ fetcher-microdata-facebook!
65
+ json
66
+ pry
67
+ rake
68
+ rspec
69
+ symbolmatrix
70
+ twitter
71
+ virtus
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Fetcher
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
File without changes
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ require "rspec/core/rake_task"
5
+
6
+ desc "Run specs"
7
+ RSpec::Core::RakeTask.new(:spec) do |t|
8
+ t.pattern = "./spec/**/*_spec.rb"
9
+ end
10
+
11
+ task :default => :spec
@@ -0,0 +1,19 @@
1
+ require "pry"
2
+
3
+ Given /^the facebook post:$/ do |json_post|
4
+ @post = JSON.parse json_post
5
+ end
6
+
7
+ And /^the viewer:$/ do |json_viewer|
8
+ @viewer = JSON.parse json_viewer
9
+ end
10
+
11
+ When /^I convert it into schema\.org\/Article\/Small$/ do
12
+ @translated = Fetcher::Microdata::ArticleSmall.new :facebook, @post, @viewer
13
+ end
14
+
15
+ Then /^I should have post:$/ do |string|
16
+ @schema = JSON.parse string
17
+ binding.pry
18
+ @translated.to.hash.should == @schema
19
+ end
@@ -0,0 +1,14 @@
1
+ require "pry"
2
+
3
+ Given /^the facebook user:$/ do |json_user|
4
+ @user = JSON.parse json_user
5
+ end
6
+
7
+ When /^I convert it into schema\.org\/Person\/User$/ do
8
+ @translated = Fetcher::Microdata::PersonUser.new :facebook, @user
9
+ end
10
+
11
+ Then /^I should have user:$/ do |string|
12
+ @schema = JSON.parse string
13
+ @translated.to.hash.should == @schema
14
+ end
@@ -0,0 +1,5 @@
1
+ $LOAD_PATH << File.expand_path('../../../lib', __FILE__)
2
+ require 'fetcher-microdata'
3
+ require 'fetcher-microdata-facebook'
4
+
5
+ require 'pry'
@@ -0,0 +1,213 @@
1
+ Feature: Translate facebook to schema.org/Person/User + getfetcher.net/Item
2
+
3
+ In order to send a standardized-properties form of the facebook information
4
+ As a developer
5
+ I want to be able to convert from Facebook API to
6
+ schema.org based vocabulary
7
+
8
+ Scenario: Converting a json facebook post into a json schema
9
+ Given the facebook post:
10
+
11
+ """
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
+ }
64
+ }
65
+
66
+ """
67
+ And the viewer:
68
+ """
69
+ {
70
+ "id": "735576666",
71
+ "name": "Tomás Mehdi"
72
+ }
73
+ """
74
+ When I convert it into schema.org/Article/Small
75
+ Then I should have post:
76
+
77
+ """
78
+ {
79
+ "type": [
80
+ "http://schema.org/Article/Small"
81
+ ],
82
+ "properties": {
83
+ "Item#id": [
84
+ "735576666_10151298637466667"
85
+ ],
86
+ "articleBody": [
87
+ "Be ready for not be ready"
88
+ ],
89
+ "author": [
90
+ {
91
+ "type": [
92
+ "http://schema.org/Person/User"
93
+ ],
94
+ "properties": {
95
+ "additionalType": [
96
+ "http://getfetcher.net/Item"
97
+ ],
98
+ "Item#id": [
99
+ "735576666"
100
+ ],
101
+ "name": [
102
+ "Tomás Mehdi"
103
+ ]
104
+ }
105
+ }
106
+ ],
107
+ "Item#viewer": [
108
+ {
109
+ "type": [
110
+ "http://schema.org/Person/User"
111
+ ],
112
+ "properties": {
113
+ "additionalType": [
114
+ "http://getfetcher.net/Item"
115
+ ],
116
+ "Item#id": [
117
+ "735576666"
118
+ ],
119
+ "name": [
120
+ "Tomás Mehdi"
121
+ ]
122
+ }
123
+ }
124
+ ],
125
+ "UserComments": [
126
+ {
127
+ "type": [
128
+ "http://schema.org/UserComments"
129
+ ],
130
+ "properties": {
131
+ "Item#id": [
132
+ "735576666_10151298637466667_26116437"
133
+ ],
134
+ "commentText": [
135
+ "ser o no ser? jaja"
136
+ ],
137
+ "creator": [
138
+ {
139
+ "type": [
140
+ "http://schema.org/Person/User"
141
+ ],
142
+ "properties": {
143
+ "additionalType": [
144
+ "http://getfetcher.net/Item"
145
+ ],
146
+ "Item#id": [
147
+ "1265409676"
148
+ ],
149
+ "name": [
150
+ "Facu Vivas"
151
+ ]
152
+ }
153
+ }
154
+ ],
155
+ "commentTime": [
156
+ "2012-10-27T15:27:29+0000"
157
+ ],
158
+ "url": [
159
+ "https://www.facebook.com/10151298637466667?comment_id=26116437"
160
+ ]
161
+ }
162
+ },
163
+ {
164
+ "type": [
165
+ "http://schema.org/UserComments"
166
+ ],
167
+ "properties": {
168
+ "Item#id": [
169
+ "735576666_10151298637466667_26116661"
170
+ ],
171
+ "commentText": [
172
+ "che vos sabes mucha Inglé no?"
173
+ ],
174
+ "creator": [
175
+ {
176
+ "type": [
177
+ "http://schema.org/Person/User"
178
+ ],
179
+ "properties": {
180
+ "additionalType": [
181
+ "http://getfetcher.net/Item"
182
+ ],
183
+ "Item#id": [
184
+ "600129837"
185
+ ],
186
+ "name": [
187
+ "Conrado Mader Blanco"
188
+ ]
189
+ }
190
+ }
191
+ ],
192
+ "commentTime": [
193
+ "2012-10-27T15:45:12+0000"
194
+ ],
195
+ "url": [
196
+ "https://www.facebook.com/10151298637466667?comment_id=26116661"
197
+ ]
198
+ }
199
+ }
200
+ ],
201
+ "dateCreated": [
202
+ "2012-10-27T15:18:35+0000"
203
+ ],
204
+ "provider": [
205
+ "facebook"
206
+ ]
207
+ }
208
+ }
209
+ """
210
+
211
+
212
+
213
+
@@ -0,0 +1,43 @@
1
+ Feature: Translate facebook to schema.org/Person/User + getfetcher.net/Item
2
+
3
+ In order to send a standardized-properties form of the facebook information
4
+ As a developer
5
+ I want to be able to convert from Facebook API to
6
+ schema.org based vocabulary
7
+
8
+ Scenario: Converting a json facebook user into a json schema
9
+ Given the facebook user:
10
+
11
+ """
12
+ {
13
+ "name": "Tomás Mehdi",
14
+ "id": "735576666"
15
+ }
16
+
17
+ """
18
+
19
+ When I convert it into schema.org/Person/User
20
+ Then I should have user:
21
+
22
+ """
23
+ {
24
+ "type": [
25
+ "http://schema.org/Person/User"
26
+ ],
27
+ "properties": {
28
+ "additionalType": [
29
+ "http://getfetcher.net/Item"
30
+ ],
31
+ "Item#id": [
32
+ "735576666"
33
+ ],
34
+ "name": [
35
+ "Tomás Mehdi"
36
+ ]
37
+ }
38
+ }
39
+
40
+ """
41
+
42
+
43
+
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/fetcher/microdata/facebook/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Xavier Via","Tomas Mehdi"]
6
+ gem.email = ["xavier.via.canel@gmail.com", "tomymehdi@gmail.com"]
7
+ gem.description = %q{Fetcher Microdata adapter for Facebook}
8
+ gem.summary = %q{Fetcher Microdata adapter for Facebook}
9
+ gem.homepage = "http://github.com/Fetcher/fetcher-microdata-facebook"
10
+
11
+ gem.add_dependency 'discoverer'
12
+ gem.add_dependency 'virtus'
13
+ gem.add_dependency 'fetcher-microdata'
14
+
15
+ gem.add_development_dependency 'rspec'
16
+
17
+ gem.files = `git ls-files`.split($\)
18
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
19
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
+ gem.name = "fetcher-microdata-facebook"
21
+ gem.require_paths = ["lib"]
22
+ gem.version = Fetcher::Microdata::Facebook::VERSION
23
+ end
@@ -0,0 +1,12 @@
1
+ require 'virtus'
2
+ require 'json'
3
+ require 'pry'
4
+ require 'fetcher-microdata'
5
+ require 'fetcher-microdata-facebook'
6
+
7
+
8
+
9
+ require 'fetcher/microdata/article_small/facebook/coercer'
10
+ require 'fetcher/microdata/user_comments/facebook/coercer'
11
+ require 'fetcher/microdata/like/facebook/coercer'
12
+ require 'fetcher/microdata/person_user/facebook/coercer'
@@ -0,0 +1,33 @@
1
+ module Fetcher
2
+ class Microdata
3
+ class ArticleSmall
4
+ module Facebook
5
+ Coercer = proc { |post, viewer|
6
+ resp = {
7
+ :likes_type => "http://schema.org/AggregateRating/Likes",
8
+ :id => post["id"],
9
+ :comments => [],
10
+ :likes => [],
11
+ :articleBody => post["message"],
12
+ :dateCreated => post["created_time"],
13
+ :author => PersonUser.new(:facebook, post["from"]),
14
+ :likes_count => post["likes"]["count"],
15
+ :comments_count => post["comments"]["count"],
16
+ :viewer => PersonUser.new(:facebook, viewer),
17
+ :provider => ["facebook"]
18
+ }
19
+ i = 0
20
+ post["likes"]["data"].each do |like|
21
+ #resp[:likes].push Like.new :facebook, like
22
+ resp[:likes].push "like#{i}"
23
+ i = i + 1
24
+ end
25
+ post["comments"]["data"].each do |comment|
26
+ resp[:comments].push UserComments.new :facebook, comment
27
+ end
28
+ resp
29
+ }
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,22 @@
1
+ module Fetcher
2
+ class Microdata
3
+ module Facebook
4
+ class Service
5
+ include Singleton
6
+
7
+ def created_at_to_timestamp created_at
8
+ year = created_at[-4..-1].to_i
9
+ month = created_at[4..6].downcase
10
+ day = created_at[8..9].to_i
11
+
12
+ time_fractioned = created_at[10..18].split ":"
13
+ hour = time_fractioned.shift.to_i
14
+ minute = time_fractioned.shift.to_i
15
+ second = time_fractioned.first.to_i
16
+
17
+ Time.gm(year, month, day, hour, minute, second).to_i
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,7 @@
1
+ module Fetcher
2
+ class Microdata
3
+ module Facebook
4
+ VERSION = '0.0.1'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ module Fetcher
2
+ class Microdata
3
+ class Like
4
+ module Facebook
5
+ Coercer = proc { |like|
6
+ {
7
+ :author => PersonUser.new(:facebook, like)
8
+ }
9
+ }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module Fetcher
2
+ class Microdata
3
+ class PersonUser
4
+ module Facebook
5
+ Coercer = proc { |original_tweet|
6
+ {
7
+ :additionalType => "http://getfetcher.net/Item",
8
+ :id => original_tweet["id"],
9
+ :name => original_tweet["name"]
10
+ }
11
+ }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module Fetcher
2
+ class Microdata
3
+ class UserComments
4
+ module Facebook
5
+ Coercer = proc { |comment|
6
+ {
7
+ :id => comment["id"],
8
+ :creator => PersonUser.new(:facebook, comment["from"]),
9
+ :commentText => comment["message"],
10
+ :likes_count => comment["likes"],
11
+ :commentTime => comment["created_time"]
12
+ }
13
+ }
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,64 @@
1
+ agregate rating for forward steps
2
+
3
+ "aggregateRating": [
4
+ {
5
+ "type": [
6
+ "http://schema.org/AggregateRating/Likes"
7
+ ],
8
+ "properties": {
9
+ "ratingCount": [
10
+ 3
11
+ ],
12
+ "author": [
13
+ {
14
+ "type": [
15
+ "http://schema.org/AggregateRating/Like"
16
+ ],
17
+ "properties": {
18
+ "additionalType": [
19
+ "http://getfetcher.net/Item"
20
+ ],
21
+ "http://getfetcher.net/Item#id": [
22
+ "536017463"
23
+ ],
24
+ "name": [
25
+ "Nahuel García Ocampo"
26
+ ]
27
+ }
28
+ },
29
+ {
30
+ "type": [
31
+ "http://schema.org/AggregateRating/Like"
32
+ ],
33
+ "properties": {
34
+ "additionalType": [
35
+ "http://getfetcher.net/Item"
36
+ ],
37
+ "http://getfetcher.net/Item#id": [
38
+ "1002769970"
39
+ ],
40
+ "name": [
41
+ "Luis Suas"
42
+ ]
43
+ }
44
+ },
45
+ {
46
+ "type": [
47
+ "http://schema.org/AggregateRating/Like"
48
+ ],
49
+ "properties": {
50
+ "additionalType": [
51
+ "http://getfetcher.net/Item"
52
+ ],
53
+ "http://getfetcher.net/Item#id": [
54
+ "1060147124"
55
+ ],
56
+ "name": [
57
+ "Sol Laborde"
58
+ ]
59
+ }
60
+ }
61
+ ]
62
+ }
63
+ }
64
+ ],
@@ -0,0 +1,9 @@
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"
9
+ }
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Fetcher::Microdata::ArticleSmall::Facebook::Coercer' do
4
+ context 'the adapter receives a valid post' do
5
+ before do
6
+ @post = JSON.parse File.read "spec/post.json"
7
+ @viewer = JSON.parse File.read "spec/viewer.json"
8
+ @translated_post = Fetcher::Microdata::ArticleSmall::Facebook::Coercer.call @post, @viewer
9
+ end
10
+
11
+ it "should initialize the id" do
12
+ @translated_post[:id].should == @post["id"]
13
+ end
14
+
15
+ it "should initialize the likes_type" do
16
+ @translated_post[:likes_type].should == "http://schema.org/AggregateRating/Likes"
17
+ end
18
+
19
+ it "should initialize the articleBody" do
20
+ @translated_post[:articleBody].should == @post["message"]
21
+ end
22
+
23
+ it "should initialize the author with a instance of person user" do
24
+ @translated_post[:author].should be_an_instance_of Fetcher::Microdata::PersonUser
25
+ end
26
+
27
+ it "should initialize the dateCreated post" do
28
+ @translated_post[:dateCreated].should == @post["created_time"]
29
+ end
30
+
31
+ it "should initialize the likes count" do
32
+ @translated_post[:likes_count].should == @post["likes"]["count"]
33
+ end
34
+
35
+ it "should initialize the comments count" do
36
+ @translated_post[:comments_count].should == @post["comments"]["count"]
37
+ end
38
+
39
+ it "should initialize the viewer" do
40
+ @translated_post[:viewer].should be_an_instance_of Fetcher::Microdata::PersonUser
41
+ end
42
+
43
+ it "should initialize the provider" do
44
+ @translated_post[:provider].should == ["facebook"]
45
+ end
46
+
47
+
48
+ end
49
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Fetcher::Microdata::Like::Facebook::Coercer' do
4
+ context 'the Coercer receives a valid like' do
5
+ before do
6
+ @like_ex = JSON.parse File.read "spec/like.json"
7
+ @like = ::Fetcher::Microdata::Like::Facebook::Coercer.call @like_ex
8
+ end
9
+
10
+ it 'should set #author with a instance of PersonUser :facebook' do
11
+ @like[:author].should be_an_instance_of Fetcher::Microdata::PersonUser
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Fetcher::Microdata::PersonUser::Facebook::Coercer' do
4
+ context 'the Coercer receives a valid person user' do
5
+ before do
6
+ @user_ex = JSON.parse File.read "spec/user.json"
7
+ @person_user = ::Fetcher::Microdata::PersonUser::Facebook::Coercer.call @user_ex
8
+ end
9
+
10
+ it "should initialize the :name with 'name'" do
11
+ @person_user[:name].should == @user_ex["name"]
12
+ end
13
+
14
+ it "should initialize the :id with 'id'" do
15
+ @person_user[:id].should == @user_ex["id"]
16
+ end
17
+
18
+ it "should initialize the :nameadditionalType with 'nameadditionalType'" do
19
+ @person_user[:nameadditionalType].should == @user_ex["additionalType"]
20
+ end
21
+
22
+ it "should initialize the :_type with '_type'" do
23
+ @person_user[:_type].should == @user_ex["_type"]
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Fetcher::Microdata::UserComments::Facebook::Coercer' do
4
+ context 'the Coercer receives a valid comment' do
5
+ before do
6
+ @comment_ex = JSON.parse File.read "spec/comment.json"
7
+ @comment = ::Fetcher::Microdata::UserComments::Facebook::Coercer.call @comment_ex
8
+ end
9
+
10
+ it "should initialize the id" do
11
+ @comment[:id].should == @comment_ex["id"]
12
+ end
13
+
14
+ it "should initialize the creator" do
15
+ @comment[:creator].should be_an_instance_of Fetcher::Microdata::PersonUser
16
+ end
17
+
18
+ it "should initialize the message" do
19
+ @comment[:commentText].should == @comment_ex["message"]
20
+ end
21
+
22
+ it "should initialize the created time" do
23
+ @comment[:commentTime].should == @comment_ex["created_time"]
24
+ end
25
+
26
+ it "should initialize the like count if there are likes" do
27
+ @comment[:likes_count].should == @comment_ex["likes"]
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "Nahuel García Ocampo",
3
+ "id": "536017463"
4
+ }
@@ -0,0 +1,16 @@
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
+ }
@@ -0,0 +1,53 @@
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": [
14
+ {
15
+ "name": "Nahuel García Ocampo",
16
+ "id": "536017463"
17
+ },
18
+ {
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
52
+ }
53
+ }
@@ -0,0 +1,4 @@
1
+ require 'pry'
2
+
3
+ require 'fetcher-microdata'
4
+ require 'fetcher-microdata-facebook'
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "Tomás Mehdi",
3
+ "id": "735576666"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "id": "735576666",
3
+ "name": "Tomás Mehdi"
4
+ }
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fetcher-microdata-facebook
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Xavier Via
9
+ - Tomas Mehdi
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-12-07 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: discoverer
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: virtus
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: fetcher-microdata
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: rspec
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ description: Fetcher Microdata adapter for Facebook
80
+ email:
81
+ - xavier.via.canel@gmail.com
82
+ - tomymehdi@gmail.com
83
+ executables: []
84
+ extensions: []
85
+ extra_rdoc_files: []
86
+ files:
87
+ - Gemfile
88
+ - Gemfile.lock
89
+ - LICENSE
90
+ - README.md
91
+ - Rakefile
92
+ - features/stepdefs/transalte_post_to_schema.rb
93
+ - features/stepdefs/translate_user_to_schema.rb
94
+ - features/support/env.rb
95
+ - features/translate_post_to_schema.feature
96
+ - features/translate_user_to_schema.feature
97
+ - fetcher-microdata-facebook.gemspec
98
+ - lib/fetcher-microdata-facebook.rb
99
+ - lib/fetcher/microdata/article_small/facebook/coercer.rb
100
+ - lib/fetcher/microdata/facebook/service.rb
101
+ - lib/fetcher/microdata/facebook/version.rb
102
+ - lib/fetcher/microdata/like/facebook/coercer.rb
103
+ - lib/fetcher/microdata/person_user/facebook/coercer.rb
104
+ - lib/fetcher/microdata/user_comments/facebook/coercer.rb
105
+ - samples/agregate_rating_for_forward_steps
106
+ - spec/comment.json
107
+ - spec/fetcher/microdata/article_small/facebook/coercer_spec.rb
108
+ - spec/fetcher/microdata/like/facebook/coercer_spec.rb
109
+ - spec/fetcher/microdata/person_user/facebook/coercer_spec.rb
110
+ - spec/fetcher/microdata/user_comments/facebook/coercer_spec.rb
111
+ - spec/like.json
112
+ - spec/microdata_like.json
113
+ - spec/post.json
114
+ - spec/spec_helper.rb
115
+ - spec/user.json
116
+ - spec/viewer.json
117
+ homepage: http://github.com/Fetcher/fetcher-microdata-facebook
118
+ licenses: []
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 1.8.24
138
+ signing_key:
139
+ specification_version: 3
140
+ summary: Fetcher Microdata adapter for Facebook
141
+ test_files:
142
+ - features/stepdefs/transalte_post_to_schema.rb
143
+ - features/stepdefs/translate_user_to_schema.rb
144
+ - features/support/env.rb
145
+ - features/translate_post_to_schema.feature
146
+ - features/translate_user_to_schema.feature
147
+ - spec/comment.json
148
+ - spec/fetcher/microdata/article_small/facebook/coercer_spec.rb
149
+ - spec/fetcher/microdata/like/facebook/coercer_spec.rb
150
+ - spec/fetcher/microdata/person_user/facebook/coercer_spec.rb
151
+ - spec/fetcher/microdata/user_comments/facebook/coercer_spec.rb
152
+ - spec/like.json
153
+ - spec/microdata_like.json
154
+ - spec/post.json
155
+ - spec/spec_helper.rb
156
+ - spec/user.json
157
+ - spec/viewer.json