Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
store receiver, add groups, log messages
- Loading branch information
Sven Fuchs
committed
Mar 24, 2010
1 parent
840592a
commit 1388b30
Showing
11 changed files
with
126 additions
and
47 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
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,5 @@ | ||
CouchPotato::View::BaseViewSpec.class_eval do | ||
def design_document | ||
@design_document.gsub('/', '::') # TODO ask alex | ||
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
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,30 @@ | ||
class Identity::Message | ||
class << self | ||
def if_unprocessed(receiver, message) | ||
raise 'message.id is nil' unless message.id | ||
return if find_by_message_id(message.id) | ||
yield | ||
create :message_id => message.id, | ||
:text => message.text, | ||
:sender => message.user.screen_name, | ||
:receiver => receiver, | ||
:received_at => Time.now | ||
end | ||
end | ||
|
||
include SimplyStored::Couch | ||
|
||
# sanitize data ... | ||
|
||
property :message_id | ||
property :text | ||
property :sender | ||
property :receiver | ||
property :received_at | ||
|
||
view :by_message_id, :key => :message_id | ||
|
||
def initialize(data = {}) | ||
data.each { |key, value| self.send("#{key}=", value) } | ||
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
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,23 @@ | ||
$: << File.expand_path('../lib', __FILE__) | ||
require 'rubygems' | ||
require 'identity' | ||
|
||
module CouchPotato | ||
def self.database=(database) | ||
@@__database = database | ||
end | ||
end | ||
|
||
ENV['couchdb_url'] = ... | ||
ENV['twitter_login'] = 'rugb_test' | ||
ENV['twitter_password'] = 'clubmate' | ||
|
||
# gotta do this to use http auth | ||
ENV['couchdb_url'] =~ /(.*)\/([^\/]*)$/ | ||
couchdb_url, couchdb_name = $1, $2 | ||
|
||
couchrest_server = CouchRest::Server.new(couchdb_url) | ||
couchrest_db = CouchRest::Database.new(couchrest_server, couchdb_name) | ||
CouchPotato.database = CouchPotato::Database.new(couchrest_db) | ||
|
||
p Identity.find_by_handle('fritzek') |
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