mingle 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 446a59b13570511c4ea2168783de71d88a5ea227
4
- data.tar.gz: db5b3a67481bd0dd6af997b32888f86ec15c9ca1
3
+ metadata.gz: fcce2c5dda956651978f29315020ec7655ab9ab1
4
+ data.tar.gz: 57b36c7a7e56f207a4ede2e22be2a941bcc42fce
5
5
  SHA512:
6
- metadata.gz: 507b2228505f58f9598fb5b1c2c0795fdab177c5edb7b3237ea7a02eff4d6514ee9723b047dd87b7b4d0096d17b545bd347fa98b024e76e0b2ab44f972f8130f
7
- data.tar.gz: d77557aedb8f87489bc182da3a8509dc3da192fe84261fb1ec46434777a8d9ed059179861da6922213374e6bf47fcab2393c672a1fe23f0569b7f0da9ee6955b
6
+ metadata.gz: e7c9c646d2847131d0d1e57d2950c186cc858685c3ae641688e5d2b7e0b136fa47fe8d0d2735259eb00405f619e8b56b00cc94f4bdba07d3e1ec60869458fadc
7
+ data.tar.gz: 2fb68c67d1b536c57a18a447f0a220362ae5d231a6b831c85f44b7ea32ba002293994de18148858d4c036d6e2746978c78fb4075df7bf8c5500f06ed12552d97
@@ -1,4 +1,4 @@
1
- Copyright 2014 YOURNAME
1
+ Copyright 2014 Hyper AS.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -25,4 +25,12 @@ class Mingle::Facebook::Post < ActiveRecord::Base
25
25
  def profile_image_url
26
26
  "https://graph.facebook.com/#{user_id}/picture" if user_id.present?
27
27
  end
28
+
29
+ def author
30
+ user_name
31
+ end
32
+
33
+ def avatar
34
+ profile_image_url
35
+ end
28
36
  end
@@ -4,7 +4,6 @@ module Mingle::Instagram
4
4
  "#{Mingle.table_name_prefix}instagram_"
5
5
  end
6
6
 
7
- # Fetch recent photos tagged with 'klhd'
8
7
  def self.fetch hashtags = Mingle::Hashtag.all
9
8
  hashtags = Array(hashtags)
10
9
 
@@ -21,7 +20,8 @@ module Mingle::Instagram
21
20
  url: media.images.standard_resolution.url,
22
21
  user_handle: media.user.username,
23
22
  user_id: media.user.id,
24
- user_image_url: media.user.profile_picture
23
+ user_image_url: media.user.profile_picture,
24
+ user_name: media.user.full_name
25
25
  }
26
26
 
27
27
  photo.hashtags << hashtag unless photo.hashtags.include? hashtag
@@ -8,6 +8,14 @@ class Mingle::Instagram::Photo < ActiveRecord::Base
8
8
 
9
9
  before_save :ensure_https_urls
10
10
 
11
+ def author
12
+ user_handle
13
+ end
14
+
15
+ def avatar
16
+ user_image_url
17
+ end
18
+
11
19
  private
12
20
 
13
21
  def ensure_https_urls
@@ -10,6 +10,14 @@ class Mingle::Twitter::Tweet < ActiveRecord::Base
10
10
 
11
11
  before_save :ensure_https_urls
12
12
 
13
+ def author
14
+ user_handle
15
+ end
16
+
17
+ def avatar
18
+ user_image_url
19
+ end
20
+
13
21
  private
14
22
 
15
23
  def ensure_https_urls
@@ -0,0 +1,5 @@
1
+ class AddUserNameToMingleInstagramPhotos < ActiveRecord::Migration
2
+ def change
3
+ add_column :mingle_instagram_photos, :user_name, :string
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Mingle
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -2,6 +2,7 @@ namespace :mingle do
2
2
 
3
3
  desc "Fetch everything"
4
4
  task fetch: ['twitter:fetch', 'facebook:fetch', 'instagram:fetch']
5
+ task clear: ['twitter:clear', 'facebook:clear', 'instagram:clear']
5
6
 
6
7
  namespace :twitter do
7
8
 
@@ -10,6 +11,11 @@ namespace :mingle do
10
11
  Mingle::Twitter.fetch
11
12
  end
12
13
 
14
+ desc "Clear tweets from Twitter"
15
+ task clear: :environment do
16
+ Mingle::Twitter::Tweet.destroy_all
17
+ end
18
+
13
19
  end
14
20
 
15
21
  namespace :facebook do
@@ -19,6 +25,11 @@ namespace :mingle do
19
25
  Mingle::Facebook.fetch
20
26
  end
21
27
 
28
+ desc "Clear posts from Facebook"
29
+ task clear: :environment do
30
+ Mingle::Facebook::Post.destroy_all
31
+ end
32
+
22
33
  end
23
34
 
24
35
  namespace :instagram do
@@ -28,6 +39,11 @@ namespace :mingle do
28
39
  Mingle::Instagram.fetch
29
40
  end
30
41
 
42
+ desc "Clear photos from Instagram"
43
+ task clear: :environment do
44
+ Mingle::Instagram::Photo.destroy_all
45
+ end
46
+
31
47
  end
32
48
 
33
49
  end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20140224155358) do
14
+ ActiveRecord::Schema.define(version: 20140305094014) do
15
15
 
16
16
  create_table "mingle_facebook_posts", force: true do |t|
17
17
  t.string "post_id"
@@ -58,6 +58,7 @@ ActiveRecord::Schema.define(version: 20140224155358) do
58
58
  t.text "message"
59
59
  t.datetime "created_at"
60
60
  t.datetime "updated_at"
61
+ t.string "user_name"
61
62
  end
62
63
 
63
64
  create_table "mingle_twitter_tweets", force: true do |t|
