twitterfeed 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -4
- data/lib/generators/twitterfeed_generator.rb +7 -0
- data/lib/twitterfeed/version.rb +1 -1
- data/lib/twitterfeed/view_helpers.rb +3 -3
- data/lib/twitterfeed.rb +1 -1
- metadata +4 -19
data/README.md
CHANGED
@@ -2,14 +2,21 @@
|
|
2
2
|
|
3
3
|
Gem that will retrieve and display tweets from a predetermined set of twitter handles.
|
4
4
|
|
5
|
-
|
5
|
+
== Installation
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
gem 'twitterfeed'
|
10
10
|
|
11
|
+
=== Rails 3.x with asset pipeline enabled:
|
11
12
|
|
12
|
-
|
13
|
+
Just install and you're good to go!
|
14
|
+
|
15
|
+
=== Rails without pipeline asset
|
16
|
+
|
17
|
+
rails g twitterfeed
|
18
|
+
|
19
|
+
== Usage
|
13
20
|
|
14
21
|
Place helper line anywhere in your project with an array of twitter handles:
|
15
22
|
|
@@ -19,13 +26,13 @@ Enjoy!
|
|
19
26
|
|
20
27
|
Twitter API only allows 150 requests per hour, so to help with this, the frequency on which twitterfeed will update is based on how many handles are passed. I.E. 1 handle will be able to be updated 150 times an hour or every 24 seconds, 10 handles will update every 4 minutes, etc. Maximum of 150 handles.
|
21
28
|
|
22
|
-
|
29
|
+
== TODO
|
23
30
|
|
24
31
|
- Add authentication to boost limit up to 350
|
25
32
|
- Read a file with twitter handles to initialize
|
26
33
|
- Ability to include searches
|
27
34
|
|
28
|
-
|
35
|
+
== Contributing
|
29
36
|
|
30
37
|
1. Fork it
|
31
38
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
data/lib/twitterfeed/version.rb
CHANGED
@@ -4,7 +4,7 @@ module Twitterfeed
|
|
4
4
|
module ViewHelpers
|
5
5
|
def twitterfeed(name_array)
|
6
6
|
|
7
|
-
twitterfeed_data = YAML.load(File.open("twitterfeed.yml", 'w+'))
|
7
|
+
twitterfeed_data = YAML.load(File.open("tmp/twitterfeed.yml", 'w+'))
|
8
8
|
|
9
9
|
#initializing cron type system. This will determine how often data is retrieved from twitter to not go over
|
10
10
|
#Twitter API's 150 request per hour limit. The frequency is determined from how many twitter handles are being
|
@@ -14,7 +14,7 @@ module Twitterfeed
|
|
14
14
|
Twitterfeed.update_twitterfeed(twitterfeed_data, name_array)
|
15
15
|
end
|
16
16
|
|
17
|
-
twitterfeed_data = YAML.load(File.open("twitterfeed.yml"))
|
17
|
+
twitterfeed_data = YAML.load(File.open("tmp/twitterfeed.yml"))
|
18
18
|
#removing update time from array
|
19
19
|
twitterfeed_data.slice!(0)
|
20
20
|
render :partial => "twitterfeed/twitterfeed_box", :locals => { :tweet_array => twitterfeed_data}
|
@@ -24,7 +24,7 @@ module Twitterfeed
|
|
24
24
|
def tweet_time(time)
|
25
25
|
#displays the time for a tweet i.e. 36m, 12h, May 5
|
26
26
|
if time < (Time.now - (3600 * 24))
|
27
|
-
time.strftime("%b
|
27
|
+
time.strftime("%b %d")
|
28
28
|
else
|
29
29
|
time_ago = Time.now - time
|
30
30
|
if time_ago < 3600
|
data/lib/twitterfeed.rb
CHANGED
@@ -17,6 +17,6 @@ module Twitterfeed
|
|
17
17
|
tweet_array << {"handle" => tweet.user.screen_name, "text" => tweet.text, "created_at" => tweet.created_at,
|
18
18
|
"pic_url" => tweet.user.profile_image_url_https}
|
19
19
|
end
|
20
|
-
File.open('twitterfeed.yml', 'w') {|f| f.write(tweet_array.to_yaml) }
|
20
|
+
File.open('tmp/twitterfeed.yml', 'w') {|f| f.write(tweet_array.to_yaml) }
|
21
21
|
end
|
22
22
|
end
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitterfeed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 25
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 0.1.1
|
5
|
+
version: 0.1.2
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Mark Capodagli
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2012-05-
|
13
|
+
date: 2012-05-28 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: twitter
|
@@ -25,11 +20,6 @@ dependencies:
|
|
25
20
|
requirements:
|
26
21
|
- - ">"
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
hash: 7
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 2
|
32
|
-
- 0
|
33
23
|
version: 2.2.0
|
34
24
|
type: :runtime
|
35
25
|
version_requirements: *id001
|
@@ -50,6 +40,7 @@ files:
|
|
50
40
|
- Rakefile
|
51
41
|
- app/assets/stylesheets/twitterfeed.css
|
52
42
|
- app/views/twitterfeed/_twitterfeed_box.html.haml
|
43
|
+
- lib/generators/twitterfeed_generator.rb
|
53
44
|
- lib/twitterfeed.rb
|
54
45
|
- lib/twitterfeed/engine.rb
|
55
46
|
- lib/twitterfeed/version.rb
|
@@ -68,23 +59,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
59
|
requirements:
|
69
60
|
- - ">="
|
70
61
|
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
|
-
segments:
|
73
|
-
- 0
|
74
62
|
version: "0"
|
75
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
64
|
none: false
|
77
65
|
requirements:
|
78
66
|
- - ">="
|
79
67
|
- !ruby/object:Gem::Version
|
80
|
-
hash: 3
|
81
|
-
segments:
|
82
|
-
- 0
|
83
68
|
version: "0"
|
84
69
|
requirements: []
|
85
70
|
|
86
71
|
rubyforge_project:
|
87
|
-
rubygems_version: 1.8.
|
72
|
+
rubygems_version: 1.8.21
|
88
73
|
signing_key:
|
89
74
|
specification_version: 3
|
90
75
|
summary: Will allow you to see multiple feeds at once.
|