kermit 1.0.0
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 +18 -0
- data/LICENSE.txt +20 -0
- data/README.md +54 -0
- data/Rakefile +31 -0
- data/VERSION +1 -0
- data/bin/kermit +24 -0
- data/config/config.example.yml +24 -0
- data/doc/Adapter.html +533 -0
- data/doc/Converter.html +348 -0
- data/doc/DAO.html +1047 -0
- data/doc/KermitPFC.html +927 -0
- data/doc/Link.html +667 -0
- data/doc/Logging.html +401 -0
- data/doc/Logging/Settings.html +170 -0
- data/doc/RandomAdapter.html +501 -0
- data/doc/RandomConverter.html +359 -0
- data/doc/RandomPhraseGenerator.html +317 -0
- data/doc/ToUser.html +815 -0
- data/doc/TwitterAdapter.html +550 -0
- data/doc/TwitterConverter.html +598 -0
- data/doc/USMF.html +2188 -0
- data/doc/User.html +1407 -0
- data/doc/WebSocketClient.html +316 -0
- data/doc/WebSocketServer.html +427 -0
- data/doc/_index.html +270 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +328 -0
- data/doc/file.LICENSE.html +73 -0
- data/doc/file.README.html +123 -0
- data/doc/file_list.html +58 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +123 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +764 -0
- data/doc/top-level-namespace.html +138 -0
- data/lib/business/adapter/adapter.rb +39 -0
- data/lib/business/adapter/random_adapter.rb +50 -0
- data/lib/business/adapter/twitter_adapter.rb +75 -0
- data/lib/business/converter/converter.rb +24 -0
- data/lib/business/converter/random_converter.rb +42 -0
- data/lib/business/converter/twitter_converter.rb +164 -0
- data/lib/business/random_phrase_generator.rb +39 -0
- data/lib/helper/DAO.rb +94 -0
- data/lib/helper/settings.rb +11 -0
- data/lib/helper/websocket_client.rb +37 -0
- data/lib/helper/websocket_server.rb +65 -0
- data/lib/kermitpfc.rb +164 -0
- data/lib/logging.rb +31 -0
- data/lib/model/USMF/USMF.rb +98 -0
- data/lib/model/USMF/link.rb +30 -0
- data/lib/model/USMF/to_user.rb +32 -0
- data/lib/model/USMF/user.rb +41 -0
- data/lib/model/templates/USMF +56 -0
- data/lib/model/templates/atom.xml +74 -0
- data/lib/model/templates/example +59 -0
- data/lib/model/templates/rss.xml +68 -0
- data/lib/model/templates/template +49 -0
- data/lib/model/templates/tweet +116 -0
- data/spec/DAO_spec.rb +64 -0
- data/spec/random_adapter_spec.rb +24 -0
- data/spec/random_converter_spec.rb +115 -0
- data/spec/random_phrase_generator_spec.rb +15 -0
- data/spec/twitter_adapter_spec.rb +24 -0
- data/spec/twitter_converter_spec.rb +132 -0
- data/websocket_client.html +20 -0
- metadata +253 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"service" : "Twitter", # Service Name.
|
3
|
+
"user" : { # User Info
|
4
|
+
"name" : "screen_name", # User Name
|
5
|
+
"real_name" : "name" # Real name of user
|
6
|
+
"id" : "id_str", # Unique User ID
|
7
|
+
"language": "lang", # Spoken language of user
|
8
|
+
"utc" : "time_zone + utc_offset", # UTC time offset of user
|
9
|
+
"geo" : "place", # Latitude/Logitude User location
|
10
|
+
"description" : "description" # User profile description
|
11
|
+
"avatar" : "profile_image_url_https", # Direct href to avatar image
|
12
|
+
"location": "location", # Plain Language User location
|
13
|
+
"subscribers": "followers_count", # Number of subscribers
|
14
|
+
"subscriptions": "friends_count", # Number of subscriptions
|
15
|
+
"postings": "statuses_count", # Number of postings made
|
16
|
+
"profile": "http://www.twitter.com/name", # Href to user profile
|
17
|
+
"website": "url", # Href to user website
|
18
|
+
}
|
19
|
+
"to_users" { # Attached link(s) // // Tantos como UserMentions tenga entities 0...N
|
20
|
+
"0": { # Index of link
|
21
|
+
"name" : "screen_name", # User Name
|
22
|
+
"id" : "id_str", # Unique User ID
|
23
|
+
"twitter/instagram/..." # Name of service/Domain hosting link
|
24
|
+
"title" : "in_reply_to_status_id_str", # Title of item
|
25
|
+
"thumbnail" : "mention/reply/retweet", # Direct href to thumbnail for item
|
26
|
+
"href" : "http://www.service.com/name", # Direct href to item
|
27
|
+
},
|
28
|
+
},
|
29
|
+
"links" { # Attached link(s) //Media del status
|
30
|
+
"0": { # Index of link // Tantos como entities se necesiten 0...N
|
31
|
+
"instagram/lockerz/youtube/..." # Name of service/Domain hosting link
|
32
|
+
"photo/video/url.." : "", # Title of item
|
33
|
+
"thumbnail" : "url", # Direct href to thumbnail for item
|
34
|
+
"href" : "media_url", # Direct href to item
|
35
|
+
},
|
36
|
+
},
|
37
|
+
"id" : "id_str", # Unique ID
|
38
|
+
"geo" : "coordinates", # Latitude/Logitude content creation location
|
39
|
+
"application" : "source", # Application used to create this posting
|
40
|
+
"location" : "full_name+country", # Plain Language content creation location
|
41
|
+
"date" : "created_at", # Date posted
|
42
|
+
"source" : "http://www.twitter.com/id_str", # User friendly link to content
|
43
|
+
"text" : "text", # Microblog text / Video Title / Etc
|
44
|
+
"description" : "", # Full post text / Decription
|
45
|
+
"keywords" : "hashtags", # Related Keywords
|
46
|
+
"likes" : "retweet_count", # Number of users who "liked" this
|
47
|
+
"dislikes" : "", # Number of users who "disliked" this
|
48
|
+
"favorites": "favourites_count", # Number of users who "favorited" this
|
49
|
+
}
|
@@ -0,0 +1,116 @@
|
|
1
|
+
"geo":{
|
2
|
+
"type":"Point",
|
3
|
+
"coordinates":[37.09277641,-84.61851055]},
|
4
|
+
"retweeted":false,
|
5
|
+
"text":"Estoy esperando las excusas de los antimadridistas! Haber con lo k salen hoy.. Baaahhh A7 y golpe a la liga!",
|
6
|
+
"possibly_sensitive_editable":true,
|
7
|
+
"truncated":false,
|
8
|
+
"created_at":"Sat Apr 21 20:19:30 +0000 2012",
|
9
|
+
"in_reply_to_status_id_str":null,
|
10
|
+
"coordinates":{
|
11
|
+
"type":"Point",
|
12
|
+
"coordinates":[-84.61851055,37.09277641]},
|
13
|
+
"source":"\u003Ca href=\"http:\/\/blackberry.com\/twitter\" rel=\"nofollow\"\u003ETwitter for BlackBerry\u00ae\u003C\/a\u003E",
|
14
|
+
"in_reply_to_user_id_str":null,
|
15
|
+
"favorited":false,
|
16
|
+
"contributors":null,
|
17
|
+
"entities":{
|
18
|
+
"urls":[{
|
19
|
+
"expanded_url":"http:\/\/twitter.com\/kermitpfc",
|
20
|
+
"indices":[22,42],
|
21
|
+
"url":"http:\/\/t.co\/yAw6slsx",
|
22
|
+
"display_url":"twitter.com\/kermitpfc"}],
|
23
|
+
"user_mentions":[{
|
24
|
+
"indices":[0,10],
|
25
|
+
"screen_name":"Minikisto",
|
26
|
+
"name":"Daniel Machado",
|
27
|
+
"id":105619316,
|
28
|
+
"id_str":"105619316"}],
|
29
|
+
"hashtags":[{
|
30
|
+
"text":"KermitPFC",
|
31
|
+
"indices":[11,21]}],
|
32
|
+
"media":[{
|
33
|
+
"type":"photo",
|
34
|
+
"expanded_url":"http:\/\/twitter.com\/KermitPFC\/status\/193818140180889602\/photo\/1",
|
35
|
+
"indices":[43,63],
|
36
|
+
"media_url":"http:\/\/p.twimg.com\/ArCUklTCQAEhg2R.jpg",
|
37
|
+
"url":"http:\/\/t.co\/5W8YCCw6",
|
38
|
+
"sizes":{
|
39
|
+
"thumb":{
|
40
|
+
"h":150,
|
41
|
+
"resize":"crop",
|
42
|
+
"w":150},
|
43
|
+
"small":{
|
44
|
+
"h":191,
|
45
|
+
"resize":"fit",
|
46
|
+
"w":340},
|
47
|
+
"medium":{
|
48
|
+
"h":337,
|
49
|
+
"resize":"fit",
|
50
|
+
"w":600},
|
51
|
+
"large":{
|
52
|
+
"h":576,
|
53
|
+
"resize":"fit",
|
54
|
+
"w":1024}},
|
55
|
+
"media_url_https":"https:\/\/p.twimg.com\/ArCUklTCQAEhg2R.jpg",
|
56
|
+
"display_url":"pic.twitter.com\/5W8YCCw6",
|
57
|
+
"id":193818140185083905,
|
58
|
+
"id_str":"193818140185083905"}]},
|
59
|
+
"possibly_sensitive":false,
|
60
|
+
"place":{
|
61
|
+
"place_type":"city",
|
62
|
+
"country":"Spain",
|
63
|
+
"bounding_box":{
|
64
|
+
"type":"Polygon",
|
65
|
+
"coordinates":[[[-6.0201004,43.2788671],[-5.7423683,43.2788671],[-5.7423683,43.4274282],[-6.0201004,43.4274282]]]},
|
66
|
+
"url":"http:\/\/api.twitter.com\/1\/geo\/id\/d1272bba8714df3d.json",
|
67
|
+
"country_code":"ES",
|
68
|
+
"attributes":{},
|
69
|
+
"full_name":"Oviedo, Asturias",
|
70
|
+
"name":"Oviedo",
|
71
|
+
"id":"d1272bba8714df3d"},
|
72
|
+
"in_reply_to_screen_name":"Minikisto",
|
73
|
+
"in_reply_to_user_id":105619316,
|
74
|
+
"user":{
|
75
|
+
"profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme8\/bg.gif",
|
76
|
+
"profile_sidebar_fill_color":"EADEAA",
|
77
|
+
"listed_count":0,
|
78
|
+
"time_zone":"Madrid",
|
79
|
+
"created_at":"Sun Oct 30 14:00:12 +0000 2011",
|
80
|
+
"profile_sidebar_border_color":"D9B17E",
|
81
|
+
"verified":false,
|
82
|
+
"url":"https:\/\/github.com\/danielmachado\/kermitpfc-core",
|
83
|
+
"description":"Soy una rana.",
|
84
|
+
"default_profile":false,
|
85
|
+
"profile_use_background_image":true,
|
86
|
+
"is_translator":false,
|
87
|
+
"contributors_enabled":false,
|
88
|
+
"geo_enabled":true,
|
89
|
+
"notifications":null,
|
90
|
+
"profile_text_color":"333333",
|
91
|
+
"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1616971308\/kermit_normal.jpg",
|
92
|
+
"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme8\/bg.gif",
|
93
|
+
"followers_count":0,
|
94
|
+
"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1616971308\/kermit_normal.jpg",
|
95
|
+
"location":"Oviedo, Asturias",
|
96
|
+
"lang":"es",
|
97
|
+
"profile_link_color":"9D582E",
|
98
|
+
"protected":false,
|
99
|
+
"screen_name":"KermitPFC",
|
100
|
+
"default_profile_image":false,
|
101
|
+
"show_all_inline_media":false,
|
102
|
+
"friends_count":4,
|
103
|
+
"name":"KermitPFC",
|
104
|
+
"statuses_count":5,
|
105
|
+
"favourites_count":0,
|
106
|
+
"profile_background_color":"8B542B",
|
107
|
+
"id":401402484,
|
108
|
+
"id_str":"401402484",
|
109
|
+
"follow_request_sent":null,
|
110
|
+
"following":null,
|
111
|
+
"profile_background_tile":false,
|
112
|
+
"utc_offset":3600},
|
113
|
+
"id":193818140180889602,
|
114
|
+
"id_str":"193818140180889602",
|
115
|
+
"retweet_count":0,
|
116
|
+
"in_reply_to_status_id":null}
|
data/spec/DAO_spec.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# DAO_spec.rb
|
2
|
+
require_relative '../lib/helper/DAO'
|
3
|
+
|
4
|
+
describe DAO do
|
5
|
+
|
6
|
+
describe "#connect_database" do
|
7
|
+
it "stablish the connection with the database" do
|
8
|
+
|
9
|
+
dao = DAO.new 'twitter'
|
10
|
+
puts 'Testing Twitter DB...'
|
11
|
+
dao.db.should_not == nil
|
12
|
+
puts 'Twitter DB OK'
|
13
|
+
dao = DAO.new 'rpg'
|
14
|
+
puts 'Testing Random DB...'
|
15
|
+
dao.db.should_not == nil
|
16
|
+
puts 'Random DB OK'
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#get_status" do
|
22
|
+
it "returns a status from the database" do
|
23
|
+
|
24
|
+
dao = DAO.new 'twitter'
|
25
|
+
puts 'Testing Twitter status...'
|
26
|
+
dao.get_status.should_not == nil
|
27
|
+
puts 'Twitter status OK'
|
28
|
+
dao = DAO.new 'rpg'
|
29
|
+
puts 'Testing Random phrase...'
|
30
|
+
dao.get_status.should_not == nil
|
31
|
+
puts 'Random phrase OK'
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#size" do
|
37
|
+
it "returns the number of items in the database" do
|
38
|
+
|
39
|
+
dao = DAO.new 'twitter'
|
40
|
+
puts 'Testing Twitter DB size...'
|
41
|
+
dao.size.should >= 0
|
42
|
+
puts 'Twitter DB size OK'
|
43
|
+
dao = DAO.new 'rpg'
|
44
|
+
puts 'Testing Random DB size...'
|
45
|
+
dao.size.should >= 0
|
46
|
+
puts 'Random DB size OK'
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "#publish" do
|
52
|
+
it "publish a status in the websocket server" do
|
53
|
+
|
54
|
+
dao = DAO.new 'twitter'
|
55
|
+
puts 'Testing Publisher...'
|
56
|
+
dao.publish('Testing a method')
|
57
|
+
|
58
|
+
puts 'Publisher OK'
|
59
|
+
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# random_adapter_spec.rb
|
2
|
+
|
3
|
+
require_relative '../lib/business/adapter/random_adapter'
|
4
|
+
require_relative '../lib/helper/DAO'
|
5
|
+
|
6
|
+
describe RandomAdapter do
|
7
|
+
describe "#connect_stream" do
|
8
|
+
it "returns a status that was retrieved from the RandomPhraseGenerator Stream" do
|
9
|
+
|
10
|
+
dao = DAO.new 'rpg'
|
11
|
+
prev = dao.size
|
12
|
+
|
13
|
+
a = Thread.new { adapter = RandomAdapter.new; adapter.connect_stream; puts 'retrieving...' ;}
|
14
|
+
a.run
|
15
|
+
a.join 5
|
16
|
+
Thread.kill(a)
|
17
|
+
post = dao.size
|
18
|
+
|
19
|
+
post = post-prev
|
20
|
+
post.should > 0
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# random_converter_spec.rb
|
2
|
+
|
3
|
+
require_relative '../lib/business/converter/random_converter'
|
4
|
+
require_relative '../lib/model/USMF/USMF'
|
5
|
+
require_relative '../lib/model/USMF/link'
|
6
|
+
require_relative '../lib/model/USMF/to_user'
|
7
|
+
require_relative '../lib/model/USMF/user'
|
8
|
+
require_relative '../lib/helper/DAO'
|
9
|
+
|
10
|
+
describe RandomConverter, "#to_usmf" do
|
11
|
+
|
12
|
+
it "returns a usmf that should be equals to the test_usmf" do
|
13
|
+
|
14
|
+
dao = DAO.new 'rpg'
|
15
|
+
|
16
|
+
status = "12453243@juanito@Poesia es la union de dos palabras que uno nunca supuso que pudieran juntarse, y que forman algo asi como un misterio."
|
17
|
+
puts 'Status retrieved'
|
18
|
+
|
19
|
+
status.should_not == nil
|
20
|
+
|
21
|
+
rc = RandomConverter.new
|
22
|
+
real = rc.to_usmf status
|
23
|
+
|
24
|
+
#build a usmf with the status, we need to parse the same phrase
|
25
|
+
|
26
|
+
test = USMF.new
|
27
|
+
puts 'Checking Status...'
|
28
|
+
test.service = 'Random'
|
29
|
+
real.service.should == test.service
|
30
|
+
test.id = '12453243'
|
31
|
+
real.id.should == test.id
|
32
|
+
test.geo = nil
|
33
|
+
real.geo.should == test.geo
|
34
|
+
test.application = nil
|
35
|
+
real.application.should == test.application
|
36
|
+
test.location = nil
|
37
|
+
real.location.should == test.location
|
38
|
+
test.date = nil
|
39
|
+
real.date.should == test.date
|
40
|
+
test.source = nil
|
41
|
+
real.source.should == test.source
|
42
|
+
test.text = 'Poesia es la union de dos palabras que uno nunca supuso que pudieran juntarse, y que forman algo asi como un misterio.'
|
43
|
+
real.text.should == test.text
|
44
|
+
test.keywords = nil
|
45
|
+
real.keywords.should == test.keywords
|
46
|
+
test.category = nil
|
47
|
+
real.category.should == test.category
|
48
|
+
test.duration = nil
|
49
|
+
real.duration.should == test.duration
|
50
|
+
test.likes = nil
|
51
|
+
real.likes.should == test.likes
|
52
|
+
test.dislikes = nil
|
53
|
+
real.dislikes.should == test.dislikes
|
54
|
+
test.favorites = nil
|
55
|
+
real.favorites.should == test.favorites
|
56
|
+
test.comments = nil
|
57
|
+
real.comments.should == test.comments
|
58
|
+
test.rates = nil
|
59
|
+
test.rating = nil
|
60
|
+
test.min_rating = nil
|
61
|
+
test.max_rating = nil
|
62
|
+
real.rates.should == test.rates
|
63
|
+
real.rating.should == test.rating
|
64
|
+
real.min_rating.should == test.min_rating
|
65
|
+
real.max_rating.should == test.max_rating
|
66
|
+
puts 'Status OK'
|
67
|
+
|
68
|
+
user = User.new
|
69
|
+
puts 'Checking User...'
|
70
|
+
user.name = 'juanito'
|
71
|
+
real.user.name.should == user.name
|
72
|
+
user.real_name = nil
|
73
|
+
real.user.real_name.should == user.real_name
|
74
|
+
user.id = nil
|
75
|
+
real.user.id.should == user.id
|
76
|
+
user.language = nil
|
77
|
+
real.user.language.should == user.language
|
78
|
+
user.utc = nil
|
79
|
+
real.user.utc.should == user.utc
|
80
|
+
user.geo = nil
|
81
|
+
real.user.geo.should == user.geo
|
82
|
+
user.description = nil
|
83
|
+
real.user.description.should == user.description
|
84
|
+
user.avatar = nil
|
85
|
+
real.user.avatar.should == user.avatar
|
86
|
+
user.location = nil
|
87
|
+
real.user.location.should == user.location
|
88
|
+
user.subscribers = nil
|
89
|
+
real.user.subscribers.should == user.subscribers
|
90
|
+
user.subscriptions = nil
|
91
|
+
real.user.subscriptions.should == user.subscriptions
|
92
|
+
user.postings = nil
|
93
|
+
real.user.postings.should == user.postings
|
94
|
+
user.profile = nil
|
95
|
+
real.user.profile.should == user.profile
|
96
|
+
user.website = nil
|
97
|
+
real.user.website.should == user.website
|
98
|
+
|
99
|
+
puts 'User OK'
|
100
|
+
|
101
|
+
puts 'Checking Entities...'
|
102
|
+
links = []
|
103
|
+
links.should == real.links
|
104
|
+
|
105
|
+
|
106
|
+
to_u = []
|
107
|
+
to_u.should == real.to_users
|
108
|
+
|
109
|
+
puts 'Entities OK'
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
#"124532435@angel@La poesia no tiene tiempo, el que la lee la rescata, la hace presente y luego la regresa a su eternidad."
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# random_phrase_generator_spec.rb
|
2
|
+
require_relative '../lib/business/random_phrase_generator'
|
3
|
+
|
4
|
+
describe RandomPhraseGenerator do
|
5
|
+
describe "#generate" do
|
6
|
+
it "returns a random phrase" do
|
7
|
+
|
8
|
+
rpg = RandomPhraseGenerator.new
|
9
|
+
phrase = rpg.generate
|
10
|
+
phrase.should_not nil
|
11
|
+
phrase.class.should == String
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# twitter_adapter_spec.rb
|
2
|
+
require_relative '../lib/business/adapter/twitter_adapter'
|
3
|
+
require_relative '../lib/helper/DAO'
|
4
|
+
#require 'redis'
|
5
|
+
|
6
|
+
describe TwitterAdapter do
|
7
|
+
describe "#connect_stream" do
|
8
|
+
it "returns a status that was retrieved from the TwitterStream API" do
|
9
|
+
|
10
|
+
dao = DAO.new 'twitter'
|
11
|
+
prev = dao.size
|
12
|
+
|
13
|
+
a = Thread.new { adapter = TwitterAdapter.new; adapter.connect_stream; puts 'retrieving...' ;}
|
14
|
+
a.run
|
15
|
+
a.join 5
|
16
|
+
Thread.kill(a)
|
17
|
+
post = dao.size
|
18
|
+
|
19
|
+
post = post-prev
|
20
|
+
post.should > 0
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
# twitter_converter_spec.rb
|
2
|
+
require_relative '../lib/business/converter/twitter_converter'
|
3
|
+
require_relative '../lib/model/USMF/USMF'
|
4
|
+
require_relative '../lib/model/USMF/link'
|
5
|
+
require_relative '../lib/model/USMF/to_user'
|
6
|
+
require_relative '../lib/model/USMF/user'
|
7
|
+
require_relative '../lib/helper/DAO'
|
8
|
+
|
9
|
+
describe TwitterConverter, "#to_usmf" do
|
10
|
+
|
11
|
+
it "returns a usmf that should be equals to the test_usmf" do
|
12
|
+
|
13
|
+
status = '{"entities":{"hashtags":[],"user_mentions":[{"screen_name":"Tukkka_","indices":[0,8],"id_str":"185248725","name":"Marta Carrera","id":185248725}],"urls":[]},"text":"@Tukkka_ Gracias. Pasar de tener a tus dos equipos en 2 y 2B a tenerlos en 2B y 3 respectivamente. Volveremos a ser grande, no lo dudes.","place":null,"in_reply_to_screen_name":"Tukkka_","truncated":false,"in_reply_to_status_id_str":"219021134480412673","favorited":false,"retweet_count":0,"source":"web","in_reply_to_user_id_str":"185248725","id_str":"219021815631183872","coordinates":null,"geo":null,"contributors":null,"created_at":"Sat Jun 30 10:57:24 +0000 2012","in_reply_to_user_id":185248725,"user":{"lang":"es","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/573127406\/n5v3a4dvj4n3f91o7sru.jpeg","profile_sidebar_fill_color":"DDEEF6","screen_name":"DXTaldia","show_all_inline_media":false,"listed_count":1,"profile_sidebar_border_color":"C0DEED","statuses_count":1636,"following":null,"description":"Blanco. Red. Teddy Bear. Industrial. Knickerbocker. Ranger. Where amazing happens. Colaborador de f\u00fatbol sala en @RepasoDeportivo.","default_profile":false,"profile_use_background_image":true,"id_str":"508941121","is_translator":false,"profile_text_color":"333333","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2287684652\/t4u7vmx6atmibl3pv1rv_normal.jpeg","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/573127406\/n5v3a4dvj4n3f91o7sru.jpeg","time_zone":null,"created_at":"Wed Feb 29 15:21:06 +0000 2012","followers_count":99,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2287684652\/t4u7vmx6atmibl3pv1rv_normal.jpeg","verified":false,"profile_link_color":"","protected":false,"url":null,"default_profile_image":false,"name":"Mr. Dxt","contributors_enabled":false,"geo_enabled":false,"favourites_count":13,"friends_count":203,"profile_background_color":"","id":508941121,"follow_request_sent":null,"notifications":null,"profile_background_tile":true,"utc_offset":null,"location":""},"retweeted":false,"id":219021815631183872,"in_reply_to_status_id":219021134480412673}';
|
14
|
+
|
15
|
+
puts 'Status retrieved'
|
16
|
+
|
17
|
+
status.should_not == nil
|
18
|
+
|
19
|
+
tc = TwitterConverter.new
|
20
|
+
real = tc.to_usmf status
|
21
|
+
|
22
|
+
#build a usmf with the status, we need to parse the same tweet
|
23
|
+
|
24
|
+
test = USMF.new
|
25
|
+
puts 'Checking Status...'
|
26
|
+
test.service = 'Twitter'
|
27
|
+
real.service.should == test.service
|
28
|
+
test.id = '219021815631183872'
|
29
|
+
real.id.should == test.id
|
30
|
+
test.geo = nil
|
31
|
+
real.geo.should == test.geo
|
32
|
+
test.application = 'web'
|
33
|
+
real.application.should == test.application
|
34
|
+
test.location = nil
|
35
|
+
real.location.should == test.location
|
36
|
+
test.date = 'Sat Jun 30 10:57:24 +0000 2012'
|
37
|
+
real.date.should == test.date
|
38
|
+
test.source = 'https://twitter.com/DXTaldia/status/219021815631183872'
|
39
|
+
real.source.should == test.source
|
40
|
+
test.text = '@Tukkka_ Gracias. Pasar de tener a tus dos equipos en 2 y 2B a tenerlos en 2B y 3 respectivamente. Volveremos a ser grande, no lo dudes.'
|
41
|
+
real.text.should == test.text
|
42
|
+
test.keywords = ""
|
43
|
+
real.keywords.should == test.keywords
|
44
|
+
test.category = nil
|
45
|
+
real.category.should == test.category
|
46
|
+
test.duration = nil
|
47
|
+
real.duration.should == test.duration
|
48
|
+
test.likes = 0
|
49
|
+
real.likes.should == test.likes
|
50
|
+
test.dislikes = nil
|
51
|
+
real.dislikes.should == test.dislikes
|
52
|
+
test.favorites = nil
|
53
|
+
real.favorites.should == test.favorites
|
54
|
+
test.comments = nil
|
55
|
+
real.comments.should == test.comments
|
56
|
+
test.rates = nil
|
57
|
+
test.rating = nil
|
58
|
+
test.min_rating = nil
|
59
|
+
test.max_rating = nil
|
60
|
+
real.rates.should == test.rates
|
61
|
+
real.rating.should == test.rating
|
62
|
+
real.min_rating.should == test.min_rating
|
63
|
+
real.max_rating.should == test.max_rating
|
64
|
+
puts 'Status OK'
|
65
|
+
|
66
|
+
user = User.new
|
67
|
+
puts 'Checking User...'
|
68
|
+
user.name = 'DXTaldia'
|
69
|
+
real.user.name.should == user.name
|
70
|
+
user.real_name = 'Mr. Dxt'
|
71
|
+
real.user.real_name.should == user.real_name
|
72
|
+
user.id = '508941121'
|
73
|
+
real.user.id.should == user.id
|
74
|
+
user.language = 'es'
|
75
|
+
real.user.language.should == user.language
|
76
|
+
user.utc = nil
|
77
|
+
real.user.utc.should == user.utc
|
78
|
+
user.geo = nil
|
79
|
+
real.user.geo.should == user.geo
|
80
|
+
user.description = "Blanco. Red. Teddy Bear. Industrial. Knickerbocker. Ranger. Where amazing happens. Colaborador de f\u00fatbol sala en @RepasoDeportivo."
|
81
|
+
real.user.description.should == user.description
|
82
|
+
user.avatar = 'https://si0.twimg.com/profile_images/2287684652/t4u7vmx6atmibl3pv1rv_normal.jpeg'
|
83
|
+
real.user.avatar.should == user.avatar
|
84
|
+
user.location = ''
|
85
|
+
real.user.location.should == user.location
|
86
|
+
user.subscribers = 99
|
87
|
+
real.user.subscribers.should == user.subscribers
|
88
|
+
user.subscriptions = 203
|
89
|
+
real.user.subscriptions.should == user.subscriptions
|
90
|
+
user.postings = 1636
|
91
|
+
real.user.postings.should == user.postings
|
92
|
+
user.profile = "https://twitter.com/#!/DXTaldia"
|
93
|
+
real.user.profile.should == user.profile
|
94
|
+
user.website = nil
|
95
|
+
real.user.website.should == user.website
|
96
|
+
|
97
|
+
puts 'User OK'
|
98
|
+
|
99
|
+
puts 'Checking Entities...'
|
100
|
+
links = []
|
101
|
+
links.should == real.links
|
102
|
+
|
103
|
+
|
104
|
+
to_u = []
|
105
|
+
|
106
|
+
|
107
|
+
tu = ToUser.new
|
108
|
+
|
109
|
+
tu.name = 'Tukkka_'
|
110
|
+
tu.id = '185248725'
|
111
|
+
tu.service = 'reply'
|
112
|
+
tu.title = '219021134480412673'
|
113
|
+
tu.thumbnail = nil
|
114
|
+
tu.href = 'https://twitter.com/Tukkka_/status/219021134480412673'
|
115
|
+
to_u << tu
|
116
|
+
|
117
|
+
to_u.each do |x|
|
118
|
+
|
119
|
+
real.to_users[0].id.should == x.id
|
120
|
+
real.to_users[0].name.should == x.name
|
121
|
+
real.to_users[0].service.should == x.service
|
122
|
+
real.to_users[0].title.should == x.title
|
123
|
+
real.to_users[0].thumbnail.should == x.thumbnail
|
124
|
+
real.to_users[0].href.should == x.href
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
puts 'Entities OK'
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|