mingle 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +28 -0
  4. data/app/assets/javascripts/mingle/application.js +13 -0
  5. data/app/assets/stylesheets/mingle/application.css +15 -0
  6. data/app/controllers/mingle/application_controller.rb +4 -0
  7. data/app/helpers/mingle/application_helper.rb +4 -0
  8. data/app/jobs/mingle/facebook/fetch.rb +9 -0
  9. data/app/jobs/mingle/instagram/fetch.rb +10 -0
  10. data/app/jobs/mingle/twitter/fetch.rb +10 -0
  11. data/app/models/mingle.rb +5 -0
  12. data/app/models/mingle/facebook.rb +82 -0
  13. data/app/models/mingle/facebook/configuration.rb +8 -0
  14. data/app/models/mingle/facebook/post.rb +28 -0
  15. data/app/models/mingle/hashtag.rb +31 -0
  16. data/app/models/mingle/hashtagging.rb +4 -0
  17. data/app/models/mingle/instagram.rb +36 -0
  18. data/app/models/mingle/instagram/photo.rb +20 -0
  19. data/app/models/mingle/twitter.rb +48 -0
  20. data/app/models/mingle/twitter/tweet.rb +18 -0
  21. data/app/views/layouts/mingle/application.html.erb +14 -0
  22. data/config/initializers/facebook.rb +3 -0
  23. data/config/initializers/instagram.rb +3 -0
  24. data/config/routes.rb +2 -0
  25. data/db/migrate/20140222105907_create_mingle_hashtags.rb +9 -0
  26. data/db/migrate/20140222105956_create_mingle_hashtaggings.rb +13 -0
  27. data/db/migrate/20140222110925_create_mingle_twitter_tweets.rb +15 -0
  28. data/db/migrate/20140222112623_create_mingle_facebook_posts.rb +19 -0
  29. data/db/migrate/20140222112741_create_mingle_instagram_photos.rb +15 -0
  30. data/db/migrate/20140222125715_create_mingle_feed_items.rb +11 -0
  31. data/db/migrate/20140224155358_drop_mingle_feed_items.rb +5 -0
  32. data/lib/mingle.rb +8 -0
  33. data/lib/mingle/engine.rb +21 -0
  34. data/lib/mingle/version.rb +3 -0
  35. data/lib/tasks/mingle_tasks.rake +33 -0
  36. data/spec/dummy/README.rdoc +28 -0
  37. data/spec/dummy/Rakefile +6 -0
  38. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  39. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  40. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  41. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  42. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  43. data/spec/dummy/bin/bundle +3 -0
  44. data/spec/dummy/bin/rails +4 -0
  45. data/spec/dummy/bin/rake +4 -0
  46. data/spec/dummy/config.ru +4 -0
  47. data/spec/dummy/config/application.rb +23 -0
  48. data/spec/dummy/config/boot.rb +5 -0
  49. data/spec/dummy/config/database.yml +30 -0
  50. data/spec/dummy/config/environment.rb +5 -0
  51. data/spec/dummy/config/environments/development.rb +37 -0
  52. data/spec/dummy/config/environments/production.rb +83 -0
  53. data/spec/dummy/config/environments/test.rb +39 -0
  54. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  55. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  56. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  57. data/spec/dummy/config/initializers/inflections.rb +16 -0
  58. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  59. data/spec/dummy/config/initializers/session_store.rb +3 -0
  60. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  61. data/spec/dummy/config/locales/en.yml +23 -0
  62. data/spec/dummy/config/routes.rb +4 -0
  63. data/spec/dummy/config/secrets.yml +22 -0
  64. data/spec/dummy/db/development.sqlite3 +0 -0
  65. data/spec/dummy/db/schema.rb +75 -0
  66. data/spec/dummy/db/test.sqlite3 +0 -0
  67. data/spec/dummy/log/development.log +12964 -0
  68. data/spec/dummy/log/test.log +12630 -0
  69. data/spec/dummy/public/404.html +67 -0
  70. data/spec/dummy/public/422.html +67 -0
  71. data/spec/dummy/public/500.html +66 -0
  72. data/spec/dummy/public/favicon.ico +0 -0
  73. data/spec/factories/mingle/facebook/posts.rb +15 -0
  74. data/spec/factories/mingle/hashtaggings.rb +8 -0
  75. data/spec/factories/mingle/hashtags.rb +7 -0
  76. data/spec/factories/mingle/instagram/photos.rb +12 -0
  77. data/spec/factories/mingle/twitter/tweets.rb +12 -0
  78. data/spec/fixtures/mingle/facebook/page_posts.json +133 -0
  79. data/spec/fixtures/mingle/facebook/search_posts.json +119 -0
  80. data/spec/fixtures/mingle/instagram/photos.json +155 -0
  81. data/spec/fixtures/mingle/twitter/tweets.json +253 -0
  82. data/spec/jobs/mingle/facebook/fetch_spec.rb +9 -0
  83. data/spec/jobs/mingle/instagram/fetch_spec.rb +9 -0
  84. data/spec/jobs/mingle/twitter/fetch_spec.rb +9 -0
  85. data/spec/models/mingle/facebook/post_spec.rb +43 -0
  86. data/spec/models/mingle/facebook_spec.rb +105 -0
  87. data/spec/models/mingle/hashtag_spec.rb +41 -0
  88. data/spec/models/mingle/hashtagging_spec.rb +4 -0
  89. data/spec/models/mingle/instagram/photo_spec.rb +4 -0
  90. data/spec/models/mingle/instagram_spec.rb +58 -0
  91. data/spec/models/mingle/twitter/tweet_spec.rb +4 -0
  92. data/spec/models/mingle/twitter_spec.rb +69 -0
  93. data/spec/spec_helper.rb +21 -0
  94. data/spec/support/fixture.rb +8 -0
  95. metadata +340 -0
