forked from punerb/ideahub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
twitter integration done and documentation added
- Loading branch information
1 parent
d3c43dc
commit 6ca2ae2
Showing
8 changed files
with
50 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
== Josh Open Source Friday's | ||
|
||
This is the place to be on Friday's. | ||
|
||
To enable the Twitter integration you should do following once during the initial setup through rails console: | ||
Setting.consumer_key = 'your twitter consumer key' | ||
Setting.consumer_secret = 'your twitter consumer secret' | ||
Setting.oauth_token = 'your twitter access token' | ||
Setting.oauth_token_secret = 'your twitter access token secret' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Setting < ActiveRecord::Base | ||
attr_accessible :name, :value | ||
|
||
def self.method_missing(identifier, args = nil) | ||
identifier = identifier.to_s.gsub '=', '' | ||
set = Setting.where(name: identifier).first | ||
if args.nil? and !set.nil? | ||
return set.value | ||
elsif !args.nil? | ||
set ||= Setting.new(name: identifier) | ||
set.value = args | ||
set.save! | ||
else | ||
super identifier, args | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
class User < ActiveRecord::Base | ||
attr_accessible :name, :email | ||
has_many :services, :dependent => :destroy | ||
|
||
def tweet(msg) | ||
twitter_user = Twitter::Client.new(oauth_token: Setting.oauth_token, oauth_token_secret: Setting.oauth_token_secret) | ||
twitter_user.update(msg) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CreateSettings < ActiveRecord::Migration | ||
def change | ||
create_table :settings do |t| | ||
t.string :name | ||
t.string :value | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters