query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Unmute chats (bulk) Unmute several chats by chat ids or unmute all chats. | def unmute_chats_bulk(unmute_chats_bulk_input_object, opts = {})
unmute_chats_bulk_with_http_info(unmute_chats_bulk_input_object, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unmute(*params)\n channels, users = split_params(params)\n\n channels.each do |channel|\n if @channels.include?(channel) && @muted_channels.include?(channel)\n @muted_channels.delete(channel)\n puts \"Unmuted channel #{channel}\"\n end\n end\n\n users.each do |user|\n i... | [
"0.7132132",
"0.7131079",
"0.69021004",
"0.64171827",
"0.61405617",
"0.61050224",
"0.60917324",
"0.6083822",
"0.59027964",
"0.589634",
"0.57480824",
"0.5726357",
"0.56983715",
"0.55992573",
"0.55949235",
"0.55013853",
"0.545051",
"0.54044497",
"0.5375365",
"0.53697544",
"0.53... | 0.7783799 | 0 |
Unmute chats (bulk) Unmute several chats by chat ids or unmute all chats. | def unmute_chats_bulk_with_http_info(unmute_chats_bulk_input_object, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.unmute_chats_bulk ...'
end
# verify the required parameter 'unmute_chats_bulk_input_object' is set
if @api_client.config.client_side_validation && unmute_chats_bulk_input_object.nil?
fail ArgumentError, "Missing the required parameter 'unmute_chats_bulk_input_object' when calling TextMagicApi.unmute_chats_bulk"
end
# resource path
local_var_path = '/api/v2/chats/unmute/bulk'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(unmute_chats_bulk_input_object)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#unmute_chats_bulk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unmute_chats_bulk(unmute_chats_bulk_input_object, opts = {})\n unmute_chats_bulk_with_http_info(unmute_chats_bulk_input_object, opts)\n nil\n end",
"def unmute(*params)\n channels, users = split_params(params)\n\n channels.each do |channel|\n if @channels.include?(channel) && @muted_c... | [
"0.77858883",
"0.71327716",
"0.7131728",
"0.6903139",
"0.64180195",
"0.6141515",
"0.6104699",
"0.6091409",
"0.5903361",
"0.58976865",
"0.57495767",
"0.57272863",
"0.56981814",
"0.55990666",
"0.5596047",
"0.5502392",
"0.54504865",
"0.5404456",
"0.53765917",
"0.53694874",
"0.53... | 0.6084983 | 8 |
Manually unsubscribe a contact > Please note, if you unsubscribe a contact, this action cannot be reversed. | def unsubscribe_contact(unsubscribe_contact_input_object, opts = {})
data, _status_code, _headers = unsubscribe_contact_with_http_info(unsubscribe_contact_input_object, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end",
"def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end",
"def unsubscribe\n end",
"def unsubscribe(email)\n # Raise an error to warn it isn't implemented.\n raise No... | [
"0.7513438",
"0.7413326",
"0.73564136",
"0.7247282",
"0.7235251",
"0.7226486",
"0.7209957",
"0.71051717",
"0.71014524",
"0.7085256",
"0.7066331",
"0.70497864",
"0.70116305",
"0.7001487",
"0.6947677",
"0.6933768",
"0.6927787",
"0.69244015",
"0.69196826",
"0.69183034",
"0.68919... | 0.63905567 | 51 |
Manually unsubscribe a contact > Please note, if you unsubscribe a contact, this action cannot be reversed. | def unsubscribe_contact_with_http_info(unsubscribe_contact_input_object, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.unsubscribe_contact ...'
end
# verify the required parameter 'unsubscribe_contact_input_object' is set
if @api_client.config.client_side_validation && unsubscribe_contact_input_object.nil?
fail ArgumentError, "Missing the required parameter 'unsubscribe_contact_input_object' when calling TextMagicApi.unsubscribe_contact"
end
# resource path
local_var_path = '/api/v2/unsubscribers'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(unsubscribe_contact_input_object)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'ResourceLinkResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#unsubscribe_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end",
"def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end",
"def unsubscribe\n end",
"def unsubscribe(email)\n # Raise an error to warn it isn't implemented.\n raise No... | [
"0.75122195",
"0.7411997",
"0.7356266",
"0.7246409",
"0.7235101",
"0.72258866",
"0.7211131",
"0.71045965",
"0.70998085",
"0.7084869",
"0.70659775",
"0.7048922",
"0.70100874",
"0.70003086",
"0.6946283",
"0.6934352",
"0.6928545",
"0.6923693",
"0.69200486",
"0.6917186",
"0.68905... | 0.63548064 | 56 |
Update balance notification settings | def update_balance_notification_settings(update_balance_notification_settings_input_object, opts = {})
update_balance_notification_settings_with_http_info(update_balance_notification_settings_input_object, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_balance\n if(@transaction.sender)\n @transaction.sender.balance -= @transaction.amount\n @transaction.sender.save\n end\n\n if(@transaction.receiver)\n @transaction.receiver.balance += Monetize.parse(convert(Money.new(@transac... | [
"0.67382586",
"0.65415233",
"0.65158415",
"0.6470524",
"0.6428448",
"0.6423011",
"0.64136684",
"0.64086133",
"0.6194804",
"0.6194369",
"0.6180276",
"0.61581516",
"0.6114005",
"0.60610324",
"0.6016056",
"0.5999219",
"0.59860325",
"0.59795576",
"0.5926202",
"0.59076303",
"0.590... | 0.63153136 | 8 |
Update balance notification settings | def update_balance_notification_settings_with_http_info(update_balance_notification_settings_input_object, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.update_balance_notification_settings ...'
end
# verify the required parameter 'update_balance_notification_settings_input_object' is set
if @api_client.config.client_side_validation && update_balance_notification_settings_input_object.nil?
fail ArgumentError, "Missing the required parameter 'update_balance_notification_settings_input_object' when calling TextMagicApi.update_balance_notification_settings"
end
# resource path
local_var_path = '/api/v2/user/notification/balance'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(update_balance_notification_settings_input_object)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#update_balance_notification_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_balance\n if(@transaction.sender)\n @transaction.sender.balance -= @transaction.amount\n @transaction.sender.save\n end\n\n if(@transaction.receiver)\n @transaction.receiver.balance += Monetize.parse(convert(Money.new(@transac... | [
"0.6733958",
"0.6549094",
"0.65102965",
"0.647895",
"0.6423355",
"0.6420541",
"0.6408277",
"0.64046645",
"0.63194346",
"0.62030977",
"0.6192312",
"0.617532",
"0.6156471",
"0.61113864",
"0.6057236",
"0.6002969",
"0.5982472",
"0.5973841",
"0.59211516",
"0.59136426",
"0.5905263"... | 0.60186905 | 15 |
Update callback URL settings | def update_callback_settings(update_callback_settings_input_object, opts = {})
update_callback_settings_with_http_info(update_callback_settings_input_object, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback_uri=(value)\n @callback_uri = value\n end",
"def callback_url\n options[:callback_url] || (full_host + script_name + callback_path)\n end",
"def callback_url\n options[:callback_url] || (full_host + script_name + callback_path)\n end",
"def callb... | [
"0.6883952",
"0.66529953",
"0.66529953",
"0.66529953",
"0.6616353",
"0.66036546",
"0.6544723",
"0.6498373",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",... | 0.0 | -1 |
Update callback URL settings | def update_callback_settings_with_http_info(update_callback_settings_input_object, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.update_callback_settings ...'
end
# verify the required parameter 'update_callback_settings_input_object' is set
if @api_client.config.client_side_validation && update_callback_settings_input_object.nil?
fail ArgumentError, "Missing the required parameter 'update_callback_settings_input_object' when calling TextMagicApi.update_callback_settings"
end
# resource path
local_var_path = '/api/v2/callback/settings'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(update_callback_settings_input_object)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#update_callback_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback_uri=(value)\n @callback_uri = value\n end",
"def callback_url\n options[:callback_url] || (full_host + script_name + callback_path)\n end",
"def callback_url\n options[:callback_url] || (full_host + script_name + callback_path)\n end",
"def callb... | [
"0.6883952",
"0.66529953",
"0.66529953",
"0.66529953",
"0.6616353",
"0.66036546",
"0.6544723",
"0.6498373",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",
"0.6471706",... | 0.0 | -1 |
Update chat desktop notification settings | def update_chat_desktop_notification_settings(update_chat_desktop_notification_settings_input_object, opts = {})
update_chat_desktop_notification_settings_with_http_info(update_chat_desktop_notification_settings_input_object, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_chat_desktop_notification_settings_with_http_info(update_chat_desktop_notification_settings_input_object, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.update_chat_desktop_notification_settings ...'\n end\n # verify the re... | [
"0.63135374",
"0.6002412",
"0.6002223",
"0.5983237",
"0.59653777",
"0.5915235",
"0.58999115",
"0.5846",
"0.5794145",
"0.57931924",
"0.5787961",
"0.5781925",
"0.57656085",
"0.5762547",
"0.5745738",
"0.57341975",
"0.572337",
"0.56941724",
"0.56842726",
"0.5637475",
"0.56155384"... | 0.728909 | 0 |
Update chat desktop notification settings | def update_chat_desktop_notification_settings_with_http_info(update_chat_desktop_notification_settings_input_object, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.update_chat_desktop_notification_settings ...'
end
# verify the required parameter 'update_chat_desktop_notification_settings_input_object' is set
if @api_client.config.client_side_validation && update_chat_desktop_notification_settings_input_object.nil?
fail ArgumentError, "Missing the required parameter 'update_chat_desktop_notification_settings_input_object' when calling TextMagicApi.update_chat_desktop_notification_settings"
end
# resource path
local_var_path = '/api/v2/user/desktop/notification'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(update_chat_desktop_notification_settings_input_object)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#update_chat_desktop_notification_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_chat_desktop_notification_settings(update_chat_desktop_notification_settings_input_object, opts = {})\n update_chat_desktop_notification_settings_with_http_info(update_chat_desktop_notification_settings_input_object, opts)\n nil\n end",
"def update!(**args)\n @keeps_conversation_... | [
"0.72889626",
"0.6002164",
"0.6001102",
"0.5983593",
"0.5965489",
"0.59144837",
"0.589872",
"0.5842723",
"0.5794857",
"0.5791943",
"0.57868433",
"0.5781087",
"0.5767294",
"0.5762983",
"0.5744512",
"0.57325584",
"0.5720346",
"0.56932074",
"0.5681408",
"0.5635787",
"0.5614523",... | 0.63132656 | 1 |
Update a contact note | def update_contact_note(update_contact_note_input_object, id, opts = {})
data, _status_code, _headers = update_contact_note_with_http_info(update_contact_note_input_object, id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to @note, :notice => 'Contact was successfully updated.' }\n format.json { render :json => @note }\n else\n format.html { render :action =... | [
"0.7536683",
"0.72219664",
"0.71332437",
"0.71052474",
"0.6898626",
"0.68814963",
"0.6849807",
"0.68432415",
"0.6817951",
"0.68102247",
"0.6714033",
"0.6691088",
"0.6674084",
"0.6631261",
"0.660899",
"0.66084677",
"0.6560655",
"0.6552811",
"0.6545872",
"0.65376276",
"0.653762... | 0.0 | -1 |
Update a contact note | def update_contact_note_with_http_info(update_contact_note_input_object, id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.update_contact_note ...'
end
# verify the required parameter 'update_contact_note_input_object' is set
if @api_client.config.client_side_validation && update_contact_note_input_object.nil?
fail ArgumentError, "Missing the required parameter 'update_contact_note_input_object' when calling TextMagicApi.update_contact_note"
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TextMagicApi.update_contact_note"
end
# resource path
local_var_path = '/api/v2/notes/{id}'.sub('{' + 'id' + '}', id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(update_contact_note_input_object)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'ResourceLinkResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#update_contact_note\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to @note, :notice => 'Contact was successfully updated.' }\n format.json { render :json => @note }\n else\n format.html { render :action =... | [
"0.7536683",
"0.72219664",
"0.71332437",
"0.71052474",
"0.6898626",
"0.68814963",
"0.6849807",
"0.68432415",
"0.6817951",
"0.68102247",
"0.6714033",
"0.6691088",
"0.6674084",
"0.6631261",
"0.660899",
"0.66084677",
"0.6560655",
"0.6552811",
"0.6545872",
"0.65376276",
"0.653762... | 0.6255175 | 81 |
Edit current account info | def update_current_user(update_current_user_input_object, opts = {})
data, _status_code, _headers = update_current_user_with_http_info(update_current_user_input_object, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_account\n @user = User.find(current_user.id)\n end",
"def update \n user = User.find_by(username: @current_user.username)\n user.update!(username_edit_params)\n response = { message: Message.account_edited, status: :ok}\n json_response(response)\n end",... | [
"0.782124",
"0.7338895",
"0.73041975",
"0.7252627",
"0.7239831",
"0.71840566",
"0.7181655",
"0.7171737",
"0.7144032",
"0.7090432",
"0.70843416",
"0.7013367",
"0.7003441",
"0.6987066",
"0.6959964",
"0.6934695",
"0.69248253",
"0.68942237",
"0.68922323",
"0.6889767",
"0.6874688"... | 0.0 | -1 |
Edit current account info | def update_current_user_with_http_info(update_current_user_input_object, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.update_current_user ...'
end
# verify the required parameter 'update_current_user_input_object' is set
if @api_client.config.client_side_validation && update_current_user_input_object.nil?
fail ArgumentError, "Missing the required parameter 'update_current_user_input_object' when calling TextMagicApi.update_current_user"
end
# resource path
local_var_path = '/api/v2/user'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(update_current_user_input_object)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'UpdateCurrentUserResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#update_current_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_account\n @user = User.find(current_user.id)\n end",
"def update \n user = User.find_by(username: @current_user.username)\n user.update!(username_edit_params)\n response = { message: Message.account_edited, status: :ok}\n json_response(response)\n end",... | [
"0.78209305",
"0.7337761",
"0.73015517",
"0.72529083",
"0.72394544",
"0.7183544",
"0.7181291",
"0.7172324",
"0.7143611",
"0.70902973",
"0.70836973",
"0.7015302",
"0.7001658",
"0.6985658",
"0.6959851",
"0.693374",
"0.6924274",
"0.68941545",
"0.68921936",
"0.6889858",
"0.687106... | 0.0 | -1 |
Edit a custom field | def update_custom_field(update_custom_field_input_object, id, opts = {})
data, _status_code, _headers = update_custom_field_with_http_info(update_custom_field_input_object, id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_custom_field\n @custom_field = CustomField.find(params[:id])\n end",
"def update\n @custom_field = CustomField.find(params[:id])\n authorize! :update, @custom_field\n \n respond_to do |format|\n if @custom_field.update_attributes(params[:custom_field])\n format.html { redi... | [
"0.7297578",
"0.72834027",
"0.72453356",
"0.7178567",
"0.71568817",
"0.6716903",
"0.6702528",
"0.6629063",
"0.6488994",
"0.6451903",
"0.63923186",
"0.6323896",
"0.6272476",
"0.6243305",
"0.62414575",
"0.6238051",
"0.6221091",
"0.6203557",
"0.6203557",
"0.6203557",
"0.61637163... | 0.0 | -1 |
Edit a custom field | def update_custom_field_with_http_info(update_custom_field_input_object, id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.update_custom_field ...'
end
# verify the required parameter 'update_custom_field_input_object' is set
if @api_client.config.client_side_validation && update_custom_field_input_object.nil?
fail ArgumentError, "Missing the required parameter 'update_custom_field_input_object' when calling TextMagicApi.update_custom_field"
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TextMagicApi.update_custom_field"
end
# resource path
local_var_path = '/api/v2/customfields/{id}'.sub('{' + 'id' + '}', id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(update_custom_field_input_object)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'ResourceLinkResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#update_custom_field\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_custom_field\n @custom_field = CustomField.find(params[:id])\n end",
"def update\n @custom_field = CustomField.find(params[:id])\n authorize! :update, @custom_field\n \n respond_to do |format|\n if @custom_field.update_attributes(params[:custom_field])\n format.html { redi... | [
"0.7297578",
"0.72834027",
"0.72453356",
"0.7178567",
"0.71568817",
"0.6716903",
"0.6702528",
"0.6629063",
"0.6488994",
"0.6451903",
"0.63923186",
"0.6323896",
"0.6272476",
"0.6243305",
"0.62414575",
"0.6238051",
"0.6221091",
"0.6203557",
"0.6203557",
"0.6203557",
"0.61637163... | 0.5753534 | 92 |
Edit the custom field value of a specified contact | def update_custom_field_value(update_custom_field_value_input_object, id, opts = {})
data, _status_code, _headers = update_custom_field_value_with_http_info(update_custom_field_value_input_object, id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_contact\n\n end",
"def contact_field(contact, field_name, label=field_name)\n html=[]\n style=\"edit\"\n html << \"<label>#{label}</label>\"\n val = html_escape(contact.send(field_name))\n if val.blank?\n val = 'Click to edit' \n style << \" subtle-text\"\n ... | [
"0.68844634",
"0.68090224",
"0.665227",
"0.65596324",
"0.65569204",
"0.6491812",
"0.6480223",
"0.6467503",
"0.646702",
"0.6454416",
"0.64517665",
"0.6413088",
"0.63649565",
"0.6344394",
"0.63395745",
"0.62570816",
"0.62487006",
"0.623997",
"0.6233087",
"0.62128305",
"0.618769... | 0.0 | -1 |
Edit the custom field value of a specified contact | def update_custom_field_value_with_http_info(update_custom_field_value_input_object, id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.update_custom_field_value ...'
end
# verify the required parameter 'update_custom_field_value_input_object' is set
if @api_client.config.client_side_validation && update_custom_field_value_input_object.nil?
fail ArgumentError, "Missing the required parameter 'update_custom_field_value_input_object' when calling TextMagicApi.update_custom_field_value"
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TextMagicApi.update_custom_field_value"
end
# resource path
local_var_path = '/api/v2/customfields/{id}/update'.sub('{' + 'id' + '}', id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(update_custom_field_value_input_object)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'ResourceLinkResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#update_custom_field_value\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_contact\n\n end",
"def contact_field(contact, field_name, label=field_name)\n html=[]\n style=\"edit\"\n html << \"<label>#{label}</label>\"\n val = html_escape(contact.send(field_name))\n if val.blank?\n val = 'Click to edit' \n style << \" subtle-text\"\n ... | [
"0.6882351",
"0.6810032",
"0.6653192",
"0.65583235",
"0.6556949",
"0.64941233",
"0.64780605",
"0.646619",
"0.64656985",
"0.6453845",
"0.64505666",
"0.6411353",
"0.6365077",
"0.6343576",
"0.6338006",
"0.6256289",
"0.6247772",
"0.623937",
"0.6235473",
"0.6211453",
"0.6186548",
... | 0.0 | -1 |
Update inbound messages notification settings | def update_inbound_messages_notification_settings(update_inbound_messages_notification_settings_input_object, opts = {})
update_inbound_messages_notification_settings_with_http_info(update_inbound_messages_notification_settings_input_object, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(settings)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'settings', settings)\n\t\t\tclient.queue_service_action_call('notificationspartnersettings', 'update', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def upda... | [
"0.64475447",
"0.6320233",
"0.62739176",
"0.62276727",
"0.6225018",
"0.61756086",
"0.61102706",
"0.5956897",
"0.59415025",
"0.581563",
"0.58070976",
"0.5798183",
"0.5775148",
"0.5767635",
"0.57662475",
"0.5757572",
"0.574932",
"0.5674729",
"0.56736",
"0.56715226",
"0.5670715"... | 0.6978391 | 0 |
Update inbound messages notification settings | def update_inbound_messages_notification_settings_with_http_info(update_inbound_messages_notification_settings_input_object, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.update_inbound_messages_notification_settings ...'
end
# verify the required parameter 'update_inbound_messages_notification_settings_input_object' is set
if @api_client.config.client_side_validation && update_inbound_messages_notification_settings_input_object.nil?
fail ArgumentError, "Missing the required parameter 'update_inbound_messages_notification_settings_input_object' when calling TextMagicApi.update_inbound_messages_notification_settings"
end
# resource path
local_var_path = '/api/v2/user/notification/inbound'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(update_inbound_messages_notification_settings_input_object)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#update_inbound_messages_notification_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_inbound_messages_notification_settings(update_inbound_messages_notification_settings_input_object, opts = {})\n update_inbound_messages_notification_settings_with_http_info(update_inbound_messages_notification_settings_input_object, opts)\n nil\n end",
"def update(settings)\n\t\t\tkparams... | [
"0.6978391",
"0.64475447",
"0.6320233",
"0.62739176",
"0.62276727",
"0.6225018",
"0.61102706",
"0.5956897",
"0.59415025",
"0.581563",
"0.58070976",
"0.5798183",
"0.5775148",
"0.5767635",
"0.57662475",
"0.5757572",
"0.574932",
"0.5674729",
"0.56736",
"0.56715226",
"0.5670715",... | 0.61756086 | 6 |
Add an avatar for a list Add an avatar for a list | def upload_list_avatar(image, id, opts = {})
data, _status_code, _headers = upload_list_avatar_with_http_info(image, id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_avatar\n\n end",
"def show_avatar\n\n end",
"def picture_list\n end",
"def add\n @user = current_user\n unless current_user.user_info.blank? \n current_user.user_info.each do | key , value|\n m = \"#{key}=\"\n unless key.to_str == \"avatar\" \n @user.send( m, c... | [
"0.6220009",
"0.6220009",
"0.6216791",
"0.6109326",
"0.60618657",
"0.6008998",
"0.5956686",
"0.59199613",
"0.5889103",
"0.586304",
"0.5833564",
"0.583222",
"0.58201754",
"0.5804496",
"0.58022344",
"0.5773102",
"0.57651883",
"0.57625663",
"0.5760603",
"0.575615",
"0.57509506",... | 0.54825896 | 54 |
Add an avatar for a list Add an avatar for a list | def upload_list_avatar_with_http_info(image, id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.upload_list_avatar ...'
end
# verify the required parameter 'image' is set
if @api_client.config.client_side_validation && image.nil?
fail ArgumentError, "Missing the required parameter 'image' when calling TextMagicApi.upload_list_avatar"
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TextMagicApi.upload_list_avatar"
end
# resource path
local_var_path = '/api/v2/lists/{id}/avatar'.sub('{' + 'id' + '}', id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
# form parameters
form_params = {}
form_params['image'] = image
# http body (model)
post_body = nil
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'ResourceLinkResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#upload_list_avatar\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def picture_list\n end",
"def show_avatar\n\n end",
"def show_avatar\n\n end",
"def add\n @user = current_user\n unless current_user.user_info.blank? \n current_user.user_info.each do | key , value|\n m = \"#{key}=\"\n unless key.to_str == \"avatar\" \n @user.send( m, c... | [
"0.62173784",
"0.6216476",
"0.6216476",
"0.61085504",
"0.6060266",
"0.60096955",
"0.59539384",
"0.5918159",
"0.58841306",
"0.5859126",
"0.5831373",
"0.5829502",
"0.58161336",
"0.58011985",
"0.5797424",
"0.5768291",
"0.5761546",
"0.57593656",
"0.57569164",
"0.57542217",
"0.574... | 0.5492858 | 47 |
Upload message attachment Upload a new file to insert it as a link. | def upload_message_attachment(file, opts = {})
data, _status_code, _headers = upload_message_attachment_with_http_info(file, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_attachment(safebox, attachment)\n if attachment.guid.nil?\n result = @json_client.upload_file(safebox.upload_url, attachment.file_path || attachment.file, attachment.content_type, attachment.filename)\n attachment.guid = result[\"temporary_document\"][\"document_guid\"]\n ... | [
"0.6926237",
"0.6784934",
"0.6474099",
"0.64252377",
"0.6417924",
"0.64106965",
"0.6380255",
"0.6374528",
"0.6352189",
"0.63198483",
"0.6317874",
"0.6316217",
"0.63130164",
"0.6288811",
"0.6288811",
"0.62778234",
"0.62672704",
"0.6258571",
"0.6249428",
"0.61975265",
"0.618341... | 0.6324746 | 9 |
Upload message attachment Upload a new file to insert it as a link. | def upload_message_attachment_with_http_info(file, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.upload_message_attachment ...'
end
# verify the required parameter 'file' is set
if @api_client.config.client_side_validation && file.nil?
fail ArgumentError, "Missing the required parameter 'file' when calling TextMagicApi.upload_message_attachment"
end
# resource path
local_var_path = '/api/v2/messages/attachment'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
# form parameters
form_params = {}
form_params['file'] = file
# http body (model)
post_body = nil
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'UploadMessageAttachmentResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#upload_message_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_attachment(safebox, attachment)\n if attachment.guid.nil?\n result = @json_client.upload_file(safebox.upload_url, attachment.file_path || attachment.file, attachment.content_type, attachment.filename)\n attachment.guid = result[\"temporary_document\"][\"document_guid\"]\n ... | [
"0.6926237",
"0.6784934",
"0.6474099",
"0.64252377",
"0.6417924",
"0.64106965",
"0.6380255",
"0.6374528",
"0.6352189",
"0.6324746",
"0.63198483",
"0.6317874",
"0.6316217",
"0.63130164",
"0.6288811",
"0.6288811",
"0.62778234",
"0.62672704",
"0.6258571",
"0.6249428",
"0.6197526... | 0.0 | -1 |
Upload message mms attachment Upload a new file to mms. | def upload_message_mms_attachment(file, opts = {})
data, _status_code, _headers = upload_message_mms_attachment_with_http_info(file, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_message_attachment(file, opts = {})\n data, _status_code, _headers = upload_message_attachment_with_http_info(file, opts)\n data\n end",
"def upload_message_mms_attachment_with_http_info(file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Call... | [
"0.66187185",
"0.64520705",
"0.6315095",
"0.63150346",
"0.6245112",
"0.6181962",
"0.6126997",
"0.6125686",
"0.6114746",
"0.5985329",
"0.5901586",
"0.58810836",
"0.5867503",
"0.58512914",
"0.5844432",
"0.58301157",
"0.58226055",
"0.58100426",
"0.58013594",
"0.5794277",
"0.5789... | 0.7162382 | 0 |
Upload message mms attachment Upload a new file to mms. | def upload_message_mms_attachment_with_http_info(file, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TextMagicApi.upload_message_mms_attachment ...'
end
# verify the required parameter 'file' is set
if @api_client.config.client_side_validation && file.nil?
fail ArgumentError, "Missing the required parameter 'file' when calling TextMagicApi.upload_message_mms_attachment"
end
# resource path
local_var_path = '/api/v2/messages/mms/attachment'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
# form parameters
form_params = {}
form_params['file'] = file
# http body (model)
post_body = nil
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'UploadMessageAttachmentResponse')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TextMagicApi#upload_message_mms_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_message_mms_attachment(file, opts = {})\n data, _status_code, _headers = upload_message_mms_attachment_with_http_info(file, opts)\n data\n end",
"def upload_message_attachment(file, opts = {})\n data, _status_code, _headers = upload_message_attachment_with_http_info(file, opts)\n ... | [
"0.71623856",
"0.6618408",
"0.6314927",
"0.631346",
"0.62449545",
"0.6181213",
"0.6126776",
"0.6125712",
"0.61152333",
"0.598484",
"0.590204",
"0.58814275",
"0.58682436",
"0.5851773",
"0.58458734",
"0.58294255",
"0.58217436",
"0.5810152",
"0.5801638",
"0.5793963",
"0.57888854... | 0.6451732 | 2 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.model_mailer.new_record_notification.subject | def request_email_verification(verification)
@verification = verification
mail to: verification.user.email, subject: "Please verify your email address on docloud.co"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def message_subject=(value)\n ... | [
"0.6963529",
"0.68878084",
"0.6857409",
"0.6829948",
"0.6609535",
"0.6590971",
"0.6568683",
"0.65458256",
"0.64841944",
"0.64195925",
"0.6397116",
"0.63221586",
"0.6294036",
"0.62651795",
"0.625842",
"0.62391955",
"0.6239172",
"0.61860853",
"0.6178773",
"0.6160129",
"0.615869... | 0.0 | -1 |
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: Grocery list made of hash keys/values "item" => qty add list item to list set default quantity at least one print the list to the console [can you use one of your other methods here?] output: hashes | def create_list(items)
grocery_list = {}
list_items = items.split(" ")
#best practice...
list_items.each do |item_name|
grocery_list = add_item(grocery_list, item_name)
end
return grocery_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_grocery_list(shopping_items)\n # steps:\n # create an empty hash\n grocery_list = {}\n # add items\n # convert input into separate items\n shopping_items = shopping_items.split\n # add items to hash and set default quantity\n shopping_items.each do |item_name|\n grocery_list[item_name.to_... | [
"0.752049",
"0.73707837",
"0.73491335",
"0.7308052",
"0.7268969",
"0.7267957",
"0.7187283",
"0.7135716",
"0.7109211",
"0.70970356",
"0.7083335",
"0.70695096",
"0.7066911",
"0.70574117",
"0.70460427",
"0.7033539",
"0.7025844",
"0.7018436",
"0.70127386",
"0.70008093",
"0.698011... | 0.0 | -1 |
Method to add an item to a list input: hash, item name, and optional quantity steps:Check if it's already there add new key value pair output: hash | def add_item(grocery_list, item_name, qty = 1)
grocery_list[item_name] = qty
return grocery_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def additem(list, item, number = 1)\n# input: hash, item name and optional quantity\n# steps: push an item into the hash\n list.store(item, number)\nend",
"def add_item(list_name, item, quantity=1)\r\n# input: list, item name, and optional quantity\r\n# steps: add item and its quantity to the hash\r\n list_nam... | [
"0.86212564",
"0.8535055",
"0.8527426",
"0.8153642",
"0.81484187",
"0.8116498",
"0.80861855",
"0.8058992",
"0.79657996",
"0.7962254",
"0.7932172",
"0.79309726",
"0.78794366",
"0.78683853",
"0.78569174",
"0.78567684",
"0.7835159",
"0.78350884",
"0.7787061",
"0.77697974",
"0.77... | 0.0 | -1 |
Method to remove an item from the list input: hash, item name steps: hash.delete(item) output: new hash | def remove_item(grocery_list, item_name)
grocery_list.delete(item_name)
return grocery_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_item(input_hash, item)\n# input: list, item name, and optional quantity\n# steps: use input item to delete key\n input_hash.delete(item)\n# output: hash data structure of key/value pairs\nreturn input_hash\nend",
"def remove_item(list_name, item)\r\n# input: list, item name\r\n# steps: delete item na... | [
"0.88204753",
"0.85525125",
"0.85453844",
"0.84970856",
"0.84947675",
"0.8478226",
"0.84760606",
"0.8474021",
"0.84556335",
"0.8442816",
"0.8442816",
"0.84241647",
"0.8413503",
"0.84002525",
"0.8301385",
"0.8301385",
"0.82657343",
"0.82527566",
"0.82129717",
"0.8168132",
"0.8... | 0.0 | -1 |
Method to update the quantity of an item input: list, item name, new quantity steps: hash[item_name] = new quantity output: updated hash | def update_quantity(grocery_list, item_name, qty = 1)
grocery_list = add_item(grocery_list, item_name, qty)
return grocery_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_quantity(list_name, item, value)\r\n# input: list, item name, new quantity\r\n# steps: find item in the hash and change quantity to new quantity\r\n list_name[item] = value\r\n# output: updated hash with new value for item key\r\n p list_name\r\nend",
"def update_item_quantity(hash_of_items, item, q... | [
"0.84925747",
"0.8381038",
"0.83744854",
"0.83744854",
"0.82997423",
"0.8290247",
"0.8254655",
"0.8241894",
"0.8209136",
"0.8169321",
"0.8167059",
"0.8159536",
"0.8141119",
"0.81378317",
"0.8135064",
"0.81227285",
"0.81227285",
"0.8115697",
"0.8115435",
"0.8098061",
"0.807548... | 0.0 | -1 |
Return the number of matching tags if one of the tag keyvalue pair matches | def get_tag_matches(option_tags, aws_tags)
matches = []
option_tags.each do | option_tag |
# If tag value is a string, do string comparison (with wildcard support)
if option_tag[:value].is_a? String
option_value = option_tag[:value].sub('*','.*')
aws_tags.each do | aws_tag |
if @options[:case_insensitive]
value_pattern = /^#{option_value}$/i
matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)
else
value_pattern = /^#{option_value}$/
matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)
end
end
# if tag value is an array, check if value is in the array
else
if @options[:case_insensitive]
option_values = option_tag[:value].map(&:downcase)
else
option_values = option_tag[:value]
end
aws_tags.each do | aws_tag |
if @options[:case_insensitive]
matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))
else
matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))
end
end
end
end
return matches
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag_match_found(option_tags, aws_tags)\n option_tags.each do | option_tag |\n aws_tags.each do | aws_tag | \n if option_tag[:key].downcase == aws_tag[:key].downcase and option_tag[:value].downcase == aws_tag[:value].downcase\n return true\n end\n end\n end\n\n return false\nend",
"d... | [
"0.6556146",
"0.65471554",
"0.6541362",
"0.65287596",
"0.65027094",
"0.6434493",
"0.6385346",
"0.6334903",
"0.6330625",
"0.62445515",
"0.60600543",
"0.60220444",
"0.60195",
"0.5995271",
"0.59949315",
"0.59555566",
"0.5907644",
"0.58970153",
"0.58970153",
"0.58676004",
"0.5856... | 0.60514545 | 16 |
only called in the seeds or from command line .. 1 app == 1 main user | def upgrade_to_main_user
self.is_main_user = true
self.save
admin_role = Role.find_by_name(USER_ROLE[:admin])
self.add_role_if_not_exists(admin_role )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_app_access(owner, app_name, path)\n router = ::UsrRouter.for(owner)\n\n app = ::OodApp.at(path: router.path_for(app: app_name))\n\n # app doesn't exist or you do not have access:\n raise ActionController::RoutingError.new('Not Found') unless app\n\n\n # run idempotent setup script to ... | [
"0.62463975",
"0.61859006",
"0.61859006",
"0.61859006",
"0.61859006",
"0.61859006",
"0.61859006",
"0.61859006",
"0.61859006",
"0.61859006",
"0.61859006",
"0.6082969",
"0.60180825",
"0.5998727",
"0.5989921",
"0.59857416",
"0.5982662",
"0.5921143",
"0.5883627",
"0.58683395",
"0... | 0.0 | -1 |
=begin ROLE VERIFICATION =end | def has_role?(role_sym)
roles.any? { |r| r.name.underscore.to_sym == role_sym }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role; end",
"def role; end",
"def policy; end",
"def add_role\n person\n end",
"def renewal_eligiblity_determination\n end",
"def role\n @role\n end",
"def role_symbols\n [:admin,:developer,:support_person]\n end",
"def verdi; end",
"def display_role\n ROLE_LIST[self.role]\n... | [
"0.7172878",
"0.7172878",
"0.5867523",
"0.584951",
"0.58261514",
"0.57826555",
"0.57823265",
"0.57686144",
"0.57676667",
"0.5744855",
"0.57401115",
"0.5718675",
"0.5703438",
"0.57014406",
"0.5677802",
"0.56642145",
"0.5647575",
"0.56416965",
"0.5597551",
"0.5594266",
"0.55794... | 0.0 | -1 |
=begin PROJECT MEMBERSHIP =end | def project_membership_for(project)
ProjectMembership.where(:user_id => self.id , :project_id => project.id ).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def projects_member\n \tProject.joins(:members).where(:members => {:user_id => id})\n\tend",
"def index\n @project_members = @project.project_members\n end",
"def projects ; end",
"def project; end",
"def index\n @project = Project.find(current_project_id)\n @members = @project.members\n end"... | [
"0.62124467",
"0.62057495",
"0.61748034",
"0.61278784",
"0.6025442",
"0.6021552",
"0.59758323",
"0.58786726",
"0.5875955",
"0.5874653",
"0.5845053",
"0.581482",
"0.580564",
"0.5741256",
"0.57240665",
"0.57240665",
"0.57240665",
"0.5700339",
"0.5613527",
"0.5611852",
"0.558255... | 0.62438834 | 0 |
=begin JOB REQUEST =end | def active_job_requests
self.job_requests.joins(:project).where( :is_canceled => false, :project => {
:is_finished => false ,
:is_deleted => false
} ).order("deadline_date ASC, is_finished ASC, created_at DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reserve_and_run_one_job; end",
"def queue_job; end",
"def request_job_to_process\n \n response = HTTParty.get(\"#{@host}/api/process/request_job/#{@process_code}.json\", query: {\n api_key: @api_key\n })\n\n job = response[\"job\"]\n #If there is no job waiting, end script\n i... | [
"0.65027785",
"0.6485674",
"0.64671373",
"0.63727015",
"0.628295",
"0.62765837",
"0.6267648",
"0.6159741",
"0.6082108",
"0.60362905",
"0.6034023",
"0.597764",
"0.5957646",
"0.5906027",
"0.589946",
"0.589946",
"0.58719325",
"0.58671755",
"0.58428097",
"0.58428097",
"0.58428097... | 0.0 | -1 |
def invalid_time_to_take_score msg = 'Score cannot be taken until the end of the game' raise msg unless all_frames.length == 10 && final_frame_complete? end | def final_frame_complete?
if roll_final_frame_first_strike? || roll_final_frame_second_strike? ||
final_frame_spare?
current_frame.length == 3
else
current_frame == 2
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_over\n if @frames.length < 10\n raise 'Score cannot be taken until the end of the game.'\n end\n if @frames[9].strike? && @frames.length != 11\n raise 'Game is not yet over, cannot score!'\n end\n end",
"def score_last_frame\n spare_or_open_frame_in_last_frame?\n bonus_rou... | [
"0.7902965",
"0.6617358",
"0.654064",
"0.63981944",
"0.6374263",
"0.6374263",
"0.6319189",
"0.6286971",
"0.6216538",
"0.6181921",
"0.6141619",
"0.61386395",
"0.6131122",
"0.6123979",
"0.6086362",
"0.60656816",
"0.60357785",
"0.6024334",
"0.6007383",
"0.6007383",
"0.6007249",
... | 0.6037027 | 16 |
Use callbacks to share common setup or constraints between actions. | def set_post
@post = Post.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def post_params
params.require(:post).permit(:content, :topic_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Creates ssh username with private key credentials. Jenkins must have sshcredentials plugin installed, to use this functionality. Accepts the following keyword parameters. +scope+:: Scope of the credential. GLOBAL or SYSTEM +id+:: Id of the credential. Will be Generated by Jenkins, if not provided. +description+:: Human readable text, what this credential is used for. +username+:: Ssh username. +private_key+:: Ssh private key, with new lines replaced by \n sequence. +passphrase+:: Passphrase for the private key. Empty string, if not provided. | def create_ssh(private_key:, **args)
json_body = {
'' => '1',
credentials: args.merge(
privateKeySource: {
value: '0',
privateKey: private_key,
'stapler-class' => 'com.cloudbees.jenkins.plugins.sshcredentials.impl.'\
'BasicSSHUserPrivateKey$DirectEntryPrivateKeySource'
},
'$class' => 'com.cloudbees.jenkins.plugins.sshcredentials.impl.'\
'BasicSSHUserPrivateKey'
)
}.to_json
create_("json=#{::CGI.escape json_body}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ssh_credential_for(username)\n ssh_credentials.where(:username => username).first\n end",
"def create_ssh_setup\n command = \"echo 'y\\\\\\n' \\| ssh-keygen -f /tmp/#{@name_args[0]}.key -N \\\"\\\" -P \\\"\\\"\"\n result = run_remote_command(command)\n\n if config[:username].eql? \"r... | [
"0.60690624",
"0.5980166",
"0.58988565",
"0.5835722",
"0.5763333",
"0.5684952",
"0.5663868",
"0.5625332",
"0.55005115",
"0.54970294",
"0.54476094",
"0.5407104",
"0.53998524",
"0.53890866",
"0.53595275",
"0.5353769",
"0.5334406",
"0.5323449",
"0.52999616",
"0.5285604",
"0.5271... | 0.6647675 | 0 |
Creates a secret text credential. Jenkins must have plaincredentials plugin installed, to use this functionality. Accepts hash with the following parameters. +scope+:: Scope of the credential. GLOBAL or SYSTEM +id+:: Id of the credential. Will be Generated by Jenkins, if not provided. +description+:: Human readable text, what this credential is used for. +secret+:: Some secret text. | def create_secret_text(**args)
json_body = {
'' => '3',
credentials: args.merge(
'$class' => 'org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl'
)
}.to_json
create_("json=#{::CGI.escape json_body}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_secret(opts = {})\n data, _status_code, _headers = create_secret_with_http_info(opts)\n data\n end",
"def put_secret(secret)\n command = \"echo '#{secret}' > /etc/chef/encrypted_data_bag_secret; chmod 0600 /etc/chef/encrypted_data_bag_secret\"\n run(command)\n end... | [
"0.62166417",
"0.5792811",
"0.5774405",
"0.5739905",
"0.57234764",
"0.56993526",
"0.5448461",
"0.5427665",
"0.539221",
"0.53901815",
"0.53607863",
"0.5354396",
"0.53503984",
"0.5304188",
"0.5304188",
"0.5282001",
"0.5278356",
"0.5276682",
"0.5271902",
"0.52616554",
"0.5249159... | 0.6758701 | 0 |
Creates a secret file credential. Jenkins must have plaincredentials plugin installed, to use this functionality. Accepts hash with the following parameters. +scope+:: Scope of the credential. GLOBAL or SYSTEM +id+:: Id of the credential. Will be Generated by Jenkins, if not provided. +description+:: Human readable text, what this credential is used for. +filename+:: Name of the file. +content+:: File content. | def create_secret_file(filename:, content:, **args)
body = "--#{BOUNDARY}\r\n"\
"Content-Disposition: form-data; name=\"file0\"; filename=\"#{filename}\"\r\n"\
"Content-Type: application/octet-stream\r\n\r\n"\
"#{content}\r\n"\
"--#{BOUNDARY}\r\n"\
"Content-Disposition: form-data; name=\"json\"\r\n\r\n"\
"#{{
'' => '2',
credentials: args.merge(
'$class' => 'org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl',
'file' => 'file0'
)
}.to_json}"\
"\r\n\r\n--#{BOUNDARY}--\r\n"
create_(body, "multipart/form-data, boundary=#{BOUNDARY}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credentials_file\n dir['credentials']\n end",
"def create_credentials\n FileUtils.mkdir_p(@local_credentials_dir)\n message \"Going to create the credentials.yml in #{@local_credentials_dir}\"\n if e.ask_to_overwrite_local(@local_credentials_file_yml)\n Spinner.return :messa... | [
"0.570389",
"0.55551624",
"0.5514668",
"0.54861754",
"0.5387628",
"0.53830314",
"0.53252465",
"0.5311679",
"0.5299257",
"0.5280092",
"0.5263736",
"0.5241492",
"0.52341443",
"0.51971227",
"0.5165792",
"0.5156606",
"0.51461494",
"0.5113564",
"0.5112878",
"0.50827134",
"0.506357... | 0.6979973 | 0 |
Creates username and password credential. Accepts hash with the following parameters. +scope+:: Scope of the credential. GLOBAL or SYSTEM +id+:: Id of the credential. Will be Generated by Jenkins, if not provided. +description+:: Human readable text, what this credential is used for. +username+:: Username. +password+:: Password in plain text. | def create_username_password(**args)
json_body = {
'' => '0',
credentials: args.merge(
'$class' => 'com.cloudbees.plugins.credentials.impl.'\
'UsernamePasswordCredentialsImpl'
)
}.to_json
create_("json=#{::CGI.escape json_body}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credentials(username, password, digest = false)\n self.username = username\n self.password = password\n self.digest = digest\n end",
"def credentials(username, password, digest = false)\n self.username = username\n self.password = password\n self.digest = digest\n end",
... | [
"0.68366724",
"0.68366724",
"0.6286266",
"0.61997336",
"0.61071193",
"0.6090847",
"0.6067064",
"0.59593356",
"0.59380543",
"0.59351337",
"0.59317005",
"0.5911087",
"0.58955485",
"0.58078295",
"0.5757619",
"0.56776595",
"0.5645276",
"0.56343925",
"0.56330895",
"0.56092685",
"0... | 0.6044932 | 7 |
Returns credential as json. Raises Net::HTTPNotFound, if no such credential +id+:: Credential's id | def credential(id, params={})
path = build_path 'credential', id
::Jenkins2::API::Credential::Proxy.new connection, path, params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_service_credential_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceCredentialApi.show_service_credential ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation... | [
"0.6535639",
"0.6324668",
"0.6295762",
"0.6049382",
"0.6000741",
"0.59451115",
"0.5928509",
"0.5884232",
"0.5785983",
"0.5748019",
"0.57228935",
"0.5717276",
"0.57107514",
"0.5697521",
"0.561063",
"0.561063",
"0.55713654",
"0.55528325",
"0.54952663",
"0.5467798",
"0.54659027"... | 0.6254089 | 3 |
Extract full text from the content using Solr's extract handler. This will extract text from the file | def extract
JSON.parse(fetch)[''].rstrip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content\n PlainTextExtractor.extract_content_from(complete_path)\n end",
"def extract_full_text(filename, uri)\n return unless Hyrax.config.extract_full_text?\n\n Hydra::Derivatives::FullTextExtract.create(filename,\n outputs: [{ url: uri, contain... | [
"0.7270647",
"0.70235354",
"0.6816646",
"0.6648667",
"0.6514269",
"0.6414339",
"0.6378688",
"0.6340436",
"0.6289689",
"0.6238615",
"0.6196504",
"0.614118",
"0.6101817",
"0.6057662",
"0.60530806",
"0.59239316",
"0.5862972",
"0.58539623",
"0.57943004",
"0.57835346",
"0.57524323... | 0.0 | -1 |
send the request to the extract service and return the response if it was successful. TODO: this pulls the whole file into memory. We should stream it from Fedora instead | def fetch
req = Net::HTTP.new(uri.host, uri.port)
req.use_ssl = true if check_for_ssl
resp = req.post(uri.to_s, file_content, request_headers)
raise "Solr Extract service was unsuccessful. '#{uri}' returned code #{resp.code} for #{source_path}\n#{resp.body}" unless resp.code == '200'
file_content.rewind if file_content.respond_to?(:rewind)
if resp.type_params['charset']
resp.body.force_encoding(resp.type_params['charset'])
end
resp.body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call\n @response = connection.get(url)\n if status == 200\n context.file = save!\n else\n context.fail! message: \"Download failed\"\n end\n end",
"def process\n verify_url!\n download_from_url do |downloaded_file|\n if valid_readers_format?\n do... | [
"0.620297",
"0.6105608",
"0.60728854",
"0.5999651",
"0.5906984",
"0.57817024",
"0.57266986",
"0.57133603",
"0.57101053",
"0.57053924",
"0.569034",
"0.568907",
"0.56855994",
"0.56817806",
"0.56716096",
"0.566023",
"0.56560355",
"0.56374156",
"0.5635822",
"0.56120956",
"0.55998... | 0.7563535 | 0 |
This method can be used as a before filter to protect any actions by ensuring the request is transmitting a valid JWT. | def verify_jwt_token
head :unauthorized if request.headers['Authorization'].nil? ||
!AuthToken.valid?(request.headers['Authorization'].split(' ').last)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_request(request)\n @token.authenticate(request)\n end",
"def authorize_request\n unless request.headers['Authorization'].present?\n render json: {message: 'Missing Token'}, status: :unauthorized\n end\n end",
"def verify_jwt_token\n # token = request.headers['HB-User... | [
"0.6974653",
"0.66739917",
"0.64600056",
"0.641112",
"0.6354014",
"0.6326608",
"0.6322767",
"0.6275213",
"0.62734914",
"0.62522364",
"0.62369347",
"0.61908114",
"0.61908114",
"0.6182787",
"0.6172595",
"0.6151201",
"0.61425436",
"0.61327106",
"0.6107404",
"0.60667187",
"0.6062... | 0.635754 | 4 |
scrambles the array of cards (shuffle) | def shuffle
@cards.shuffle!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shuffle\n @cards.shuffle!\n end",
"def shuffle\r\n @cards.shuffle!\r\n end",
"def shuffleCards!()\n\t\t@cards.shuffle!\n\tend",
"def shuffle\n @cards.replace @cards.sort_by {rand}\n end",
"def shuffle\n @cards.shuffle! \n end",
"def shuffle!\n cards.shuffle!\n end",
"def shu... | [
"0.81570756",
"0.81451166",
"0.8093987",
"0.80676746",
"0.8048093",
"0.8040894",
"0.80340135",
"0.8003827",
"0.7877288",
"0.7833823",
"0.78137493",
"0.77548456",
"0.7711458",
"0.7682108",
"0.76817137",
"0.7676967",
"0.76727915",
"0.76727915",
"0.7651439",
"0.7588509",
"0.7572... | 0.810647 | 2 |
puts cards from deck onto "table"; deals them | def putOnTable
# take the 12 cards on top of the deck and deal on "table"
@cardsOnTable = @cards[0..11]
12.times{@cards.shift}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateTable(tableCards, deck)\n\twhile deck.deckSize!=0 && (tableCards.size<12 || findSets(tableCards).size==0)\n\t\ttableCards.push(deck.dealCard!)\n\t\ttableCards.push(deck.dealCard!)\n\t\ttableCards.push(deck.dealCard!)\n\tend\nend",
"def deal\n @events.handle(:deal) do\n 2.times do\n all_a... | [
"0.75387704",
"0.7410605",
"0.73909795",
"0.7358549",
"0.7326226",
"0.69259214",
"0.6925553",
"0.68864965",
"0.6884341",
"0.68833697",
"0.68608356",
"0.6840549",
"0.6831535",
"0.6830785",
"0.6810685",
"0.68027496",
"0.6786861",
"0.67570066",
"0.67489195",
"0.6729858",
"0.6726... | 0.7870343 | 0 |
subtract cards picked by the user from the "table" | def subtractSet(chosenCards)
@cardsOnTable.each { |c|
if c = chosenCards[0]
@cardsOnTable.delete_at(0)
elsif c = chosencards[1]
@cardsOnTable.delete_at(1)
elsif c = chosenCards[2]
@cardsOnTable.delete_at(2)
end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putOnTable\n # take the 12 cards on top of the deck and deal on \"table\"\n @cardsOnTable = @cards[0..11]\n 12.times{@cards.shift}\n end",
"def trump_cards\n @cards.select {|c| c.suit == @trump_suit}\n end",
"def deal_cards(old_deck, num_cards)\n hand = old_deck.sample(num_card... | [
"0.6350296",
"0.6318342",
"0.6102369",
"0.60559064",
"0.60333276",
"0.60214025",
"0.6019718",
"0.60169184",
"0.60064167",
"0.59916955",
"0.5986585",
"0.5926425",
"0.58920825",
"0.588824",
"0.5880091",
"0.5873161",
"0.58491343",
"0.5844423",
"0.5836564",
"0.58282083",
"0.58231... | 0.76083845 | 0 |
replaces the three set cards on the table with three new cards | def replaceThree
# move cards from deck to cardsOnTable
3.times{ |c|
@cardsOnTable.push(@cards.at(c))
}
# subtract 3 cards from deck
3.times{cards.shift}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putOnTable\n # take the 12 cards on top of the deck and deal on \"table\"\n @cardsOnTable = @cards[0..11]\n 12.times{@cards.shift}\n end",
"def updateTable(tableCards, deck)\n\twhile deck.deckSize!=0 && (tableCards.size<12 || findSets(tableCards).size==0)\n\t\ttableCards.push(deck.dea... | [
"0.7521795",
"0.6885771",
"0.63097906",
"0.6209958",
"0.61590016",
"0.6149335",
"0.6128926",
"0.6087851",
"0.60579216",
"0.6031203",
"0.60028625",
"0.59449685",
"0.59013414",
"0.58739525",
"0.58588433",
"0.5848991",
"0.584589",
"0.58397347",
"0.58299094",
"0.5813447",
"0.5811... | 0.816698 | 0 |
GET /sale_types or /sale_types.json | def index
@sale_types = SaleType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def types\n @client.make_request :get, reports_path\n end",
"def alltime_sales(type, product_ids=[], options={})\n accept_types = %w{products products+countries countries countries+products}\n raise ArgumentError, \"Type must be one of TYPE: #{accept_types}\" unless accept_types.include?(type)\... | [
"0.6506691",
"0.6437273",
"0.6389046",
"0.6385791",
"0.63074654",
"0.6293778",
"0.6274261",
"0.6247223",
"0.62158173",
"0.61920696",
"0.6175922",
"0.6169705",
"0.6163034",
"0.61453706",
"0.60952365",
"0.6087388",
"0.6077529",
"0.6067259",
"0.6065327",
"0.6053647",
"0.6044782"... | 0.6873939 | 0 |
GET /sale_types/1 or /sale_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sale_types = SaleType.all\n end",
"def show\n\n @sales_type = SalesType.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sales_type }\n end\n \n end",
"def show\n @os_type = OsType.find(params[:id])\n\n res... | [
"0.67469335",
"0.6428272",
"0.6354281",
"0.63523847",
"0.63442",
"0.63399065",
"0.6336289",
"0.6278028",
"0.6230845",
"0.623001",
"0.6209859",
"0.6183554",
"0.61562634",
"0.6149829",
"0.6128884",
"0.6128884",
"0.611498",
"0.61017597",
"0.60942566",
"0.6091358",
"0.60836405",
... | 0.0 | -1 |
POST /sale_types or /sale_types.json | def create
@sale_type = SaleType.new(sale_type_params)
respond_to do |format|
if @sale_type.save
format.html { redirect_to @sale_type, notice: "Sale type was successfully created." }
format.json { render :show, status: :created, location: @sale_type }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @sale_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sale_type_params\n params.require(:sale_type).permit(:name)\n end",
"def create\n @sales_type = SalesType.new(params[:sales_type])\n\n respond_to do |format|\n if @sales_type.save\n format.html { redirect_to(sales_types_path, :notice => 'Sales type was successfully created.') }\n ... | [
"0.66498834",
"0.6597361",
"0.63876307",
"0.6241136",
"0.6075885",
"0.6069174",
"0.6069174",
"0.6069174",
"0.5966863",
"0.5959298",
"0.5952671",
"0.5952671",
"0.594551",
"0.5940793",
"0.59273505",
"0.58926195",
"0.58855915",
"0.58090323",
"0.5771694",
"0.57623494",
"0.575656"... | 0.7050932 | 0 |
PATCH/PUT /sale_types/1 or /sale_types/1.json | def update
respond_to do |format|
if @sale_type.update(sale_type_params)
format.html { redirect_to @sale_type, notice: "Sale type was successfully updated." }
format.json { render :show, status: :ok, location: @sale_type }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @sale_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @sales_type = SalesType.find(params[:id])\n\n respond_to do |format|\n if @sales_type.update_attributes(params[:sales_type])\n format.html { redirect_to(sales_types_path, :notice => 'Sales type was successfully updated.') }\n format.xml { head :ok }\n else\n forma... | [
"0.6919991",
"0.6606697",
"0.6371228",
"0.62476736",
"0.62463844",
"0.6208023",
"0.62035906",
"0.6196608",
"0.61913174",
"0.61913174",
"0.61907274",
"0.61681056",
"0.61549747",
"0.61500794",
"0.6146838",
"0.613244",
"0.60943204",
"0.60937893",
"0.6088319",
"0.6088319",
"0.608... | 0.74232817 | 0 |
DELETE /sale_types/1 or /sale_types/1.json | def destroy
@sale_type.destroy
respond_to do |format|
format.html { redirect_to sale_types_url, notice: "Sale type was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @sales_type = SalesType.find(params[:id])\n @sales_type.destroy\n\n respond_to do |format|\n format.html { redirect_to({:controller=>\"sales_types\", :action=>\"index\"}) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @os_type = OsType.find(params[:id])\n @os... | [
"0.7177196",
"0.70327616",
"0.6968708",
"0.6826253",
"0.682397",
"0.67674184",
"0.676383",
"0.676383",
"0.67628783",
"0.67601293",
"0.6744132",
"0.67420846",
"0.67400086",
"0.6708341",
"0.6708341",
"0.66681224",
"0.66657764",
"0.66657764",
"0.66510725",
"0.66476476",
"0.66451... | 0.7608435 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_sale_type
@sale_type = SaleType.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def sale_type_params
params.require(:sale_type).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.6949874",
"0.68134874",
"0.6803973",
"0.6796339",
"0.6746466",
"0.67413056",
"0.6527813",
"0.6520603",
"0.64913523",
"0.64299726",
"0.64299726",
"0.64299726",
"0.6399997",
"0.63564914",
"0.63551056",
"0.6347068",
"0.6344981",
"0.63384986",
"0.6325687",
"0.6325687",
"0.6325... | 0.0 | -1 |
GET /cities GET /cities.json | def index
@page_title = 'Cities'
@pagy, @cities = pagy(City.includes(:state).all, items: @per_page)
@number_of_cities = City.all.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cities = City.all\n\n render json: @cities\n end",
"def cities\n cities = CS.cities(params[:id], :GB)\n if cities.blank?\n country = ISO3166::Country.find_country_by_alpha3(params[:id])\n cities = country_cites(country)\n return(render json: { message: I18n.t(:invalid_cou... | [
"0.76548207",
"0.7429503",
"0.73086387",
"0.7288925",
"0.7202862",
"0.7059344",
"0.7000238",
"0.6969",
"0.69465405",
"0.6889809",
"0.6851996",
"0.6785107",
"0.6783002",
"0.6756113",
"0.6723028",
"0.6723028",
"0.6723028",
"0.6723028",
"0.6723028",
"0.66641665",
"0.66181433",
... | 0.58264035 | 78 |
GET /cities/1 GET /cities/1.json | def show
@educations = @city.educations
@number_of_educations = @city.educations.count
@pagy, @educations = pagy(@city.educations, items: 30)
@page_title = @city.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cities = City.all\n\n render json: @cities\n end",
"def index\n @cities = City.where(state_id: params[:id])\n respond_to do |format|\n format.json { render :json => @cities.to_json }\n end\n end",
"def show_cities\n\n @cities = City.where(\"country_id = ?\", params[:count... | [
"0.7298952",
"0.72530884",
"0.7168866",
"0.6876525",
"0.6864428",
"0.6851983",
"0.68275726",
"0.6825104",
"0.6811574",
"0.6811519",
"0.67788744",
"0.6727149",
"0.67045456",
"0.6668797",
"0.6644394",
"0.65875024",
"0.6582801",
"0.6560298",
"0.6514726",
"0.6514726",
"0.6514726"... | 0.0 | -1 |
POST /cities POST /cities.json | def create
@city = City.new(city_params)
respond_to do |format|
if @city.save
format.html { redirect_to @city, notice: 'City was successfully created.' }
format.json { render :show, status: :created, location: @city }
else
@page_title = 'New City'
format.html { render :new }
format.json { render json: @city.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @city = City.new(city_params)\n\n if @city.save\n render json: @city, status: :created, location: @city\n # 'city model was successfully created.'\n else\n render json: @city.errors, status: :unprocessable_entity\n end\n end",
"def create\n @city = City.new(params[:cit... | [
"0.66167533",
"0.66018355",
"0.6576531",
"0.65081626",
"0.65081626",
"0.65081626",
"0.64859545",
"0.64765066",
"0.6455192",
"0.635809",
"0.6290361",
"0.6239976",
"0.6233214",
"0.61711264",
"0.61641276",
"0.6134436",
"0.6130887",
"0.6071737",
"0.60571915",
"0.6006276",
"0.5975... | 0.6382116 | 9 |
PATCH/PUT /cities/1 PATCH/PUT /cities/1.json | def update
respond_to do |format|
if @city.update(city_params)
format.html { redirect_to @city, notice: 'City was successfully updated.' }
format.json { render :show, status: :ok, location: @city }
else
@states = State.all
@page_title = 'Edit City'
format.html { render :edit }
format.json { render json: @city.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n \n if @city.update(:name => city_params[:name].strip, :state_id => city_params[:state_id])\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render acti... | [
"0.6485486",
"0.6436113",
"0.6415445",
"0.6385748",
"0.6384778",
"0.63440883",
"0.62604344",
"0.62316245",
"0.619148",
"0.61545193",
"0.61409116",
"0.61409116",
"0.61409116",
"0.61409116",
"0.61409116",
"0.61403686",
"0.6088547",
"0.6083598",
"0.60394716",
"0.59477276",
"0.59... | 0.62104183 | 8 |
DELETE /cities/1 DELETE /cities/1.json | def destroy
@city.destroy
respond_to do |format|
format.html { redirect_to cities_url, notice: 'City was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @city.destroy\n respond_to do |format|\n format.html { redirect_to cities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @city = City.find(params[:id])\n @city.destroy\n\n respond_to do |format|\n format.html { redirect_to cities_url }\n ... | [
"0.7346429",
"0.7317753",
"0.7267204",
"0.7204148",
"0.71994764",
"0.7051234",
"0.70340216",
"0.7019492",
"0.69471693",
"0.6913666",
"0.6872417",
"0.68462896",
"0.68452054",
"0.6818906",
"0.679811",
"0.67970204",
"0.6791861",
"0.6767723",
"0.6747037",
"0.67384404",
"0.6723905... | 0.7044481 | 10 |
Use callbacks to share common setup or constraints between actions. | def set_city
@city ||= City.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def city_params
params.require(:city).permit(:name, :state_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
TODO: Make references to token type constant everywhere | def inline?
INLINE_CLASS_NAMES.include?(camel_case_type) || type == :TEXT
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_type; end",
"def convert_buffer_to_token(token_type); end",
"def token_type(headers = T.unsafe(nil)); end",
"def scout_token \n\treturn $tokens[$index].type\nend",
"def current_type\n @token_type[@current_tok]\n end",
"def token(content, kind); end",
"def getTokenKind()\n $tokens.at(0)\n... | [
"0.84581697",
"0.7550089",
"0.7537007",
"0.7301405",
"0.72796625",
"0.7273054",
"0.7213114",
"0.7168721",
"0.7163569",
"0.7163569",
"0.7163569",
"0.7163569",
"0.7163569",
"0.7163569",
"0.7014541",
"0.7014541",
"0.696939",
"0.6952368",
"0.6947894",
"0.68680173",
"0.6830532",
... | 0.0 | -1 |
Create a rule Rules define which actions to run when a given event verifies the specified condition. Full list of predicates and other type of expressions can be found at GET /bre/expressions/. Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def create_bre_rule(opts = {})
data, _status_code, _headers = create_bre_rule_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rule(expression, &block)\n case expression\n when Hash\n expression.each do |fact, task|\n fact = define_fact(fact)\n task = define_task(task)\n @rules << Rule.new(fact, &task)\n end\n else\n fact = define_fact(expression)\n @rules << Rule.n... | [
"0.6252926",
"0.60939145",
"0.585964",
"0.5756257",
"0.56442136",
"0.5636846",
"0.5584809",
"0.54575807",
"0.54575807",
"0.5448957",
"0.54384",
"0.53908193",
"0.5372388",
"0.53407955",
"0.5317262",
"0.5317262",
"0.53018075",
"0.5293926",
"0.5290184",
"0.5281746",
"0.5262607",... | 0.0 | -1 |
Create a rule Rules define which actions to run when a given event verifies the specified condition. Full list of predicates and other type of expressions can be found at GET /bre/expressions/. Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def create_bre_rule_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: RuleEngineRulesApi.create_bre_rule ..."
end
# resource path
local_var_path = "/bre/rules"
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'bre_rule'])
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'BreRule')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RuleEngineRulesApi#create_bre_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rule(expression, &block)\n case expression\n when Hash\n expression.each do |fact, task|\n fact = define_fact(fact)\n task = define_task(task)\n @rules << Rule.new(fact, &task)\n end\n else\n fact = define_fact(expression)\n @rules << Rule.n... | [
"0.6251521",
"0.6093659",
"0.58590037",
"0.57546145",
"0.56432045",
"0.56374055",
"0.5583384",
"0.5456319",
"0.5456319",
"0.5449396",
"0.54380643",
"0.53901875",
"0.53716266",
"0.5340813",
"0.53166395",
"0.53166395",
"0.53028196",
"0.52929974",
"0.5290286",
"0.52807885",
"0.5... | 0.0 | -1 |
Delete a rule May fail if there are existing rules against it. Cannot delete core rules. Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def delete_bre_rule(id, opts = {})
delete_bre_rule_with_http_info(id, opts)
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_rule(rule_id)\n request({\n 'Action' => 'DeleteRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new\n })\n end",
"def plugin_rule_delete(rule_id)\n nessus_rest_delete(\"plugin-rules/#{r... | [
"0.7450013",
"0.71755135",
"0.7096774",
"0.68829805",
"0.68812466",
"0.6880127",
"0.6789897",
"0.678838",
"0.6685202",
"0.66305155",
"0.6606749",
"0.65990824",
"0.65479326",
"0.6510384",
"0.6510111",
"0.6508516",
"0.6500621",
"0.6500621",
"0.648585",
"0.64845514",
"0.6481508"... | 0.60229397 | 43 |
Delete a rule May fail if there are existing rules against it. Cannot delete core rules. Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def delete_bre_rule_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: RuleEngineRulesApi.delete_bre_rule ..."
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling RuleEngineRulesApi.delete_bre_rule"
end
# resource path
local_var_path = "/bre/rules/{id}".sub('{' + 'id' + '}', id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RuleEngineRulesApi#delete_bre_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_rule(rule_id)\n request({\n 'Action' => 'DeleteRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new\n })\n end",
"def plugin_rule_delete(rule_id)\n nessus_rest_delete(\"plugin-rules/#{r... | [
"0.7450316",
"0.71762013",
"0.70963204",
"0.6881235",
"0.6881233",
"0.687967",
"0.6789347",
"0.67876625",
"0.66842365",
"0.66298455",
"0.6607012",
"0.65983695",
"0.6546735",
"0.6509758",
"0.65091914",
"0.650756",
"0.6499901",
"0.6499901",
"0.64863145",
"0.64837146",
"0.648073... | 0.5786439 | 70 |
Returns a string representation of the provided expression Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def get_bre_expression_as_string(opts = {})
data, _status_code, _headers = get_bre_expression_as_string_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n str = \"rule(#{self.object_id}): allow roles [\" + @roles.join(',') + \"]\"\n str += \" (only under condition object_id will be retrieved using '#{@object_id}')\" if @cond\n\n str\n end",
"def to_s\n rules.map {|r| r.embed }.join(' | ')\n end",
"def to_s\n @expre... | [
"0.6461643",
"0.596843",
"0.5931704",
"0.59203035",
"0.5886942",
"0.5883809",
"0.5879203",
"0.5845497",
"0.5841365",
"0.57670164",
"0.57670164",
"0.5747242",
"0.57391006",
"0.56942886",
"0.5603615",
"0.5556469",
"0.5527054",
"0.55237854",
"0.5468806",
"0.543001",
"0.53969735"... | 0.0 | -1 |
Returns a string representation of the provided expression Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def get_bre_expression_as_string_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: RuleEngineRulesApi.get_bre_expression_as_string ..."
end
# resource path
local_var_path = "/bre/rules/expression-as-string"
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'expression'])
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'String')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RuleEngineRulesApi#get_bre_expression_as_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n str = \"rule(#{self.object_id}): allow roles [\" + @roles.join(',') + \"]\"\n str += \" (only under condition object_id will be retrieved using '#{@object_id}')\" if @cond\n\n str\n end",
"def to_s\n rules.map {|r| r.embed }.join(' | ')\n end",
"def to_s\n @expre... | [
"0.64601886",
"0.5968616",
"0.59349924",
"0.59210867",
"0.5885231",
"0.58814853",
"0.5880667",
"0.5846357",
"0.58399117",
"0.5767215",
"0.5767215",
"0.574988",
"0.5739588",
"0.5693727",
"0.5603907",
"0.55568385",
"0.5527606",
"0.55259746",
"0.5471008",
"0.5428772",
"0.5400374... | 0.495299 | 66 |
Get a single rule Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def get_bre_rule(id, opts = {})
data, _status_code, _headers = get_bre_rule_with_http_info(id, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simple_get_acc_res_permission(permission)\n unless self.acc_group\n return 0\n end\n right = self.acc_group.acc_group_rights.find(:first, :conditions => \"acc_rights.name = '#{permission}'\", :include => :acc_right) if self.is_accountant? or self.is_reseller?\n if right\n retu... | [
"0.6585816",
"0.6519605",
"0.6409717",
"0.6338396",
"0.6337911",
"0.6193466",
"0.6193466",
"0.6193466",
"0.6193466",
"0.6193466",
"0.61732334",
"0.61428916",
"0.6125339",
"0.609747",
"0.6079814",
"0.60730904",
"0.6069879",
"0.6057168",
"0.5986181",
"0.5939365",
"0.5894979",
... | 0.0 | -1 |
Get a single rule Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def get_bre_rule_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: RuleEngineRulesApi.get_bre_rule ..."
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling RuleEngineRulesApi.get_bre_rule"
end
# resource path
local_var_path = "/bre/rules/{id}".sub('{' + 'id' + '}', id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'BreRule')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RuleEngineRulesApi#get_bre_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simple_get_acc_res_permission(permission)\n unless self.acc_group\n return 0\n end\n right = self.acc_group.acc_group_rights.find(:first, :conditions => \"acc_rights.name = '#{permission}'\", :include => :acc_right) if self.is_accountant? or self.is_reseller?\n if right\n retu... | [
"0.6586423",
"0.6520184",
"0.6410655",
"0.6338942",
"0.63384557",
"0.61934334",
"0.61934334",
"0.61934334",
"0.61934334",
"0.61934334",
"0.61760074",
"0.614245",
"0.612688",
"0.60974765",
"0.6079695",
"0.6075879",
"0.6071732",
"0.6057405",
"0.5984933",
"0.5939381",
"0.5897414... | 0.0 | -1 |
List rules Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def get_bre_rules(opts = {})
data, _status_code, _headers = get_bre_rules_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def get_rules\r\n @rules\r\n end",
"def LIST_RULES\n... | [
"0.68041056",
"0.6535674",
"0.64975166",
"0.6419347",
"0.639062",
"0.639062",
"0.6353051",
"0.6298587",
"0.61952376",
"0.61848366",
"0.61048406",
"0.6081504",
"0.6081504",
"0.605484",
"0.60410684",
"0.60410684",
"0.6034178",
"0.60327303",
"0.59972465",
"0.59972465",
"0.598412... | 0.0 | -1 |
List rules Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def get_bre_rules_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: RuleEngineRulesApi.get_bre_rules ..."
end
# resource path
local_var_path = "/bre/rules"
# query parameters
query_params = {}
query_params[:'filter_name'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?
query_params[:'filter_enabled'] = opts[:'filter_enabled'] if !opts[:'filter_enabled'].nil?
query_params[:'filter_system'] = opts[:'filter_system'] if !opts[:'filter_system'].nil?
query_params[:'filter_trigger'] = opts[:'filter_trigger'] if !opts[:'filter_trigger'].nil?
query_params[:'filter_action'] = opts[:'filter_action'] if !opts[:'filter_action'].nil?
query_params[:'filter_condition'] = opts[:'filter_condition'] if !opts[:'filter_condition'].nil?
query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'PageResourceBreRule')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RuleEngineRulesApi#get_bre_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def get_rules\r\n @rules\r\n end",
"def LIST_RULES\n... | [
"0.68041056",
"0.6535674",
"0.64975166",
"0.6419347",
"0.639062",
"0.639062",
"0.6353051",
"0.6298587",
"0.61952376",
"0.61848366",
"0.61048406",
"0.6081504",
"0.6081504",
"0.605484",
"0.60410684",
"0.60410684",
"0.6034178",
"0.60327303",
"0.59972465",
"0.59972465",
"0.598412... | 0.0 | -1 |
Enable or disable a rule This is helpful for turning off systems rules which cannot be deleted or modified otherwise. Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def set_bre_rule(id, opts = {})
set_bre_rule_with_http_info(id, opts)
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rule\n @rule = Rule.find(params[:id])\n unless @logged_in.update_site?\n @rule.readonly!\n end\n end",
"def location_rule_change_status\n if @rule.enabled == 0\n @rule.enabled = 1; st =_('Rule_enabled')\n else\n @rule.enabled = 0; st = _('Rule_disabled')\n end\n @rule... | [
"0.6441237",
"0.63873684",
"0.620413",
"0.60382926",
"0.601604",
"0.5982222",
"0.5852278",
"0.5781664",
"0.57018375",
"0.5658355",
"0.55457145",
"0.552321",
"0.55224615",
"0.5498731",
"0.54751265",
"0.5452901",
"0.5435259",
"0.5435259",
"0.54339355",
"0.54072595",
"0.54059833... | 0.0 | -1 |
Enable or disable a rule This is helpful for turning off systems rules which cannot be deleted or modified otherwise. Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def set_bre_rule_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: RuleEngineRulesApi.set_bre_rule ..."
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling RuleEngineRulesApi.set_bre_rule"
end
# resource path
local_var_path = "/bre/rules/{id}/enabled".sub('{' + 'id' + '}', id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'enabled'])
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RuleEngineRulesApi#set_bre_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rule\n @rule = Rule.find(params[:id])\n unless @logged_in.update_site?\n @rule.readonly!\n end\n end",
"def location_rule_change_status\n if @rule.enabled == 0\n @rule.enabled = 1; st =_('Rule_enabled')\n else\n @rule.enabled = 0; st = _('Rule_disabled')\n end\n @rule... | [
"0.6441923",
"0.6388075",
"0.62044185",
"0.6038161",
"0.6015424",
"0.5981087",
"0.58534074",
"0.57823646",
"0.570186",
"0.56578165",
"0.5546131",
"0.552399",
"0.552195",
"0.549974",
"0.54763156",
"0.54533494",
"0.54353815",
"0.54353815",
"0.5433902",
"0.54074794",
"0.54070455... | 0.0 | -1 |
Update a rule Cannot update system rules. Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def update_bre_rule(id, opts = {})
data, _status_code, _headers = update_bre_rule_with_http_info(id, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_battle_rule_permission\n #如果规则已被使用,则禁止修改\n brc = @battle_rule.battle_rules_copies.active\n if brc.present?\n flash[:danger] = '战役规则已被使用,不能修改!'\n redirect_to \"/battle_rules\" and return\n end\n end",
"def update_rules\n create_update_rules\n end",
"def update_rule(rule... | [
"0.7372961",
"0.7159215",
"0.6976504",
"0.69144464",
"0.67638737",
"0.67638737",
"0.67123085",
"0.6584087",
"0.6582155",
"0.65630966",
"0.6520525",
"0.645504",
"0.6441872",
"0.64137316",
"0.64119124",
"0.6386717",
"0.63572085",
"0.6347124",
"0.6343753",
"0.6303252",
"0.628343... | 0.54440635 | 100 |
Update a rule Cannot update system rules. Permissions Needed: BRE_RULE_ENGINE_RULES_ADMIN | def update_bre_rule_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: RuleEngineRulesApi.update_bre_rule ..."
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling RuleEngineRulesApi.update_bre_rule"
end
# resource path
local_var_path = "/bre/rules/{id}".sub('{' + 'id' + '}', id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'bre_rule'])
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'BreRule')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RuleEngineRulesApi#update_bre_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_battle_rule_permission\n #如果规则已被使用,则禁止修改\n brc = @battle_rule.battle_rules_copies.active\n if brc.present?\n flash[:danger] = '战役规则已被使用,不能修改!'\n redirect_to \"/battle_rules\" and return\n end\n end",
"def update_rules\n create_update_rules\n end",
"def update_rule(rule... | [
"0.73735535",
"0.71589786",
"0.6976015",
"0.6913913",
"0.67634636",
"0.67634636",
"0.67116904",
"0.65824205",
"0.6580047",
"0.6561038",
"0.6518974",
"0.6453439",
"0.644167",
"0.64119685",
"0.6410149",
"0.63866335",
"0.63571614",
"0.634521",
"0.63427556",
"0.6302452",
"0.62822... | 0.0 | -1 |
Returns unauthorized unless running in test mode or the authenticated user is an ASF Committer | def call(env)
authorized = ( ENV['RACK_ENV'] == 'test' )
# Must always call decode as it adds required accessors
person = ASF::Auth.decode(env)
authorized ||= person.asf_committer?
if authorized
@app.call(env)
else
unauthorized
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_author\n redirect_to '/login' unless self.user_access > 1 || current_user.access == 3\n end",
"def access_robot\n raise 'unauthorised' if current_user != @robot.user \n end",
"def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either... | [
"0.637237",
"0.63446116",
"0.6326177",
"0.6326177",
"0.6310912",
"0.6290463",
"0.6268028",
"0.6262969",
"0.62616444",
"0.6243428",
"0.62365055",
"0.62345856",
"0.6227054",
"0.619982",
"0.6195088",
"0.61816126",
"0.61709845",
"0.6169162",
"0.61390465",
"0.61381006",
"0.6112215... | 0.6375893 | 0 |
Returns unauthorized unless running in test mode or the authenticated user is an ASF Member, a PMC Chair, or if a block is specified on the new call, and that block returns a true value. Block is used by the board agenda to allow invited guests to see the agenda. | def call(env)
authorized = ( ENV['RACK_ENV'] == 'test' )
person = ASF::Auth.decode(env)
authorized ||= person.asf_chair_or_member?
authorized ||= @block.call(env) if @block
if authorized
@app.call(env)
else
unauthorized
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_block?(user)\n active? && (approved? || (pending? && self.friend == user))\n end",
"def can_unblock?(user)\n blocked? && self.blocker == user\n end",
"def blocked?\n (status == ConfigCenter::User::BLOCKED)\n end",
"def block?(other_user)\n blocks_user.includ... | [
"0.64216083",
"0.62105846",
"0.6072742",
"0.60215116",
"0.5946899",
"0.59297204",
"0.59297204",
"0.5913994",
"0.58807045",
"0.5845147",
"0.57944226",
"0.5772463",
"0.5754888",
"0.57203746",
"0.5687594",
"0.5652091",
"0.5638385",
"0.563545",
"0.56279564",
"0.5617902",
"0.55945... | 0.0 | -1 |
Define the frequency with which GC should be run (as in every 'n' requests), and the maximum number of idle minutes between GC runs. This class also will make use of PhusionPassenger's out of band GC, if available. | def initialize(app, frequency=100, minutes=15)
@app = app
@frequency = frequency
@request_count = 0
@queue = Queue.new
@mutex = Mutex.new
if defined?(PhusionPassenger)
# https://github.com/suyccom/yousell/blob/master/config.ru
# https://www.phusionpassenger.com/library/indepth/ruby/out_of_band_work.html
if PhusionPassenger.respond_to?(:require_passenger_lib)
PhusionPassenger.require_passenger_lib 'rack/out_of_band_gc'
else
# Phusion Passenger < 4.0.33
require 'phusion_passenger/rack/out_of_band_gc'
end
@passenger = PhusionPassenger::Rack::OutOfBandGc.new(app, frequency)
end
Thread.kill(@@background) if @@background
if minutes
# divide minutes by frequency and use the result to determine the
# time between simulated requests
@@background = Thread.new do
seconds = minutes * 60.0 / frequency
loop do
sleep seconds
maybe_perform_gc
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gc_every_n_examples=(n)\n if(defined?(JRuby))\n warn \"Ignoring gc_every_n_examples because JRuby doesn't support GC control.\"\n return\n end\n if(!GC.respond_to?(:count))\n warn \"Ignoring gc_every_n_examples because this Ruby implementation doesn't implement G... | [
"0.6105185",
"0.60598457",
"0.6028152",
"0.5828076",
"0.5764472",
"0.5702333",
"0.56019884",
"0.558762",
"0.55468565",
"0.55221844",
"0.5517417",
"0.54635245",
"0.5462218",
"0.5462218",
"0.5444275",
"0.5439505",
"0.5436583",
"0.54276395",
"0.54010844",
"0.5390084",
"0.5345033... | 0.6952157 | 0 |
Rack middleware used to push an object onto the queue prior to the request (this stops AutoGC from running during the request), and popping it afterward the request completes. Also will spin off a thread to run GC after the reply completes (using rack.after_reply if available), otherwise using a standard Thread. | def call(env)
@queue.push 1
if @passenger
@passenger.call(env)
else
# https://github.com/puma/puma/issues/450
status, header, body = @app.call(env)
if (ary = env['rack.after_reply']) # this is intended to be assignment, see #108
ary << lambda {maybe_perform_gc}
else
Thread.new {sleep 0.1; maybe_perform_gc}
end
[status, header, body]
end
ensure
@queue.pop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_front(request)\n request.hydra = self\n queued_requests.unshift request\n end",
"def handle(obj)\n request = Request.new(obj)\n @mutex.synchronize do\n @requests_queue.push(request)\n @cv.wait(@mutex) until request.re?\n request.re\n end\n end",
"def store_... | [
"0.63265085",
"0.6292942",
"0.5845886",
"0.5701893",
"0.5683307",
"0.5608534",
"0.55191934",
"0.5479543",
"0.54609054",
"0.5381242",
"0.5381242",
"0.5354042",
"0.5346535",
"0.53408164",
"0.5305497",
"0.53002095",
"0.52724797",
"0.5272069",
"0.5248474",
"0.52333313",
"0.523333... | 0.6512412 | 0 |
strip gzip from the IfNoneMatch HTTP header. | def call(env)
if env['HTTP_IF_NONE_MATCH']
env['HTTP_IF_NONE_MATCH'] =
env['HTTP_IF_NONE_MATCH'].sub(/-gzip"$/, '"')
end
return @app.call(env)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip_http_headers; end",
"def strip_storehouse_headers(response)\n response[1].except!('X-Storehouse-Distribute', 'X-Storehouse', 'X-Storehouse-Expires-At')\n response\n end",
"def skip_http_headers=(_arg0); end",
"def strip_headers\n %w(return-receipt-to domainkey-signature dkim-sign... | [
"0.59814656",
"0.5842759",
"0.5824742",
"0.5776508",
"0.55611753",
"0.5556824",
"0.5464936",
"0.53425777",
"0.5162861",
"0.5060253",
"0.505856",
"0.5057068",
"0.50535387",
"0.5021007",
"0.50119555",
"0.49947718",
"0.49324656",
"0.4882684",
"0.4852373",
"0.48473814",
"0.482157... | 0.48111042 | 22 |
compute the document root by stripping the PASSENGER_BASE_URI from the the current working directory. | def call(env)
if ENV['PASSENGER_BASE_URI'] and not ENV['DOCUMENT_ROOT']
base = Dir.pwd
if base.end_with? ENV['PASSENGER_BASE_URI']
base = base[0...-ENV['PASSENGER_BASE_URI'].length]
end
ENV['DOCUMENT_ROOT'] = base
end
return @app.call(env)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document_root\n return @document_root\n end",
"def document_root\n end",
"def root\n @root ||= Pathname.new(\"#{__dir__}/../../../..\").cleanpath\n end",
"def path_root\n base_uri ? base_uri : path_to( '/' )\n end",
"def construct_document_root\n return Dir.pwd + \"/public\"\n ... | [
"0.7094331",
"0.6956426",
"0.6890349",
"0.68658525",
"0.6798084",
"0.679645",
"0.67867327",
"0.6770115",
"0.6766115",
"0.6714358",
"0.67100817",
"0.6698767",
"0.66699505",
"0.6667619",
"0.6657011",
"0.6654438",
"0.6654438",
"0.6615691",
"0.6582745",
"0.65756154",
"0.65704364"... | 0.63126516 | 54 |
if HTTPS is set in the environment, rewrite the SCRIPT_URI and SERVER_PORT; and strip index.html from the PATH_INFO and SCRIPT_URI. | def call(env)
if env['HTTPS'] == 'on'
env['SCRIPT_URI'].sub!(/^http:/, 'https:')
env['SERVER_PORT'] = '443'
# for reasons I don't understand, Passenger on whimsy doesn't
# forward root directory requests directly, so as a workaround
# these requests are rewritten and the following code maps
# the requests back:
if env['PATH_INFO'] == '/index.html'
env['PATH_INFO'] = '/'
env['SCRIPT_URI'] += '/'
end
end
return @app.call(env)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rewrite_env(env)\n request = Rack::Request.new(env)\n\n if request.path =~ %r{^\\/imports\\/.*}\n # example of a remote host with a lab framework version\n # http://lab.dev.concord.org/version/2666763/\n\n # set the remote host\n env['HTTP_HOST'] = \"#{remote_host}:#{remote_port}\"\n ... | [
"0.5945021",
"0.5930469",
"0.57882875",
"0.5782636",
"0.575318",
"0.57426614",
"0.5740312",
"0.5725165",
"0.5674361",
"0.56274617",
"0.5593895",
"0.5572077",
"0.55286133",
"0.5501195",
"0.54737735",
"0.54670984",
"0.54523486",
"0.54399806",
"0.54052037",
"0.5377094",
"0.53725... | 0.69294304 | 0 |
flake_denied_prefix returns the prefix to be used for the flake info comment for a particular job | def flake_denied_prefix(repo, job)
"The #{Properties['repo_to_product'][repo]} #{job} job could not be run again for this pull request."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_flake_comment(prefix, flake_config, team_ids)\n flake_label = flake_config['label']\n flake_repo = flake_config['repo']\n org_repo = \"#{Properties['github_user']}/#{flake_repo}\"\n flake_label_query = CGI.escape(\"label:#{flake_label}\")\n issue_link = \"https://github.com/#{or... | [
"0.57065415",
"0.5539765",
"0.5362376",
"0.5296141",
"0.52624065",
"0.52536756",
"0.5246777",
"0.51903427",
"0.5183945",
"0.51680416",
"0.51575214",
"0.51373684",
"0.5062537",
"0.5062537",
"0.5008397",
"0.5008397",
"0.5008397",
"0.5008397",
"0.5008397",
"0.5008397",
"0.500839... | 0.8065487 | 0 |
Helper function to create appropriate regex for matching/extracting :build_url field from bot comment | def build_url_field_regex
if Properties && Properties['jenkins_url']
/ \((#{Regexp::escape(Properties['jenkins_url'])}[^)]+)\)/
else
# Use this test to set the build url matching pattern
if ENV['BUILD_URL']
# Don't set build_url directly from the env var, since we want
# to make sure they match
/ \((#{Regexp::escape(ENV['BUILD_URL'])})\)/
else
/ \((https?:[^)]+)\)/
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_url\n URI.extract(comment, %w[http https])[0]\n end",
"def extract_bot_comment_fields(bot_comment_body, settings=nil)\n test_prefix = extract_test_prefix(bot_comment_body, settings)\n content = nil\n build_url = nil\n base_commit = nil\n extended_tests = nil\n state = nil\n build_url_p... | [
"0.61116976",
"0.6050132",
"0.58697206",
"0.5622831",
"0.56117344",
"0.56117344",
"0.55781454",
"0.55182785",
"0.5503246",
"0.54954576",
"0.54844165",
"0.54379344",
"0.540567",
"0.540567",
"0.53400767",
"0.53394854",
"0.5326634",
"0.5324973",
"0.51664203",
"0.5164277",
"0.515... | 0.68409556 | 0 |
Helper function to pull the test prefix from the settings object or try to determine it from the provided bot_comment_body | def extract_test_prefix(bot_comment_body, settings=nil)
test_prefix = nil
if settings
test_prefix = settings['test_prefix']
else
if Properties && Properties['settings']
Properties['settings'].values.each do |test_settings|
if test_settings['test_prefix'] && bot_comment_body.start_with?(test_settings['test_prefix'])
# In case a valid test prefix happens to be a substring of another
if test_prefix.nil? || (test_prefix && test_settings['test_prefix'].start_with?(test_prefix))
test_prefix = test_settings['test_prefix']
end
end
end
end
if !test_prefix
# Do our best to find the prefix since we don't know it beforehand
if bot_comment_body =~ /^([^:(]+:) /
test_prefix = $1.strip
elsif bot_comment_body =~ /^([^ (]+) /
test_prefix = $1.strip
end
end
end
test_prefix
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_bot_comment_fields(bot_comment_body, settings=nil)\n test_prefix = extract_test_prefix(bot_comment_body, settings)\n content = nil\n build_url = nil\n base_commit = nil\n extended_tests = nil\n state = nil\n build_url_pattern = build_url_field_regex\n # Do our best to find the content (aka stat... | [
"0.63342136",
"0.57434124",
"0.56521523",
"0.55927515",
"0.52534074",
"0.51400006",
"0.51185834",
"0.5077393",
"0.49968824",
"0.4879415",
"0.48382804",
"0.48098743",
"0.47916752",
"0.47613922",
"0.47474268",
"0.47452372",
"0.4714698",
"0.4698543",
"0.4680922",
"0.46453544",
"... | 0.8771788 | 0 |
Pulls out as much metadata from the bot comment as it can, including state (AKA content), Jenkins build URL, base repo commit ID, and the extended tests metadata | def extract_bot_comment_fields(bot_comment_body, settings=nil)
test_prefix = extract_test_prefix(bot_comment_body, settings)
content = nil
build_url = nil
base_commit = nil
extended_tests = nil
state = nil
build_url_pattern = build_url_field_regex
# Do our best to find the content (aka state) even if there aren't metadata in parens after it
if test_prefix && bot_comment_body =~ /^#{Regexp::escape(test_prefix)} ([^(]+) ?\(?/
content = $1.strip
# Find the state matching the start of the content string
state = CONTENT_TO_STATE.find { |k,v| content.start_with? k }[1]
end
if content.nil?
if settings.nil?
raise "Could not parse bot comment: '#{bot_comment_body}'"
end
raise "'#{settings['name']}' pull request not found"
end
build_url = bot_comment_body[build_url_pattern, 1]
base_commit = bot_comment_body[/ \(Base Commit: ([a-f0-9]{40})\)/, 1]
extended_tests = bot_comment_body[/ (\(Extended Tests: .+)/, 1]
return {
:prefix => test_prefix,
:content => content,
:build_url => build_url,
:base_commit => base_commit,
:extended_tests => extended_tests,
:state => state
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_meta_comment \n send_cmd(\"get_meta_comment\")\n end",
"def extractMetadata()\n Logging.LogScriptInfo \"Extract metadata from #{@logFile}...\"\n\n # Get the meta datas from the json report\n metas = { }\n metas['build_date'] = @jsonData['build_date']\n metas['build_time'] = @jsonData['... | [
"0.6040567",
"0.578792",
"0.5611091",
"0.5597029",
"0.55922675",
"0.55784094",
"0.5523473",
"0.5481338",
"0.54249936",
"0.54169875",
"0.5367198",
"0.535952",
"0.535952",
"0.5359146",
"0.5285003",
"0.5281926",
"0.52717686",
"0.5271381",
"0.5234234",
"0.5224696",
"0.5221936",
... | 0.72822064 | 0 |
Helper to abstract complex waiting state check | def waiting_state?(state)
[:wait_in_queue, :wait_queue_pos, :wait_stable_build].include? state
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def waiting?\n @status[:description] == :wait\n end",
"def waiting; end",
"def waiting; end",
"def waitingsecond?\n state_name == \"waitingsecond\"\n end",
"def waiting_in_queue_state?(state)\n [:wait_in_queue, :wait_queue_pos].include? state\nend",
"def waiting?\n !checked_in?\n end",
... | [
"0.72975236",
"0.7153424",
"0.7153424",
"0.7095634",
"0.70735455",
"0.70406294",
"0.7010487",
"0.69788504",
"0.690036",
"0.6833685",
"0.6814907",
"0.66882855",
"0.66804403",
"0.6678775",
"0.6649652",
"0.66470706",
"0.66361487",
"0.6634081",
"0.66235065",
"0.66231185",
"0.6623... | 0.7870765 | 0 |
Helper to precisely abstract queuespecific waiting state check | def waiting_in_queue_state?(state)
[:wait_in_queue, :wait_queue_pos].include? state
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def waiting_state?(state)\n [:wait_in_queue, :wait_queue_pos, :wait_stable_build].include? state\nend",
"def waiting?\n @status[:description] == :wait\n end",
"def waiting?\n @waiting\n end",
"def waiting?\n @waiting\n end",
"def waiting? #:nodoc:\n false|@waiting\n end",
... | [
"0.82269037",
"0.69994736",
"0.68158287",
"0.6804705",
"0.6655843",
"0.66557556",
"0.65790004",
"0.65472907",
"0.65472907",
"0.6518608",
"0.6518608",
"0.65019196",
"0.6495713",
"0.6490054",
"0.64794934",
"0.64611447",
"0.6456125",
"0.6436864",
"0.64062643",
"0.6373663",
"0.63... | 0.8578836 | 0 |
Bot comment field composition helper | def waiting_for_stable_build_comment_segment(branch, settings)
"#{CONTENT_WAITING_STABLE_BUILD} '#{branch_settings(branch, settings)['downstream_job_name']}'"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compose_bot_comment(prefix, comment_data={})\n # Derive comment data content from state, if needed\n if comment_data[:state] && (comment_data[:content].nil? ||\n # Don't overwrite the content if it matches the state already\n !comment_data[:content].s... | [
"0.6409536",
"0.60181",
"0.6000034",
"0.58739394",
"0.5865607",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0.5815524",
"0... | 0.0 | -1 |
Bot comment field composition helper | def waiting_in_queue_comment_segment(branch_name)
"#{CONTENT_WAITING_IN_QUEUE} #{branch_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compose_bot_comment(prefix, comment_data={})\n # Derive comment data content from state, if needed\n if comment_data[:state] && (comment_data[:content].nil? ||\n # Don't overwrite the content if it matches the state already\n !comment_data[:content].s... | [
"0.6409303",
"0.602003",
"0.60015094",
"0.58745456",
"0.58673626",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"0.581707",
"... | 0.0 | -1 |
Constructs a "standard" format bot comment from the provided test settings prefix, comment, and metadata. Uses BOT_COMMENT_FIELDS to map field keys to field prefixes in the comment string | def compose_bot_comment(prefix, comment_data={})
# Derive comment data content from state, if needed
if comment_data[:state] && (comment_data[:content].nil? ||
# Don't overwrite the content if it matches the state already
!comment_data[:content].start_with?(STATE_TO_CONTENT[comment_data[:state]]))
comment_data[:content] = STATE_TO_CONTENT[comment_data[:state]]
end
updated_comment = "#{prefix} #{comment_data[:content]}"
BOT_COMMENT_FIELDS.each do |field_key, field_prefix|
if comment_data[field_key] && (!comment_data[field_key].empty?)
field_data = comment_data[field_key]
updated_comment += if field_data.start_with? '('
" #{field_data}"
else
if field_key == :build_url
" (#{field_data})"
else
" (#{field_prefix} #{field_data})"
end
end
end
end
updated_comment
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_comment string_data\n if is_multiline string_data\n build_multiline_comment string_data\n else\n build_singleline_comment string_data\n end\n end",
"def extract_bot_comment_fields(bot_comment_body, settings=nil)\n test_prefix = extract_test_prefix(bot_comment_body, sett... | [
"0.6374409",
"0.63161486",
"0.6100111",
"0.5836524",
"0.5794107",
"0.5794107",
"0.566276",
"0.5568552",
"0.55482095",
"0.55397916",
"0.54882324",
"0.54882324",
"0.54882324",
"0.54882324",
"0.5474414",
"0.5461972",
"0.54176503",
"0.5404404",
"0.5383738",
"0.5291022",
"0.528210... | 0.7357124 | 0 |
is_mergeable? is a more stable way of determining if a pull request is mergeable than probing the pull request object as `pull_request["mergeable"]`. It seems like our first request for the mergeable status may trigger a recalculation, so if that is the case, we will retry the request a couple of times to get the correct status The GitHub API will return one of three states for pull_request[mergeable]: true, if the pull request has been evaluated and found not to have merge conflicts false, if the pull request has been evaluated and found to have merge conflicts null, if the pull request has not yet been evaluated and the status is unknown In the third case, we will defer to the pull_request[mergeable_state], which gives a further breakdown of states to determine if we will be testing this pull request. We try three times and exit early if we get a positive result as we would like to err on the side of running a test (and it quickly failing due to merge conflicts) rather than not running a set of tests on a valid pull request. | def is_mergeable?(id, repo, num_tries=3)
(1..num_tries).each do |i|
pull_request = get_pull_request(id, repo, num_tries)
mergeable = pull_request['mergeable']
# Mergeable has become unreliable. Resort to mergeable state for now if nil.
# TODO: Re-evaluate this at a later date
if mergeable.nil?
case pull_request['mergeable_state']
when 'checking', 'dirty', 'unstable'
mergeable = false
when 'unknown', 'clean', 'stable'
mergeable = !pull_request['merged']
end
end
return true if mergeable
sleep SLEEP_TIME if i > 1 && i < num_tries
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ok_to_merge?(pull_request, data)\n pull_request.mergeable?\n # status_ok?(pull_request) &&\n # required_users_ok?(pull_request, data) &&\n # score_ok?(pull_request)\n end",
"def mergeable?\n pr_json.attrs[:mergeable_state] == 'clean' && github.pr_json.attrs[:mergeable]\n en... | [
"0.8100986",
"0.7295645",
"0.69760513",
"0.6964352",
"0.67890066",
"0.674101",
"0.66875196",
"0.6594768",
"0.65908307",
"0.64846754",
"0.6405755",
"0.6358625",
"0.63520133",
"0.63520133",
"0.61928743",
"0.6093296",
"0.6060717",
"0.59518903",
"0.5927256",
"0.5896247",
"0.58573... | 0.7966356 | 1 |
last_commit_for_pull_id returns the most recent commit in the branch the pull request originates from | def last_commit_for_pull_id(id, repo, num_tries=3)
commits = nil
if $commits[repo]
commits = $commits[repo][id]
else
$commits[repo] = {}
end
unless commits
(1..num_tries).each do |i|
res = get "#{GITHUB_API_BASE_URL}/repos/#{Properties['github_user']}/#{repo}/pulls/%s/commits?per_page=100" % id
if res.success?
commits = res.data
$commits[repo][id] = commits
break
elsif i == num_tries
res.error!
end
end
end
commits.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_commit\n\tresp = github_api(\"commits\")\n\tresp[0]\nend",
"def last_commited_commit\n get_all_commits_in_repo.first\n end",
"def get_commits(pull_req_id)\n do_request(\"https://api.github.com/repos/#{CONFIG[\"repo\"][\"org\"]}/#{CONFIG[\"repo\"][\"repo\"]}/pulls/#{pull_req_id}/commits\", t... | [
"0.7413704",
"0.71718526",
"0.6944143",
"0.6935682",
"0.68247783",
"0.66902584",
"0.6659573",
"0.6637536",
"0.6551022",
"0.6546382",
"0.6483578",
"0.64792025",
"0.6401375",
"0.6376618",
"0.62095976",
"0.6172303",
"0.6137609",
"0.6113869",
"0.6103242",
"0.60812885",
"0.6071794... | 0.8219147 | 0 |
user_trusted? determines if the user is part of a trusted team in the repository | def user_trusted?(login, repo, settings)
user_in_group?(login, repo, settings, 'repo_to_teams')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_potential_user?\n\t\ttrue\n\tend",
"def secure?\n user\n end",
"def is_managed_by?(user)\n user&.person&.is_project_administrator_of_any_project? || user&.person&.is_programme_administrator_of_any_programme?\n end",
"def can_user_access?(user)\n if user.is_account_holder_or_administrator? |... | [
"0.6732021",
"0.66330564",
"0.65165555",
"0.65136385",
"0.64743984",
"0.6463503",
"0.6429567",
"0.642395",
"0.6414026",
"0.6411369",
"0.6404929",
"0.63415223",
"0.63276595",
"0.632672",
"0.6314539",
"0.6304026",
"0.62964094",
"0.6272254",
"0.6227152",
"0.62226474",
"0.6206725... | 0.8072372 | 0 |
user_admin? determines if the user is part of a administrative team in the repository | def user_admin?(login, repo, settings)
user_in_group?(login, repo, settings, 'repo_to_admin_teams')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def demoting_admin?(team_user)\n team_user.user&.admin? && new_role != \"owner\"\n end",
"def is_admin?(user)\n user.admin > 0\n end",
"def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end",
"def admin?(user)\n user.role_names.include?('cmsadmin')\n end",
"def ad... | [
"0.8224429",
"0.7918802",
"0.7666307",
"0.76546407",
"0.7623141",
"0.75962186",
"0.7574645",
"0.754595",
"0.754537",
"0.7541833",
"0.75402594",
"0.7538174",
"0.75298935",
"0.7511707",
"0.7507075",
"0.74913263",
"0.7490166",
"0.7486418",
"0.74724585",
"0.74694264",
"0.7467596"... | 0.8389005 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.