tweetwall 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,21 +23,10 @@ Or install it yourself as:
23
23
 
24
24
  The print_tweets method returns an HTML division of Tweets.
25
25
  Simply call the print_tweets method like so:
26
- Tweetwall.print_tweets("oceancucumber")
26
+ Tweetwall.print_tweets("oceancucumber", 5, consumer_key, consumer_secret)
27
27
 
28
28
  You'll get the full tweet_wall HTML division
29
29
 
30
- Optionally, you can specify the number of tweets:
31
- Tweetwall.print_tweets("oceancucumber", 10)
32
-
33
- There is also a function that you can call that will only print
34
- the Tweet content. This is useful if you want to do an AJAX
35
- refresh on the tweet_wall division without refreshing the entire
36
- page:
37
- Tweetwall.print_tweet_content("oceancucumber", 10)
38
-
39
- The number of tweets is again optional.
40
-
41
30
  ## Contributing
42
31
 
43
32
  1. Fork it
@@ -3,27 +3,36 @@ require "twitter"
3
3
 
4
4
  module Tweetwall
5
5
 
6
+ public
7
+
6
8
  # This method prints the entire DIV of the tweet_wall in your html
7
- def self.print_tweets(twitter_user, number_of_tweets=5)
9
+ def self.print_tweets(twitter_user, number_of_tweets=5, consumer_key, consumer_secret)
8
10
  begin
9
- '<div id="tweet_wall">' + self.print_tweet_content(twitter_user, number_of_tweets) + '</div>'
11
+ '<div id="tweet_wall">' + self.print_tweet_content(twitter_user, number_of_tweets, consumer_key, consumer_secret) + '</div>'
10
12
  rescue
11
13
  ""
12
14
  end
13
15
  end
14
16
 
17
+ private
18
+
15
19
  # This method prints out just the tweet content. Usefull if you want to do an AJAX refresh
16
20
  # of your Tweets without reloading the whole page
17
- def self.print_tweet_content(twitter_user, number_of_tweets=5)
21
+ def self.print_tweet_content(twitter_user, number_of_tweets=5, consumer_key, consumer_secret)
18
22
  begin
23
+ client = Twitter::REST::Client.new do |config|
24
+ config.consumer_key = consumer_key
25
+ config.consumer_secret = consumer_secret
26
+ end
27
+
19
28
  # working with an array that starts at 0
20
29
  number_of_tweets = number_of_tweets - 1
21
30
 
22
31
  # Get the tweets from the feed
23
- twitter_feed = Twitter.user_timeline(twitter_user)[0..number_of_tweets]
32
+ twitter_feed = client.user_timeline(twitter_user)[0..number_of_tweets]
24
33
 
25
34
  # Get the twitter user's profile picture
26
- twitter_image = Twitter.user(twitter_user).profile_image_url
35
+ twitter_image = client.user(twitter_user).profile_image_url
27
36
 
28
37
  # This variable needs to be declared because of the scop of the each\do block
29
38
  tweet_content = String.new
@@ -57,8 +66,10 @@ module Tweetwall
57
66
  end
58
67
 
59
68
  tweet_content
60
- rescue
61
- "Tweets not available"
69
+ rescue Exception => e
70
+ #"Tweets not available"
71
+ puts e.message
72
+ puts e.backtrace.inspect
62
73
  end
63
74
  end
64
75
 
@@ -1,3 +1,3 @@
1
1
  module Tweetwall
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tweetwall
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-17 00:00:00.000000000Z
12
+ date: 2013-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: twitter
16
- requirement: &2158464520 !ruby/object:Gem::Requirement
16
+ requirement: &2152920560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2158464520
24
+ version_requirements: *2152920560
25
25
  description: This Gem makes it very easy to add a wall of Tweets from a Twitter User
26
26
  in your web application.
27
27
  email:
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  version: '0'
59
59
  requirements: []
60
60
  rubyforge_project:
61
- rubygems_version: 1.8.10
61
+ rubygems_version: 1.8.11
62
62
  signing_key:
63
63
  specification_version: 3
64
64
  summary: Easily add a Tweet Wall.