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 |
|---|---|---|---|---|---|---|
to prevent code injection: system is a dangerous call | def raise_single_quote_error
raise ArgumentError, "Single quotes are not allowed in filenames here."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safe_system *args\n Kernel.system *args\nend",
"def system=(_arg0); end",
"def _unsafe_system(command)\n\n ### ###\n ### XXX - SECURITY ###\n ### ###\n\n if command =~ /(\\||\\;|\\`)/\n #raise \"Illegal character\"\n _log_error \"FATAL Illegal char... | [
"0.7231649",
"0.6908195",
"0.6856311",
"0.68365335",
"0.68365335",
"0.66729546",
"0.634052",
"0.6214964",
"0.62003624",
"0.61936694",
"0.61936694",
"0.5998577",
"0.5985371",
"0.59819937",
"0.5947401",
"0.5928928",
"0.59255475",
"0.58995926",
"0.5882401",
"0.5874585",
"0.58694... | 0.0 | -1 |
We go linear, and go through the array and create an array of zero indexes. Then go through the array, and swap out with each value that is not a zero. | def move_zeros_left_failure(array)
zero_indexes = Array.new
array.each_with_index do |value, index|
if value == 0
zero_indexes << index
end
end
zeros_cursor = 0
zero_indexes.each do |index|
#This does not work, because we're swapping.. NOT maintaining order.
#If this index is not in a place that will eventually be a zero.
unless index < zero_indexes.size - 1
tmp = array[index]
array[index] = array[zeros_cursor]
array[zeros_cursor] = 0
zeros_cursor += 1
end
end
return array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_ord_arr(arr)\n z = 0\n i = 1\n while i < arr.length\n if arr[z] != 0 && arr[i] == 0\n z = i\n end\n if arr[z] == 0 && arr[i] != 0\n arr[z], arr[i] = arr[i], arr[z]\n z += 1\n end\n i += 1\n end\n arr\nend",
"def move_zeroes(nums)\n count = nums.select { |i| i.zero? }.... | [
"0.75967336",
"0.74537593",
"0.7418099",
"0.7378691",
"0.735207",
"0.7315849",
"0.7246049",
"0.7181783",
"0.71808875",
"0.69366425",
"0.6887754",
"0.68305194",
"0.68170255",
"0.679784",
"0.6786388",
"0.67555135",
"0.6749932",
"0.67464906",
"0.6743448",
"0.669853",
"0.66448635... | 0.71871465 | 7 |
GET /system/platform_accounts GET /system/platform_accounts.json | def index
@system_platform_accounts = System::PlatformAccount.all.order(created_at: :desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @platform_accounts = PlatformAccount.all\n end",
"def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end",
"def social_accounts_for_a_... | [
"0.71803",
"0.7104645",
"0.70181173",
"0.7009661",
"0.68501115",
"0.66124415",
"0.64616865",
"0.6403624",
"0.6352732",
"0.62865174",
"0.62178135",
"0.61433905",
"0.6135354",
"0.6112601",
"0.6078784",
"0.60730547",
"0.6033302",
"0.6006916",
"0.5996568",
"0.5990285",
"0.5989550... | 0.69320863 | 4 |
POST /system/platform_accounts POST /system/platform_accounts.json | def create
@system_platform_account = System::PlatformAccount.new(system_platform_account_params)
if @system_platform_account.save
record_activities('创建接入账号', @system_platform_account.account_name)
flash[:success] = '创建接入账号成功'
redirect_to system_platform_accounts_path
else
flash[:error] = "创建失败: #{@system_platform_account.errors.full_message}"
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @platform_account = PlatformAccount.new(platform_account_params)\n\n respond_to do |format|\n if @platform_account.save\n format.html { redirect_to @platform_account, notice: 'Platform account was successfully created.' }\n format.json { render :show, status: :created, locatio... | [
"0.69657475",
"0.6878102",
"0.65119225",
"0.6469372",
"0.6435222",
"0.613894",
"0.6093869",
"0.60785115",
"0.6018403",
"0.6013775",
"0.594479",
"0.59259516",
"0.5910427",
"0.58811086",
"0.586852",
"0.5812276",
"0.5800599",
"0.5793748",
"0.5776442",
"0.57460445",
"0.57443756",... | 0.692325 | 1 |
PATCH/PUT /system/platform_accounts/1 PATCH/PUT /system/platform_accounts/1.json | def update
if @system_platform_account.update(system_platform_account_params)
record_activities('修改接入账号', @system_platform_account.account_name)
flash[:success] = '修改接入账号成功'
redirect_to system_platform_accounts_path
else
flash[:error] = "修改失败: #{@system_platform_account.errors.full_message}"
render :edit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @platform_account.update(platform_account_params)\n format.html { redirect_to @platform_account, notice: 'Platform account was successfully updated.' }\n format.json { render :show, status: :ok, location: @platform_account }\n else\n format... | [
"0.6664587",
"0.63509876",
"0.62742865",
"0.6177907",
"0.61456203",
"0.61348855",
"0.6080994",
"0.60676354",
"0.5990541",
"0.5987726",
"0.5969116",
"0.59688026",
"0.5911257",
"0.5911257",
"0.5896474",
"0.5860513",
"0.58026594",
"0.5790808",
"0.57885647",
"0.57713467",
"0.5769... | 0.65516 | 1 |
DELETE /system/platform_accounts/1 DELETE /system/platform_accounts/1.json | def destroy
if @system_platform_account.destroy
record_activities('删除接入账号', @system_platform_account.account_name)
flash[:success] = '删除接入账号成功'
else
flash[:error] = "删除失败: #{@system_platform_account.errors.full_message}"
end
redirect_to system_platform_accounts_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @platform_account.destroy\n respond_to do |format|\n format.html { redirect_to platform_accounts_url, notice: 'Platform account was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_account\n @connection.request({\n :meth... | [
"0.72787035",
"0.72124016",
"0.71362054",
"0.7104608",
"0.69834447",
"0.6962185",
"0.6930946",
"0.6786673",
"0.67275316",
"0.6713607",
"0.67068356",
"0.6480351",
"0.6465249",
"0.6465249",
"0.6465249",
"0.6465249",
"0.6460519",
"0.6445031",
"0.64420724",
"0.6418994",
"0.641206... | 0.693422 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_system_platform_account
@system_platform_account = System::PlatformAccount.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 system_platform_account_params
params[:system_platform_account].except(:id).permit!
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.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_coleta_indicador
@coleta_indicador = ColetaIndicador.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 |
Only allow a trusted parameter "white list" through. | def coleta_indicador_params
params.require(:coleta_indicador).permit(:indicador_id, :abrangencia_coleta, :area_id, :pessoa_id, :indice, :semestre, :quadrimestre, :trimestre, :mes, :quinzena, :semana, :ano, :periodo_coleta)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
GET /posts GET /posts.xml | def index
@posts = Post.search(params[:search], params[:page])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @posts }
format.js
format.atom
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => ... | [
"0.73163414",
"0.72102565",
"0.72102565",
"0.70133805",
"0.69922805",
"0.69905823",
"0.6946224",
"0.68449396",
"0.6825624",
"0.68239427",
"0.67839086",
"0.67474705",
"0.6744808",
"0.67014694",
"0.66831535",
"0.66570085",
"0.66536814",
"0.6641173",
"0.6569632",
"0.6569632",
"0... | 0.6194646 | 78 |
GET /posts/1 GET /posts/1.xml | def show
@post = Post.find_by_id(params[:id]) || Post.find_by_url(params[:id])
if logged_in?
@comments = @post.comments.all(:order => "created_at DESC")
else
@comments = @post.comments.approved(:order => "created_at DESC")
end
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @post }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => ... | [
"0.72230846",
"0.7073397",
"0.7073397",
"0.6978713",
"0.69539315",
"0.69031423",
"0.6797454",
"0.67764527",
"0.67728055",
"0.6706541",
"0.67029274",
"0.66985327",
"0.6677388",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0... | 0.0 | -1 |
GET /posts/new GET /posts/new.xml | def new
@user = User.find(session[:user_id])
@post = @user.posts.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @post }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end",
"def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n... | [
"0.78365606",
"0.7708412",
"0.76752806",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
... | 0.0 | -1 |
POST /posts POST /posts.xml | def create
@user = User.find(session[:user_id])
@post = @user.posts.new(params[:post])
respond_to do |format|
if @post.save
format.html { redirect_to("/#{@post.url}", :notice => t('controller.created')) }
format.xml { render :xml => @post, :status => :created, :location => @post }
else
format.html { render :action => "new" }
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n ... | [
"0.6847672",
"0.6799606",
"0.6638679",
"0.6625985",
"0.6582057",
"0.63850963",
"0.6320757",
"0.627628",
"0.62496513",
"0.62292284",
"0.6224684",
"0.6214792",
"0.62033695",
"0.61848694",
"0.6183795",
"0.61547226",
"0.61526495",
"0.6142421",
"0.61416507",
"0.6132199",
"0.61245"... | 0.60040534 | 29 |
PUT /posts/1 PUT /posts/1.xml | def update
@post = Post.find(params[:id])
respond_to do |format|
if @post.update_attributes(params[:post])
format.html { redirect_to("/#{@post.url}", :notice => t('controller.updated')) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def upd... | [
"0.6867673",
"0.66907144",
"0.6294395",
"0.62794256",
"0.6099675",
"0.6098852",
"0.6035446",
"0.590173",
"0.58895403",
"0.5880021",
"0.58741546",
"0.5867954",
"0.5849058",
"0.5837317",
"0.5833679",
"0.58261484",
"0.5825736",
"0.5818691",
"0.58159804",
"0.58100533",
"0.5810053... | 0.59057415 | 7 |
DELETE /posts/1 DELETE /posts/1.xml | def destroy
@post = Post.find(params[:id])
@post.destroy
respond_to do |format|
format.html { redirect_to(root_path, :notice => t('controller.deleted')) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.deleted = 1\n ... | [
"0.7365624",
"0.7322596",
"0.72059286",
"0.715179",
"0.715179",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.7068259",
"0.70451736",
"... | 0.70919865 | 5 |
Processes the given email, submits attachments to the Heathen server, delivers responses as configured | def process email, mail_to, is_rts=false
documents = []
unless email.has_attachments?
logger.info "From: #{email.from} Subject: (#{email.subject}) Files: no attachments"
return
end
logger.info "From: #{email.from} Subject: (#{email.subject}) Files: #{email.attachments.map(&:filename).join(',')}"
#
# Convert the attachments
#
email.attachments.each do |attachment|
begin
converter = AutoHeathen::Converter.new( { logger: logger } )
input_source = attachment.body.decoded
action = converter.get_action input_source.content_type
logger.info " convert #{attachment.filename} using action: #{action}"
converted_filename, data = converter.convert action, @cfg[:language], attachment.filename, input_source
documents << { orig_filename: attachment.filename, orig_content: input_source, filename: converted_filename, content: data, error: false }
rescue StandardError => e
documents << { orig_filename: attachment.filename, orig_content: input_source, filename: nil, content: nil, error: e.message }
end
end
#
# deliver the results
#
if is_rts
deliver_rts email, documents, mail_to
else
deliver_onward email, documents, mail_to
end
#
# Summarise the processing
#
logger.info "Results of conversion"
documents.each do |doc|
if doc[:content].nil?
logger.info " #{doc[:orig_filename]} was not converted (#{doc[:error]}) "
else
logger.info " #{doc[:orig_filename]} was converted successfully"
end
end
documents
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email\n\t\temail_response = EmailHandler.new(email_content).deliver_email\n\t\t\trender text: email_response + \"\\n\"\n\tend",
"def process\n return 'OK' if @email.to.first[:token] == 'example'\n return process_image if @email.to.first[:token] == 'flyers'\n\n token = ReplyToken.find(@email.to.first... | [
"0.6445737",
"0.62992346",
"0.62779707",
"0.6247057",
"0.6162328",
"0.6014607",
"0.6004042",
"0.5993383",
"0.5950224",
"0.59502155",
"0.5886799",
"0.5832686",
"0.58004117",
"0.5765758",
"0.5738035",
"0.5697251",
"0.5692308",
"0.5687707",
"0.5686721",
"0.567369",
"0.56539917",... | 0.6434325 | 1 |
Forward the email to sender, with decoded documents replacing the originals | def deliver_onward email, documents, mail_to
logger.info "Sending response mail to #{mail_to}"
email.cc [] # No CCing, just send to the recipient
email.to mail_to
email.subject "#{'Fwd: ' unless email.subject.to_s.start_with? 'Fwd:'}#{email.subject}"
email.return_path email.from unless email.return_path
# something weird goes on with Sharepoint, where the doc is dropped on the floor
# so, remove any offending headers
email.message_id = nil # make sure of message_id too
good_headers = ONWARD_HEADERS.map{ |h| h.downcase }
inspect_headers = email.header.map(&:name)
inspect_headers .each do |name|
unless good_headers.include? name.downcase
email.header[name] = nil
end
end
email.received = nil # make sure of received
# replace attachments with converted files
email.parts.delete_if { |p| p.attachment? }
documents.each do |doc|
if doc[:content]
email.add_file filename: doc[:filename], content: doc[:content]
else # preserve non-converted attachments when forwarding
email.add_file filename: doc[:orig_filename], content: doc[:orig_content]
end
end
email.delivery_method :smtp, address: @cfg[:mail_host], port: @cfg[:mail_port]
deliver email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deliver_rts email, documents, mail_to\n logger.info \"Sending response mail to #{mail_to}\"\n mail = Mail.new\n mail.from @cfg[:from]\n mail.to mail_to\n # CCs to the original email will get a copy of the converted files as well\n mail.cc (email.cc - email.to - (@cfg[:cc_blacklist... | [
"0.64977014",
"0.6424124",
"0.63283294",
"0.6274577",
"0.5993774",
"0.5918794",
"0.5916153",
"0.582899",
"0.58096135",
"0.5710799",
"0.5679788",
"0.5650706",
"0.5617321",
"0.55787796",
"0.55785877",
"0.5576686",
"0.55626917",
"0.55534476",
"0.5546139",
"0.5511874",
"0.5496006... | 0.71392787 | 0 |
Send decoded documents back to sender | def deliver_rts email, documents, mail_to
logger.info "Sending response mail to #{mail_to}"
mail = Mail.new
mail.from @cfg[:from]
mail.to mail_to
# CCs to the original email will get a copy of the converted files as well
mail.cc (email.cc - email.to - (@cfg[:cc_blacklist]||[]) ) if email.cc # Prevent autoheathen infinite loop!
# Don't prepend yet another Re:
mail.subject "#{'Re: ' unless email.subject.start_with? 'Re:'}#{email.subject}"
# Construct received path
# TODO: is this in the right order?
#rcv = "by localhost(autoheathen); #{Time.now.strftime '%a, %d %b %Y %T %z'}"
#[email.received,rcv].flatten.each { |rec| mail.received rec.to_s }
mail.return_path email.return_path if email.return_path
mail.header['X-Received'] = email.header['X-Received'] if email.header['X-Received']
documents.each do |doc|
next if doc[:content].nil?
mail.add_file filename: doc[:filename], content: doc[:content]
end
cfg = @cfg # stoopid Mail scoping
me = self # stoopid Mail scoping
mail.text_part do
s = Haml::Engine.new( me.read_file cfg[:text_template] ).render(Object.new, to: mail_to, documents: documents, cfg: cfg)
body s
end
mail.html_part do
content_type 'text/html; charset=UTF-8'
s = Haml::Engine.new( me.read_file cfg[:html_template] ).render(Object.new, to: mail_to, documents: documents, cfg: cfg)
body s
end
mail.delivery_method :smtp, address: @cfg[:mail_host], port: @cfg[:mail_port]
deliver mail
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive\n begin\n message = save_message\n rescue => err\n render :text => err.message, :status => 400\n return\n end\n \n begin\n message.process! params\n rescue => err\n message.reply = err.message\n ensure\n if (message.reply != \"Invalid command\")\n c... | [
"0.54869807",
"0.5417447",
"0.5417447",
"0.53679866",
"0.5307356",
"0.5301398",
"0.53003854",
"0.5299064",
"0.52919436",
"0.52829903",
"0.52796304",
"0.5253086",
"0.52505875",
"0.52391064",
"0.52151275",
"0.5201595",
"0.51985765",
"0.51840144",
"0.51640135",
"0.5142425",
"0.5... | 0.49734047 | 43 |
Convenience method allowing us to stub out actual mail delivery in RSpec | def deliver mail
if @cfg[:deliver]
mail.deliver!
logger.debug "Files were emailed to #{mail.to}"
else
logger.debug "Files would have been emailed to #{mail.to}, but #{self.class.name} is configured not to"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deliver!(mail)\n delivery_method.deliver!(mail)\n end",
"def mail(headers, &hash)\n return if Rails.env.test? && !ActionMailer::Base.perform_deliveries\n super\n end",
"def mail(headers={}, &block)\n # TODO: always send to support@bountysource.com and feedback@bountysource.com\n # TODO... | [
"0.6902263",
"0.6689212",
"0.668046",
"0.6551013",
"0.6544629",
"0.6540586",
"0.6504109",
"0.6487756",
"0.6424335",
"0.64029855",
"0.6301557",
"0.63013154",
"0.62775016",
"0.6270943",
"0.6267072",
"0.6267072",
"0.625257",
"0.62435454",
"0.622653",
"0.62154555",
"0.62098426",
... | 0.61922216 | 22 |
Opens and reads a file, first given the filename, then tries from the project base directory | def read_file filename
f = filename
unless File.exist? f
f = Pathname.new(__FILE__).realpath.parent.parent.parent + f
end
File.read f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file(filename) File.read(File.absolute_path(filename, File.dirname($PROGRAM_NAME))) end",
"def load_file( filename )\n begin\n read_in = File.new( filename, 'r' )\n rescue\n abort \"\\\"#{ filename }\\\" not found\"\n end\nend",
"def open_file(filename)\n File.open(filename, 'r')\n end",
... | [
"0.70322126",
"0.67769605",
"0.663163",
"0.6585881",
"0.65428025",
"0.6354542",
"0.63190085",
"0.63149667",
"0.63071203",
"0.62838364",
"0.62745726",
"0.6266581",
"0.6263687",
"0.62383866",
"0.62383866",
"0.62296194",
"0.6216855",
"0.6201136",
"0.61948687",
"0.6175239",
"0.61... | 0.69019765 | 1 |
GET /germinations GET /germinations.json | def index
@germinations = Germination.all
#Para traer todas las imagenes
@pictures = GeneticBankPicture.group(:genetic_bank_id)
@germinationsGrid = initialize_grid(Germination,
include: [:seed])
@geneticBankImagesPath = "/assets/images/geneticBank/"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_germination\n @germination = Germination.find(params[:id])\n end",
"def available_grade_levels_json\n params.require(:workspace_id)\n\n # schools\n school_ids = queries.supported_schools.map(&:id).select do |school_id|\n queries.is_authorized_for_school_id?(school_id)\n end\n ... | [
"0.62024117",
"0.5742523",
"0.5732085",
"0.57247204",
"0.5688935",
"0.5633007",
"0.5629104",
"0.56258285",
"0.5622049",
"0.56045717",
"0.5602284",
"0.55787754",
"0.5567271",
"0.5517237",
"0.55168563",
"0.54796255",
"0.54434246",
"0.5431874",
"0.5428535",
"0.5419062",
"0.54070... | 0.0 | -1 |
GET /germinations/1 GET /germinations/1.json | def show
@pictures = GeneticBankPicture.group(:genetic_bank_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_germination\n @germination = Germination.find(params[:id])\n end",
"def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end",
"def show\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ... | [
"0.65823025",
"0.5954642",
"0.587647",
"0.5749051",
"0.5746271",
"0.5726184",
"0.57108116",
"0.56986123",
"0.56787467",
"0.5635924",
"0.56314933",
"0.5631135",
"0.56106675",
"0.55862164",
"0.55854744",
"0.5563536",
"0.5556098",
"0.55455",
"0.5529545",
"0.55290306",
"0.5522159... | 0.0 | -1 |
POST /germinations POST /germinations.json | def create
@germination = Germination.new(germination_params)
respond_to do |format|
if @germination.save
format.html { redirect_to @germination, notice: 'Germination was successfully created.' }
format.json { render :show, status: :created, location: @germination }
else
format.html { render :new }
format.json { render json: @germination.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def germination_params\n params.require(:germination).permit(:seed_id, :week, :numGerminations,:codeCross, :codeCrossNumRepeat, :totalNumRepeat, :totalCode, :missingSeed)\n end",
"def set_germination\n @germination = Germination.find(params[:id])\n end",
"def update\n respond_to do |... | [
"0.62815017",
"0.62179554",
"0.6190228",
"0.6001416",
"0.5924232",
"0.5803998",
"0.5788219",
"0.5759266",
"0.57424706",
"0.57262695",
"0.5717415",
"0.57160664",
"0.5695696",
"0.56330705",
"0.5626055",
"0.562183",
"0.5593575",
"0.55877817",
"0.5563954",
"0.5561194",
"0.55527",... | 0.6999638 | 0 |
PATCH/PUT /germinations/1 PATCH/PUT /germinations/1.json | def update
respond_to do |format|
if @germination.update(germination_params)
format.html { redirect_to @germination, notice: 'Germination was successfully updated.' }
format.json { render :show, status: :ok, location: @germination }
else
format.html { render :edit }
format.json { render json: @germination.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n if @golfer.update_attributes(params[:golfer])\n format.html { redirect_to @golfer, notice: 'Golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ... | [
"0.62286437",
"0.6133187",
"0.60811967",
"0.6075552",
"0.60667264",
"0.60458076",
"0.59186405",
"0.58900356",
"0.58647126",
"0.5864348",
"0.58479387",
"0.58449566",
"0.5818425",
"0.58170277",
"0.58123165",
"0.5799829",
"0.5795953",
"0.57946986",
"0.57925326",
"0.5792086",
"0.... | 0.65737003 | 0 |
DELETE /germinations/1 DELETE /germinations/1.json | def destroy
begin
@germination.destroy
respond_to do |format|
format.html { redirect_to germinations_url, notice: 'Germination was successfully destroyed.' }
format.json { head :no_content }
end
rescue ActiveRecord::DeleteRestrictionError => e
respond_to do |format|
format.html {redirect_to germinations_url, alert: "#{e}"}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @golfer = Golfer.find(params[:id])\n @golfer.destroy\n\n respond_to do |format|\n format.html { redirect_to golfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mineral.destroy\n respond_to do |format|\n format.html { redirect_to minerals_... | [
"0.65731776",
"0.65606797",
"0.65290964",
"0.6449913",
"0.64485663",
"0.6417969",
"0.64070225",
"0.6393848",
"0.638985",
"0.63858825",
"0.63834727",
"0.6381429",
"0.63799417",
"0.63715047",
"0.6367167",
"0.63553685",
"0.6352163",
"0.63477576",
"0.6344742",
"0.6330198",
"0.632... | 0.64353764 | 5 |
Use callbacks to share common setup or constraints between actions. | def set_germination
@germination = Germination.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 germination_params
params.require(:germination).permit(:seed_id, :week, :numGerminations,:codeCross, :codeCrossNumRepeat, :totalNumRepeat, :totalCode, :missingSeed)
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.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: Takes a string and break up white and put into an array. (array.split) Iterate through each element of the string and use them as keys. Each step of the items: Incrementing the value of the key. Till we reach the end of that list. keys = item , value = quantity. print the list to the console [can you use one of your other methods here?] output: [what data type goes here, array or hash?] | def list_creater(items)
my_array = items.split(" ")
my_list = Hash.new(0)
my_array.each {|item| my_list[item] += 1}
return my_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createlist(str)\r\n# steps:\r\n# break the string into an array\r\n items = str.split\r\n item_list = {}\r\n\r\n\t# iterate through array and build hash\r\n items.each do |item|\r\n\r\n\t\t# iterate through array and build hash\r\n\t\t# set default quantity to 1\r\n \titem_list[item] = 1\r\n e... | [
"0.7393834",
"0.71228564",
"0.7065592",
"0.7029482",
"0.7026936",
"0.7024648",
"0.7020407",
"0.6938105",
"0.69128233",
"0.6728702",
"0.6728076",
"0.6670857",
"0.66625106",
"0.6618079",
"0.66167235",
"0.65895796",
"0.65760183",
"0.65728253",
"0.65671855",
"0.6554636",
"0.65446... | 0.61277467 | 90 |
Method to add an item to a list input: item name and optional quantity steps: Take 1 argument, and 1 optional argument. Increment our hash using the first argument as the key, and the second argument (if given) with 1. If no second arg, use the default as 1. Return updated list_hash. output: | def add_item(list_hash, food, quantity = 1)
list_hash[food] += quantity
return list_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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_name.store(item, quantity)\r\n# output: hash with new item\r\n p list_name\r\nend",
"def add_item(list, add_item, add_quantity=1)\n# steps:\n # Add item as ke... | [
"0.8476646",
"0.8380483",
"0.82813907",
"0.81637627",
"0.8160089",
"0.8112604",
"0.8033509",
"0.80103284",
"0.7957742",
"0.7940187",
"0.7877532",
"0.7858696",
"0.78544647",
"0.7846281",
"0.7844471",
"0.7841629",
"0.78342634",
"0.7822519",
"0.7812931",
"0.78082985",
"0.7777492... | 0.75773835 | 62 |
Method to remove an item from the list input: Look at the list and remove a specified item. steps: Do the opposite of add_item()! output: Show the updated list without that item. | def remove_item(updated_hash, food)
updated_hash.delete(food)
return updated_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_item(item, list)\n\t# steps: delete the item if it exists\n\tlist.delete_if {|list_item| list_item == item.to_sym}\n\t# output: updated list\n\tlist\nend",
"def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove_item(list, item_removed)\n list.delete(item_removed)\nend",
"def... | [
"0.8309526",
"0.81510586",
"0.8123036",
"0.811851",
"0.8104933",
"0.8064743",
"0.80269223",
"0.80100244",
"0.80062795",
"0.7990043",
"0.79897976",
"0.7964092",
"0.7963934",
"0.7963669",
"0.7963669",
"0.7963669",
"0.7963669",
"0.7961619",
"0.79605746",
"0.7958668",
"0.7956096"... | 0.0 | -1 |
Method to update the quantity of an item input: updated_and_removed (hash), the food, and also the integer/value update steps: Call for the key, pass in an argument for the value (to update) output: hash with quantities changed | def update_quantity(updated_and_removed, food, quantity)
updated_and_removed[food] = quantity
return updated_and_removed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_item_quantity(hash_of_items, item, quantity)\n hash_of_items[item] = quantity\n hash_of_items\nend",
"def update_quantity (item, quantity)\n item_hash[item] = quantity\nend",
"def update_quantity(list, upd_item, new_quantity)\n# steps:\n # reassign key (item) a new value (quantity)\n list[upd_i... | [
"0.7888069",
"0.764511",
"0.7604691",
"0.76039946",
"0.7598769",
"0.7592169",
"0.7575722",
"0.7571074",
"0.75564104",
"0.75564104",
"0.7491865",
"0.7490988",
"0.7438961",
"0.74265236",
"0.73975",
"0.7379802",
"0.73691183",
"0.7361545",
"0.73510516",
"0.73359215",
"0.73170424"... | 0.79688597 | 1 |
Method to print a list and make it look pretty input: new_hash steps: Use string padding and left/right justification to print hash output: prettified new hash | def print_list(new_hash)
new_hash.each_pair {|key, value| puts "#{key}: #{value}"}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_list(hash)\n width= 50\n puts \"Shopping List\".center(width)\n puts \"\".rjust(50,\"-\")\n print \"Item\".ljust(width/2)\n print \"-\"\n puts \"Quantity\".rjust(width/2)\n puts \"\".rjust(50,\"-\")\n hash.each do |item, quantity|\n puts \"#{item.ljust(width/2)}-#{quantity.to_s.rjust(width/2)}... | [
"0.6861356",
"0.67829186",
"0.6679124",
"0.6679124",
"0.66731256",
"0.65380496",
"0.6487519",
"0.6483313",
"0.64092034",
"0.639326",
"0.63731575",
"0.6354653",
"0.6327226",
"0.6285449",
"0.62683225",
"0.62461895",
"0.6237056",
"0.621643",
"0.6215804",
"0.6183054",
"0.6180052"... | 0.5746706 | 55 |
Find the largest product in a row | def left_to_right_helper(arr)
largest_prod_so_far = 0
for num in (1..16)
curr_prod = arr[num] * arr[num + 1] * arr[num + 2] * arr[num + 3]
if curr_prod > largest_prod_so_far
largest_prod_so_far = curr_prod
end
end
return largest_prod_so_far
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def largest_product()\n 0.upto(GRID_SIZE - 1) do |x|\n 0.upto(GRID_SIZE - 1) do |y|\n products_at_point(x,y)\n end\n end\n @largest_product\n end",
"def greatestProduct(num)\n numArr = num.to_s.split('')\n windowSize = 12\n maxProduct = -1\n for currentWindowStartIndex in 0...(numA... | [
"0.81063545",
"0.748328",
"0.7462482",
"0.73779976",
"0.737253",
"0.7218915",
"0.71026534",
"0.709903",
"0.70870435",
"0.7055352",
"0.7034241",
"0.70301944",
"0.7026105",
"0.7025688",
"0.70204794",
"0.7011268",
"0.70048285",
"0.696654",
"0.6965646",
"0.69614804",
"0.689627",
... | 0.67000103 | 32 |
Left to right per row approach | def left_to_right_approach
largest_prod_of_all_rows = 0
for each_row in (0..19)
curr_largest_prod_in_row = left_to_right_helper($grid_of_numbers[each_row])
if curr_largest_prod_in_row > largest_prod_of_all_rows
largest_prod_of_all_rows = curr_largest_prod_in_row
end
end
return largest_prod_of_all_rows
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_other_rows \n left = 2\n right = @n - 1\n\n (0..t-1).each do |c|\n (1..m-1).each do |r|\n @rounds[c][r] = \"#{left}-#{right}\"\n right = right_decrement(right)\n if r < m-1\n left = left_increment(left)\... | [
"0.6874047",
"0.64136726",
"0.6403356",
"0.63473946",
"0.629021",
"0.62245977",
"0.615518",
"0.6101817",
"0.59964246",
"0.5982305",
"0.59396225",
"0.5917513",
"0.5917364",
"0.5909867",
"0.5868755",
"0.5852535",
"0.5849668",
"0.5830294",
"0.5803585",
"0.57982105",
"0.57822037"... | 0.57355994 | 23 |
Top to bottom per col approach | def top_to_bottom_approach
largest_prod_of_all_cols = 0
for each_row in (0..15)
for each_col in (0..19)
curr_prod_in_col = $grid_of_numbers[each_row][each_col] * $grid_of_numbers[each_row + 1][each_col] * $grid_of_numbers[each_row + 2][each_col] * $grid_of_numbers[each_row + 3][each_col]
if curr_prod_in_col > largest_prod_of_all_cols
largest_prod_of_all_cols = curr_prod_in_col
end
end
end
return largest_prod_of_all_cols
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rows\n top...(top + bordered_height)\n end",
"def topToBottom(grid, width, height)\n\n strings = Array.new\n string = String.new\n\n for x in 0..width-1 do\n\n string = \"\"\n\n for y in 0..height-1 do\n letter = grid[[x, y]]\n string << letter\n ... | [
"0.64538753",
"0.6239998",
"0.61013013",
"0.60231555",
"0.6017565",
"0.5979388",
"0.5934234",
"0.59333867",
"0.59333867",
"0.59333867",
"0.59027475",
"0.5900925",
"0.5897193",
"0.58860314",
"0.5856215",
"0.58514017",
"0.58369446",
"0.5831316",
"0.58283556",
"0.58254564",
"0.5... | 0.64596754 | 0 |
Diagonal Top left to bottom right approach | def left_to_diagonal_right_approach
largest_prod = 0
for each_row in (0..15)
for each_col in (0..15)
a = $grid_of_numbers[each_row][each_col]
b = $grid_of_numbers[each_row+1][each_col+1]
c = $grid_of_numbers[each_row+2][each_col+2]
d = $grid_of_numbers[each_row+3][each_col+3]
curr_prod = a*b*c*d
if curr_prod > largest_prod
largest_prod = curr_prod
end
end
end
return largest_prod
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonal_left\n end",
"def diagonals\n down_diag = []\n up_diag = []\n \n # push sets of coordinates that make up both diagonals\n 0.upto(@size - 1) do |idx|\n down_diag << [idx, idx]\n up_diag << [idx, @size - 1 - idx]\n end\n\n [down_diag, up_diag].map do |diag|\n diag.... | [
"0.7465372",
"0.6961317",
"0.6956885",
"0.6897699",
"0.68156993",
"0.6783061",
"0.6779543",
"0.6760683",
"0.66843647",
"0.665417",
"0.6599142",
"0.6584765",
"0.65793014",
"0.6518524",
"0.65104765",
"0.6468214",
"0.6460205",
"0.64529014",
"0.6444333",
"0.64419717",
"0.6421348"... | 0.6128675 | 30 |
Diagonal Top right to bottom left approach | def right_to_diagonal_left_approach
largest_prod = 0
for each_row in (0..15)
for col in (0..19)
each_col = 19 - col
a = $grid_of_numbers[each_row][each_col]
b = $grid_of_numbers[each_row+1][each_col-1]
c = $grid_of_numbers[each_row+2][each_col-2]
d = $grid_of_numbers[each_row+3][each_col-3]
#puts "#{a} #{b} #{c} #{d}"
curr_prod = a*b*c*d
if curr_prod > largest_prod
largest_prod = curr_prod
end
end
end
return largest_prod
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonal_left\n end",
"def diagonalize floor = 0\n raise 'err: not 2d' unless self[0].class == Array\n size = self.length + self[0].length - 1\n array = Array.new(size) {Array.new}\n # acquire top and main diagonal\n self.length.times do |row|\n (0 .. row).each do |col|\n array[ro... | [
"0.73875606",
"0.69709074",
"0.6918539",
"0.68719816",
"0.6835893",
"0.6742801",
"0.6731876",
"0.67242265",
"0.66501546",
"0.6584924",
"0.6574043",
"0.6550251",
"0.6489379",
"0.6478272",
"0.6477696",
"0.64707994",
"0.6462538",
"0.64564466",
"0.6451236",
"0.6431176",
"0.642839... | 0.5975553 | 39 |
destroys spelling analysis records for dirty attributes | def expire_spellcheck_analysis!
spellcheck_attributes.each do |attribute|
if send("#{attribute}_changed?")
spellcheck_analyses.for(
attribute
).destroy_all
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_analysis\n model.wordcounts.destroy_all\n create_analysis\n delete_orphaned_keywords\n end",
"def destroy_analysis\n model.wordcounts.destroy_all\n delete_orphaned_keywords\n end",
"def clean_attributes\n @attribute_changes = {}\n end",
"def clean_dirty_attri... | [
"0.7054716",
"0.6836037",
"0.67611176",
"0.66816026",
"0.65128964",
"0.64335",
"0.6398209",
"0.6332102",
"0.6327789",
"0.63066363",
"0.6243849",
"0.6243849",
"0.6214917",
"0.6196193",
"0.6184995",
"0.60894126",
"0.6087792",
"0.60426253",
"0.6020794",
"0.6009847",
"0.5996206",... | 0.7698176 | 0 |
schedules a spellcheck analysis if there's any attribute missing without analysis | def schedule_spellcheck_analysis!
if missing_spellcheck_analysis?
self.class.delay.perform_spellcheck!(id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyse!\n @words = formatted_mispelled_words\n @success = true\n rescue *rescued_exceptions_keys => e\n @success = false\n if rescued_exceptions_messages.include?(e.message)\n # aspell is not present. track analysis as failure\n else\n raise e\n end\n end",
"def expire_spellche... | [
"0.7094114",
"0.65429735",
"0.60914516",
"0.5973861",
"0.5959402",
"0.56555307",
"0.5457493",
"0.54477775",
"0.53906095",
"0.5385877",
"0.5344768",
"0.5335884",
"0.5333769",
"0.53216285",
"0.52984506",
"0.52297664",
"0.51652765",
"0.5151356",
"0.5128848",
"0.5100648",
"0.5089... | 0.8056898 | 0 |
Never trust parameters from the scary internet, only allow the white list through. | def admin_params
params.permit(:username, :email, :password, :password_confirmation)
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.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Epay::Subscription.create(:card_no => '...', :) | def create(params)
params.merge!(
:order_no => (Time.now.to_f * 10000).to_i.to_s, # Produce a unique order_no - it's not used anywhere, but ePay needs this
:amount => 0
)
post = Api.default_post_for_params(params).merge({
:subscription => 1,
:subscriptionname => params[:description]
})
query = Api.authorize(post)
if query['accept']
# Return the new subscriber
subscription = new(query["subscriptionid"].to_i).reload
# Set (obfuscated) card number:
subscription.card_no = query["tcardno"]
subscription
else
new(nil, 'error' => query["error"])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_subscription(credit_card, options = {})\n\n u = self.user\n options[:order_id] = number # currently just loading a date\n options[:email] = u.email\n options[:address] = {\n :first_name => u.first_name,\n :last_name => u.last_name,\n :address1 => u.street_address1,\n ... | [
"0.74440676",
"0.69249344",
"0.66142",
"0.6543828",
"0.6535729",
"0.6463699",
"0.6438519",
"0.63840294",
"0.63840294",
"0.63743496",
"0.6366984",
"0.6348669",
"0.63290554",
"0.6298875",
"0.6294393",
"0.6271813",
"0.6244119",
"0.621914",
"0.62121296",
"0.6211957",
"0.6202277",... | 0.70539814 | 1 |
Locate whitelisted attributes for the supplied association name | def whitelisted_attrs_for(assoc_name, attr_hash = whitelisted_attrs)
if assoc_name.to_s == attr_hash.keys.first.to_s
return attr_hash.values.first.reject { |v| v.is_a? Hash }
end
scoped_whitelisted_attrs = attr_hash.values.first
scoped_whitelisted_attrs.reject { |v|
!v.is_a? Hash
}.find { |v|
whitelisted_attrs_for(assoc_name, v)
}.try(:values).try(:first)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_attributes_starting_with(name)\n @attributes.select { |key| key.to_s.start_with?(name) }\n end",
"def with(name)\r\n @attributes.find { |attr| attr.name == name }\r\n end",
"def sanitize_has_many(association_name)\n association_name = association_name.to_s\n singula... | [
"0.62297773",
"0.58707494",
"0.5681205",
"0.56804436",
"0.5580042",
"0.55318826",
"0.5509185",
"0.543627",
"0.54211015",
"0.5367452",
"0.53495026",
"0.5342377",
"0.52918595",
"0.5263046",
"0.52556527",
"0.5253176",
"0.51756036",
"0.51753515",
"0.5157375",
"0.51460755",
"0.514... | 0.6263081 | 0 |
Returns true or nil | def nullify(bool)
bool ? bool : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def null?; false end",
"def success?() end",
"def usable?; end",
"def result?\n true\n end",
"def result?\n false\n end",
"def ok? \n @funct == nil ? (return false) : (return true)\n end",
"def check ; true ; end",
"def true(_argvs)\n return nil\n end",
"... | [
"0.73527294",
"0.71958756",
"0.70889044",
"0.7076888",
"0.70721966",
"0.7020699",
"0.6976452",
"0.6956316",
"0.69526184",
"0.6942693",
"0.6942693",
"0.69166285",
"0.6899009",
"0.6875169",
"0.68494153",
"0.6838159",
"0.68375415",
"0.6819223",
"0.6819223",
"0.680289",
"0.680289... | 0.0 | -1 |
num1 the first integer num2 the second integer Examples power(3, 2) => 9 Returns the value of the first integer to the power of the second one | def power(base, exponent)
i =
output = 1
while i <= exponent
output = output * base
i += 1
end
return output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def power (n1, n2)\n\tn = n1 ** n2\n\treturn n\nend",
"def power(n1, n2)\r\n n1.to_i ** n2.to_i\r\nend",
"def power(num1, num2)\n return num1**num2\nend",
"def power(num1, num2)\n return num1**num2\nend",
"def power(n1, n2)\n return n1**n2\nend",
"def power(n1, n2)\n n1 ** n2\nend",
"def pow... | [
"0.80441004",
"0.7976614",
"0.79447675",
"0.79447675",
"0.7922328",
"0.78334236",
"0.77964866",
"0.7736557",
"0.7570357",
"0.7410962",
"0.7199833",
"0.71449816",
"0.7132441",
"0.71121764",
"0.71075374",
"0.7052429",
"0.7035631",
"0.6969633",
"0.6965739",
"0.6957376",
"0.69228... | 0.0 | -1 |
GET /plans GET /plans.json | def index
@search = params[:search].to_s
@status = params[:status].to_s
@artist = params[:artist].to_s
@purchase_date_start = params[:purchase_date_start].to_s
@purchase_date_end = params[:purchase_date_end].to_s
@music_orders = Order.joins('INNER JOIN users AS u ON u.id=orders.user_id').joins('INNER JOIN order_items AS oi ON oi.order_id=orders.id').joins('INNER JOIN audios ON audios.id=oi.product_id')
if @search.length > 0
searchText = '%'+@search+'%'
@music_orders = @music_orders.where("CONCAT(u.first_name,' ',u.last_name) LIKE ?",searchText)
end
if @artist!=""
@music_orders = @music_orders.where("audios.user_id=?",@artist)
#@music_orders = Order.joins('INNER JOIN audios ON audios.id=oi.product_id')
end
if @status == "Complete"
@music_orders = @music_orders.where("order_status=1")
elsif @status == "Incomplete"
@music_orders = @music_orders.where("order_status=0")
end
if @purchase_date_start!=""
@music_orders = @music_orders.where("date(created_at)>=?",@purchase_date_start)
end
if @purchase_date_end!=""
@music_orders = @music_orders.where("date(created_at)<=?",@purchase_date_end)
end
@music_orders = @music_orders.order('created_at DESC').paginate(:page => params[:page], :per_page => 10)
#render text: @music_orders.to_sql
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def index\n @plans = Plan.all\n\n render json: @plans\n end",
"def index\n @plans = Plan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plans }\n end\n ... | [
"0.83793116",
"0.8245937",
"0.79580194",
"0.771876",
"0.76548684",
"0.75855523",
"0.75678337",
"0.75678337",
"0.7560124",
"0.7451438",
"0.7422722",
"0.7376277",
"0.7278245",
"0.7252006",
"0.71429604",
"0.71125525",
"0.7108914",
"0.7099293",
"0.70921487",
"0.70670223",
"0.7018... | 0.0 | -1 |
GET /plans/1 GET /plans/1.json | def show
#render text: @music_order.order_items.length and return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def index\n @plans = Plan.all\n\n render json: @plans\n end",
"def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end",
"def index\n @plans = Plan.all\n\n respond_to do |format|\n f... | [
"0.80668986",
"0.80299073",
"0.7866424",
"0.7828984",
"0.75015014",
"0.75013804",
"0.747925",
"0.7453174",
"0.7453174",
"0.7383227",
"0.7175319",
"0.715803",
"0.7094077",
"0.708701",
"0.7042046",
"0.7042046",
"0.70326114",
"0.701462",
"0.70041215",
"0.6973513",
"0.69346154",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_music_order
@music_order = Order.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 |
End Validations TODO Is this OperatingTime applicable at +time+ | def valid_at(time=Time.now)
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time_check\n if self.event_type == \"Script\" || self.event_type == \"Gamecall\"\n if end_time > start_time\n self.end_time = start_time\n end\n end\n end",
"def validate\n\t\tif not isEmpty(self.time)\n\t\t\terrors.add(:time, \"is already occupied.\")\n\t\tend\n\t\tif not Schedul... | [
"0.6389445",
"0.63161683",
"0.630917",
"0.6272418",
"0.62706494",
"0.62253946",
"0.622534",
"0.6204812",
"0.6201192",
"0.6197278",
"0.61787534",
"0.6177698",
"0.6162016",
"0.6134159",
"0.6134159",
"0.6104135",
"0.6083882",
"0.60712993",
"0.60669905",
"0.60382575",
"0.602923",... | 0.57621694 | 35 |
days_of_week Helpers Hash mapping day of week (Symbol) to valid(true)/invalid(false) | def days_of_week_hash
@days_of_week_hash ||= {
:sunday => (days_of_week & SUNDAY ) > 0,
:monday => (days_of_week & MONDAY ) > 0,
:tuesday => (days_of_week & TUESDAY ) > 0,
:wednesday => (days_of_week & WEDNESDAY ) > 0,
:thursday => (days_of_week & THURSDAY ) > 0,
:friday => (days_of_week & FRIDAY ) > 0,
:saturday => (days_of_week & SATURDAY ) > 0
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def week_days\n {\n \"1\" => 'mon',\n \"2\" => 'tue',\n \"3\" => 'wed',\n \"4\" => 'thu',\n \"5\" => 'fri',\n \"6\" => 'sat',\n \"7\" => 'sun'\n }\n end",
"def days_of_week_are_valid\n errors.add(:days_of_week, \"The days of the week ... | [
"0.7101164",
"0.68387413",
"0.66913855",
"0.6580827",
"0.645476",
"0.6395663",
"0.62980866",
"0.61266935",
"0.61141163",
"0.6081505",
"0.60686713",
"0.6054797",
"0.60448176",
"0.6013568",
"0.6002565",
"0.598655",
"0.5983415",
"0.59625745",
"0.5904272",
"0.5893466",
"0.5884830... | 0.81110364 | 0 |
Array beginning with Sunday of valid(true)/inactive(false) values | def days_of_week_array
dow = days_of_week_hash
@days_of_week_array ||= [
dow[:sunday],
dow[:monday],
dow[:tuesday],
dow[:wednesday],
dow[:thursday],
dow[:friday],
dow[:saturday]
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_days\n\t\tbool_array = []\n\n\t\tbool_array << self[:monday]\n\t\tbool_array << self[:tuesday]\n\t\tbool_array << self[:wednesday]\n\t\tbool_array << self[:thursday]\n\t\tbool_array << self[:friday]\n\t\tbool_array << self[:saturday]\n\t\tbool_array << self[:sunday]\n\n\t\treturn bool_array\n\tend",
"def... | [
"0.71965784",
"0.67568946",
"0.6581913",
"0.64520675",
"0.63136214",
"0.6308482",
"0.6202394",
"0.61984134",
"0.6176048",
"0.61348885",
"0.6126456",
"0.60864455",
"0.6034387",
"0.60218185",
"0.59990925",
"0.5979697",
"0.59554625",
"0.595433",
"0.58854246",
"0.5867371",
"0.584... | 0.69801205 | 1 |
Humanreadable string of applicable days of week | def days_of_week_string
dow = days_of_week_hash
@days_of_week_string ||=
(dow[:sunday] ? "Su" : "") +
(dow[:monday] ? "M" : "") +
(dow[:tuesday] ? "Tu" : "") +
(dow[:wednesday] ? "W" : "") +
(dow[:thursday] ? "Th" : "") +
(dow[:friday] ? "F" : "") +
(dow[:saturday] ? "Sa" : "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def day_name; Date::DAYNAMES[wday] end",
"def week_days\n {\n \"1\" => 'mon',\n \"2\" => 'tue',\n \"3\" => 'wed',\n \"4\" => 'thu',\n \"5\" => 'fri',\n \"6\" => 'sat',\n \"7\" => 'sun'\n }\n end",
"def wday_shortname date\n %w'вс пн... | [
"0.7737139",
"0.7486552",
"0.7469496",
"0.73546207",
"0.72907776",
"0.7284998",
"0.7241393",
"0.72357625",
"0.71897435",
"0.7145447",
"0.7094004",
"0.70383483",
"0.7018797",
"0.6955864",
"0.69220936",
"0.69005585",
"0.6775498",
"0.67750865",
"0.67712194",
"0.6764459",
"0.6739... | 0.78225845 | 0 |
End days_of_week Helpers Returns the next full occurrence of these operating time rule. If we are currently within a valid time range, it will look forward for the next opening time | def next_times(at = Time.now)
at = at.midnight unless at.respond_to? :offset
return nil if length == 0
return nil if at.to_date > endDate # Schedules end at 23:59 of the stored endDate
at = startDate.midnight if at < startDate # This schedule hasn't started yet, skip to startDate
# Next occurrence is later today
# This is the only time the "time" actually matters;
# after today, all we care about is the date
if days_of_week_array[at.wday] and
start >= at.offset
open = at.midnight + start
close = open + length
return [open,close]
end
# We don't care about the time offset anymore, jump to the next midnight
at = at.midnight + 1.day
# NOTE This also has the added benefit of preventing an infinite loop
# from occurring if +at+ gets shifted by 0.days further down.
# Shift days_of_weekArray so that +at+ is first element
dow = days_of_week_array[at.wday..-1] + days_of_week_array[0..(at.wday-1)]
# NOTE The above call does something a little quirky:
# In the event that at.wday = 0, it concatenates the array with itself.
# Since we are only interested in the first true value, this does not
# cause a problem, but could probably be cleaned up if done so carefully.
# Next day of the week this schedule is valid for (relative to current day)
shift = dow.index(true)
if shift
# Skip forward
at = at + shift.days
else
# Give up, there are no more occurrences
# TODO Test edge case: valid for 1 day/week
return nil
end
# Recurse to rerun the validation routines
return next_times(at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_of_week\n @end_of_week ||= (start_of_week + 6)\n end",
"def end_of_week(start_day = Date.beginning_of_week)\n last_hour(days_since(6 - days_to_week_start(start_day)))\n end",
"def end_of_week; self + (6 - wday).days end",
"def ending_of_week\n if current_week.index(day) == 6\n ... | [
"0.6887679",
"0.66346705",
"0.6612159",
"0.65665865",
"0.6491254",
"0.64626026",
"0.6456308",
"0.639722",
"0.63921046",
"0.6352652",
"0.6317332",
"0.6278184",
"0.62594515",
"0.6212975",
"0.61278874",
"0.6109816",
"0.60801196",
"0.6054199",
"0.60504466",
"0.6021319",
"0.598778... | 0.5527699 | 43 |
TODO DEPRECATED METHODS Returns a RelativeTime object representing this OperatingTime | def relativeTime
@relativeTime ||= RelativeTime.new(self, :opensAt, :length)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_time\r\n return @owner.timestamp.to_i - @start.to_i\r\n end",
"def time\n Time.now.localtime + self.time_offset\n end",
"def to_time\n self\n end",
"def relative_time(time)\n stamp = time.getutc.iso8601\n %(<time class=\"ltr\" dir=\"ltr\" title=\"#{st... | [
"0.65414953",
"0.64402467",
"0.6255717",
"0.6231243",
"0.61912125",
"0.6088688",
"0.6035321",
"0.6035321",
"0.6031371",
"0.5978721",
"0.5962981",
"0.59468776",
"0.59287286",
"0.59149784",
"0.5897135",
"0.5892174",
"0.5857807",
"0.584655",
"0.58331233",
"0.58246064",
"0.582424... | 0.7810221 | 0 |
Backwards compatibility with old database schema TODO GET RID OF THIS!!! | def flags
( (override ? 1 : 0) << 7) | read_attribute(:days_of_week)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_new_schema\n AssociatedRecord.reset_column_information\n DeeplyAssociatedRecord.reset_column_information\n\n AssociatedRecord.cached_primary_index.send(:instance_variable_set, :@cache_key_prefix, nil)\n Item.cached_primary_index.send(:instance_variable_set, :@cache_key_prefix, nil)\n end",
... | [
"0.6499884",
"0.64268947",
"0.6419232",
"0.63254976",
"0.62552696",
"0.6207963",
"0.6176072",
"0.6157932",
"0.61382",
"0.6098865",
"0.6047233",
"0.59738535",
"0.5945883",
"0.5927769",
"0.58752453",
"0.5833171",
"0.57681584",
"0.57356924",
"0.5732324",
"0.573167",
"0.5729477",... | 0.0 | -1 |
FIXME Deprecated, use +override+ instead | def special
override
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overrides; end",
"def source(override); end",
"def super_method; end",
"def tag; raise 'Override this method'; end",
"def custom; end",
"def custom; end",
"def inherited(base); end",
"def overrides=(_arg0); end",
"def virtual; end",
"def proxy\n super\n end",
"def private; end",
"... | [
"0.8639842",
"0.76268375",
"0.75826335",
"0.75562793",
"0.74351907",
"0.74351907",
"0.74229366",
"0.7329519",
"0.7291582",
"0.72717106",
"0.7223582",
"0.7076081",
"0.7076081",
"0.7038899",
"0.69644564",
"0.69644564",
"0.69512624",
"0.6944975",
"0.69274217",
"0.69274217",
"0.6... | 0.7944929 | 1 |
Input: isSpecial = true/false FIXME Deprecated, use +override=+ instead | def special=(isSpecial)
if isSpecial == true or isSpecial == "true" or isSpecial == 1
self.override = true
elsif isSpecial == false or isSpecial == "false" or isSpecial == 0
self.override = false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def special\n override\n end",
"def special=(value)\n @special = value\n end",
"def specialty; end",
"def is_special?\n\n [ '*embedded*', '*untracked*' ].include?(self.name)\n end",
"def overrides; end",
"def enotsup?() super; end",
"def set_normal!\n @wildcard = ... | [
"0.71309096",
"0.6226058",
"0.61120033",
"0.59751964",
"0.5869382",
"0.5725025",
"0.5698278",
"0.56727046",
"0.56639534",
"0.5553868",
"0.5505519",
"0.5494788",
"0.54832375",
"0.54832375",
"0.5450311",
"0.5423534",
"0.5421569",
"0.5414391",
"0.5395716",
"0.53858036",
"0.53718... | 0.8336799 | 0 |
Initialize an instance of Issue | def initialize(attributes = {})
@project_id = attributes.fetch(:project_id) { raise ArgumentError, "Missing project_id" }
@title = attributes.fetch(:title) { raise ArgumentError, "Missing title" }
@description = attributes.fetch(:body) { raise ArgumentError, "Missing description" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(issue_id=nil)\n @issue =\n if issue_id\n Issue.find(issue_id)\n else\n Issue.new\n end\n end",
"def build_issue\n @issue = Issue.new\n end",
"def initialize(jira, issue)\n @jira = jira\n @issue = issue\n end",
"def initialize(issue, project, cl... | [
"0.80681145",
"0.79213995",
"0.77904505",
"0.7358495",
"0.72131765",
"0.66923636",
"0.6653379",
"0.6606198",
"0.6606198",
"0.6606198",
"0.6606198",
"0.6606198",
"0.6606198",
"0.6606198",
"0.6606198",
"0.6606198",
"0.6606198",
"0.6606198",
"0.6606198",
"0.6606198",
"0.6606198"... | 0.0 | -1 |
Delete VPC. ec2.delete_vpc("vpc890ce2e0") => true | def delete_vpc(vpc_id)
link = generate_request("DeleteVpc", 'VpcId' => vpc_id )
request_info(link, RightHttp2xxParser.new(:logger => @logger))
rescue Exception
on_exception
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n requires :id\n service.delete_vpc(id)\n true\n end",
"def delete_vpc(vpc_id)\n return if vpc_id.nil? || !configured?\n\n @client.delete_vpc(vpc_id: vpc_id)\n end",
"def destroy\n @aws_vpc_tag.destroy\n respond_to do |format|\n format.html { redi... | [
"0.8224563",
"0.790087",
"0.694757",
"0.6551244",
"0.63807094",
"0.6149625",
"0.6077866",
"0.5724397",
"0.5701135",
"0.5694534",
"0.5691916",
"0.56865984",
"0.56732345",
"0.56375486",
"0.56126297",
"0.5608507",
"0.5586136",
"0.55807585",
"0.5557539",
"0.55503654",
"0.55220866... | 0.7932706 | 1 |
Delete Subnet. ec2.delete_subnet("subnet770de31e") => true | def delete_subnet(subnet_id)
link = generate_request("DeleteSubnet", 'SubnetId' => subnet_id )
request_info(link, RightHttp2xxParser.new(:logger => @logger))
rescue Exception
on_exception
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n requires :subnet_id\n\n service.delete_subnet(subnet_id)\n true\n end",
"def delete_subnet(subnet)\n return delete_request(address(\"subnets/\" + subnet), @token)\n end",
"def destroy\n @aws_subnet.destroy\n respond_to do |format|\n format.html... | [
"0.84729993",
"0.7955613",
"0.72776175",
"0.64005053",
"0.6343148",
"0.6320133",
"0.625123",
"0.61103386",
"0.6010957",
"0.5974229",
"0.5925765",
"0.58072263",
"0.577895",
"0.57667285",
"0.57600766",
"0.5737357",
"0.5728298",
"0.558142",
"0.5580356",
"0.5567163",
"0.5541871",... | 0.7831108 | 2 |
Delete DHCP Options. ec2.delete_dhcp_options("doptcb0de3a2") => true | def delete_dhcp_options(dhcp_options_id)
link = generate_request("DeleteDhcpOptions", 'DhcpOptionsId' => dhcp_options_id )
request_info(link, RightHttp2xxParser.new(:logger => @logger))
rescue Exception
on_exception
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n requires :id\n service.delete_dhcp_options(id)\n true\n end",
"def destroy\n @aws_dhcp_option_attribute.destroy\n respond_to do |format|\n format.html { redirect_to aws_dhcp_option_attributes_url, notice: 'Aws dhcp option attribute was successfully destr... | [
"0.8420959",
"0.6863806",
"0.6480748",
"0.6448804",
"0.6369895",
"0.61514276",
"0.60612226",
"0.60586494",
"0.6022748",
"0.59883505",
"0.597475",
"0.59474516",
"0.59318",
"0.58906984",
"0.58425814",
"0.58199286",
"0.576356",
"0.57190824",
"0.5701034",
"0.56766",
"0.5669369",
... | 0.79963267 | 1 |
Delete customer gateway. ec2.delete_customer_gateway("cgwd5a643bc") => true | def delete_customer_gateway(customer_gateway_id)
link = generate_request("DeleteCustomerGateway", 'CustomerGatewayId' => customer_gateway_id )
request_info(link, RightHttp2xxParser.new(:logger => @logger))
rescue Exception
on_exception
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n requires :customer_gateway_id\n \n service.delete_customer_gateway(customer_gateway_id)\n true\n end",
"def destroy\n requires :id\n \n service.delete_nat_gateway(id)\n true\n end",
"def destroy\n @payment_ga... | [
"0.8375744",
"0.6895204",
"0.6833198",
"0.66712445",
"0.6517801",
"0.6488889",
"0.6185644",
"0.6076983",
"0.6076983",
"0.6051314",
"0.6018349",
"0.6008825",
"0.59804004",
"0.59573954",
"0.59382427",
"0.58884317",
"0.586029",
"0.5835617",
"0.58298254",
"0.57514703",
"0.5721072... | 0.83043444 | 1 |
Detach VPN gateway. ec2.detach_vpn_gateway('vgwdfa144b6','vpc890ce2e0') => true | def detach_vpn_gateway(vpn_gateway_id, vpc_id)
link = generate_request("DetachVpnGateway", 'VpnGatewayId' => vpn_gateway_id,
'VpcId' => vpc_id )
request_info(link, RightHttp2xxParser.new(:logger => @logger))
rescue Exception
on_exception
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_vpn_gateway(vpn_gateway_id)\n link = generate_request(\"DeleteVpnGateway\", 'VpnGatewayId' => vpn_gateway_id )\n request_info(link, RightHttp2xxParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end",
"def detach(vpc_id)\n requires :id\n service.... | [
"0.65123874",
"0.6361243",
"0.62730455",
"0.59608024",
"0.5887733",
"0.5845077",
"0.5825646",
"0.5697991",
"0.55941606",
"0.5589475",
"0.55568457",
"0.5531404",
"0.5480342",
"0.5466503",
"0.54130226",
"0.5395616",
"0.53945833",
"0.5380723",
"0.536856",
"0.5331706",
"0.5273601... | 0.78283596 | 0 |
Delete vpn gateway. ec2.delete_vpn_gateway("vgwdfa144b6") => true | def delete_vpn_gateway(vpn_gateway_id)
link = generate_request("DeleteVpnGateway", 'VpnGatewayId' => vpn_gateway_id )
request_info(link, RightHttp2xxParser.new(:logger => @logger))
rescue Exception
on_exception
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n requires :id\n \n service.delete_nat_gateway(id)\n true\n end",
"def destroy\n @payment_gateway.destroy\n respond_to do |format|\n flash[:success] = 'Payment gateway was successfully deleted.'\n format.html { redirect_to payment_gateways_ur... | [
"0.7183906",
"0.7150462",
"0.7052538",
"0.6931372",
"0.6924067",
"0.68908215",
"0.68870014",
"0.66670597",
"0.6476776",
"0.64290774",
"0.6409588",
"0.6380826",
"0.6116025",
"0.6015251",
"0.59981155",
"0.59282196",
"0.57916135",
"0.57296383",
"0.5694964",
"0.56835365",
"0.5665... | 0.8243737 | 0 |
Delete VPN connection. ec2.delete_vpn_connection("vpna9a643c0") => true | def delete_vpn_connection(vpn_connection_id)
link = generate_request("DeleteVpnConnection", 'VpnConnectionId' => vpn_connection_id )
request_info(link, RightHttp2xxParser.new(:logger => @logger))
rescue Exception
on_exception
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n requires :vpn_connection_id\n\n service.delete_vpn_connection(vpn_connection_id)\n true\n end",
"def destroy\n @vpn = Vpn.find(params[:id])\n checkaccountobject(\"vpns\",@vpn)\n @vpn.send_delete\n\n respond_to do |format|\n format.html { redirect_t... | [
"0.8566948",
"0.6577365",
"0.6408355",
"0.6338869",
"0.6139732",
"0.6011228",
"0.6007342",
"0.59931576",
"0.5975029",
"0.5954041",
"0.5954041",
"0.593591",
"0.5904912",
"0.5869909",
"0.5847338",
"0.58333385",
"0.58041346",
"0.579174",
"0.5732727",
"0.57266825",
"0.5715345",
... | 0.7710807 | 1 |
needed this method, it is a bit of a hack | def each
self.to_hash.each
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def original; end",
"def wrapper; end",
"def custom; end",
"def custom; end",
"def escaper; end",
"def weber; end",
"def internal; end",
"def anchored... | [
"0.7332386",
"0.6274376",
"0.6181776",
"0.6181776",
"0.6181776",
"0.6181776",
"0.61147016",
"0.58904445",
"0.58735126",
"0.5859788",
"0.5859788",
"0.5730424",
"0.5706505",
"0.5698918",
"0.56872684",
"0.56723124",
"0.5649386",
"0.5649386",
"0.5644264",
"0.5642484",
"0.56346774... | 0.0 | -1 |
prime numbers only divisible by themselves and 1 modulo will be != 0 for everything but themselves and 1 | def prime?(num)
fail_count = 0
if num < 0
num = num * (-1)
end
factors = []
range = (1..num)
range.each do |range_number|
remain = num % range_number
if remain == 0
factors.push(num)
else fail_count += 1
end
end
puts fail_count
if factors[-1] == 1
return false
elsif num == 0
return false
elsif factors.count > 2
return false
elsif factors.count == 2
return true
else return nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prime_alt_1(number)\n return false if number <=1\n max_div = Math.sqrt(number)\n (2..max_div ).each do |x|\n if (number % x)== 0\n return false\n end\n end\n return true\nend",
"def prime?(num) \n return false if !num.integer? #integer is # that is not a fraction\n return false if num <... | [
"0.7799592",
"0.7716491",
"0.76884675",
"0.76285803",
"0.76052797",
"0.75964946",
"0.7533037",
"0.75246763",
"0.75246763",
"0.7505941",
"0.74972594",
"0.7494623",
"0.7494623",
"0.7494623",
"0.74922144",
"0.7483564",
"0.7482918",
"0.74609315",
"0.74240124",
"0.7419909",
"0.741... | 0.0 | -1 |
Generate expected cookbook version hash | def batali_cookbook_hash
Chef::Log.warn 'Resolving cookbooks via Batali!'
system = batali_build_system
constraints = Smash[
api_service.get_rest("environments/#{node.chef_environment}").cookbook_versions.to_a
]
restrictions = api_service.get_rest("environments/#{node.chef_environment}").cookbook_versions.to_a
requirements = Array.new.tap do |reqs|
@expanded_run_list_with_versions.each do |item|
c_name, c_version = item.split('@')
c_name = c_name.split('::').first
reqs << [c_name, c_version ? c_version : '> 0']
end
end
unless(requirements.empty?)
solver = Grimoire::Solver.new(
:requirements => Grimoire::RequirementList.new(
:name => 'requirements',
:requirements => requirements
),
:restrictions => Grimoire::RequirementList.new(
:name => 'restrictions',
:requirements => restrictions
),
:system => system,
:score_keeper => batali_build_score_keeper
)
results = solver.generate!
solution = results.pop
solution_output = solution.units.sort_by(&:name).map{|u| "#{u.name}<#{u.version}>"}.join(', ')
node.set[:batali] ||= Mash.new
node.set[:batali][:last_resolution] = Mash[solution.units.map{|u| [u.name, u.version]}]
Chef::Log.warn "Batali cookbook resolution: #{solution_output}"
Hash[
solution.units.map do |unit|
[unit.name, api_service.get_rest("cookbooks/#{unit.name}/#{unit.version}")]
end
]
else
node.set[:batali][:last_resolution] = Mash.new
Chef::Log.warn 'Batali resolution not required. No cookbooks in run list!'
Hash.new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aws_cookbook_version\n aws_version = run_context.cookbook_collection['aws'].metadata.version.chomp('v')\n end",
"def version_guid\n \"#{digest_type}:#{checksum}\"\n end",
"def check_commit_version\n metadata = Chef::Cookbook::Metadata.new\n metadata.from_file(File.join(Config.set... | [
"0.67571723",
"0.6570089",
"0.6528119",
"0.62239987",
"0.61201304",
"0.61163527",
"0.6061317",
"0.6061317",
"0.6008768",
"0.5942273",
"0.5923056",
"0.5911335",
"0.588799",
"0.5868936",
"0.58665407",
"0.5862085",
"0.5858372",
"0.5852333",
"0.58497155",
"0.5842781",
"0.5798828"... | 0.0 | -1 |
Build the base system for generating solution | def batali_build_system
system = Grimoire::System.new
units = api_service.get_rest('cookbooks?num_versions=all').map do |c_name, meta|
meta['versions'].map do |info|
"#{c_name}/#{info['version']}"
end
end.flatten.map do |ckbk|
Batali::Unit.new(
Smash.new(
:name => ckbk.split('/').first,
:version => ckbk.split('/').last,
:dependencies => api_service.get_rest("cookbooks/#{ckbk}").metadata.dependencies.to_a
)
)
end
system.add_unit(*units)
system
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build()\n HP.logger.debug(\"~ Build Mode: #{build_mode}\")\n HP.logger.debug(\"~ Source Root: #{source_root}\")\n HP.logger.debug(\"~ Build Root: #{build_root}\")\n build_entries(entries())\n end",
"def setup_skeleton\r\n self.destination_root = File.join(path, name)\r\n @c... | [
"0.6551143",
"0.6481094",
"0.6448664",
"0.64158076",
"0.6411115",
"0.6241133",
"0.6204607",
"0.619607",
"0.616401",
"0.6142587",
"0.6133116",
"0.6115252",
"0.60413915",
"0.6032264",
"0.6022114",
"0.599538",
"0.59832394",
"0.59813315",
"0.59603006",
"0.5945617",
"0.59408545",
... | 0.0 | -1 |
Build score keeper if it is enabled via settings | def batali_build_score_keeper
if(batali_least_impact?)
Chef::Log.warn "Batali 'least impact resolution' is currently enabled!"
if(node[:batali] && node[:batali][:last_resolution])
Batali::ScoreKeeper.new(
:manifest => Batali::Manifest.new(
:cookbooks => node[:batali][:last_resolution].map{ |c_name, c_version|
Batali::Unit.new(
:name => c_name,
:version => c_version
)
}
)
)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_score_tree\n tree_nodes = []\n root_node = nil\n\n @nodes.each do |n|\n if n['key'] == 1\n root_node = build_node_from_model(n)\n root_node['parent_id'] = 0\n else\n tree_nodes.push(build_node_from_model(n))\n end\n end\n\n node_list = { 1 => root_node }... | [
"0.55239743",
"0.5172838",
"0.50185764",
"0.49578756",
"0.48621836",
"0.48131984",
"0.47761005",
"0.47544083",
"0.47504866",
"0.47458765",
"0.46919346",
"0.4677389",
"0.46730867",
"0.4667838",
"0.46658063",
"0.46630818",
"0.4653106",
"0.46260557",
"0.46077943",
"0.46077755",
... | 0.5560613 | 0 |
def text_decoder_instance Cardtec::TextDecoder.new(self) end | def update_from_text_decoder(text_decoder)
new_props = text_decoder.to_hash
labels = new_props.delete(:labels)
neo_id = new_props.delete(:neo_id)
new_and_old_props = neo_node.props.slice(*Cardtec::Node::PROPERTIES_TO_KEEP).merge(new_props.symbolize_keys)
neo_node.props = new_and_old_props
neo_node.set_label(*labels) if labels.present?
notify_to_after_save_listeners
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decoded_text\n @decoded_text ||= text.wukong_decode\n end",
"def decoded_text\n @decoded_text ||= text.wukong_decode\n end",
"def decode(text); end",
"def he_decode(text); self.class.he_decode text; end",
"def initialize(text)\n @text = text\n end",
"def initialize(text)\n @tex... | [
"0.6798471",
"0.6798471",
"0.6736987",
"0.64154917",
"0.6335317",
"0.6335317",
"0.6268227",
"0.6268227",
"0.6238657",
"0.6238657",
"0.6235681",
"0.5981813",
"0.59749764",
"0.5949045",
"0.58993727",
"0.58618313",
"0.5852969",
"0.58179134",
"0.5808291",
"0.5806802",
"0.5806802"... | 0.0 | -1 |
Function definitions Read in the names file | def readNames(path)
return File.read(path).rstrip.split(/\n/).map{|r| r.downcase.split(/\|/)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_functions src_file\n code = IO.readlines(src_file)\n functions = []\n puts src_file\n code.each do |line|\n /^\\s*def\\s+([^\\s\\(]+)\\s?.*/ =~ line\n functions << $1 if $1\n end \n functions\n end",
"def functions\r\n functions = {}\r\n current = []\r\n \r... | [
"0.66335344",
"0.6316705",
"0.62529147",
"0.6136073",
"0.6126373",
"0.59391606",
"0.59391606",
"0.5909518",
"0.5851262",
"0.5851262",
"0.5851262",
"0.5851262",
"0.5851262",
"0.5851262",
"0.5851262",
"0.57839864",
"0.5740372",
"0.56873727",
"0.5669565",
"0.5652784",
"0.5649223... | 0.5598702 | 24 |
Read in the table JSON | def readTable(path)
return JSON.parse(File.read(path).rstrip)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_table (filename)\n\t\t\tnew_table = File.open(filename)\n\t\t\t@file_table = JSON.load(new_table)\n\t\t\tnew_table.close\n\t\tend",
"def table\n self.class.read_and_parse_file(@table_path)\n end",
"def parse_json(json_)\n ::NTable.parse_json(json_)\n end",
"def get_data\n rais... | [
"0.7256125",
"0.69474566",
"0.6754364",
"0.66707605",
"0.64308697",
"0.6232659",
"0.60649",
"0.60297436",
"0.602133",
"0.5964239",
"0.5830802",
"0.5751797",
"0.56991273",
"0.56991273",
"0.5664855",
"0.5638613",
"0.56268764",
"0.56209123",
"0.5603976",
"0.55999094",
"0.5592211... | 0.80408955 | 0 |
Initialise the log entry | def initLog(data)
n = data[:names].join("; ")
l = data[:data].length
p = (l === 1) ? "y" : "ies"
return %Q_- NAME: #{n}\n #{l} matching entr#{p}\n_
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n @log = {}\n end",
"def initialize(*args)\n @init_args = args\n set_log(*args)\n end",
"def initialize\n\t\t@@logger = OMLogger.getLogger(DataHelper.name)\n\tend",
"def initialize\n Logging.setup(Logger::INFO)\n end",
"def init\n Logging.logger.root.l... | [
"0.7669621",
"0.72301805",
"0.7149161",
"0.6986685",
"0.69864684",
"0.69269675",
"0.6917172",
"0.69040227",
"0.68727",
"0.6856564",
"0.68003935",
"0.67769736",
"0.6755396",
"0.6751251",
"0.6697647",
"0.66729325",
"0.66460323",
"0.66335124",
"0.66169983",
"0.6610713",
"0.65660... | 0.0 | -1 |
Main function for processing entries | def processEntries(data)
# Initialise output hash and kick if no data
out = {:log => initLog(data), :data => String.new()}
# Loop over the data, if any
data[:data].each_with_index do |dat, i|
# Boot if frowns
if dat["smiles"].nil?
out[:log] += " No SMILES code for entry #{i + 1}\n"
next
end
# Get OpenBabel output
out[:data] += obabelOutput(data[:names].join("; "), dat["smiles"])
end
return out
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(entry); end",
"def entry; end",
"def entry; end",
"def entry; end",
"def entry; end",
"def process_entry(entry)\n # No-op.\n end",
"def entries() end",
"def entry_filter; end",
"def print_entry(entry)\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }... | [
"0.70323396",
"0.6874803",
"0.6874803",
"0.6874803",
"0.6874803",
"0.6866741",
"0.6630906",
"0.6250296",
"0.62387204",
"0.62174827",
"0.62174827",
"0.62174827",
"0.62174827",
"0.6196818",
"0.61786914",
"0.6147069",
"0.6114427",
"0.60086113",
"0.59967196",
"0.59581983",
"0.589... | 0.61355317 | 16 |
Get required output from OpenBabel conversion operation | def obabelOutput(name, smiles)
insert = %Q_> <id>\n#{smiles}\n\n> <Name>\n#{name}\n\n$$$$_
response = %x_obabel -:"#{smiles}" -osdf --gen2D_.rstrip.split(/\n/)
response[-1] = insert
return response.join("\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output\n return @output if @output\n\n convert!\n @output\n end",
"def convert(output, args={})\n tokens = [\"convert\"]\n tokens << convert_to_arguments(args) if args\n tokens << \" '#{@file}#{\"[#{args[:layer].to_s}]\" if args[:layer]}'\"\n tokens << \" -annotate #{ar... | [
"0.60510087",
"0.5810248",
"0.5746399",
"0.5596033",
"0.5486675",
"0.5486675",
"0.54468",
"0.5444783",
"0.53817195",
"0.53817195",
"0.53817195",
"0.53817195",
"0.53817195",
"0.53817195",
"0.53817195",
"0.53817195",
"0.53817195",
"0.53817195",
"0.53817195",
"0.53817195",
"0.53... | 0.52790856 | 25 |
Set the "slimmer headers" to configure the page | def set_slimmer_headers(hash)
raise InvalidHeader if (hash.keys - SLIMMER_HEADER_MAPPING.keys).any?
SLIMMER_HEADER_MAPPING.each do |hash_key, header_suffix|
value = hash[hash_key]
headers["#{HEADER_PREFIX}-#{header_suffix}"] = value.to_s if value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_headers! session = nil\n response.headers['sid'] = session.id\n response.headers['utoken'] = session.utoken\n end",
"def add_headers; end",
"def show_headers=(value)\n @show_headers = value\n end",
"def on_header_init()\n end",
"def kopal_layout_before_page_heade... | [
"0.64804345",
"0.61778986",
"0.6094569",
"0.60413307",
"0.6010624",
"0.6004721",
"0.59677815",
"0.5965604",
"0.59422946",
"0.59367436",
"0.5924764",
"0.59143287",
"0.59120494",
"0.5895154",
"0.5886509",
"0.5886509",
"0.5886509",
"0.5886509",
"0.5886509",
"0.5886509",
"0.58865... | 0.63729626 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_langual_factor
@langual_factor = LangualFactor.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 |
Only allow a trusted parameter "white list" through. | def langual_factor_params
params.require(:langual_factor).permit(:description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
For this example, we are simply using token authentication via parameters. However, anyone could use Rails's token authentication features to get the token from a header. | def authenticate_user_from_token!
user_email = params[:user_email].presence
user = user_email && User.find_by_email(user_email)
# Notice we are passing store false, so the user is not
# actually stored in the session and a token is needed
# for every request. If you want the token to work as a
# sign in token, you can simply remove store: false.
if user && Devise.secure_compare(user.auth_token, params[:auth_token])
sign_in user, store: false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token\n request.headers[\"Authorization\"]\n end",
"def token\n request.headers['Authorization']\n end",
"def token(request)\n end",
"def get_token\n request.headers[\"Authorization\"]\n end",
"def token(auth_code = T.unsafe(nil), headers = T.unsafe(nil)); end",
"def auth_header # gets t... | [
"0.78677654",
"0.7867661",
"0.77609175",
"0.7755275",
"0.76498723",
"0.75415516",
"0.73891926",
"0.7334458",
"0.7309852",
"0.7240654",
"0.72284627",
"0.72151905",
"0.7183141",
"0.7169413",
"0.71585006",
"0.7144371",
"0.7143278",
"0.7142817",
"0.71351194",
"0.71279824",
"0.711... | 0.0 | -1 |
Delete L2 Bridge Endpoint Profile API will delete L2 bridge profile with ID profileid | def delete_l2_bridge_profile(site_id, enforcement_point_id, profile_id, opts = {})
delete_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @profile.destroy\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n end",
"def delete_profile( profile_name )\n delete_all_accessors(profile_name)\n\n profile_id = find_profile_id( profile_name )\n response = Faraday.get do |req|\n re... | [
"0.73535186",
"0.73372966",
"0.7275864",
"0.7172895",
"0.70331097",
"0.6998336",
"0.69751936",
"0.6962235",
"0.6958074",
"0.69547355",
"0.6954444",
"0.6954444",
"0.6954444",
"0.6952455",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6940198",
"0.6940198"... | 0.0 | -1 |
Delete L2 Bridge Endpoint Profile API will delete L2 bridge profile with ID profileid | def delete_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.delete_l2_bridge_profile ...'
end
# verify the required parameter 'site_id' is set
if @api_client.config.client_side_validation && site_id.nil?
fail ArgumentError, "Missing the required parameter 'site_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.delete_l2_bridge_profile"
end
# verify the required parameter 'enforcement_point_id' is set
if @api_client.config.client_side_validation && enforcement_point_id.nil?
fail ArgumentError, "Missing the required parameter 'enforcement_point_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.delete_l2_bridge_profile"
end
# verify the required parameter 'profile_id' is set
if @api_client.config.client_side_validation && profile_id.nil?
fail ArgumentError, "Missing the required parameter 'profile_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.delete_l2_bridge_profile"
end
# resource path
local_var_path = '/global-infra/sites/{site-id}/enforcement-points/{enforcement-point-id}/edge-bridge-profiles/{profile-id}'.sub('{' + 'site-id' + '}', site_id.to_s).sub('{' + 'enforcement-point-id' + '}', enforcement_point_id.to_s).sub('{' + 'profile-id' + '}', profile_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 = nil
auth_names = ['BasicAuth']
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: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi#delete_l2_bridge_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @profile.destroy\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n end",
"def delete_profile( profile_name )\n delete_all_accessors(profile_name)\n\n profile_id = find_profile_id( profile_name )\n response = Faraday.get do |req|\n re... | [
"0.73535186",
"0.73372966",
"0.7275864",
"0.7172895",
"0.70331097",
"0.6998336",
"0.69751936",
"0.6962235",
"0.6958074",
"0.69547355",
"0.6954444",
"0.6954444",
"0.6954444",
"0.6952455",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6940198",
"0.6940198"... | 0.0 | -1 |
Delete L2 Bridge Endpoint Profile API will delete L2 bridge profile with ID profileid | def delete_l2_bridge_profile_0(site_id, enforcement_point_id, profile_id, opts = {})
delete_l2_bridge_profile_0_with_http_info(site_id, enforcement_point_id, profile_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @profile.destroy\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n end",
"def delete_profile( profile_name )\n delete_all_accessors(profile_name)\n\n profile_id = find_profile_id( profile_name )\n response = Faraday.get do |req|\n re... | [
"0.73535186",
"0.73372966",
"0.7275864",
"0.7172895",
"0.70331097",
"0.6998336",
"0.69751936",
"0.6962235",
"0.6958074",
"0.69547355",
"0.6954444",
"0.6954444",
"0.6954444",
"0.6952455",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6940198",
"0.6940198"... | 0.67776114 | 66 |
Delete L2 Bridge Endpoint Profile API will delete L2 bridge profile with ID profileid | def delete_l2_bridge_profile_0_with_http_info(site_id, enforcement_point_id, profile_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.delete_l2_bridge_profile_0 ...'
end
# verify the required parameter 'site_id' is set
if @api_client.config.client_side_validation && site_id.nil?
fail ArgumentError, "Missing the required parameter 'site_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.delete_l2_bridge_profile_0"
end
# verify the required parameter 'enforcement_point_id' is set
if @api_client.config.client_side_validation && enforcement_point_id.nil?
fail ArgumentError, "Missing the required parameter 'enforcement_point_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.delete_l2_bridge_profile_0"
end
# verify the required parameter 'profile_id' is set
if @api_client.config.client_side_validation && profile_id.nil?
fail ArgumentError, "Missing the required parameter 'profile_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.delete_l2_bridge_profile_0"
end
# resource path
local_var_path = '/infra/sites/{site-id}/enforcement-points/{enforcement-point-id}/edge-bridge-profiles/{profile-id}'.sub('{' + 'site-id' + '}', site_id.to_s).sub('{' + 'enforcement-point-id' + '}', enforcement_point_id.to_s).sub('{' + 'profile-id' + '}', profile_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 = nil
auth_names = ['BasicAuth']
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: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi#delete_l2_bridge_profile_0\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @profile.destroy\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n end",
"def delete_profile( profile_name )\n delete_all_accessors(profile_name)\n\n profile_id = find_profile_id( profile_name )\n response = Faraday.get do |req|\n re... | [
"0.73535186",
"0.73372966",
"0.7275864",
"0.7172895",
"0.70331097",
"0.6998336",
"0.69751936",
"0.6962235",
"0.6958074",
"0.69547355",
"0.6954444",
"0.6954444",
"0.6954444",
"0.6952455",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6952046",
"0.6940198",
"0.6940198"... | 0.0 | -1 |
List L2 Bridge Endpoint Profiles List all L2 bridge profiles | def list_l2_bridge_profiles(site_id, enforcement_point_id, opts = {})
data, _status_code, _headers = list_l2_bridge_profiles_with_http_info(site_id, enforcement_point_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_app_profiles instance_id\n execute do\n instances.list_app_profiles(\n instance_path(instance_id)\n )\n end\n end",
"def fetch_profiles\n UI.message \"Fetching profiles...#{Sigh.config[:app_identifier]}\"\n results = profile_type.find... | [
"0.622121",
"0.6171837",
"0.613318",
"0.61215836",
"0.6089443",
"0.6062317",
"0.5965883",
"0.59603125",
"0.59340954",
"0.59097725",
"0.58970654",
"0.5877867",
"0.5876824",
"0.5838917",
"0.5827292",
"0.58270675",
"0.5821021",
"0.57649034",
"0.5748111",
"0.5683791",
"0.56539446... | 0.610758 | 4 |
List L2 Bridge Endpoint Profiles List all L2 bridge profiles | def list_l2_bridge_profiles_with_http_info(site_id, enforcement_point_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.list_l2_bridge_profiles ...'
end
# verify the required parameter 'site_id' is set
if @api_client.config.client_side_validation && site_id.nil?
fail ArgumentError, "Missing the required parameter 'site_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.list_l2_bridge_profiles"
end
# verify the required parameter 'enforcement_point_id' is set
if @api_client.config.client_side_validation && enforcement_point_id.nil?
fail ArgumentError, "Missing the required parameter 'enforcement_point_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.list_l2_bridge_profiles"
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.list_l2_bridge_profiles, must be smaller than or equal to 1000.'
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.list_l2_bridge_profiles, must be greater than or equal to 0.'
end
# resource path
local_var_path = '/global-infra/sites/{site-id}/enforcement-points/{enforcement-point-id}/edge-bridge-profiles'.sub('{' + 'site-id' + '}', site_id.to_s).sub('{' + 'enforcement-point-id' + '}', enforcement_point_id.to_s)
# query parameters
query_params = {}
query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?
query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?
query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
# 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 = nil
auth_names = ['BasicAuth']
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 => 'L2BridgeEndpointProfileListResult')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi#list_l2_bridge_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_app_profiles instance_id\n execute do\n instances.list_app_profiles(\n instance_path(instance_id)\n )\n end\n end",
"def fetch_profiles\n UI.message \"Fetching profiles...#{Sigh.config[:app_identifier]}\"\n results = profile_type.find... | [
"0.622121",
"0.6171837",
"0.613318",
"0.61215836",
"0.610758",
"0.6089443",
"0.6062317",
"0.5965883",
"0.59603125",
"0.59340954",
"0.59097725",
"0.58970654",
"0.5877867",
"0.5876824",
"0.5838917",
"0.5827292",
"0.58270675",
"0.5821021",
"0.5748111",
"0.5683791",
"0.56539446",... | 0.57649034 | 18 |
List L2 Bridge Endpoint Profiles List all L2 bridge profiles | def list_l2_bridge_profiles_0(site_id, enforcement_point_id, opts = {})
data, _status_code, _headers = list_l2_bridge_profiles_0_with_http_info(site_id, enforcement_point_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_app_profiles instance_id\n execute do\n instances.list_app_profiles(\n instance_path(instance_id)\n )\n end\n end",
"def fetch_profiles\n UI.message \"Fetching profiles...#{Sigh.config[:app_identifier]}\"\n results = profile_type.find... | [
"0.622121",
"0.6171837",
"0.613318",
"0.61215836",
"0.610758",
"0.6089443",
"0.6062317",
"0.5965883",
"0.59603125",
"0.59340954",
"0.59097725",
"0.58970654",
"0.5877867",
"0.5876824",
"0.5838917",
"0.5827292",
"0.58270675",
"0.5821021",
"0.57649034",
"0.5748111",
"0.5683791",... | 0.5637352 | 23 |
List L2 Bridge Endpoint Profiles List all L2 bridge profiles | def list_l2_bridge_profiles_0_with_http_info(site_id, enforcement_point_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.list_l2_bridge_profiles_0 ...'
end
# verify the required parameter 'site_id' is set
if @api_client.config.client_side_validation && site_id.nil?
fail ArgumentError, "Missing the required parameter 'site_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.list_l2_bridge_profiles_0"
end
# verify the required parameter 'enforcement_point_id' is set
if @api_client.config.client_side_validation && enforcement_point_id.nil?
fail ArgumentError, "Missing the required parameter 'enforcement_point_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.list_l2_bridge_profiles_0"
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.list_l2_bridge_profiles_0, must be smaller than or equal to 1000.'
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.list_l2_bridge_profiles_0, must be greater than or equal to 0.'
end
# resource path
local_var_path = '/infra/sites/{site-id}/enforcement-points/{enforcement-point-id}/edge-bridge-profiles'.sub('{' + 'site-id' + '}', site_id.to_s).sub('{' + 'enforcement-point-id' + '}', enforcement_point_id.to_s)
# query parameters
query_params = {}
query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?
query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?
query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
# 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 = nil
auth_names = ['BasicAuth']
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 => 'L2BridgeEndpointProfileListResult')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi#list_l2_bridge_profiles_0\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_app_profiles instance_id\n execute do\n instances.list_app_profiles(\n instance_path(instance_id)\n )\n end\n end",
"def fetch_profiles\n UI.message \"Fetching profiles...#{Sigh.config[:app_identifier]}\"\n results = profile_type.find... | [
"0.622121",
"0.6171837",
"0.613318",
"0.61215836",
"0.610758",
"0.6089443",
"0.6062317",
"0.5965883",
"0.59603125",
"0.59340954",
"0.59097725",
"0.58970654",
"0.5877867",
"0.5876824",
"0.5838917",
"0.5827292",
"0.58270675",
"0.5821021",
"0.57649034",
"0.5748111",
"0.5683791",... | 0.56066656 | 28 |
Create or update L2 Bridge Endpoint Profile API will create or update L2 bridge profile with ID profileid. L2 Bridge profile is only allowed under an enforcementpoint with path /infra/sites/default/enforcementpoints/default. | def patch_l2_bridge_profile(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})
patch_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile ...'\n ... | [
"0.74398065",
"0.74231076",
"0.72141737",
"0.7182919",
"0.7162661",
"0.713989",
"0.67805517",
"0.6753361",
"0.6525983",
"0.65237695",
"0.64346457",
"0.6292789",
"0.6265245",
"0.6153511",
"0.60907227",
"0.6079858",
"0.60353255",
"0.6019991",
"0.5993825",
"0.5971388",
"0.595140... | 0.68753177 | 6 |
Create or update L2 Bridge Endpoint Profile API will create or update L2 bridge profile with ID profileid. L2 Bridge profile is only allowed under an enforcementpoint with path /infra/sites/default/enforcementpoints/default. | def patch_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.patch_l2_bridge_profile ...'
end
# verify the required parameter 'site_id' is set
if @api_client.config.client_side_validation && site_id.nil?
fail ArgumentError, "Missing the required parameter 'site_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.patch_l2_bridge_profile"
end
# verify the required parameter 'enforcement_point_id' is set
if @api_client.config.client_side_validation && enforcement_point_id.nil?
fail ArgumentError, "Missing the required parameter 'enforcement_point_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.patch_l2_bridge_profile"
end
# verify the required parameter 'profile_id' is set
if @api_client.config.client_side_validation && profile_id.nil?
fail ArgumentError, "Missing the required parameter 'profile_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.patch_l2_bridge_profile"
end
# verify the required parameter 'l2_bridge_endpoint_profile' is set
if @api_client.config.client_side_validation && l2_bridge_endpoint_profile.nil?
fail ArgumentError, "Missing the required parameter 'l2_bridge_endpoint_profile' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.patch_l2_bridge_profile"
end
# resource path
local_var_path = '/global-infra/sites/{site-id}/enforcement-points/{enforcement-point-id}/edge-bridge-profiles/{profile-id}'.sub('{' + 'site-id' + '}', site_id.to_s).sub('{' + 'enforcement-point-id' + '}', enforcement_point_id.to_s).sub('{' + 'profile-id' + '}', profile_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(l2_bridge_endpoint_profile)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PATCH, 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: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi#patch_l2_bridge_profile\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_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile ...'\n ... | [
"0.7440173",
"0.74238",
"0.7183777",
"0.7162514",
"0.7139919",
"0.68746734",
"0.6780593",
"0.67534924",
"0.6525527",
"0.65236706",
"0.6434839",
"0.6292552",
"0.626511",
"0.6154161",
"0.60921836",
"0.6080533",
"0.6035727",
"0.60206205",
"0.59959066",
"0.59720224",
"0.5951914",... | 0.72147363 | 2 |
Create or update L2 Bridge Endpoint Profile API will create or update L2 bridge profile with ID profileid. L2 Bridge profile is only allowed under an enforcementpoint with path /infra/sites/default/enforcementpoints/default. | def patch_l2_bridge_profile_0(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})
patch_l2_bridge_profile_0_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile ...'\n ... | [
"0.74412334",
"0.7424626",
"0.7215516",
"0.7184345",
"0.7162582",
"0.68752944",
"0.6781651",
"0.675443",
"0.65255797",
"0.6524788",
"0.6435752",
"0.6294121",
"0.6266573",
"0.61533517",
"0.6092006",
"0.6080814",
"0.6036426",
"0.6019085",
"0.5995237",
"0.59725",
"0.59515077",
... | 0.714014 | 5 |
Create or update L2 Bridge Endpoint Profile API will create or update L2 bridge profile with ID profileid. L2 Bridge profile is only allowed under an enforcementpoint with path /infra/sites/default/enforcementpoints/default. | def patch_l2_bridge_profile_0_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.patch_l2_bridge_profile_0 ...'
end
# verify the required parameter 'site_id' is set
if @api_client.config.client_side_validation && site_id.nil?
fail ArgumentError, "Missing the required parameter 'site_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.patch_l2_bridge_profile_0"
end
# verify the required parameter 'enforcement_point_id' is set
if @api_client.config.client_side_validation && enforcement_point_id.nil?
fail ArgumentError, "Missing the required parameter 'enforcement_point_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.patch_l2_bridge_profile_0"
end
# verify the required parameter 'profile_id' is set
if @api_client.config.client_side_validation && profile_id.nil?
fail ArgumentError, "Missing the required parameter 'profile_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.patch_l2_bridge_profile_0"
end
# verify the required parameter 'l2_bridge_endpoint_profile' is set
if @api_client.config.client_side_validation && l2_bridge_endpoint_profile.nil?
fail ArgumentError, "Missing the required parameter 'l2_bridge_endpoint_profile' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.patch_l2_bridge_profile_0"
end
# resource path
local_var_path = '/infra/sites/{site-id}/enforcement-points/{enforcement-point-id}/edge-bridge-profiles/{profile-id}'.sub('{' + 'site-id' + '}', site_id.to_s).sub('{' + 'enforcement-point-id' + '}', enforcement_point_id.to_s).sub('{' + 'profile-id' + '}', profile_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(l2_bridge_endpoint_profile)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PATCH, 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: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi#patch_l2_bridge_profile_0\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_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile ...'\n ... | [
"0.7441519",
"0.7424836",
"0.7215665",
"0.71624964",
"0.7139739",
"0.6875108",
"0.6781137",
"0.67538905",
"0.65258217",
"0.65243983",
"0.64351976",
"0.629415",
"0.6266634",
"0.615254",
"0.60908175",
"0.60808843",
"0.6036305",
"0.60189813",
"0.5993805",
"0.5972299",
"0.595081"... | 0.71844035 | 3 |
Get L2 Bridge Endpoint Profile Read L2 bridge profile with ID profileid | def read_l2_bridge_profile(site_id, enforcement_point_id, profile_id, opts = {})
data, _status_code, _headers = read_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end",
"def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end",
"def profile; Profile.get(se... | [
"0.7228726",
"0.72203064",
"0.6971988",
"0.69307995",
"0.6919285",
"0.68600434",
"0.681343",
"0.6758999",
"0.67305",
"0.66180146",
"0.66109884",
"0.66056293",
"0.65936095",
"0.6586344",
"0.65701485",
"0.6568907",
"0.65557253",
"0.65474814",
"0.6527027",
"0.6517917",
"0.647713... | 0.6773237 | 7 |
Get L2 Bridge Endpoint Profile Read L2 bridge profile with ID profileid | def read_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.read_l2_bridge_profile ...'
end
# verify the required parameter 'site_id' is set
if @api_client.config.client_side_validation && site_id.nil?
fail ArgumentError, "Missing the required parameter 'site_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.read_l2_bridge_profile"
end
# verify the required parameter 'enforcement_point_id' is set
if @api_client.config.client_side_validation && enforcement_point_id.nil?
fail ArgumentError, "Missing the required parameter 'enforcement_point_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.read_l2_bridge_profile"
end
# verify the required parameter 'profile_id' is set
if @api_client.config.client_side_validation && profile_id.nil?
fail ArgumentError, "Missing the required parameter 'profile_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.read_l2_bridge_profile"
end
# resource path
local_var_path = '/global-infra/sites/{site-id}/enforcement-points/{enforcement-point-id}/edge-bridge-profiles/{profile-id}'.sub('{' + 'site-id' + '}', site_id.to_s).sub('{' + 'enforcement-point-id' + '}', enforcement_point_id.to_s).sub('{' + 'profile-id' + '}', profile_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 = nil
auth_names = ['BasicAuth']
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 => 'L2BridgeEndpointProfile')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi#read_l2_bridge_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end",
"def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end",
"def profile; Profile.get(se... | [
"0.7228726",
"0.72203064",
"0.6971988",
"0.69307995",
"0.6919285",
"0.68600434",
"0.681343",
"0.6773237",
"0.6758999",
"0.67305",
"0.66180146",
"0.66109884",
"0.66056293",
"0.65936095",
"0.6586344",
"0.65701485",
"0.6568907",
"0.65557253",
"0.65474814",
"0.6527027",
"0.647713... | 0.6517917 | 20 |
Get L2 Bridge Endpoint Profile Read L2 bridge profile with ID profileid | def read_l2_bridge_profile_0(site_id, enforcement_point_id, profile_id, opts = {})
data, _status_code, _headers = read_l2_bridge_profile_0_with_http_info(site_id, enforcement_point_id, profile_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end",
"def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end",
"def profile; Profile.get(se... | [
"0.7228726",
"0.72203064",
"0.6971988",
"0.69307995",
"0.6919285",
"0.68600434",
"0.681343",
"0.6773237",
"0.6758999",
"0.67305",
"0.66180146",
"0.66109884",
"0.66056293",
"0.65936095",
"0.6586344",
"0.65701485",
"0.6568907",
"0.65474814",
"0.6527027",
"0.6517917",
"0.647713"... | 0.65557253 | 17 |
Get L2 Bridge Endpoint Profile Read L2 bridge profile with ID profileid | def read_l2_bridge_profile_0_with_http_info(site_id, enforcement_point_id, profile_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.read_l2_bridge_profile_0 ...'
end
# verify the required parameter 'site_id' is set
if @api_client.config.client_side_validation && site_id.nil?
fail ArgumentError, "Missing the required parameter 'site_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.read_l2_bridge_profile_0"
end
# verify the required parameter 'enforcement_point_id' is set
if @api_client.config.client_side_validation && enforcement_point_id.nil?
fail ArgumentError, "Missing the required parameter 'enforcement_point_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.read_l2_bridge_profile_0"
end
# verify the required parameter 'profile_id' is set
if @api_client.config.client_side_validation && profile_id.nil?
fail ArgumentError, "Missing the required parameter 'profile_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.read_l2_bridge_profile_0"
end
# resource path
local_var_path = '/infra/sites/{site-id}/enforcement-points/{enforcement-point-id}/edge-bridge-profiles/{profile-id}'.sub('{' + 'site-id' + '}', site_id.to_s).sub('{' + 'enforcement-point-id' + '}', enforcement_point_id.to_s).sub('{' + 'profile-id' + '}', profile_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 = nil
auth_names = ['BasicAuth']
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 => 'L2BridgeEndpointProfile')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi#read_l2_bridge_profile_0\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end",
"def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end",
"def profile; Profile.get(se... | [
"0.7228726",
"0.72203064",
"0.6971988",
"0.69307995",
"0.6919285",
"0.68600434",
"0.681343",
"0.6773237",
"0.6758999",
"0.67305",
"0.66180146",
"0.66109884",
"0.66056293",
"0.65936095",
"0.6586344",
"0.65701485",
"0.6568907",
"0.65557253",
"0.65474814",
"0.6527027",
"0.651791... | 0.6460488 | 23 |
Create or update L2 Bridge Endpoint Profile API will create or update L2 bridge profile with ID profileid. L2 Bridge profile is only allowed under an enforcementpoint with path /infra/sites/default/enforcementpoints/default. | def update_l2_bridge_profile(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})
data, _status_code, _headers = update_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile ...'\n ... | [
"0.74398065",
"0.74231076",
"0.72141737",
"0.7182919",
"0.7162661",
"0.713989",
"0.68753177",
"0.67805517",
"0.6753361",
"0.65237695",
"0.64346457",
"0.6292789",
"0.6265245",
"0.6153511",
"0.60907227",
"0.6079858",
"0.60353255",
"0.6019991",
"0.5993825",
"0.5971388",
"0.59514... | 0.6525983 | 9 |
Create or update L2 Bridge Endpoint Profile API will create or update L2 bridge profile with ID profileid. L2 Bridge profile is only allowed under an enforcementpoint with path /infra/sites/default/enforcementpoints/default. | def update_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile ...'
end
# verify the required parameter 'site_id' is set
if @api_client.config.client_side_validation && site_id.nil?
fail ArgumentError, "Missing the required parameter 'site_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile"
end
# verify the required parameter 'enforcement_point_id' is set
if @api_client.config.client_side_validation && enforcement_point_id.nil?
fail ArgumentError, "Missing the required parameter 'enforcement_point_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile"
end
# verify the required parameter 'profile_id' is set
if @api_client.config.client_side_validation && profile_id.nil?
fail ArgumentError, "Missing the required parameter 'profile_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile"
end
# verify the required parameter 'l2_bridge_endpoint_profile' is set
if @api_client.config.client_side_validation && l2_bridge_endpoint_profile.nil?
fail ArgumentError, "Missing the required parameter 'l2_bridge_endpoint_profile' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile"
end
# resource path
local_var_path = '/global-infra/sites/{site-id}/enforcement-points/{enforcement-point-id}/edge-bridge-profiles/{profile-id}'.sub('{' + 'site-id' + '}', site_id.to_s).sub('{' + 'enforcement-point-id' + '}', enforcement_point_id.to_s).sub('{' + 'profile-id' + '}', profile_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(l2_bridge_endpoint_profile)
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 => 'L2BridgeEndpointProfile')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi#update_l2_bridge_profile\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_l2_bridge_profile_0_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile_0 ...'\n ... | [
"0.74238",
"0.72147363",
"0.7183777",
"0.7162514",
"0.7139919",
"0.68746734",
"0.6780593",
"0.67534924",
"0.6525527",
"0.65236706",
"0.6434839",
"0.6292552",
"0.626511",
"0.6154161",
"0.60921836",
"0.6080533",
"0.6035727",
"0.60206205",
"0.59959066",
"0.59720224",
"0.5951914"... | 0.7440173 | 0 |
Create or update L2 Bridge Endpoint Profile API will create or update L2 bridge profile with ID profileid. L2 Bridge profile is only allowed under an enforcementpoint with path /infra/sites/default/enforcementpoints/default. | def update_l2_bridge_profile_0(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})
data, _status_code, _headers = update_l2_bridge_profile_0_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile ...'\n ... | [
"0.74412334",
"0.7424626",
"0.7215516",
"0.7184345",
"0.714014",
"0.68752944",
"0.6781651",
"0.675443",
"0.65255797",
"0.6524788",
"0.6435752",
"0.6294121",
"0.6266573",
"0.61533517",
"0.6092006",
"0.6080814",
"0.6036426",
"0.6019085",
"0.5995237",
"0.59725",
"0.59515077",
... | 0.7162582 | 4 |
Create or update L2 Bridge Endpoint Profile API will create or update L2 bridge profile with ID profileid. L2 Bridge profile is only allowed under an enforcementpoint with path /infra/sites/default/enforcementpoints/default. | def update_l2_bridge_profile_0_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile_0 ...'
end
# verify the required parameter 'site_id' is set
if @api_client.config.client_side_validation && site_id.nil?
fail ArgumentError, "Missing the required parameter 'site_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile_0"
end
# verify the required parameter 'enforcement_point_id' is set
if @api_client.config.client_side_validation && enforcement_point_id.nil?
fail ArgumentError, "Missing the required parameter 'enforcement_point_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile_0"
end
# verify the required parameter 'profile_id' is set
if @api_client.config.client_side_validation && profile_id.nil?
fail ArgumentError, "Missing the required parameter 'profile_id' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile_0"
end
# verify the required parameter 'l2_bridge_endpoint_profile' is set
if @api_client.config.client_side_validation && l2_bridge_endpoint_profile.nil?
fail ArgumentError, "Missing the required parameter 'l2_bridge_endpoint_profile' when calling PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile_0"
end
# resource path
local_var_path = '/infra/sites/{site-id}/enforcement-points/{enforcement-point-id}/edge-bridge-profiles/{profile-id}'.sub('{' + 'site-id' + '}', site_id.to_s).sub('{' + 'enforcement-point-id' + '}', enforcement_point_id.to_s).sub('{' + 'profile-id' + '}', profile_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(l2_bridge_endpoint_profile)
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 => 'L2BridgeEndpointProfile')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi#update_l2_bridge_profile_0\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_l2_bridge_profile_with_http_info(site_id, enforcement_point_id, profile_id, l2_bridge_endpoint_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsEdgeBridgeProfilesApi.update_l2_bridge_profile ...'\n ... | [
"0.7441519",
"0.7215665",
"0.71844035",
"0.71624964",
"0.7139739",
"0.6875108",
"0.6781137",
"0.67538905",
"0.65258217",
"0.65243983",
"0.64351976",
"0.629415",
"0.6266634",
"0.615254",
"0.60908175",
"0.60808843",
"0.6036305",
"0.60189813",
"0.5993805",
"0.5972299",
"0.595081... | 0.7424836 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.