Binary file
@@ -40,4 +40,16 @@ describe Mingle::Facebook::Post do
40
40
  expect(subject.profile_image_url).to be_nil
41
41
  end
42
42
  end
43
+
44
+ describe "#author" do
45
+ it 'should be the username' do
46
+ expect(subject.author).to eq subject.user_name
47
+ end
48
+ end
49
+
50
+ describe "#avatar" do
51
+ it 'should be the profile image' do
52
+ expect(subject.avatar).to eq subject.profile_image_url
53
+ end
54
+ end
43
55
  end
@@ -1,4 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Mingle::Instagram::Photo do
4
+ describe "#author" do
5
+ it 'should be the user handle' do
6
+ expect(subject.author).to eq subject.user_handle
7
+ end
8
+ end
9
+
10
+ describe "#avatar" do
11
+ it 'should be the user image url' do
12
+ expect(subject.avatar).to eq subject.user_image_url
13
+ end
14
+ end
4
15
  end
@@ -30,6 +30,7 @@ describe Mingle::Instagram do
30
30
  expect(photo.user_handle).to eq 'eivindhilling'
31
31
  expect(photo.user_id).to eq '272366028'
32
32
  expect(photo.user_image_url).to eq 'https://distillery.s3.amazonaws.com/profiles/profile_272366028_75sq_1365676035.jpg'
33
+ expect(photo.user_name).to eq 'Eivind Hilling'
33
34
 
34
35
  photo = photos.last
35
36
 
@@ -41,6 +42,7 @@ describe Mingle::Instagram do
41
42
  expect(photo.user_handle).to eq 'eivindhilling'
42
43
  expect(photo.user_id).to eq '272366028'
43
44
  expect(photo.user_image_url).to eq 'https://distillery.s3.amazonaws.com/profiles/profile_272366028_75sq_1365676035.jpg'
45
+ expect(photo.user_name).to eq 'Eivind Hilling'
44
46
 
45
47
  expect(Mingle::Instagram::Photo.count).to be 2
46
48
  end
@@ -1,4 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Mingle::Twitter::Tweet do
4
+ describe "#author" do
5
+ it 'should be the user handle' do
6
+ expect(subject.author).to eq subject.user_handle
7
+ end
8
+ end
9
+
10
+ describe "#avatar" do
11
+ it 'should be the user image url' do
12
+ expect(subject.avatar).to eq subject.user_image_url
13
+ end
14
+ end
4
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mingle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Gorset
@@ -10,146 +10,146 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-02-25 00:00:00.000000000 Z
13
+ date: 2014-03-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: '4.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: '4.0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: twitter
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: '5.5'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '5.5'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: fb_graph
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ~>
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: '2.7'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ~>
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
56
  version: '2.7'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: instagram
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ~>
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0.10'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ~>
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0.10'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: faraday
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ~>
75
+ - - "~>"
76
76
  - !ruby/object:Gem::Version
77
77
  version: 0.8.9
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ~>
82
+ - - "~>"
83
83
  - !ruby/object:Gem::Version
84
84
  version: 0.8.9
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: sqlite3
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: rspec-rails
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - '>='
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - '>='
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: webmock
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - '>='
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - '>='
124
+ - - ">="
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: factory_girl_rails
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - '>='
131
+ - - ">="
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
- - - '>='
138
+ - - ">="
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: sidekiq
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - '>='
145
+ - - ">="
146
146
  - !ruby/object:Gem::Version
147
147
  version: '0'
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - '>='
152
+ - - ">="
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  description: Facebook, Twitter and Instagram integration for Ruby on Rails
@@ -191,6 +191,7 @@ files:
191
191
  - db/migrate/20140222112741_create_mingle_instagram_photos.rb
192
192
  - db/migrate/20140222125715_create_mingle_feed_items.rb
193
193
  - db/migrate/20140224155358_drop_mingle_feed_items.rb
194
+ - db/migrate/20140305093743_add_user_name_to_mingle_instagram_photos.rb
194
195
  - lib/mingle.rb
195
196
  - lib/mingle/engine.rb
196
197
  - lib/mingle/version.rb
@@ -226,8 +227,6 @@ files:
226
227
  - spec/dummy/db/development.sqlite3
227
228
  - spec/dummy/db/schema.rb
228
229
  - spec/dummy/db/test.sqlite3
229
- - spec/dummy/log/development.log
230
- - spec/dummy/log/test.log
231
230
  - spec/dummy/public/404.html
232
231
  - spec/dummy/public/422.html
233
232
  - spec/dummy/public/500.html
@@ -264,17 +263,17 @@ require_paths:
264
263
  - lib
265
264
  required_ruby_version: !ruby/object:Gem::Requirement
266
265
  requirements:
267
- - - '>='
266
+ - - ">="
268
267
  - !ruby/object:Gem::Version
269
268
  version: '0'
270
269
  required_rubygems_version: !ruby/object:Gem::Requirement
271
270
  requirements:
272
- - - '>='
271
+ - - ">="
273
272
  - !ruby/object:Gem::Version
274
273
  version: '0'
275
274
  requirements: []
276
275
  rubyforge_project:
277
- rubygems_version: 2.2.2
276
+ rubygems_version: 2.2.0
278
277
  signing_key:
279
278
  specification_version: 4
280
279
  summary: Social media integration for Ruby on Rails
@@ -308,8 +307,6 @@ test_files:
308
307
  - spec/dummy/db/development.sqlite3
309
308
  - spec/dummy/db/schema.rb
310
309
  - spec/dummy/db/test.sqlite3
311
- - spec/dummy/log/development.log
312
- - spec/dummy/log/test.log
313
310
  - spec/dummy/public/404.html
314
311
  - spec/dummy/public/422.html
315
312
  - spec/dummy/public/500.html