@@ -0,0 +1,155 @@
1
+ {
2
+ "pagination": {
3
+ "next_min_id": "1370010531591",
4
+ "deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead",
5
+ "min_tag_id": "1370010531591"
6
+ },
7
+ "meta": {
8
+ "code": 200
9
+ },
10
+ "data": [
11
+ {
12
+ "attribution": null,
13
+ "tags": [
14
+ "bær",
15
+ "rema1000",
16
+ "sommer",
17
+ "rema1000bjerkvik",
18
+ "klhd"
19
+ ],
20
+ "location": null,
21
+ "comments": {
22
+ "count": 0,
23
+ "data": []
24
+ },
25
+ "filter": "Normal",
26
+ "created_time": "1369985275",
27
+ "link": "http://instagram.com/p/Z97x-zEBXL/",
28
+ "likes": {
29
+ "count": 1,
30
+ "data": [
31
+ {
32
+ "username": "tihwassmo",
33
+ "profile_picture": "http://images.ak.instagram.com/profiles/profile_225146815_75sq_1348171706.jpg",
34
+ "id": "225146815",
35
+ "full_name": "tihwassmo"
36
+ }
37
+ ]
38
+ },
39
+ "images": {
40
+ "low_resolution": {
41
+ "url": "http://distilleryimage7.s3.amazonaws.com/9c90802cc9c311e2868a22000a9f18a6_6.jpg",
42
+ "width": 306,
43
+ "height": 306
44
+ },
45
+ "thumbnail": {
46
+ "url": "http://distilleryimage7.s3.amazonaws.com/9c90802cc9c311e2868a22000a9f18a6_5.jpg",
47
+ "width": 150,
48
+ "height": 150
49
+ },
50
+ "standard_resolution": {
51
+ "url": "http://distilleryimage7.s3.amazonaws.com/9c90802cc9c311e2868a22000a9f18a6_7.jpg",
52
+ "width": 612,
53
+ "height": 612
54
+ }
55
+ },
56
+ "users_in_photo": [],
57
+ "caption": {
58
+ "created_time": "1369985331",
59
+ "text": "foo",
60
+ "from": {
61
+ "username": "eivindhilling",
62
+ "profile_picture": "http://images.ak.instagram.com/profiles/profile_272366028_75sq_1365676035.jpg",
63
+ "id": "272366028",
64
+ "full_name": "Eivind Hilling"
65
+ },
66
+ "id": "467793323198781310"
67
+ },
68
+ "type": "image",
69
+ "id": "467792855743600075_272366028",
70
+ "user": {
71
+ "username": "eivindhilling",
72
+ "website": "",
73
+ "profile_picture": "http://images.ak.instagram.com/profiles/profile_272366028_75sq_1365676035.jpg",
74
+ "full_name": "Eivind Hilling",
75
+ "bio": "",
76
+ "id": "272366028"
77
+ }
78
+ },
79
+ {
80
+ "attribution": null,
81
+ "tags": [
82
+ "rema1000",
83
+ "klhd"
84
+ ],
85
+ "location": null,
86
+ "comments": {
87
+ "count": 0,
88
+ "data": []
89
+ },
90
+ "filter": "Normal",
91
+ "created_time": "1366202692",
92
+ "link": "http://instagram.com/p/YNNE4ckBfI/",
93
+ "likes": {
94
+ "count": 9,
95
+ "data": [
96
+ {
97
+ "username": "alagurion",
98
+ "profile_picture": "http://images.ak.instagram.com/profiles/anonymousUser.jpg",
99
+ "id": "211278169",
100
+ "full_name": "alagurion"
101
+ },
102
+ {
103
+ "username": "tihwassmo",
104
+ "profile_picture": "http://images.ak.instagram.com/profiles/profile_225146815_75sq_1348171706.jpg",
105
+ "id": "225146815",
106
+ "full_name": "tihwassmo"
107
+ },
108
+ {
109
+ "username": "queenviq",
110
+ "profile_picture": "http://images.ak.instagram.com/profiles/profile_201453182_75sq_1357046744.jpg",
111
+ "id": "201453182",
112
+ "full_name": "Veronica Sørensen"
113
+ },
114
+ {
115
+ "username": "kaaaia",
116
+ "profile_picture": "http://images.ak.instagram.com/profiles/profile_28626465_75sq_1365775834.jpg",
117
+ "id": "28626465",
118
+ "full_name": "kaaaia"
119
+ }
120
+ ]
121
+ },
122
+ "images": {
123
+ "low_resolution": {
124
+ "url": "http://distilleryimage4.s3.amazonaws.com/995b39c6a75c11e2918122000a9f4d8a_6.jpg",
125
+ "width": 306,
126
+ "height": 306
127
+ },
128
+ "thumbnail": {
129
+ "url": "http://distilleryimage4.s3.amazonaws.com/995b39c6a75c11e2918122000a9f4d8a_5.jpg",
130
+ "width": 150,
131
+ "height": 150
132
+ },
133
+ "standard_resolution": {
134
+ "url": "http://distilleryimage4.s3.amazonaws.com/995b39c6a75c11e2918122000a9f4d8a_7.jpg",
135
+ "width": 612,
136
+ "height": 612
137
+ }
138
+ },
139
+ "users_in_photo": [],
140
+ "type": "image",
141
+ "id": "436062249016104904_272366028",
142
+ "user": {
143
+ "username": "eivindhilling",
144
+ "website": "",
145
+ "profile_picture": "http://images.ak.instagram.com/profiles/profile_272366028_75sq_1365676035.jpg",
146
+ "full_name": "Eivind Hilling",
147
+ "bio": "",
148
+ "id": "272366028"
149
+ }
150
+ },
151
+ {
152
+ "type": "unknown"
153
+ }
154
+ ]
155
+ }
@@ -0,0 +1,253 @@
1
+ {
2
+ "statuses": [
3
+ {
4
+ "metadata": {
5
+ "result_type": "recent",
6
+ "iso_language_code": "no"
7
+ },
8
+ "created_at": "Sat Jun 01 07:45:37 +0000 2013",
9
+ "id": 340735872293040128,
10
+ "id_str": "340735872293040128",
11
+ "text": "Klar for dagens plikter! Ha en fin lørdag :) #Rema1000 http://t.co/npom7ntimr",
12
+ "source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>",
13
+ "truncated": false,
14
+ "in_reply_to_status_id": null,
15
+ "in_reply_to_status_id_str": null,
16
+ "in_reply_to_user_id": null,
17
+ "in_reply_to_user_id_str": null,
18
+ "in_reply_to_screen_name": null,
19
+ "user": {
20
+ "id": 280615050,
21
+ "id_str": "280615050",
22
+ "name": "Anita Iren Vassli",
23
+ "screen_name": "anitairenLFC",
24
+ "location": "Kyrksæterøra",
25
+ "description": "Trønderjente som helst kler seg i rødt og er veldig svak for Steven Gerrard! Rosenborg og Liverpool - livet mitt!",
26
+ "url": null,
27
+ "entities": {
28
+ "description": {
29
+ "urls": [
30
+
31
+ ]
32
+ }
33
+ },
34
+ "protected": false,
35
+ "followers_count": 224,
36
+ "friends_count": 214,
37
+ "listed_count": 2,
38
+ "created_at": "Mon Apr 11 17:52:21 +0000 2011",
39
+ "favourites_count": 687,
40
+ "utc_offset": 3600,
41
+ "time_zone": "Amsterdam",
42
+ "geo_enabled": false,
43
+ "verified": false,
44
+ "statuses_count": 10870,
45
+ "lang": "en",
46
+ "contributors_enabled": false,
47
+ "is_translator": false,
48
+ "profile_background_color": "1A1B1F",
49
+ "profile_background_image_url": "http://a0.twimg.com/profile_background_images/667504298/9de1056dd73477c5d69519285b8edd77.jpeg",
50
+ "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/667504298/9de1056dd73477c5d69519285b8edd77.jpeg",
51
+ "profile_background_tile": true,
52
+ "profile_image_url": "http://a0.twimg.com/profile_images/3521212093/20a837ff967f5f1685f00506df7550e5_normal.jpeg",
53
+ "profile_image_url_https": "https://si0.twimg.com/profile_images/3521212093/20a837ff967f5f1685f00506df7550e5_normal.jpeg",
54
+ "profile_banner_url": "https://pbs.twimg.com/profile_banners/280615050/1363378975",
55
+ "profile_link_color": "2FC2EF",
56
+ "profile_sidebar_border_color": "FFFFFF",
57
+ "profile_sidebar_fill_color": "252429",
58
+ "profile_text_color": "666666",
59
+ "profile_use_background_image": true,
60
+ "default_profile": false,
61
+ "default_profile_image": false,
62
+ "following": false,
63
+ "follow_request_sent": false,
64
+ "notifications": false
65
+ },
66
+ "geo": null,
67
+ "coordinates": null,
68
+ "place": null,
69
+ "contributors": null,
70
+ "retweet_count": 0,
71
+ "favorite_count": 0,
72
+ "entities": {
73
+ "hashtags": [
74
+ {
75
+ "text": "Rema1000",
76
+ "indices": [
77
+ 45,
78
+ 54
79
+ ]
80
+ }
81
+ ],
82
+ "symbols": [
83
+
84
+ ],
85
+ "urls": [
86
+
87
+ ],
88
+ "user_mentions": [
89
+
90
+ ],
91
+ "media": [
92
+ {
93
+ "id": 340735872297234433,
94
+ "id_str": "340735872297234433",
95
+ "indices": [
96
+ 55,
97
+ 77
98
+ ],
99
+ "media_url": "http://pbs.twimg.com/media/BLqJeHaCcAEPMFq.jpg",
100
+ "media_url_https": "https://pbs.twimg.com/media/BLqJeHaCcAEPMFq.jpg",
101
+ "url": "http://t.co/npom7ntimr",
102
+ "display_url": "pic.twitter.com/npom7ntimr",
103
+ "expanded_url": "http://twitter.com/anitairenLFC/status/340735872293040128/photo/1",
104
+ "type": "photo",
105
+ "sizes": {
106
+ "small": {
107
+ "w": 340,
108
+ "h": 382,
109
+ "resize": "fit"
110
+ },
111
+ "thumb": {
112
+ "w": 150,
113
+ "h": 150,
114
+ "resize": "crop"
115
+ },
116
+ "large": {
117
+ "w": 911,
118
+ "h": 1024,
119
+ "resize": "fit"
120
+ },
121
+ "medium": {
122
+ "w": 600,
123
+ "h": 674,
124
+ "resize": "fit"
125
+ }
126
+ }
127
+ }
128
+ ]
129
+ },
130
+ "favorited": false,
131
+ "retweeted": false,
132
+ "possibly_sensitive": false,
133
+ "lang": "no"
134
+ },
135
+ {
136
+ "metadata": {
137
+ "result_type": "recent",
138
+ "iso_language_code": "no"
139
+ },
140
+ "created_at": "Sat Jun 01 07:33:40 +0000 2013",
141
+ "id": 340732867342651392,
142
+ "id_str": "340732867342651392",
143
+ "text": "Av erfaring er det en ting som er sikkert!! #kiwi selger frukt som er umoden eller for gammel. #rema1000 har moden og god frukt! #dagligvare",
144
+ "source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>",
145
+ "truncated": false,
146
+ "in_reply_to_status_id": null,
147
+ "in_reply_to_status_id_str": null,
148
+ "in_reply_to_user_id": null,
149
+ "in_reply_to_user_id_str": null,
150
+ "in_reply_to_screen_name": null,
151
+ "user": {
152
+ "id": 87887606,
153
+ "id_str": "87887606",
154
+ "name": "Hans Fredrik",
155
+ "screen_name": "Hbjorg",
156
+ "location": "Norway ",
157
+ "description": "Life, music, travel!",
158
+ "url": null,
159
+ "entities": {
160
+ "description": {
161
+ "urls": [
162
+
163
+ ]
164
+ }
165
+ },
166
+ "protected": false,
167
+ "followers_count": 14,
168
+ "friends_count": 18,
169
+ "listed_count": 0,
170
+ "created_at": "Fri Nov 06 07:08:28 +0000 2009",
171
+ "favourites_count": 4,
172
+ "utc_offset": 3600,
173
+ "time_zone": "Berlin",
174
+ "geo_enabled": true,
175
+ "verified": false,
176
+ "statuses_count": 443,
177
+ "lang": "en",
178
+ "contributors_enabled": false,
179
+ "is_translator": false,
180
+ "profile_background_color": "00AAFF",
181
+ "profile_background_image_url": "http://a0.twimg.com/profile_background_images/567117896/qpqj0ahmkia1ehieve33.jpeg",
182
+ "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/567117896/qpqj0ahmkia1ehieve33.jpeg",
183
+ "profile_background_tile": false,
184
+ "profile_image_url": "http://a0.twimg.com/profile_images/1364414120/Profil_twitter_normal.jpg",
185
+ "profile_image_url_https": "https://si0.twimg.com/profile_images/1364414120/Profil_twitter_normal.jpg",
186
+ "profile_banner_url": "https://pbs.twimg.com/profile_banners/87887606/1366322320",
187
+ "profile_link_color": "000000",
188
+ "profile_sidebar_border_color": "EEEEEE",
189
+ "profile_sidebar_fill_color": "EFEFEF",
190
+ "profile_text_color": "333333",
191
+ "profile_use_background_image": true,
192
+ "default_profile": false,
193
+ "default_profile_image": false,
194
+ "following": false,
195
+ "follow_request_sent": false,
196
+ "notifications": false
197
+ },
198
+ "geo": null,
199
+ "coordinates": null,
200
+ "place": null,
201
+ "contributors": null,
202
+ "retweet_count": 0,
203
+ "favorite_count": 0,
204
+ "entities": {
205
+ "hashtags": [
206
+ {
207
+ "text": "kiwi",
208
+ "indices": [
209
+ 44,
210
+ 49
211
+ ]
212
+ },
213
+ {
214
+ "text": "rema1000",
215
+ "indices": [
216
+ 95,
217
+ 104
218
+ ]
219
+ },
220
+ {
221
+ "text": "dagligvare",
222
+ "indices": [
223
+ 129,
224
+ 140
225
+ ]
226
+ }
227
+ ],
228
+ "symbols": [
229
+
230
+ ],
231
+ "urls": [
232
+
233
+ ],
234
+ "user_mentions": [
235
+
236
+ ]
237
+ },
238
+ "favorited": false,
239
+ "retweeted": false,
240
+ "lang": "no"
241
+ }
242
+ ],
243
+ "search_metadata": {
244
+ "completed_in": 0.025,
245
+ "max_id": 340735872293040128,
246
+ "max_id_str": "340735872293040128",
247
+ "query": "%23rema1000",
248
+ "refresh_url": "?since_id=340735872293040128&q=%23rema1000&include_entities=1",
249
+ "count": 15,
250
+ "since_id": 0,
251
+ "since_id_str": "0"
252
+ }
253
+ }
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mingle::Facebook::Fetch do
4
+ it 'will invoke fetch' do
5
+ Mingle::Facebook.should_receive(:fetch)
6
+
7
+ subject.perform
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mingle::Instagram::Fetch do
4
+ it 'will invoke fetch' do
5
+ Mingle::Instagram.should_receive(:fetch)
6
+
7
+ subject.perform
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mingle::Twitter::Fetch do
4
+ it 'will invoke fetch' do
5
+ Mingle::Twitter.should_receive(:fetch)
6
+
7
+ subject.perform
8
+ end
9
+ end
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mingle::Facebook::Post do
4
+
5
+ describe '#large_picture' do
6
+ it 'provides its picture in large format' do
7
+ subject.picture = 'https://facebook.com/images/_s/123871_s.jpg'
8
+ expect(subject.large_picture).to eq('https://facebook.com/images/_s/123871_b.jpg')
9
+
10
+ subject.picture = 'https://facebook.com/images/_s/123871_s.jpeg'
11
+ expect(subject.large_picture).to eq('https://facebook.com/images/_s/123871_b.jpeg')
12
+
13
+ subject.picture = 'https://facebook.com/images/_s/123871_s.png'
14
+ expect(subject.large_picture).to eq('https://facebook.com/images/_s/123871_b.png')
15
+
16
+ subject.picture = 'https://facebook.com/images/_s/123871_s.gif'
17
+ expect(subject.large_picture).to eq('https://facebook.com/images/_s/123871_b.gif')
18
+
19
+ subject.picture = nil
20
+ expect(subject.large_picture).to be_nil
21
+ end
22
+ end
23
+
24
+ describe '#profile_url' do
25
+ it 'provides Facebook profile link' do
26
+ subject.user_id = 'timkurvers'
27
+ expect(subject.profile_url).to eq 'https://www.facebook.com/timkurvers'
28
+
29
+ subject.user_id = nil
30
+ expect(subject.profile_url).to be_nil
31
+ end
32
+ end
33
+
34
+ describe '#profile_image_url' do
35
+ it 'provides profile image through Graph API' do
36
+ subject.user_id = 'timkurvers'
37
+ expect(subject.profile_image_url).to eq 'https://graph.facebook.com/timkurvers/picture'
38
+
39
+ subject.user_id = nil
40
+ expect(subject.profile_image_url).to be_nil
41
+ end
42
+ end
43
+ end