Get a list of all votes for the authenticating client.

 @param [Hash]  options
 @option options Integer :user_id - Only return votes for this user.
 @option options Integer :limit - The maximum number of records to return.
12695
def votes(options={})
      response = connection.get do |req|
        req.url "votes", options
      end
      return_error_or_body(response)
    end
353440
def all(self, order_by=None, limit=0):
        
        with rconnect() as conn:
            try:
                query = self._base()
                if order_by is not None:
                    query = self._order_by(query, order_by)
                if limit > 0:
                    query = self._limit(query, limit)

                log.debug(query)
                rv = query.run(conn)
            except Exception as e:
                log.warn(e)
                raise
            else:
                data = [self._model(_) for _ in rv]
                return data
671427
def index
      @sessions = Session.where(user: @user)
      expired = []
      active = []
      @sessions.each do |session|
        if session.expired?
          expired << session.uuid
        else
          active << session
        end
      end
      SessionsCleanupJob.perform_later(*expired)
      render json: active, except: [:secret]
    end
970702
def list_results(self, number, username):
        
        # 取得新 API 的結果
        data = self.get_question_results(number, username)
        # 實作相容的結構
        result = []
        for number in data:
            # 儲存題目資訊
            result += [(number, data[number])]
        # 回傳結果
        return result
447545
def find(user_id, read_attributes="01")
      options = default_options_to_merge_with.merge({ query: { full: read_attributes} })
      self.class.get("/#{@api_ver}/users/#{user_id}", options)
    end
1334787
def get_statuses(self, username, offset=0, limit=10):

        

        response = self._req('/user/statuses/', {
            "username" : username,
            'offset' : offset,
            'limit' : limit
        })

        statuses = []

        for item in response['results']:
            s = Status()
            s.from_dict(item)
            statuses.append(s)

        return {
            "results" : statuses,
            "has_more" : response['has_more'],
            "next_offset" : response['next_offset']
        }
178075
def get_clients(self, limit=None, offset=None):
        
        data = {}
        if limit:
            data['limit'] = limit
        if offset:
            data['offset'] = offset
        result = self._request('GET', '/clients', data=json.dumps(data))
        return result.json()
777615
def get_votes_comment(self, *args, **kwargs):
        
        return bind_api(
            api=self,
            path='/comments/{commentId}/votes',
            payload_type='vote',
            payload_list=True,
            allowed_param=['commentId']
        )(*args, **kwargs)
1280482
def get(self, **options):
        
        sub_query = self.with_limit(1)
        options = QueryOptions(sub_query).replace(batch_size=1)
        for result in sub_query.run(**options):
            return result
        return None
488111
def limit(self, limit):
    
    params = join_params(self.parameters, {"limit": limit})

    return self.__class__(**params)
216516
def get_users(self, limit=100, offset=0):
        
        url = self.TEAM_USERS_URL + "?limit=%s&offset=%s" % (limit, offset)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
1203734
def obtain_users(access = nil)
      admins = obtain_users
      if access.is_a?(Array)
        admins = admins.where(:id => access) if !access.blank?
      else
        admins = admins.where(:access_level => access) if !access.blank?
      end

      admins
    end
774515
def _rate_limit_status(self, api=None, mode=None):
        
        if api == None:
            api = self.connectToAPI()

        if mode == None:
            print json.dumps(api.rate_limit_status(), indent=2)
            raw_input("<Press ENTER>")
        else:
            # Testing if we have enough queries
            while True:
                allLimits = api.rate_limit_status()
                if mode == "get_user":
                    limit = allLimits["resources"]["users"]["/users/show/:id"]["limit"]
                    remaining = allLimits["resources"]["users"]["/users/show/:id"]["remaining"]
                    reset = allLimits["resources"]["users"]["/users/show/:id"]["reset"]
                elif mode == "get_followers":
                    limit = allLimits["resources"]["followers"]["/followers/ids"]["limit"]
                    remaining = allLimits["resources"]["followers"]["/followers/ids"]["remaining"]
                    reset = allLimits["resources"]["followers"]["/followers/ids"]["reset"]
                elif mode == "get_friends":
                    limit = allLimits["resources"]["friends"]["/friends/ids"]["limit"]
                    remaining = allLimits["resources"]["friends"]["/friends/ids"]["remaining"]
                    reset = allLimits["resources"]["friends"]["/friends/ids"]["reset"]
                elif mode == "search_users":
                    limit = allLimits["resources"]["users"]["/users/search"]["limit"]
                    remaining = allLimits["resources"]["users"]["/users/search"]["remaining"]
                    reset = allLimits["resources"]["users"]["/users/search"]["reset"]
                else:
                    remaining = 1
                """elif mode == "get_all_docs":
                    limit = allLimits["resources"]REPLACEME["limit"]
                    remaining = allLimits["resources"]REPLACEME["remaining"]
                    reset = allLimits["resources"]REPLACEME["reset"]elif mode == "get_users":
                    limit = allLimits["resources"]REPLACEME["limit"]
                    remaining = allLimits["resources"]REPLACEME["remaining"]
                    reset = allLimits["resources"]REPLACEME["reset"] else:
                    remaining = 1"""
                # Checking if we have enough remaining queries
                if remaining > 0:
                    #raw_input(str(remaining) + " queries yet...")
                    break
                else:
                    waitTime = 60
                    print "No more queries remaining, sleeping for " + str(waitTime) +" seconds..."
                    time.sleep(waitTime)

        return 0
1187427
def access_keys(options = {})
      batches = Enumerator.new do |y|
        options = options.merge(user_name: @name)
        resp = @client.list_access_keys(options)
        resp.each_page do |page|
          batch = []
          page.data.access_key_metadata.each do |a|
            batch << AccessKey.new(
              user_name: @name,
              id: a.access_key_id,
              data: a,
              client: @client
            )
          end
          y.yield(batch)
        end
      end
      AccessKey::Collection.new(batches)
    end
420186
def get_user_playlists(self, user_id, limit=1000):
        

        url = 'http://music.163.com/weapi/user/playlist?csrf_token='
        csrf = ''
        params = {'offset': 0, 'uid': user_id, 'limit': limit,
                  'csrf_token': csrf}
        result = self.post_request(url, params)
        playlists = result['playlist']
        return self.display.select_one_playlist(playlists)
174856
def get_user_push_restrictions(self):
        
        return github.PaginatedList.PaginatedList(
            github.NamedUser.NamedUser,
            self._requester,
            self.protection_url + "/restrictions/users",
            None
        )
856745
def has_been_completed_by(poll, user):
    
    user_votes = TopicPollVote.objects.filter(
        poll_option__poll=poll)
    if user.is_anonymous:
        forum_key = get_anonymous_user_forum_key(user)
        user_votes = user_votes.filter(anonymous_key=forum_key) if forum_key \
            else user_votes.none()
    else:
        user_votes = user_votes.filter(voter=user)
    return user_votes.exists()