Created
July 20, 2013 14:56
-
-
Save rauhryan/6045348 to your computer and use it in GitHub Desktop.
Current data collection code for huboard
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
class Board | |
board_method = self.instance_method(:board) | |
def couch | |
@couch ||= Huboard::Couch.new :base_url => ENV["CLOUDANT_URL"] | |
end | |
define_method(:board) do | |
api = connection_factory.call | |
therepo = api.repos(user, repo) | |
theuser = api.users(user) | |
couch.users.get_or_create theuser if theuser.type == "User" | |
couch.orgs.get_or_create theuser if theuser.type == "Organization" | |
couch.repos.get_or_create therepo | |
theboard = board_method.bind(self).call | |
#couch.boards.save theboard | |
theboard | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment