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 |
|---|---|---|---|---|---|---|
Renders the passed attr with a link to the show action for the current entry. A block may be given to define the link path for the row entry. | def col_show(table, attr, &block)
table.attr(attr, table.sort_header(attr)) do |e|
link_to(format_attr(e, attr), action_path(e, &block))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link(**opt)\n opt[:path] = show_path(id: object.identifier)\n super(**opt)\n end",
"def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end",
"def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"li... | [
"0.6564911",
"0.6518258",
"0.6518258",
"0.6109622",
"0.6035642",
"0.5927493",
"0.59167856",
"0.58894664",
"0.5859699",
"0.5800829",
"0.57670516",
"0.5765323",
"0.57456344",
"0.57155037",
"0.57113117",
"0.5708713",
"0.56677127",
"0.56396294",
"0.5632076",
"0.5614726",
"0.55943... | 0.77146125 | 0 |
Action link to show the row entry inside a table. A block may be given to define the link path for the row entry. | def action_col_show(table, &block)
action_col(table) do |e|
link_table_action('zoom-in', action_path(e, &block))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row(row_id); get(\"#{link('rows')}/#{row_id}\"); end",
"def col_show(table, attr, &block)\n table.attr(attr, table.sort_header(attr)) do |e| \n link_to(format_attr(e, attr), action_path(e, &block))\n end\n end",
"def action_col_show(table, &block)\n action_col(table) { |e| link_table_action(... | [
"0.66657925",
"0.6494846",
"0.6316912",
"0.62980616",
"0.6172614",
"0.6172614",
"0.601025",
"0.5869467",
"0.586942",
"0.5764227",
"0.5764227",
"0.5711135",
"0.56855345",
"0.5682822",
"0.5682309",
"0.56200075",
"0.55924344",
"0.5583496",
"0.55549395",
"0.55393124",
"0.5508647"... | 0.6368461 | 2 |
Action link to edit inside a table. A block may be given to define the link path for the row entry. | def action_col_edit(table, &block)
action_col(table) do |e|
path = action_path(e, &block)
link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end",
"def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path... | [
"0.7418714",
"0.7418714",
"0.7009814",
"0.6940941",
"0.6645491",
"0.65837044",
"0.6402713",
"0.6399663",
"0.6365207",
"0.63572574",
"0.63572574",
"0.63283",
"0.6326858",
"0.62960666",
"0.6292471",
"0.62249035",
"0.620171",
"0.6176942",
"0.6176942",
"0.61269784",
"0.61239785",... | 0.8110266 | 1 |
Action link to destroy inside a table. A block may be given to define the link path for the row entry. | def action_col_destroy(table, &block)
action_col(table) do |e|
link_table_action('remove', action_path(e, &block),
:data => { :confirm => ti(:confirm_delete),
:method => :delete })
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_col_destroy(table, &block)\n action_col(table) do |e|\n link_table_action('remove', action_path(e, &block),\n :confirm => ti(:confirm_delete),\n :method => :delete)\n end\n end",
"def link_action_destroy(path = nil)\n path ||= path_args(entr... | [
"0.78386474",
"0.70801383",
"0.7050985",
"0.6635237",
"0.6559301",
"0.64729893",
"0.6380505",
"0.6367818",
"0.6340585",
"0.63159376",
"0.6255097",
"0.6192836",
"0.6137068",
"0.6099586",
"0.60969186",
"0.60541767",
"0.60522157",
"0.6030391",
"0.60214126",
"0.6015478",
"0.60099... | 0.782632 | 1 |
Generic action link inside a table. | def link_table_action(icon, url, html_options = {})
add_css_class html_options, "icon-#{icon}"
link_to('', url, html_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_data_link(logged_in_user, title, action)\n if logged_in_user\n if action == \"Edit\"\n\"<td> <a href=/titles/#{title.id.to_s}/edit>#{action}</a> </td>\".html_safe\n elsif action == \"Delete\"\n\"<td> <a href=/titles/#{title.id.to_s}/delete>#{action}</a> </td>\".html_safe\n else\n e... | [
"0.7599486",
"0.7441103",
"0.74272674",
"0.6810069",
"0.6810069",
"0.66832507",
"0.66182244",
"0.66063905",
"0.64828694",
"0.64828694",
"0.6332754",
"0.6296523",
"0.6293951",
"0.6220653",
"0.61772686",
"0.6142519",
"0.6115107",
"0.60924137",
"0.6052146",
"0.6036665",
"0.60336... | 0.74432373 | 2 |
Defines a column with an action link. | def action_col(table, &block)
table.col('', :class => 'action', &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_column(options={}, &block)\n case mode\n when :header\n \"<th>#{I18n.t(:'link.actions')}</th>\".html_safe\n when :content\n td_options = options[:td_options] || {}\n td_options[:class] = [td_options[:class]].flatten || []\n td_options[... | [
"0.68659335",
"0.6676235",
"0.6676235",
"0.6626017",
"0.65914094",
"0.65518653",
"0.64810014",
"0.64810014",
"0.6111127",
"0.6082752",
"0.60673535",
"0.6035074",
"0.6002753",
"0.5996383",
"0.59883153",
"0.5952024",
"0.59111124",
"0.59095824",
"0.5807181",
"0.5792581",
"0.5704... | 0.7094079 | 1 |
ACTION LINKS :nodoc: Standard link action to the show page of a given record. Uses the current record if none is given. | def link_action_show(path = nil)
path ||= path_args(entry)
link_action ti(:"link.show"), 'zoom-in', path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link(**opt)\n opt[:path] = show_path(id: object.identifier)\n super(**opt)\n end",
"def link_to_show(text, path, options={})\n link_to_action(text, path, options.reverse_merge(:action => :show))\n end",
"def link\n\t\tpage_id.present? ? short_page_path(Page.find(page_id)) : href\n\tend",
"def ... | [
"0.6470081",
"0.64369476",
"0.6305149",
"0.62784165",
"0.6152702",
"0.61308247",
"0.61293757",
"0.6118188",
"0.610357",
"0.60206217",
"0.60050935",
"0.59638166",
"0.5927874",
"0.59247965",
"0.59086144",
"0.58844644",
"0.5835034",
"0.58156013",
"0.5803757",
"0.57960385",
"0.57... | 0.6059773 | 10 |
Standard link action to the edit page of a given record. Uses the current record if none is given. | def link_action_edit(path = nil)
path ||= path_args(entry)
link_action ti(:"link.edit"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def button_to_edit(record, options={})\n button_to_action record, :edit, options\n end",
"def edit\n @record = Record.find(params[:id])\n end",
"def edit\n resource.before_actions[:edit].call(@record) if resource.before_actions[:edit]\n end",
"def edit_link(obj, options = {})\n i... | [
"0.7420026",
"0.7184157",
"0.71270794",
"0.7106863",
"0.7043936",
"0.69979936",
"0.69696784",
"0.68517655",
"0.6795488",
"0.6795488",
"0.67942053",
"0.6750367",
"0.67334473",
"0.67334473",
"0.6726495",
"0.6726495",
"0.6726495",
"0.6726495",
"0.6726495",
"0.6726495",
"0.672649... | 0.7035757 | 6 |
Standard link action to the destroy action of a given record. Uses the current record if none is given. | def link_action_destroy(path = nil)
path ||= path_args(entry)
link_action ti(:"link.delete"), 'remove', path,
:data => { :confirm => ti(:confirm_delete),
:method => :delete }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_link(resource, *args)\n link = ''.html_safe\n\n resource_name = normalized_resource_name(resource)\n object = determine_proper_resource(resource)\n options = args.first || {}\n\n # CSS classes for this crud link\n crud_link_css(options, 'destroy')\n # text to be displa... | [
"0.7412957",
"0.7224197",
"0.7184262",
"0.7108367",
"0.69561446",
"0.6939046",
"0.6910096",
"0.6895957",
"0.68707764",
"0.6851649",
"0.6802576",
"0.6799156",
"0.67861605",
"0.67856103",
"0.67788965",
"0.6772118",
"0.67546374",
"0.6745191",
"0.6743206",
"0.67142135",
"0.665915... | 0.7077149 | 4 |
Standard link action to the list page. Links to the current model_class if no path is given. | def link_action_index(path = nil, url_options = {:returning => true})
path ||= path_args(model_class)
link_action ti(:"link.list"), 'list', path.is_a?(String) ? path : polymorphic_path(path, url_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_page_for model\n param_hash_to_link_hash( (session[:admin_list_params] || {})[model] || {} ).merge( :action => 'list', :model => model )\n end",
"def list_page_for_current\n list_page_for params[:model]\n end",
"def list_in_path(model, path)\n @true_class.list_in_path(model, path)\n en... | [
"0.7021258",
"0.65458167",
"0.6489672",
"0.61265",
"0.5941287",
"0.5863582",
"0.586167",
"0.5833222",
"0.57725334",
"0.57609385",
"0.57283396",
"0.5647914",
"0.5589933",
"0.55824786",
"0.555384",
"0.55421025",
"0.55359024",
"0.5532612",
"0.5523689",
"0.55061024",
"0.5492093",... | 0.7388719 | 1 |
Standard link action to the new page. Links to the current model_class if no path is given. | def link_action_add(path = nil, url_options = {})
path ||= path_args(model_class)
link_action ti(:"link.add"), 'plus', path.is_a?(String) ? path : new_polymorphic_path(path, url_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_to_new(text, path, options={})\n if path.is_a? Class\n text ||= t(\"app.actions.new\", :default => \"New\") + ' ' + path.try(:human_name).to_s.downcase\n path = options.delete(:url) || new_polymorphic_path(path) unless path.is_a? String\n end\n link_to_action(text, path, options.reverse... | [
"0.7442898",
"0.70447654",
"0.6716493",
"0.65565366",
"0.62060285",
"0.6186592",
"0.61531603",
"0.60233366",
"0.60233366",
"0.5979654",
"0.59704185",
"0.5963542",
"0.59425706",
"0.5907352",
"0.590151",
"0.58893704",
"0.587151",
"0.5866565",
"0.5856044",
"0.5841805",
"0.583367... | 0.6121125 | 8 |
Get the cancel url for the given object considering options: 1. Use :cancel_url_new or :cancel_url_edit option, if present 2. Use :cancel_url option, if present 3. Use polymorphic_path(object) | def get_cancel_url(object, options)
record = Array(object).last
cancel_url = options.delete(:cancel_url)
cancel_url_new = options.delete(:cancel_url_new)
cancel_url_edit = options.delete(:cancel_url_edit)
url = record.new_record? ? cancel_url_new : cancel_url_edit
url || cancel_url || polymorphic_path(object, :returning => true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_to_cancel( object, options={})\n path = object.class.name.tableize\n path = if object.new_record?\n send( path.pluralize + '_path' )\n else\n send( path.singularize + '_path', object )\n end\n link_to \"Cancel\", path, options\n end",
"def link_to_ca... | [
"0.75616986",
"0.7237853",
"0.65782756",
"0.6402849",
"0.5894265",
"0.5657138",
"0.5649547",
"0.56070155",
"0.55972683",
"0.5594955",
"0.55717987",
"0.55168355",
"0.5480481",
"0.54286695",
"0.5401311",
"0.5359663",
"0.5353586",
"0.52714837",
"0.52714837",
"0.5189978",
"0.5183... | 0.9175337 | 0 |
If a block is given, call it to get the path for the current row entry. Otherwise, return the standard path args. | def action_path(e, &block)
block_given? ? yield(e) : path_args(e)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_path(cell, &block)\n current_cell = cell\n begin\n current_cell = yield(current_cell)\n return current_cell if is_intersection?(current_cell)\n end while is_navigable_space?(current_cell)\n nil\n end",
"def contextual_edit_block_path(block)\n active_model = get_active_model_by_... | [
"0.5891314",
"0.55897903",
"0.5582664",
"0.5563171",
"0.5515973",
"0.54829067",
"0.5437429",
"0.5399933",
"0.5287319",
"0.5262655",
"0.5236643",
"0.51250136",
"0.51234734",
"0.51191664",
"0.51136595",
"0.5113634",
"0.51100683",
"0.51100683",
"0.51100683",
"0.51100683",
"0.511... | 0.58819824 | 2 |
GET /applications/1 GET /applications/1.json | def show
@application = Application.find(params[:id])
if @application.nil? or @application.job.nil?
redirect_to "/", :alert=>"You do not have access to this page"
return false
end
return unless appAccess?(@application.job.id)
@job = @application.job
respond_to do |format|
format.html # show.html.erb
format.json { render json: @application }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applications_list\n get \"applications\"\n end",
"def show\n @applications_application = ApplicationsApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applications_application }\n end\n end",
"def index\n @app... | [
"0.8114244",
"0.7810009",
"0.7691295",
"0.7680003",
"0.7680003",
"0.75518596",
"0.74795187",
"0.7417034",
"0.7405294",
"0.7366823",
"0.7303719",
"0.7295216",
"0.7287319",
"0.7275292",
"0.7260817",
"0.7242591",
"0.7242591",
"0.7242591",
"0.7239261",
"0.72133744",
"0.7209267",
... | 0.6419915 | 63 |
GET /applications/new GET /applications/new.json | def new
if params[:id].nil?
redirect_to "/", :alert=>"You need to apply through a job"
return
end
@job = Job.find(params[:id])
@company = @job.company.name
@title = @job.title
@application = Application.new
respond_to do |format|
format.html# new.html.erb
format.json { render json: @application }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @applicati... | [
"0.80625165",
"0.7869684",
"0.7869684",
"0.7869684",
"0.76236117",
"0.76236117",
"0.76236117",
"0.76236117",
"0.7623116",
"0.71835846",
"0.7132159",
"0.71160907",
"0.70642376",
"0.70039517",
"0.6994037",
"0.6959962",
"0.6938884",
"0.6912392",
"0.6904323",
"0.6895807",
"0.6875... | 0.68693525 | 22 |
POST /applications POST /applications.json | def create
@application = Application.new(params[:application])
@application.job = Job.find(params[:id])
respond_to do |format|
if @application.save
format.html { redirect_to '/', notice: 'Application was received.' }
format.json { render json: @application, status: :created, location: @application }
else
@job = Job.find(params[:id])
@company = @job.company.name
@title = @job.title
format.html { render action: "new" }
format.json { render json: @category.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end",... | [
"0.75115496",
"0.7120853",
"0.7010377",
"0.69720936",
"0.6955418",
"0.6880274",
"0.68689686",
"0.68499",
"0.68345064",
"0.68260735",
"0.68003273",
"0.67571235",
"0.67512643",
"0.6713185",
"0.6713185",
"0.666663",
"0.6665081",
"0.66627544",
"0.66618484",
"0.6633409",
"0.661857... | 0.0 | -1 |
PUT /applications/1 PUT /applications/1.json | def update
return unless admin?
@application = Application.find(params[:id])
respond_to do |format|
if @application.update_attributes(params[:application])
format.html { redirect_to @application, notice: 'Application was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @application.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_app data={}\n put '/app', data\n end",
"def update\n if @application.update(application_params)\n render json: @application, status: :ok, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_... | [
"0.7469422",
"0.72270745",
"0.7125723",
"0.7125723",
"0.7041248",
"0.6964055",
"0.6934149",
"0.6930521",
"0.6912836",
"0.6912441",
"0.69096094",
"0.6858745",
"0.68190056",
"0.6797293",
"0.67899096",
"0.6755568",
"0.67281526",
"0.6690258",
"0.6655856",
"0.6655856",
"0.6645903"... | 0.6755353 | 16 |
DELETE /applications/1 DELETE /applications/1.json | def destroy
@application = Application.find(params[:id])
return unless appAccess?(@application.job.id)
id = @application.job.id
@application.destroy
respond_to do |format|
format.html { redirect_to show_apps_path(:id=>id) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end",
"def delete_application(client, options)\n if !options[:application].nil?\n application = client.applications.get options[:appl... | [
"0.79110837",
"0.756269",
"0.7553193",
"0.7553193",
"0.7553193",
"0.7548598",
"0.7548598",
"0.75248295",
"0.75248295",
"0.74210054",
"0.74210054",
"0.7404727",
"0.7369377",
"0.7369377",
"0.7369377",
"0.7363378",
"0.7356216",
"0.7339116",
"0.7307494",
"0.7307494",
"0.7307494",... | 0.70905864 | 38 |
The Doctor class needs an instance method, new_appointment, that takes in a an instance of the Patient class and a date, and creates a new Appointment. That Appointment should know that it belongs to the doctor | def appointments
Appointment.all.select {|appointment| appointment.doctor == self}
# binding.pry
# [1,2,3,4,5].select { |num| num.even? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_appointment(patient, date)\n #creating a new appointment whose doctor is the current instance of doctor\n Appointment.new(date, patient, self)\n end",
"def new_appointment doctor, date\n Appointment.new self, doctor, date\n end",
"def new_appointment(doctor, date)\n Appointment.... | [
"0.89874065",
"0.8890551",
"0.88336277",
"0.8825928",
"0.8823697",
"0.8823697",
"0.8823697",
"0.8793198",
"0.87709254",
"0.8691347",
"0.8691201",
"0.8660245",
"0.8617087",
"0.8612515",
"0.85878557",
"0.85878557",
"0.8396513",
"0.8324181",
"0.821093",
"0.8061271",
"0.7901105",... | 0.0 | -1 |
The Doctor class needs an instance method, appointments, that iterates through all Appointments and finds those belonging to this doctor. def meals Meal.all.select do |meal| meal.customer == self end end | def patients
self.appointments.map do |appointment|
appointment.patient
# binding.pry
end
# Appointments.all.select {|doc| }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meals\n Meal.all.select do |meal|\n meal.customer == self\n end \n end",
"def meals\r\n Meal.all.select do |meal|\r\n meal.customer == self\r\n end\r\n end",
"def meals\n Meal.all.select {|meal| meal.customer == self}\n end",
"def meals\n Meal.all.se... | [
"0.84449434",
"0.8438282",
"0.8430137",
"0.8430137",
"0.8419096",
"0.8372266",
"0.78940815",
"0.7890239",
"0.7855226",
"0.78399605",
"0.7835399",
"0.7760524",
"0.7722476",
"0.7689095",
"0.7672292",
"0.7579529",
"0.7551969",
"0.75274074",
"0.73857087",
"0.7345606",
"0.73451954... | 0.62319326 | 53 |
GET /ratings GET /ratings.json | def index
@ratings = Rating.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @ratings }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n re... | [
"0.81410384",
"0.73434645",
"0.73434645",
"0.73434645",
"0.7281987",
"0.7273105",
"0.7246692",
"0.7246692",
"0.7246692",
"0.72193485",
"0.716764",
"0.7037074",
"0.70103705",
"0.70024836",
"0.6965943",
"0.6939483",
"0.69357884",
"0.6848616",
"0.681786",
"0.6757801",
"0.6656508... | 0.7709336 | 3 |
GET /ratings/1 GET /ratings/1.json | def show
@rating = Rating.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @rating }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end",
"def index\n @ratings = Rating.all\n\n respond_to do |format|\n... | [
"0.7949204",
"0.7568998",
"0.7568998",
"0.7568998",
"0.7461371",
"0.74430245",
"0.7253984",
"0.71735245",
"0.7153197",
"0.7153197",
"0.7153197",
"0.6919049",
"0.68775797",
"0.68547004",
"0.6786845",
"0.6725233",
"0.67199665",
"0.6708475",
"0.6704931",
"0.6696515",
"0.6687978"... | 0.75321156 | 6 |
GET /ratings/new GET /ratings/new.json | def new
@rating = Rating.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @rating }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @rating_alt = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_alt }\n end\n end",
"def create\n @rating = Rating.new(params[:rating])\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_to @r... | [
"0.7811452",
"0.7174088",
"0.7163591",
"0.7093007",
"0.70800436",
"0.6947447",
"0.6931201",
"0.67748594",
"0.6722131",
"0.67181534",
"0.67181534",
"0.67181534",
"0.67181534",
"0.67181534",
"0.67181534",
"0.6691287",
"0.6622075",
"0.65468276",
"0.6531713",
"0.6506759",
"0.6504... | 0.7917388 | 2 |
POST /ratings POST /ratings.json | def create
@rating = Rating.new(params[:rating])
respond_to do |format|
if @rating.save
format.html { redirect_to @rating, notice: 'Rating was successfully created.' }
format.json { render json: @rating, status: :created, location: @rating }
else
format.html { render action: "new" }
format.json { render json: @rating.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rating\n @rating = @movie.ratings.new(rating_params)\n @rating.user_id = current_user.id\n if @rating.save\n render json: { message: \"Rating Created\", data: @rating }, status: 200\n else\n render json: { message: \"Rating not Created\" }, status: 422\n end\n end",
"def create\r\n ... | [
"0.7309647",
"0.7309517",
"0.70375794",
"0.68742937",
"0.6778626",
"0.67721534",
"0.67654777",
"0.6745564",
"0.67338264",
"0.6692064",
"0.66909605",
"0.6686345",
"0.6668436",
"0.66275793",
"0.66187423",
"0.66009176",
"0.6595893",
"0.6592229",
"0.65695137",
"0.6548216",
"0.653... | 0.7129198 | 2 |
PUT /ratings/1 PUT /ratings/1.json | def update
@rating = Rating.find(params[:id])
respond_to do |format|
if @rating.update_attributes(params[:rating])
format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @rating.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ... | [
"0.72009504",
"0.70992285",
"0.70477927",
"0.7011928",
"0.69314367",
"0.6922336",
"0.6902734",
"0.6896913",
"0.6876283",
"0.68599623",
"0.68599623",
"0.68599623",
"0.68200225",
"0.68200225",
"0.68200225",
"0.68200225",
"0.68200225",
"0.68200225",
"0.68200225",
"0.68200225",
"... | 0.72361165 | 0 |
DELETE /ratings/1 DELETE /ratings/1.json | def destroy
@rating = Rating.find(params[:id])
@rating.destroy
respond_to do |format|
format.html { redirect_to ratings_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to ratings_url }\n format.json { head :no_content }\n ... | [
"0.77660185",
"0.7689148",
"0.7496062",
"0.74291325",
"0.7310085",
"0.7310085",
"0.71718204",
"0.71176755",
"0.7095924",
"0.70656586",
"0.70259017",
"0.7021365",
"0.70124835",
"0.69818383",
"0.6980865",
"0.696372",
"0.6940898",
"0.6907331",
"0.6891433",
"0.6887266",
"0.685944... | 0.7704459 | 1 |
A list of the param names that can be used for filtering the Product list | def filtering_params(params)
params.slice(:search, :title, :content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filtering_params(params)\n params.slice(:shortlist, :client, :category, :updated_at, :costmodel, :state, :prio)\n end",
"def filtering_params(params)\n\t\t params.slice(:name, :category_id, :trademark)\n\t\tend",
"def parameters_to_filter\n @parameters_to_filter ||= []\n end",
"def fi... | [
"0.70026404",
"0.686209",
"0.68030256",
"0.6721399",
"0.6721399",
"0.67001814",
"0.66970915",
"0.65932226",
"0.65365136",
"0.651642",
"0.64946437",
"0.64048344",
"0.6366691",
"0.6351925",
"0.6294786",
"0.6290239",
"0.62871677",
"0.6265679",
"0.6261443",
"0.6206927",
"0.620191... | 0.59879434 | 35 |
takes file from the string if protocols are http ftp then curl/wget if magnet then set to torrent both are async | def file_url= val
return if val.blank?
self.state = :pending
self.server_data = val
@file_last_action = __method__.to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_torrent_data(the_torrent_url = self.torrent_url)\n if the_torrent_url && torrent_data.nil?\n begin\n torrent_item = open(the_torrent_url)\n self.torrent_data = Base64.encode64(torrent_item.read())\n torrent_item.close\n self.set_state(:to_download)\n return true... | [
"0.6025188",
"0.57515717",
"0.5744811",
"0.56442326",
"0.5541267",
"0.5541267",
"0.5541267",
"0.5541267",
"0.5480322",
"0.53987443",
"0.53890586",
"0.5354135",
"0.5318147",
"0.5296142",
"0.5296142",
"0.5236898",
"0.5235556",
"0.5235556",
"0.5230711",
"0.5227862",
"0.5213218",... | 0.54284954 | 9 |
some other job should decide what to do in order to better support if errors occured | def run_processor
if @file_last_action == :file_url
processor = WORKER_LIST.detect{|worker| worker.can_work_with_file_name?(val) }
processor.perform_later(self)
elsif @file_last_action == :file
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_failed; end",
"def handle_perform_error(_e); end",
"def do_failure; end",
"def errorhandling\n end",
"def storage_failure=(_arg0); end",
"def task_check_error\n # nochannel job failure should not result in any state changes\n return if is_nochannel?\n\n policies = Push::Policy.policies_... | [
"0.7024513",
"0.6798284",
"0.67348063",
"0.63316077",
"0.6287837",
"0.62539697",
"0.6213479",
"0.6212638",
"0.6166773",
"0.6166773",
"0.6166773",
"0.61639655",
"0.61639655",
"0.61639655",
"0.6096867",
"0.60809845",
"0.6070552",
"0.6065741",
"0.6025575",
"0.6021471",
"0.601368... | 0.0 | -1 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
if !@external_id.nil? && @external_id.to_s.length > 64
invalid_properties.push('invalid value for "external_id", the character length must be smaller than or equal to 64.')
end
if !@first_name.nil? && @first_name.to_s.length > 128
invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 128.')
end
if @last_name.nil?
invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
end
if @last_name.to_s.length > 64
invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 64.')
end
if @last_name.to_s.length < 1
invalid_properties.push('invalid value for "last_name", the character length must be great than or equal to 1.')
end
if !@middle_name.nil? && @middle_name.to_s.length > 64
invalid_properties.push('invalid value for "middle_name", the character length must be smaller than or equal to 64.')
end
if !@language.nil? && @language.to_s.length > 32
invalid_properties.push('invalid value for "language", the character length must be smaller than or equal to 32.')
end
if !@phone.nil? && @phone.to_s.length > 64
invalid_properties.push('invalid value for "phone", the character length must be smaller than or equal to 64.')
end
if !@email.nil? && @email.to_s.length > 128
invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 128.')
end
if !@doc_type.nil? && @doc_type.to_s.length > 32
invalid_properties.push('invalid value for "doc_type", the character length must be smaller than or equal to 32.')
end
if !@doc_issuer_info.nil? && @doc_issuer_info.to_s.length > 256
invalid_properties.push('invalid value for "doc_issuer_info", the character length must be smaller than or equal to 256.')
end
if !@doc_series.nil? && @doc_series.to_s.length > 64
invalid_properties.push('invalid value for "doc_series", the character length must be smaller than or equal to 64.')
end
if !@doc_number.nil? && @doc_number.to_s.length > 64
invalid_properties.push('invalid value for "doc_number", the character length must be smaller than or equal to 64.')
end
if !@department_code.nil? && @department_code.to_s.length > 64
invalid_properties.push('invalid value for "department_code", the character length must be smaller than or equal to 64.')
end
if !@department_name.nil? && @department_name.to_s.length > 256
invalid_properties.push('invalid value for "department_name", the character length must be smaller than or equal to 256.')
end
if !@building_no.nil? && @building_no.to_s.length > 8
invalid_properties.push('invalid value for "building_no", the character length must be smaller than or equal to 8.')
end
if !@city.nil? && @city.to_s.length > 32
invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 32.')
end
if !@country_code.nil? && @country_code.to_s.length > 8
invalid_properties.push('invalid value for "country_code", the character length must be smaller than or equal to 8.')
end
if !@country_name.nil? && @country_name.to_s.length > 64
invalid_properties.push('invalid value for "country_name", the character length must be smaller than or equal to 64.')
end
if !@district.nil? && @district.to_s.length > 64
invalid_properties.push('invalid value for "district", the character length must be smaller than or equal to 64.')
end
if !@flat_no.nil? && @flat_no.to_s.length > 8
invalid_properties.push('invalid value for "flat_no", the character length must be smaller than or equal to 8.')
end
if !@house_no.nil? && @house_no.to_s.length > 16
invalid_properties.push('invalid value for "house_no", the character length must be smaller than or equal to 16.')
end
if !@region.nil? && @region.to_s.length > 64
invalid_properties.push('invalid value for "region", the character length must be smaller than or equal to 64.')
end
if !@room_no.nil? && @room_no.to_s.length > 8
invalid_properties.push('invalid value for "room_no", the character length must be smaller than or equal to 8.')
end
if !@settlement_type.nil? && @settlement_type.to_s.length > 32
invalid_properties.push('invalid value for "settlement_type", the character length must be smaller than or equal to 32.')
end
if !@street.nil? && @street.to_s.length > 64
invalid_properties.push('invalid value for "street", the character length must be smaller than or equal to 64.')
end
if !@raw_address.nil? && @raw_address.to_s.length > 512
invalid_properties.push('invalid value for "raw_address", the character length must be smaller than or equal to 512.')
end
invalid_properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.... | [
"0.765058",
"0.765058",
"0.765058",
"0.765058",
"0.7638772",
"0.7638772",
"0.7638772",
"0.7638772",
"0.7638772",
"0.7638772",
"0.7638772",
"0.7638772",
"0.73569804",
"0.7336038",
"0.72692806",
"0.72394663",
"0.72318745",
"0.7226795",
"0.7209003",
"0.7177062",
"0.7171715",
"... | 0.0 | -1 |
Check to see if the all the properties in the model are valid | def valid?
return false if !@external_id.nil? && @external_id.to_s.length > 64
return false if !@first_name.nil? && @first_name.to_s.length > 128
return false if @last_name.nil?
return false if @last_name.to_s.length > 64
return false if @last_name.to_s.length < 1
return false if !@middle_name.nil? && @middle_name.to_s.length > 64
gender_validator = EnumAttributeValidator.new('String', ["M", "F"])
return false unless gender_validator.valid?(@gender)
return false if !@language.nil? && @language.to_s.length > 32
return false if !@phone.nil? && @phone.to_s.length > 64
return false if !@email.nil? && @email.to_s.length > 128
return false if !@doc_type.nil? && @doc_type.to_s.length > 32
return false if !@doc_issuer_info.nil? && @doc_issuer_info.to_s.length > 256
return false if !@doc_series.nil? && @doc_series.to_s.length > 64
return false if !@doc_number.nil? && @doc_number.to_s.length > 64
return false if !@department_code.nil? && @department_code.to_s.length > 64
return false if !@department_name.nil? && @department_name.to_s.length > 256
return false if !@building_no.nil? && @building_no.to_s.length > 8
return false if !@city.nil? && @city.to_s.length > 32
return false if !@country_code.nil? && @country_code.to_s.length > 8
return false if !@country_name.nil? && @country_name.to_s.length > 64
return false if !@district.nil? && @district.to_s.length > 64
return false if !@flat_no.nil? && @flat_no.to_s.length > 8
return false if !@house_no.nil? && @house_no.to_s.length > 16
return false if !@region.nil? && @region.to_s.length > 64
return false if !@room_no.nil? && @room_no.to_s.length > 8
return false if !@settlement_type.nil? && @settlement_type.to_s.length > 32
return false if !@street.nil? && @street.to_s.length > 64
return false if !@raw_address.nil? && @raw_address.to_s.length > 512
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :... | [
"0.7899264",
"0.7899264",
"0.70971936",
"0.7078258",
"0.7032224",
"0.70312935",
"0.6951032",
"0.6869895",
"0.68580866",
"0.68580866",
"0.6828718",
"0.6823897",
"0.6820318",
"0.6814491",
"0.6794687",
"0.675217",
"0.66843694",
"0.6676567",
"0.6667767",
"0.6629611",
"0.66184616"... | 0.0 | -1 |
Custom attribute writer method with validation | def external_id=(external_id)
if !external_id.nil? && external_id.to_s.length > 64
fail ArgumentError, 'invalid value for "external_id", the character length must be smaller than or equal to 64.'
end
@external_id = external_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def first_name=(first_name)
if !first_name.nil? && first_name.to_s.length > 128
fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 128.'
end
@first_name = first_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def last_name=(last_name)
if last_name.nil?
fail ArgumentError, 'last_name cannot be nil'
end
if last_name.to_s.length > 64
fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 64.'
end
if last_name.to_s.length < 1
fail ArgumentError, 'invalid value for "last_name", the character length must be great than or equal to 1.'
end
@last_name = last_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.64714426",
"0.6314092",
"0.6314092",
"0.62843996",
"0.6279117",
"0.6212286",
"0.6188891",
"0.6179444",
"0.6065791",
"0.6032525",
"0.5996907",
"0.5990497",
"0.5959816",
"0.5938802",
"0.59287214",
"0.5895985",
"0.58595186",
"0.5852596",
"0.5847984",
"0.58444107",
"0.58343303... | 0.0 | -1 |
Custom attribute writer method with validation | def middle_name=(middle_name)
if !middle_name.nil? && middle_name.to_s.length > 64
fail ArgumentError, 'invalid value for "middle_name", the character length must be smaller than or equal to 64.'
end
@middle_name = middle_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method checking allowed values (enum). | def gender=(gender)
validator = EnumAttributeValidator.new('String', ["M", "F"])
unless validator.valid?(gender)
fail ArgumentError, "invalid value for \"gender\", must be one of #{validator.allowable_values}."
end
@gender = gender
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end",
"def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n ... | [
"0.7088127",
"0.64820594",
"0.6429773",
"0.6227689",
"0.61418885",
"0.5809922",
"0.57507086",
"0.5743216",
"0.5736045",
"0.5708027",
"0.57014966",
"0.56777334",
"0.5601988",
"0.55947953",
"0.55464065",
"0.55371004",
"0.55344343",
"0.5528221",
"0.5434983",
"0.54312384",
"0.541... | 0.0 | -1 |
Custom attribute writer method with validation | def language=(language)
if !language.nil? && language.to_s.length > 32
fail ArgumentError, 'invalid value for "language", the character length must be smaller than or equal to 32.'
end
@language = language
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def phone=(phone)
if !phone.nil? && phone.to_s.length > 64
fail ArgumentError, 'invalid value for "phone", the character length must be smaller than or equal to 64.'
end
@phone = phone
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.64714426",
"0.6314092",
"0.6314092",
"0.62843996",
"0.6279117",
"0.6212286",
"0.6188891",
"0.6179444",
"0.6065791",
"0.6032525",
"0.5996907",
"0.5990497",
"0.5959816",
"0.5938802",
"0.59287214",
"0.5895985",
"0.58595186",
"0.5852596",
"0.5847984",
"0.58444107",
"0.58343303... | 0.0 | -1 |
Custom attribute writer method with validation | def email=(email)
if !email.nil? && email.to_s.length > 128
fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 128.'
end
@email = email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def doc_type=(doc_type)
if !doc_type.nil? && doc_type.to_s.length > 32
fail ArgumentError, 'invalid value for "doc_type", the character length must be smaller than or equal to 32.'
end
@doc_type = doc_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def doc_issuer_info=(doc_issuer_info)
if !doc_issuer_info.nil? && doc_issuer_info.to_s.length > 256
fail ArgumentError, 'invalid value for "doc_issuer_info", the character length must be smaller than or equal to 256.'
end
@doc_issuer_info = doc_issuer_info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def doc_series=(doc_series)
if !doc_series.nil? && doc_series.to_s.length > 64
fail ArgumentError, 'invalid value for "doc_series", the character length must be smaller than or equal to 64.'
end
@doc_series = doc_series
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.64714426",
"0.6314092",
"0.6314092",
"0.62843996",
"0.6279117",
"0.6212286",
"0.6188891",
"0.6179444",
"0.6065791",
"0.6032525",
"0.5996907",
"0.5990497",
"0.5959816",
"0.5938802",
"0.59287214",
"0.5895985",
"0.58595186",
"0.5852596",
"0.5847984",
"0.58444107",
"0.58343303... | 0.0 | -1 |
Custom attribute writer method with validation | def doc_number=(doc_number)
if !doc_number.nil? && doc_number.to_s.length > 64
fail ArgumentError, 'invalid value for "doc_number", the character length must be smaller than or equal to 64.'
end
@doc_number = doc_number
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def department_code=(department_code)
if !department_code.nil? && department_code.to_s.length > 64
fail ArgumentError, 'invalid value for "department_code", the character length must be smaller than or equal to 64.'
end
@department_code = department_code
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def department_name=(department_name)
if !department_name.nil? && department_name.to_s.length > 256
fail ArgumentError, 'invalid value for "department_name", the character length must be smaller than or equal to 256.'
end
@department_name = department_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def building_no=(building_no)
if !building_no.nil? && building_no.to_s.length > 8
fail ArgumentError, 'invalid value for "building_no", the character length must be smaller than or equal to 8.'
end
@building_no = building_no
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.64714426",
"0.6314092",
"0.6314092",
"0.62843996",
"0.6279117",
"0.6212286",
"0.6188891",
"0.6179444",
"0.6065791",
"0.6032525",
"0.5996907",
"0.5990497",
"0.5959816",
"0.5938802",
"0.59287214",
"0.5895985",
"0.58595186",
"0.5852596",
"0.5847984",
"0.58444107",
"0.58343303... | 0.0 | -1 |
Custom attribute writer method with validation | def city=(city)
if !city.nil? && city.to_s.length > 32
fail ArgumentError, 'invalid value for "city", the character length must be smaller than or equal to 32.'
end
@city = city
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def country_code=(country_code)
if !country_code.nil? && country_code.to_s.length > 8
fail ArgumentError, 'invalid value for "country_code", the character length must be smaller than or equal to 8.'
end
@country_code = country_code
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def country_name=(country_name)
if !country_name.nil? && country_name.to_s.length > 64
fail ArgumentError, 'invalid value for "country_name", the character length must be smaller than or equal to 64.'
end
@country_name = country_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def district=(district)
if !district.nil? && district.to_s.length > 64
fail ArgumentError, 'invalid value for "district", the character length must be smaller than or equal to 64.'
end
@district = district
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.64714426",
"0.6314092",
"0.6314092",
"0.62843996",
"0.6279117",
"0.6212286",
"0.6188891",
"0.6179444",
"0.6065791",
"0.6032525",
"0.5996907",
"0.5990497",
"0.5959816",
"0.5938802",
"0.59287214",
"0.5895985",
"0.58595186",
"0.5852596",
"0.5847984",
"0.58444107",
"0.58343303... | 0.0 | -1 |
Custom attribute writer method with validation | def flat_no=(flat_no)
if !flat_no.nil? && flat_no.to_s.length > 8
fail ArgumentError, 'invalid value for "flat_no", the character length must be smaller than or equal to 8.'
end
@flat_no = flat_no
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def house_no=(house_no)
if !house_no.nil? && house_no.to_s.length > 16
fail ArgumentError, 'invalid value for "house_no", the character length must be smaller than or equal to 16.'
end
@house_no = house_no
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def region=(region)
if !region.nil? && region.to_s.length > 64
fail ArgumentError, 'invalid value for "region", the character length must be smaller than or equal to 64.'
end
@region = region
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def room_no=(room_no)
if !room_no.nil? && room_no.to_s.length > 8
fail ArgumentError, 'invalid value for "room_no", the character length must be smaller than or equal to 8.'
end
@room_no = room_no
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.64714426",
"0.6314092",
"0.6314092",
"0.62843996",
"0.6279117",
"0.6212286",
"0.6188891",
"0.6179444",
"0.6065791",
"0.6032525",
"0.5996907",
"0.5990497",
"0.5959816",
"0.5938802",
"0.59287214",
"0.5895985",
"0.58595186",
"0.5852596",
"0.5847984",
"0.58444107",
"0.58343303... | 0.0 | -1 |
Custom attribute writer method with validation | def settlement_type=(settlement_type)
if !settlement_type.nil? && settlement_type.to_s.length > 32
fail ArgumentError, 'invalid value for "settlement_type", the character length must be smaller than or equal to 32.'
end
@settlement_type = settlement_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def street=(street)
if !street.nil? && street.to_s.length > 64
fail ArgumentError, 'invalid value for "street", the character length must be smaller than or equal to 64.'
end
@street = street
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def raw_address=(raw_address)
if !raw_address.nil? && raw_address.to_s.length > 512
fail ArgumentError, 'invalid value for "raw_address", the character length must be smaller than or equal to 512.'
end
@raw_address = raw_address
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
id == o.id &&
url == o.url &&
external_id == o.external_id &&
first_name == o.first_name &&
last_name == o.last_name &&
middle_name == o.middle_name &&
birth_date == o.birth_date &&
gender == o.gender &&
language == o.language &&
phone == o.phone &&
allow_phone_contact == o.allow_phone_contact &&
email == o.email &&
allow_email_contact == o.allow_email_contact &&
notes == o.notes &&
date_created == o.date_created &&
date_modified == o.date_modified &&
ext_date_created == o.ext_date_created &&
ext_date_modified == o.ext_date_modified &&
doc_type == o.doc_type &&
doc_issuer_info == o.doc_issuer_info &&
doc_series == o.doc_series &&
doc_number == o.doc_number &&
department_code == o.department_code &&
department_name == o.department_name &&
doc_issue_date == o.doc_issue_date &&
doc_expiration_date == o.doc_expiration_date &&
is_closed == o.is_closed &&
merged_to == o.merged_to &&
building_no == o.building_no &&
city == o.city &&
country_code == o.country_code &&
country_name == o.country_name &&
district == o.district &&
flat_no == o.flat_no &&
house_no == o.house_no &&
region == o.region &&
room_no == o.room_no &&
settlement_type == o.settlement_type &&
street == o.street &&
raw_address == o.raw_address &&
cards == o.cards &&
view_url == o.view_url &&
preferences == o.preferences
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en... | [
"0.72932124",
"0.7189842",
"0.70406866",
"0.7007727",
"0.68881786",
"0.68621296",
"0.67085785",
"0.66622394",
"0.661674",
"0.6586541",
"0.65844727",
"0.65818226",
"0.65561724",
"0.6545535",
"0.6508076",
"0.64813215",
"0.64577025",
"0.64179385",
"0.6414028",
"0.6414028",
"0.64... | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[id, url, external_id, first_name, last_name, middle_name, birth_date, gender, language, phone, allow_phone_contact, email, allow_email_contact, notes, date_created, date_modified, ext_date_created, ext_date_modified, doc_type, doc_issuer_info, doc_series, doc_number, department_code, department_name, doc_issue_date, doc_expiration_date, is_closed, merged_to, building_no, city, country_code, country_name, district, flat_no, house_no, region, room_no, settlement_type, street, raw_address, cards, view_url, preferences].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ... | [
"0.71187764",
"0.7038497",
"0.7038497",
"0.7038497",
"0.7038497",
"0.7038497",
"0.7038497",
"0.7038497",
"0.68957126",
"0.67830646",
"0.6707231",
"0.6699251",
"0.6687822",
"0.6669884",
"0.64887464",
"0.64610004",
"0.64610004",
"0.64441663",
"0.64113593",
"0.6394231",
"0.63886... | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.openapi_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ... | [
"0.8011074",
"0.7470833",
"0.7457607",
"0.7256629",
"0.72455454",
"0.70060325",
"0.6973257",
"0.6955014",
"0.69459796",
"0.69398683",
"0.69363195",
"0.6917627",
"0.6872358",
"0.6796184",
"0.6783521",
"0.67575246",
"0.67575246",
"0.67560464",
"0.67514306",
"0.67136854",
"0.666... | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :Boolean
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
CheckpointCrmClient.const_get(type).build_from_hash(value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s... | [
"0.7330926",
"0.7274019",
"0.72504056",
"0.7245751",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
... | 0.0 | -1 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"de... | [
"0.901102",
"0.8951408",
"0.847116",
"0.83399886",
"0.8337297",
"0.8337297",
"0.8332112",
"0.82551175",
"0.8145114",
"0.8143849",
"0.8134524",
"0.8126343",
"0.8092803",
"0.80863005",
"0.8072428",
"0.80386686",
"0.80304825",
"0.80054814",
"0.80054814",
"0.80054814",
"0.8005481... | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.842897",
"0.83478487",
"0.83478487"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n ... | [
"0.8270299",
"0.78767854",
"0.78726953",
"0.7802364",
"0.7789188",
"0.77806795",
"0.7775915",
"0.7767511",
"0.7760525",
"0.7760525",
"0.77559966",
"0.7731286",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",... | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @va... | [
"0.6721064",
"0.6721064",
"0.66705114",
"0.66585946",
"0.65890485",
"0.6454646",
"0.6417013",
"0.6417013",
"0.6384306",
"0.6348656",
"0.630476",
"0.6225539",
"0.6153802",
"0.6104665",
"0.6081452",
"0.6081452",
"0.6072844",
"0.6038052",
"0.60226446",
"0.5938669",
"0.5903004",
... | 0.0 | -1 |
GET /categories GET /categories.json | def index
resource_params = {}
resource_params[:f] = params[:f].to_json if params[:f].present?
resource_params[:page] = params[:page].present? ? params[:page] : 1
resource_params[:per] = params[:per].present? ? params[:per] : 12
@categories = Category.all(params: resource_params)
@categories = Kaminari::PaginatableArray.new(@categories,{
limit: @categories.http_response['X-limit'].to_i,
offset: @categories.http_response['X-offset'].to_i,
total_count: @categories.http_response['X-total'].to_i
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter:... | [
"0.8390047",
"0.83304346",
"0.8320247",
"0.78100723",
"0.77435976",
"0.7568599",
"0.7512776",
"0.7415717",
"0.7387233",
"0.73714656",
"0.73706967",
"0.73706967",
"0.7368256",
"0.7347074",
"0.73320836",
"0.7318429",
"0.72868323",
"0.72664523",
"0.7229807",
"0.7223272",
"0.7217... | 0.0 | -1 |
GET /categories/1 GET /categories/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def GetCategory id\n\n ... | [
"0.7878061",
"0.7865138",
"0.7847367",
"0.78421843",
"0.7415738",
"0.7407003",
"0.73067135",
"0.7306128",
"0.7306128",
"0.72814614",
"0.7234994",
"0.7184808",
"0.7156553",
"0.71328664",
"0.7124016",
"0.70659167",
"0.7043319",
"0.703876",
"0.7034461",
"0.7033088",
"0.7012336",... | 0.0 | -1 |
POST /categories POST /categories.json | def create
@category = Category.new(category_params)
respond_to do |format|
if @category.save
format.html { redirect_to @category, notice: 'Category was successfully created.' }
format.json { render :show, status: :created, location: @category }
else
format.html { render :new }
format.json { render json: @category.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n json_create(category_params, Category)\n end",
"def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATE... | [
"0.7738549",
"0.74339235",
"0.72349083",
"0.71634054",
"0.7124031",
"0.70645165",
"0.705568",
"0.695861",
"0.6956783",
"0.6903891",
"0.6838659",
"0.6821712",
"0.68190134",
"0.6807838",
"0.678525",
"0.66138625",
"0.6566919",
"0.65661913",
"0.65567696",
"0.6523676",
"0.65186286... | 0.6418686 | 46 |
PATCH/PUT /categories/1 PATCH/PUT /categories/1.json | def update
respond_to do |format|
if @category.update_attributes(category_params)
format.html { redirect_to @category, notice: 'Category was successfully updated.' }
format.json { render :show, status: :ok, location: @category }
else
format.html { render :edit }
format.json { render json: @category.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n json_update(category,category_params, Category)\n end",
"def update_categories(categories, options = {} )\n options.merge!(:docid => self.doci... | [
"0.7692541",
"0.76002717",
"0.72122926",
"0.69430083",
"0.69147646",
"0.68174535",
"0.6781423",
"0.6712822",
"0.66981524",
"0.66931385",
"0.66563374",
"0.66518235",
"0.6651313",
"0.66455007",
"0.6606881",
"0.65994096",
"0.6570957",
"0.6570957",
"0.6554447",
"0.65348464",
"0.6... | 0.635001 | 46 |
DELETE /categories/1 DELETE /categories/1.json | def destroy
@category.destroy
respond_to do |format|
format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @category.destroy\n render json: @category, status: :ok\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |f... | [
"0.78262806",
"0.7735309",
"0.763867",
"0.7488627",
"0.74725026",
"0.7423611",
"0.7399044",
"0.7384889",
"0.7384889",
"0.7384889",
"0.7384889",
"0.7384889",
"0.7384889",
"0.7384889",
"0.7384889",
"0.7384889",
"0.7384889",
"0.7384889",
"0.7384889",
"0.7378353",
"0.7378353",
... | 0.70824283 | 72 |
Use callbacks to share common setup or constraints between actions. | def set_category
@category = Category.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.6163927",
"0.6046165",
"0.59465253",
"0.59167755",
"0.58904207",
"0.58346355",
"0.577713",
"0.5703502",
"0.5703502",
"0.56531286",
"0.56215113",
"0.54224145",
"0.5410795",
"0.5410795",
"0.5410795",
"0.53924775",
"0.5379919",
"0.53580743",
"0.53401667",
"0.53397506",
"0.533... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def category_params
params.require(:category).permit(:title, :ancestry)
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 |
ruledata = <<~DATA 0: 1 2 1: "a" 2: 1 3 | 3 1 3: "b" DATA ruledata = <<~DATA 0: 4 1 5 1: 2 3 | 3 2 2: 4 4 | 5 5 3: 4 5 | 5 4 4: "a" 5: "b" DATA | def flatten(id, rules)
rule = rules[id]
if rule.kind_of?(String)
[rule]
else
rule.reduce([]) do |sum, subrule|
sum + subrule.map { |s| flatten(s, rules) }
.reduce { |prod, s| prod.product(s) }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_rule(tag, data, id)\n @rules ||= {}\n @rules[tag] ||= {}\n @rules[tag][id] ||= data.each_with_object({}) do |(key, value), style|\n if value.is_a? Hash\n handle_rule_raw_hash tag, key, value\n else\n style[key] = value\n end\n end... | [
"0.6051894",
"0.59856635",
"0.59272337",
"0.59269965",
"0.59088653",
"0.577136",
"0.5759406",
"0.5759406",
"0.5759406",
"0.57396615",
"0.57260936",
"0.5710072",
"0.56360507",
"0.55693185",
"0.55602074",
"0.55467236",
"0.553209",
"0.5512858",
"0.5491807",
"0.5484152",
"0.54545... | 0.0 | -1 |
GET /lab_users GET /lab_users.xml index and new view are merged | def index
#@lab_users = LabUser.find(:all, :order=>params[:sort_by])
set_order_by
@lab_users = LabUser.order(@order).paginate(:page => params[:page], :per_page => @per_page)
@lab_user = LabUser.new
@users= User.order('username')
if request.format == 'json'
if params[:conditions]
conditions = params[:conditions].as_json
#fix start and end
if conditions[:end] && conditions[:end]==''
conditions[:end]=nil
end
if conditions && conditions[:start]==''
conditions[:start]=nil
end
logger.info "FIND LABUSER: #{conditions}"
labusers = LabUser.where(conditions)
else
labusers = LabUser.all
end
if params[:with_ping]
labusers = labusers.map{|l| l.with_ping}
end
end
respond_to do |format|
format.html # index.html.erb
format.json { render :json => labusers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users_index\n\t\t@view.users_list($users)\n\t\t@view.second_view(@current_user, @current_user.actions)\n\tend",
"def index\n @user_labs = UserLab.all\n end",
"def index\n @user = User.find(params[:user_id])\n @lab_memberships = @user.lab_memberships\n\n respond_to do |format|\n format.htm... | [
"0.72773415",
"0.7232288",
"0.7165176",
"0.70872307",
"0.70236284",
"0.69331115",
"0.6904785",
"0.68364716",
"0.68174815",
"0.68134177",
"0.67674434",
"0.6763421",
"0.67588854",
"0.6709928",
"0.6680158",
"0.66797256",
"0.6665183",
"0.6663183",
"0.6659405",
"0.6652202",
"0.665... | 0.6466197 | 65 |
for search view to display user machines in an attempt | def show
@info={:running=>[], :paused=>[], :stopped=>[]}
@lab_user.vms.each do |v|
v['username']=@lab_user.user.username
v['port'] = v.rdp_port
logger.debug "state is #{v.state}"
@info[:"#{v.state}"]<< v
end
respond_to do |format|
format.json { render :json => @info }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @machine_user_name = MachineUserName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @machine_user_name }\n end\n end",
"def index\n @machine_infos = MachineInfo.all\n end",
"def list\n \t\tuser = User.find(current_us... | [
"0.59255767",
"0.5848387",
"0.5792922",
"0.5683477",
"0.5663232",
"0.5630264",
"0.56130457",
"0.5556362",
"0.5544253",
"0.55217975",
"0.54379725",
"0.5431421",
"0.54277843",
"0.5392782",
"0.53881454",
"0.53772306",
"0.53627795",
"0.53627795",
"0.5351879",
"0.533307",
"0.53175... | 0.5209501 | 35 |
POST /lab_users POST /lab_users.xml | def create
set_order_by
@lab_users = LabUser.order(@order).paginate(:page => params[:page], :per_page => @per_page)
# logic for when adding/removing multiple users at once to a specific lab
if params[:lab_user] && params[:lab_user][:page]=='bulk_add'
LabUser.add_users(params)
flash[:notice] = 'successful update.'
redirect_back fallback_location: add_users_path
else #adding a single user to a lab
respond_to do |format|
#create lab_user params based on lab_id and user_id
if params[:lab_id]
params[:lab_user] = { lab_id: params[:lab_id] }
if @user
params[:lab_user][:user_id] = @user.id
end
end
# continue to create
@lab_user = LabUser.new(labuser_params)
if @lab_user.save
format.html {
flash[:notice] = 'successful update.'
redirect_back fallback_location: lab_users_path
}
format.json {
logger.info "LABUSER CREATE SUCCESS: labuser=#{@lab_user.id} lab=#{@lab_user.lab.id} user=#{@lab_user.user.id} [#{@lab_user.user.username}]"
render :json=> {:success => true, :lab_user => @lab_user}, :status=> :created
}
else
format.html { render :action => 'index' }
format.json {
logger.error "LABUSER CREATE FAILED: lab=#{params[:lab_id]} user=#{params[:user_id]} " + ( @user ? "[#{@user.username}]" : '')
logger.error @lab_user.errors.as_json
render :json=> {:success => false, :errors => @lab_user.errors}, :status=> :unprocessable_entity
}
end #end if
end #end respond_to
end #end else
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def append_user_info(username, xml); end",
"def create_user(body)\n post 'create_user', body\n end",
"def post body=nil, headers={}\n ... | [
"0.6368727",
"0.6049231",
"0.59577274",
"0.58966994",
"0.58820397",
"0.5861588",
"0.5841159",
"0.5837824",
"0.5827645",
"0.5822449",
"0.5818072",
"0.5780486",
"0.57476145",
"0.57180935",
"0.5712718",
"0.5638049",
"0.5620628",
"0.55968904",
"0.55528",
"0.5540951",
"0.5531949",... | 0.53722155 | 49 |
PUT /lab_users/1 PUT /lab_users/1.xml | def update
respond_to do |format|
if @lab_user.update_attributes(labuser_params)
format.html {
flash[:notice] = 'successful update.'
redirect_back fallback_location: lab_users_path
}
format.json { render :json=>{:success=>true, :lab_user=>@lab_user.as_json} }
else
format.html { render :action => 'edit' }
format.json { render :json => {:success=>false, :errors=> @lab_user.errors}, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"def update\n respond_to do |format|\n if @lab_us... | [
"0.6696875",
"0.6186183",
"0.6172667",
"0.61507875",
"0.61284614",
"0.6025905",
"0.59806406",
"0.5942275",
"0.59141713",
"0.59137934",
"0.5913523",
"0.59059465",
"0.58524704",
"0.5849189",
"0.5819567",
"0.5815567",
"0.5808175",
"0.5785233",
"0.57784307",
"0.57784307",
"0.5749... | 0.5892333 | 12 |
DELETE /lab_users/1 DELETE /lab_users/1.xml | def destroy
respond_to do |format|
#when removing someone from a lab, you need to end their lab
@lab_user.end_lab
@lab_user.destroy
format.html { redirect_to(lab_users_path) }
format.json { render :json=> { :success=>true, :message=>'lab user removed'} }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def delete_users\n delete(users_path)\n end",
"def destroy\n @user = ... | [
"0.6878262",
"0.6797821",
"0.66255116",
"0.6539781",
"0.6521376",
"0.65021044",
"0.65009737",
"0.6482622",
"0.6478631",
"0.64693964",
"0.64634985",
"0.6427895",
"0.6395588",
"0.63879114",
"0.63869697",
"0.6383369",
"0.63735974",
"0.6362089",
"0.6355484",
"0.6355484",
"0.63446... | 0.61984867 | 82 |
return labuser and it's lab info based on labuser uuid | def labinfo
respond_to do |format|
format.html { redirect_to(root_path, notice: 'Invalid request') }
format.json { render :json=> ImportLabs.export_labuser(params[:uuid], params[:pretty]) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lab_user\n Cucumber::Chef::Config[Cucumber::Chef::Config.provider][:lab_user]\n end",
"def get_user(username)\n Chef::Log.info username\n user = @node[:users][username]\n Chef::Log.info user.inspect\n user\nend",
"def lab_user_id\n plaintext_id = \"#{@view_options[:channel]}:#{user_or_se... | [
"0.63693494",
"0.626337",
"0.6244368",
"0.62398934",
"0.61564606",
"0.59039146",
"0.5831387",
"0.5679249",
"0.56510717",
"0.5622008",
"0.55465883",
"0.55327034",
"0.5517035",
"0.54975665",
"0.54561967",
"0.54508966",
"0.5444654",
"0.5365396",
"0.5363711",
"0.53626484",
"0.534... | 0.6041976 | 5 |
before_action :set_assignee, only: [:new, :create, :edit, :update, :destroy] | def index
@photos = policy_scope(Photo)
@photo = Photo.new
@assignee = Assignee.find(params[:approver_id] || params[:guardian_id] || params[:recipient_id] || params[:assignee_id]) if params[:approver_id] || params[:guardian_id] || params[:recipient_id] || params[:assignee_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_assigner\n @assigner = Assigner.find(params[:id])\n end",
"def set_assigner\n @assigner = Assigner.find(params[:id])\n end",
"def assigner_params\n params.require(:assigner).permit(:task_id, :user_id)\n end",
"def initialize(*args)\r\n super\r\n @action = :assign\r\nend",
... | [
"0.7186971",
"0.7186971",
"0.68563867",
"0.68222964",
"0.667966",
"0.667966",
"0.66776174",
"0.66749144",
"0.66112024",
"0.65751064",
"0.6500225",
"0.64775145",
"0.63925564",
"0.63865566",
"0.6345604",
"0.63261503",
"0.631618",
"0.63020486",
"0.63016427",
"0.62534374",
"0.625... | 0.0 | -1 |
before_action :set_message, only: %i[ show edit update destroy ] GET /messages or /messages.json | def index
@messages = Message.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_message\n @message = Message.find(params[:id])\n authorize @message\n end",
"def set_message\n if (params[:id].nil?)\n # @message = Message.find(params[:id])\n end\n end",
"def set_message\r\n @message = Message.find(params[:id])\r\n end",
"def set_message\n ... | [
"0.6668982",
"0.65535486",
"0.6497759",
"0.6485363",
"0.6466215",
"0.6454117",
"0.6451692",
"0.6451692",
"0.6451692",
"0.6451692",
"0.6451692",
"0.6451692",
"0.6451692",
"0.6451692",
"0.6451692",
"0.6451692",
"0.6451692",
"0.64188147",
"0.64188147",
"0.63941205",
"0.6383194",... | 0.0 | -1 |
GET /messages/1 or /messages/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @v1_message = V1::Message.find(params[:id])\n\n render json: @v1_message\n end",
"def messages_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MessagesApi.messages_get ...'\n end\n # resource path\n local... | [
"0.689082",
"0.68518597",
"0.683459",
"0.68263704",
"0.66642535",
"0.6630801",
"0.66219234",
"0.6600434",
"0.6595764",
"0.65915227",
"0.6583334",
"0.6579721",
"0.65685",
"0.6539185",
"0.6535771",
"0.6535771",
"0.6535771",
"0.6535771",
"0.6535771",
"0.6535771",
"0.6535771",
... | 0.0 | -1 |
POST /messages or /messages.json | def create
message = Message.new({content: params[:message], chatroom_id: params[:chatroomId].to_i, user_id: params[:userId].to_i})
if message.save
user = message.user
message_reactions = message.message_reactions
message_reactions.map {|reaction| {reaction: reaction, user: reaction.user}}
updatedChatroom = Chatroom.find(params[:chatroomId])
ActionCable.server.broadcast(
"chatroom_#{params[:chatroomId]}",
{
newMessage: {message: message, user: user},
messageReactions: message_reactions,
user: user,
updatedChatroom: updatedChatroom
}
)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end",
"def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end",
"def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end",
"def create\... | [
"0.74819237",
"0.6867244",
"0.6867244",
"0.67944425",
"0.66470176",
"0.66364",
"0.66077125",
"0.65904486",
"0.6579336",
"0.6530916",
"0.65242887",
"0.6514387",
"0.64589214",
"0.64374226",
"0.6426772",
"0.64240545",
"0.64221734",
"0.6412072",
"0.6404961",
"0.6401801",
"0.63782... | 0.0 | -1 |
PATCH/PUT /messages/1 or /messages/1.json | def update
respond_to do |format|
if @message.update(message_params)
format.html { redirect_to @message, notice: "Message was successfully updated." }
format.json { render :show, status: :ok, location: @message }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @message.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @message.up... | [
"0.7184797",
"0.70606303",
"0.7021847",
"0.698403",
"0.6979361",
"0.6976994",
"0.6967576",
"0.69522804",
"0.69522804",
"0.694486",
"0.68902403",
"0.68678486",
"0.68517536",
"0.6850133",
"0.6848943",
"0.6847985",
"0.6847985",
"0.6847985",
"0.6847985",
"0.6847985",
"0.6847985",... | 0.667852 | 86 |
DELETE /messages/1 or /messages/1.json | def destroy
@message.destroy
respond_to do |format|
format.html { redirect_to messages_url, notice: "Message was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def destroy\n # delete a specific message\n end",
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def destroy\n # delete a specific messag... | [
"0.77768886",
"0.7708586",
"0.7706946",
"0.76591605",
"0.7646406",
"0.7640255",
"0.7601341",
"0.75992024",
"0.75970477",
"0.75970477",
"0.75883824",
"0.7588306",
"0.7579826",
"0.7579826",
"0.7579826",
"0.7579826",
"0.75688785",
"0.7557959",
"0.7557959",
"0.7557959",
"0.755795... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_message
@message = Message.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def message_params
params.require(:message).permit(:content, :user_id, :chatroom_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69485277",
"0.6813547",
"0.6799911",
"0.6796169",
"0.6745757",
"0.6741778",
"0.6527065",
"0.65204644",
"0.64925444",
"0.64314413",
"0.64314413",
"0.64314413",
"0.6398711",
"0.6355623",
"0.6355327",
"0.6345812",
"0.6343951",
"0.6338371",
"0.6327366",
"0.6327366",
"0.6327366... | 0.0 | -1 |
returns an array of all the Employees who work at that role | def employees
Employee.all.select{|employee| employee.role == self}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def company_employee_list(company_id)\n roles = Role.where(company_id: company_id)\n workers = []\n User.where(id: roles.pluck(:user_id).uniq).each do |w|\n workers.push(\n id: w.id,\n email: w.email,\n roles: roles.where(user_id: w.id).select(:id, :name)\n )\n end\n w... | [
"0.7071529",
"0.70429456",
"0.68709403",
"0.67674553",
"0.6726405",
"0.67206436",
"0.66657573",
"0.6642868",
"0.6598172",
"0.65895873",
"0.64642835",
"0.63845545",
"0.6211491",
"0.618306",
"0.61317563",
"0.60660416",
"0.6055224",
"0.6036162",
"0.6036162",
"0.6025784",
"0.6012... | 0.8019726 | 0 |
build id > centroid cache | def build_centroids
#sql = "SELECT b.ogc_fid as id, ST_AsGeoJSON(ST_centroid(b.wkb_geometry)) as geo FROM buildings b"
sql = "SELECT b.ogc_fid as id,
st_x(st_transform(ST_Centroid(b.wkb_geometry),4326)) as lng,
st_y(st_transform(ST_Centroid(b.wkb_geometry),4326)) as lat
FROM buildings b;"
result_set = ActiveRecord::Base.connection.execute(sql)
results = {}
result_set.each do |row|
results[row['id']] = [row['lng'],row['lat']]
end
results
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_key(id); end",
"def initialize\n @identity_map = Hash.new\n end",
"def key_id=(_arg0); end",
"def key_id; end",
"def set_id_to_cache_key_map\n @ids.each do |id|\n @id_to_cache_key_map[id] = {\n kit: get_kit_cache_key(id),\n saas: get_saas_cache_key(id)\n ... | [
"0.593164",
"0.5630838",
"0.5594484",
"0.5537156",
"0.5518913",
"0.5458449",
"0.54288363",
"0.54115874",
"0.54096395",
"0.5408406",
"0.53992057",
"0.53882325",
"0.5386415",
"0.5376187",
"0.53726834",
"0.53705853",
"0.53212446",
"0.53114766",
"0.52939475",
"0.52934694",
"0.528... | 0.60702795 | 0 |
null object parent Sobreescribimos el metodo de current_user que nos da devise | def current_user
super || guest_user
#Super quiere decir que exactamente con los valores
#del metodo original sin cambiar nada
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n current_parent\n end",
"def parent\n User.find(self.user_id)\n end",
"def current_user\n current_user ||= Parent.find_by(id: session[:id])\n\n end",
"def current_user\n current_usuario\n end",
"def current_user\n nil\n end",
"def current_user\n super\n end",
"... | [
"0.72876644",
"0.7139101",
"0.7115013",
"0.70647514",
"0.70472246",
"0.70463896",
"0.70463896",
"0.6932307",
"0.68133706",
"0.6777462",
"0.6753491",
"0.67210376",
"0.67210376",
"0.67210376",
"0.67210376",
"0.67173916",
"0.67162454",
"0.6668918",
"0.66334194",
"0.6625624",
"0.... | 0.70095533 | 7 |
Called by NGINX. Sends streamup over websockets to users watching, and returns redirect response to nginx to internally redirect stream to the restricted hlsout RTMP app | def start
if params[:name]
streaming_user = User.where('stream_key = ?', params[:name]).first
if streaming_user
async_confirm_and_set_stream_state(streaming_user)
# Sending a redirect causes NGINX rtmp module to redirect the stream
# to the restricted hlsout application. This also effectively translates
# the users stream key to their username for client-side use.
redirect_to "rtmp://127.0.0.1/hlsout/" + streaming_user.username.downcase
else
render status: :not_found
end
else
render status: :not_found
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_drop_stream\n unless self.is_being_seeded || Rails.env.development? || Rails.env.test?\n params = {\n 'app' => 'stream',\n 'name' => stream_key_was\n }\n x = Net::HTTP.post_form(\n URI.parse(\n Rails.configuration.x.saber.stream_rtmp_control_url\n ),\... | [
"0.58280367",
"0.57718873",
"0.5579982",
"0.5522775",
"0.53750527",
"0.536677",
"0.5360725",
"0.53053564",
"0.52383673",
"0.52051324",
"0.52019185",
"0.51858497",
"0.5163819",
"0.51257485",
"0.5105848",
"0.5105848",
"0.5103562",
"0.5079626",
"0.50751495",
"0.5059812",
"0.5007... | 0.6716026 | 0 |
Called by NGINX. Sends streamdown over websockets to users watching stream | def stop
if params[:name]
streaming_user = User.where('stream_key = ?', params[:name]).first
if streaming_user
async_confirm_and_set_stream_state(streaming_user)
render status: :ok
else
render status: :not_found
end
else
render status: :not_found
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @quacks = Quack.all\n # SSE expects the `text/event-stream` content type\n response.headers['Content-Type'] = 'text/event-stream'\n\n sse = Reloader::SSE.new(response.stream)\n begin\n loop do\n sse.write({ :time => Time.now })\n sleep 1\n end\n rescue IOError\... | [
"0.610678",
"0.6084596",
"0.6043035",
"0.58969367",
"0.58438325",
"0.5815156",
"0.5815156",
"0.5779583",
"0.5752698",
"0.5662101",
"0.5658571",
"0.56455475",
"0.5612067",
"0.5581128",
"0.5558989",
"0.5548527",
"0.54962933",
"0.54947215",
"0.5463059",
"0.5456812",
"0.543579",
... | 0.0 | -1 |
Wait until HLS files are avaiable or unavailable for streaming before setting online status | def async_confirm_and_set_stream_state(streaming_user)
Thread.new do
stream_state_confirmed = false
retries = 30
retry_count = 0
confirmations = 15
confirmation_count = 0
stream_found_count = 0
stream_not_found_count = 0
until stream_state_confirmed do
# Check stream once per second
sleep 1
url = URI.parse(Rails.configuration.front_end_hostname +
'/hls/' + streaming_user.username.downcase + '/index.m3u8')
req = Net::HTTP.new(url.host, url.port)
req.use_ssl = true
res = req.request_head(url.path)
# If stream manifest is found, increment found_count and reset
# not_found count. Otherwise, do the opposite
if res.code == "200"
stream_found_count += 1
stream_not_found_count = 0
else
stream_not_found_count += 1
stream_found_count = 0
end
# If stream is confirmed, set status to true, and send a 'stream-up'
# message to all users in the broadcasters chat room.
if stream_found_count == confirmations
streaming_user.user_public_datum.online_status = true
if streaming_user.user_public_datum.save!
send_stream_state("stream-up", streaming_user)
stream_state_confirmed = true
break
end
elsif stream_not_found_count == confirmations
streaming_user.user_public_datum.online_status = false
if streaming_user.user_public_datum.save!
send_stream_state("stream-down", streaming_user)
stream_state_confirmed = true
break
end
end
# If retries exceed the limit, the stream is either down or unstable.
# Send 'stream-down' message to all chat room users.
if retry_count >= retries
streaming_user.user_public_datum.online_status = false
if streaming_user.user_public_datum.save!
send_stream_state("stream-down", streaming_user)
stream_state_confirmed = true
end
break
end
retry_count += 1
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_until_not_full; end",
"def wait\n Kernel.sleep self.interval until check_files\n end",
"def online\n gateway_check\n update_status(nil, @game, @streamurl)\n end",
"def poll_status_url(url)\n loop do\n response = connection.get(url)\n yield response.body\n ... | [
"0.6226796",
"0.6190148",
"0.61010474",
"0.60171115",
"0.5984374",
"0.5982183",
"0.5863519",
"0.5859245",
"0.5849903",
"0.58445406",
"0.5832351",
"0.5740435",
"0.5730877",
"0.5720811",
"0.5709433",
"0.5694138",
"0.5678089",
"0.5647087",
"0.56369615",
"0.5625646",
"0.560188",
... | 0.5716096 | 14 |
Send stream state over websocket to user channel | def send_stream_state(state, streaming_user)
WebSocket::Client::Simple.connect(
Rails.configuration.x.saber.chat_server,
headers: { "streamstate-auth": Rails.application.credentials.stream_state_auth }
) do |ws|
ws.on :open do
ws.send({
type: "StreamState",
data: {
state: state,
username: streaming_user.username.downcase
}
}.to_json)
ws.close
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _send_message state\n stream.with_stream! do | io |\n state.in_stream = io\n _write(state.message_payload, io, state)\n end\n end",
"def async_confirm_and_set_stream_state(streaming_user)\n Thread.new do\n stream_state_confirmed = false\n retries = 30\n ... | [
"0.6672159",
"0.6465095",
"0.6435608",
"0.6408094",
"0.6408094",
"0.6188834",
"0.61855716",
"0.5950496",
"0.59468573",
"0.5927827",
"0.590224",
"0.5900619",
"0.5715108",
"0.5707985",
"0.56854737",
"0.56694293",
"0.5641432",
"0.5627343",
"0.56225497",
"0.5613962",
"0.5593259",... | 0.86023664 | 0 |
Generate a Clickatellstyle response like ID: ny4eiyiac4qfy7do4mgrydqyacoen652 To: 2348162522097 ID: dxvtg2o9jhbqe4edifn026905st8mpz4 To: 2348162522102 | def generate_response
if @numbers.size == 1
@mock_response =
"ID: #{rand_string(32)}" # Phone number is not given when it's the only one
else
@mock_response =
@numbers.map{|number|
"ID: #{rand_string(32)} To: #{number}"}.join("\n")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate\n blake160_bin = [blake160[2..-1]].pack(\"H*\")\n type = [\"01\"].pack(\"H*\")\n bin_idx = [\"P2PH\".each_char.map { |c| c.ord.to_s(16) }.join].pack(\"H*\")\n payload = type + bin_idx + blake160_bin\n ConvertAddress.encode(@prefix, payload)\n end",
"def purchase_response(... | [
"0.5749803",
"0.56259435",
"0.5623994",
"0.558258",
"0.55555594",
"0.55321133",
"0.5463289",
"0.5434888",
"0.54205745",
"0.5410976",
"0.5382934",
"0.53603685",
"0.5352169",
"0.5337962",
"0.53250355",
"0.5305058",
"0.5304313",
"0.5279206",
"0.52769774",
"0.52545005",
"0.524018... | 0.6687389 | 0 |
Yet to be tested DELETE /nodes/:node_id | def delete_server(server_id)
@options = {:path => "/servers/delete",
:body => ""}.merge(@options)
@options[:query]=@options[:query].merge(server_id)
request(
:expects => 200,
:method => :delete,
:body => @options[:body]
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n \n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Node was successfully deleted.' }\... | [
"0.76476693",
"0.7589126",
"0.75564736",
"0.75471574",
"0.75142425",
"0.75023645",
"0.75023645",
"0.75023645",
"0.74632853",
"0.74632853",
"0.74632853",
"0.74632853",
"0.74632853",
"0.74330837",
"0.74310005",
"0.7331386",
"0.7305195",
"0.726349",
"0.7163339",
"0.71597904",
"0... | 0.0 | -1 |
Override to_json to sanitize output | def serializable_hash(options = {})
pre_sanitized_hash = super({
:only => [:id, :name, :email]
}.merge(options))
# Sanitize
pre_sanitized_hash.merge({
"name" => Rack::Utils.escape_html(self.name),
"email" => Rack::Utils.escape_html(self.email)
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json\n to_raw.to_json\n end",
"def to_json!\n self.to_hash.to_json\n end",
"def to_json\n raise StandardError, \"Not implemented!\"\n end",
"def to_json\n @json ||= get_json\n end",
"def to_json_raw(*args)\n #This is a stub, used for indexing\n ... | [
"0.71091324",
"0.7070944",
"0.7013781",
"0.70020175",
"0.69998175",
"0.6885053",
"0.68568146",
"0.68413514",
"0.6804717",
"0.6778572",
"0.6772898",
"0.6740202",
"0.673947",
"0.673947",
"0.6723391",
"0.67147934",
"0.67142653",
"0.67085356",
"0.6708394",
"0.6708394",
"0.6706822... | 0.0 | -1 |
returns a hash mapping each letter to its frequency. Do not include spaces. | def letter_count(str)
counts = {}
str.each_char do |char|
next if char==" "
counts[char] =0 unless counts.include?(char)
counts[char]+=1
end
counts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frequency\n # normal string which has assigned all the alphabets\n name = 'abcdefghijklmnopqrstuvwxyz'\n # this line will first split 'name' string and then assign it to hash\n @letters = name.split('').reduce(@letters){|alphabet,count| alphabet[count] +=0; alphabet}\n # this will convert all th... | [
"0.8173194",
"0.8149677",
"0.81445986",
"0.8137479",
"0.79474926",
"0.79324096",
"0.7926586",
"0.7902801",
"0.78996736",
"0.78863686",
"0.7857806",
"0.7782786",
"0.775013",
"0.76953506",
"0.76889914",
"0.7668839",
"0.76588756",
"0.75699896",
"0.7553269",
"0.7549146",
"0.75149... | 0.67525136 | 100 |
FUNCTIONS USED BY THE APP Default rate limiting method | def check_rate
if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2
sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i
puts("Waiting for #{sleep_time} seconds to allow for rate limit to be reset")
sleep sleep_time
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def throttle_api\n Rate::Limiter.new(request.env['REMOTE_ADDR'], request.env['REQUEST_PATH']).set\n end",
"def rate_limit\n if current_user.nil?\n rate_limit_by_api_key\n else\n rate_limit_by_user\n end\n end",
"def rate_limit\n new_request=RequestLimit.new({ip:request.remote_ip.to_s... | [
"0.750423",
"0.7502726",
"0.73384",
"0.7310064",
"0.72990054",
"0.72097987",
"0.7160852",
"0.71251214",
"0.71103394",
"0.71011657",
"0.7098245",
"0.70155466",
"0.694872",
"0.6900897",
"0.6851895",
"0.68482524",
"0.68378204",
"0.6829347",
"0.676603",
"0.675675",
"0.674409",
... | 0.598942 | 67 |
sidekiq_options :retry => false | def perform(user_id,alert,id,nt,name,activity_id)
user = User.find(user_id)
user.devices.each do |device|
@activity = Activity.find(activity_id) unless activity_id == 0
if @activity
user.notifications.create(notification_type: @activity.activity_type, user_id: @activity.item_id, content: @activity.message )
end
if @activity and (@activity.activity_type == "friend_request")
nt = "friend_request"
end
p"=====user_id========#{user_id.inspect}================="
p"=========nt====#{nt.inspect}================="
p"=====activity_id========#{activity_id.inspect}================="
p "device_id: #{device.device_id}===========device_type: #{device.device_type}"
if (device.device_type == 'iOS')
p "device_id: #{device.device_id}===========device_type: #{device.device_type}"
pusher = Grocer.pusher(
certificate: Rails.root.join('MobiloitteDevelopment.pem'),
passphrase: "Mobiloitte1",
gateway: "gateway.sandbox.push.apple.com",
#gateway: "gateway.push.apple.com",
port: 2195,
retries: 3
)
notification = Grocer::Notification.new(
:device_token => device.device_id.to_s,
:alert => alert,
custom: {:Notification_id => id, :Notification_type => nt,name: name,activity_id: activity_id},
:badge => 1,
:sound => "siren.aiff",
:expiry => Time.now + 60*60,
:identifier => 1234,
:content_available => true
)
push = pusher.push(notification)
elsif (device.device_type == 'android')
p "deviceandroid_id: #{device.device_id}===========device_type: #{device.device_type}"
gcm = GCM.new("AIzaSyAigkMoPSiWg2vq-CQJZNYM5Hvh3-Qu9MQ")
registration_ids= ["#{device.device_id}"]
options = {
'data' => {
'message' =>['alert' => alert,'badge' => 1,'Notification_id' => id,'Notification_type' => nt,'name' => name, 'activity_id' => activity_id]
},
"time_to_live" => 108,
"delay_while_idle" => true,
"collapse_key" => 'updated_state'
}
response = gcm.send_notification(registration_ids,options)
logger.info"====================#{response}++++++++++++++++"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n Sidekiq::Worker.clear_all\n end",
"def retry_options\n {tries: 15, sleep: 1}\n end",
"def silence_single_worker_warning; end",
"def disable_until_finished_or_interrupted; end",
"def lock_timeout_retries; end",
"def lock_timeout_retry_delay; end",
"def clean_sidekiq\n ... | [
"0.6580955",
"0.64084613",
"0.6309883",
"0.6303499",
"0.59379095",
"0.58770365",
"0.57881063",
"0.5756289",
"0.5748831",
"0.572569",
"0.57132155",
"0.5707041",
"0.5687238",
"0.5659512",
"0.56595105",
"0.5650672",
"0.5650672",
"0.5641426",
"0.56057924",
"0.559615",
"0.5578624"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.