Skip to content

Instantly share code, notes, and snippets.

@rauhryan
Created July 20, 2013 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rauhryan/6045348 to your computer and use it in GitHub Desktop.
Save rauhryan/6045348 to your computer and use it in GitHub Desktop.
Current data collection code for huboard
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