rauhryan
7/20/2013 - 2:56 PM

Current data collection code for huboard

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