helper method for getting an instance of dailycred
 example:
   dailycred.tagUser "user_id", "tag"

 for more documentation, visit https://www.dailycred.com/api/ruby
491043
def dailycred
      config = Rails.configuration
      @dailycred ||= Dailycred::Client.new(config.DAILYCRED_CLIENT_ID, config.DAILYCRED_SECRET_KEY, config.DAILYCRED_OPTIONS)
    end
933741
def get_for_tag(self, tag):
        
        tag_filter = {'tag': tag}

        if isinstance(tag, six.integer_types):
            tag_filter = {'tag_id': tag}
        elif isinstance(tag, str):
            tag_filter = {'tag__slug': tag}

        return self.filter(id__in=[
            entry_tag.entry_id
            for entry_tag
            in EntryTag.objects.filter(**tag_filter)
        ])
1296772
def for_user(cls, user):
        
        user_id = getattr(user, api_settings.USER_ID_FIELD)
        if not isinstance(user_id, int):
            user_id = str(user_id)

        token = cls()
        token[api_settings.USER_ID_CLAIM] = user_id

        return token
309210
def token_getter(is_personal=True, is_internal=False):
    
    def wrapper(f):
        @wraps(f)
        def decorated(*args, **kwargs):
            if 'token_id' not in kwargs:
                abort(500)

            token = Token.query.filter_by(
                id=kwargs.pop('token_id'),
                user_id=current_user.get_id(),
                is_personal=is_personal,
                is_internal=is_internal,
            ).first()

            if token is None:
                abort(404)

            return f(token, *args, **kwargs)
        return decorated
    return wrapper
328698
def get_instances_by_tag(self, tags):
        

        try:
            c = ec2.connect_to_region(self._region,
                                      aws_access_key_id=self._aws_access_key_id,
                                      aws_secret_access_key=self._aws_secret_access_key)

            # select instance by list of tags (OR used)
            reservations = c.get_all_reservations(filters=SergentSsh.tags_to_dict(tags))
            instances = list()

            for r in reservations:
                # for each instance launched by this reservation
                for instance in r.instances:
                    # we need only running instances
                    if instance.state.lower() == 'running':
                        instances.append(instance)

            return instances
        except NoAuthHandlerFound:
            raise SergentSshException('Boto said that you should check your credentials')
12787
def get_user(self, user_id):
        
        api = self._get_api(iam.AccountAdminApi)
        return User(api.get_user(user_id))
267359
def user_id
      user_id = @current_user ? @current_user.id : nil rescue nil
      user_id = current_user ? current_user.id : nil rescue nil if user_id.blank?
      user_id
    end
78968
def get_tags_of_recurring_per_page(self, recurring_id, per_page=1000, page=1):
        
        return self._get_resource_per_page(
            resource=RECURRING_TAGS,
            per_page=per_page,
            page=page,
            params={'recurring_id': recurring_id},
        )
502181
def tag(tokens)
      !tokens.is_a?(Array) && !tokens.is_a?(String) &&
        raise(ArgumentError, 'tokens must be an instance of String or Array')

      j_instance.tag(tokens.to_java(:String))
    end
559635
def tag_user(self, tag_id, user_id):
        
        data = {'tagid': tag_id}
        if isinstance(user_id, (tuple, list)):
            data['openid_list'] = user_id
        else:
            data['openid_list'] = [user_id, ]
        return self._post('tags/members/batchtagging', data=data)
126453
def user(id)
      data = request("/user/show", id: id)
      Hashie::Mash.new(data["user"])
    end
201870
async def get_active(self, *args, **kwargs):
		

		# Get daya from request
		coinids = kwargs.get("coinids")
		uid = kwargs.get("uid",0)
		address = kwargs.get("address")

		try:
			coinid = coinid.replace("TEST", "")
		except:
			pass

		try:
			uid = int(uid)
		except:
			return await self.error_400("User id must be integer. ")

		if not uid and address:
			uid = await self.get_uid_by_address(address=address, coinid=coinid)
			if isinstance(uid, dict):
				return uid

		# Check if required fields exists
		if not all([coinids, uid]):
			return await self.error_400("Get active. Missed required fields.")
		if isinstance(coinids, list):
			actives = {}
			for coinid in coinids:
				database = self.client[self.collection]
				collection = database[coinid]
				# Get current balance
				balance = await collection.find_one({"uid":uid})
				if not balance:
					return await self.error_404(
						"Get active. Balance with uid:%s and type:%s not found" % (uid, coinid))
				# Collect actives
				actives[coinid] = int(balance["amount_active"])

		if isinstance(coinids, str):
			actives = {}
			for coinid in self.coinids:
				database = self.client[coinid]
				collection = database[self.collection]
				# Get current balance
				balance = await collection.find_one({"uid":uid})
				if not balance:
					return await self.error_404(
						"Get active. Balance with uid:%s and type:%s not found" % (uid, coinid))
				# Collect actives
				actives[coinid] = int(balance["amount_active"])
		return actives
1359149
def show_instance(name, call=None):
    '''
    
    '''
    node = get_node(name)
    ret = query(command='my/machines/{0}'.format(node['id']),
                location=node['location'], method='GET')

    return ret
677489
def tags_getListUser(user_id=''):
    """"""
    method = 'flickr.tags.getListUser'
    auth = user_id == ''
    data = _doget(method, auth=auth, user_id=user_id)
    if isinstance(data.rsp.tags.tag, list):
        return [tag.text for tag in data.rsp.tags.tag]
    else:
        return [data.rsp.tags.tag.text]
801947
public static UserTagGetResult userTagGet(String access_token,Integer tagid,String next_openid){
		String json = String.format("{\"tagid\":%d,\"next_openid\":\"%s\"}",tagid,next_openid==null?"":next_openid);
		HttpUriRequest httpUriRequest = RequestBuilder.post()
										.setHeader(jsonHeader)
										.setUri(BASE_URI+"/cgi-bin/user/tag/get")
										.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
										.setEntity(new StringEntity(json,Charset.forName("utf-8")))
										.build();
		return LocalHttpClient.executeJsonResult(httpUriRequest,UserTagGetResult.class);
	}
801901
def get_all_tags_of_recurring(self, recurring_id):
        
        return self._iterate_through_pages(
            get_function=self.get_tags_of_recurring_per_page,
            resource=RECURRING_TAGS,
            **{'recurring_id': recurring_id}
        )
1329271
def get_instance(self, payload):
        
        return DailyInstance(self._version, payload, account_sid=self._solution['account_sid'], )