query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
GET /employee/edit/1 GET /employee/edit/1.json | def edit
@employee = Employee.find(params[:id])
@employee_contact = @employee.employee_contact.blank? ? EmployeeContact.new : @employee.employee_contact
@employee_ec_contact = @employee.employee_ec_contact.blank? ? EmployeeEcContact.new : @employee.employee_ec_contact
@employee_job = @employee.employee_job.blank? ? EmployeeJob.new : @employee.employee_job
@employee_salary = @employee.employee_salary.blank? ? EmployeeSalary.new : @employee.employee_salary
@employee_qualification = @employee.employee_qualification.blank? ? EmployeeQualification.new : @employee.employee_qualification
@employee_membership = @employee.employee_membership.blank? ? EmployeeMembership.new : @employee.employee_membership
@employee_spouse = @employee.employee_spouse.blank? ? EmployeeSpouse.new : @employee.employee_spouse
@form_id = 'edit-form'
@users = User.order(:username).all
@supervisors = Employee.all
@designations = Designation.order(:title).all
@employment_statuses = EmploymentStatus.order(:name).all
@job_categories = JobCategory.order(:name).all
@departments = Department.order(:name).all
respond_to do |fmt|
fmt.html { render :partial => 'form' }
fmt.json { render :json => @employee }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @employee = Employee.find(params[:id])\n end",
"def edit\n @employee = Employee.find(params[:id])\n respond_to do |format|\n # format.html { render action: \"index\" }\n format.js\n # format.json { render json: @employee }\n end\n end",
"def edit\n @employee = Employee.find(params[:id])\n @url = { controller: '/employees', action: :update }\n render :form\n end",
"def edit\n @employee = Employee.find(params[:employee_id])\n\n # For URL like /employees/1/annuals/2/edit\n # Get annual id=2 for employee 1\n @annual = @employee.annuals.find(params[:id])\n end",
"def update\n @employee = current_owner.employees.find(params[:id])\n puts \"#{params}\"\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\t\t@person = Person.find_by(id: params[:id])\n\t\t# @person.save\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend",
"def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n \n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n render action: 'edit'\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_url, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_path, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n respond_to do |format|\n format.html\n format.json { render :json => @user }\n end\n end",
"def edit\n respond_with(resource)\n end",
"def create\n @employee = Employee.new(employee_params)\n @employee.id = current_user.id\n # pass the current_user id to the employee to keep the records tight\n edit\n \n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find_by_id(params[:id])\n @employee.update_attributes({:id => params[:id],\n :name => params[:name],\n :title => params[:title],\n :status => params[:status],\n :employment_type => params[:employment_type],\n :attendance_type_id => params[:attendance_type_id],\n :hourly_rate => params[:hourly_rate],\n :location => params[:location],\n :capitalizable_group_id => params[:capitalizable_group_id],\n :leave_days => params[:leave_days],\n :commencement_date => params[:commencement_date],\n :termination_date => params[:termination_date]})\n if request.xhr?\n render :json => @employee\n end\n end",
"def edit\n respond_with(@sicoss_employer_type)\n end",
"def update\n @employe = Employe.find(params[:id])\n\n respond_to do |format|\n if @employe.update_attributes(params[:employe])\n format.html { redirect_to @employe, notice: 'Employe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: \"Employee was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage, Employee\n if responsibility_changes?\n new_employee = Employee.new_from_old(employee_params['responsibility'], @employee)\n @employee.destroy\n new_employee.save\n @employee = new_employee\n end\n\n respond_to do |format|\n if @employee.update(employee_attrs)\n format.html { redirect_to (@employee.try(:employee) || @employee), notice: t('action.update.succeed', entity: Employee.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @employee = Employee.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee }\n end\n end",
"def employee(employee_id)\n get(\"employees/#{employee_id}\")\n end",
"def show\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee }\n end\n end",
"def edit\n respond_to do |format|\n format.json { render :json => @user } \n format.xml { render :xml => @user }\n format.html\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to(@employee, :notice => 'Employee was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n CustomLogger.info(\"Se actualiza empleado: #{@employee}, usuario: #{current_user.inspect}, #{Time.now}\")\n format.html { redirect_to new_employee_path, notice: 'Empleado Actualizado Exitosamente!' }\n format.json { head :no_content }\n else\n CustomLogger.error(\"Error al actualizar empleado: #{@employee}, usuario: #{current_user.inspect}, #{Time.now}\")\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:company_id])\n @employee = @company.employees.find(params[:id]) \n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to company_employees_url(@company), notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n respond_with(@exercise)\n end",
"def edit\n @person = Person.find(params[:id])\n end",
"def edit\n @person = Person.find(params[:id])\n end",
"def edit\n @person = Person.find(params[:id])\n end",
"def update\n\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'El contacto a sido actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n # format.html { render :layout => false }\n format.html\n format.any(:xml, :json) { render request.format.to_sym => @resource }\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_path, notice: 'El empleado ha sido actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @employee, :update?\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Funcionário atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_personal.update(employee_personal_params)\n format.html { redirect_to @employee_personal, notice: 'Employee personal was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_personal }\n else\n format.html { render :edit }\n format.json { render json: @employee_personal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def edit\n respond_with(page)\n end",
"def create\n if :opr == 'edit'\n update\n else\n @employee = Employee.create({:name => params[:name],\n :title => params[:title],\n :status => params[:status],\n :employment_type => params[:employment_type],\n :attendance_type_id => params[:attendance_type_id],\n :hourly_rate => params[:hourly_rate],\n :location => params[:location],\n :capitalizable_group_id => params[:capitalizable_group_id],\n :leave_days => params[:leave_days],\n :commencement_date => params[:commencement_date],\n :termination_date => params[:termination_date]})\n if request.xhr?\n render :json => @employee\n end\n end\n\n\n end",
"def employee\n if EMPLOYEES_VIEW_MUST_HAVE.include?(Employee.where(id: session[\"found_user_id\"]).first.admin_rights)\n id = params[\"employee_id\"]\n else\n id = session[\"found_user_id\"]\n end\n @ADMIN_RIGHTS = ADMIN_RIGHTS\n @EMPLOYEES_VIEW_MUST_HAVE = EMPLOYEES_VIEW_MUST_HAVE \n if id == \"new\"\n @employee = Employee.new\n @employee.view_pref = \"all\"\n else\n @employee = Employee.where(florist_id: session[\"found_florist_id\"]).where(id: id).first\n end\n render(:employee_edit) and return\n end",
"def update\n @employ = Employ.find(params[:id])\n\n respond_to do |format|\n if @employ.update_attributes(params[:employ])\n format.html { redirect_to @employ, notice: 'Employ was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employ.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @item = Item.find(params[:id])\n respond_to do |format|\n format.json { render :json => @item }\n format.xml { render :xml => @item }\n format.html\n end\n end",
"def show\n @employee = Employee.find[params[:id]]\n end",
"def update\n respond_to do |format|\n if(@employee==nil)\n format.html { redirect_to employees_path, notice: 'Employee id not found' }\n elsif @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Funcionario was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_employee.update(admin_employee_params)\n format.html { redirect_to admin_employees_path, notice: 'Funcionário foi editado com sucesso.' }\n else\n format.html { render :edit }\n format.json { render json: @admin_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\n end",
"def edit\n respond_to do |format|\n format.html { render :action => resource_template(\"edit\") }\n end\n end",
"def update\n respond_to do |format|\n if @aga_employee.update(aga_employee_params)\n format.html { redirect_to @aga_employee, notice: 'Aga employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @aga_employee }\n else\n format.html { render :edit }\n format.json { render json: @aga_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # raise params.to_s\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Работник обновлен.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employeedetail.update(employeedetail_params)\n format.html { redirect_to @employeedetail, notice: \"Employeedetail was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employeedetail }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @employeedetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @user = User.find(params[:id])\n @form_id = 'edit-form'\n \n respond_to do |fmt|\n fmt.html { render partial: 'form' }\n fmt.json { render json: @user }\n end\n end",
"def edit\n respond_to do |format|\n format.json { render :json => @admin } \n format.xml { render :xml => @admin }\n format.html\n end\n \n rescue ActiveRecord::RecordNotFound\n respond_to_not_found(:json, :xml, :html)\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee page was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n\n # if @employee.update_attributes(employee_params)\n # flash[:success] = \"Employee updated\"\n # redirect_to @employee\n # else\n # render 'edit'\n # end\n\n end",
"def edit\n # When a http GET request to '/users/1/edit' is received, have it render:\n # a view file with a form with user 1's information in the appropriate input field.\n @id = params[:id]\n @user = User.find(@id)\n end",
"def edit\n\t\t@post = Post.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def edit\n\n end",
"def set_employee_detail\n @employee_detail = EmployeeDetail.find(params[:id])\n end",
"def set_employeedetail\n @employeedetail = Employeedetail.find(params[:id])\n end",
"def update\n #respond_to do |format|\n\t\n\temployee = Employee.find_by id: @employee.id\n\tuser = User.find_by id: @employee.user_id\n\temployee.firstname = params[:firstname]\n\temployee.lastname = params[:lastname]\n\tuser.roles_mask = params[:Role]\n if(user.roles_mask != nil)\n if employee.save && user.save\n\t@employee = Employee.find_by user_id: current_user.id\n\trender \"index\"\n else\n\tflash[:alert] = \"Invalid data\"\n\trender \"edit\"\n end\n else\n\tif employee.save\n\t@employee = Employee.find_by user_id: current_user.id\n\trender \"index\"\n else\n\tflash[:alert] = \"Invalid data\"\n\trender \"edit\"\n end\n end\n end",
"def update\n #respond_to do |format|\n if @employee.update(employee_params)\n # format.html { redirect_to employee_path(@employee), notice: 'User was successfully updated.' }\n # format.json { render :show, status: :ok, location: @employee }\n redirect_to employee_path(@employee), notice: 'User was successfully updated.'\n else\n #format.html { render :edit }\n #format.json { render json: @employee.errors, status: :unprocessable_entity }\n redirect_to employee_path(@employee), notice: 'User was not updated.'\n\n end\n #end\n end",
"def edit\n respond_to do |format|\n format.html {}\n format.json { render json: @invoice, status: :ok, location: @invoice }\n end\n\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end",
"def set_employee\n @employee = Employee.find(params[:id])\n end"
] | [
"0.80351394",
"0.7999853",
"0.7531273",
"0.75276196",
"0.7290397",
"0.72233635",
"0.7132575",
"0.7132575",
"0.7114641",
"0.7065122",
"0.7040112",
"0.7040112",
"0.7040112",
"0.7016973",
"0.69972116",
"0.69102955",
"0.6908866",
"0.6908866",
"0.6908866",
"0.6908866",
"0.6908866",
"0.6908866",
"0.6908866",
"0.6908866",
"0.6908866",
"0.6908866",
"0.6908866",
"0.6873627",
"0.6861014",
"0.6845266",
"0.6822842",
"0.67971927",
"0.67956847",
"0.67600006",
"0.6757691",
"0.67396915",
"0.6737813",
"0.67350864",
"0.6710046",
"0.6700563",
"0.66859096",
"0.66803867",
"0.66785765",
"0.6659916",
"0.6659916",
"0.6659916",
"0.66501325",
"0.6648319",
"0.66429526",
"0.66391075",
"0.6635986",
"0.66131556",
"0.6590711",
"0.6581615",
"0.65814084",
"0.6576639",
"0.6573942",
"0.6572861",
"0.6561918",
"0.65606016",
"0.6559794",
"0.65550923",
"0.6545991",
"0.65417",
"0.65288204",
"0.65133655",
"0.6507251",
"0.6498401",
"0.649826",
"0.6491807",
"0.6484029",
"0.6484029",
"0.6484029",
"0.6484029",
"0.6484029",
"0.6484029",
"0.64820224",
"0.647264",
"0.6469968",
"0.64675295",
"0.645696",
"0.6455109",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469",
"0.645469"
] | 0.71566314 | 6 |
Move the given register to temporary storage and rewrite reads from it to point to the new location. | def spill(reg)
spill_move = Move.new(reg, SPILL_REG, true)
@moves.each do |move|
move.src = SPILL_REG if move.src == reg
end
@moves << spill_move
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shiftRight(register)\n\tregister.unshift(0).pop\nend",
"def pop_reg reg\n @fisk.pop reg.to_register\n end",
"def with_register name = \"temp\"\n reg = register(name)\n yield reg\n release_register reg\n end",
"def register name = \"temp\"\n Registers::Temp.new name, \"r64\"\n end",
"def atomic_replace\n @mutex.synchronize do\n @new_registry = @exported_registry.clone\n\n begin\n yield(@new_registry)\n ensure\n @exported_registry = @new_registry\n end\n end\n\n nil\n end",
"def store_register (instruction)\n op_code, f = extract_op_code_and_modifier(instruction)\n register = select_register_from_op_code(op_code, Instructions::OP_STA)\n word = extract_word_from_memory(instruction)\n left, right = explode_f(f)\n @logger.debug('Setting %s (%d,%d) word at location %d' %[register.to_s, left, right, calculate_modified_address(instruction)]) if @logger.debug?\n word.store_value(register, left, right)\n end",
"def call_move(reg_key, addr, i_reg, m_spec)\n to_addr = get_mem_addr(addr, i_reg)\n from_addr = @registers['I1'].word.to_i\n\n (0..(m_spec - 1)).each do |i|\n @computer.memory.write(to_addr + i, @computer.memory.read(from_addr + i))\n end\n end",
"def read_register(reg_or_val, options = {})\n write_register(reg_or_val, options.merge(write: false))\n end",
"def put_dest(mode, dst_r)\n case mode\n when 1 # Register direct\n temp = @reg[dst_r]\n x = yield temp\n @reg[dst_r] = x\n when 2 # Indirect\n dst_address = @mem.read(@pc)\n @pc += 1\n temp = @mem.read(dst_address)\n new_value = yield temp\n @mem.write(dst_address, new_value)\n when 3 # Register indirect\n dst_address = @reg[dst_r]\n temp = @mem.read(dst_address)\n new_value = yield temp\n @mem.write(dst_address, new_value)\n end\n end",
"def shiftLeft(register)\n\tregister.shift\n\tregister.push(0)\nend",
"def st(wf, dest_pair, src_reg)\n d = DIR_WRITE\n a = $pairs[dest_pair]\n r = reg_to_pair(src_reg)\n u = src_reg_to_alu_op(src_reg)\n\n # Note that we don't need to latch the generated address:\n # we can just use transparent mode because none of the GP\n # registers can change during the store\n\n # +------------ 0: read dest addr, assert to l/r busses, read src reg to ALU data bus\n # | +--------- 1: send reg data to external data bus, start external write\n # | | +------ 2: clock data into external memory\n # | | | +--- 3: end external write, end instruction\n # | | | |\n wf.play 'rdGPAddr', a, a, a, _\n wf.play 'rdGP', x, x, x, _\n wf.play 'driveAddr', x, x, x, _\n wf.play 'aluOp', u, u, u, _\n wf.play 'aluOut', x, x, x, _\n wf.play 'memDir', d, d, d, _\n wf.play 'rwMem', _, x, x, _\n wf.play 'extRW', _, x, _, _\n wf.play '-endUncond', _, _, _, x\nend",
"def <<( reg )\n reg = reg.to_reg() if reg.is_a?( RegisterSlot )\n raise \"not reg value or slot #{reg}\" unless reg.is_a?(RegisterValue)\n to_mem(\"#{reg.class_name} -> #{register.class_name}[#{index}]\" , reg)\n end",
"def store(idx, reg)\n raise RangeError, \"Expect 0 <= idx < 16, got #{idx}.\" unless idx.between?(0, 15)\n\n values[idx] = values[reg.downcase.to_sym]\n end",
"def mov(wf, dest_reg, src_reg)\n r = reg_to_pair(src_reg)\n w = reg_to_pair(dest_reg)\n u = src_reg_to_alu_op(src_reg)\n dest_bank = dest_reg_to_bank(dest_reg)\n\n wf.play 'rdGPAddr', r, r, r, _\n wf.play 'rdGP', x, x, x, _\n wf.play 'wrGPAddr', w, w, w, _\n wf.play dest_bank, _, x, _, _\n wf.play 'aluOp', u, u, u, _\n wf.play 'aluOut', x, x, x, _\n wf.play '-endUncond', _, _, _, x\nend",
"def read_register(reg, options = {})\n if reg_wrapped_by_dcrsr?(reg)\n pp(\"Reading and Comparing Core Register: DCRDR <- #{reg.name}.data (expecting #{reg.data}\") do\n core_reg_to_dcrdr(reg, options)\n reg(:dcrdr).read!(reg.data)\n end\n else\n # Nothing special about this registers. Write it as normal.\n parent.read_register(reg, options)\n end\n end",
"def resolveXCH\r\n puts \"Before Swap, Register A: \" + @RegA.to_s + \"\\tRegister B: \" + @RegB.to_s\r\n temp = @RegA\r\n @RegA = @RegB\r\n @RegB = temp\r\n puts \"After Swap, Register A: \" + @RegA.to_s + \"\\tRegister B: \" + @RegB.to_s\r\n end",
"def temporary_registration\n @temporary_registration ||= TemporaryRegistration.make!(event: event)\n end",
"def repoint\n unless @rom && @table && @index\n fail 'Rom, table and index must be set before repointing.'\n end\n\n l = (@lz77 ? to_lz77.length : to_bytes.length)\n f_offset = @rom.find_free(l)\n\n unless f_offset\n fail \"Bytestream#repoint: Could not find #{l} bytes of free data in\" \\\n \" #{@rom}. Consider using a clean rombase.\"\n end\n\n @rom.write_offset_to_table(@table, @index, f_offset)\n clear_cache\n f_offset\n end",
"def move_right\n @memory_position += 1\n @memory_position = 0 if @memory_position > 0xfffffe\n end",
"def rm_indexed_memory_operand_with_displacement(mod, rm, displacement, width_bit)\n\t\trm_name, rm_indices = @rm_index_operands[rm]\n\t\tbits = width_bit == 1 ? 16 : 8\n\t\tindex = rm_indices.inject(0) { |sum, register| sum + register.value }\n\t\taddress_string = \"[#{rm_name} + #{displacement.to_s(16)}]\"\n\t\tMemoryAccess.new(@ram, @ds.displacement, (index + displacement).to_unsigned_16_bits, bits, address_string)\n\tend",
"def copy(reg)\n size.times do |i|\n source_bit = reg.bit[i]\n @bits[i].overlay(source_bit.overlay_str) if source_bit.has_overlay?\n @bits[i].write(source_bit.data)\n end\n self\n end",
"def write_in_register(instruction)\n op_code, f = extract_op_code_and_modifier(instruction)\n register = select_register_from_op_code(op_code, Instructions::OP_ENTA)\n modified_address = calculate_modified_address(instruction)\n\n if f == Instructions::F_INCA or f == Instructions::F_DECA\n operation = 'increment_value'\n else\n operation = 'store_long'\n end\n if f == Instructions::F_DECA or f == Instructions::F_ENNA\n modified_address = 0 - modified_address\n end\n @logger.debug('Applying operation %s to %s ' % [operation, register]) if @logger.debug?\n register.send(operation, modified_address)\n end",
"def mov(trg_reg_id, src_reg_id)\n reg(trg_reg_id).cell_set!(reg(src_reg_id).cell_data)\n end",
"def copy_data_from(reg)\n size.times do |i|\n @bits[i].write(reg.bit[i].data)\n end\n self\n end",
"def assign_registers list, local: false\n temp_registers = @temp_registers\n\n # This mutates the temp registers, setting their end_point based on\n # the CFG\n self.cfg unless local\n\n temp_registers.each do |reg|\n unless reg.end_point\n raise Errors::UnreleasedRegisterError, \"Register #{reg.name} hasn't been released\"\n end\n end\n\n temp_registers = temp_registers.sort_by(&:start_point)\n\n active = []\n free_registers = list.reverse\n register_count = list.length\n\n temp_registers.each do |temp_reg|\n # expire old intervals\n active, dead = active.sort_by(&:end_point).partition do |j|\n j.end_point >= temp_reg.start_point\n end\n\n # Add unused registers back to the free register list\n dead.each { |tr| free_registers << tr.register }\n\n if active.length == register_count\n raise NotImplementedError, \"Register spilled\"\n end\n\n temp_reg.register = free_registers.pop\n active << temp_reg\n end\n end",
"def temporary_frame(frame, &block)\n old = current_frame\n @current_frame = frame\n block.call\n @current_frame = old\n end",
"def reduce_and_load(const_reg , compiler , original_source )\n raise \"only cache\" unless known_object.is_a?( Parfait::CacheEntry)\n load = Risc.load_constant(original_source, known_object )\n left = load.register\n compiler.add_code load\n compiler.add_code Risc.reg_to_slot(original_source, const_reg , left, slots.name)\n end",
"def store_word(loc,out_register,offset)\n\t#Get Location in memory.\n\tlocation = (offset+REGISTERS[loc])/4\n\tsetnum = getSet(location).to_i(2)\n\ttag = getTag(location).to_i(2)\n\t#Hit Block 1?\tIf Hit: UPDATE CACHE\n\tif((CACHE[setnum.to_i][0]).tag == tag && (CACHE[setnum.to_i][0]).valid == 1)\n\t\t(CACHE[setnum.to_i][0]).data = REGISTERS[out_register]\n\t\tprint \"hit\\n\"\n\t#Hit Block 2?\tIf Hit: UPDATE CACHE\n\telsif((CACHE[setnum.to_i][1]).tag == tag && (CACHE[setnum.to_i][0]).valid == 1)\n\t\t(CACHE[setnum.to_i][1]).data = REGISTERS[out_register]\n\t\tprint \"hit\\n\"\t\t\n\telse\n\t\t#If Miss:UPDATE MEMORY\n\t\tprint \"miss\\n\"\n\t\t#Store register value in memory.\n\t\tMAIN_MEMORY[location] = REGISTERS[out_register]\n\tend\nend",
"def modrm_r_on instruction, stream\n address, register = instruction.first, instruction.second\n swap = false # TODO: this can be 1 call at the bottom\n\n if instruction.first.register? && instruction.second.register? then\n if parameters.first.memory_register? then\n return instruction.first.push_mod_rm_on(instruction.second, stream)\n else\n return instruction.second.push_mod_rm_on(instruction.first, stream)\n end\n end\n\n if instruction.first.special_register? then\n return instruction.second.push_mod_rm_on(instruction.first, stream)\n end\n\n if instruction.second.special_register? then\n return instruction.first.push_mod_rm_on(instruction.second, stream)\n end\n\n address, register = if instruction.first.register? && instruction.second.respond_to?(:push_mod_rm_on) then\n [instruction.second, instruction.first]\n else\n [instruction.first, instruction.second]\n end\n\n address.push_mod_rm_on register, stream\n end",
"def push_reg reg\n @fisk.push reg.to_register\n end",
"def redo_path\n self.path = @temp_path\n end",
"def read_nexus_register(reg_or_val, options = {})\n write_nexus_register(reg_or_val, options.merge(write: false))\n end",
"def store(val, at)\n flat(pop_rcx, at, pop_rdx, val, mov_prcx_rdx)\nend",
"def to_reg()\n source = \"reduce #{@register.symbol}[#{@index}]\"\n slot_to_reg = Risc.slot_to_reg(source , register, index)\n if compiler\n compiler.add_code(slot_to_reg)\n slot_to_reg.register.set_compiler(compiler)\n end\n slot_to_reg.register\n end",
"def reg(id)\n id == REG_MEMORY ? @memory : reg_abs(id)\n end",
"def temp(temporary_info, &b)\n set(temporary_info).tap {|x| yield(x)}\n return nil\n end",
"def reduce_and_load(const_reg , compiler , original_source )\n left = Risc.message_named_reg\n slot = slots\n while( slot.next_slot )\n left = left.resolve_and_add( slot.name , compiler)\n slot = slot.next_slot\n end\n compiler.add_code Risc.reg_to_slot(original_source, const_reg , left, slot.name)\n end",
"def read_register(reg, options = {})\n arm_debug.mem_ap.read_register(reg, options)\n end",
"def find_value(register)\n for r in @reg_writes\n if register == r.register\n return r.value\n end\n end\n\n nil\n end",
"def use_reg type , value = nil\n if @regs.empty?\n reg = Register.tmp_reg(type , value)\n else\n reg = @regs.last.next_reg_use(type , value)\n end\n @regs << reg\n return reg\n end",
"def rewrite before, after, reg = /\\#\\{(\\w+)\\}/, reg2 = '\\1'\n File.open(after, 'w') do |a|\n File.open(before) do |b|\n b.each do |line|\n a << line.gsub(reg) do\n if reg2.include? '\\1'\n reg2.gsub(%r!\\\\1!, Object.const_get($1))\n else\n reg2\n end\n end\n end\n end\n end\n end",
"def rewrite before, after, reg = /\\#\\{(\\w+)\\}/, reg2 = '\\1'\n File.open(after, 'w') do |a|\n File.open(before) do |b|\n b.each do |line|\n a << line.gsub(reg) do\n if reg2.include? '\\1'\n reg2.gsub(%r!\\\\1!, Object.const_get($1))\n else\n reg2\n end\n end\n end\n end\n end\n end",
"def rewrite before, after, reg = /\\#\\{(\\w+)\\}/, reg2 = '\\1'\n File.open(after, 'w') do |a|\n File.open(before) do |b|\n b.each do |line|\n a << line.gsub(reg) do\n if reg2.include? '\\1'\n reg2.gsub(%r!\\\\1!, Object.const_get($1))\n else\n reg2\n end\n end\n end\n end\n end\n end",
"def rewrite before, after, reg = /\\#\\{(\\w+)\\}/, reg2 = '\\1'\n File.open(after, 'w') do |a|\n File.open(before) do |b|\n b.each do |line|\n a << line.gsub(reg) do\n if reg2.include? '\\1'\n reg2.gsub(%r!\\\\1!, Object.const_get($1))\n else\n reg2\n end\n end\n end\n end\n end\n end",
"def rewrite before, after, reg = /\\#\\{(\\w+)\\}/, reg2 = '\\1'\n File.open(after, 'w') do |a|\n File.open(before) do |b|\n b.each do |line|\n a << line.gsub(reg) do\n if reg2.include? '\\1'\n reg2.gsub(%r!\\\\1!, Object.const_get($1))\n else\n reg2\n end\n end\n end\n end\n end\n end",
"def write_to_main_memory(slot)\n block_start_address = slot.tag + slot.num + \"0\"\n block_address = block_start_address.to_i(16)\n slot.saved_blocks.each do |block|\n @main_memory.content[block_address] = block\n block_address += 1\n end\n slot.is_dirty = 0\n end",
"def sh4LowerMisplacedSpecialRegisters(list)\n newList = []\n list.each {\n | node |\n if node.is_a? Instruction\n case node.opcode\n when \"move\"\n if node.operands[0].is_a? RegisterID and node.operands[0].sh4Operand == \"pr\"\n newList << Instruction.new(codeOrigin, \"stspr\", [node.operands[1]])\n elsif node.operands[1].is_a? RegisterID and node.operands[1].sh4Operand == \"pr\"\n newList << Instruction.new(codeOrigin, \"ldspr\", [node.operands[0]])\n else\n newList << node\n end\n when \"loadi\", \"loadis\", \"loadp\"\n if node.operands[1].is_a? RegisterID and node.operands[1].sh4Operand == \"pr\"\n tmp = Tmp.new(codeOrigin, :gpr)\n newList << Instruction.new(codeOrigin, node.opcode, [node.operands[0], tmp])\n newList << Instruction.new(codeOrigin, \"ldspr\", [tmp])\n else\n newList << node\n end\n when \"storei\", \"storep\"\n if node.operands[0].is_a? RegisterID and node.operands[0].sh4Operand == \"pr\"\n tmp = Tmp.new(codeOrigin, :gpr)\n newList << Instruction.new(codeOrigin, \"stspr\", [tmp])\n newList << Instruction.new(codeOrigin, node.opcode, [tmp, node.operands[1]])\n else\n newList << node\n end\n else\n newList << node\n end\n else\n newList << node\n end\n }\n newList\nend",
"def to_mem( source , from )\n reg_to_slot = Risc.reg_to_slot(source , from , register, index)\n compiler.add_code(reg_to_slot) if compiler\n reg_to_slot.register\n end",
"def load_word(loc,in_register,offset)\n\t#Loads from memory with offset into memory[register location]\n\t#Get Location in memory.\n\tlocation = (offset+REGISTERS[loc])/4\n\tsetnum = getSet(location).to_i(2)\n\ttag = getTag(location).to_i(2)\n\t#Hit Block 1? If so use it.\n\tif((CACHE[setnum.to_i][0]).tag == tag && (CACHE[setnum.to_i][0]).valid == 1)\n\t\tprint \"hit\\n\"\n\t\tREGISTERS[in_register] = (CACHE[setnum.to_i][0]).data\n\t#Hit Block 2? If so use it.\n\telsif((CACHE[setnum.to_i][1]).tag == tag && (CACHE[setnum.to_i][0]).valid == 1)\n\t\tprint \"hit\\n\"\n\t\tREGISTERS[in_register] = (CACHE[setnum.to_i][1]).data\t\n\telse\n\tprint \"miss\\n\"\n\t#No Hits, Then move to CACHE and then load into the register.\n\t\t#If left is LRU\n\t\tif(LRU[setnum.to_i] == 0)\n\t\t\tLRU[setnum.to_i] = 1\n\t\t\t(CACHE[setnum.to_i][0]).valid = 1\n\t\t\t(CACHE[setnum.to_i][0]).tag = tag\n\t\t\t(CACHE[setnum.to_i][0]).data = MAIN_MEMORY[location]\n\t\t\tREGISTERS[in_register] = (CACHE[setnum.to_i][0]).data\n\t\telse\n\t\t#If right is LRU\n\t\t\tLRU[setnum.to_i] = 0\n\t\t\t(CACHE[setnum.to_i][1]).valid = 1\n\t\t\t(CACHE[setnum.to_i][1]).tag = tag\n\t\t\t(CACHE[setnum.to_i][1]).data = MAIN_MEMORY[location]\n\t\t\tREGISTERS[in_register] = (CACHE[setnum.to_i][1]).data\t\t\t\n\t\tend\n\tend\nend",
"def reduce_and_load(const_reg , compiler , original_source )\n raise \"only cache\" unless known_object.is_a?( Parfait::CacheEntry)\n left = compiler.use_reg( :CacheEntry )\n compiler.add_code Risc.load_constant(original_source, known_object , left)\n compiler.add_code Risc.reg_to_slot(original_source, const_reg , left, slots.name)\n end",
"def read_register(reg, options = {})\n end",
"def modify\n save = modify_save_for_slot(2)\n\n save_hex = bin_file_to_hex save\n before_length = save_hex.length\n broad_sword_count = save_hex.scan(broad_sword).length\n puts \"[before] Broad sword x#{broad_sword_count}\"\n\n save_hex.gsub!(broad_sword, zwill_crossblades)\n after_length = save_hex.length\n raise 'Save corrupted!' unless before_length == after_length\n\n broad_sword_count = save_hex.scan(broad_sword).length\n puts \"[after] Broad sword x#{broad_sword_count}\"\n\n hex_to_bin_file(save, save_hex)\n\n FileUtils.cp save, 'C:\\Users\\surface\\AppData\\Local\\Temp\\SWPS4MAX\\__gameplay____slot2__gameplay0.save'\n end",
"def release_register reg\n if reg.end_point\n raise Errors::AlreadyReleasedError, \"register #{reg.name} already released at #{reg.end_point}\"\n end\n\n reg.end_point = (@instructions.length - 1)\n end",
"def edit_temp(opts = {})\n temp_file do |f|\n f.puts(opts[:temp])\n f.flush\n f.close(false)\n invoke_editor(f.path, opts[:line], true)\n @content = File.read(f.path)\n end\n end",
"def swap(new)\n v = @tvar.value\n raise Ractor::RetryTransaction if v == EMPTY\n\n @tvar.value = new\n v\n end",
"def load_in_register (instruction)\n op_code, f = extract_op_code_and_modifier(instruction)\n negate = op_code >= Instructions::OP_LDAN\n register = select_register_from_op_code(op_code,\n negate ? Instructions::OP_LDAN : Instructions::OP_LDA)\n word = extract_word_from_memory(instruction)\n word.negate if negate\n left, right = explode_f(f)\n @logger.debug('Setting %s (%d,%d) from word at location %d into register' %[word.to_s, left, right, calculate_modified_address(instruction)]) if @logger.debug?\n register.load_value(word, left, right)\n end",
"def update_io\n io = create_tempfile\n rewind\n @io = (io << @io.read; io)\n __setobj__(@io)\n @in_memory = false\n nil\n end",
"def write_register(reg, options = {})\n arm_debug.mem_ap.write_register(reg, options)\n end",
"def store!\n unlink! @original_path\n return nil unless @tempfile_path\n\n new_path = path\n FileUtils.mkdir_p File.dirname(new_path)\n result = if @tempfile_path =~ /\\/te?mp\\//\n FileUtils.move @tempfile_path, new_path\n else\n FileUtils.copy @tempfile_path, new_path\n end\n File.chmod 0644, new_path\n reset\n result\n end",
"def call_st(reg_key, addr, i_reg, m_spec)\n reg = @registers[reg_key]\n mem_addr = get_mem_addr(addr, i_reg)\n\n @computer.memory.write(mem_addr, reg.value, m_spec[:l], m_spec[:r])\n end",
"def save_operation(operator, left, right, result, memory)\n result_access = VarAccess.new(result) unless result.nil?\n @quadruples.push Quadruple.new(\n Instruction.new(operator),\n left,\n right,\n result_access)\n memory.dealloc_temp right if right.is_a? VarAccess\n memory.dealloc_temp left if left.is_a? VarAccess\n end",
"def release_reg reg\n last = @regs.pop\n raise \"released register in wrong order, expect #{last} but was #{reg}\" if reg != last\n end",
"def to_reg(reg_or_val, options)\n if reg_or_val.respond_to?(:data)\n reg = reg_or_val.dup\n else\n reg = Reg.dummy(32)\n if reg_or_val.nil?\n reg.read(options[:compare_data]) if options[:compare_data]\n else\n reg.write(reg_or_val)\n reg.read if options[:read]\n end\n end\n reg.overlay(options[:arm_debug_overlay]) if options.key?(:arm_debug_overlay)\n reg.overlay(options[:overlay_label]) if options.key?(:overlay)\n reg\n end",
"def move(location, token)\n @board[location.to_i-1] = token\nend",
"def execute_RETFAR(operand=nil)\n\t\t@ip.direct_value = pop_stack_word\n\t\t@cs.direct_value = pop_stack_word\n\t\t@sp.value += operand.value if operand\n\tend",
"def move_temp_to_destination\n if !File.exist? temp_file\n $logger.info \"no moving, transcode didn't complete\"\n return\n end\n $logger.info \" moving (temp->destination)\\n #{temp_file} ->\\n #{destination_file}\"\n FileUtils.mv temp_file, destination_file\n end",
"def register_memory\n @register_memory ||= Memory.new(256, \"Register Memory\")\n end",
"def almost_rewind(f)\n f.seek(2)\nend",
"def call_src(reg_key, addr, i_reg, m_spec)\n mem_addr = get_mem_addr(addr, i_reg)\n (1..mem_addr).each do |i|\n @registers['A'].word.rotate_right\n end\n end",
"def move_immediate(dest, value)\n instrs = []\n instrs << Instruction.movw(dest: Register.reg(dest), srcs: [Register.reg(value.to_i)])\n #instrs << Instruction.movw(dest: target, srcs: [Register.reg(value.to_i & 0x00FF)])\n # TODO ruby does not store FIXNUMS in 2's complement, instead unsigned with sign flag\n # Need to adjust this accordingly\n # if value < LO_BOUND_16 || value > UP_BOUND_16\n # instrs << Instruction.movt(dest: target, srcs: [Register.reg(value >> 15)])\n #end\n instrs\n end",
"def dirty_tile(tile_info, x, y)\n tile_info.dirty_tiles << [x,y]\n end",
"def restore\n return unless @cached\n update(@cached[:y], @cached[:x])\n @cached = nil\n end",
"def replace!(destination, regexp, string)\n content = File.binread(destination)\n content.gsub!(regexp, string)\n File.open(destination, 'wb') { |file| file.write(content) }\nend",
"def move_right\n right_tile = Couple.new(@location.first, @location.second + 1)\n move_to(right_tile)\n end",
"def write_register(reg_or_val, options = {})\n options = { write: true, # whether to write or read the register\n overlay: false\n }.merge(options)\n address = exact_address(reg_or_val, options)\n data = exact_data(reg_or_val, options)\n size = exact_size(reg_or_val, options)\n name = (exact_name(reg_or_val, options)).upcase\n\n op = options[:write] ? 'Write' : 'Read'\n\n # Set undefined register flag to override option for simple_write_access below\n options[:undef] = !real_reg?(reg_or_val)\n\n # if reading a real register then need to handle copying over all data and flags\n # undefined regs will be handled in lower function so that default is to treat\n # as undefined reg (just simple accesses)\n reg(:rwd).overlay(nil) # clear overlay flags if there, as sticky\n if real_reg?(reg_or_val)\n reg(:rwd).copy_all(reg_or_val)\n end\n\n cc \"**************************** NEXUS REGISTER #{op.upcase} BEGIN ****************************\"\n cc \"- #{op} Register #{name}: addr: 0x%08X, data: 0x%08X\\n\" % [address, data]\n single_write_access(address, data, options)\n cc \"**************************** NEXUS REGISTER #{op.upcase} END ****************************\"\n\n # Clear flags so as to not affect subsequent reg reads/writes\n reg(:rwd).clear_flags\n reg_or_val.clear_flags if reg_or_val.respond_to?(:clear_flags)\n end",
"def move(location, token =\"X\")\r\n @board[(location.to_i) -1 ]=token\r\n end",
"def swap(object, new_values)\n old_values = {}\n new_values.each do |key, value|\n old_values[key] = object.send key\n object.send :\"#{key}=\", value\n end\n clear_cached_variables(new_values)\n yield\n ensure\n clear_cached_variables(new_values)\n old_values.each do |key, value|\n object.send :\"#{key}=\", value\n end\n end",
"def swap(object, new_values)\n old_values = {}\n new_values.each do |key, value|\n old_values[key] = object.send key\n object.send :\"#{key}=\", value\n end\n clear_cached_variables(new_values)\n yield\n ensure\n clear_cached_variables(new_values)\n old_values.each do |key, value|\n object.send :\"#{key}=\", value\n end\n end",
"def swap(object, new_values)\n old_values = {}\n\n new_values.each do |key, value|\n old_values[key] = object.send key\n object.send(:\"#{key}=\", value)\n end\n\n clear_cached_variables(new_values)\n\n yield\nensure\n clear_cached_variables(new_values)\n\n old_values.each do |key, value|\n object.send(:\"#{key}=\", value)\n end\nend",
"def write_moved(string); end",
"def replace(src)\n src = self.class.new(src)\n src.temp_path(src.dirname) do |temp|\n src.copy(temp)\n temp.write(read)\n temp.rename(src.to_s)\n end\n end",
"def replace(src)\n src = self.class.new(src)\n src.temp_path(src.dirname) do |temp|\n src.copy(temp)\n temp.write(read)\n temp.rename(src.to_s)\n end\n end",
"def rewind() end",
"def rewind() end",
"def rewind() end",
"def rewind() end",
"def write_register(reg, options = {})\n if reg_wrapped_by_dcrsr?(reg)\n # This register write requires a few steps:\n # 1. Write the dcrdr register with the data.\n #\n # 2a. Write the dcrsr[:regwnr] bit to 1 (indicate a write)\n # 2b. Write the regsel bits with the desired register.\n # (The above two take place in a single transaction)\n #\n # Writing the dcrsr will trigger the write to occur. Very important\n # the write to the dcrdr occurs first.\n #\n # This requires a reg_sel lookup.\n pp(\"Writing Debug Register: #{reg.name} <- #{reg.data.to_hex}\") do\n reg(:dcrdr).write!(reg.data)\n reg(:dcrsr).bits(:regwnr).write(1)\n reg(:dcrsr).bits(:reg_sel).write(reg.address)\n reg(:dcrsr).write!\n tester.cycle(repeat: write_debug_register_delay)\n end\n else\n # Nothing special about this registers. Write it as normal.\n parent.write_register(reg, options)\n end\n end",
"def record_move(row, col, value)\n tile = @rows[row-1][col-1]\n tile.value = value\n tile\n end",
"def putback()\n\t\treturn UndoScan.new\n\tend",
"def rewind\n sync\n rewind!\n end",
"def set_registers(name , value)\n register_attributes.each do |attr|\n reg = instance_variable_get(\"@#{attr}\".to_sym)\n next unless reg.symbol == name\n new_reg = reg.dup(value)\n instance_variable_set(\"@#{attr}\".to_sym , new_reg)\n end\n end",
"def rewind()\n #This is a stub, used for indexing\n end",
"def load(reg, rel: nil, val: nil)\n reg = reg.downcase.to_sym\n values[reg] = if rel == :mem\n values[val]\n else\n Value.new(rel: rel, val: val)\n end\n end",
"def release_all_registers\n @temp_registers.each do |reg|\n next if reg.end_point\n release_register reg\n end\n end",
"def store_current\n locations = @current_block.current_rotation\n displacement = @current_block.position\n (0..locations.length - 1).each{|index|\n current = locations[index];\n @grid[current[1]+displacement[1]][current[0]+displacement[0]] =\n @current_pos[index]\n }\n remove_filled\n @delay = [@delay - 2, 80].max\n end",
"def ld(wf, dest_reg, src_pair)\n d = DIR_READ\n a = $pairs[src_pair]\n w = reg_to_pair(dest_reg)\n dest_bank = dest_reg_to_bank(dest_reg)\n\n # +--------------- 0: read source address, assert to left/right busses\n # | +------------ 1: latch source address, drive address onto addr bus\n # | | +--------- 2: start ext read, start reg write, gate ext data to ALU data bus\n # | | | +------ 3: clock data into dest register\n # | | | | +--- 4: end ext read, end instruction\n # | | | | |\n wf.play 'rdGPAddr', a, a, a, _, _\n wf.play 'rdGP', x, x, x, _, _\n wf.play 'latchAddr', _, x, x, x, _\n wf.play 'driveAddr', _, x, x, x, _\n wf.play 'memDir', d, d, d, d, _\n wf.play 'rwMem', _, _, x, x, _\n wf.play 'extRW', _, _, x, x, _\n wf.play 'wrGPAddr', w, w, w, w, _\n wf.play dest_bank, _, _, x, _, _\n wf.play '-endUncond', _, _, _, _, x\nend",
"def restore_original_value\n @buffer = @original_value.dup\n # earlier commented but trying again, since i am getting IndexError in insert 2188\n # Added next 3 lines to fix issue, now it comes back to beginning.\n cursor_home\n\n @repaint_required = true\n end",
"def register(curr); end",
"def replace\n delete!(@old, phase: :replaced) if @old && !cache.uploaded?(@old)\n remove_instance_variable(\"@old\")\n end",
"def set(x, y)\n @registers[x] = @registers.fetch(y, y.to_i)\n end"
] | [
"0.55005604",
"0.5304445",
"0.52626455",
"0.5249074",
"0.5239891",
"0.5112067",
"0.51108605",
"0.5095372",
"0.4973654",
"0.49369252",
"0.49340752",
"0.48452878",
"0.4843692",
"0.48028213",
"0.47891957",
"0.47784686",
"0.4710739",
"0.46858305",
"0.46796703",
"0.46791205",
"0.46665242",
"0.46431193",
"0.46358997",
"0.4629499",
"0.4610508",
"0.46026236",
"0.46024978",
"0.45961833",
"0.45894223",
"0.4579148",
"0.45678714",
"0.4549944",
"0.45015192",
"0.4495261",
"0.44924158",
"0.44880795",
"0.44727695",
"0.4448493",
"0.44476384",
"0.44403583",
"0.4437924",
"0.4437924",
"0.4437924",
"0.4437924",
"0.4437924",
"0.44340307",
"0.4429764",
"0.44292536",
"0.4424904",
"0.4405019",
"0.43920773",
"0.43756595",
"0.43670288",
"0.4356556",
"0.43484834",
"0.4339429",
"0.43368834",
"0.43356872",
"0.4333066",
"0.43030766",
"0.42909276",
"0.42862573",
"0.42741007",
"0.42685744",
"0.42574677",
"0.42562318",
"0.4248007",
"0.42459378",
"0.4239802",
"0.42375672",
"0.42347294",
"0.4232623",
"0.42311576",
"0.42247027",
"0.42164782",
"0.421314",
"0.4208921",
"0.4208921",
"0.42083785",
"0.42037332",
"0.4202363",
"0.4202363",
"0.42000404",
"0.42000404",
"0.42000404",
"0.42000404",
"0.41898268",
"0.41878602",
"0.41766492",
"0.41748378",
"0.41704476",
"0.4166357",
"0.4156467",
"0.41525057",
"0.41471907",
"0.41434443",
"0.41377556",
"0.41310942",
"0.41309252",
"0.41304448"
] | 0.54092324 | 1 |
Return an array of Move objects in the order they should be executed. | def sort
# Find a cycle in the move graph and pick a register to spill to break it.
spillee = nil
each_strongly_connected_component do |component|
if component.size > 1
fail if spillee # There is one cycle with 3 registers.
spillee = component.first.src
end
end
# Break the cycle.
spill(spillee) if spillee
tsort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moves\n possible_moves = []\n dir do |dir|\n possible_moves += MyDirections(pos, dir)\n end\n possible_moves\n end",
"def moves \r\n move = []\r\n move_directions do |dir|\r\n move += grow_unblocked_moves_in_dir(*dir)\r\n end\r\n move\r\n end",
"def moves; [] end",
"def listLegalMoveAll\n result = [] ;\n for x in 0..3\n for y in 0..3\n from = Pos.new(x,y) ;\n r = self.listLegalMoveFrom(from) ;\n r.shift ;\n result += r ;\n end\n end\n return result ;\n end",
"def moves\n moves = []\n\n # call move_dirs and generate moves\n move_dirs.each do |x,y|\n moves += valid_positions(x,y)\n end\n moves\n end",
"def moves\n # create array to collect moves\n final_array = []\n\n\n\n pos = self.move_dirs\n\n pos.each do |optional_pos|\n\n end\n\n # Note do these logics for all the optional positions \n spec_dx = pos[0]\n spec_dy = pos[1]\n\n possible_movements = grow_unblocked_moves_in_dir(spec_dx, spec_dy)\n possible_movements\n # ending\n\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"def moves\n result = []\n\n color_setter = (color == :black ? 0 : 1)\n\n ## handles single moves\n d_pos = DELTA[color_setter]\n new_move = calc_new_move(d_pos)\n result << new_move if in_bounds?(new_move) && !occupied?(new_move)\n\n ## handles double move\n d_pos = DOUBLE_MOVE[color_setter]\n new_move = calc_new_move(d_pos)\n result << new_move if in_bounds?(new_move) && !moved? && !result.empty? && !occupied?(new_move)\n\n ## handles capture moves\n CAPTURE_MOVES[color_setter].each do |c_pos|\n new_move = calc_new_move(c_pos)\n result << new_move if in_bounds?(new_move) && capturable?(new_move)\n end\n\n result\n end",
"def get_all_possible_moves\n possible_moves = []\n @MOVES.each do |arr|\n possible_moves += get_possible_moves(arr)\n end\n possible_moves\n end",
"def possible_moves\n return []\n end",
"def regular_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n \n # looks at the two forward diagonal positions and adds them to moves array if there are no pieces there\n pos1 = [@x_pos + 1, @y_pos + dir]\n moves << pos1 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 1, @y_pos + dir]\n moves << pos2 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves \n end",
"def moves\n output = []\n move_one = false\n @directions = @directions.take(3) if position != @initial_position\n directions.each_index do |index|\n possible_position = [position[0] + directions[index][0],position[1] + directions[index][1]]\n if index.even?\n if board.in_bounds?(possible_position) && occupied?(possible_position)\n output << possible_position unless board[possible_position].color == board[position].color\n end\n elsif index == 1\n if board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position\n move_one = true\n end\n elsif board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position if move_one\n end\n end\n output\n end",
"def moves\n possible_moves = []\n\n move_dirs.each do |dir|\n possible_moves.concat(grow_unblocked_moves_in_dir(dir[0], dir[1])) \n end\n\n possible_moves \n end",
"def moves\n # create array to collect moves\n possible_moves = []\n move_dirs.each do |dir|\n possible_moves += grow_unblocked_moves_in_dir(dir[0],dir[1])\n end\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n possible_moves\n end",
"def moves\n return [] if @position.empty?\n possible_moves = []\n move_dirs.each do |dir| #[-1,-1]\n test_pos = @position #[1,3] - current position\n valid = true\n while valid\n x = dir.first + test_pos.first\n y = dir.last + test_pos.last\n test_pos = [x,y]\n valid = valid_move?([x,y])\n possible_moves << [x,y] if valid\n valid = false if valid == :attack\n end\n end\n possible_moves\n end",
"def moves(*move_dirs)\n possible_moves = []\n\n end",
"def moves\n # All pieces can stay in place\n [[0,0]]\n end",
"def moves\r\n # pos = [0,0]\r\n # row, col = pos\r\n all_h = []\r\n all_d = []\r\n HORIZONTAL_DIRS.each do |h_pos|\r\n h_row, h_col = h_pos\r\n all_h += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in h_pos\r\n end\r\n DIAGONAL_DIRS.each do |d_pos|\r\n h_row, h_col = d_pos\r\n all_d += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in d_pos\r\n end\r\n if self.class == Queen\r\n return all_h + all_d\r\n elsif self.class == Bishop\r\n return all_d\r\n elsif self.class == Rook\r\n return all_h\r\n end\r\n end",
"def moves\n [player_one_move, player_two_move].compact\n end",
"def moves\n all_moves = []\n self.move_dirs.each do |move| \n if ((0..7).include?(self.pos[0] + move[0]) && (0..7).include?(self.pos[1] + move[1])) && !(@board[(self.pos[0] + move[0]), (self.pos[1] + move[1])].is_a?(Piece)) #|| self.color == \n all_moves << [(self.pos[0] + move[0]), (self.pos[1] + move[1])]\n end \n end\n all_moves\n end",
"def moves\n moves_arr = []\n move_dirs.each do |dir|\n dx, dy = dir\n moves_arr += grow_unblocked_moves_in_dir(dx, dy)\n end\n moves_arr\n end",
"def moves\n # warn \"Explorer: #{explorer.last}\"\n # warn @robots.map(&:last)\n # warn @items.map(&:last)\n\n clear_tasks\n assign_tasks\n\n @my_bots.map(&:next_command)\n end",
"def moves\n pos = self.current_position\n moves = []\n move_dirs.each do |arr|\n @current_position = pos\n loop do\n @current_position = [@current_position[0] + arr[0], @current_position[1] + arr[1]]\n break if [@current_position[0], @current_position[1]].any? { |val| val < 0 || val > 7 }\n if board.pos_occupied?(@current_position)\n if @board[@current_position].color == self.color\n break\n else\n moves << @current_position\n break\n end\n moves << @current_position\n end\n moves << @current_position\n end\n end\n moves\n end",
"def moves\n poss_moves = []\n determine_moves.each do |diff| #array of directions\n poss_moves += grow_unblocked_moves_in_dir(diff[0],diff[1])\n end\n poss_moves\n end",
"def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless on_board?(next_move)\n break unless empty_square?(next_move)\n available_moves << next_move\n end\n\n available_moves + capture_moves\n end",
"def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless empty_square?(next_move)\n if on_board?(next_move)\n available_moves << next_move\n end\n end\n\n available_moves + capture_moves\n end",
"def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y-1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y-1]\n positions_array << next_position if position_check(next_position)\n positions_array\n end",
"def moves\n res = []\n move_dirs.each do |pos| # [0, 1]\n dx, dy = pos # 0, 1\n temp = grow_unblocked_moves_in_dir(dx, dy) # 0, 1 => [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6]]\n res += temp \n end\n res \n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"def generate_moves\n @delta.each do |step|\n new_pos = [@pos[0] + step[0], @pos[1] + step[1]]\n @move_list << new_pos if valid_coord?(new_pos)\n end\n end",
"def possibleMovements\n deltas = []\n DIRECTIONS.each do |delta|\n deltas.push(delta) if canMoveBy? delta\n end\n deltas\n end",
"def moves\n moves = []\n\n move_dirs.each do |dir| #[1,1]\n dx, dy = dir #1 0\n new_pos = grow_unblocked_moves_in_dir(dx, dy) #[1,0][2,0][3,0][4,0],[5,0][6,0][7,0]\n moves += new_pos\n end\n\n moves\n end",
"def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end",
"def moves(options = {}, force = false)\n # Return moves if present and not forcing reload\n return @moves if @moves && !force\n # Get moves from the api and create move objects\n @moves = get_moves(options).map do |move|\n Move.new self, move\n end\n end",
"def moves\n possible_moves = []\n\n self.move_dirs.each do |dir|\n num_steps = 1\n blocked = false\n\n until blocked\n next_step = [dir[0]*num_steps, dir[1]*num_steps]\n next_pos = [self.pos[0] + next_step[0], self.pos[1] + next_step[1]]\n\n break unless next_pos.all? { |i| i.between?(0,7) }\n\n if self.board[next_pos]\n blocked = true\n possible_moves << next_pos unless self.color == self.board[next_pos].color\n else\n possible_moves << next_pos\n num_steps += 1\n end\n end\n end\n\n possible_moves\n end",
"def moves(direction = :all)\n case direction\n when :all\n ([left] + [top_left] + [top] + [top_right] +\n [right] + [bottom_right] + [bottom] + [bottom_left]).delete_if(&:empty?)\n when :left then [left]\n when :top_left then [top_left]\n when :top then [top]\n when :top_right then [top_right]\n when :right then [right]\n when :bottom_right then [bottom_right]\n when :bottom then [bottom]\n when :bottom_left then [bottom_left]\n end\n end",
"def moves\n\n HORIZONTAL_DIRS.each do |direction|\n x,y = direction\n grow_unblocked_moves_in_dir(x,y)\n end\n\n #call grow_unblocked_ele \n# RIGHT HERE!!!\n \n #1 call move_dirs -< put this in each class\n #will return array of all possible moves from unblocked into moves array\n\n\n #2 Then #moves is used collects the all possible moves\n\n\n # create array to collect moves\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"def moves\n moves = []\n\n x, y = self.position\n sign = self.color == :white ? 1 : -1\n init_row = self.color == :white ? 1 : 6\n\n one_up = [x + (1 * sign), y]\n two_up = [x + (2 * sign), y]\n\n moves << one_up if self.board[one_up].nil?\n\n if (self.board[one_up].nil? && self.board[two_up].nil? && self.position.first == init_row)\n moves << two_up\n end\n\n diag_left = [x + (1 * sign), y + 1]\n diag_right = [x + (1 * sign), y - 1]\n\n if self.board[diag_left] && self.board[diag_left].color != self.color\n moves << diag_left\n end\n\n if self.board[diag_right] && self.board[diag_right].color != self.color\n moves << diag_right\n end\n\n moves.select { |move| on_board?(move) }\n end",
"def moves\n\n #\n all_moves = sigma_deltas().map {|delta| transform(delta)}\n # all_moves.select { |move| board.on_board?(move)}\n end",
"def jump_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n\n # looks at the two forward far diagonal positions and adds them to moves array if there are no pieces there and an opponent piece in between\n pos1 = [@x_pos + 2, @y_pos + 2*dir]\n moves << pos1 if Piece.all.find{|p| p.x_pos == @x_pos + 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 2, @y_pos + 2*dir]\n moves << pos2 if Piece.all.find{|p| p.x_pos == @x_pos - 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n\n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves\n end",
"def get_possible_moves\n moves = \n\t @@offsets.collect do |move| \n\t row = @position[:row] + move[0]\n\t col = @position[:col] + move[1]\n\t\t[row, col] if row.between?(0, 7) && col.between?(0, 7)\n\t end\n\tmoves.compact\n end",
"def get_moves\n reset_moves\n jump_moves\n base_moves if @valid_moves.empty?\n end",
"def moves\n @moves\n end",
"def get_move\n print \"Your move, #{@name}\\n\"\n from = select\n to = select\n [from,to]\n end",
"def moves\n to_return = []\n board_iterate do |i|\n if(i.is_a? Numeric)\n to_return.push(i)\n end\n end\n to_return.empty? ? nil : to_return\n end",
"def get_moves(pieces)\n\t\tarrPos = [] \n\t\tif team == 1\n\t\t\tarrPos << [@xCord, @yCord + 1] if square_is_open?(pieces, [@xCord, @yCord + 1])\n\t\t\tarrPos << [@xCord, @yCord + 2] if @yCord == 1 && square_is_open?(pieces, [@xCord, @yCord + 2])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord, @yCord - 1] if square_is_open?(pieces, [@xCord, @yCord - 1])\n\t\t\tarrPos << [@xCord, @yCord - 2] if @yCord == 6 && square_is_open?(pieces, [@xCord, @yCord - 2])\n\t\tend\n\t\tarrPos\n\tend",
"def updateMovements()\n toRemove = []\n moves = []\n\n @movingUnits.each_pair{|id, moveInfo|\n unit = @units[id]\n target = moveInfo[:path][0]\n\n # Unit is gone. Killed?\n if (!unit)\n toRemove << id\n next\n end\n\n if (@gameTime - moveInfo[:lastMoved] < unit[:unit].moveSpeed ||\n # TODO(eriq): If the next location for this unit is occupied, just wait.\n # If the spot if occupied by a unit that is not moving, the path should probably be recalculated.\n @board.occupied?(target[:row], target[:col]))\n next\n end\n\n @board.move(unit[:position][:row], unit[:position][:col],\n target[:row], target[:col])\n unit[:position] = target\n moveInfo[:path].shift()\n moveInfo[:lastMoved] = @gameTime\n\n if (moveInfo[:path].empty?)\n toRemove << id\n end\n\n moves << {'id' => unit[:unit].id,\n 'x' => target[:row],\n 'y' => target[:col]}\n }\n\n toRemove.each{|id|\n @movingUnits.delete(id)\n }\n\n return moves\n end",
"def moves\n valid_moves = []\n move_dirs.each do |dx,dy| \n valid_moves += grow_unblocked_moves_in_dir(dx,dy)\n end\n valid_moves\n end",
"def get_next_moves\n children = Array.new()\n new_move = @moves + 1\n @code.length.times do |i|\n move_up = Combination.new(next_code(i, :up), self, new_move)\n move_down = Combination.new(next_code(i, :down), self, new_move)\n children.push(move_down, move_up)\n end\n children\n end",
"def moves\n\t\tm = []\n\t\t@@moves.each do |move|\n\t\t\tfrom, to = move\n\n\t\t\tp1 = @value & MASKS[from]\n\t\t\tp2 = @value & MASKS[to]\n\n\t\t\tshift = (to - from) * 3\n\t\t\tp1 = p1 >> shift\n\t\t\tp2 = p2 << shift\n\n\t\t\tnum = (@value & INV_MASKS[from]) | p2\n\t\t\tnum = (num & INV_MASKS[to]) | p1\n\n\t\t\tm << State.new(num, @n_moves + 1)\n\t\tend\n\t\tm\n\tend",
"def get_possible_moves_for(position)\n possible = []\n x = position.square[0]\n y = position.square[1]\n moves = [\n Placement.new([x-1,y-2], position), \n Placement.new([x-1,y+2], position), \n Placement.new([x-2,y-1], position), \n Placement.new([x-2,y+1], position), \n Placement.new([x+1,y+2], position), \n Placement.new([x+1,y-2], position), \n Placement.new([x+2,y-1], position), \n Placement.new([x+2,y+1], position)\n ]\n moves.each do |move|\n possible << move unless Chess.not_on_board?(move)\n end\n possible\n end",
"def process_moves\n @delta[:moves].each do |move| process_move(move) end\n end",
"def children\n potential_moves = []\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |ele, j|\n pos = [i, j]\n potential_moves << pos if @board.empty?(pos)\n end\n end\n \n new_mark = self.switch_mark\n potential_moves.map! do |pos|\n new_board = @board.dup \n new_board[pos] = next_mover_mark\n self.class.new(new_board, new_mark, pos)\n end\n \n return potential_moves\n end",
"def possible_moves\n possible_moves = []\n\n # move up\n up_right = [start[X] + 1, start[Y] + 2]\n possible_moves << up_right\n\n up_left = [start[X] - 1, start[Y] + 2]\n possible_moves << up_left\n\n # move right\n right_up = [start[X] + 2, start[Y] + 1]\n possible_moves << right_up\n\n right_down = [start[X] + 2, start[Y] - 1]\n possible_moves << right_down\n\n # move down\n down_right = [start[X] + 1, start[Y] - 2]\n possible_moves << down_right\n\n down_left = [start[X] - 1, start[Y] - 2]\n possible_moves << down_left\n\n # move left\n left_up = [start[X] - 2, start[Y] + 1]\n possible_moves << left_up\n\n left_down = [start[X] - 2, start[Y] - 1]\n possible_moves << left_down\n\n possible_moves.select { |move| @board.valid_position?(move) }\n\n end",
"def perform_actions\n new_objects = []\n while(command = $players[@parent_id][:actions].pop)\n if command\n puts command + \" #{@parent_id}\"\n new_object = self.send(command)\n if new_object\n new_objects << new_object\n end\n end\n end\n new_objects\n end",
"def moves!\n total_possible_moves = []\n total_possible_moves.concat(diag_moves(diag_initializer))\n total_possible_moves.concat(straight_moves(move_initializer))\n total_possible_moves.select { |move| self.valid_move?(move) }\n end",
"def getPossibleMoves(move)\n board = move.board\n possibleMoves = []\n if move.from.nil?\n possibleFrom = getPossibleFrom(move)\n possibleFrom.each do |from|\n possibleMove = Move.new(board, move.board.getSquare(from).occupancy, move.to, from)\n possibleMoves << possibleMove\n end\n else\n # Make sure the piece trying to be moved exists\n if(board.getSquare(move.from).occupied? &&\n board.getSquare(move.from).occupancy.class == move.piece.class &&\n board.getSquare(move.from).occupancy.colour == move.piece.colour)\n move.piece = move.board.getSquare(move.from).occupancy\n possibleMoves << move\n end\n end\n possibleMoves\n end",
"def possible_moves\n all_moves = []\n x, y = @position\n moves = [[x, y-1], [x-1, y-1], [x-1, y], [x-1, y+1], [x, y+1], [x+1, y+1], [x+1, y], [x+1, y-1]]\n moves.each do |position|\n all_moves << [position] if position.all? { |number| number.between?(0,7) }\n end\n all_moves\n end",
"def moves\n directions = MOVE_DIRECTIONS[self.piece_type]\n directions.map do |(dx, dy)|\n x, y = self.position\n [x + dx, y + dy]\n end.select { |coord| on_board?(coord) && not_blocked?(coord) }\n\n # cond = board[[coord]].nil? || board[[coord]].color != self.color\n # opp_cond = !(board[coord].color == self.color)\n # coord = [2,4]\n # [[2,3], nil, [3,4]]\n #(self.board[coord].color != self.color)\n end",
"def getPossibleFrom move\n possibleFrom = []\n move.board.pieces[move.piece.colour][move.piece.class.to_s.to_sym].each do |coord, piece|\n possibleFrom << coord\n end\n possibleFrom\n end",
"def move board\n free_pieces = board.free_pieces\n piece = free_pieces.random\n moves = board.possible_moves(piece)\n return [piece.x, piece.y], moves.random \n end",
"def all_moves_array(initial_x, initial_y)\n\t\tfinal = []\n\t\tx = initial_x + 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\tx = initial_x - 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\ty = initial_y + 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\ty = initial_y - 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\tfinal\n\tend",
"def take_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend",
"def capture_moves\n direction = get_direction\n moves = []\n x, y = @pos\n x += direction\n y += 1\n if @board[ [x, y] ] && @board[ [x,y] ].color == opponent_color\n moves << [x, y]\n end \n y -= 2\n if @board[ [x, y] ] && @board[ [x,y] ].color == opponent_color\n moves << [x, y]\n end\n moves\n end",
"def move\n move_by a, m\n end",
"def possible_moves(side)\n possible_moves = []\n # initialize an 8x8 array of coordinates 1-8\n coords = Array.new(8) { [*1..8] }\n coords.each_with_index do |i, j|\n i.each do |t|\n # t is the x, i[j] is the y\n side.each do |test_piece|\n # Run move validation tests on every piece\n next unless test_piece.move_tests(to_x: t, to_y: i[j])\n # if a move passes validations, push the pieces ID and the\n # coordinates of a successful move to the possible_moves array\n possible_moves << [test_piece.id, t, i[j]]\n end\n end\n end\n possible_moves\n end",
"def children\n mark = self.next_mover_mark\n possible_moves = []\n (0...3).each do |row|\n (0...3).each do |col|\n pos = [row, col]\n if board.empty?(pos)\n possible_board = board.dup\n prev_move_pos = pos\n possible_board[pos] = mark\n possible_moves << possible_board\n end\n end\n end\n possible_moves\n end",
"def possible_moves(position, board, color)\n out_array = []\n\n x = position[0]\n y = position[1]\n\n add_to_move_array(x - 1, y - 2, board, color, out_array)\n add_to_move_array(x - 2, y - 1, board, color, out_array)\n add_to_move_array(x - 2, y + 1, board, color, out_array)\n add_to_move_array(x - 1, y + 2, board, color, out_array)\n add_to_move_array(x + 1, y + 2, board, color, out_array)\n add_to_move_array(x + 2, y + 1, board, color, out_array)\n add_to_move_array(x + 2, y - 1, board, color, out_array)\n add_to_move_array(x + 1, y - 2, board, color, out_array)\n\n out_array\n end",
"def children\n pos_positions = all_positions.select { |pos| @board[pos].nil? }\n mark = switch_mark\n moves = []\n\n pos_positions.each do |pos|\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n moves << TicTacToeNode.new(new_board, mark, pos)\n end\n\n moves\n end",
"def moves\n end",
"def find_all_moves\n stack = []\n stack << @initial_move\n until stack.empty?\n current_node = stack.shift\n calc_move(current_node)\n stack << current_node.children\n stack.flatten!\n end\n end",
"def move(move)\n @moves << move\n end",
"def get_valid_moves\n # delta = color == :white ? 1 : -1\n pos = [position[0] + direction, position[1]]\n validated_moves = capture_spaces\n validated_moves << pos if valid_move?(pos)\n unless @moved || !validated_moves.include?(pos)\n\n pos = [position[0] + (2*direction), position[1]]\n validated_moves += valid_move?(pos) ? [pos] : []\n end\n\n validated_moves\n end",
"def get_moves; raise NotImplementedError end",
"def valid_moves\n moves = []\n\n # go in all directions\n (-1..1).each do |_x_step|\n (-1..1).each do |_y_step|\n # start walking in that direction\n (1..7).each do |steps|\n x = x_coordinate + steps * x_direction\n y = y_coordinate + steps * y_direction\n\n # stop walking if you hit a wall\n break unless valid_move?(x, y)\n\n # remember the valid moves\n moves.push(Move.new(x, y))\n end\n end\n end\n moves\n end",
"def move(*commands)\n commands = [commands] unless commands[0].is_a?(Array)\n commands.each do |e|\n @moveroute.concat(e)\n end\n end",
"def moves\n\n end",
"def move_dirs\n [[-1,2], [1,2], [2,1], [2,-1], [1,-2], [-1,-2], [-2,-1], [-2,1]]\n end",
"def possible_moves(board)\n poss_move_array = []\n current_square = @history.last\n current_coords = parse_coord(current_square)\n\n poss_move_array.push(single_march(current_coords, board)) if single_march(current_coords, board)\n\n poss_move_array.push(double_march(current_coords, board)) if first_move? && double_march(current_coords, board)\n\n valid_diagonals(current_coords, board).each { |move| poss_move_array.push(move) }\n\n # en passant only allowed opportunity first created\n poss_move_array.push(en_passant?(current_coords, board)) if en_passant?(current_coords, board)\n\n poss_move_array\n end",
"def possible_moves(x, y)\n @moves = [[x+1,y+2], [x+1,y-2],\n [x-1,y+2], [x-1,y-2],\n [x+2,y+1], [x+2,y-1],\n [x-2,y+1], [x-2,y-1]]\n\n end",
"def move_dirs\n [[0,1], [1,0], [0,-1], [-1,0], [-1,1], [1,1], [1,-1], [-1,-1]]\n end",
"def move_dirs\n [[0,1], [1,0], [0,-1], [-1,0], [-1,1], [1,1], [1,-1], [-1,-1]]\n end",
"def group_possible_moves_rook(pm)\n result = []\n\n result << pm.select do |p|\n p[0] == position[0] && p[1] < position[1]\n end\n\n result << pm.select do |p|\n p[0] == position[0] && p[1] > position[1]\n end\n\n result << pm.select do |p|\n p[1] == position[1] && p[0] < position[0]\n end\n\n result << pm.select do |p|\n p[1] == position[1] && p[0] > position[0]\n end\n result[0].reverse!\n result[2].reverse!\n result\n end",
"def create_moves\n valid_moves = []\n MOVES.each do |move|\n location = [move[0] + loc[0], move[1] + loc[1]]\n valid_moves << location if location[0].between?(0,7) && location[1].between?(0,7)\n end\n valid_moves\n end",
"def makeMoves # fix this\n\t\t@players.each.with_index do |player,i|\n\t\t\t(0..player.numHands-1).each do |handIndex|\n\t\t\t\tmakeMove(player, handIndex, i)\n\t\t\tend\n\t\tend\n\tend",
"def possible_queen_moves(start_arr)\n\t\tchildren = []\n\t\tchildren << possible_rook_moves(start_arr)\n\t\tchildren << possible_bishop_moves(start_arr)\n\t\tchildren = children.flatten(1)\n\tend",
"def castling_moves(pos, board)\n return [] if @owner.check || pos[1] != 4 || !@owner.can_castle\n\n home_rank = (0..7).map { |index| board.locate_piece([pos[0], index]) }\n [castle_queenside(home_rank[0..3], pos, board), castle_kingside(home_rank[5..7], pos, board)].compact\n end",
"def move_dirs\n [\n [2, 1],\n [1, 2],\n [-1, 2],\n [-2, 1],\n [-2, -1],\n [-1, -2],\n [1, -2],\n [2, -1]\n ]\n end",
"def generate_moves\n @delta.each do |step|\n (1..7).each do |i|\n new_pos = [@pos[0] + step[0] * i, @pos[1] + step[1] * i]\n if valid_coord?(new_pos)\n @move_list << new_pos\n break if @board[new_pos]\n else\n break\n end\n end\n end\n end",
"def next_move gameboard\n result_pairs = []\n\n gameboard.valid_moves.each do |move|\n new_gameboard = gameboard.move move\n result_pairs << { score: new_gameboard.score, move: move } unless gameboard.equal_tile_layout? new_gameboard\n end\n\n result_pairs.sort_by{ |s| s[:score] }.reverse.first[:move]\n end",
"def move_dirs\n [[-1,1], [1,1], [1,-1], [-1,-1]]\n end",
"def valid_moves\n valid = []\n all_moves = self.moves\n\n all_moves.each do |end_pos|\n valid << end_pos unless move_into_check(end_pos)\n end\n \n valid\n end",
"def children\n moves = []\n (0..2).each do |r|\n (0..2).each do |c|\n if board.empty?([r, c])\n dup_board = board.dup\n\n dup_board[[r, c]] = next_mover_mark\n if next_mover_mark == :x\n next_mover_mark = :o\n else\n next_mover_mark = :x\n end\n\n moves << TicTacToeNode.new(dup_board, next_mover_mark, [r, c])\n p moves\n end\n end\n end\n\n return moves\n end",
"def parse_moves\n s0 = @scanner.pos\n s1 = parse_firstboard\n if s1 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n parse_split\n s2 = []\n s3 = parse_move\n while s3 != :failed\n s2 << s3\n s3 = parse_move\n end\n parse_result\n @reported_pos = s0\n s0 = s2.unshift(s1)\n end\n s0\n end",
"def find_possible_moves\n @possible_moves = []\n\n @moveset.each do |move, value|\n x = @x + value[0]\n y = @y + value[1]\n\n next unless ChessBoard.check_boundaries(x, y) && !visited_coordinates.include?([x, y])\n\n @possible_moves << move\n end\n end",
"def move_dirs\n [[0,1], [1,0], [0,-1], [-1,0]]\n end",
"def move\r\n case direction\r\n when DIRECTIONS[:north]\r\n self.longitude += 1\r\n when DIRECTIONS[:south]\r\n self.longitude -= 1\r\n when DIRECTIONS[:east]\r\n self.latitude += 1\r\n when DIRECTIONS[:west]\r\n self.latitude -= 1\r\n end\r\n\r\n return [latitude, longitude]\r\n end",
"def all_objects_in_order\n all_objects\n end",
"def each_move\n SQ.select { |i| @colors[i] == @mx }.each do |f|\n if @pieces[f] == PAWN\n t = f + UP[@mx]\n yield(f, t + 1) if @colors[t + 1] == @mn && SQ120[SQ64[t] + 1] != NULL\n yield(f, t - 1) if @colors[t - 1] == @mn && SQ120[SQ64[t] - 1] != NULL\n next unless @colors[t] == EMPTY\n yield(f, t)\n yield(f, t + UP[@mx]) if @colors[t + UP[@mx]] == EMPTY && (f >> 3) == (SIDE[@mx] - 1).abs\n next\n end\n STEPS[@pieces[f]].each do |s|\n t = SQ120[SQ64[f] + s]\n while t != NULL\n yield(f, t) if @colors[t] != @mx\n break if @pieces[f] == KING || @pieces[f] == KNIGHT || @colors[t] != EMPTY\n t = SQ120[SQ64[t] + s]\n end\n end\n end\n end",
"def children\n out = [] \n (0..2).each do |row|\n (0..2).each do |col|\n pos = [row, col]\n out << next_move_node(pos) if @board.empty?(pos)\n end\n end\n out\n end",
"def get_move\n @players[0].get_move(@board)\n end",
"def moves( who = @turn )\n\t\t\tmoves = find_all { |(sq, pc)| pc and pc.color == who }.\n\t\t\t map { |(sq, pc)| [sq, (pc.captures + pc.moves).sort] }\n\t\t\tmoves.each do |(from, tos)|\n\t\t\t\ttos.delete_if { |to| dup.move(from, to).in_check?(who) }\n\t\t\tend\n\t\t\tmoves.delete_if { |(from, tos)| tos.empty? }\n\t\t\tmoves.sort\n\t\tend",
"def copy_moves\n account_combatant.moves.map do |move|\n MatchCombatantsMove.create!(\n match_combatant: match_combatant,\n move: move\n )\n end\n end"
] | [
"0.70720303",
"0.7055909",
"0.68432826",
"0.68365794",
"0.68076944",
"0.6777615",
"0.6764118",
"0.6701747",
"0.66412926",
"0.65923786",
"0.6579858",
"0.6551193",
"0.65377843",
"0.6524724",
"0.6505313",
"0.6501989",
"0.6492492",
"0.64846724",
"0.64798087",
"0.646525",
"0.64517057",
"0.64451617",
"0.6426853",
"0.6401771",
"0.63870054",
"0.6382671",
"0.63333404",
"0.6328502",
"0.6316959",
"0.62835455",
"0.6244378",
"0.6229872",
"0.617222",
"0.6159954",
"0.6094029",
"0.60905856",
"0.6047056",
"0.6044177",
"0.60292494",
"0.6021223",
"0.6017321",
"0.5985539",
"0.59851617",
"0.59825927",
"0.5975215",
"0.5946299",
"0.5921188",
"0.5906557",
"0.5882623",
"0.5871298",
"0.5863441",
"0.58528143",
"0.5848977",
"0.5840824",
"0.5839387",
"0.58330935",
"0.5821489",
"0.5807209",
"0.58050865",
"0.5798482",
"0.5788343",
"0.5784345",
"0.5775802",
"0.5774251",
"0.5761066",
"0.5753143",
"0.5748889",
"0.5741828",
"0.5730731",
"0.57288253",
"0.5725028",
"0.56971574",
"0.56887287",
"0.5685474",
"0.56459236",
"0.56378067",
"0.56261146",
"0.56257534",
"0.5619626",
"0.5619626",
"0.5603037",
"0.5600465",
"0.5596698",
"0.55730563",
"0.5562847",
"0.5557834",
"0.55563545",
"0.55551076",
"0.5549443",
"0.5544062",
"0.55407757",
"0.5536068",
"0.5526359",
"0.5484162",
"0.5480377",
"0.5470261",
"0.54604113",
"0.5454395",
"0.54487693",
"0.54457504",
"0.5444156"
] | 0.0 | -1 |
Implements the calling convention from | def call(dest, *args)
# Split into register and stack args
stack_args = args.dup
reg_args = stack_args.slice! 0...3
# Push all the stack arguments in reverse order
stack_args.reverse.each do |arg|
SET push, arg
end
# Set the argument registers
MoveSorter.new(reg_args).sort.each do |move|
SET move.dst, move.src
end
JSR dest
# Clean up the stack arguments
ADD sp, stack_args.size if stack_args.size > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call\n\n\tend",
"def call\n\n\tend",
"def call() end",
"def call\n # implement in subclasses\n end",
"def call(*) end",
"def call(*) end",
"def call\n end",
"def call\n end",
"def calls; end",
"def calls; end",
"def invoke; end",
"def invoking\n end",
"def invoke\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n raise 'must be implemented in subclasses'\r\n end",
"def called_from; end",
"def called_from; end",
"def private; end",
"def call(*args); end",
"def caller; end",
"def call\n raise \"Must subclass and implement call\"\n end",
"def wrapper; end",
"def implementation; end",
"def implementation; end",
"def called_from=(_arg0); end",
"def called_from=(_arg0); end",
"def handle; end",
"def call(*)\n raise NotImplementedError\n end",
"def call(*args)\n __call__( args )\n end",
"def call( *args )\n raise NotImplementedError\n end",
"def args(*) end",
"def call\n raise NotImplementedError,\n \"Override #call and implement your application logic.\"\n end",
"def probers; end",
"def methods() end",
"def probers=(_arg0); end",
"def weber; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def internal; end",
"def custom; end",
"def custom; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def schubert; end",
"def call\n raise NotImplementedError\n end",
"def call\n raise NotImplementedError\n end",
"def call\n raise NotImplementedError\n end",
"def run(_); end",
"def run(_); end",
"def call(object); end",
"def returns=(_arg0); end",
"def who_we_are\r\n end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def initialize ( _caller )\n super\n end"
] | [
"0.78853166",
"0.78853166",
"0.78853166",
"0.78853166",
"0.78853166",
"0.78853166",
"0.78853166",
"0.78853166",
"0.7607828",
"0.7607828",
"0.759717",
"0.74952185",
"0.74685013",
"0.74685013",
"0.7387357",
"0.73359966",
"0.7205347",
"0.7205347",
"0.7180994",
"0.7045674",
"0.700595",
"0.7002529",
"0.7002529",
"0.69574976",
"0.6860484",
"0.68550736",
"0.68425447",
"0.68293047",
"0.6821839",
"0.6821839",
"0.682159",
"0.682159",
"0.6736253",
"0.6681254",
"0.66592413",
"0.66229665",
"0.66140735",
"0.65959966",
"0.6574395",
"0.6555934",
"0.65462494",
"0.65399307",
"0.6535849",
"0.6535849",
"0.6535849",
"0.6535849",
"0.6535849",
"0.6535849",
"0.6535849",
"0.6535849",
"0.6535849",
"0.6535849",
"0.6535849",
"0.6535849",
"0.653346",
"0.6523044",
"0.6523044",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65218353",
"0.65071243",
"0.64992386",
"0.6492043",
"0.6492043",
"0.648852",
"0.648852",
"0.6475421",
"0.64276534",
"0.64038825",
"0.63808864",
"0.63808864",
"0.63808864",
"0.63808864",
"0.6379288",
"0.6379288",
"0.6379288",
"0.6379288",
"0.6379288",
"0.6379288",
"0.6379288",
"0.6379288",
"0.6379288",
"0.6379288",
"0.6378553"
] | 0.0 | -1 |
Allocate storage for local variables on the stack. | def locals(&blk)
@stack_usage ||= 0
num_locals = blk.arity
# Allocate stack space
locals = (0...num_locals).map do |i|
offset = -(@stack_usage+i+1)
PlusRegister.new j, (offset & 0xFFFF)
end
@stack_usage += num_locals
SUB sp, num_locals
yield *locals
# Deallocate stack space
ADD sp, num_locals
@stack_usage -= num_locals
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_variables() end",
"def push_local\n <<-CODE\n next_int;\n stack_push(fast_fetch(c->locals, _int));\n CODE\n\n # \"next_int; stack_push(fast_fetch(cpu_current_locals(state, c), _int));\"\n end",
"def new_local(name)\n name = name.name if name.is_a? Identifier\n @variables[name] = store_new_local(name)\n end",
"def stack(new_scope = T.unsafe(nil)); end",
"def local_var(aparam)\n # +2 instead of +1 because %ecx is pushed onto the stack in main,\n # In any variadic function we push :numargs from %ebx into -4(%ebp)\n \"-#{PTR_SIZE*(aparam+2)}(%ebp)\"\n end",
"def new_local(name)\n name = name.name if name.is_a? Identifier\n @variables[name] = store_new_local(name)\n end",
"def new_local(name)\n name = name.name if name.is_a? Identifier\n @variables[name] = @parent.store_new_local(name)\n end",
"def new_local(name)\n name = name.name if name.is_a? Identifier\n @variables[name] = @parent.store_new_local(name)\n end",
"def set_local\n <<-CODE\n next_int;\n t1 = stack_pop();\n // printf(\"Set local %d to %s\\\\n\", _int, _inspect(t1));\n t2 = c->locals;\n if(t2->gc_zone == 0) {\n sassert(_int < NUM_FIELDS(t2) && \"locals tuple sized wrong\");\n fast_unsafe_set(t2, _int, t1);\n } else {\n tuple_put(state, t2, _int, t1);\n }\n stack_push(t1);\n CODE\n end",
"def locals; list_all :local_variables; end",
"def local_scope; @scope = :local end",
"def alloc(var_entry)\n if @deallocated.any?\n addr = @deallocated.first\n @deallocated.shift\n else\n addr = @local_counter\n @local_counter += 1\n end\n var_entry.set_addr addr\n @memory[var_entry.name] = var_entry\n var_entry\n end",
"def set_local_from_fp\n <<-CODE\n next_int;\n k = (native_int)_int;\n next_int;\n\n t1 = c->stack_top[c->fp - _int];\n\n t2 = cpu_current_locals(state, c);\n if(t2->gc_zone == 0) {\n sassert(k < NUM_FIELDS(t2) && \"locals tuple sized wrong\");\n fast_unsafe_set(t2, k, t1);\n } else {\n tuple_put(state, t2, k, t1);\n }\n CODE\n end",
"def build_stack\n t = temp_var # alloc temp but the take it over with named one\n NamedTemporaryVariable.new(t.offset, '%stack').tap do |stack_var|\n add copy(stack_var, org.jruby.ir.operands.Array.new)\n end\n end",
"def definir_var_local\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n\n return_value = DefinirVarLocalReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __LPAR121__ = nil\n __RPAR123__ = nil\n __EOL124__ = nil\n var_local120 = nil\n body_var_local122 = nil\n\n\n tree_for_LPAR121 = nil\n tree_for_RPAR123 = nil\n tree_for_EOL124 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 131:4: var_local LPAR body_var_local RPAR EOL\n @state.following.push( TOKENS_FOLLOWING_var_local_IN_definir_var_local_577 )\n var_local120 = var_local\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, var_local120.tree )\n end\n\n __LPAR121__ = match( LPAR, TOKENS_FOLLOWING_LPAR_IN_definir_var_local_579 )\n if @state.backtracking == 0\n tree_for_LPAR121 = @adaptor.create_with_payload( __LPAR121__ )\n @adaptor.add_child( root_0, tree_for_LPAR121 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_body_var_local_IN_definir_var_local_581 )\n body_var_local122 = body_var_local\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, body_var_local122.tree )\n end\n\n __RPAR123__ = match( RPAR, TOKENS_FOLLOWING_RPAR_IN_definir_var_local_583 )\n if @state.backtracking == 0\n tree_for_RPAR123 = @adaptor.create_with_payload( __RPAR123__ )\n @adaptor.add_child( root_0, tree_for_RPAR123 )\n\n end\n\n __EOL124__ = match( EOL, TOKENS_FOLLOWING_EOL_IN_definir_var_local_585 )\n if @state.backtracking == 0\n tree_for_EOL124 = @adaptor.create_with_payload( __EOL124__ )\n @adaptor.add_child( root_0, tree_for_EOL124 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 25 )\n\n\n end\n\n return return_value\n end",
"def allocate\n <<-CODE\n _lit = stack_pop();\n stack_push(NEW_OBJECT(Qnil, N2I(_lit)));\n CODE\n end",
"def getlocal() end",
"def test_local\n result = 1 + 2\n result.times do |x|\n puts a = x + 1\n p local_variables\n end\n p local_variables\nend",
"def get_local_var\n p $local_var #this is different than...\n local_var = \"Local Var\"\n p local_var #...this.\nend",
"def locals; end",
"def locals; end",
"def locals; end",
"def set_local_depth\n <<-CODE\n next_int;\n k = (native_int)_int;\n next_int;\n t3 = stack_pop();\n t1 = c->active_context;\n\n for(j = 0; j < k; j++) {\n t2 = blokctx_env(state, t1);\n t1 = blokenv_get_home_block(t2);\n }\n\n t2 = blokctx_locals(state, t1);\n if(t2->gc_zone == 0) {\n sassert(_int < NUM_FIELDS(t2) && \"locals tuple sized wrong\");\n fast_unsafe_set(t2, _int, t3);\n } else {\n tuple_put(state, t2, _int, t3);\n }\n stack_push(t3);\n\n CODE\n end",
"def foo\n local_variables = 10\n puts \"local variables: #{local_variables}\"\n puts defined?(local_variables)\nend",
"def info_locals\n @queue << \"i l\"\n end",
"def locals\n @locals ||= var_names.inject({}) { |memo, v| memo.merge!({ v => eval(v.to_s, get_binding) }) }\n end",
"def data_decls\n if @enum.peek.value == 'int'\n #@instruction.push(@enum.peek.value)\n match(Token.new(:reserved, 'int'))\n local_id_list\n @instruction.push('int local['+(@local_var).to_s+\"]\")\n #@instruction.delete_if{|item| item.start_with?(\"int local\") and item != @instruction.last}\n semicolon\n #@instruction.delete(@instruction.last)\n data_decls\n end\n end",
"def alloc_temp\n if @temp_deallocated.any?\n addr = @temp_deallocated.first\n @temp_deallocated.shift\n else\n addr = @temp_counter\n @temp_counter += 1\n end\n entry = Entry.new is_temp: true\n entry.set_addr addr\n @temp_memory[addr - Limits::TEMP_START_ADDR] = entry\n entry\n end",
"def test_get_local\n assert_equal [\n PUSH_NUMBER, 0, # 1 stack = [1]\n SET_LOCAL, 0, # a stack = []\n GET_LOCAL, 0, # a stack = [1]\n RETURN\n ], @compiler.compile(\"a=1; a\")[:instructions]\n end",
"def active_locals; end",
"def push_local_depth\n <<-CODE\n next_int;\n k = (native_int)_int;\n next_int;\n t1 = c->active_context;\n for(j = 0; j < k; j++) {\n t2 = blokctx_env(state, t1);\n t1 = blokenv_get_home_block(t2);\n }\n stack_push(tuple_at(state, blokctx_locals(state, t1), _int));\n CODE\n end",
"def var_names\n @var_names ||= eval \"local_variables\", get_binding\n end",
"def test_local_basic\n lst = compile( \"foo = 1 ; foo\")\n assert_equal ScopeStatement , lst.class\n assert_equal LocalVariable , lst.statements[1].class\n end",
"def init_globals\n $process_vars = ThreadSafeHash::ThreadSafeHashMonitored.new(Params['enable_monitoring'])\n $tmp_content_data_file = nil # will be init during execution\n $testing_memory_active = false\n $testing_memory_log = nil\n $indexed_file_count = 0\n $local_content_data = nil\n $local_content_data_lock = nil\n $remote_content_data_lock = nil\n $remote_content_data = nil\n $last_content_data_id = nil\n end",
"def free_variable\n @temp_variable.succ! while check(@temp_variable)\n @variables[@temp_variable.to_sym] = :var\n Value.new(@temp_variable.dup)\n end",
"def attach_local(local_sym)\n @dependent_locals << local_sym\n end",
"def local_vars(bnd, vars = {})\n vars.each_pair do |name, val|\n bnd.local_variable_set(name, val)\n end\n bnd\n end",
"def define_locals(&block)\n error(\"No requirements specification provided.\") unless block_given?\n @locals_proxy = Fizzy::Locals::Proxy.new(self)\n @locals_proxy.instance_eval(&block)\n end",
"def second_test_local_variables\n value = 5\n another_value = 10\n puts local_variables\n addition_of_values = value + another_value\n puts addition_of_values \nend",
"def test_memory_size\n assert_equal 1, SetVariableEval.new(@int_var, @int_lit).memory\n get = GetVariableEval.new(\"test2\")\n assert_equal 0, SetVariableEval.new(get, @int_lit).memory\n end",
"def local(l = nil)\n l = get_local if !l\n label(l)\n end",
"def allocate(parts); end",
"def on_lvasgn(node)\n super\n name, = *node\n position = find_local name\n # TODO: should be able to shadow variable scope\n unless position\n position = locals.length\n @locals << name\n end\n\n emit :FROMALTSTACK\n emit :DUP\n emit :TOALTSTACK\n emit_push position\n emit_push 2\n emit :ROLL\n emit :SETITEM\n end",
"def put_var_scope\nend",
"def __locals__\n\t\t\treturn @locals\n\t\tend",
"def ruby_gc_init_slots\n 10_000\n end",
"def thread_variables\n _locals.keys\n end",
"def temp_var\n tv = TemporaryVariable.new @fisk.register, Fiddle::TYPE_VOIDP, Fiddle::SIZEOF_VOIDP, 0, self\n\n if block_given?\n yield tv\n tv.release!\n else\n tv\n end\n end",
"def var_local\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 64 )\n\n\n return_value = VarLocalReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __DOUBLEDOT344__ = nil\n __Identificador345__ = nil\n\n\n tree_for_DOUBLEDOT344 = nil\n tree_for_Identificador345 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 620:4: DOUBLEDOT Identificador\n __DOUBLEDOT344__ = match( DOUBLEDOT, TOKENS_FOLLOWING_DOUBLEDOT_IN_var_local_3218 )\n if @state.backtracking == 0\n tree_for_DOUBLEDOT344 = @adaptor.create_with_payload( __DOUBLEDOT344__ )\n @adaptor.add_child( root_0, tree_for_DOUBLEDOT344 )\n\n end\n\n __Identificador345__ = match( Identificador, TOKENS_FOLLOWING_Identificador_IN_var_local_3220 )\n if @state.backtracking == 0\n tree_for_Identificador345 = @adaptor.create_with_payload( __Identificador345__ )\n @adaptor.add_child( root_0, tree_for_Identificador345 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 64 )\n\n\n end\n\n return return_value\n end",
"def local(*args); end",
"def local_variable_scope\n parent.local_variable_scope\n end",
"def local\n @local\n end",
"def variables(vars)\n @storage[:variables] = vars\n end",
"def createEntryBlockAlloca(theFunction, varName)\n# IRBuilder<> TmpB(TheFunction.getEntryBlock, TheFunction.getEntryBlock.begin )\n# return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0, VarName)\n end",
"def push_ivar\n <<-CODE\n next_literal;\n stack_push(object_get_ivar(state, c->self, _lit));\n CODE\n end",
"def local_variable_declaration(method)\n\n\n\n \t dummy_variable = LocalVariableDefinition.new\n \t local_variables = []\n\n\n # 149:7: variable_modifier type[dummy_variable] local_variable_list[dummy_variable, local_variables, method] ';'\n variable_modifier()\n\n type(dummy_variable)\n\n local_variable_list(dummy_variable, local_variables, method)\n\n match(:SEMICOLON)\n\n local_variables.each do |local_variable|\n method.add_local_variable(local_variable)\n end\n local_variables.each do |local_variable|\n method.add_use_of(local_variable.name, local_variable.line) if local_variable.was_initialized?\n end\n \n\n\n\n end",
"def get_local_storage\n storage = {:hostname => Socket.gethostname, :mounts => [], :vgs => []}\n\n LVM::LVM.new({:command => \"/usr/bin/sudo /sbin/lvm\"}) do |lvm|\n lvm.volume_groups.each do |vg|\n vg.logical_volumes.each do |lv|\n mnt = get_mount(lv.name)\n fs = {:mount => mnt.mount_point, :fs => mnt.name, :lv => lv.name, :vg => vg.name}\n storage[:mounts] << fs\n end\n\n volg = {:vg => vg.name, :pvs => []}\n vg.physical_volumes.each do |pv|\n volg[:pvs] << {:pv => pv.name}\n end\n storage[:vgs] << volg\n end\n end\n storage\n end",
"def collect_variables\n []\n end",
"def locals\n @locals\n end",
"def global_variables() end",
"def locals\n if strict_locals?\n nil\n else\n @locals\n end\n end",
"def size()\n @VAR_STACK.length()\n end",
"def locals\n variables - parameters - hidden\n end",
"def method\n local_variable = \"Hi, I'm local only to this method\"\nend",
"def simple_variables\n strong_memoize(:simple_variables) do\n scoped_variables(environment: nil)\n end\n end",
"def variables; end",
"def variables; end",
"def increment_locals\n @locals += 1\n end",
"def alloc(front, rear)\n result = allocate\n result.instance_variable_set(:@front, front)\n result.instance_variable_set(:@rear, rear)\n result.freeze\n end",
"def local?; !!@local end",
"def __typedeaf_varstack__\n if @__typedeaf_varstack_id__.nil?\n @__typedeaf_varstack_id__ = \"typedeaf_varstack_#{self.object_id}\".to_sym\n end\n\n if Thread.current[@__typedeaf_varstack_id__].nil?\n Thread.current[@__typedeaf_varstack_id__] = []\n end\n return Thread.current[@__typedeaf_varstack_id__]\n end",
"def load_stack\n $LOAD_STACK\n end",
"def local_variable_reads(node); end",
"def loop\n evict_all\n br = get_local\n l = local\n yield(br,l)\n evict_all\n jmp(l)\n local(br)\n end",
"def globals; end",
"def globals; end",
"def local!(name)\n value = local(name)\n error(\"Undefined local `#{name}`.\") if value.nil?\n value\n end",
"def stack_start\n @stack_start ||= ram.size\n end",
"def new_variable(name, type, memory, is_cte = false) #method\n @variables[name] = ObjectVariable.new(name, type, memory, is_cte)\n end",
"def local(name)\n @locals[name.to_s.to_sym]\n end",
"def local_variable_declarator(dummy_variable, local_variables, method)\n \t_IDENTIFIER8 = nil\n\n\n\n\n \t local_variable = LocalVariableDefinition.new\n\n\n # 169:7: IDENTIFIER ( '[' ']' )* ( local_variable_initialization[method] )?\n _IDENTIFIER8 = @input.look_ahead(1)\n match(:IDENTIFIER)\n\n local_variable.name = _IDENTIFIER8.text\n local_variable.line = _IDENTIFIER8.line\n local_variable.type = dummy_variable.type\n \n # 174:7: ( '[' ']' )*\n while true\n alt21 = 2\n # ()* loopback of 174:7: ( '[' ']' )*\n look_ahead21_0 = look_ahead(1)\n if look_ahead21_0 == :LEFT_SQUARE_BRACKET \n alt21 = 1\n end\n case alt21\n when 1\n # 174:8: '[' ']'\n match(:LEFT_SQUARE_BRACKET)\n match(:RIGHT_SQUARE_BRACKET)\n local_variable.type << \"[]\" \n else\n break\n end\n end\n # 175:7: ( local_variable_initialization[method] )?\n alt22 = 2\n # 175:7: ( local_variable_initialization[method] )?\n look_ahead22_0 = look_ahead(1)\n\n if look_ahead22_0 == :EQUAL \n alt22 = 1\n end\n case alt22\n when 1\n # 175:8: local_variable_initialization[method]\n local_variable_initialization(method)\n\n local_variable.was_initialized \n end\n\n local_variables << local_variable\n \n\n\n\n end",
"def inspect_variables_in_scope(scope_node); end",
"def locals\n\t\t# \"typical\" example without name clashing\n\t\tlocal_var = 10 #1 [:setlocal, 2]\n\t\tputs(local_var) #2 [:getlocal, 2]\n\t\tlocal_var #3 has no effect and is skipped by compiler\n\n\t\tputs(method_call) #4 [:send, :method_call, 0, nil, 24, nil]\n\t\tmethod_call #5 [:send, :method_call, 0, nil, 24, nil]\n\t\tmethod_call() #6 [:send, :method_call, 0, nil, 8, nil]\n\tend",
"def initialize\n @info = Array.new(STACK_SIZE)\n @index = 0\n end",
"def allocated_storage\n data[:allocated_storage]\n end",
"def allocated_storage\n data[:allocated_storage]\n end",
"def some_method # Scope gate\n v2 = 2\n p local_variables\n end",
"def init(n)\n for s in 1..n do\n\t @stk.push(s)\n\tend\n end",
"def add_scope()\n $highest_scope += 1\n $current_scope_list << $highest_scope\n $var_list << {}\nend",
"def reserve!\n memory_map.transform_values! { |_| RESERVED }\n end",
"def prep_variables\n end",
"def local_arg(aparam)\n \"#{PTR_SIZE*(aparam+2)}(%ebp)\"\n end",
"def on_casgn(node)\n super\n _scope, name, = *node\n position = find_local name\n if position\n # TODO: raise error, can't re-assign contstant\n else\n position = locals.length\n @locals << name\n end\n\n emit :FROMALTSTACK\n emit :DUP\n emit :TOALTSTACK\n emit_push position\n emit_push 2\n emit :ROLL\n emit :SETITEM\n end",
"def to_vars\n vars = @temps.dup\n vars.push(*@locals.map { |l| \"#{l} = nil\" })\n\n iv = ivars.map do |ivar|\n \"if (self#{ivar} == null) self#{ivar} = nil;\\n\"\n end\n\n gv = gvars.map do |gvar|\n \"if ($gvars#{gvar} == null) $gvars#{gvar} = nil;\\n\"\n end\n\n indent = @compiler.parser_indent\n str = vars.empty? ? '' : \"var #{vars.join ', '};\\n\"\n str += \"#{indent}#{iv.join indent}\" unless ivars.empty?\n str += \"#{indent}#{gv.join indent}\" unless gvars.empty?\n\n if class? and !@proto_ivars.empty?\n #raise \"FIXME to_vars\"\n pvars = @proto_ivars.map { |i| \"#{proto}#{i}\"}.join(' = ')\n result = \"%s\\n%s%s = nil;\" % [str, indent, pvars]\n else\n result = str\n end\n\n fragment(result)\n end",
"def initialize\n @stack = []\n end",
"def initialize\n @stack = []\n end",
"def to_vars\n vars = @temps.dup\n vars.push(*@locals.map { |l| \"#{l} = nil\" })\n\n iv = ivars.map do |ivar|\n \"if (self#{ivar} == null) self#{ivar} = nil;\\n\"\n end\n\n gv = gvars.map do |gvar|\n \"if ($gvars#{gvar} == null) $gvars#{gvar} = nil;\\n\"\n end\n\n if class? && !@proto_ivars.empty?\n vars << '$proto = self.$$prototype'\n end\n\n indent = @compiler.parser_indent\n str = vars.empty? ? '' : \"var #{vars.join ', '};\\n\"\n str += \"#{indent}#{iv.join indent}\" unless ivars.empty?\n str += \"#{indent}#{gv.join indent}\" unless gvars.empty?\n\n if class? && !@proto_ivars.empty?\n pvars = @proto_ivars.map { |i| \"$proto#{i}\" }.join(' = ')\n str = \"#{str}\\n#{indent}#{pvars} = nil;\"\n end\n\n fragment(str)\n end",
"def inspect_variables_in_scope(scope_node)\n variable_table.push_scope(scope_node)\n process_children(scope_node)\n variable_table.pop_scope\n end",
"def has_local( name )\n raise \"has_local #{name}.#{name.class}\" unless name.is_a? Symbol\n @frame_type.variable_index( name )\n end",
"def storage=(_arg0); end"
] | [
"0.6657945",
"0.6476294",
"0.63291484",
"0.6280848",
"0.6264493",
"0.62583894",
"0.62052745",
"0.61316067",
"0.6096079",
"0.60400754",
"0.60282224",
"0.5930591",
"0.5871734",
"0.58600366",
"0.58068335",
"0.57896346",
"0.5743584",
"0.57284284",
"0.5661522",
"0.5649867",
"0.5649867",
"0.5649867",
"0.56082976",
"0.55461705",
"0.55088603",
"0.55047995",
"0.5498017",
"0.5494453",
"0.5462001",
"0.54189026",
"0.54137045",
"0.5390078",
"0.53715986",
"0.53089154",
"0.5296818",
"0.5270932",
"0.5256018",
"0.5241718",
"0.5237074",
"0.5226155",
"0.52126503",
"0.52109575",
"0.5207715",
"0.5187291",
"0.5150217",
"0.51334476",
"0.5117277",
"0.5093064",
"0.50900155",
"0.5087411",
"0.5076671",
"0.5076082",
"0.50700766",
"0.5069102",
"0.50649744",
"0.50635535",
"0.5044183",
"0.5021431",
"0.5016048",
"0.5011208",
"0.50025195",
"0.5001133",
"0.49901548",
"0.4970094",
"0.4967121",
"0.49635693",
"0.49635693",
"0.49629477",
"0.49606222",
"0.49541497",
"0.49531335",
"0.49508315",
"0.49473202",
"0.49462432",
"0.490183",
"0.490183",
"0.4896933",
"0.48953924",
"0.48935884",
"0.4889234",
"0.4870572",
"0.4865896",
"0.48594692",
"0.4858257",
"0.48572248",
"0.48572248",
"0.4855685",
"0.48461688",
"0.4833816",
"0.48337102",
"0.48280057",
"0.4825306",
"0.48236126",
"0.48216224",
"0.48193622",
"0.48193622",
"0.4815705",
"0.4814303",
"0.48137325",
"0.48070765"
] | 0.6802815 | 0 |
incomplete shouldn't do anything | def incomplete
puts "not a feature of GoalTracker"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def incomplete\r\n\r\n end",
"def private; end",
"def probers; end",
"def missing; end",
"def remaining; end",
"def missing?; end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def ignores; end",
"def complete?; end",
"def suivre; end",
"def internship_passed; end",
"def schubert; end",
"def ibu; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def internal; end",
"def missed?; end",
"def big_bad; end",
"def pass; end",
"def pass; end",
"def implementation; end",
"def implementation; end",
"def dead?; end",
"def skipped; end",
"def berlioz; end",
"def complete!\n raise NotImplementedError\n end",
"def isolated; end",
"def isolated; end",
"def weber; end",
"def ignore; end",
"def used?; end",
"def refutal()\n end",
"def invalid; end",
"def under_construction\n end",
"def done; end",
"def who_we_are\r\n end",
"def pending?; end",
"def unused\n end",
"def internal?; end",
"def complete\n raise NotImplementedError\n end",
"def placebo?; false end",
"def faint; end",
"def faint; end",
"def final; end",
"def semact?; false; end",
"def custom; end",
"def custom; end",
"def valid; end",
"def gounod; end",
"def begin; end",
"def usable?; end",
"def pausable; end",
"def r; end",
"def r; end",
"def extra; end",
"def operations; end",
"def operations; end",
"def celebration; end",
"def proceed!; end",
"def proceed!; end",
"def discard; end",
"def discard; end",
"def flag; end",
"def reap; end",
"def trd; end",
"def missing?; false; end",
"def bug\n end",
"def silly_adjective; end",
"def terpene; end",
"def anchored; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def reserved; end",
"def complete\n nil\n end",
"def complete\n nil\n end",
"def operation; end",
"def skipped!; end",
"def optional; end",
"def zuruecksetzen()\n end",
"def villian; end",
"def extra_state; end",
"def miss_reason; end",
"def nothing; end",
"def absent?; end",
"def returns; end",
"def unquiesce \n raise NotImplementedError.new\n end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end"
] | [
"0.75019497",
"0.7479263",
"0.7039842",
"0.69246954",
"0.6788856",
"0.6705853",
"0.66968834",
"0.6696005",
"0.6681822",
"0.6651681",
"0.6605049",
"0.6603852",
"0.6597086",
"0.65584797",
"0.65584797",
"0.65584797",
"0.65584797",
"0.65046865",
"0.6494277",
"0.64641196",
"0.64241517",
"0.64241517",
"0.6395174",
"0.6395174",
"0.6393724",
"0.6376839",
"0.637457",
"0.6373785",
"0.63714623",
"0.63714623",
"0.6331642",
"0.63311565",
"0.63311404",
"0.6321066",
"0.6315737",
"0.6307073",
"0.6303744",
"0.6289484",
"0.62814146",
"0.6281032",
"0.6278276",
"0.6275215",
"0.6272846",
"0.626307",
"0.626307",
"0.62587994",
"0.6254064",
"0.6252348",
"0.6252348",
"0.62473524",
"0.62363505",
"0.62355673",
"0.6226006",
"0.6222912",
"0.62226266",
"0.62226266",
"0.62184894",
"0.6215656",
"0.6215656",
"0.61790705",
"0.61740404",
"0.61740404",
"0.61670196",
"0.61670196",
"0.61551076",
"0.6135858",
"0.6126987",
"0.61126125",
"0.6109689",
"0.6098863",
"0.6088958",
"0.60885566",
"0.6087492",
"0.6087492",
"0.6087492",
"0.6087492",
"0.6087492",
"0.6087492",
"0.6087492",
"0.6087492",
"0.60861254",
"0.60776323",
"0.60776323",
"0.60758865",
"0.6074045",
"0.6071917",
"0.6060554",
"0.6058378",
"0.6053588",
"0.60535127",
"0.6049645",
"0.60474414",
"0.6047064",
"0.6044089",
"0.6043031",
"0.6043031",
"0.6043031",
"0.6043031",
"0.6043031",
"0.6043031",
"0.6043031"
] | 0.0 | -1 |
returns if data has been sent | def is_complete?
# check if an individual rep, complete reps of day if not
if self.rep_parent.nil?
self.repititions.
where(:show_date => Date.current).each do |rep|
if !rep.is_complete?
return false
end
end
return true
else
return self.state == Activity::COMPLETE
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sent?\n status.sent? || status.received? || status.read?\n end",
"def msg_sent?\n true\n end",
"def sent?\n @sent\n end",
"def request_sent?\n !response.nil?\n end",
"def sent?\n !@sent_at.nil?\n end",
"def sent?\n !@id.nil?\n end",
"def can_send?\n !sent?\n end",
"def sent?\n status == \"sent\"\n end",
"def message_sent?\n message.state == 'sent'\n end",
"def message_sent?\n message.state == 'sent'\n end",
"def send_pending\n if output.length > 0\n sent = send(output.to_s, 0)\n debug { \"sent #{sent} bytes\" }\n output.consume!(sent)\n return sent > 0\n else\n return false\n end\n end",
"def received?\r\n self['trans_status']=='99'\r\n end",
"def might_have_data?\n @state.to_s =~ /finished|aborted|running/\n end",
"def sent?\n self.status == 'sent'\n end",
"def succeeded?\n request_sent? && response.success?\n end",
"def send_data(packet)\n if @status == :open\n data = JSON.dump(packet)\n @mutex.synchronize do\n @wscon.send(data)\n end\n return true\n end\n return false\n end",
"def pending_write?\n output.length > 0\n end",
"def send?\n type == 'send'\n end",
"def data?\n dis_data.any?\n end",
"def received?\n status.received? || status.read?\n end",
"def done_request_line?\n [:headers, :body_identity, :body_chunked, :body_chunked_tail, :done].include?(@state)\n end",
"def receive_data_command\n @headers_finished = false\n @body = []\n @headers = {}\n\n return true\n end",
"def response_received?\n !! @status\n end",
"def response_received?\n !! @status\n end",
"def socket?() end",
"def enqueue?(data)\n result = false\n\n begin\n # uses unix domain socket\n sock_path = @sock_path\n enq_sock = UNIXSocket.new(sock_path)\n \n packet = add_header(data)\n\n Lgdisit.logger.info(LgdisitUtil.get_bracketed_string(self.object_id.to_s) + \"Send: \" + packet)\n enq_sock.send packet,0\n result = true\n rescue => exception\n result = false\n Lgdisit.logger.error(exception) \n ensure\n if !enq_sock.nil?\n enq_sock.close \n Lgdisit.logger.info(LgdisitUtil.get_bracketed_string(self.object_id.to_s) + \"Socket closed.\")\n end\n end\n\n return result\n end",
"def is_receiving_data\n if defined? TsPoint\n return IsTsInstrumentAlive.call(TsPoint, \"value\", self.id, self.sample_rate_seconds+5)\n else\n return false\n end\n end",
"def sent?\n id.present? && error.blank?\n end",
"def needs_sending?\n !sent? && !flagged?\n end",
"def response?\n done? && !error?\n end",
"def finished?\n\t\t\t\t@finished && @body.length >= @headers['CONTENT_LENGTH']\n\t\t\tend",
"def has_been_read?\n @data_read\n end",
"def headers_sent?\n return true if _httpsession.resp.headers_sent\n return false\n end",
"def good?\n\t\t\t\t\t@stream.connected?\n\t\t\t\tend",
"def sent?\n id.present?\n end",
"def buffer? \n !@_out_buf.nil?\n end",
"def receive_data_command\n true\n end",
"def receive_data_command\n true\n end",
"def sent?\n sender_id.present?\n end",
"def in_transit?\n status.sent?\n end",
"def multi_response_completed?\n @multi_buffer.nil?\n end",
"def pending_data?\n !pending_queues.empty?\n end",
"def success?\n reply_code == 0\n end",
"def ready_for_write?\n begin\n @write_buffer.length > 0 && IO.select(nil, [socket], nil, 0.1)\n rescue Exception\n triggered_close $!.message, :terminated\n raise\n end\n end",
"def work_pending?\n !buffer.empty?\n end",
"def reading?\n status.received?\n end",
"def has_sent_recognition_data?\n [top_recognition_senders, bottom_recognition_senders].flatten.any? { |u| u.sent_recognitions_count > 0 }\n end",
"def alive?\n unless(@recvthread.instance_of?(Thread))\n return false\n end\n \n ret=@recvthread.alive?\n @sendthreads.each_value{|t|\n ret&=t\n }\n ret&=(!@socket.closed?)\n \n return ret\n end",
"def data_available?\n true\n end",
"def eof?\n @sock.closed?\n end",
"def data?\n self.runner.parameters[:data] || false\n end",
"def established?\n !! @socket\n end",
"def finished?\n @buffer.size == @size\n end",
"def finished?\n super && response_received?\n end",
"def finished?\n super && response_received?\n end",
"def queued_messages?\r\n @pointer < @buffer.length\r\n end",
"def ok?\n return @data[\"stat\"] == \"ok\" ? true : false\n end",
"def processed?\n @processed_smser || @sms_message\n end",
"def success?\n stat = false\n if @data and @data['message'] == 'success'\n stat = true\n end\n return stat\n end",
"def open?\n @data_bytes[1] != 0\n end",
"def connected?\n !!@socket\n end",
"def connected?\n !!@socket\n end",
"def receive_po\n is_received?\n end",
"def stream_is_done?\n @stream.nil? || @stream.closed? || @stream.eof?\n end",
"def connected?\n !socket.closed?\n end",
"def connected?\n\t\t\t\treturn false if @io.closed?\n\t\t\t\t\n\t\t\t\t# If we can wait for the socket to become readable, we know that the socket may still be open.\n\t\t\t\tresult = to_io.recv_nonblock(1, MSG_PEEK, exception: false)\n\t\t\t\t\n\t\t\t\t# Either there was some data available, or we can wait to see if there is data avaialble.\n\t\t\t\treturn !result.empty? || result == :wait_readable\n\t\t\t\t\n\t\t\trescue Errno::ECONNRESET\n\t\t\t\t# This might be thrown by recv_nonblock.\n\t\t\t\treturn false\n\t\t\tend",
"def transmit\n if self.sendcmd(\"main.get_trx_status\")==\"tx\"\n return true\n else\n self.sendcmd(\"main.tx\")\n end\n if self.sendcmd(\"main.get_trx_status\")==\"tx\"\n return true\n else\n self.error(\"main.tx failed\")\n return false\n end\n end",
"def _send_result state\n unless @one_way || state.message.one_way\n # $stderr.write \"\\n _send_result #{state.result_payload.inspect}\\n\\n\"\n _write(state.result_payload, state.out_stream, state)\n true\n end\n end",
"def failed_write\n begin\n @sock.wait_readable\n rescue ArgumentError # IO Selector Exception\n return true\n end\n false\n end",
"def complete?\n status_code == 'OK'\n end",
"def send_and_get_data data\n send_data data\n get_data_with_timeout data.size\n end",
"def received?\n !!self.received_at?\n end",
"def queued_messages?\n @pointer < @buffer.length\n end",
"def complete?\n @bytes == [[0, @length - 1, true]]\n end",
"def closed?\n socket.closed?\n end",
"def complete?\n buff.length < @maxlen\n end",
"def performed?\n response_body\n end",
"def check ()\n\t return \"OK\" if @simulate\n\t return \"IES\" unless @sock\n\t @sock.readline().chomp\n\tend",
"def empty?\n @buffer.empty? && stream_is_done?\n end",
"def closed?\n socket.closed?\n end",
"def ok?\n first[OK] == 1 || reply.nil?\n end",
"def success?\n !raw_response.nil?\n end",
"def waiting_for?(packet)\n\t\treturn (packet.rid == rid)\n\tend",
"def sendable?\n at?(:active)\n end",
"def is_requesting?\n @lock.synchronize { !@batch.empty? }\n end",
"def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend",
"def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend",
"def eof?\n @socket.eof?\n rescue IOError, SystemCallError\n true\n end",
"def reader_ready?\n IO.select([@socket],nil,nil,0) != nil\n end",
"def fin?\n Capp::TCP_FIN == flags & Capp::TCP_FIN\n end",
"def failed?\n request_sent? && !response.success?\n end",
"def data_fetched?\n @data_fetched\n end",
"def pull?\n @data_bytes[1] != 0\n end",
"def delivered?\n\t\t@mutex.synchronize {\n\t\t\tinstance_variable_defined? :@value\n\t\t}\n\tend",
"def viable?\n\t\t\t\t\t\t@ready && @stream&.connected?\n\t\t\t\t\tend",
"def success?\n return unless @request\n if @request.respond_to?(:success?)\n @request.success?\n else\n _response = http_client.response\n _response && _response.code.start_with?('2')\n end\n end",
"def write(message)\n @out_buffer << message\n n = @socket.send(@out_buffer, 0)\n # Chop what we already sent off the front of the buffer.\n @out_buffer.slice!(0...n)\n # Return whether we are done sending.\n return @out_buffer.size == 0\n end",
"def status_getdata?()\n return true if (@status == TAC_PLUS_AUTHEN_STATUS_GETDATA)\n return false\n end",
"def has_pending_requests?\n received_requests.pending.any?\n end",
"def data_changed?\n changes.include?(\"data\")\n end",
"def successfully_sent?(resource)\n message_kind = resolve_message_kind!(resource)\n\n return false if message_kind.nil?\n\n @message = find_message(message_kind, {})\n true\n end"
] | [
"0.7570652",
"0.7502323",
"0.7289277",
"0.6952359",
"0.69519824",
"0.69459414",
"0.6929616",
"0.68513554",
"0.6805283",
"0.6805283",
"0.67984354",
"0.6748324",
"0.6733153",
"0.66976255",
"0.6686635",
"0.66778404",
"0.66710746",
"0.66611874",
"0.6648253",
"0.6633918",
"0.6577645",
"0.6571878",
"0.6533903",
"0.6533903",
"0.65166086",
"0.6502216",
"0.6497064",
"0.6495855",
"0.64953053",
"0.64786685",
"0.6461878",
"0.64135945",
"0.6412443",
"0.63789684",
"0.63359034",
"0.63240683",
"0.62580293",
"0.62580293",
"0.62500423",
"0.623984",
"0.62363416",
"0.6220592",
"0.6204244",
"0.6177277",
"0.6162542",
"0.6162042",
"0.6154334",
"0.61517763",
"0.61355484",
"0.61083186",
"0.6103953",
"0.6102091",
"0.61007863",
"0.61002916",
"0.61002916",
"0.6095529",
"0.60854924",
"0.6075606",
"0.6069234",
"0.6063235",
"0.60619277",
"0.60619277",
"0.60446966",
"0.6044027",
"0.60439634",
"0.6039957",
"0.60392475",
"0.6033422",
"0.60206777",
"0.60004276",
"0.5991624",
"0.59914184",
"0.59875196",
"0.59857213",
"0.5985406",
"0.5977787",
"0.59757614",
"0.597537",
"0.59577435",
"0.59556615",
"0.59502274",
"0.59318644",
"0.5930633",
"0.5917315",
"0.5913005",
"0.590822",
"0.590822",
"0.590548",
"0.5899704",
"0.5893917",
"0.5893483",
"0.5878918",
"0.5876466",
"0.58742315",
"0.5865157",
"0.58644646",
"0.58641833",
"0.5863132",
"0.5863022",
"0.585389",
"0.585258"
] | 0.0 | -1 |
:secret => 'a988443081447099355cae80d988cbaa' See ActionController::Base for details Uncomment this to filter the contents of submitted sensitive data parameters from your application log (in this case, all fields with names like "password"). filter_parameter_logging :password | def error_messages_for(object_name)
object = instance_variable_get("@#{object_name}")
if object
msg = ""
puts "================"
puts object.errors.inspect
object.errors.each do | attr, msg|
msg = content_tag(:p, Column[attr]+msg)
break
end
end
content_tag(:div, msg, :id => "errorExplanation") unless msg.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secret_params\n params.require(:secret).permit(:body, :password, :expiration, :unlock_password)\n end",
"def secret\n decrypt_secret\n end",
"def secret\n decrypt_secret\n end",
"def filter_password_confirmation\n log :filter_password_confirmation, \"\"\n replace_in_file 'config/initializers/filter_parameter_logging.rb',\n 'Rails.application.config.filter_parameters += [:password]',\n 'Rails.application.config.filter_parameters += [:password, :password_confirmation]'\n end",
"def secret\n @secret || ''\n end",
"def secret\n \"whatamidoing\"\n end",
"def secret_params\n params.require(:secret).permit(:name, :value)#.merge(user_id: current_user.id)\n end",
"def secret\n # ````'badbreathbuffalo'\n\n # Hide in React Auth pt2 1:20:00 \n # ```ENV['jwt_secret']\n # Export in ~/.bash_profile\n # export jwt_secret = 'badbreathbuffalo'\n\n # OR\n\n # $ EDITOR='code --wait' rails credentials:edit\n # Add to the bottom of the file:\n # `jwt_secret: 'badbreathbuffalo'`\n # Save and close the file\n Rails.application.credentials.jwt_secret\n\n # Heroku Config Vars\n # ```ENV['jwt_secret']\n end",
"def password\n conf['api']['password']\n end",
"def password=(secret)\n if secret.present?\n @password = secret\n self.password_digest = BCrypt::Password.create(secret)\n end\n end",
"def generate_secret\n self.password = self.class.generate_secret\n end",
"def password_params\n params.require(:password).permit(:login, :pass, :url, :obs, :PasswordCategory_id)\n end",
"def get_secret(params)\n return @api_secret\n end",
"def secret\n\t\tputs \"This IS a secret\"\n\tend",
"def set_Secret(value)\n set_input(\"Secret\", value)\n end",
"def set_Secret(value)\n set_input(\"Secret\", value)\n end",
"def secret_key\n ActionController::Base.session_options[:secret]\n end",
"def monitor_password_with(secret,salt)\n secret_key = Digest::MD5.digest(secret)\n iv = Digest::MD5.digest(salt)\n begin\n Encryptor.decrypt(Base64.decode64(read_attribute(:monitor_password)), :key => secret_key,:iv=>iv)\n rescue\n return read_attribute(:monitor_password)\n end\n end",
"def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end",
"def token_secret; end",
"def token_secret; end",
"def token_secret; end",
"def secret_key\n credentials['secret_key']\n end",
"def secret_key\n credentials['secret_key']\n end",
"def secret\n query[\"client_secret\"]\n end",
"def basic_params\n { username: @id, password: @secret }\n end",
"def secret_key; end",
"def secret\n # EDITOR='code --wait' rails credentials:edit\n # Rails.application.credentials.jwt_secret\n # Use environmental variables for Heroku\n ENV['jwt_secret']\n end",
"def secret\n super\n end",
"def secret_params\n params.require(:secret).permit(:message, :key, :algorithm)\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def secret\n @secret or raise MissingSecret\n end",
"def secret\n @options[:credential2]\n end",
"def secret_key\n \"\"\n end",
"def password\r\n @password\r\n end",
"def set_secret\n @secret = Secret.find(params[:id])\n end",
"def set_secret\n @secret = Secret.find(params[:id])\n end",
"def set_secret\n @secret = Secret.find(params[:id])\n end",
"def set_secret\n @secret = Secret.find(params[:id])\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def value\n if show_secret\n secret\n else\n Digest::SHA1.hexdigest secret\n end\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def xf_password_field (object_name, method, label = nil, attrs = {})\n attrs = attrs.symbolize_keys()\n text (\"secret\", object_name, method, label, attrs)\n end",
"def secure_password_params\n params.require(:secure_password).permit(:url, :name, :notes, :password)\n end",
"def client_secret; end",
"def password \n @password \n end",
"def test_secret\n assert pass = Argon2::Password.create('mypassword', secret: \"A secret\")\n skip(\"The secret isn't kept on the Argon2::Password instance\")\n assert_equal pass.secret, \"A secret\"\n end",
"def password\n @crypted_password\n \n end",
"def get_password(password)\n password\n end",
"def api_secret_field(value = nil)\n rw_config(:api_secret_field, value, first_column_to_exist(nil, :api_secret, :application_secret))\n end",
"def consumer_secret; config[:consumer_secret]; end",
"def set_secret\n @secret = Secret.find(params[:id])\n end",
"def secret_params\n params.require(:secret).permit(:content)\n end",
"def token_secret\n config_method_not_implemented\n end",
"def password\n\t\t@password\n\tend",
"def password\n\t\t@password\n\tend",
"def get_password\n if Rails.env == \"development\"\n return \"password\"\n else\n abort(\"You should only run this on development.\\naborting\")\n end\nend",
"def service_password( password )\n\t\t\tself.password_digest = Digest::SHA2.hexdigest( password )\n\t\t\tDRbService.log.debug \"Setting encrypted password for %p to \"\n\t\tend",
"def password\n [@password, @security_token].join('')\n end",
"def password\n@password\nend",
"def password\n@password\nend",
"def secure_hash\r\n params['secureHash']\r\n end",
"def password\n\n end",
"def user_password\n @password\n end",
"def encrypted_password\n nil\n end",
"def password_params\n params.permit(:password, :ip)\n end",
"def password\n end",
"def password\n end",
"def secret(new_secret = nil)\n if !new_secret\n @secret\n else\n @secret = new_secret\n @encrypt = true if @encrypt.nil?\n end\n end",
"def password=(password)\n @password = password\n end",
"def password_params\n params.require(:password).permit(:password)\n end",
"def initialize_secret(opts = {})\n secret = if opts[:username] && opts[:password]\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Using provided plain credentials\"\n \"#{opts[:username]}:#{opts[:password]}\"\n else\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Falling back to file and environment credentials\"\n opts[:auth_file] ? File.read(opts[:auth_file]) : nil\n end\n secret.strip! if secret\n secret\n end"
] | [
"0.67574555",
"0.67557096",
"0.67557096",
"0.66757953",
"0.6570936",
"0.6537558",
"0.64591116",
"0.6381581",
"0.6324565",
"0.6238957",
"0.6231013",
"0.6228836",
"0.6201663",
"0.6189981",
"0.6186701",
"0.6186701",
"0.6158133",
"0.6133264",
"0.61268026",
"0.6115818",
"0.6115818",
"0.6115818",
"0.60937",
"0.60937",
"0.6090736",
"0.60764116",
"0.6072751",
"0.6070961",
"0.6069484",
"0.6057571",
"0.60539424",
"0.60539424",
"0.6024455",
"0.59898525",
"0.5989393",
"0.59879446",
"0.59774387",
"0.59774387",
"0.59774387",
"0.59774387",
"0.5972383",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5969595",
"0.5958477",
"0.5935817",
"0.5935817",
"0.5934223",
"0.5925123",
"0.5923203",
"0.59177977",
"0.59141994",
"0.5899477",
"0.5899297",
"0.5895394",
"0.58853656",
"0.5876291",
"0.58747774",
"0.5874588",
"0.5871736",
"0.5871736",
"0.5863971",
"0.5862131",
"0.5860687",
"0.58605903",
"0.58605903",
"0.5855125",
"0.58494216",
"0.58452857",
"0.5840247",
"0.58387595",
"0.5836836",
"0.5836836",
"0.58319306",
"0.5825765",
"0.5823794",
"0.5823136"
] | 0.0 | -1 |
using hashes as method parameters | def area(options) #taking one hash instead of multiple parameters, imagine you had to pass 10 parameters...
options[:width] * options[:length] #the use of symbols :key is a convention for hash method parameters
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def params=(hash); end",
"def params=(hash); end",
"def method(hash)\n p hash # {\"location\"=>\"SF\", \"color\"=>\"red\", \"size\"=>100}\nend",
"def method(hash)\n p hash # {\"location\"=>\"SF\", \"color\"=>\"red\", \"size\"=>100}\nend",
"def hash_for_json(*_arg0); end",
"def hash\n hash_args.hash\n end",
"def example(hash_of_arguments)\n hash_of_arguments.each {|key,value| self.send(\"#{key}=\", value) }\nend",
"def method_missing(method, *args)\n hash.send(method, *args)\n end",
"def method_missing(method, *args)\n hash.send(method, *args)\n end",
"def get_hash(*params); raise('Stub or mock required.') end",
"def cast_to_hash(params); end",
"def _key(*args); args.hash; end",
"def assign_hash(method_name, params)\n @params[method_name] ||= {}\n params.each do |attr_name, value|\n @params[method_name][attr_name] = value\n end\n end",
"def hash(*args, **_arg1, &block); end",
"def custom_from_hashes\n self.create_hash.each_pair do |key,value|\n method_name = \"#{key}_from_hash\".to_sym\n if self.respond_to?(method_name)\n self.send(method_name,value)\n end\n end\n end",
"def prepare_method_arg_hash(args)\n # SEQUEL5: Remove\n h = {}\n prepare_method_args('a', args.length).zip(args).each{|k, v| h[k] = v}\n h\n end",
"def hash=(_arg0); end",
"def parameterize(hash)\n _hash = {}\n hash.each do |k,v|\n _hash[k.to_sym] = parameterized?(k) ? attributes_to_hash(v) : v\n end\n _hash\n end",
"def my_hash_creator(key, value)\n # return a hash that includes the key and value parameters passed into this method\n {key => value}\nend",
"def my_method_hash(attrs = {})\n puts \"Name is #{attrs[:name]}\"\nend",
"def map(hash); end",
"def update(para)\n if para.kind_of? Hash\n from_hash(para)\n end\n\nend",
"def method_missing(sym, *args, &block)\n str = sym.to_s\n matches = nil\n\n if str == \"[]\"\n str = args.shift\n elsif str == \"[]=\"\n str = \"#{ args.shift }=\"\n end\n\n if @@fields.include?(str)\n @hash[str]\n elsif matches = str.match(/(.*)=$/) and @@fields.include?(matches[1])\n @hash[matches[1]] = args.first\n else\n super(sym, *args, &block)\n end\n end",
"def method(**a)\r\nend",
"def meth(\n **\n ); end",
"def consume_hash(subject, hash)\n result = @argument_list.inject({}) do |result, arg|\n result.merge arg.consume_hash(subject, hash)\n end\n unless @name.nil?\n result[@name] = parse(subject, hash[@name])\n end\n return result\n end",
"def consume_hash(subject, hash)\n result = @argument_list.inject({}) do |result, arg|\n result.merge arg.consume_hash(subject, hash)\n end\n unless @name.nil?\n result[@name] = parse(subject, hash[@name])\n end\n return result\n end",
"def call_hash\n raise NotImplementedException.new(\"Must implement call_hash\")\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def example(*array_of_arguments)\n\n#this method expects a single hash as an argument\ndef example(name:, age: 18) #age is defaulted to 18 if not specified\n puts age # don't use symbols in the body of the method\n puts :name # this will print the symbol \"name\" instead of \"Andrew\"\nend\n# despite being passed in the \"wrong order\", name will still be \"Andrew\" and age will be 24\nexample(age: 24, name: \"Andrew\")\n\n# accepts a hash, creates new instance variables named after the keys, and sets them equal to the corresponding value\ndef example(hash_of_arguments)\n hash_of_arguments.each {|key,value| self.send(\"#{key}=\", value) }\nend\n# however, setter methods must already exist for these new attributes because .SEND is trying to call them\n\nclass Example\n def initialize\n @status = \"instantiated\"\n end\nend\nobj = Example.new\n# access obj's @status without calling, or even defining, getter/setter methods\nobj.instance_variable_get(\"@status\") #can pass @status as a string...\n# @status => \"instantiated\"\nobj.instance_variable_set(:@status, 123)#...or a symbol.\n# @status => 123\n\n# by combining the previous two concepts, we can create an initialize method that will accept a hash...\n# ...with any number of key/value pairs and instantiate a new object attribute for each.\nclass Example\n def initialize(attr_hash)\n attr_hash.each {|key, value| self.instance_variable_set(\"@#{key}\", value) }\n end\nend\nobj = Example.new(status: \"instantiated\", name: \"Andrew\", age: 24, hello: \"world\")\n# right now, the only way to get these values is to use \"instance_variabe_get\"\n# however, we can write the attr macros for the attributes we expect and ignore the rest\n# this is bad design but I thought it was cool\n\n#__________Time__________\n\nstart = Time.now\n#some code executes...\nputs Time.now - start\n# measures runtime\n\n#format Time object as a string\nTime.now.strftime(\"%d/%m/%Y %H:%M\") # => \"01/02/2003 4:56\"\n\n#__________terminal/bash_commands__________",
"def method_missing(method_name, *opts, &block)\n body[method_name.to_s] if body.is_a?(Hash)\n end",
"def will_create_new_hash(**hash)\n hash[:x] = 10 # Change\n p hash\n p hash.object_id \nend",
"def initialize(*h)\n if h.length == 1 && h.first.kind_of?(Hash)\n h.first.each do |k,v| \n if !respond_to? \"#{k}\"\n self.class_eval(\"def #{k};@#{k};end\")\n self.class_eval(\"def #{k}=(val);@#{k}=val;end\")\n end\n send(\"#{k}=\",v) \n end\n end\n end",
"def method_missing(method, *args)\n instance.value_for(method, args) do |v, args|\n instance.collapse_hashes(v, args)\n end\n end",
"def process_params object\n case object\n when Hash\n new_hash = indifferent_hash\n object.each { |key, value| new_hash[key] = process_params(value) }\n new_hash\n when Array\n object.map { |item| process_params(item) }\n when M_BOOLEAN\n object == \"true\"\n when M_FLOAT\n object.to_f\n when M_INTEGER\n object.to_i\n else\n object\n end\n end",
"def initialize *args\n if args.size == 1 && args.first.is_a?(Hash)\n super()\n args.first.each do |k,v|\n send \"#{k}=\", v\n end\n else\n super\n end\n end",
"def set_params(hash)\n hash.each do |k,v|\n set_param(k, v)\n end\n end",
"def lookup_hash_args(*args, **kwargs)\n if args.empty?\n [kwargs]\n elsif args.length == 1 && args.last.is_a?(Hash)\n [args.first.symbolize_keys]\n else\n args\n end\n end",
"def hash\n [name, args].hash\n end",
"def method_missing(meth, *args)\n return nil if !@hash.key?(meth) && args.empty?\n if args.empty?\n @hash[meth]\n else\n @hash[meth] = args.size == 1 ? args.first : args\n end\n end",
"def set_hash_method(opts)\n opts = check_params(opts,[:methods])\n super(opts)\n end",
"def setup(hash_args); end",
"def initialize(*args)\n @hash = HashWithIndifferentAccess.new(*args)\n end",
"def the_hash\n puts put_in_hash(get_symbols, get_prices, 20)\nend",
"def serializable_hash(*args)\n args[0] = (args[0] || {}).merge(:except => [:password, :twitter_access_token, :twitter_access_secret, :facebook_access_token] )\n user_hash = super\n\n if self.current_trip\n user_hash[:due] = self.current_trip.total_due_to(self)\n user_hash[:owe] = self.current_trip.total_owed_from(self)\n user_hash[:contributed] = self.current_trip.total_contributed_from(self)\n user_hash[:obligated] = self.current_trip.total_obligated_from(self)\n user_hash[:purchases] = self.purchases.where(:trip_id => self.current_trip.id)\n user_hash[:contributions] = self.contributions.includes(:expense).where([\"expenses.trip_id = ?\", self.current_trip.id])\n user_hash[:obligations] = self.obligations.includes(:expense).where([\"expenses.trip_id = ?\", self.current_trip.id])\n\n user_hash[:owe_members] = self.current_trip.members.collect{|x| {:user => x, :amount => self.amount_owed_from(x, self.current_trip)}}.select{|x| !x[:amount].zero?}\n user_hash[:due_members] = self.current_trip.members.collect{|x| {:user => x, :amount => self.amount_due_to(x, self.current_trip)}}.select{|x| !x[:amount].zero?}\n end\n\n user_hash\n end",
"def update(*other_hashes, &blk); end",
"def hashes_examples\n\n user = {} # {} is an empty hash.\n\n user[\"first_name\"] = \"Michael\" # Key \"first_name\", value \"Michael\"\n user[\"last_name\"] = \"Hartl\" # Key \"last_name\", value \"Hartl\"\n user[\"first_name\"] # Element access is like arrays.\n\n # A literal representation of the hash\n user # => {\"last_name\"=>\"Hartl\", \"first_name\"=>\"Michael\"}\n\n # Instead of defining hashes one item at a time using square brackets,\n # it’s easy to use their literal representation\n user = { \"first_name\" => \"Michael\", \"last_name\" => \"Hartl\" }\n\n # In Rails more common to use symbols as hash keys\n # Symbols look kind of like strings, but prefixed with a colon instead of surrounded by quotes.\n # For example, :name is a symbol. Symbols as basically strings without all the extra baggage.\n # Symbols are a special Ruby data type\n user = { :name => \"Michael Hartl\", :email => \"michael@example.com\" }\n\n user[:name] # => \"Michael Hartl\"\n user[:password] # => nil (undefined key)\n\n # Hash values can be virtually anything, even other hashes (hashes-of-hashes, or nested hashes)\n params = {}\n params[:user] = { :name => \"Michael Hartl\", :email => \"mhartl@example.com\" }\n\n params # => {:user=>{:name=>\"Michael Hartl\", :email=>\"mhartl@example.com\"}}\n params[:user][:email] # => \"mhartl@example.com\"\n\n # Hash brackets are optional for the final argument in a method\n # so these two lines are equivalent\n user.update_attributes(:name => \"The Dude\", :email => \"dude@abides.org\")\n user.update_attributes( { :name => \"The Dude\", :email => \"dude@abides.org\" } )\n\n # As with arrays and ranges, hashes respond to the each method\n # with a block that takes two variables\n # the each method for a hash iterates through the hash one key-value pair at a time\n flash = { :success => \"It worked!\", :error => \"It failed. :-(\" }\n flash.each do |key, value|\n puts \"Key #{key.inspect} has value #{value.inspect}\"\n end\n # outputs:\n # Key :success has value \"It worked!\"\n # Key :error has value \"It failed. :-(\"\n\n # The inspect method, which returns a string with a literal representation of the object it’s called on\n puts (1..5).to_a.inspect # => [1, 2, 3, 4, 5]\n\n puts :name, :name.inspect\n # outputs:\n # name\n # :name\n\n puts \"It worked!\", \"It worked!\".inspect\n # outputs:\n # It worked!\n # \"It worked!\"\n\n p :name # Same as 'puts :name.inspect'\n end",
"def load_params args\n\tparams = {}\n\targs.each_slice(2) do | key_value |\n\t\t# puts \"o #{key_value}\"\n\t\tparams[key_value[0][1..-1]] = key_value[1]\n\tend\n\tparams\nend",
"def to_hash(*_arg0); end",
"def initialize(*args)\n args.each do |arg|\n if arg.kind_of? Hash\n arg.each do |k,v|\n self.send(\"#{k}=\", v)\n end\n end\n end\n end",
"def inject(hash); end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def initialize(optHash)\n @optHash=optHash\n setParameters()\nend",
"def merge(hash_1, hash_2)\n\nend",
"def method_missing(method_name, *args, &block)\n if data.key?(method_name.to_s)\n data[method_name.to_s]\n elsif data.respond_to?(method_name)\n warn 'WARNING: Please convert ObjectifiedHash object to hash before calling Hash methods on it.'\n data.send(method_name, *args, &block)\n else\n super\n end\n end",
"def param_hash(*keys)\n params.to_unsafe_h\n .deep_symbolize_keys\n .then { |hash| keys.empty? ? hash : hash.slice(*keys) }\n .compact\n end",
"def hash(*) end",
"def method_missing(m, *args, &block)\n method_name = m.to_s.gsub(/=$/, '')\n if self.class.schema.keys.include?(method_name)\n m.to_s.match(/=$/) ? @hash[method_name] = args[0] : @hash[method_name]\n else\n super\n end\n end",
"def process_hash(exp)\n kv_list = exp\n raise if kv_list.length % 2 != 0 \n\n args = \n without_result do\n want_expression do\n kv_list.map {|i| process(i)}.join(\",\")\n end\n end\n\n str = @model.lookup_constant('::Hash') + \".\"\n if kv_list.empty?\n # empty Hash\n @model.add_method_call(m = @model.encode_method(\"new\"))\n str << \"#{m}()\" \n else\n @model.add_method_call(m = @model.encode_method(\"new_from_key_value_list\"))\n str << \"#{m}(#{@model.encode_nil},#{args})\" \n end\n\n exp.clear\n\n return str\n end",
"def do_operation(dict, key)\n\n end",
"def **(arg0)\n end",
"def **(arg0)\n end",
"def add(hash); end",
"def __get_params(data)\n \n # If named arguments used, assigns keys as symbols\n # but keeps numeric arguments as integers\n \n if @params.kind_of? Hash\n @params = @params.dup\n @keyword_params = JsonRpcObjects::Utils::Hash.remove!(@params) do |k, v|\n not JsonRpcObjects::Utils::String.numeric? k\n end\n \n @params = @params.sort_by { |i| i[0].to_i }.map { |i| i[1] }\n else\n @keyword_params = { }\n end\n \n JsonRpcObjects::Utils::Hash.keys_to_sym! @keyword_params\n \n end",
"def method_missing method, *args, &block\n if args.size > 1\n raise ArgumentError.new \"wrong number of arguments (#{args.size} for 0..1)\"\n end\n\n args.push({}) if args.size == 0\n\n call method.to_s, args[0]\n end",
"def shared(other_hash)\n end",
"def build_from_hash(attributes)\n\n end",
"def map_to_prepared_args(hash)\n prepared_args.map{|k| hash[k.to_sym]}\n end",
"def pair_params\n end",
"def method_a\n Hash.new\n end",
"def define_hash_method(methods)\n define_method(:hash) do\n self.class.hash ^ methods.map { |method| send(method).hash }.inject(:^)\n end\n end",
"def create_hash(&block); end",
"def create_hash(&block); end",
"def method_missing(method, *args, &block)\n if @hash.key?(method.to_s.to_sym)\n @hash[method.to_s.to_sym]\n else\n @hash.send(method, *args, &block)\n end\n end",
"def keys(*_arg0, &_arg1); end",
"def collect_on_hash(hash)\n @args.collect{|arg| hash[arg]}\n end",
"def transform_parameters(params)\n Smash.new.tap do |new_hash|\n (params || []).each do |key, value|\n new_hash[snakecase(key)] = value\n end\n end\n end",
"def hashParameters params\n\n\t# Create a temp array\n\tparameters = []\n\n\t# Load each element into a one dimensional array\n\tparams.each do |p|\n\t\tp.each do |x|\n\t\t\tparameters << x\n\t\tend\n\tend\n\n\t# Convert to a hash and return\n\tparameters = Hash[*parameters]\nend",
"def hvals(key); end",
"def hvals(key); end",
"def initialize hash\n @hash = hash\n end",
"def params=(_); end",
"def method_missing(meth, *args) = parameters.has_key?(meth) ? parameters[meth] : meth",
"def initialize(objects = {}) #pass in a hash \n objects.each do |key,value|\n self.send(\"#{key}=\",value)\n end\n end",
"def parameters=(_arg0); end",
"def method_missing(symbol, *args)\n @params[symbol] = args.length == 1 ? args[0] : args\n end",
"def initialize(*h)\n if h.length == 1 && h.first.kind_of?(Hash)\n h.first.each { |k, v| send(\"#{k}=\", v) if public_methods.include?(\"#{k}=\".to_sym) }\n end\n end",
"def my_hash\n{:Artists => \"Beyonce\"}\nend",
"def call(klass_hash:, value_hash:)\n return value_hash if klass_hash.empty?\n return_hash = each_param(klass_hash, value_hash) do |key|\n @__error_data[:var_sym] = key\n end\n value_hash.merge return_hash\n end",
"def hashed_key_and_args(key, *args)\n base = args.inject('') do |memo, arg|\n memo << (':' + arg.class.to_s + ':') << case arg\n when Array\n hashed_key_and_args(key, *arg)\n when Hash\n hashed_key_and_args(key, *arg.to_a)\n when NilClass, Numeric, String, Symbol\n arg.to_s\n else\n raise ArgumentError, 'can only compute digest for primitive objects'\n end\n\n Digest::SHA1::hexdigest(memo)\n end\n\n key + ':' + base\n end"
] | [
"0.7405891",
"0.7405891",
"0.7006835",
"0.69985807",
"0.6968216",
"0.69272965",
"0.6813502",
"0.675658",
"0.675658",
"0.6680257",
"0.6644106",
"0.6567214",
"0.65349287",
"0.6517277",
"0.6472143",
"0.6435197",
"0.6363558",
"0.6345563",
"0.63415986",
"0.6314929",
"0.6264529",
"0.6255269",
"0.6249623",
"0.62191874",
"0.61924744",
"0.61691123",
"0.61691123",
"0.61611295",
"0.61513656",
"0.61513656",
"0.61513656",
"0.61305153",
"0.6109344",
"0.6049107",
"0.60460776",
"0.6045807",
"0.60252655",
"0.6006548",
"0.60041094",
"0.5997121",
"0.5983245",
"0.597697",
"0.595763",
"0.5955417",
"0.59474146",
"0.5939297",
"0.5926068",
"0.59249",
"0.59221447",
"0.59155905",
"0.59088963",
"0.59076875",
"0.5905108",
"0.59032196",
"0.59032196",
"0.59032196",
"0.59032196",
"0.59032196",
"0.59032196",
"0.59032196",
"0.59032196",
"0.59032196",
"0.59032196",
"0.5892136",
"0.58871555",
"0.58672184",
"0.58619606",
"0.58528996",
"0.5850402",
"0.58490545",
"0.58320713",
"0.5803753",
"0.5803753",
"0.57993656",
"0.579871",
"0.5790529",
"0.5789802",
"0.5788153",
"0.57832986",
"0.57800406",
"0.5777595",
"0.5774912",
"0.57717407",
"0.57717407",
"0.576984",
"0.57612777",
"0.5758968",
"0.57554513",
"0.5748584",
"0.574368",
"0.574368",
"0.57426995",
"0.5731095",
"0.5730889",
"0.5724381",
"0.5724146",
"0.5722738",
"0.5722529",
"0.57205176",
"0.5720131",
"0.571969"
] | 0.0 | -1 |
Execute file using associate app | def run file_name
application = select_app file_name
system "#{application} #{file_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run file_name\n\t\tapplication = select_app file_name\n\t\tsystem \"#{application} #{file_name}\"\n\tend",
"def run file_name \n application = select_app file_name \n system \"#{application} #{file_name}\" \n end",
"def run file_name \n\t\tapplication = select_app file_name \n\t\tsystem \"#{application} #{file_name}\" \n\tend",
"def run( file_name )\n application = select_app( file_name )\n system( \"#{application} #{file_name}\" )\n end",
"def run(file_name)\n application = select_app(file_name)\n system \"#{application} #{file_name}\"\n end",
"def exec_file(file)\n exec \"#{file}\"\n end",
"def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end",
"def execute_file(full_path, args)\n if File.extname(full_path) == '.rb'\n Rex::Script::Shell.new(self, full_path).run(args)\n else\n load_resource(full_path)\n end\n end",
"def execute_script(file)\n abspath = ::File.expand_path(file,@pwd.full_path)\n execute(Rush::File.new(abspath).contents)\n end",
"def execute_file(full_path, args)\n\t\to = Rex::Script::MetaSSH.new(self, full_path)\n\t\to.run(args)\n\tend",
"def play_file(file)\n system(\"afplay #{file}\")\n end",
"def play_file(file)\n system(\"afplay #{file}\")\n end",
"def run(filename, options) end",
"def perform(filepath)\n\n end",
"def execute_app(app)\n load app\n end",
"def run file, args = nil \n handler(file).run file, args\n end",
"def exec_file(file)\n\t\t\tcurrent_dir = @variables['__DIR__' ]\n\t\t\tcurrent_file = @variables['__FILE__']\n\t\t\tcurrent_line = @variables['__LINE__']\n\n\t\t\t@parser.parse(file) do |action, args, text, file, line|\n\t\t\t\t@variables['__DIR__'] = File.absolute_path(File.dirname(file))\n\t\t\t\t@variables['__FILE__'] = file\n\t\t\t\t@variables['__LINE__'] = line\n\t\t\t\tbreak if exec_parsed_action(action, args, true, text) == :break\n\t\t\tend\n\n\t\t\t@variables['__DIR__' ] = current_dir\n\t\t\t@variables['__FILE__'] = current_file\n\t\t\t@variables['__LINE__'] = current_line\n\t\tend",
"def execute_app(app)\n $LOAD_PATH.unshift(Dir.pwd)\n Shoes.configuration.backend = :swt\n load app\n end",
"def run(file, cmd, *args)\n env = Environment.load(source: file)\n exec env, cmd, *args\n end",
"def run_rc_file(rc_file); end",
"def command_file prompt, *command\n pauseyn = command.shift\n command = command.join \" \"\n print \"[#{prompt}] Choose a file [#{$view[$cursor]}]: \"\n file = ask_hint $view[$cursor]\n #print \"#{prompt} :: Enter file shortcut: \"\n #file = ask_hint\n perror \"Command Cancelled\" unless file\n return unless file\n file = File.expand_path(file)\n if File.exists? file\n file = Shellwords.escape(file)\n pbold \"#{command} #{file} (#{pauseyn})\"\n system \"#{command} #{file}\"\n pause if pauseyn == \"y\"\n refresh\n else\n perror \"File #{file} not found\"\n end\nend",
"def exe(*args)\r\n app.exe(self, args)\r\n end",
"def run(file, line)\n system *command_for(file, line)\n end",
"def run_with_admin_privileges(file, *args)\n require 'win32ole'\n shell = WIN32OLE.new('Shell.Application')\n shell.ShellExecute('ruby', \"#{file} #{args.join(' ')}\", nil, 'runas', 1)\n end",
"def run(file, args = nil)\n handler(file).run file, args\n end",
"def command_file prompt, *command\n pauseyn = command.shift\n command = command.join \" \"\n #print \"[#{prompt}] Choose a file [#{$view[$cursor]}]: \"\n t = \"[#{prompt}] Choose a file [#{$view[$cursor]}]: \"\n file = ask_hint t, $view[$cursor]\n #print \"#{prompt} :: Enter file shortcut: \"\n #file = ask_hint\n perror \"Command Cancelled\" unless file\n return unless file\n file = File.expand_path(file)\n if File.exists? file\n file = Shellwords.escape(file)\n pbold \"#{command} #{file} (press a key)\"\n c_system \"#{command} #{file}\"\n pause if pauseyn == \"y\"\n c_refresh\n else\n perror \"File #{file} not found\"\n end\nend",
"def play_file(file)\n system(\"ogg123 #{file}\")\n end",
"def run_android(test_file = nil)\n wait_for_valid_device\n cmd = 'bundle exec ruby ./lib/run.rb android'\n cmd = %(#{cmd} \"#{test_file}\") if test_file\n bash cmd\nend",
"def exec; end",
"def exec; end",
"def exec\n path = File.join(options[:bin_path], 'response')\n `#{path} pathfile=#{options[:pathfile]} message=#{message}`\n end",
"def test_cmd_appid_run_file\n File.delete(\"app_id_status.json\") if File.exists?(\"app_id_status.json\")\n app = Mu::Command::Cmd_appid.new\n args = Array.new\n args << \"-s\"\n args << \"#{Dir.pwd}/test/data/data_cgi.msl\"\n args << \"-i\"\n args << \"b1-10000,b2\"\n args << \"-p\"\n args << \"1-100:10\"\n app.cmd_run_file args\n assert(File.exists?(\"app_id_status.json\"), \"app_id_status.json file was not created\")\n j = JSON File.read(\"app_id_status.json\")\n status = j[\"status\"]\n assert(status[\"statistics\"][\"summary\"][\"duration\"].to_f >= 10.0, \"expected summary duration > 10, but got #{status[\"statistics\"][\"summary\"][\"duration\"]}\")\n assert(status[\"statistics\"][\"summary\"][\"instances\"][\"executed\"].to_i > 10, \"expected instances executed > 0, but got #{status[\"statistics\"][\"summary\"][\"instances\"][\"executed\"]}\")\n end",
"def run\n if @options['file']\n execute_script @options['file']\n elsif @options['command']\n execute @options['command']\n else\n interactive_shell\n puts \n end\n end",
"def open\n\t \texec 'open '+@params[0]\n\t end",
"def air file\n jslib = normalize(\"lib\")\n if !File.exist?(jslib)\n begin \n puts \"Can't find #{jslib} necessary for Adobe AIR adl execution.\"\n\t\t print \"Would you like to (c)opy or (s)ymlink or (a)bort? (c/s/a): \" \n c = STDIN.gets.chomp.downcase\n end while ![\"c\", \"s\", \"a\"].include? c\n\n case c\n when \"c\" \n vendorize_with_copy\n when \"s\"\n vendorize_with_symlink\n when \"a\"\n exit\n end\n end\n system \"adl #{file}\"\n end",
"def run_android test_file=nil\n wait_for_valid_device\n cmd = 'bundle exec ruby ./appium/run.rb android'\n cmd += %Q( \"#{ test_file }\") if test_file\n bash cmd\nend",
"def eval_file; end",
"def command_file prompt, *command\n pauseyn = command.shift\n command = command.join ' '\n clear_last_line\n print \"[#{prompt}] Choose a file [#{@view[@cursor]}]: \"\n file = ask_hint @view[@cursor]\n # print \"#{prompt} :: Enter file shortcut: \"\n # file = ask_hint\n perror 'Command Cancelled' unless file\n return unless file\n\n file = expand_path(file)\n if File.exist? file\n file = Shellwords.escape(file)\n pbold \"#{command} #{file} (#{pauseyn})\"\n system \"#{command} #{file}\"\n setup_terminal\n pause if pauseyn == 'y'\n refresh\n else\n perror \"File #{file} not found\"\n end\nend",
"def run_local_story(filename, options={})\n run File.join(File.dirname(__FILE__), filename), options\nend",
"def click_run_file_dialog_popup(title)\n click_button_popup(title, \"&Run\")\nend",
"def execute(file)\n check_args!(file)\n\n resolve_uploader.upload(file)\n end",
"def run_app(command, arguments)\nend",
"def launch(app_id, args)\n runcmd 'launch', \"#{app_id} #{args}\" \n end",
"def run\r\n return puts(\"usage example: glimmer run tictactoe\") unless @name\r\n # Search for the filename (and add the .rb extension if not provided), and run it\r\n if File.exist?(\"#{@name}#{'.rb' unless @name =~ /.rb$/}\")\r\n command = \"#{JRUBY_COMMAND} \\\"#{@name.gsub(/\\\\/, '/')}#{'.rb' unless @name =~ /.rb$/}\\\"\"\r\n else\r\n # Search for all installed samples and try to run of those\r\n command = \"#{JRUBY_COMMAND} \\\"#{SAMPLES_PATH}/#{fetch_app(@name)}.rb\\\"\"\r\n end\r\n puts \"Starting the application with following command:\"\r\n puts command\r\n system command\r\n end",
"def Run222(programPath)\n file = File.open(programPath, \"w+\")\n\t\tfile.puts(\"Yes I am up!\")\n\t\tfile.close()\n end",
"def play_file(file)\n\t\tsystem(\"afplay #{file}\") #switching ogg123 to afplay\n\tend",
"def exec(application, options)\r\n\t\tmsg = \"EXEC\"\r\n\t\tif (application != nil)\r\n\t\t\tmsg = msg + \" \" + application\r\n\t\tend\r\n\t\tif (options != nil)\r\n\t\t\tmsg = msg + \" \" + options\r\n\t\tend\r\n\r\n\t\tsend(msg)\r\n\t\treturn get_result()\t\r\n\tend",
"def manage_extract_file(action)\n @extract_res.user 'root'\n @extract_res.path %w(/bin /sbin /usr/bin /usr/sbin)\n @extract_res.command tar_command\n @extract_res.creates instance_binary\n @extract_res.returns 0\n @extract_res.timeout 180\n @extract_res.run_action(action)\nend",
"def test_retrievethenmkexe\n exe = tempfile\n oexe = tempfile\n sh = %x{which sh}\n File.open(exe, \"w\") { |f| f.puts \"#!#{sh}\\necho yup\" }\n\n file = Puppet::Type.type(:file).new(\n :path => oexe,\n :source => exe,\n :mode => 0755\n )\n\n exec = Puppet::Type.type(:exec).new(\n :command => oexe,\n :require => Puppet::Resource.new(:file, oexe)\n )\n\n comp = mk_catalog(\"Testing\", file, exec)\n\n assert_events([:file_created, :executed_command], comp)\n end",
"def open_document(filename)\n case RUBY_PLATFORM\n when /darwin/\n system(\"open\", filename)\n when /linux/\n system(\"xdg-open\", filename)\n when /windows/\n system(\"cmd\", \"/c\", \"\\\"start #{filename}\\\"\")\n else\n Output.warning(:dont_know_how_to_open_resume)\n end\n end",
"def cfs_kit_launch_app(screen, app)\n\n\n if (app == \"UPDATE_TUTORIAL\")\n # An exception will report any errors \n if cfs_kit_create_tutorial_screen\n prompt (\"Successfuly created tutorial screen file #{tutorial_scr_file}\\nusing #{tutorial_def_file}\")\n end\n elsif (app == \"PROTO_APPP\")\n #TODO - Investigate generic text table editor or tutorial screen\n\t Cosmos.run_process(\"ruby lib/OskCfeFileViewer -f '/mnt/hgfs/OpenSatKit/cosmos/cfs_kit/file_server/cfe_es_syslog.dat'\")\n\t #Cosmos.run_process(\"ruby lib/OskTxtFileViewer -f '/mnt/hgfs/OpenSatKit/cosmos/test.json'\")\n #require 'osk_tbl_editor'\n #Cosmos.run_process(\"ruby lib/OskTblEditor\")\n\t #require 'cfs_fcx_cmdgen'\n #Cosmos.run_process(\"ruby lib/CfsFcxCmdGen\")\n #Cosmos.run_process(\"ruby tools/ConfigEditor\")\n #Cosmos::OskTblEditor.run\n #Cosmos.run_cosmos_tool('ConfigEditor')\n\n elsif (app == \"TUTORIAL\")\n cfs_kit_launch_tutorial_screen\n end\n\nend",
"def execute *args\n self.executable = :amxmlc\n super\n end",
"def run(path)\n if File.exist? path\n puts(path) ; system(\"ruby \" + path) \n end\nend",
"def show(path = @path) \n write(path)\n file = path + @filename + '.png'\n if windows?\n system %{cmd /c \"start #{file}\"}\n elsif mac?\n file_to_open = \"/path/to/file.txt\"\n system %{open \"#{file}\"}\n elsif linux?\n begin \n system %{xdg-open \"#{file}\"}\n system %{cmd.exe /c \"start #{file}\"}\n rescue \n system %{cmd.exe /c \"start #{file}\"}\n end\n end\n end",
"def execute\n\n\t\t#raise \"You must define 'output' for #{self}\" if self.output == nil\n\t\t#raise \"You must define 'application_descriptor'\" if self.application_descriptor == nil || !File.exists?(self.application_descriptor)\n\t\t#raise \"You must define 'keystore' for #{self}\" if self.keystore == nil\n\t\t#raise \"You must define 'keystore_name' for #{self}\" if self.keystore_name == nil\n\t\t#raise \"You must define 'storepass' for #{self}\" if self.storepass == nil\n\t\t#raise \"You must define 'include_files' for #{self}\\neg: include_files << 'bin .'\" if self.include_files.length < 1\n\n\t\t# TODO: Somehow confirm that the initialWindow content is included in the build\n\t\t#app_xml = Nokogiri::XML(File.read(application_descriptor))\n\t\t#swf = app_xml.at_css(\"initialWindow > content\").content.to_s\n\t\t#swf = File.join(@output_dir, swf)\n\t\t#puts swf\n\n\t\tcommand = \"#{FlexSDK::adt}\"\n\t\tcommand << \" -package\"\n\t\tcommand << \" -tsa #{self.tsa}\" if self.tsa != nil\n\t\tcommand << \" -storetype #{self.storetype}\"\n\t\tcommand << \" -keystore #{self.keystore}\"\n\t\tcommand << \" -storepass #{self.storepass}\"\n\t\tcommand << \" -target #{target}\" if target != nil && target != \"air\"\n\t\tcommand << \" #{additional_args}\" if self.additional_args != nil\n\t\tcommand << \" #{self.output}\"\n\t\tcommand << \" #{self.application_descriptor}\"\n\t\tself.include_files.each {|entry| command << \" -C #{entry}\" }\n\t\t\n\t\tstatus = run command, false\n\n\t\tif status.exitstatus != 0\n\t\t\tcase status.exitstatus\n\t\t\twhen 2\n\t\t\t\traise \"Usage error\\n\" + \n\t\t\t\t\t \"Check the command line arguments for errors\"\n\t\t\twhen 5\n\t\t\t\traise \"Unknown error\\n\" +\n\t\t\t\t\t \"This error indicates a situation that cannot be explained by common error conditions.\\n\" +\n\t\t\t\t\t \"Possible root causes include incompatibility between ADT and the Java Runtime Environment,\\n\" +\n\t\t\t\t\t \"corrupt ADT or JRE installations, and programming errors within ADT.\"\n\t\t\twhen 6\n\t\t\t\traise \"Could not write to output directory\\n\" +\n\t\t\t\t\t \"Make sure that the specified (or implied) output directory is accessible and\\n\" +\n\t\t\t\t\t \"that the containing drive has sufficient disk space.\"\n\t\t\twhen 7\n\t\t\t\traise \"Could not access certificate\\n\" +\n\t\t\t\t\t \"Make sure that the path to the keystore is specified correctly: #{self.keystore}\\n\" +\n\t\t\t\t\t \"Make sure that the keystore password is correct: #{self.storepass}\"\n\t\t\t\t\t #\"Check that the certificate within the keystore can be accessed.\"\n\t\t\twhen 8\n\t\t\t\traise \"Invalid certificate\\n\" +\n\t\t\t\t\t \"The certificate file is malformed, modified, expired, or revoked.\"\n\t\t\twhen 9\n\t\t\t\traise \"Could not sign AIR file\\n\" +\n\t\t\t\t\t \"Verify the signing options passed to ADT.\"\n\t\t\twhen 10\n\t\t\t\traise \"Could not create time stamp\\n\" +\n\t\t\t\t\t \"ADT could not establish a connection to the timestamp server.\\n\" + \n\t\t\t\t\t \"If you connect to the internet through a proxy server, you may need to configure\\n\" + \n\t\t\t\t\t \"the JRE proxy settings. There have also been errors reported with Java 7: \\n\" +\n\t\t\t\t\t \"http://www.flashdevelop.org/community/viewtopic.php?p=41221\\n\" + \n\t\t\t\t\t \"You can disable checking a timestamp server by setting 'tsa' to 'none' in your task\"\n\t\t\twhen 11\n\t\t\t\traise \"Certificate creation error\\n\" +\n\t\t\t\t\t \"Verify the command line arguments used for creating signatures.\"\n\t\t\twhen 12\n\t\t\t\traise \"Invalid input\\n\" +\n\t\t\t\t\t \"Verify file paths and other arguments passed to ADT on the command line.\\n\" +\n\t\t\t\t\t \"Be sure the initial content in #{self.application_descriptor} is included in the build by\\n\" +\n\t\t\t\t\t \"appnding it to includ_files (eg, adt.include_files << 'bin .')\"\n\t\t\t\t\t #\"<initialWindow>\\n <content>#{swf}</content>\\n</initialWindow>\"\n\t\t\telse\n\t\t\t\traise \"Operation exited with status #{status.exitstatus}\"\n\t\t\tend\n\t\tend\n\tend",
"def exec_local(filename1, filename2 = nil)\n @command = [ @program, filename1, (filename2 or @database), *@option ]\n @output = nil\n @log = nil\n @report = nil\n Open3.popen3(*@command) do |din, dout, derr|\n din.close\n derr.sync = true\n t = Thread.start { @log = derr.read }\n begin\n @output = dout.read\n @report = Bio::Sim4::Report.new(@output)\n ensure\n t.join\n end\n end\n @report\n end",
"def launch_app\n @bridge.launch_app\n end",
"def run_from_file_command(command)\n if logger.debug?\n debug(\"Creating exec script for #{instance_name} (#{exec_script_file})\")\n debug(\"Executing #{exec_script_file}\")\n end\n File.open(exec_script_file, \"wb\") { |file| file.write(command) }\n %{powershell -file \"#{exec_script_file}\"}\n end",
"def exec_script_on(script_path_str,arguments_str,current_path_str)\n fname_str = File.basename(script_path_str)\n rempte_path_str = \"/tmp/\" + fname_str\n push_a_file(script_path_str,rempte_path_str)\n exec_on!(\"sh #{rempte_path_str} \" + arguments_str,current_path_str)\n end",
"def get_file_executable(dir_run_programs, opts = {})\n BawWorkers::Validation.check_custom_hash(opts, BawWorkers::Jobs::Analysis::Payload::OPTS_FIELDS)\n\n file_executable_relative = opts[:file_executable]\n BawWorkers::Validation.normalise_path(file_executable_relative, dir_run_programs)\n end",
"def app_mgmt_launch_app(screen, app)\r\n\r\n if (app == \"Eclipse\")\r\n\t\tspawn(\"sudo #{Cosmos::USERPATH}/../eclipse/eclipse/eclipse\")\r\n elsif (app == \"AppGen\")\r\n\t\tspawn(\"java -jar #{CFS_KIT_GEN_APP_DIR}/CreateApp.jar\")\r\n elsif (app == \"APP_SUMMARY\")\r\n display(\"CFS_KIT APP_SUMMARY_SCREEN\",50,50)\r\n else\r\n prompt(\"Error in screen definition file. Undefined commmand sent to app_mgmt_launch_app()\")\r\n end\r\n\r\nend",
"def file(filename) File.read(File.absolute_path(filename, File.dirname($PROGRAM_NAME))) end",
"def open_file_in_editor(index)\n # get the selected filename\n filename=@filtered_files[index]\n\n # launch the vim executable\n task=NSTask.new\n task.setLaunchPath(MAC_VIM_EXECUTABLE)\n task.setArguments(['-g','--remote-tab-silent',filename])\n task.launch\n\n # that's it for ourself, let's go home.\n NSApp.stop(self)\n true\n end",
"def action(type)\n ENV[\"runner_path\"] = $runner_path\n\n dirname = File.dirname(File.expand_path(__FILE__))\n script = File.join(dirname, \"action.py\")\n\n puts \"Calling python script: #{script} #{type}\"\n exec(\"python\", script, type, *$items)\nend",
"def run(argv = [])\n @opts.parse!(argv)\n\n path = argv.delete_at(0)\n proto = __DIR__('../../proto')\n\n abort 'You need to specify a name for your application' if path.nil?\n\n if File.directory?(path) and @options[:force] === false\n abort 'The specified application already exists, use -f to overwrite it'\n end\n\n if File.directory?(path) and @options[:force] === true\n FileUtils.rm_rf(path)\n end\n\n begin\n FileUtils.cp_r(proto, path)\n puts \"The application has been generated and saved in #{path}\"\n rescue\n abort 'The application could not be generated'\n end\n end",
"def execute\n warn 'executing fpm app spec task, but there are no input files [fpm_app_spec::task#execute]' if\n @opts.get(:files).empty?\n\n fpm_package @opts.get(:out), @opts.get(:files)\n end",
"def execute\n run_command current_or_selected_files\nend",
"def open_output_file(output_file)\n puts \"\\n************************************\"\n puts ' >>> Only will work on mac <<<'\n puts 'NOW attempting to open created file in Word.'\n cmd = \"open #{output_file}\"\n puts \" will run '#{cmd}'\"\n puts '************************************'\n\n system cmd\n end",
"def executable_path=(_arg0); end",
"def rhino file\n system \"java -jar #{rhino_jar} -opt -1 #{file}\"\n end",
"def file(*args, &block)\n Rake::FileTask.define_task(*args, &block)\n end",
"def launch (raw_exp, workitem)\n\n onotify(:launch, raw_exp.fei, workitem)\n\n apply(raw_exp, workitem)\n end",
"def usage\n puts \"Usage: akaza exec|wsrb|exec_wsrb FILE_NAME\"\nend",
"def run\n if @files.empty?\n @commander.Process(STDIN)\n else\n @files.each do |filename|\n File.open(filename) { |f| @commander.Process(f) }\n end \n end\n end",
"def launch(app_name, *options)\n options = combine_options(*options)\n \n compatible_call :launch, app_name, options\n end",
"def run\n src = ARGF.read\n exit 2 unless src\n\n interpreter = Expectr::Interpreter.new(src.untaint)\n interpreter.filename = $FILENAME\n interpreter.run\n end",
"def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end",
"def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end",
"def execute(uploader)\n cmd = []\n cmd << \"-debug\" if !Vagrant.log_level.nil?\n cmd << \"-vcs\" if config.vcs\n cmd += config.includes.map { |v| [\"-include\", v] }\n cmd += config.excludes.map { |v| [\"-exclude\", v] }\n cmd += metadata.map { |k,v| [\"-metadata\", \"#{k}=#{v}\"] }\n cmd += [\"-address\", config.address] if config.address\n cmd += [\"-token\", config.token] if config.token\n cmd << config.app\n cmd << File.expand_path(config.dir, env.root_path)\n Vagrant::Util::SafeExec.exec(uploader, *cmd.flatten)\n end",
"def execute_script(file_name, conn, keys, argv)\n conn.evalsha(\n script_sha(conn, file_name),\n keys,\n argv,\n )\n end",
"def run_script(file, out = STDOUT)\n raise NotImplementedException.new \"Debugger.run_script not implemented\"\n end",
"def eval_file(file)\n file = File.join(__dir__, file)\n eval(File.read(file), nil, file) # rubocop:disable Security/Eval\nend",
"def visit(file)\n @path ||= 'Safari.app'\n `open #{file} -a #{@path} -g`\n end",
"def mobi_command(filename, options={})\n silent = options[:silent] || Softcover.test?\n cmd = \"#{calibre} ebooks/#{filename}.epub ebooks/#{filename}.mobi\" +\n \" #{calibre_options}\"\n puts cmd unless (options[:quiet] || silent)\n cmd\n end",
"def command_exec(name, *args)\n shell_exec command_for(name, *args)\n end",
"def xdg_open(file_name)\n pid = spawn(\"xdg-open '#{file_name}'\")\n\n Process.wait pid\n\n if $CHILD_STATUS.exitstatus > 0\n warn \"Error when running xdg-open #{file_name}. Exiting...\"\n nil\n end\nend",
"def run_script(file, out = handler.interface, verbose=false)\n interface = ScriptInterface.new(File.expand_path(file), out)\n processor = ControlCommandProcessor.new(interface)\n processor.process_commands(verbose)\n end",
"def run_script(file, out = handler.interface, verbose=false)\n interface = ScriptInterface.new(File.expand_path(file), out)\n processor = ControlCommandProcessor.new(interface)\n processor.process_commands(verbose)\n end",
"def run_script(file, out = handler.interface, verbose=false)\n interface = ScriptInterface.new(File.expand_path(file), out)\n processor = ControlCommandProcessor.new(interface)\n processor.process_commands(verbose)\n end",
"def test_exec()\n\t\ttempfile = Tempfile.new('sampleexec', './')\n\t\twrite_sampleexec(tempfile)\n\t\ttempfile.close(false)\n\t\tFileUtils.chmod(0700, tempfile.path)\n\n\t\t# test via direct call\n\t\toutput = Cfruby::Exec::exec(tempfile.path)\n\t\tassert_equal(output.length, 2)\n\t\tassert_equal(10, output[0].length, \"expected 10 lines of stdout\")\n\t\tassert_equal(10, output[1].length, \"expected 10 lines of stderr\")\n\n\t\t# test via the String exec() helper method\n\t\ttempfile.path.exec\n\t\tassert_equal(output.length, 2)\n\t\tassert_equal(10, output[0].length, \"expected 10 lines of stdout\")\n\t\tassert_equal(10, output[1].length, \"expected 10 lines of stderr\")\t\t\n\tend",
"def execute(args)\n raise BadUsageError.new(self) unless (args.length == 1) \n\n puts \"Adding [#{args.first}] to Railcar...\"\n if RCApplicationManager.new.add(args.first)\n puts \"Done!\"\n else\n puts\n puts \"That path (#{args.first}) doesn't appear to exist or be a Rails application.\"\n puts \"Make sure you've got the path right!\"\n puts\n end\n end",
"def open_files *o\n activate\n end",
"def do_a_thing\n puts \"We are doing a thing!!!!!!!!!!!!!!!! #{file_name}\"\n end",
"def select_app( file_name )\n ftype = file_type( file_name )\n @app_map[ ftype ]\n end",
"def app_script_text(bin_file_name)\n <<-TEXT\n#\n# This file was generated by RubyGems.\n#\n# The application '#{@spec.name}' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire 'rubygems'\n\nversion = \"#{Gem::Requirement.default}\"\n\nif ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then\n version = $1\n ARGV.shift\nend\n\ngem '#{@spec.name}', version\nload Gem.bin_path('#{@spec.name}', '#{bin_file_name}', version)\nTEXT\n end",
"def launch_exe\n @game_info['launch_exe']\n end",
"def file(*args, &block)\n Rake::FileTask.define_task(*args, &block)\nend",
"def execute(args)\n # Analyze arguments\n remaining_args = @options.parse(args)\n if @display_help\n puts @options\n elsif (remaining_args.size > 2)\n puts 'Please specify just 1 file to be loaded on startup.'\n puts @options\n else\n activate_log_debug(true) if @debug\n log_info 'Loading GUI libraries...'\n require 'gtk2'\n Gdk::Threads.init\n require 'ruby-serial'\n require 'filesrebuilder/Model/Data'\n require 'filesrebuilder/GUIFactory'\n require 'filesrebuilder/GUIcontroller'\n require 'filesrebuilder/_Gtk/_object'\n require 'rUtilAnts/Platform'\n RUtilAnts::Platform::install_platform_on_object\n gui_factory = GUIFactory.new\n gui_controller = GUIController.new(gui_factory)\n gui_factory.gui_controller = gui_controller\n Gtk::Settings.default.gtk_button_images = true\n log_info 'Executing application...'\n main_widget = gui_factory.new_widget('Main')\n gui_controller.set_main_widget(main_widget)\n main_widget.show\n gui_controller.run_callback_dirline_progress_bars\n gui_controller.load_from_file(remaining_args[0]) if (remaining_args.size == 1)\n Gtk.main\n log_info 'Quitting application...'\n end\n end",
"def run_installer_command(cmd)\n `#{cmd}`\n end"
] | [
"0.7812446",
"0.77878755",
"0.77824914",
"0.76077783",
"0.74816865",
"0.70978063",
"0.6927364",
"0.6513946",
"0.62575394",
"0.62202096",
"0.6184521",
"0.6184521",
"0.6108953",
"0.6071891",
"0.6021347",
"0.59654903",
"0.5828118",
"0.5815852",
"0.57904077",
"0.57484615",
"0.5744515",
"0.5715454",
"0.5700581",
"0.5698364",
"0.5686541",
"0.5677321",
"0.56538755",
"0.564219",
"0.5627121",
"0.5627121",
"0.5619936",
"0.56073314",
"0.5577242",
"0.5576803",
"0.5559778",
"0.5538997",
"0.55349237",
"0.5531627",
"0.55238855",
"0.55105305",
"0.5504008",
"0.54971623",
"0.54773575",
"0.54638034",
"0.5456404",
"0.5442648",
"0.54420674",
"0.5433453",
"0.54318047",
"0.54211706",
"0.5417436",
"0.5368453",
"0.53681284",
"0.5361044",
"0.53551275",
"0.53533",
"0.53524977",
"0.5352263",
"0.53522515",
"0.5341754",
"0.53369397",
"0.5329761",
"0.53219205",
"0.5310918",
"0.5295467",
"0.5292",
"0.528757",
"0.5276769",
"0.52703357",
"0.5253276",
"0.52525073",
"0.52508974",
"0.5248884",
"0.5241554",
"0.52401483",
"0.5231402",
"0.52296185",
"0.52296185",
"0.52249837",
"0.52211714",
"0.5203774",
"0.5201841",
"0.5200341",
"0.5194689",
"0.51937675",
"0.51884526",
"0.51766217",
"0.51766217",
"0.51766217",
"0.5176131",
"0.51707214",
"0.51658154",
"0.5161874",
"0.51580554",
"0.51564765",
"0.51550794",
"0.51541775",
"0.51462615",
"0.5144186"
] | 0.77640027 | 4 |
Given file, look up matching application | def select_app file_name
ftype = file_type( file_name ).downcase
@app_map[ ftype ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_app file_name \n ftype = file_type( file_name ).downcase\n @app_map[ ftype ]\n end",
"def select_app( file_name )\n ftype = file_type( file_name )\n @app_map[ ftype ]\n end",
"def select_app file_name \n\t\tftype = file_type( file_name ).downcase\n\t\t@app_map[ ftype ]\n\tend",
"def select_app(file_name)\n ftype = file_type(file_name)\n @app_map[ ftype ]\n end",
"def select_app file_name\n ftype = file_type file_name\n @app_map[ftype]\n end",
"def find snippet\n apps.select do |app|\n app.filename.include? snippet\n end\n end",
"def locate_app_file\n app_const = app_constant\n\n candidates = []\n candidates << app_const.app_file if app_const.respond_to?(:app_file)\n candidates << Padrino.first_caller if File.identical?(Padrino.first_caller.to_s, Padrino.called_from.to_s)\n candidates << Padrino.mounted_root(name.downcase, \"app.rb\")\n simple_name = name.split(\"::\").last.downcase\n mod_name = name.split(\"::\")[0..-2].join(\"::\")\n Padrino.modules.each do |mod|\n if mod.name == mod_name\n candidates << mod.root(simple_name, \"app.rb\")\n end\n end\n candidates << Padrino.root(\"app\", \"app.rb\")\n candidates.find { |candidate| File.exist?(candidate) }\n end",
"def file_match(file)\n end",
"def find_apf( path_and_file = self.file_name_and_contents.path_and_file)\n match_apf = []\n regexp = /^t([^ \\#]+)( *$| )/\n File_name_and_contents.new( path_and_file ).contents.each do |line|\n if line.match(regexp) != nil\n if line.match(regexp)[1] != nil \n match_apf << ( self.file_name_and_contents.path_and_file.sub(/\\/.+/, '') + '/' + line.match(regexp)[1].chomp + '.apf' ) \n end\n end\n end\n match_apf\n end",
"def detect(dir = Dir.pwd)\n candidates = @registry.find_all do |pack|\n pack.applicable? dir\n end\n\n raise NotFound if candidates.empty?\n raise AmbiguousApp if candidates.length > 1\n\n candidates.first\n end",
"def get_app_name(app_name)\n app_file = $pkg_dir+\"/\"+app_name.downcase.gsub(/ |-/,'_')+\".rb\"\n if File.exist?(app_file)\n app_name = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_app_name()\")\n else\n app_list = Dir.entries($pkg_dir)\n tmp_name = app_list.grep(/^#{app_name.downcase.gsub(/ |-/,'_')}/)[0]\n if tmp_name\n tmp_name = tmp_name.gsub(/\\.rb/,\"\")\n else\n puts\n end\n if tmp_name =~ /[A-z]/\n if $verbose == 1\n puts \"Application profile \"+app_name+\" not found\"\n puts \"Found profile \"+tmp_name\n end\n app_name = eval(\"get_#{tmp_name.downcase.gsub(/ |-/,'_')}_app_name()\")\n else\n puts \"Application \"+app_name+\" not found\"\n puts\n puts \"Available Applications:\"\n puts\n print_avail_pkgs()\n puts\n exit\n end\n end\n return app_name\nend",
"def read_market_app_regexes(path_to_file)\n market_app_regexes = {}\n File.open(path_to_file).readlines.each do |line|\n line.strip!\n unless line.start_with? '#' or line.empty?\n splitted = line.split(':')\n next unless splitted.size == 2\n market = splitted[0]\n app = splitted[1]\n market_app_regexes[market] = Set.new if market_app_regexes[market].nil?\n market_app_regexes[market].add app\n end\n end\n market_app_regexes\n end",
"def search\n Dir.glob(@config.target_file_pattern, File::FNM_CASEFOLD).each do |file_path|\n next if FileTest.directory?(file_path)\n\n extension = get_extension(file_path)\n tokens = get_tokens(file_path, extension)\n search_romaji(extension, tokens, file_path)\n end\n\n nil\n end",
"def run file_name \n application = select_app file_name \n system \"#{application} #{file_name}\" \n end",
"def file_match(file)\n {:filename => file, :matched => file, :line => 1, :column => 1}\n end",
"def for(file)\n matching = @conversion.select { |m, _o| m.matches? file }\n\n return '' if matching.empty?\n\n matching.max_by { |(pathname_matcher, _oa)| pathname_matcher }[1]\n end",
"def find_match_index (fileArray, match_string)\n fileArray.each_index {|index|\n if fileArray[index].include?(match_string)\n return index # no error checking, SO MAKE SURE THE MATCH EXISTS IN YOUR FILE\n end}\nend",
"def find_application\n unless self.app_name.blank?\n my_apps = []\n # in the case of an array, the new finder will not work\n Array(self.app_name).each do |individual_name|\n new_apps = App.active.by_short_or_long_name(individual_name)\n logger.info \"new_apps\" + new_apps.inspect\n my_apps += new_apps unless new_apps.blank?\n logger.info \"my_apps\" + my_apps.inspect\n end\n unless my_apps.blank? || my_apps.length != Array(self.app_name).length\n self.apps << my_apps - self.apps\n else\n self.application_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\n end",
"def find_requirable_file(file)\n root = full_gem_path\n\n require_paths.each do |lib|\n base = \"#{root}/#{lib}/#{file}\"\n Gem.suffixes.each do |suf|\n path = \"#{base}#{suf}\"\n return path if File.file? path\n end\n end\n\n return nil\n end",
"def file_match(file)\n raise ArgumentError, \"Filename cannot be nil\" if file.nil?\n {:filename => file, :matched => file, :line => 1, :column => 1}\n end",
"def match\n [version, file] if file && version\n end",
"def run file_name \n\t\tapplication = select_app file_name \n\t\tsystem \"#{application} #{file_name}\" \n\tend",
"def resolve_app(application, sdfile=nil, params={})\n return @vespa.resolve_app(application, sdfile, params)\n end",
"def matches(ext); end",
"def matches(_ext); end",
"def matches(_ext); end",
"def find_config(file); end",
"def mounted_apps_of(file)\n Padrino.mounted_apps.select { |app| File.identical?(file, app.app_file) }\n end",
"def run file_name\n application = select_app file_name\n system \"#{application} #{file_name}\"\n end",
"def run file_name\n application = select_app file_name\n system \"#{application} #{file_name}\"\n end",
"def find_app(what, item, app)\n id = get_id(what, item)\n the_app = get_app(what, app, id)\n raise \"#{what} #{item['text']} app #{app} not found\" unless the_app\n the_app\n end",
"def find_application_name(val_installpath)\n index_file = ['index.html','index.htm','index.php','index.jsp','index.asp']\n path = val_installpath + \"\\\\webapps\"\n if not directory?(path + \"\\\\ROOT\")\n print_error(\"\\t\\t! expected directory wasnt found\")\n return \"Unknown\"\n end\n\n index_file.each do |i|\n if not exist?(\"#{path}\\\\ROOT\\\\#{i}\")\n next\n end\n data = read_file(path + \"\\\\ROOT\\\\#{i}\")\n if data =~ /(?i)<title>([^<]+)<\\/title>/\n return $1\n else\n #look for redirect as name\n if data =~ /(?i)onload=\\\"?document\\.location\\=['\"]?([\\/\\w\\d]+)['\"]?\\\"?/\n return $1.gsub(\"/\",\"\")\n end\n end\n end\n return \"Unknown\"\n rescue\n print_error(\"\\t\\t! could not identify application name\")\n return \"Unknown\"\n end",
"def lookup(app_name)\n unless @metadata.key?(app_name)\n data = YAML.load_file(\"./data/applications/#{app_name}.yaml\")\n @metadata[app_name] = data['cots::app_metadata']\n end\n @metadata[app_name]\n end",
"def match_against filename\n @regexp.match(filename)\n end",
"def search_file(pattern, file)\n node = ast_from_file(file)\n search node, pattern\n end",
"def match(source_filename)\n matched = elements.detect do |element|\n if element.kind_of?(::Hash)\n element.each do |key, value|\n return value if source_filename_match?(source_filename, key)\n\n return key if source_filename_match?(source_filename, value)\n end\n false\n else\n source_filename_match? source_filename, element\n end\n end\n\n matched.kind_of?(::String) ? Inflection.to_constant_name(matched) : matched\n end",
"def run file_name\n\t\tapplication = select_app file_name\n\t\tsystem \"#{application} #{file_name}\"\n\tend",
"def GetPlatformOfFile ( fl )\n platforms = { \"a1\" => \"AQUA-1\", \"t1\" => \"TERRA-1\", \"npp\" => \"NPP\"}\n \n x = File.basename(fl).split(\".\").first\n puts x\n return platforms[x] if ( platforms[x])\n return \"unknown\"\nend",
"def get_app_url(app_name)\n app_file = $pkg_dir+\"/\"+app_name.downcase+\".rb\"\n if File.exist?(app_file)\n app_url = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_app_url()\")\n else\n puts \"Application \"+app_name+\" not found\"\n end\n return app_url\nend",
"def find_matching_file_set(hash_key_for_file)\n filename = Array(params[hash_key_for_curation_concern][hash_key_for_file]).first.original_filename\n curation_concern.file_sets.select {|fs| fs.label == filename }.first\n end",
"def find_file(file)\n file_name = File.basename(file)\n # Firstly we'll drop obvious mismatches where basename of file differs\n candidates = @build_files.select { |path| File.basename(path) == file_name }\n # In case when got ambiguous files return all try to find closest match\n files = find_closest_files(file, candidates)\n\n # If has only option return first\n return files.first if files.size == 1\n # Return original file if files empty\n return file if files.empty?\n\n files # Return all files if many matched\n end",
"def get_app(what, app, id)\n apps = all(case what.keys[0]\n when :study\n %Q{div.app a[href*=\"/?study_id=#{id}\"]}\n when :study_group\n %Q{div.app a[href*=\"/?studygroup_id=#{id}\"]}\n when :site\n raise \"don't know how to search for site apps\"\n when :team\n raise \"don't know how to search for team apps\"\n else\n nil\n end)\n apps.detect { |a| a['text'] == app }\n end",
"def lookup(pattern = {})\n contacts = []\n create_source_files(pattern).each do |source_file|\n\n next unless File.exist? source_file\n\n source = File.read(source_file)\n\n next if source.empty?\n\n values = {}\n\n REGEX.each do |key, regex|\n value = source.scan(regex)[0]\n values[key] = value if value\n end\n\n contacts << values\n end\n\n contacts.keep_if do |contact|\n pattern.each.reduce(true) do |match, pattern| \n contact_does_not_have_key = contact[pattern[0]].nil?\n regex = Regexp.new(pattern[1].strip.downcase)\n pos = regex =~ contact[pattern[0]].strip.downcase unless contact_does_not_have_key\n match and (not pos.nil? or contact_does_not_have_key)\n end\n end\n end",
"def all_apf_finder( path_and_file = self.file_name_and_contents.path_and_file, all_apf_arr = [] )\n apf_files = find_apf( path_and_file )\n if apf_files.count > 0\n all_apf_arr << apf_files\n apf_files.each do |apf_file|\n if File.exists? apf_file\n path_and_file = apf_file\n all_apf_finder( path_and_file, all_apf_arr )\n else\n if self.hints_hash['file_does_not_exist']\n self.hints_hash['file_does_not_exist'] << apf_file\n else\n self.hints_hash = self.hints_hash.merge( 'file_does_not_exist' => [ apf_file ] )\n end\n end\n end\n end\n all_apf_arr\n end",
"def check_apps\n flag = false\n ps_out = []\n\tif !Has_Sys_ProcTable\n\t\tIO.popen(PS_command).each do |line|\n\t\t\tps_out.push line\n\t\tend\n\telse\n\t\tProcTable.ps do |ps|\n\t\t\tps_out.push ps\n\t\tend\n\tend\n\n begin\n\t\tFile.open(Conf,'r').each do |filename|\n\t\t filename.chomp!\n\t\n\t\t\t# Skip this app if we were provided with a filepath argument, and this\n\t\t\t# app doesn't match it.\n\t\n\t next if (ARGV[1].to_s != '' and ARGV[1].to_s != filename)\n\t\t\tif Has_Sys_ProcTable\n\t\t\t\tps_out.each do |ps|\n\t\t\t\t\tflag = true if (ps.cmdline =~ /ruby\\s+#{filename}/)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tps_out.each do |line|\n\t\t\t\t\tflag = true if (line =~ /ruby\\s+#{filename}/)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n rescue Exception\n raise $!\n end\n\n if (flag)\n raise \"Iowa application(s) are already running; can not start application(s).\"\n end\nend",
"def search_builder(file_added, word)\n\t\t file_data = File.read(file_added)\n\t\t file_2data = File.read(file_added).split(\"\\n\")\n\t\t\tper = \"#{word}: can not find\"\n\n\t\t\tif file_data.downcase.include?(word.downcase)\n\n\t\t\t\tfor j in 0..file_2data.length-1\n\t\t\t\t if file_2data[j].downcase.include?(word.downcase)\n\t\t\t\t\t\tper = file_2data[j].downcase\n\n\t\t\t\t\t\tif per.include?(\":\")\n\t\t\t\t\t\t per = per.capitalize\n\n\t\t\t\t\t\telsif per.downcase.include?(\"#{word.downcase}\")\n\t\t\t\t\t\t per = \"#{word}: found\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn per\n\t\tend",
"def find_applications_by_app_name(app_name)\n pids = []\n\n begin\n x = `ps auxw | grep -v grep | awk '{print $2, $11, $12}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n _pid, name, add = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n\n app_name != name[0..(app_name.length - 1)] and not add.include?(app_name)\n end\n pids = processes.map { |p| p.split(/\\s/)[0].to_i }\n end\n rescue ::Exception\n end\n\n pids.map do |f|\n app = Application.new(self, {}, PidMem.existing(f))\n setup_app(app)\n app\n end\n end",
"def infer_manifest\n if file = root.glob('manifest{,.txt}', :casefold).first\n set :manifest, File.basename(file)\n end\n end",
"def find_r_code_from_base_name\n found_lib = Dir.glob(path_as_r_glob)\n found_lib.empty? ? nil : File.read(found_lib.first)\n end",
"def search(f_name) \r\n yield ENV['PATH'].split(';').map {|p| File.join p, f_name}.find {|p| File.file? p and File.executable? p}\r\nend",
"def find_first_match(options)\n return unless options[:in_file]\n\n open(File.join(base_dir, options[:in_file])) do |file|\n regexp = options[:matching] || Regexp.new(\"^#{options[:starting_with]}\")\n regexp.match(file.read)\n end\n end",
"def find_resource_entry(filename, opts={}, seen=nil)\n extname = File.extname(filename)\n rootname = filename.gsub(/#{extname}$/,'')\n entry_extname = entry_rootname = nil\n\n ret = entries_for(:resource, opts.merge(:hidden => :none)).reject do |entry|\n entry_extname = File.extname(entry.filename)\n entry_rootname = entry.filename.gsub(/#{entry_extname}$/,'')\n\n ext_match = (extname.nil? || extname.size == 0) || (entry_extname == extname)\n !(ext_match && (/#{rootname}$/ =~ entry_rootname))\n end\n\n ret = ret.first\n\n if ret.nil?\n seen = Set.new if seen.nil?\n seen << self\n all_required_bundles.each do |bundle|\n next if seen.include?(bundle) # avoid recursion\n ret = @bundle.find_resource_entry(filename, opts, seen)\n return ret unless ret.nil?\n end\n end\n return ret\n end",
"def find_application\n unless self.app_name.blank?\n self.app = App.active.by_short_or_long_name(self.app_name).try(:first)\n self.application_lookup_failed = self.app.blank?\n end\n # be sure the call back returns true or else the call will fail with no error message\n return true\n end",
"def search\n puts \"\\nprocurando arquivos...\\n\"\n\n paths = []\n @apks.each do |apk|\n paths << apk.path\n end\n @apks.clear\n\n paths.each do |path|\n verify(path)\n end\n\n @apks.compact!\n apk_pri\n\n puts \"\\t#{@apks.count} arquivo(s) encontrado(s).\\n\"\n end",
"def lookup_file_path\n file_path_list.each do |candidate_file_path|\n next unless File.file?(File.expand_path(candidate_file_path))\n return candidate_file_path\n end\n nil\n end",
"def item_by_file(filename)\n item = self.item.select do |it|\n it.path.match(/.*(?:\\\\|\\/|^)(.+)$/)[1] == filename\n end\n item.first if item\n end",
"def [] files\n # This stores all our matches\n match_hash = {}\n\n # Go through each file, check if the file basename matches the regexp.\n files.each do |f|\n path, file = File.split(f)\n\n if (m = match_against(file))\n replacement = populate_based_on(m)\n match_hash[f] = if path == '.'\n replacement\n else\n File.join(path, replacement)\n end\n end\n end\n match_hash\n end",
"def subpkg_containing(file)\n pkg_files.each do |pkg, spec_files|\n return pkg if spec_files.include?(file)\n end\n nil\n end",
"def find_associated(filename)\n assoc = associated_filename(filename)\n File.exists?(assoc) ? assoc : false\n end",
"def lookup_executable(args)\n executable = args[:executable]\n matches = packages_providing(\"*#{executable}\").join(\"\\n\")\n puts \"packages which provide executable:\\n#{matches}\".bold.blue\nend",
"def run\n load_the_file\n word_frequency\n match_the_word\n end",
"def find_requireable_file(file)\n root = full_gem_path\n\n require_paths.each do |lib|\n base = File.join(root, lib, file)\n Gem.suffixes.each do |suf|\n path = \"#{base}#{suf}\"\n return path if File.file? path\n end\n end\n\n return nil\n end",
"def lookup(word)\n word.gsub!(/\\s/, \"+\")\n meaning_file = initialize_files(word)[0]\n f = File.open(meaning_file)\n begin\n extract_text(f)\n rescue Exception\n raise\n end\n\n end",
"def run( file_name )\n application = select_app( file_name )\n system( \"#{application} #{file_name}\" )\n end",
"def lookup_file(resource_directory, file)\n file_path = File.join resource_directory, file\n if File.exists?(file_path)\n file_path\n end\n end",
"def translate(file)\n \n basename = File.basename(file)\n candidates = []\n test_filename = nil\n case file\n when %r:^app/controllers/:\n test_filename = file.sub('.rb', '_test.rb').sub('app/controllers', 'test/functional')\n when %r:^app/models/:\n test_filename = \"test/unit/#{basename.sub('.rb', '_test.rb')}\"\n when %r:^app/views/:\n file = file.sub('app/views/', '')\n directory = file.split('/')[0..-2].compact.join('/')\n test_filename = \"test/functional/#{directory}_controller_test.rb\"\n when %r:^test/:\n test_filename = file\n when %r:^lib/:\n # map libs to units\n test_filename = \"test/unit/#{file.sub('lib/', '').sub('.rb', '_test.rb')}\"\n when 'config/routes.rb'\n test_filename = \"test/functional/#{basename.sub('.rb', '_test.rb')}\"\n #candidates << 'controllers' << 'helpers' << 'views'\n when 'config/database.yml', 'db/schema.rb'\n #candidates << 'models'\n else\n #\n end\n if test_filename and file_verified?(test_filename)\n candidates << test_filename\n end\n if candidates == []\n puts \"=> NOTICE: could not find test file for: #{file}\" if Bolt.verbose?\n end\n # puts candidates.inspect\n candidates\n end",
"def run(file_name)\n application = select_app(file_name)\n system \"#{application} #{file_name}\"\n end",
"def translate(file)\n \n basename = File.basename(file)\n candidates = []\n test_filename = nil\n case file\n when %r:^app/controllers/:\n test_filename = file.sub('.rb', '_test.rb').sub('app/controllers', 'test/functional')\n when %r:^app/models/:\n test_filename = \"test/unit/#{basename.sub('.rb', '_test.rb')}\"\n when %r:^app/views/:\n file = file.sub('app/views/', '')\n directory = file.split('/')[0..-2].compact.join('/')\n test_filename = \"test/functional/#{directory}_controller_test.rb\"\n when %r:^test/:\n test_filename = file\n when %r:^lib/:\n # map libs to units\n test_filename = \"test/unit/#{file.sub('lib/', '').sub('.rb', '_test.rb')}\"\n when 'config/routes.rb'\n test_filename = \"test/functional/#{basename.sub('.rb', '_test.rb')}\"\n #candidates << 'controllers' << 'helpers' << 'views'\n when 'config/database.yml', 'db/schema.rb'\n #candidates << 'models'\n else\n #\n end\n if test_filename and file_verified?(test_filename)\n candidates << test_filename\n end\n if candidates == []\n puts \"=> NOTICE: could not find test file for: #{file}\"\n end\n # puts candidates.inspect\n candidates\n end",
"def process_file(file, files)\n # puts \"processing file #{file.to_s}\"\n case check_file_ext(file)\n when 'atp'\n files << file unless files.include?(file)\n when 'avc'\n files << file unless files.include?(file)\n when 'list'\n parse_list(file, files)\n end\n end",
"def find_hook_point(amanifest)\n package = amanifest.xpath(\"//manifest\").first['package']\n application = amanifest.xpath('//application')\n application_name = application.attribute(\"name\")\n if application_name\n application_str = application_name.to_s\n unless application_str == 'android.app.Application'\n return application_str\n end\n end\n activities = amanifest.xpath(\"//activity|//activity-alias\")\n for activity in activities\n activityname = activity.attribute(\"targetActivity\")\n unless activityname\n activityname = activity.attribute(\"name\")\n end\n category = activity.search('category')\n unless category\n next\n end\n for cat in category\n categoryname = cat.attribute('name')\n if (categoryname.to_s == 'android.intent.category.LAUNCHER' || categoryname.to_s == 'android.intent.action.MAIN')\n name = activityname.to_s\n if name.start_with?('.')\n name = package + name\n end\n return name\n end\n end\n end\n end",
"def test_application_as_file\n assert_pattern_match [ \"/\", \"component.vwf\", nil, nil ], \"/component.vwf\"\n assert_pattern_match [ \"/directory\", \"index.vwf\", nil, nil ], \"/directory\"\n assert_pattern_match [ \"/directory\", \"component.vwf\", nil, nil ], \"/directory/component.vwf\"\n end",
"def match_environment(fullpath)\n Dir.foreach(fullpath) do |patternfile|\n filepath = \"#{fullpath}/#{patternfile}\"\n next unless File.file?(filepath) and\n File.readable?(filepath)\n next if patternfile =~ /^\\./\n log(\"Attempting to match [#{@hostname}] in [#{filepath}]\")\n if matched_in_patternfile?(filepath,@hostname)\n @environment = patternfile.to_s\n log(\"Wrote #{patternfile} to environment instance variable\")\n end\n end\n end",
"def guess_source\n\t\t# Typically csv files come from UniteU\n\t\tif @file =~ /\\.csv$/ then return source = \"uniteu\"\n\t\t# While xml files come from RPro\n\t\telsif @file =~ /\\.xml$/ then return source = \"rpro\"\n\t\t# Otherwise toss out an error\n\t\telse\n\t\t\traise \"Error: No map exists\"\n\t\tend\n\tend",
"def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend",
"def index \n\t if params[:search] && params[:search].strip !=\"\" # search query code\n\t \t@apps = App.where(file_name: Regexp.new(\".*#{params[:search]}.*\", Regexp::IGNORECASE), user_id: current_user.id)\n\t \t\n\t else \n\n\n\t\t@apps = App.where(user_id: current_user.id).order(date_created: :desc) # index of apps in order of date created descending\n\t end \n\tend",
"def fetch_app(name)\r\n return name if SAMPLES[name].nil?\r\n \"#{name}/#{SAMPLES[name]}\"\r\n end",
"def match(image_file)\n image = load_as_gray_image(image_file)\n matches = image.match_descriptors(@images)\n if m = matches.max_by{|_, count| count}\n m[0]\n end\n end",
"def search_in_project phrase_we_have_now\n result_files_with_phrase = []\n path_to_files = File.join(DIRECTORY_PATH, '**/*.rb')\n files_to_check = []\n Dir.glob(path_to_files) do |rb_file|\n files_to_check << rb_file\n end\n raise \"files_to_check is empty !\" if files_to_check.length == 0\n #Looking for files where occurs: phrase_we_have_now\n files_to_check.each do |one_file|\n file = File.open(one_file, \"r\") do |f|\n f.each_line do |line|\n reg = /.*#{@phrase_we_have_now}.*/\n if line.match?(reg)\n result_files_with_phrase << one_file\n end\n end\n end\n end\n if result_files_with_phrase.length == 0\n puts \"\\n\\e[31m\\e[1;4mThe phrase: '#{@phrase_we_have_now}' not found in files.\\e[31m\"\n exit\n end\n result_files_with_phrase.uniq.sort\n end",
"def classname_from_file(file)\n the_process_class = File.basename(file)\n\n the_process_class['.rb'] = '' if the_process_class['.rb']\n\n if (/[A-Z]/ =~ the_process_class) != 0\n the_process_class = the_process_class.capitalize\n end\n\n match_found = the_process_class.scan(/_[a-z]/)\n if match_found\n # Ruby 1.8 : 'ab'[1] => 98 and 'ab'[1, 1] => 'b'\n # Ruby 1.9 + : 'ab'[1] => 'b' and 'ab'[1, 1] => 'b'\n match_found.each { |str| the_process_class[str] = str[1, 1].capitalize }\n end\n\n the_process_class\n end",
"def fnmatch( pattern, *args ) File.fnmatch( pattern, self, *args ) end",
"def find_apk_path\n apks = Dir['*.apk']\n fail \"wrong number of APKs in #{apk_dir}: \" \\\n \"#{apks.length} instead of 1\" \\\n unless apks.length == 1\n\n apks.first\n end",
"def matches_file?(f)\r\n @magics.any? {|m| m =~ f }\r\n end",
"def cb_local_lookup(cb_name)\n full_path = File.expand_path(\"#{$opts[:repo]}/#{cb_name}\")\n if File.exists?(\"#{full_path}/metadata.rb\")\n version = (`grep '^version' #{full_path}/metadata.rb`)\n else\n return -1\n end\n version.split(' ').last.gsub('\"','').gsub('\\'','').chomp\nend",
"def matchfile\n if search_image\n name_parts = search_image.filename.split('.')\n ext = name_parts.pop\n name = name_parts.join('.')\n return \"#{name}_match.#{ext}\"\n else\n return \"no_search_image.png\"\n end\n end",
"def find_code_insert_point (fileArray, utilHash)\n find_match_index(fileArray, utilHash[\"match_code\"])\nend",
"def lookup_specific(words)\n words = @delimiter_handler.split_path(words.first) if words.size == 1\n load_for_prefix(words)\n tool = @mutex.synchronize { get_tool_data(words, false)&.cur_definition }\n finish_definitions_in_tree(words) if tool\n tool\n end",
"def runtime_file?(file)\n RUNTIME_FILES.any? do |runtime|\n runtime.is_a?(Regexp) ? runtime.match(file) : runtime == file\n end\n end",
"def sapi_files_found(sapi, priority = '*')\n ::Dir.glob(sapi_file_path(sapi, priority)) + ::Dir.glob(sapi_file_path(sapi))\n end",
"def by_name( name )\n available.each { |addon| return addon if addon['filename'] == name }\n return nil\n end",
"def search_from_file whitelist, test_case\n tests = file_to_array test_case\n whitelist = file_to_array whitelist\n whitelist.sort!\n\n tests.each { |num| check_number(num, whitelist) }\n end",
"def search_for_file(path_suffix)\n path_suffix += \".rb\" unless path_suffix.ends_with?(\".rb\")\n\n autoload_paths.each do |root|\n path = File.join(root, path_suffix)\n return path if File.file? path\n end\n nil # Gee, I sure wish we had first_match ;-)\n end",
"def judge_file(file, whitelist, blacklist)\n file_basename = File.basename(file)\n log.debug(\"Judging file #{file_basename}\")\n file_content_array = begin\n file_rw_manager.read(file).chomp.split(\"\\n\")\n rescue => err\n log.warn(\"Failed to read #{file_basename} => #{err}\")\n []\n end\n\n check_result = CheckResult.new(file_basename)\n line_num = 0\n file_content_array.each do |content_line|\n line_num += 1\n next if content_line.nil? || line_num <= 1 # Ignore the first line (The first line is the column name) and empty line\n next if whitelist.include?(content_line)\n if blacklist.include?(content_line)\n check_result.push_to_blacklist_app_list(content_line)\n else\n check_result.push_to_unqual_app_list(content_line)\n end\n end\n\n if check_result.has_blacklist_app? || check_result.has_unqual_app?\n check_result_output_handler = CheckResultOutputHandler.new(@output_type, @output_format, @output_location)\n check_result_output_handler.output(check_result)\n end\n end",
"def matchFn(filename)\n\treturn [\".txt\", \".pdf\"].include? File.extname(filename)\nend",
"def search_prog_id(prog_id, programName, episodeId)\n begin\n @log.debug \"Trying Program ID #{prog_id}\"\n doc = download_ais(prog_id)\n streamUri = (doc/\"//streamuri\").text\n fileType = streamUri[-3..-1]\n match_programName = (doc/\"//brandtitle\").text\n match_episodeId = (doc/\"//programmenumber\").text\n @log.debug \"found program #{match_programName} and #{match_episodeId}, type #{streamUri[-3..-1]}\"\n\n return (fileType == \"mp4\" and programName == match_programName and episodeId == match_episodeId)\n rescue\n return false\n end\n\n end",
"def fnmatch(pattern, *args) File.fnmatch(pattern, @path, *args) end",
"def get_program_file_data(program_file)\n File.open(program_file,'rb'){|f| f.read}\nend",
"def search_project_paths(word)\n\t\n\t# Collect all .as and .mxml files with a filename that contains the search\n\t# term. When used outside a project this step is skipped.\n\tTextMate.each_text_file do |file|\n\t\t\n\t\tif file =~ /\\b#{word}\\w*\\.(as|mxml)$/\n\t\t\t\n\t\t\tpath = file.sub( $project, \"\" );\n\t\t\t\n\t\t\tcommon_src_dirs.each do |remove|\n\t\t\t\tpath = path.gsub( /^.*\\b#{remove}\\b\\//, '' );\n\t\t\tend\n\n\t\t\tpath = path.gsub(/\\.(as|mxml)$/,'').gsub( \"/\", \".\").sub(/^\\./,'')\n\n\t\t\tif path =~ /\\.#{word}$/\n\t\t\t\t$best_paths << path\n\t\t\telse\n\t\t\t\t$package_paths << path\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\tend\n\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend",
"def find_match(env)\n path = env['REQ_PATH']\n @serve.each do |pattern, block|\n case pattern\n when FalseClass\n when TrueClass\n return Match.new(self, path, block)\n when String\n if pattern=='*'\n return Match.new(self, path, block)\n elsif /^\\*?\\.[a-z]+$/ =~ pattern\n return Match.new(self, path, block) if File.extname(realpath(path))==pattern\n else\n return Match.new(self, path, block) if File.basename(realpath(path))==pattern\n end\n when Regexp\n if matchdata = pattern.match(path)\n return Match.new(self, path, block, *matchdata.to_a)\n end\n when Waw::Validation::Validator\n if pattern.validate(matching_file(path))\n return Match.new(self, path, block) \n end\n when StaticController::AbstractMatcher\n if pattern.matches?(env)\n return Match.new(self, path, block)\n end\n else\n raise WawError, \"Unrecognized wawaccess pattern #{pattern}\"\n end\n end\n nil\n end",
"def find_ios_apps(api_key, search_term)\n search_uri = \"https://data.42matters.com/api/v2.0/ios/apps/query.json?access_token=#{api_key}\"\n data = {\n \"query\" => {\n \"query_params\" => {\n \"from\": 0,\n \"sort\": \"score\",\n \"include_full_text_desc\": true,\n \"include_developer\": true,\n \"full_text_term\": \"#{search_term}\"\n }\n }\n }\n \n response = http_request :post , search_uri, nil, {}, data.to_json, true, 60\n\n unless response\n _log_error \"Failed to retrieve response from 42matters. Exiting!\"\n return\n end\n\n _log \"Got response! Parsing...\"\n response_json = JSON.parse(response.body)\n\n if response_json[\"results\"]\n # iterate through items and if entity name is in title or developer, consider a match\n response_json[\"results\"].each do |app|\n is_match = false\n \n if app[\"description\"] =~ /#{search_term}/i\n #_log \"Found matching app #{app}\"\n is_match = true\n elsif app[\"sellerName\"] =~ /#{search_term}/i\n is_match = true\n end\n \n if is_match\n _create_entity \"IosApp\", {\n \"title\" => app[\"description\"], \n \"name\" => app[\"trackId\"], # setting name to trackId which is the unique app id, so as to prevent multiple entities of the same\n \"id\" => app[\"trackId\"], # redundant field, but adding to \"id\" key as it may be needed in the future.\n \"bundle_id\" => app[\"bundleId\"], \n \"developer\" => app[\"sellerName\"],\n \"price\" => app[\"price\"],\n \"icon_url\" => app[\"artworkUrl60\"],\n \"rating\" => app[\"averageUserRating\"],\n \"app_url\" => app[\"trackViewUrl\"],\n \"email\" => app[\"email\"],\n \"minimum_os_version\" => app[\"minimumOsVersion\"],\n \"permissions\" => app[\"permissions\"],\n \"version\" => app[\"version\"],\n \"size_in_bytes\" => app[\"fileSizeBytes\"],\n \"developer_url\" => app[\"sellerUrl\"],\n \"supported_devices\" => app[\"supportedDevices\"],\n \"support_url\" => app[\"supportUrl\"],\n \"current_release_date\" => app[\"currentVersionReleaseDate\"],\n \"first_release_date\" => app[\"releaseDate\"]\n }\n end\n end\n else\n _log \"No apps found for search term. Exiting.\"\n return\n end\n end",
"def in_file(filename); end"
] | [
"0.7087219",
"0.7029745",
"0.6963543",
"0.693891",
"0.69037956",
"0.66919976",
"0.6542444",
"0.6382299",
"0.6157495",
"0.60503167",
"0.601646",
"0.5859156",
"0.5818461",
"0.57572633",
"0.57046884",
"0.5678892",
"0.56743115",
"0.5649614",
"0.5636007",
"0.5610509",
"0.56057966",
"0.5604949",
"0.55801606",
"0.5576402",
"0.55714047",
"0.55714047",
"0.55608517",
"0.5553873",
"0.55489534",
"0.55489534",
"0.5531824",
"0.55252475",
"0.5518236",
"0.5515044",
"0.5514842",
"0.5506561",
"0.5503322",
"0.5493073",
"0.54928756",
"0.5486454",
"0.54683304",
"0.5468002",
"0.54430234",
"0.5416634",
"0.5408694",
"0.5391602",
"0.5370375",
"0.5370097",
"0.53359294",
"0.5314237",
"0.53092825",
"0.53067344",
"0.52846014",
"0.5252555",
"0.524484",
"0.52376133",
"0.52250475",
"0.5209949",
"0.5203413",
"0.5197249",
"0.51763576",
"0.5170929",
"0.51672935",
"0.5159094",
"0.5154426",
"0.5138118",
"0.5137994",
"0.5133115",
"0.512817",
"0.5121482",
"0.5119422",
"0.5105721",
"0.5098841",
"0.5094426",
"0.5088999",
"0.50795996",
"0.5078399",
"0.5074296",
"0.5073209",
"0.5071679",
"0.5066702",
"0.50660706",
"0.5049214",
"0.50464076",
"0.5045764",
"0.50445664",
"0.5042937",
"0.5041482",
"0.5035523",
"0.5028753",
"0.5027289",
"0.50263613",
"0.5026064",
"0.5023429",
"0.50222754",
"0.50218517",
"0.5021744",
"0.5016143",
"0.5016117",
"0.5014751"
] | 0.7122727 | 0 |
Initialize class, and set default strategy to :user | def initialize
super
@strategy = :user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(strategy)\n @strategy = strategy\n end",
"def configure_user_search_strategy(strategy)\n @user_search_strategy =\n case strategy.to_s\n when \"default\"\n GitHub::Ldap::UserSearch::Default.new(self)\n when \"global_catalog\"\n GitHub::Ldap::UserSearch::ActiveDirectory.new(self)\n else\n GitHub::Ldap::UserSearch::Default.new(self)\n end\n end",
"def initialize\n @connection = nil\n @user_class = 'User'\n end",
"def initialize user\n @user = user\n end",
"def initialize(user=current_user)\n @user = user\n @authed = true\n end",
"def init_by_user(user)\n return self unless user\n self.user = user\n self.name = user.name\n self.email = user.email\n self\n end",
"def initialize(user:)\n @user = user\n end",
"def initialize(user)\n @user = user\n end",
"def initialize(user)\n @user = user\n end",
"def initialize(user)\n @user = user\n end",
"def initialize(user)\n @user = user\n end",
"def initialize(user)\n @user = user\n end",
"def initialize(user)\n @user = user\n end",
"def initialize\n @user = UserUtility.new\n end",
"def set_default!\n @@default_user = self\n end",
"def initialize(bot:, user:)\n super\n @settings = user.student_settings\n end",
"def user_init; end",
"def initialize(user, data)\n\t\t\tsuper(user)\n\t\t\tinit(data)\n\t\tend",
"def initialize(user)\n user ||= User.new\n\n if user.new_record?\n not_signed_in\n else\n signed_in(user)\n common_abilities_for_admins(user) if user.roles.any? || user.is_admin?\n end\n end",
"def strategy=(strategy)\n case strategy\n when :user, :search\n @strategy = strategy\n end\n end",
"def for_user(user)\n self.class.new(@config, user)\n end",
"def initialize_vars\n \n @auth_user_class = Auth.configuration.user_class.constantize\n\n @auth_user_params = permitted_params.fetch(:user,{}) \n\n @auth_user = params[:id] ? @auth_user_class.find_self(params[:id],current_signed_in_resource) : @auth_user_class.new(@auth_user_params)\n \n end",
"def set_default_user(user)\n @_default_user = user\n end",
"def initialize(user, type = :all)\n @user = user\n @type = type\n end",
"def initialize_advertiser_user\n self.user_type = TYPE_ADVERTISER\n self.update_user_code\n self.status = STATUS_ACTIVE\n end",
"def initialize(user, model)\n @user = user\n @model = model\n end",
"def initialize(user)\n raise(Utility::Errors::NotFound, \"UserProfile Requires a instance from the Users model.\") unless user\n\n @user_object = user\n @last_access = Time.zone.now\n\n [:@id, :@person_authentication_key, :@assigned_roles,\n :@name, :@user_options, :@assigned_groups, :@username,\n :@email, :@roles].each do |k|\n instance_variable_set(k, nil)\n instance_variable_set(k, user.send(k.to_s[1..-1].to_sym) )\n end\n\n @user_options ||= []\n setup_combined_user_roles()\n end",
"def initialize(current_user = nil)\n @current_user = current_user\n end",
"def set_default_role\n self.role ||= Role.find_by_name('user')\n end",
"def initialize(context:)\n @user = JSONAPI::Authorization.configuration.user_context(context)\n end",
"def set_user; end",
"def use( klass, opts={} )\n behavior_options[SystemUser] ||= Hash.new\n behavior_options[SystemUser][klass] = opts\n end",
"def initialize(user, attributes={})\n super(attributes)\n self.user_record = user\n end",
"def initialize_auth\n @conf[:use_user_pool_cache] = false\n end",
"def initialize(user)\n if user\n # This ability allows admins impersonating other users to revert\n # back to their original user.\n can :unimpersonate, User\n\n # A user should only be able to update himself or herself (assuming no\n # other permissions granted below by the global role).\n can [:show, :update], User do |target_user|\n target_user == user\n end\n\n can :index, User if user.global_role.can_edit_system_configuration?\n\n process_global_role user\n process_courses user\n process_assignments user\n process_repositories user\n process_assignment_checks user\n process_media_items user\n end\n end",
"def initialize(user_id: nil)\n @user_id = user_id\n end",
"def initialize(user)\n\n # Anyone\n allow :sessions, [:new, :create, :destroy]\n allow :circles, :index\n allow :decisions, [:all, :review]\n allow :circle_decisions, :index\n allow :password_resets, [:index, :create, :new, :edit, :update, :show, :destroy]\n\n # If They're logged in\n if user\n allow :users, :show do |user_record|\n user_record == user\n end\n\n # If they're logged in as a super\n if super?(user)\n allow :users, [:index]\n allow [:users, :decisions], [:new, :create, :edit, :update, :destroy]\n allow :circles, [:new, :create, :edit, :update]\n allow :circles, :destroy do |circle|\n circle_has_no_decisions?(circle)\n end\n\n # If they're logged in as a leader\n else\n allow :decisions, :new\n allow :decisions, :create # TODO: Find way to prevent users unassociated with the decisions circles to create decisions. For now, the view only allows them to select associated circles\n allow :decisions, [:edit, :update, :destroy] do |decision|\n circles_user_involved_in = []\n Circle.all.each do |circle|\n role = Role.find_by(circle: circle, user: user)\n unless role.role_type == \"none\"\n circles_user_involved_in.push(circle)\n end\n end\n decision.circle.in?(circles_user_involved_in)\n end\n allow :users, [:edit, :update] do |user_record|\n user_record == user\n end\n allow :users, :destroy do |user_record|\n user_record == user\n end\n end\n end\n end",
"def initialize(user, source: nil, incorrect_auth_found_callback: nil, missing_auth_found_callback: nil)\n @user = user\n @source = source\n @incorrect_auth_found_callback = incorrect_auth_found_callback\n @missing_auth_found_callback = missing_auth_found_callback\n end",
"def init_behavior user_opts\n super if defined? super\n @systems ||= Hash.new\n\n options_for_me = self.class.behavior_options[SystemUser]\n\n options_for_me && options_for_me.each do |klass, options|\n # add the behavior options to the user_opts hash\n # in case we need access to some level class config param\n user_opts.merge!(options)\n @systems[klass] = klass.new( self, user_opts )\n end\n end",
"def setup_user\n User.new( \n age: 5,\n bio: \"My test bio\",\n password: SecureRandom.hex(6),\n email: SecureRandom.hex(4) + \"@example.com\",\n picture: \"blah.jpg\",\n sex: \"M\",\n username: SecureRandom.hex(4)\n )\n end",
"def initialize(data)\n @user = data['user'] || data[:user]\n # forced reorder so config= is called last\n super(name: data['name'] || data[:name], config: data['config'] || data[:config])\n end",
"def set_user\n \t@user = User.new\n end",
"def set_default_role\n self.role ||= :user\n end",
"def user\n @user ||= User.find_or_initialize_by email: @auth.info.email do |user|\n user.name = @auth.info.name\n user.nickname = @auth.info.name.downcase.split(/\\W/).join('.')\n user.password = Devise.friendly_token[0, 20]\n user.role = :reporter\n end\n end",
"def set_default_role\n self.role ||= :user\n end",
"def set_default_role\n self.role ||= :user\n end",
"def set_default_role\n self.role ||= :user\n end",
"def set_default_role\n self.role ||= :user\n end",
"def initialize(user)\n user ||= User.new # guest user (not logged in)\n\n if user.role? :admin\n can :manage, :all\n else\n if user.role? :certifier\n can :certify, User\n end\n\n if user.role? :voter\n can :create, Vote\n end\n\n can :read, Vote do |vote|\n user.id == vote.registration.user_id\n end\n end\n\n # default is can't do anything special for now\n end",
"def initialize( * )\n\t\tsuper\n\t\t@auth_provider = self.class.auth_provider.new( self )\n\tend",
"def set_user\n @user = User.find(params[:id])\n @user.initialize_users(@user)\n end",
"def set_default_role\n\n\t\tself.role ||= :user\n\n\tend",
"def initialize(user)\n user ||= User.new(:role => \"anonymous\") # Guest user\n\n if user.role == \"admin\"\n can :manage, :all\n elsif user.role == \"staff\"\n can :read, :all\n can :update, Deposit\n\n # publisher-specific agent configuration\n can :update, Agent do |agent|\n user.publisher && agent.by_publisher?\n end\n can [:update, :show], User, :id => user.id\n elsif user.role == \"contributor\"\n can :update, Deposit\n\n # publisher-specific agent configuration\n can :update, Agent do |agent|\n user.publisher && agent.by_publisher?\n end\n can [:update, :show], User, :id => user.id\n elsif user.role == \"user\"\n # publisher-specific agent configuration\n can :update, Agent do |agent|\n user.publisher && agent.by_publisher?\n end\n can [:update, :show], User, :id => user.id\n else\n end\n end",
"def initialize(options = {})\n super()\n @uid = options[:user_id]\n end",
"def initializer(user)\n rebuild_all_cache(user.id) #prevent inconsistences\n # rebuild_task_cache #prevent inconsistences\n user.log_trash = user.log_old\n user.log_old = nil\n user.tkn = rand(1000000)\n user.last_login = Time.now.utc\n user.save\n end",
"def initialize(options = {})\n requires!(options, :login)\n super\n end",
"def initialize(options = {})\n requires!(options, :login)\n super\n end",
"def initialize(options = {})\n requires!(options, :login)\n super\n end",
"def set_defaults\n self.state ||= 'NEW'\n self.user_id ||= Gizmo::Util::Uuid.generate\n end",
"def initialize(model_class, strategy:, **options)\n @model_class = model_class\n @only_updated = options[:only_updated]\n @remote = options[:remote]\n @strategy = strategy_class(strategy).new(model_class, options)\n end",
"def initialize(user,pw,options={})\n options = DEFAULT_OPTIONS.merge(options)\n \n @user = user\n @pw = pw\n \n connect if options[:connect]\n listen if options[:listen]\n join_muc(options[:muc]) if options[:muc]\n \n @allowed_roster = options[:roster]\n @redirects = {}\n end",
"def initialize(user, authorized_services, options = {})\n @user = user\n fetch_additional_resources\n resource = UserStruct.new(user.uuid, profile, authorized_services, health)\n super(resource, options)\n end",
"def initialize(name,password,age)\n #though is looks funny (@something = something) the @ symbol makes it an instance variable so that the argument given is attached to that specific User and not mixed up with other Users\n @name = name\n @password = password \n @age = age\n end",
"def initialize(user)\n return unless user\n\n case user.role\n when 'researcher'\n can_acces_rails_admin\n can_do_collection_scoped_actions\n can_do_member_scoped_actions\n when 'super'\n can_acces_rails_admin\n can_do_collection_scoped_actions\n can_do_member_scoped_actions\n end\n end",
"def user(*args)\n super(*args) || build_user\n end",
"def initialize\n @model = Evertils::Common::Query::Simple.new\n @format = Formatting.new\n @user = @model.user_info[:user]\n @shard = @model.user_info[:shard]\n end",
"def initialize(user)\n if user&.admin?\n admin\n elsif user&.viewer?\n viewer\n else\n # If a user was not provided or has no defined role,\n # then the user should not be able to access anything.\n cannot :manage, :all\n end\n end",
"def initialize(user)\n define_global_privileges\n define_user_privileges(user) if user\n define_admin_privileges(user) if user and user.admin?\n end",
"def initialize(user, password=nil)\n @user, @password = user, password\n end",
"def initialize(options={})\r\n @strategy_record=options[:strategy_record]\r\n end",
"def bootstrap!\n self.roles << Role.create(:title => 'user') unless self.roles.include?(:user)\n self.profile ||= Profile.create\n end",
"def initialize(user)\n authorize_guest(user)\n return if user.nil?\n\n authorize_admin(user)\n end",
"def initialize(options={})\n requires!(options, :login, :password)\n super\n end",
"def initialize(user)\n anonymous_abilities\n\n if user.blank?\n no_user_abilities\n else\n cannot :update, UserSession\n # can :manage, Section do |section|\n # can? :update, section.document\n # end\n # habitapedia_abilities(user)\n # social_abilities(user)\n admin_abilities if user.admin?\n end\n end",
"def strategy=(strategy)\n @strategy = strategy\n end",
"def set_default_role\n self.roles = [Role.find_by_name('user')]\n end",
"def user\n @user ||=\n User.where(:provider => @auth.provider, :username => @auth.info.email).first_or_initialize.tap do |user|\n user.uid = @auth.uid\n user.enabled = false\n user.save!\n end\n end",
"def set_defaults\n\t\tself.email = self.users.first.email if ['student','school_admin','admin'].include? self.role\n\t\tself.uuid = SecureRandom::uuid()\n\t\tself.active = true\n\tend",
"def initialize(user = nil, scope)\n @user = user\n @scope = scope\n end",
"def init\n self.role ||= \"standard\" #will set the default value only if it's nil\n end",
"def initialize(user)\n @base_url = BASE_URL + \"/users/\" + user\n end",
"def initialize(user, password = nil, alg = Algorithm::DEFAULT, alg_params = {} )\n @user = user\n alg = Algorithm::DEFAULT if alg == Algorithm::EXISTING \n @algorithm = Algorithm.algorithm_from_name(alg, alg_params)\n @digest = calc_digest(password)\n end",
"def initialize(user)\n # default abilities for anonymous, non-logged-in visitors\n can [:read, :index], [Term, Organization, Course, CourseOffering]\n\n if user\n # This ability allows admins impersonating other users to revert\n # back to their original user.\n can :unimpersonate, User\n\n # Creating an alias for CRUD operations\n alias_action :create, :read, :update, :destroy, to: :crud\n\n # Global admin permissions, placed last override everything\n if user.global_role.id == GlobalRole::ADMINISTRATOR_ID\n can :manage, :all\n else\n\n # A user should only be able to update himself or herself (assuming no\n # other permissions granted below by the global role).\n can [:read, :index], User, User.visible_to_user(user) do |u|\n u == user || u.course_enrollments\n .where('course_role_id != ?', CourseRole::STUDENT_ID).any?\n end\n can [:edit, :update], User, id: user.id\n\n process_global_role user\n process_instructor user\n process_researcher user\n process_courses user\n end\n end\n end",
"def user\n super || create_user\n end",
"def initialize(options = {})\n requires!(options, :login)\n @options = options\n super\n end",
"def initialize(user_credentials = nil)\n unless user_credentials.nil?\n Utility.check_argument_class('user_credentials', user_credentials, User)\n end\n @user_credentials = user_credentials\n @use_authentication = @user_credentials && @user_credentials.username && @user_credentials.password\n\n super() #initialize the base (Atom::HTTP) class\n \n if @use_authentication\n self.user = @user_credentials.username\n self.pass = @user_credentials.password\n self.always_auth = :basic\n end\n \n end",
"def add_defaults_local\n super\n self.timestamp ||= Java.now\n self.user ||= default_user\n end",
"def use_default_user_model def_model\n def_model\n end",
"def initialize\n super(\"ssh-userauth\")\n end",
"def initialize(user, connection, **opts)\n super\n @speculative_auth_client_nonce = opts[:speculative_auth_client_nonce]\n @speculative_auth_result = opts[:speculative_auth_result]\n end",
"def initialize(user)\n # Handle the case where we don't have a current_user i.e. the user is a guest\n user ||= User.new\n can :read, :all\n can :create, Document\n can :update, Document do |document|\n document.try(:user) == user\n end\n can :destroy, Document do |document|\n document.try(:user) == user\n end\n end",
"def initialize(user, instance)\n @user = user\n @instance = instance\n end",
"def initialize_roles(user)\n case user.class.to_s\n when \"AdminUser\"\n admin_user_with_role(user)\n when \"HakaUser\"\n haka_user(user)\n when \"GuestUser\"\n guest_user(user)\n else\n raise \"Current user class could not be determined. This is a bug.\"\n end\n end",
"def initialize(options = {})\n requires!(options, :login, :password)\n super\n end",
"def initialize(options = {})\n requires!(options, :login, :password)\n super\n end",
"def initialize(options = {})\n requires!(options, :login, :password)\n super\n end",
"def initialize(options = {})\n requires!(options, :login, :password)\n super\n end",
"def initialize(options = {})\n requires!(options, :login, :password)\n super\n end",
"def initialize(options = {})\n requires!(options, :login, :password)\n super\n end",
"def initialize(options = {})\n requires!(options, :login, :password)\n super\n end"
] | [
"0.67172897",
"0.6685895",
"0.668033",
"0.6675152",
"0.66650766",
"0.654373",
"0.65173364",
"0.6514021",
"0.6514021",
"0.6514021",
"0.6506571",
"0.6500203",
"0.6500203",
"0.6496486",
"0.6461032",
"0.6426161",
"0.6419987",
"0.63515323",
"0.63169116",
"0.63151526",
"0.625627",
"0.6230983",
"0.62292105",
"0.6201605",
"0.6190185",
"0.6159113",
"0.6128729",
"0.6091738",
"0.60743314",
"0.60627276",
"0.606125",
"0.605279",
"0.60267735",
"0.60183185",
"0.60142946",
"0.6014043",
"0.59720796",
"0.5969969",
"0.59676844",
"0.5959116",
"0.59542525",
"0.5946158",
"0.59288406",
"0.5906782",
"0.58931607",
"0.58931607",
"0.58931607",
"0.58931607",
"0.5877796",
"0.5873279",
"0.5872745",
"0.5866733",
"0.5864324",
"0.5860569",
"0.5857872",
"0.5854014",
"0.5854014",
"0.5854014",
"0.58537614",
"0.58436733",
"0.5837633",
"0.5835292",
"0.58299524",
"0.5821477",
"0.58144444",
"0.58067876",
"0.5798422",
"0.57821524",
"0.57720494",
"0.5768059",
"0.57680273",
"0.5766993",
"0.576577",
"0.5765185",
"0.57578677",
"0.5745665",
"0.5736572",
"0.5736234",
"0.5729928",
"0.5729754",
"0.5726084",
"0.57178444",
"0.5708155",
"0.5707763",
"0.57069707",
"0.5694237",
"0.56939363",
"0.56839323",
"0.5680334",
"0.5678781",
"0.5678039",
"0.5671322",
"0.5670242",
"0.5668961",
"0.5668961",
"0.5668961",
"0.5668961",
"0.5668961",
"0.5668961",
"0.5668961"
] | 0.82145846 | 0 |
Set the Twitter lookup strategy to :search or :user | def strategy=(strategy)
case strategy
when :user, :search
@strategy = strategy
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_user_search_strategy(strategy)\n @user_search_strategy =\n case strategy.to_s\n when \"default\"\n GitHub::Ldap::UserSearch::Default.new(self)\n when \"global_catalog\"\n GitHub::Ldap::UserSearch::ActiveDirectory.new(self)\n else\n GitHub::Ldap::UserSearch::Default.new(self)\n end\n end",
"def configure_search_strategy(strategy = nil)\n # configure which strategy should be used to validate user membership\n configure_membership_validation_strategy(strategy)\n\n # configure which strategy should be used for member search\n configure_member_search_strategy(strategy)\n end",
"def search_twitter()\n search_call = \"#{@api_endpoint_twitter}?ors=#{@search_term}&result_type=#{@result_type}&rpp=#{@results_per_page}\"\n @response = http_get search_call\n end",
"def lazy_search_twitter()\n @refresh_url = \"#{@api_endpoint_twitter}#{@response['refresh_url']}\" unless (@response.nil? || @response['refresh_url'].nil? || @response['refresh_url'].empty?)\n if @refresh_url\n #FIXME persist the refresh url - server restart would be a pain elsewise\n search_url = \"#{@refresh_url}&result_type=#{@result_type}&rpp=#{@results_per_page}\"\n @log.info \"lazy search using '#{search_url}'\" #workaround to get refresh url logged w/ the Daemons gem\n @response = http_get search_url\n else\n @log.debug \"regular search using '#{@search_term}'\"\n @response = search_twitter()\n end\n end",
"def configure_member_search_strategy(strategy = nil)\n @member_search_strategy =\n case strategy.to_s\n when \"classic\"\n GitHub::Ldap::MemberSearch::Classic\n when \"recursive\"\n GitHub::Ldap::MemberSearch::Recursive\n when \"active_directory\"\n GitHub::Ldap::MemberSearch::ActiveDirectory\n else\n # fallback to detection, defaulting to recursive strategy\n if active_directory_capability?\n GitHub::Ldap::MemberSearch::ActiveDirectory\n else\n GitHub::Ldap::MemberSearch::Recursive\n end\n end\n end",
"def twitter\n unless @twitter_user\n provider = self.authentications.find_by_provider('twitter')\n @twitter_user = Twitter::Client.new(:oauth_token => provider.token, :oauth_token_secret => provider.secret )rescue nil\n end\n @twitter_user\n end",
"def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end",
"def initialize(q=nil, options={})\n @adapter = options.delete(:adapter)\n @options = options\n clear\n containing(q) if q && q.strip != \"\"\n @api_endpoint = \"search.twitter.com/search.#{Twitter.format}\"\n @api_endpoint = Addressable::URI.heuristic_parse(@api_endpoint)\n end",
"def show\n @word = Word.find(params[:id])\n if current_user.authentications[2]==\"twitter\"\n @tweet_search = current_user.twitter.search(@word.word)\n else\n @tweet_search\n end\n end",
"def twitter_search(term)\n TwitterClient.new.search(term)\n end",
"def suggester_name(url_params = nil)\n blacklight_config.autocomplete_suggester ||= DEF_AUTOCOMPLETE_SUGGESTER\n super\n end",
"def twitter?\n self.provider == 'twitter'\n end",
"def set_twitter_user\n @twitter_user = current_user.twitter_users.find(params[:id])\n end",
"def twitter\n handle_oauth\n end",
"def twitter\n \toauth.authorize_from_access(oauth_token, oauth_secret)\n\t @twitter ||= Twitter::Base.new(oauth)\n end",
"def set_ommniauth_twitter(email = 'phanha9389twitter@gmail.com')\n OmniAuth.config.mock_auth[:twitter] = auth_hash_twitter(email)\n request.env[\"omniauth.auth\"] = OmniAuth.config.mock_auth[:twitter]\n end",
"def select_twitter_account(&callback)\n account_type = @store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter)\n\n @store.requestAccessToAccountsWithType(account_type, options: nil, completion: -> (granted, error) do\n if granted\n @accounts = @store.accountsWithAccountType(account_type)\n if @accounts.length > 0\n Dispatch::Queue.main.async do\n next_step = -> (account, &firebase_handler) do\n self.authenticate_account(account, &firebase_handler)\n end\n callback.call(nil, @accounts, next_step)\n end if callback\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'No Twitter accounts detected on phone. Please add one in the settings first.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'Access to twitter accounts denied.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n end)\n end",
"def apply_twitter(omniauth)\n if (extra = omniauth['extra']['user_hash'] rescue false)\n end\n end",
"def twitter\n callback_from :twitter\n end",
"def set_twitter_user\n @twitter_user = TwitterUser.find(params[:id])\n end",
"def load_twitter_account\n # FIXME would this be better placed in the models?\n @twitter_account = @workspace ? @workspace.twitter_account || @workspace.create_twitter_account :\n @user.twitter_account || @user.create_twitter_account\n end",
"def twitter_auth_cache\n self.auth_profiles.where(provider: 'twitter').first\n end",
"def oauth #:nodoc:\n @oauth ||= Bountybase.config.twitter[Bountybase.instance] ||\n begin\n E \"Cannot find twitter configuration for\", Bountybase.instance\n raise \"Cannot find twitter configuration\"\n end\n end",
"def autocomplete_suggesters!(config)\n config.autocomplete_path = 'suggest'\n config.autocomplete_suggester = 'suggest' # TODO: TBD?\n super(config)\n end",
"def initialize\n super\n @strategy = :user\n end",
"def twitter?\n provider_name == 'Twitter'\n end",
"def url\n \"http://twitter.com/search/?q=\" + self.query\n end",
"def twitter\n if twitter?\n return self.twitter_client if self.twitter_client\n self.twitter_client = TwitterOAuth::Client.new(\n :consumer_key => TWITTER_CONSUMER_KEY,\n :consumer_secret => TWITTER_CONSUMER_SECRET,\n :token => self.twitter_token,\n :secret => self.twitter_secret\n )\n else\n false\n end\n end",
"def twitter_user\n @twitter_user ||= prepare_access_token(self.token, self.secret)\n end",
"def twitter_user\n @twitter_user ||= TwitterClient.new.user(@user)\n end",
"def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend",
"def search\n \t@whosaidit = params[:whosaidit]\n \t@query = params[:query]\n\n if params[:enableRT] == true\n @RToption = \"-RT\"\n else\n @RToption = \"\"\n end\n\n \t# user and keyword\n \t# @tweets = $twitter.search(\"to:#{@whosaidit} \"+ @query + \" filter:images\").take(20)\n\n \t# just keyword\n \t# @tweets = $twitter.search(@query + \" filter:images\").take(20)\n\n \t# just user\n \t@tweets = $twitter.search(\"from:#{@whosaidit}\" + \" filter:images \"+\"#{@RToption}\").take(30)\n \n \t# puts @tweets.first.inspect\n \t@twitteranalysis = \"\"\n \trender \"index\"\n end",
"def twitter_url\n twitter_user.blank? ? nil : \"#{TWITTER_URL}#{twitter_user}\"\n end",
"def share_location_on_twitter options={}\n if from_twitter?\n\n c_id = id\n c_id = \"4f696467043bac0001000002\" if Rails.env != \"production\"\n\n oauth = providers.where(provider: \"twitter\").first\n \n status_msg = self.swap_stat\n status_msg.gsub! /you/, \"me\" \n status_msg = \"On @myradddar! #{status_msg} http://www.radddar.com/#{c_id}\"\n\n Twitter.configure do |config|\n config.consumer_key = ENV[\"RDR_TWITTER_KEY\"]\n config.consumer_secret = ENV[\"RDR_TWITTER_SECRET\"]\n config.oauth_token = oauth[:token]\n config.oauth_token_secret = oauth[:secret]\n end\n\n client = Twitter::Client.new\n client.update(status_msg,{\n lat: self.loc[0],\n long: self.loc[1],\n }) rescue nil\n\n end\n end",
"def twitt\n if PLANETOID_CONF[:twitter][:users][:send_twitts]\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:users][:prefix]} #{self.name} #{PLANETOID_CONF[:site][:url]}/#{self.slug}\" \n end\n end",
"def set_last_tweet(search)\n access_token = OAuth::AccessToken.new(get_consumer(), search.user.access_token,\n search.user.access_secret)\n \n query_string = \"https://search.twitter.com/search.json?q=#{CGI.escape(search.text)}&rpp=1\"\n json = access_token.get(query_string)\n results = JSON.parse(json.body)\n \n if results.has_key?(\"results\") && results[\"results\"].count > 0\n search.last_tweet = results[\"results\"][0][\"id_str\"]\n else\n search.last_tweet = \"1\"\n end\n \n search.save\n end",
"def twitter_url; \"https://twitter.com/#{twitter}\" end",
"def initialize(default_field = :twitter_name)\n @default_field = default_field\n end",
"def twitter\n @client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = Rails.application.secrets.twitter_api_key\n config.consumer_secret = Rails.application.secrets.twitter_api_secret\n config.access_token = token\n config.access_token_secret = secret\n end\n end",
"def twitter_client\n @twitter_client ||= begin\n if provider = self.omni_auth_providers.where(name: \"twitter\").first\n Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CLIENT_ID\"]\n config.consumer_secret = ENV[\"TWITTER_CLIENT_SECRET\"]\n config.access_token = provider.auth_data[\"credentials\"][\"token\"]\n config.access_token_secret = provider.auth_data[\"credentials\"][\"secret\"]\n end\n end\n end\n end",
"def configure_twitter\n Twitter.configure do |config|\n config.consumer_key = \"VowhzjVm7OWLZmHGxosVyg\"\n config.consumer_secret = \"Pwkd1J2rxWVaejWdvg1MOW2qHmP6lAncP0EDTXWvZM\"\n config.oauth_token = \"109484472-I0kSWE9FnpxjlzUrDmL0eIFxkcDxnkLyIaZskQhf\"\n config.oauth_token_secret = \"1PmK1OlThcRsiYgHYwOdRHXVEboog5jukq35nIUNauA\"\n end\nend",
"def isTwitter?\n self.category =~ /(tweet|twitter|suggested)/i\n end",
"def twitter\n @client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = Rails.application.secrets.twitter_api_key\n config.consumer_secret = Rails.application.secrets.twitter_api_secret\n config.access_token = token\n config.access_token_secret = secret\n end\n end",
"def user_connect_to_twitter(user)\n access = nil\n if user.twitter_token\n user_credentials = @t_credentials.clone # Keep consumer token\n # but override with user's access token\n user_credentials[:access_token] = user.twitter_token\n user_credentials[:access_token_secret] = user.twitter_secret\n# puts \"Using this token for #{user.ublog_name}: #{user_credentials[:access_token]}/#{user_credentials[:access_token_secret]}\"\n begin\n access = TwitterAPI::Access.new(user_credentials)\n rescue StandardError, Timeout::Error\n puts \"Failed to access Twitter for user #{user.ublog_name}:\\n\" + $!\n # Didn't expect this. User needs to get new token sometime.\n end\n end\n access\n end",
"def twitter_profile\n @network = current_user.network ||= Network.new\n (@network.twitter.nil?) ? \"\" : @network.twitter\n end",
"def search_for_type(type)\n q = type\n # search for tweets containing type or #type\n # save them to DB if request is valid (ie not an exception)\n end",
"def set_search_engine\n set_engine_callback(SearchService)\n end",
"def twitter\n handle_callback(:twitter)\n end",
"def infer_strategy_key\n case @remote\n when /\\A.+?@.+?:.+?/ then :rsync\n else :curl\n end\n end",
"def strategy=(strategy)\n @strategy = strategy\n end",
"def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end",
"def twitter?\n false\n end",
"def find_strategy(type)\n \"Simple::OAuth2::Strategies::#{type.to_s.camelize}\".constantize\n end",
"def search_twitter(term, options, nb_results)\n $client_rest.search(term, options).take(nb_results).each do |tweet|\n if tweet.is_a?(Twitter::Tweet)\n puts tweet.text\n #spam(tweet)\n end\n end\n end",
"def get_user_from_twitter_as_hash(screen_name_or_twitter_id)\n Rails.cache.fetch(\"/users/show/#{screen_name_or_twitter_id}\", :expires_in => 2.hours) { twitter.get(\"/users/show/#{screen_name_or_twitter_id}\") }\n end",
"def use(strategy)\n prediction_strategies << strategy\n end",
"def set_omniauth_user(user)\n # Setup OmniAuth to return the correct metatda for this user.\n OmniAuth.config.add_mock(:twitter, {\n uid: user.uid,\n info: {\n name: user.name\n }\n })\n end",
"def strategy(value = nil)\n if value\n Registration.repositories[self].strategy = value\n Registration.clear_method_cache(self)\n else\n Registration.repositories[self].strategy\n end\n end",
"def fetch_new_tweets(search_query, search_type)\n # max_id is inclusive\n new_tweets = method(\"search_tweets_by_#{search_type}\").call(search_query)\n end",
"def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end",
"def search_twitter(query)\n \n url = \"http://search.twitter.com/search.json\"\n \n if (not query.q.nil? and not query.q.empty?) and (not query.from_user.nil? and not query.from_user.empty?)\n url << \"?q=\" + CGI.escape(query.q) + \"+from%3A\" + CGI.escape(query.from_user)\n elsif query.q.nil? or query.q.empty?\n url << \"?q=from%3A\" + CGI.escape(query.from_user)\n elsif query.from_user.nil? or query.from_user.empty?\n url << \"?q=\" + CGI.escape(query.q)\n end\n \n url << \"&lang=\" + CGI.escape(query.lang) if not query.lang.nil? and not query.lang.empty?\n url << \"&rpp=\" + query.rpp.to_s\n url << \"&since=\" + \"%04d-%02d-%02d\" % [query.since.year, query.since.month, query.since.day] if not query.since.nil?\n \n JSON.parse(open(url).read)['results']\n end",
"def lookup(key, default = nil, scope = self.scope, *rest)\n super(key.to_s, default, scope, *rest)\n end",
"def search_twitter(term, options, nb_results)\n $client_rest.search(term, options).take(nb_results).each do |tweet|\n if tweet.is_a?(Twitter::Tweet)\n puts tweet.text\n spam(tweet)\n end\n end\n end",
"def configure_membership_validation_strategy(strategy = nil)\n @membership_validator =\n case strategy.to_s\n when \"classic\"\n GitHub::Ldap::MembershipValidators::Classic\n when \"recursive\"\n GitHub::Ldap::MembershipValidators::Recursive\n when \"active_directory\"\n GitHub::Ldap::MembershipValidators::ActiveDirectory\n else\n # fallback to detection, defaulting to recursive strategy\n if active_directory_capability?\n GitHub::Ldap::MembershipValidators::ActiveDirectory\n else\n GitHub::Ldap::MembershipValidators::Recursive\n end\n end\n end",
"def set_keyword\n @tweet = Tweet.find(params[:id])\n end",
"def search_for_mbti\n # search for tweets cotaining #MBTI, #mbti, or 'mbti'\n # save them to DB if the request is valid\n hashtag_res = client.search('#mbti', result_type: 'mixed', count: 100, lang: 'en')\n hashtag_res.take(5).each { |tweet| puts \"#{tweet.user.screen_name}: #{tweet.text}\" }\n save_tweets_to_db(hashtag_res)\n # text_res = client.search('mbti', result_type: 'mixed', count: 100, lang: 'en')\n # text_res.take(5).each { |tweet| puts \"#{tweet.user.screen_name}: #{tweet.text}\" }\n\n #save tweets to DB and save last_tweet_id as max_id so can poll later\n # self.last_tweet_id = hashtag_res.first.id.to_s # || Tweet.last.t_id_str\n end",
"def user=(user)\n @user = user\n @twitter_user = nil\n load_words\n end",
"def configure_authentication\n consumer_secret = \"18yElxR1Zf8ESVkl3k7XQZxyAPWngz5iM69nbhH7yE\"\n consumer_key = \"zQ727fZBHDIv36pKhr2Hg\"\n\n Twitter.configure do |config|\n config.consumer_key = consumer_key\n config.consumer_secret = consumer_secret\n config.oauth_token = \"157879876-iSPfgtHxw8QSAj6cJl0uYTbDTV1kfxsw8Tgi1QGK\"\n config.oauth_token_secret = \"XiI1kkuGgvqZNc4mGIGkPxjcr19p9PVxhT7m0M\"\n Twitter::Client.new\n end\n end",
"def login_twitter\n\t\tclient = Twitter::REST::Client.new do |config|\n\t\t config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n\t\t config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n\t\t config.access_token = ENV[\"TWITTER_ACCESS_TOKEN\"]\n\t\t config.access_token_secret = ENV[\"TWITTER_ACCESS_TOKEN_SECRET\"]\n\t\tend\n\tend",
"def authenticate!\n session = DeviseTwitterAnywhere::Twitter::Session.new(cookies, params)\n\n if session.valid?\n klass = mapping.to\n user = klass.authenticate_twitter_user session.uid\n\n if user.blank? && klass.twitter_auto_create_account?\n user = klass.new\n user.twitter_session = session\n user.set_twitter_credentials_from_session!\n user.run_callbacks :create_by_twitter do\n begin\n user.save(:validate => klass.run_validations_when_creating_twitter_user)\n rescue ActiveRecord::RecordNotUnique\n fail!(:not_unique_user_on_creation) and return\n end\n end\n\n if klass.run_validations_when_creating_twitter_user && !user.persisted?\n fail!(:invalid_twitter_user_on_creation) and return\n end\n end\n\n if user.present? && user.persisted?\n user.twitter_session = session\n user.run_callbacks :connecting_to_twitter do\n success!(user) and return\n end\n else\n fail!(:twitter_user_not_found_locally) and return\n end\n else\n fail!(:invalid_twitter_session) and return\n end\n end",
"def set_search_style(style = nil)\n valid_values = SearchModesHelper::SEARCH_STYLES\n set_search_feature(:style, style, valid_values, meth: __method__)\n end",
"def strategy=(s); end",
"def set_tweet\n # @tweet = Tweet.find(params[:id])\n @tweet = current_user.tweets.find(params[:id])\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end",
"def twitter(*args)\n W \"TRY twitter\", *args unless Rails.env.test?\n\n oauth = args.extract_options!\n expect! oauth => {\n :oauth_token => String,\n :oauth_token_secret => String,\n :consumer_key => String,\n :consumer_secret => String\n }\n\n client = Twitter::Client.new(oauth)\n client.send(*args) unless Rails.env.development?\n W \"OK twitter\", *args unless Rails.env.test?\n end",
"def authenticate()\n\n Twitter.configure do |config|\n config.consumer_key = @consumer_key\n config.oauth_token = @oauth_token\n config.oauth_token_secret = @oauth_token_secret\n config.consumer_secret = @consumer_secret\n\n end\n\n end",
"def load_words\n case @strategy\n when :user\n @words = twitter_user.status.text.split(/\\s/) \n when :search\n @words = twitter_search(@term).statuses.map(&:text).join(\" \").split(/\\s/)\n end\n end",
"def twitter_url(username)\n \"https://twitter.com/#!/#{username}\"\n end",
"def initialize (type = 'twitter')\n\n\t\t@type = type\n\t\t\n\t\tconnect_database\n\n\tend",
"def search(query, limit)\n unless @twitterclient\n configinit\n end\n options = {\n :count => limit,\n :include_rts => true\n }\n @twitterclient.search(query, options)\n end",
"def initialize(params, repository)\n autocomplete_config_name = params[:autocomplete_config]\n super\n @autocomplete_config = if repository.blacklight_config.autocomplete\n repository.blacklight_config.autocomplete[autocomplete_config_name]\n else\n {\n solr_endpoint: repository.blacklight_config.autocomplete_path,\n search_component_name: \"mySuggester\"\n }\n end\n end",
"def _fetch_strategy(name, scope)\n @strategies[scope][name] ||= if klass = Watchman::Strategies[name]\n klass.new(@env, scope)\n elsif @config.silence_missing_strategies?\n nil\n else\n raise \"Invalid strategy #{name}\"\n end\n end",
"def lookup(key, default, scope, order_override, resolution_type)\n @backends ||= {}\n answer = nil\n\n Config[:backends].each do |backend|\n if constants.include?(\"#{backend.capitalize}_backend\")\n @backends[backend] ||= Backend.const_get(\"#{backend.capitalize}_backend\").new\n answer = @backends[backend].lookup(key, scope, order_override, resolution_type)\n\n break if answer\n end\n end\n\n answer = resolve_answer(answer, resolution_type) || parse_string(default, scope)\n\n return default if answer == empty_answer(resolution_type)\n return answer\n end",
"def link_twitter\n\n end",
"def set_twitter_info omni\n info = omni['info']\n \n # Get profile image from twitter. Remove _normal to return normal size\n # (weird, right?)\n if info['image'].present?\n self.remote_profile_image_url = info['image'].gsub(\"_normal\", \"\")\n end\n end",
"def make_reverse_request\n @ref.makeReverseOAuthRequestTo('twitter', withCompletionBlock: -> (error, json) do\n if error\n callback_if_exists_with_error(error)\n else\n request = create_credential_request_with_reverse_auth_payload(json)\n request_twitter_credentials(request)\n end\n end)\n end",
"def default_strategy\n {\n strength: 10,\n speed: 20,\n intelligence: 10,\n integrity: 60,\n }\n end",
"def base_url\n \"https://api.twitter.com\"\n end",
"def fetch_details_from_twitter\n\t\t# twitter_object = Twitter::Client.new(\n\t\t# \t:oauth_token => self.token,\n\t\t# \t:oauth_token_secret => self.secret\n\t\t# \t)\n\t\t# twitter_data = Twitter.user(self.uid.to_i)\n\t\t# self.username = twitter_data.username\n\t\t# self.save\n\t\t# self.user.username = twitter_data.username if self.user.username.blank?\n\t\t# self.user.image = twitter_data.profile_image_url if self.user.image.blank?\n\t\t# self.user.location = twitter_data.location if self.user.location.blank?\n\t\t# self.user.save(:validate => false)\n\t\tself.user.has_twitter = true\n\t\tself.user.save\n\tend",
"def twins(path)\n lookup(path, nil, false, false, false)\n end",
"def pick_suggestion\n strategy_class.new(@pattern).pick_suggestions\n end",
"def twitter_check\n begin\n unless twitter.blank?\n RestClient.get \"twitter.com/#{twitter}\"\n end\n rescue\n errors.add :base, \"Invalid Twitter account.\"\n end\n end",
"def run\n super\n \n #\n # Do the google search\n #\n results = GSearchParser.webSearch(@object.name.gsub(\" \",\"%20\"))\n \n results.each do |r|\n #\n # Parse the results for known patterns \n #\n \n # Check to see if this is a twitter result&\n # grab the username if so\n if r.title =~ /on Twitter/\n \n @task_logger.log \"Found a twitter account! (#{r.title}\"\n account_name = r.title.gsub(/<.?em>/,\"\").split(\"@\").last.split(\")\").first\n \n @task_logger.log_good \"Storing a twitter account! (#{account_name})\"\n @object.usernames << account_name\n \n @object.save\n end\n\n # TODO - we can do the same thing with the linkedin URL, but we'll need to tweak\n # gsearch-parser in order to get it out\n\n end\n \n end",
"def fill_in_prefetched_typeahead_field(opts)\n type = opts[:type] || 'twitter'\n # Poltergeist / Capybara doesn't fire the events typeahead.js\n # is listening for, so we help it out a little:\n find(opts[:wait_for]) if opts[:wait_for]\n page.execute_script <<-EOF\n $(\"[data-#{type}-typeahead]:visible\").val(\"#{opts[:with]}\").trigger(\"input\");\n $(\"[data-#{type}-typeahead]:visible\").typeahead(\"open\");\n $(\".tt-suggestion\").click();\n EOF\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n\n self.login = user_info['screen_name']\n self.twitter_name = user_info['name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end",
"def handle_search(list)\n # Connexion à l'API Twitter avec le Token renseigné dans le .env loadé.\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV['TWITTER_CONSUMER']\n config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']\n config.access_token = ENV['TWITTER_TOKEN']\n config.access_token_secret = ENV['TWITTER_TOKEN_SECRET']\n end\n list.each do |line| # Pour chaque ligne du tableau :\n if line[0] == \"name\" # On skip la première.\n elsif client.user_search(\"ville #{line[0]}\").first # Si on trouve un résultat on l'enregistre 4è valeur du tableau.\n line[3] = client.user_search(\"ville #{line[0]}\").first.screen_name\n else # Si on ne trouve rien on enregistre un blanc.\n line[3] = \"\"\n break if line[0] == \"BUDOS\" # Pour pouvoir effectuer le test arrête à la mairie BUDOS, sinon on finira par se faire kick de l'API Twitter...\n# Afin de continuer à faire tourner le script jusqu'à la fin il faudrait rescue les erreurs \"Too many requests\", mettre un sleep qui relancerait plus tard.\n end\n end\n list\n return final_list = list\nend",
"def add_twitter(id, twitter_name, options = nil)\n params = { 'username' => twitter_name }\n params.update(options) if options\n add_service(id, 'twitter', params)\n end",
"def add_twitter(id, twitter_name, options = nil)\n params = { 'username' => twitter_name }\n params.update(options) if options\n add_service(id, 'twitter', params)\n end",
"def load_old_tweet\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n #replace t.co link with didmichiganstatewin.com so the comparison will work\n return client.user_timeline(\"didmsuwin\").first.text.split('http').first + \"didmichiganstatewin.com\"\nend",
"def get_twitter_query(project_id, query_id)\n get \"projects/#{project_id}/twitterqueries/#{query_id}\"\n end"
] | [
"0.6899154",
"0.60859466",
"0.60526884",
"0.58958787",
"0.5813516",
"0.56575435",
"0.5576044",
"0.5574021",
"0.55738586",
"0.5396325",
"0.53547204",
"0.5337322",
"0.5326187",
"0.530415",
"0.5301709",
"0.52801555",
"0.52781755",
"0.52741367",
"0.5263843",
"0.523065",
"0.51948786",
"0.518447",
"0.5179282",
"0.5175917",
"0.5131764",
"0.5123046",
"0.50791335",
"0.5069938",
"0.5069908",
"0.50400805",
"0.50185347",
"0.5008167",
"0.4998247",
"0.49829173",
"0.49664566",
"0.49492934",
"0.4944747",
"0.49412364",
"0.49293548",
"0.49128783",
"0.48879102",
"0.48739648",
"0.48718658",
"0.48410258",
"0.48405483",
"0.483047",
"0.48111892",
"0.4796815",
"0.4787171",
"0.47838137",
"0.47776002",
"0.47772005",
"0.47771603",
"0.47643623",
"0.47608238",
"0.47405496",
"0.47390187",
"0.47283798",
"0.47252464",
"0.47218186",
"0.4719087",
"0.47181907",
"0.4711739",
"0.46937078",
"0.46874133",
"0.46863505",
"0.46773836",
"0.46710026",
"0.4668218",
"0.46613348",
"0.465845",
"0.46384886",
"0.46326947",
"0.4628988",
"0.46237925",
"0.46229085",
"0.46124682",
"0.46102452",
"0.46006933",
"0.45949122",
"0.45923787",
"0.45869505",
"0.45843828",
"0.45834893",
"0.45823047",
"0.45709223",
"0.45696872",
"0.4569671",
"0.4568689",
"0.45646486",
"0.45584154",
"0.45576686",
"0.45571786",
"0.4555276",
"0.4554525",
"0.45493042",
"0.4546747",
"0.4546747",
"0.45463675",
"0.45371702"
] | 0.6275252 | 1 |
Set the Twitter user to find | def user=(user)
@user = user
@twitter_user = nil
load_words
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_twitter_user\n @twitter_user = current_user.twitter_users.find(params[:id])\n end",
"def set_twitter_user\n @twitter_user = TwitterUser.find(params[:id])\n end",
"def set_user\n id = params[:id] == 'me' ? current_user.login : params[:id]\n @user = LDAP::User.find(id)\n end",
"def set_user\n @user = User.find_by_token!(params[:id])\n end",
"def set_tweet\n @tweet = current_user.tweets.find(params[:id])\n end",
"def set_tweet\n # @tweet = Tweet.find(params[:id])\n @tweet = current_user.tweets.find(params[:id])\n end",
"def set_user\n puts \"STAN THE MANNNNNNNNNNN\"\n @user = User.find(params[:id])\n end",
"def set_tweet\n @tweet = current_user.tweets.find(params[:id])\n end",
"def set_user\n @user = User.find_by(oauth_id: params[:id])\n end",
"def cmd_twitt_set_user(*args)\n\t\t\t\tif args.length > 0\n\t\t\t\t\tprint_status(\"Setting the DM target user to #{args[0]}\")\n\t\t\t\t\t@user = args[0]\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Please provide a value\")\n\t\t\t\tend\n\t\t\tend",
"def set_user\n @user = User.find_by(auth0_id: auth_token[0]['sub'])\n end",
"def twitter_user\n @twitter_user ||= TwitterClient.new.user(@user)\n end",
"def set_tw_usuario\n @tw_usuario = TwUsuario.find(params[:id])\n end",
"def set_user\n begin\n @user = User.find_by name: params[:id]\n rescue Mongoid::Errors::DocumentNotFound\n begin\n @user = User.find_by email: params[:id]\n rescue Mongoid::Errors::DocumentNotFound\n @user = nil\n end\n end\n end",
"def set_user\n @user = User.find_by(username: params[:id])\n end",
"def set_user\n @user = User.find(params[:id]) or not_found\n end",
"def set_user\n @user = User.find(user_id)\n end",
"def set_user\n @user = User.find(params[:last_name] || params[:id])\n end",
"def set_user\n @user = User.where(username: params[:username]).take\n end",
"def set_user\n if !(User.where(id: params[:id]).empty?)\n @user = User.find(params[:id])\n else\n @user = User.find_by_username(params[:username])\n end\n end",
"def set_user\n params.delete :matched_desc\n params.delete :host_prep\n params.delete :would_ret\n @user = User.where(user_id: params[:userId])\n end",
"def twitter_user\n @twitter_user ||= prepare_access_token(self.token, self.secret)\n end",
"def set_user\n @user = User.where(:username => params[:id]).first!\n end",
"def set_user\n @user = User.find(params[:id])\n #trying this to address couldn't find id w/user=login error:\n # @user = User.find(user_id)\n end",
"def set_user\n @user = User.find_by(username: params[:username])\n end",
"def set_user\n @user = User.find_by(username: params[:username])\n end",
"def set_user\n @User = User.find_by_username(params[:username])\n end",
"def set_omniauth_user(user)\n # Setup OmniAuth to return the correct metatda for this user.\n OmniAuth.config.add_mock(:twitter, {\n uid: user.uid,\n info: {\n name: user.name\n }\n })\n end",
"def set_user\n if User.exists?(params[:id].to_i)\n @user = User.find(params[:id])\n end\n end",
"def set_user\n id = params[:id] ? params[:id] : params[:user_id]\n @user = User.find(id)\n end",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def set_user\n @user = User.find_by(\"username = ?\", params[:username])\n end",
"def set_user\n user_id = params['user_id']\n @user = user_id ? User.find(user_id) : User.find(1)\n end",
"def set_user\n begin\n @user = User.find(params[:id])\n rescue\n head :not_found\n end\n end",
"def set_user\n @user = User.find(username: params[:username])\n end",
"def set_user\n @user = User.find(params[:id]) if params[:id].present?\n return if @user.present?\n @user = user\n end",
"def set_user\n @user = User.find(params[:user_name])\n end",
"def set_user\n # @user = User.find(params[:id])\n @user = User.find_by_sql(['SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = ? LIMIT 1', params[:id]])[0]\n end",
"def twitter\n unless @twitter_user\n provider = self.authentications.find_by_provider('twitter')\n @twitter_user = Twitter::Client.new(:oauth_token => provider.token, :oauth_token_secret => provider.secret )rescue nil\n end\n @twitter_user\n end",
"def set_user\n @user = User.find(params[:id]) || User.find(params[:user_id])\n end",
"def set_user\n @user = User.includes(:addresses).find_by_username session[:username]\n end",
"def set_user\n user_id = params['user_id']\n @user = user_id ? User.find(user_id) : User.find(1)\n end",
"def set_user\n @user = User.find(params[:id])\n\t \n end",
"def set_user\n @user = User.find(current_user)\n end",
"def set_user\n @user = User.find(current_user)\n end",
"def set_user\n user = User.find(params[:id])\n end",
"def set_user\n user = User.find(params[:id])\n end",
"def set_user\n user = User.find(params[:id])\n end",
"def set_user\n @user = User.find_by(username: params[:username])\n end",
"def set_user\n @user = User.find(params[:user_id])\n if @user.blank?\n res_not_found(:user)\n end\n end",
"def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend",
"def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend",
"def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend",
"def set_user; end",
"def set_user\n \t@user = User.find(params[:uid])\n end",
"def set_user\n @user = User.find_by(params[:id])\n end",
"def set_user\n @user = User.includes(:country, :avatars, resources: :medium).find_by_username!(params[:username])\n end",
"def set_user\n @user = current_agent.users.where('users.username = ?', params[:id]).first\n end",
"def set_t_user\n @t_user = TUser.find(params[:id])\n end",
"def set_user\n \t#to do\n \t#if cookie authentication_token type facebook\n\n \t#elsif cookie authentication_token type email\n\n \t#end\n \t\t\n \t@user = User.find_by(authentication_token: request.headers['Authorization'])\n end",
"def set_user\n logger.debug(params[:id].to_i == 0)\n if params[:id].to_i != 0\n @user = User.find(params[:id])\n else\n @user = User.find_by_vanity_url(params[:id].downcase)\n end\n end",
"def set_user\n @user = User.find( params[:id] )\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def set_user\n @user = User.find(params[:user][:id])\n end",
"def set_user\n @telemarketer = User.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find_by(id: params[:id])\n @user ||= User.find_by(slug: params[:id])\n @user ||= User.find_by id: params[:id]\n end",
"def set_user\n @user = user.find(params[:id])\n end",
"def set_user\n @user = User.find_by_slug(params[:id].downcase)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_interesting_tweet\n @interesting_tweet = InterestingTweet.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @interesting_tweet = InterestingTweet.new do |tweet|\n tweet.username = 'timuruski'\n end\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find_by(user_name: auth_params[:user_name])\nend",
"def set_user\n @user = @application.users.find(params[:id])\n end",
"def set_user\n @user = Users.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end"
] | [
"0.8349216",
"0.8345023",
"0.72438496",
"0.70895934",
"0.70694596",
"0.7068223",
"0.70290947",
"0.7006494",
"0.6889445",
"0.6876138",
"0.6872724",
"0.6866049",
"0.68649864",
"0.68396765",
"0.6833791",
"0.68009865",
"0.6795352",
"0.6794126",
"0.6772457",
"0.676607",
"0.6763045",
"0.6753816",
"0.67433363",
"0.6734042",
"0.67300886",
"0.67300886",
"0.67232686",
"0.67219174",
"0.6705019",
"0.66997343",
"0.6698774",
"0.6698774",
"0.6693165",
"0.6690436",
"0.6681091",
"0.6664014",
"0.666027",
"0.6650062",
"0.66480136",
"0.6639526",
"0.66394365",
"0.6638157",
"0.6632911",
"0.6632703",
"0.6624921",
"0.6624921",
"0.661965",
"0.661965",
"0.661965",
"0.66185826",
"0.6603569",
"0.6600323",
"0.6600323",
"0.6600323",
"0.6595729",
"0.6594237",
"0.659331",
"0.6590421",
"0.6590114",
"0.658649",
"0.6586062",
"0.6583279",
"0.65697324",
"0.6563579",
"0.6563579",
"0.65558106",
"0.65546376",
"0.6553002",
"0.65462226",
"0.6545846",
"0.65445447",
"0.65445447",
"0.65445447",
"0.65445447",
"0.65445447",
"0.6540839",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.6538467",
"0.6534562",
"0.6531995",
"0.6528782",
"0.6528782",
"0.6528782",
"0.6528782",
"0.6528782",
"0.6528782",
"0.6528782"
] | 0.7091827 | 3 |
Set the Twitter user to find | def term=(term)
@term = term
@twitter_search = nil
load_words
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_twitter_user\n @twitter_user = current_user.twitter_users.find(params[:id])\n end",
"def set_twitter_user\n @twitter_user = TwitterUser.find(params[:id])\n end",
"def set_user\n id = params[:id] == 'me' ? current_user.login : params[:id]\n @user = LDAP::User.find(id)\n end",
"def user=(user)\n @user = user\n @twitter_user = nil\n load_words\n end",
"def set_user\n @user = User.find_by_token!(params[:id])\n end",
"def set_tweet\n @tweet = current_user.tweets.find(params[:id])\n end",
"def set_tweet\n # @tweet = Tweet.find(params[:id])\n @tweet = current_user.tweets.find(params[:id])\n end",
"def set_user\n puts \"STAN THE MANNNNNNNNNNN\"\n @user = User.find(params[:id])\n end",
"def set_tweet\n @tweet = current_user.tweets.find(params[:id])\n end",
"def set_user\n @user = User.find_by(oauth_id: params[:id])\n end",
"def cmd_twitt_set_user(*args)\n\t\t\t\tif args.length > 0\n\t\t\t\t\tprint_status(\"Setting the DM target user to #{args[0]}\")\n\t\t\t\t\t@user = args[0]\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Please provide a value\")\n\t\t\t\tend\n\t\t\tend",
"def set_user\n @user = User.find_by(auth0_id: auth_token[0]['sub'])\n end",
"def twitter_user\n @twitter_user ||= TwitterClient.new.user(@user)\n end",
"def set_tw_usuario\n @tw_usuario = TwUsuario.find(params[:id])\n end",
"def set_user\n begin\n @user = User.find_by name: params[:id]\n rescue Mongoid::Errors::DocumentNotFound\n begin\n @user = User.find_by email: params[:id]\n rescue Mongoid::Errors::DocumentNotFound\n @user = nil\n end\n end\n end",
"def set_user\n @user = User.find_by(username: params[:id])\n end",
"def set_user\n @user = User.find(params[:id]) or not_found\n end",
"def set_user\n @user = User.find(user_id)\n end",
"def set_user\n @user = User.find(params[:last_name] || params[:id])\n end",
"def set_user\n @user = User.where(username: params[:username]).take\n end",
"def set_user\n if !(User.where(id: params[:id]).empty?)\n @user = User.find(params[:id])\n else\n @user = User.find_by_username(params[:username])\n end\n end",
"def set_user\n params.delete :matched_desc\n params.delete :host_prep\n params.delete :would_ret\n @user = User.where(user_id: params[:userId])\n end",
"def twitter_user\n @twitter_user ||= prepare_access_token(self.token, self.secret)\n end",
"def set_user\n @user = User.where(:username => params[:id]).first!\n end",
"def set_user\n @user = User.find(params[:id])\n #trying this to address couldn't find id w/user=login error:\n # @user = User.find(user_id)\n end",
"def set_user\n @user = User.find_by(username: params[:username])\n end",
"def set_user\n @user = User.find_by(username: params[:username])\n end",
"def set_user\n @User = User.find_by_username(params[:username])\n end",
"def set_omniauth_user(user)\n # Setup OmniAuth to return the correct metatda for this user.\n OmniAuth.config.add_mock(:twitter, {\n uid: user.uid,\n info: {\n name: user.name\n }\n })\n end",
"def set_user\n if User.exists?(params[:id].to_i)\n @user = User.find(params[:id])\n end\n end",
"def set_user\n id = params[:id] ? params[:id] : params[:user_id]\n @user = User.find(id)\n end",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def set_user\n @user = User.find_by(\"username = ?\", params[:username])\n end",
"def set_user\n user_id = params['user_id']\n @user = user_id ? User.find(user_id) : User.find(1)\n end",
"def set_user\n begin\n @user = User.find(params[:id])\n rescue\n head :not_found\n end\n end",
"def set_user\n @user = User.find(username: params[:username])\n end",
"def set_user\n @user = User.find(params[:id]) if params[:id].present?\n return if @user.present?\n @user = user\n end",
"def set_user\n @user = User.find(params[:user_name])\n end",
"def set_user\n # @user = User.find(params[:id])\n @user = User.find_by_sql(['SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = ? LIMIT 1', params[:id]])[0]\n end",
"def twitter\n unless @twitter_user\n provider = self.authentications.find_by_provider('twitter')\n @twitter_user = Twitter::Client.new(:oauth_token => provider.token, :oauth_token_secret => provider.secret )rescue nil\n end\n @twitter_user\n end",
"def set_user\n @user = User.find(params[:id]) || User.find(params[:user_id])\n end",
"def set_user\n @user = User.includes(:addresses).find_by_username session[:username]\n end",
"def set_user\n user_id = params['user_id']\n @user = user_id ? User.find(user_id) : User.find(1)\n end",
"def set_user\n @user = User.find(params[:id])\n\t \n end",
"def set_user\n @user = User.find(current_user)\n end",
"def set_user\n @user = User.find(current_user)\n end",
"def set_user\n user = User.find(params[:id])\n end",
"def set_user\n user = User.find(params[:id])\n end",
"def set_user\n user = User.find(params[:id])\n end",
"def set_user\n @user = User.find_by(username: params[:username])\n end",
"def set_user\n @user = User.find(params[:user_id])\n if @user.blank?\n res_not_found(:user)\n end\n end",
"def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend",
"def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend",
"def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend",
"def set_user; end",
"def set_user\n \t@user = User.find(params[:uid])\n end",
"def set_user\n @user = User.find_by(params[:id])\n end",
"def set_user\n @user = User.includes(:country, :avatars, resources: :medium).find_by_username!(params[:username])\n end",
"def set_user\n @user = current_agent.users.where('users.username = ?', params[:id]).first\n end",
"def set_t_user\n @t_user = TUser.find(params[:id])\n end",
"def set_user\n \t#to do\n \t#if cookie authentication_token type facebook\n\n \t#elsif cookie authentication_token type email\n\n \t#end\n \t\t\n \t@user = User.find_by(authentication_token: request.headers['Authorization'])\n end",
"def set_user\n logger.debug(params[:id].to_i == 0)\n if params[:id].to_i != 0\n @user = User.find(params[:id])\n else\n @user = User.find_by_vanity_url(params[:id].downcase)\n end\n end",
"def set_user\n @user = User.find( params[:id] )\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def set_user\n @user = User.find(params[:user][:id])\n end",
"def set_user\n @telemarketer = User.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find_by(id: params[:id])\n @user ||= User.find_by(slug: params[:id])\n @user ||= User.find_by id: params[:id]\n end",
"def set_user\n @user = user.find(params[:id])\n end",
"def set_user\n @user = User.find_by_slug(params[:id].downcase)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_interesting_tweet\n @interesting_tweet = InterestingTweet.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @interesting_tweet = InterestingTweet.new do |tweet|\n tweet.username = 'timuruski'\n end\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n @user = User.find_by(user_name: auth_params[:user_name])\nend",
"def set_user\n @user = @application.users.find(params[:id])\n end",
"def set_user\n @user = Users.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end",
"def set_user\n @user = User.friendly.find(params[:id])\n end"
] | [
"0.8349216",
"0.8345023",
"0.72438496",
"0.7091827",
"0.70895934",
"0.70694596",
"0.7068223",
"0.70290947",
"0.7006494",
"0.6889445",
"0.6876138",
"0.6872724",
"0.6866049",
"0.68649864",
"0.68396765",
"0.6833791",
"0.68009865",
"0.6795352",
"0.6794126",
"0.6772457",
"0.676607",
"0.6763045",
"0.6753816",
"0.67433363",
"0.6734042",
"0.67300886",
"0.67300886",
"0.67232686",
"0.67219174",
"0.6705019",
"0.66997343",
"0.6698774",
"0.6698774",
"0.6693165",
"0.6690436",
"0.6681091",
"0.6664014",
"0.666027",
"0.6650062",
"0.66480136",
"0.6639526",
"0.66394365",
"0.6638157",
"0.6632911",
"0.6632703",
"0.6624921",
"0.6624921",
"0.661965",
"0.661965",
"0.661965",
"0.66185826",
"0.6603569",
"0.6600323",
"0.6600323",
"0.6600323",
"0.6595729",
"0.6594237",
"0.659331",
"0.6590421",
"0.6590114",
"0.658649",
"0.6586062",
"0.6583279",
"0.65697324",
"0.6563579",
"0.6563579",
"0.65558106",
"0.65546376",
"0.6553002",
"0.65462226",
"0.6545846",
"0.65445447",
"0.65445447",
"0.65445447",
"0.65445447",
"0.65445447",
"0.6540839",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.65392655",
"0.6538467",
"0.6534562",
"0.6531995",
"0.6528782",
"0.6528782",
"0.6528782",
"0.6528782",
"0.6528782",
"0.6528782",
"0.6528782"
] | 0.0 | -1 |
Get the words from the file | def load_words
case @strategy
when :user
@words = twitter_user.status.text.split(/\s/)
when :search
@words = twitter_search(@term).statuses.map(&:text).join(" ").split(/\s/)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def words_from_file( f )\n result = Array.new\n File.foreach( f ) do | line |\n result << self.words_from_string( line )\n end\n result.flatten\n end",
"def prepare_words(filename)\n @words = []\n File.readlines(filename).each do |line|\n line.split.each {|word| @words << word}\n end\n end",
"def load_words\n File.readlines(\"#{WORD_DIR}/#{language}.txt\").map(&:strip)\n end",
"def load_words\n File.read(\"../scrabble word cheat/words.txt\").split(\"\\n\")\nend",
"def read_words(dictionary)\n unless FileTest.file?(dictionary)\n p \"Provided #{dictionary} is not a filepath or such file doesn't exist.\"\n return []\n end\n\n words = []\n IO.foreach(dictionary) { |line| words << line.strip }\n words\n end",
"def load_words(file_name)\n words_loaded = []\n File.open(file_name).readlines.each do |line|\n words_loaded << line if line.length.between?(5, 12)\n end\n words_loaded\n end",
"def words_file(words)\n File.read(words).lines.select do |l|\n (3..9).cover?(l.strip.size)\n end\n end",
"def get_spelling_words(file)\n lines = IO.readlines(file).map(&:chomp)\n review_word = false\n challenge_word = false\n words = []\n lines.each do |line|\n if md=line.match(/\\A(\\d+)\\.\\s+(\\w+)\\Z/)\n (num, word) = md.captures\n words << SpellingWord.new(num, word, review_word, challenge_word)\n elsif line.match(/\\AReview Words/)\n review_word = true\n challenge_word = false\n elsif line.match(/\\AChallenge Words/)\n challenge_word = true\n review_word = false\n end\n end\n words\nend",
"def read_word_file(file)\n\t\tFile.foreach(file) do |line|\n\t\t\tif(@@word.legal?(line.chomp)) # Check if current line/word is legal\n\t\t\t\tLEGAL_WORDS << line.chomp # Add line/word to array of legal words\n\t\t\tend\n end\n LEGAL_WORDS.freeze # Freeze LEGAL_WORDS to make it immutable\n\tend",
"def wordlist(filename)\n wordlist = []\n File.foreach(filename) { |x| wordlist << x.delete!(\"\\r\\n\") }\n wordlist\nend",
"def add_words_from_text_file(file_path)\n words = []\n\n File.open(file_path, 'r') do |file|\n file.each do |line|\n words.push(line.chomp)\n end\n end\n\n add_words(words)\n end",
"def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/, \" \").split\nrescue\n puts \"Please provide the following file: #{text_file}\"\n exit\nend",
"def load_dict\n words = []\n File.open(\"dict.txt\").each do |line| # Hard code for now\n if line.length.between?(5, 12)\n words << line.rstrip.downcase\n end\n end\n words\n end",
"def ReadFromFile()\n wordArray = Array.new\n File.open(\"mastermindWordList.txt\", \"r\") do |file| # Uncomment this to have a larger list (466000+ words)\n # Note: Only use if in original repository that contains words.txt\n # File.open(\"mastermindWordList.txt\", \"r\") do |file| # Comment this if previous line is uncommented\n file.each_line do |word|\n if CheckValidWord(word) == true\n wordArray.push(word.chomp.downcase)\n end\n end\n end\n return wordArray\nend",
"def word_list\n @word_list ||= Set.new File.read(\"dictionary.txt\").split(\"\\n\").map(&:downcase)\n end",
"def words\n word_list = @lines.map do |line|\n line.split(\" \")\n end\n word_list.uniq\n end",
"def sample_word file\n words = []\n File.open(file).readlines.each do |line|\n words << line\n end\n\n words = words.select{ |word| word.length.between?(5,12) }\n words.sample.chomp\n end",
"def words\n @content.split\n end",
"def words\n @content.split\n end",
"def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/, \" \").split\nrescue\n puts \"Give me #{text_file} and let's get the party started!\"\n exit\nend",
"def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/,\" \").split\nrescue\n puts \"Give me #{text_file} and let's get the party started\"\n exit\nend",
"def read_word_file\n File.open(\"5desk.txt\").each { |line| @text_file << line }\n end",
"def LoadFile ()\n\t\n\tinput = \"\"\n\tFile.foreach(\"../Data Files/042-Words.txt\") {|x| input = x }\n\tnames = input.split(\",\")\n\t\n\treturn names;\nend",
"def unixWords(inputFile)\n\t\ttext = File.open(inputFile).read\n\t\twords = []\n\t\ttext.each_line do |line|\n\t\t\twords.push(line.gsub(\"\\n\",\"\"))\n\t\tend\n\t\treturn words\n\tend",
"def get_the_word\n words = File.readlines(\"5desk.txt\")\n words = words.map do |word|\n word.strip\n end\n words = words.select do |word|\n (word.length > 4) && (word.length < 13)\n end\n words.sample.upcase.split(\"\")\n end",
"def words\n self.scan(WORD_PATTERN)\n end",
"def read_content(file)\n\t\tcontent = []\n\t\tfile.each do |f|\n\t\t\tif File.file?(f)\n\t\t\t\tFile.open(f, \"r\") do |f|\n\t\t\t\t\tword = \"\"\n\t\t\t\t\tf.each_line do |line|\n\t\t\t\t\t\tword += \"#{line}\"\n\t\t\t\t\tend\n\t\t\t\t\tcontent += [word]\n\t\t\t\tend\n\t\t\tend\t\t\t\n\t\tend\n\t\treturn calculate_content(content)\n\tend",
"def get_stopword_list\n list = []\n \n begin\n File.open(\"stopwords.txt\", \"r\") do |file|\n file.each_line { |line| list.push( line.chomp ) }\n end\n rescue\n puts \"The file 'stopwords.txt' was not found.\"\n exit\n end\n\n return list\nend",
"def scanner\n @sentences ||= File.open(@path) do |file|\n file.each_line.each_with_object([]) do |line, acc|\n stripped_line = line.strip\n\n unless stripped_line.nil? || stripped_line.empty?\n acc << line.split(' ').map do |word|\n word.split('/').first\n end.join(' ')\n end\n end\n end\n\n end",
"def get_word\n words = File.readlines(\"lib/5desk.txt\")\n words.each { |word| word.chomp! }\n words_list = words.select { |word| word.length.between?(5, 12)}\n\n words_list.sample.downcase.split(\"\")\n end",
"def get_word\n\t\tbegin\n\t\t File.readlines(DICTIONARY_FILENAME).\n\t\t select { |word| word.length.between?(6, 13) }.sample.chomp\n\t\trescue\n\t\t\tputs \"Unable to read from file '#{ DICTIONARY_FILENAME }'.\"\n\t\t\tnil\n\t\tend\n\tend",
"def analyse(file_path)\n fixed = 0\n words = []\n File.open(file_path, \"r:iso-8859-1\") do |f|\n words = f.readlines(sep=\" \")\n words.dup.each_with_index do |word, i|\n word.delete!(\" \")\n match, dist = @tree.best word.downcase\n if !match.nil? && dist != 0\n fixed+=1\n words[i] = capitalize_if_needed(word, match)\n # puts \"#{word} - #{match}\"\n end\n end\n end\n # print \"file: #{file_path}\\nwords: #{words.size}\\nfixed words:#{((fixed.to_f/(words.size).to_f)*100).round(2)}%\\n\"\n save words, file_path\n end",
"def readwordfile name\r\n\t\t \tl_num=0\r\n\t\t File.open(name).each do |l|\r\n\t\t \t@wordtable[l_num] = l.gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\r\n\t\t l_num +=1\r\n\t\t end\r\n\t\t return l_num\r\n\t\t end",
"def make_list\n file = File.new(\"dictionary.txt\")\n dict_list = Array.new\n # add all the words that are the same length as the user's word to an array\n while (line = file.gets)\n if (line.length - 1 == @word1.length)\n dict_list.push line.chomp\n end\n end\n dict_list\n end",
"def get_words(line)\n ### FILL IN YOUR CODE HERE\n if line == nil\n \n else\n words = line.split(/ +/)\n words\n end\n end",
"def get_words(filename)\n graph = Graph.new\n graph = read_file(filename, graph)\n paths = graph.paths\n permutations = permutations(paths)\n wordlist = wordlist('wordlist.txt')\n validwords = real_words(permutations, wordlist)\n puts \"\\nLongest valid word(s): from dictionary\"\n longest_words(validwords, longest_length(validwords))\nend",
"def bannedWords(inputFile)\n\t\ttext = File.open(inputFile).read\n\t\twords = []\n\t\ttext.each_line do |line|\n\t\t\twords.push(line.gsub(\"\\r\\n\",\"\"))\n\t\tend\n\t\treturn words\n\tend",
"def scan\n $stderr.print \"[words] \"\n\n files.each do |file|\n if $DEBUG\n $stderr.print \"\\n[scan] #{file}\"\n else\n $stderr.print \".\"\n end\n\n text = File.read(file).gsub(\"\\n\", \" \")\n states = text.split(/[.,:;?!()\"]\\s*/)\n\n states.each do |state|\n state.scan(WORD) do |word|\n word = normalize(word)\n if valid_word?(word)\n\t\t self[word] ||= Word.new(word)\n\t\t self[word].file!(file)\n end\n end\n end\n end\n\n $stderr.puts\n end",
"def generate_words\n ret = []\n\n File.open('enable.txt').each do |line|\n new_line = line\n # We don't care for the new line character in the game of hangman.\n new_line = new_line.delete(\"\\n\")\n ret << new_line\n end\n\n return ret\nend",
"def load_word_list\n @word_list = []\n puts \"Loading word list...\"\n File.readlines(WORDLIST_FILE).each{|word|\n word.gsub!(/[\\r\\n]+/,\"\")\n if valid_word?(word, @inner_letter, @outer_letters)\n @word_list << word\n end\n }\n @word_list.sort!\n puts \"Word list loaded.\"\n end",
"def words\n scrabble_words = File.readlines(\"words.txt\")\n scrabble_words.map { |x| x.delete(\"\\n\") }\nend",
"def read_tokens()\n\n # By adding @ to tokens, we're saving it also in the instance. We're not\n # going to use that, but it might be useful later.\n @tokens = []\n\n File.open(@filename) do |input_file|\n input_file.each do |line|\n line.split.each do |word|\n word = normalize(word)\n @tokens << word unless word.empty?\n end\n end\n end\n\n @tokens\n end",
"def words\n file = File.open(\"words.txt\")\n words = file.read.split(\",\").map { |x| x.gsub(\"\\\"\", \"\") }\n file.close\n words\nend",
"def wordlist\n # Split defaults to splitting on white space\n File.read(File.expand_path('../data/subdomains.txt', __FILE__)).split\n end",
"def getStopWordsSet(path)\n unless caller[0].include? \"frequencies\"\n return\n end\n Set.new(open(path){|f| f.read}.split(\",\")).merge( Set.new( ('a' .. 'z').to_a ))\nend",
"def get_word_list\n @word_list = @lines.reject do |line|\n line.length < 5 || line.length > 12\n end\n end",
"def read_files\r\n @prefixes = IO.read('prefixes.txt').split(' ')\r\n @syllables = IO.read('syllables.txt').split(' ')\r\n @postfixes = IO.read('postfixes.txt').split(' ')\r\n end",
"def words\n @words ||= (\n load_words(1000) || corpus.words.to_h(1000)\n )\n end",
"def read_file(path)\n lines = []\n count = 0\n vocab = Set.new\n File.open(path, \"r:ISO-8859-1\").each do |line|\n line = line.strip\n vocab.merge(parse_vocab(line))\n lines << line\n count += 1\n end\n return lines, vocab\nend",
"def extract\n parse_word_boundaries(file_content).to_json\n end",
"def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend",
"def load_words\n words = []\n\n begin\n sql = \"SELECT word_id, spelling, count FROM Words;\"\n stm = @db.prepare sql\n rs = stm.execute\n\t\t while (row = rs.next) do\n\t\t id, s, c = *row\n\t\t words << Word.new(s, :count=>c, :id=>id)\n\t\t end\n ensure\n stm.close\n end\n\n begin \n sql = \"SELECT file_path, file_count FROM WordFiles WHERE word_id = ?\"\n stm = @db.prepare sql\n\n\t\t words.each do |w|\n\t\t rs = stm.execute(w.id)\n\t\t files = {}\n\t\t while (row = rs.next) do\n\t\t path, count = *row\n\t\t files[path] = count\n\t\t end\n\t\t w.files = files\n\t\t end\n ensure\n stm.close\n end\n\n return words\n end",
"def read()\n a=[]\n f=open(\"words.txt\")\n f.each_line {|line|\n a[a.length]=line.chomp}\n f.close\n return a\nend",
"def create_dict(file)\n # Since wordlist is constant\n if File.file?(file)\n IO.readlines(file, chomp: true)\n else\n puts 'File not found!'\n end\n end",
"def get_random_word(filename)\n dictFile = File.open filename\n words = dictFile.readlines.reduce([]) do |words, word|\n if word.strip!.length >= 8\n words << word\n end\n words\n end\n words[(rand words.length)]\nend",
"def textualed\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.downcase }\n while a = full_list.shift\n puts a unless nil? \n end\n end",
"def load(file)\n words = File.readlines(file)\n words = words.collect {|word| Word.new(word.chomp.downcase) }\n change_wordlist(words.select {|word| word.word.length >= 5 && word.word =~ /^([a-z])+$/ })\n self\n end",
"def words\n\t\tscan(/\\w[\\w\\'\\-]*/)\n\tend",
"def populate(file)\n words = file.split(\"\\n\")\n insert_words(words)\n end",
"def words\n return @words if @words\n @words = []\n charno = self.charno\n text.scan(/(\\s*)(\\S*)/)[0..-2].each { |spaces, word|\n charno += spaces.size\n @words << [charno, word] if word != \"\"\n charno += word.size\n }\n @words\n end",
"def words\n scan(/\\w[\\w'\\-]*/)\n end",
"def initialize\n self.word_list = []\n WORD_FILES.each do |word_file|\n contents = File.read(File.dirname(__FILE__)+word_file)\n self.word_list = word_list + contents.split(/\\n/)\n end\n end",
"def lookup(word)\n word.gsub!(/\\s/, \"+\")\n meaning_file = initialize_files(word)[0]\n f = File.open(meaning_file)\n begin\n extract_text(f)\n rescue Exception\n raise\n end\n\n end",
"def set_word_list\n word_list = []\n min_length = 5\n max_length = 12\n # Fixed external word_list file has only one word per line\n if File.exist? \"../word_list.txt\"\n File.open(\"../word_list.txt\").each do |line|\n line_clean = line.chomp\n if (line_clean.length >= min_length && line_clean.length <= max_length)\n word_list.push(line_clean)\n end\n end\n else\n word_list.push(\"FileWordListTextDoesNotExist\")\n end\n return word_list\n end",
"def run\n load_the_file\n word_frequency\n match_the_word\n end",
"def read_stop_words\n # Meta-level: caller & caller_locations (inspect.stack in python)\n # p caller\n # p caller_locations.last(5).inspect\n if caller_locations[-3].label != 'extract_words'\n p caller_locations.last(5).inspect # just for debug\n return nil\n end\n stop_words = File.open('/Users/ravil/experimental/exips/stop_words.txt').read.split(',')\n stop_words += 'abcdefghijklmnopqrstuvwxyz'.chars\n stop_words\nend",
"def get_word_from_dictionary(filename)\n words = File.readlines(filename, chomp: true) # read in dictionary\n # get only valid length words\n valid_words = words.select do |word|\n word.length >= 5 && word.length <= 12\n end\n # choose a random valid_word\n valid_words.sample\n end",
"def read_file\n\t\t\treturn 'wordlists/reverse_ip.txt'\n\t\tend",
"def words\n @words\n end",
"def stopwords\n @stopwords ||= IO.readlines(@stopwords_file).map { |l| l.strip }\n end",
"def words\n terms.collect { |t| t.word }\n end",
"def get_word\r\n\t # Variable initialization\r\n\t wordArray = []\r\n\t count = 0\r\n\t random_int = 0\r\n\t \r\n\t # Stores each word that is on a new line into an array\r\n\t f = File.open(\"5desk.txt\", \"r\")\r\n\t f.each_line{ |line| wordArray << line }\r\n\t f.close\r\n\t \r\n\t # Selects the random word between the desired length of between 5 and 12 characters. \r\n\t # Note that this includes an extra delimiter at the end of each word\r\n\t until wordArray[random_int].length > 5 && wordArray[random_int].length < 14 do\r\n\t random_int = Random.new.rand(0..61405)\r\n\t end\r\n\t wordArray[random_int].chomp!\r\n\tend",
"def getWord()\n\tFile.open(\"./corncob_lowercase.txt\"){|f|\n\t\tline=nil\n\t\trand(1..58110).times{line=f.gets}\n\t\tputs line\n\t\treturn line.chomp()\n\t}\nend",
"def valid_words\n return @valid_words if @valid_words && @valid_words.length > 0\n\n @valid_words = Set.new\n @io.each_line do |l|\n l.encode!('UTF-8', 'UTF-8', invalid: :replace, undef: :replace, replace: '')\n # Funny story, in place methods are faster.\n l.gsub!(/[^[:alnum:]^[:blank:]]/, \"\")\n l.downcase!\n l.strip!\n # Only 'short' words (discard numbers only)\n l.split(\" \").reject{|w| /\\A\\d+\\z/.match(w) || w.length < 3 || w.length > 10}.each do |w|\n @valid_words.add(w)\n end\n end\n @valid_words\n end",
"def possible_words\n\t\t\t@dictionary.grep to_r\n\t\tend",
"def necessary_spellings\n spellings = []\n if necessary_file\n File.readlines(necessary_file).each do |line|\n line.strip!\n spellings << line unless line == \"\"\n end\n end\n spellings\n end",
"def read_stopwords_file(filename)\n stopwords = []\n CSV.foreach(filename) do |row|\n stopwords << row[0]\n end\n stopwords\n # puts \"loaded \" + stopwords.length.to_s + \" stopwords.\"\n end",
"def words\n scan(/\\S+/)\n end",
"def initialize(word_list_file_path)\n word_list = ::File.readlines(word_list_file_path).map(&:chomp)\n @words = word_list.map(&:downcase)\n end",
"def words\n @words ||= text.split(/\\s/).delete_if { |word| word.length.zero? }\n end",
"def words_from_string( line )\n result = Array.new\n words = line.split\n if words.size > 0\n words.each { | word | result << word }\n else\n result << \"\\n\"\n end\n result\n end",
"def initialize file\n word_set = Set.new\n\n File.open(file, \"r\") do |f|\n f.each_line do |raw_line|\n line = raw_line.strip.upcase\n\n if HangmanGame.acceptable_word? line\n word_set.add line\n end\n end\n end\n\n @words = word_set.to_a.freeze\n\n Random.srand\n end",
"def load_stopwords_file(file) \n stop_words = {}\n\n # Looping through the file and adding each word to a hash table after chomping them\n File.open(file, \"r\").each_line do |line|\n stop_words[line.chomp] = 1\n end\n\n return stop_words\n\nend",
"def proper_length_words\n proper_length = lambda { |line| line.length.between?(5, 12) }\n words = @file_contents.select(&proper_length)\n end",
"def initialize\n @words_set = Set.new\n words_file = File.expand_path(File.dirname(__FILE__) + '/words.txt')\n File.readlines(words_file).each do |line|\n @words_set.add(line.to_s.strip)\n end\n end",
"def stopwords\n @stopwords ||= IO.readlines(@stopwords_file).map { |l| l.strip }\n end",
"def list\n file_correct?(@file_path)\n file = File.open(@file_path)\n file.map { |row| row.split(' ') }\n end",
"def stopwords\n @stopwords ||= IO.readlines(@stopwords_file).map { |l| l.strip }\n end",
"def pick_random\n random_word = nil\n File.open(\"words.txt\") do |file|\n file_lines = file.readlines()\n random_word = file_lines[Random.rand(0...file_lines.size())]\n end\n return random_word\n end",
"def print_wordfiles\r\n puts '\\n'\r\n puts 'Wordfiles avaliable for use:'\r\n puts '\\n'\r\n get_wordfile_names.each do |filename|\r\n puts filename\r\n end\r\n end",
"def load_stopwords_file(file)\n f = File.open(file, \"r\")\n stopwordH = {}\n f.each_line do |stopword|\n stopwordH[stopword] = 0\n end\n return stopwordH\nend",
"def file_reader file_name\n @words_count = {}\n File.read(file_name).each_line{ |line| count_words( line.split(',')[2] ) }\n hash_to_file(@words_count, file_name)\nend",
"def words\n []\n end",
"def choose_word\n input = File.open(\"words.txt\", 'r')\n words = []\n input.readlines.each do |line|\n words.push(line.strip().downcase)\n end\n input.close()\n words[rand(words.length)]\n end",
"def init_word_array(plaintext_file)\n ary = File.read(plaintext_file).split(\" \").map do |word|\n word.downcase.gsub(/[^a-z]/, '')\n end\n return ary\n end",
"def get_words\n @sentences.each_index do |i|\n s = @sentences[i]\n words = s.split(' ')\n words.each do |w|\n word = w.gsub(WORD_SANITIZE, '').downcase\n if belongs_to_known_abbreviations? word\n add_word_to_result(word, i)\n else\n add_word_to_result(word.gsub(DOT_SANITIZE, ''), i)\n end\n end\n end\n end",
"def generate_words\r\n words = Hash.new\r\n\r\n # TODO - add error handling\r\n dictionary = \"bigdict.txt\"\r\n dictionary = \"test.txt\" if DEBUG\r\n \r\n # for benchmarking purposes, we search 80k records in about 1 second. mindblowing increase in computing power since 1980!\r\n time = Time.new\r\n\r\n File.foreach dictionary do |word|\r\n word.chomp!\r\n words[word] = score_word(word) if valid_word?(word)\r\n end #end file.each\r\n\r\n time = Time.new - time\r\n\r\n # output all words in descending score value\r\n words.sort_by { |word, score| score }.reverse.each do |result|\r\n puts \"#{result[0]} - #{result[1]}\"\r\n end\r\n\r\n puts \"Found #{words.length} words in #{time} seconds\"\r\nend",
"def parse_vocabulary1\n json = File.read(VOCABULARY_FILE)\n object = JSON.parse(json)\n result = []\n (1..6).each do |i|\n result.push(object[\"LEVEL#{i}\"][\"words\"])\n end\n result\n end",
"def display_words\n words = self.dictionary.map do |dictionary_entry|\n dictionary_entry.word.lexical_item\n end\n words \n end",
"def words\n @words\n end"
] | [
"0.8049222",
"0.7622496",
"0.753984",
"0.7527045",
"0.74274397",
"0.7357578",
"0.7262832",
"0.7232927",
"0.7181514",
"0.7048082",
"0.7045214",
"0.7034308",
"0.7008517",
"0.6906711",
"0.6897604",
"0.68760556",
"0.6840481",
"0.6836829",
"0.6836829",
"0.6827689",
"0.6820445",
"0.6792855",
"0.6770606",
"0.6746488",
"0.671995",
"0.6716041",
"0.6713162",
"0.6705392",
"0.66834533",
"0.6667954",
"0.6604026",
"0.65883833",
"0.65781105",
"0.6565328",
"0.65557283",
"0.6550955",
"0.6541159",
"0.65276223",
"0.6519188",
"0.64998627",
"0.6492789",
"0.6472033",
"0.6460105",
"0.6446244",
"0.64313513",
"0.6376928",
"0.637218",
"0.63694084",
"0.63589376",
"0.63157445",
"0.6312192",
"0.63084906",
"0.6307154",
"0.62965083",
"0.6281119",
"0.62547493",
"0.6191988",
"0.6184835",
"0.6164837",
"0.6155908",
"0.6149896",
"0.61449283",
"0.6144037",
"0.6137255",
"0.61274517",
"0.6126046",
"0.61066854",
"0.61004525",
"0.60964084",
"0.60935503",
"0.60800344",
"0.6075913",
"0.60695463",
"0.6067977",
"0.6060345",
"0.6058657",
"0.60513216",
"0.60381544",
"0.6037871",
"0.60202867",
"0.6019187",
"0.60187095",
"0.60157454",
"0.6015661",
"0.60139614",
"0.60128033",
"0.6012611",
"0.60120165",
"0.60024667",
"0.5993167",
"0.59564376",
"0.5954281",
"0.5942063",
"0.59362835",
"0.5934169",
"0.59278256",
"0.5924966",
"0.59199005",
"0.59132576",
"0.5910249"
] | 0.6163481 | 59 |
Return a search result from Twitter | def twitter_search(term)
TwitterClient.new.search(term)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_twitter()\n search_call = \"#{@api_endpoint_twitter}?ors=#{@search_term}&result_type=#{@result_type}&rpp=#{@results_per_page}\"\n @response = http_get search_call\n end",
"def twitter_search\n @search = TwitterAuthor.client.user_search(params[:twitter_search]).collect\n flash[:notice] = \"Search results for \\\"#{params[:twitter_search]}\\\"\"\n render :twitter_search_results\n end",
"def search_twitter(term, options, nb_results)\n $client_rest.search(term, options).take(nb_results).each do |tweet|\n if tweet.is_a?(Twitter::Tweet)\n puts tweet.text\n #spam(tweet)\n end\n end\n end",
"def search\n \t@whosaidit = params[:whosaidit]\n \t@query = params[:query]\n\n if params[:enableRT] == true\n @RToption = \"-RT\"\n else\n @RToption = \"\"\n end\n\n \t# user and keyword\n \t# @tweets = $twitter.search(\"to:#{@whosaidit} \"+ @query + \" filter:images\").take(20)\n\n \t# just keyword\n \t# @tweets = $twitter.search(@query + \" filter:images\").take(20)\n\n \t# just user\n \t@tweets = $twitter.search(\"from:#{@whosaidit}\" + \" filter:images \"+\"#{@RToption}\").take(30)\n \n \t# puts @tweets.first.inspect\n \t@twitteranalysis = \"\"\n \trender \"index\"\n end",
"def search_twitter(term, options, nb_results)\n $client_rest.search(term, options).take(nb_results).each do |tweet|\n if tweet.is_a?(Twitter::Tweet)\n puts tweet.text\n spam(tweet)\n end\n end\n end",
"def search_twitter(query)\n \n url = \"http://search.twitter.com/search.json\"\n \n if (not query.q.nil? and not query.q.empty?) and (not query.from_user.nil? and not query.from_user.empty?)\n url << \"?q=\" + CGI.escape(query.q) + \"+from%3A\" + CGI.escape(query.from_user)\n elsif query.q.nil? or query.q.empty?\n url << \"?q=from%3A\" + CGI.escape(query.from_user)\n elsif query.from_user.nil? or query.from_user.empty?\n url << \"?q=\" + CGI.escape(query.q)\n end\n \n url << \"&lang=\" + CGI.escape(query.lang) if not query.lang.nil? and not query.lang.empty?\n url << \"&rpp=\" + query.rpp.to_s\n url << \"&since=\" + \"%04d-%02d-%02d\" % [query.since.year, query.since.month, query.since.day] if not query.since.nil?\n \n JSON.parse(open(url).read)['results']\n end",
"def search\n @tweets = TwitterClient.search(params[:query], result_type: 'recent').take(20)\n render json: @tweets\n end",
"def print_twitter_search(tweets)\n #puts JSON.pretty_generate(tweet)\n tweets.each do |tweet|\n puts tweet[\"text\"] \n end \n end",
"def url\n \"http://twitter.com/search/?q=\" + self.query\n end",
"def search\n result = q.present? ? TWITTER.search(q, options) : []\n result = result.take(count.to_i) if result.present? && count.present?\n result\n end",
"def retweet search_for\n\t\tlast_verified = File.open 'last_verified', 'r+'\n\t\tlast_id = last_verified.read.gsub(\"\\000\", '')\n\t\tlast_id = 0 if last_id.empty?\n\t\tsearch_terms = search_for.join ' OR '\n\t\ttweets = Twitter::Search.new.containing(search_terms).since_id(last_id).not_from(@account[:name]).not_from('StrikeRH1').fetch.collect do |t|\n\t\t\tt.id unless t.text[0,1] == '@'\n\t\tend.compact\n\n\t\tif tweets.length > 0\n\t\t\ttwitter = get_twitter_client\n\t\t\ttweets.each do |id|\n\t\t\t\tbegin\n\t\t\t\t\ttwitter.retweet id\n\t\t\t\trescue Twitter::Forbidden\n\t\t\t\tend\n\t\t\tend\n\t\t\tlast_verified.truncate 0\n\t\t\tlast_verified.write tweets[0]\n\t\tend\n end",
"def search_tweets(result_type, number_of_responses)\n \n searchORstring = @searchArray.map { |hashtagElement| hashtagElement.to_s + \" OR\"}.join(\" \")\n search = @twitter_client.search(searchORstring, result_type: result_type).take(number_of_responses)\n\n if search.empty? == false\n search.each do |tweet|\n @tweets << tweet\n end\n else\n raise('Your search returned no tweets')\n end\n @tweets\n end",
"def user_tweet\n get_tweets params[:Enter_what_you_want_to_search]\n respond_to do |format|\n format.html \n format.json \n end\n \nend",
"def getTwitters(searchTerm)\n # url encoding the searchterm\n searchTerm = CGI::escape(searchTerm)\n \n # grabbing the search results for the given searchTerm from summize as a REXML document\n doc = REXML::Document.new open(\"http://summize.com/search.atom?lang=en&rpp=100&q=#{searchTerm}\").read\n \n # this part swaps the current @content stack with the search result\n @content.clear {\n doc.elements.each(\"feed/entry\") do |element|\n stack(:width => 500, :height => 80) do\n fill \"#282828\"..\"#141414\", :angle => 180\n rect 0, 0, 500, 80, 5\n flow(:margin_left => 5, :margin_top => 5) do\n flow(:width => 50) do\n #clicking on avatar => visit the person's twitter profile in a webbrowser\n click do\n visit(element.elements['author'].elements['uri'].text)\n end\n \n element.each_element_with_attribute('rel', 'image', 1) do |pic|\n image pic.attributes['href'] # downloads and displays avatar\n end\n end\n flow(:width => 440) do\n # clicking on message => visit the message on twitter in a webbrowser\n click do\n element.each_element_with_attribute('rel', 'alternate', 1) do |profile|\n visit(profile.attributes['href'])\n end\n end\n \n inscription getFormattedTime(element.elements[\"published\"].text), :stroke => orange\n para element.elements[\"title\"].text, :stroke => white\n end\n end\n end\n end\n }\n end",
"def show\n @word = Word.find(params[:id])\n if current_user.authentications[2]==\"twitter\"\n @tweet_search = current_user.twitter.search(@word.word)\n else\n @tweet_search\n end\n end",
"def search\n token = current_user.twitter_access_token\n client = Twitter::Client.new oauth_token: token.token, oauth_token_secret: token.secret\n\n @users = client.user_search params['q'], {\n count: params['count']\n }\n\n respond_with @users\n end",
"def fetch_search_results\n response = twitter_account.client.search(query, search_options)\n statuses = response.statuses\n tweets = TweetMaker.many_from_twitter(statuses, project: project, twitter_account: twitter_account, state: state)\n update_max_twitter_id(tweets.map(&:twitter_id).max)\n tweets\n # If there's an error, just skip execution\n rescue Twitter::Error\n false\n end",
"def search(query, count=10)\n cache_key = \"twitter:search:#{query}\"\n cached_tweets = Rails.cache.read(cache_key)\n unless cached_tweets\n tweets = api(SEARCH_URL, CGI.escape(query), count) do |response|\n response['results'][0,count].map do |result|\n transform_search_result result\n end\n end\n if tweets\n Rails.cache.write(cache_key, tweets, :expires_in => 15.minutes)\n cached_tweets = tweets\n end\n end\n cached_tweets || []\n end",
"def get_tweet(search,since_id = 0, throtle = 20)\n\turl = 'http://search.twitter.com/search.json?q='+search+'&rpp='+throtle.to_s+'&since_id='+since_id.to_s\n\tprint \"Asking with this url \" + url+ \"\\n\"\n\tresp = Net::HTTP.get_response(URI.parse(url))\n\tresponse_array = JSON.parse(resp.body)\nend",
"def search_twitter(query, query_size)\n return @client.search(query, since: MegaUltraTweet::Application::TWEETS_SINCE_STRING).take(query_size).to_a\n end",
"def search\n @users = User.search(@search_term)\n @tweets = Tweet.search(@search_term)\n @tags = Tag.search(@search_term)\n end",
"def search_tweets\n results = []\n client = authenticate\n\n # Search tweets using 'twitter' gem\n client.search('100DaysOfCode -rt Day' + @day.to_s, result_type: 'recent')\n .take(5).each do |tweet|\n results.push(tweet.id)\n end\n\n return results\n end",
"def last_tweet\r\n\t\tresult = @client.search(@twitter_search_keyword)\r\n\t\tresult.first.full_text\r\n\tend",
"def twitter_search(skeyword, rec_per_page)\n recs_found = 0\n \n Twitter::Search.new(skeyword).per_page(rec_per_page).each do |r|\n #puts r.inspect\n #puts \"@\" + r.from_user + \": \" + r.text\n #puts \"at \" + r.created_at\n #puts \"......................................................................\"\n #puts\n recs_found = recs_found + 1\n end\n recs_found\nend",
"def search_result\n @search = params[:search]\n query = params[:search] #Query variable is the string a user enters in the search bar.\n url = Addressable::URI.parse('https://api.themoviedb.org/3/search/tv?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n url.query_values = url.query_values.merge(query: query)\n response = HTTParty.get(url)\n @results = JSON.parse(response.body, symbolize_names: true) \n end",
"def search_user(q)\n uri = \"https://api.twitter.com/1/users/search.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"get\",\n :params =>{:q=>q, :include_entities=>\"true\"})\n oauth_helper = OAuth::Client::Helper.new(req, oauth_params.merge(:request_uri => uri))\n sign_request(req,uri)\n hydra = Typhoeus::Hydra.new\n hydra.queue(req)\n hydra.run \n \n profile_list = Array.new\n\n JSON.parse(req.response.body).each do |raw|\n profile_list.push([\n raw[\"id\"].to_s,\n raw[\"profile_image_url\"].to_s,\n raw[\"name\"].to_s,\n raw[\"screen_name\"].to_s]\n )# prepare to cash into database, not sure\n end\n profile_list.sort!{|x,y| x[0]<=>y[0]} \n end",
"def extract_search(tweet)\n tweet.text.downcase.sub('@rijks_bot', '').strip\n end",
"def search_for_mbti\n # search for tweets cotaining #MBTI, #mbti, or 'mbti'\n # save them to DB if the request is valid\n hashtag_res = client.search('#mbti', result_type: 'mixed', count: 100, lang: 'en')\n hashtag_res.take(5).each { |tweet| puts \"#{tweet.user.screen_name}: #{tweet.text}\" }\n save_tweets_to_db(hashtag_res)\n # text_res = client.search('mbti', result_type: 'mixed', count: 100, lang: 'en')\n # text_res.take(5).each { |tweet| puts \"#{tweet.user.screen_name}: #{tweet.text}\" }\n\n #save tweets to DB and save last_tweet_id as max_id so can poll later\n # self.last_tweet_id = hashtag_res.first.id.to_s # || Tweet.last.t_id_str\n end",
"def handle_search(list)\n # Connexion à l'API Twitter avec le Token renseigné dans le .env loadé.\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV['TWITTER_CONSUMER']\n config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']\n config.access_token = ENV['TWITTER_TOKEN']\n config.access_token_secret = ENV['TWITTER_TOKEN_SECRET']\n end\n list.each do |line| # Pour chaque ligne du tableau :\n if line[0] == \"name\" # On skip la première.\n elsif client.user_search(\"ville #{line[0]}\").first # Si on trouve un résultat on l'enregistre 4è valeur du tableau.\n line[3] = client.user_search(\"ville #{line[0]}\").first.screen_name\n else # Si on ne trouve rien on enregistre un blanc.\n line[3] = \"\"\n break if line[0] == \"BUDOS\" # Pour pouvoir effectuer le test arrête à la mairie BUDOS, sinon on finira par se faire kick de l'API Twitter...\n# Afin de continuer à faire tourner le script jusqu'à la fin il faudrait rescue les erreurs \"Too many requests\", mettre un sleep qui relancerait plus tard.\n end\n end\n list\n return final_list = list\nend",
"def index\n query = params[\"query\"]\n unless query.nil? || query == \"\" \n @tweets = Twitter.basic_search(query)\n @wikipedia = Wikipedia.basic_search(query)\n end\n end",
"def search_tweets(hashtag, limit=nil)\n response = @api_client.get(URI::SEARCH_TWEETS_URI, { q: hashtag })\n parse(response[\"statuses\"], Tweet, limit)\n end",
"def search(query, limit)\n unless @twitterclient\n configinit\n end\n options = {\n :count => limit,\n :include_rts => true\n }\n @twitterclient.search(query, options)\n end",
"def search_hashtag tag\r\n response = RestClient.get 'https://api.twitter.com/1.1/search/tweets.json', params: {q: tag, count: 100}, Authorization: 'Bearer AAAAAAAAAAAAAAAAAAAAAJr1YQAAAAAAHA%2FAKcuAEPhPSJgFqwcwKMU0wPk%3DwHtz3CIM3eluP3XQDNfXobhvApEBTpyYeWrJ31ZxUukMm1idUj'\r\n \r\n tweets = Array.new\r\n JSON.parse(response)['statuses'].each do |t|\r\n hashtags = Array.new\r\n t[\"entities\"][\"hashtags\"].each do |h|\r\n hashtags << (\"#\" + h[\"text\"].downcase)\r\n end\r\n tweet={\r\n \"id\" => t[\"id\"],\r\n \"text\" => t['text'],\r\n \"hashtags\" => hashtags\r\n }\r\n tweets << tweet\r\n end\r\n tweets\r\n end",
"def search(options)\n options = DEFAULT_SEARCH_OPTIONS.merge(options)\n\n response = @oauth_requester.GET(\"#{SEARCH_URI}?#{options.to_query}\")\n\n if response\n response.fetch('statuses', []).collect do |tweet|\n @collection << Tweet.new(tweet['id'], tweet['text'], tweet['user']['screen_name'], tweet['created_at'])\n end\n end\n \n return @collection\n end",
"def get_tweets(screen_name, num_tweets)\n\t\n\tresult = \"\"\n #Query num_tweets tweets from screen_name and create the HTML\n Twitter.user_timeline(screen_name, {\"count\" => num_tweets}).each do |tweet|\n \tlinkified = linkifyTweet(tweet.text)\n \tresult = result + \"<li class=\\\"tweet\\\">\n <span class=\\\"gentle\\\">#{linkified}</span>\n </li>\"\n end\n return result\nend",
"def list_tweets\n tweets\n end",
"def search(query)\n response = twitter_user.request(:get, configatron.api_call_url + \"users/search.json?q=#{URI.escape(query)}\")\n \n #\"#{configatron.api_call_url}users/search.json?q=#{URI.escape(query)}&page=#{page}&per_page=#{configatron.page_size}\"\n if response.is_a?(Net::HTTPSuccess)\n get_nicknames_and_names(JSON.parse(response.body))\n end\n end",
"def get_search_timeline_tweets(search_term)\n\n begin\n if @last_tweet_id\n response = ::Twitter.search(search_term, :since_id => @last_tweet_id)\n else\n response = ::Twitter.search(search_term, :result_type => \"recent\", :rpp => 3, :page => 1)\n end\n\n rescue => exc\n return exc\n end\n\n response || []\n\n end",
"def fetch_tweets(criteria)\n @client.filter(track: criteria.theme) do |object|\n puts object.text if object.is_a?(Twitter::Tweet)\n end\n end",
"def index\n\n @tweets = Tweet.tweets_for_me(list_friends()).order(created_at: :DESC).page params[:page]\n \n if params[:q] #REEMPLAZA A RANSACK PARA BUSCAR\n @tweets = Tweet.where('content LIKE ?', \"%#{params[:q]}%\").order(created_at: :DESC).page params[:page]\n\n end\n \n #SOLO APARECERÁN LOS TWEETS A LOS QUE SIGUE EL CURREN USER\n #@tweets = Tweet.tweets_for_me(list_friends()).order(created_at: :DESC).page params[:page]\n #@tweets = Tweet.order(created_at: :DESC).page params[:page]\n \n \n @tweet = Tweet.new\n \n end",
"def response(env)\n env.trace :response_beg\n\n result_set = fetch_twitter_search(env.params['q'])\n\n fetch_trstrank(result_set)\n \n body = JSON.pretty_generate(result_set)\n\n env.trace :response_end\n [200, {}, body]\n end",
"def get_twitter(npo)\n\t\trequire 'net/http'\n\t\trequire 'rexml/document'\n\n begin\n\n res = Net::HTTP.get(URI.parse(\"http://api.twitter.com/1/users/show.xml?screen_name=#{npo.twitter}\"))\n document = REXML::Document.new(res)\n\n if document.root.elements[2]\n document.root.elements[2].expanded_name == 'error' ? nil : npo.twitter\n end\n rescue\n nil\n end\n\tend",
"def search word\n # No need to enclose the following in a EM.run block b/c TweetStream does this when \n # it initializes the client.\n puts \"entering\"\n q = last_search_query(word) \n current_search = next_search(word, q)\n #jump first one beacause of max_id including last one\n q = q.merge(current_search.next_results)\n current_search = next_search(word, q)\n puts \"#{current_search.attrs[:search_metadata]}\"\n while current_search.next_results? do\n current_search.results.each do |tweet|\n unless same_tweet(tweet)\n raw_tweet_to_tweet(tweet, word).save\n end\n end\n q = q.merge(current_search.next_results)\n current_search = next_search(word, q)\n end\n end",
"def index\n query = params[:q]\n respond_to do |format|\n format.html { @tweets_url = query ? \"/tweets.json?q=#{query}\" : '/tweets.json' }\n format.json do\n tweets, has_more =\n if query\n search_result =\n Tweet.search(\n query,\n page: params[:page] || 1,\n per_page: 20,\n includes: [\n { user: { avatar_attachment: %i[blob] } },\n :likes,\n { images_attachments: %i[blob] },\n { comments: { user: { avatar_attachment: %i[blob] } } },\n ],\n )\n [search_result.results, search_result.current_page < search_result.total_pages]\n else\n @pagy, tweets =\n pagy Tweet\n .includes(\n { user: { avatar_attachment: %i[blob] } },\n :likes,\n { images_attachments: %i[blob] },\n { comments: { user: { avatar_attachment: %i[blob] } } },\n )\n .order(created_at: :desc)\n [tweets, @pagy.page < @pagy.pages]\n end\n render json: { has_more: has_more, data: TweetBlueprint.render_as_hash(tweets) }\n end\n end\n end",
"def fetch_new_tweets(search_query, search_type)\n # max_id is inclusive\n new_tweets = method(\"search_tweets_by_#{search_type}\").call(search_query)\n end",
"def result\n @search = params[:search]\n if current_user\n # 같은 검색어가 목록에 여럿 있는 경우를 막기 위해 있으면 삭제\n prev = current_user.recent_keywords.where('keyword', @search)\n if prev.count > 0\n prev.take.destroy\n end\n key = RecentKeyword.new\n key.keyword = @search\n key.user_id = current_user.id\n key.save\n end\n\n @feed_results = Feed.search(\n @search,\n fields: [:artists_names, :title, :user_nickname],\n operator: \"or\",\n match: :word_middle\n )\n @upcoming_results = Upcoming.search(\n @search,\n fields: [:artists_names, :title, :place],\n operator: \"or\",\n match: :word_middle\n )\n @result_size = @feed_results.size + @upcoming_results.size\n render_by_device\n end",
"def tweets\n @_tweets ||= client.filter_tweets(screen_names)\n end",
"def index\n query = params[:q]\n respond_to do |format|\n format.html { \n if query\n @tweets_url = \"/tweets.json?q=#{query}\"\n else\n @tweets_url = \"/tweets.json\" \n end\n }\n format.json { \n tweets, has_more = if query\n search_result = Tweet.search(query, \n page: params[:page] || 1, \n per_page: 20, \n includes: [\n {user: {avatar_attachment: [:blob]}},\n :likes, {images_attachments: [:blob]},\n {comments: {user: {avatar_attachment: [:blob]}}}\n ])\n [search_result.results, search_result.current_page < search_result.total_pages]\n else\n @pagy, tweets = pagy Tweet.includes({user: {avatar_attachment: [:blob]}},\n :likes, \n {images_attachments: [:blob]},\n {comments: {user: {avatar_attachment: [:blob]}}}).order(created_at: :desc)\n [tweets, @pagy.page < @pagy.pages]\n end\n render json: {has_more: has_more, data: TweetBlueprint.render_as_hash(tweets) }\n }\n end\n end",
"def index\r\n @users = User.where.not(id: current_user&.id)\r\n @tweet = Tweet.new\r\n @tweets = Tweet.all.page(params[:page])\r\n\r\n \r\n if params[:q]\r\n @tweets = Tweet.where('content LIKE ?', \"%#{params[:q]}%\").page(params[:page])\r\n if @tweets.nil?\r\n @tweets = Tweet.all.page(params[:page])\r\n end\r\n else\r\n @tweets = Tweet.all.page(params[:page])\r\n end\r\n \r\n #SCOPE comentado para evitar conflicto con buscador\r\n if signed_in?\r\n @tweets = Tweet.tweets_for_me(current_user).page(params[:page])\r\n else\r\n @tweets = Tweet.all.order(\"created_at DESC\").page(params[:page])\r\n end\r\n\r\n if params[:tweetsearch].present?\r\n @tweets = Tweet.search_my_tweets(params[:tweetsearch]).page(params[:page]).order(\"created_at DESC\")\r\n elsif params[:hashtag].present?\r\n @tweets = Tweet.search_my_tweets(\"##{params[:hashtag]}\").page(params[:page]).order(\"created_at DESC\")\r\n end\r\n\r\n end",
"def lazy_search_twitter()\n @refresh_url = \"#{@api_endpoint_twitter}#{@response['refresh_url']}\" unless (@response.nil? || @response['refresh_url'].nil? || @response['refresh_url'].empty?)\n if @refresh_url\n #FIXME persist the refresh url - server restart would be a pain elsewise\n search_url = \"#{@refresh_url}&result_type=#{@result_type}&rpp=#{@results_per_page}\"\n @log.info \"lazy search using '#{search_url}'\" #workaround to get refresh url logged w/ the Daemons gem\n @response = http_get search_url\n else\n @log.debug \"regular search using '#{@search_term}'\"\n @response = search_twitter()\n end\n end",
"def description\n\t\"Search twitter for this username.\"\nend",
"def user_timeline(qt)\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = \"v8gVbMe6vQRaqhR3pp7NAC3Hu\"\n config.consumer_secret = \"PajgzuySLYRmTjTHBII3NkoCLeKcYeMiFuNN9rKw80RoUwLTKg\"\n config.access_token = \"2742505915-pa5qcpgna0T2s9dlvH6oY0kftxcpYbqSqs84VUa\"\n config.access_token_secret = \"9IhvXk8UejEA2t8MV9qSMlKL1rbYA8D1P1SqCDF58LRNb\"\n\n end\n @data = params[:q]\n logger.info \"here is the text: #{@data}\"\n @tweets= client.search(\"to: #{@data}\", result_type: \"recent\", :lang => :en).take(20).collect{ |element| element.text}\n\n end",
"def process \n \n #a = Account.oldest_used\n accounts = Account.order(:updated_at).all\n a = accounts.first\n\n tweets, data, self.temp_usernames = [],[],[]\n \n config = {:count => 100, :result_type => \"recent\" }\n config[:since_id] = self.last_tweet_id.to_i unless self.last_tweet_id.nil? \n \n while true\n r = a.tc.search(self.search + \" -rt -http -#ff\", config)\n break if r.results.empty? || tweets.count > MAX_RESULTS_PER_REQUEST\n \n config[:max_id] = r.results.last.id - 1\n tweets += r.results\n puts \"Found... #{tweets.count} tweets in total\"\n end\n \n # raise tweets.map{|t| \"@\" + t.from_user + \": \" + t.text }.to_yaml \n if !tweets.empty? \n\n replies = File.readlines \"vendor/replies/\" + self.responses\n\n our_accounts_list = Account.all.map{|x| x.username}\n blocked_keywords = Keyword.all.map{|x| x.name}\n\n tweets\n .reject { |t| t.text.include? 'http' } \n .reject { |t| our_accounts_list.include? t.from_user } # Reject if are our own accounts\n .reject { |t| t.text.downcase.split(' ').any? {|i| blocked_keywords.include? i } } # Reject blocked keywords\n .reject { |t| self.repeat_user(t.from_user) }\n .each_with_index do |t,i|\n puts \"#{i}. Tweet de @\" + t.from_user\n reply = \"@#{t.from_user} \" + replies[rand(replies.count)]\n\n #check encoding and length\n\n #apply filters\n\n data << SearchesResult.new({\n :account_id => accounts.sample.id, \n :username => t.from_user, \n :tweet => t.text, \n :reply => reply,\n :tweeted_at => t.created_at\n })\n end\n\n self.last_tweet_id = tweets.first.id\n self.save\n\n if !data.empty?\n SearchesResult.import data.reverse\n end\n end\n \n self.save_log tweets.count, data.count, 1\n \n \n data.map{|t| \"@\" + t.username + \": \" + t.tweet}.to_yaml\n end",
"def like_hello\n @client.search(\"#{@hashtbonjour}\", result_type: \"recent\").take(25).collect do |tweet|\n @client.favorite(tweet)\n end\n end",
"def retweets_of_me(options={})\n perform_get(\"statuses/retweets_of_me.#{Twitter.format}\", options)\n end",
"def search (search_url, options = {})\n # HttParty encapsulate Net::Http library to make it more developer friendly. \n # It is making a get request to the search_url. \n # Sets options to the query and merges the default params. Example the access_token.\n http_response = HTTParty.get(search_url, query: options.merge(Underbelly::DEFAULT_PARAMS))\n # HttParty has methods like .parsed_response, .body, .code, .message, .headers.inspect\n # Set @status equal to the code that is returning we can uses this to make sure that the response was successful.\n @status = http_response.code\n # Message is set to get more detail of the status. It is more useful when the response is not successful.\n @message = http_response.message\n # Before set the response to the User object, it makes sure that the response is successful. \n if status == 200\n # Set a local variable equal to the parsed response. \n # The parsed_response method calls JSON parse without explicitly using the JSON library.\n # Return a ruby hash instead of a Json response.\n response = http_response.parsed_response\n # Transform the response into an object in this case a User object.\n # This way it calls the attributes like normal attributes \".name\" instead of \"['name']\".\n # Also allows us to be able to create addition methods for the User object to manipulate the data. \n @user = Underbelly::User.new(response) \n end \n end",
"def index\n if params[:q].present?\n @tweets = Tweet.where(\"title like ? or content like ?\", \"%#{params[:q]}%\", \"%#{params[:q]}%\")\n else\n @tweets = Tweet.all\n end\n end",
"def search_and_save\n if params[:q].nil?\n redirect_to root_path\n else\n @dados = []\n url = URI.encode(\"http://search.twitter.com/search.json?q=#{params[:q]}\")\n call url\n Search.create(query: params[:q])\n end\n end",
"def run\n super\n require 'twitter'\n\n # Initialize a Twitter search\n search = Twitter::Search.new\n\n search.containing(\"#{@object.fname} #{@object.lname}\").result_type(\"recent\").per_page(10).each do |r|\n #puts \"#{r.from_user}: #{r.text}\"\n Fact.create :user_id => @object.id, :text => \"#{r.from_user}: #{r.text}\"\n end\n\n # Enough about\n search.clear\n\n\tnil\nend",
"def display_timeline\n timeline_search_results = []\n TWITTER.home_timeline.each do |tweet|\n timeline_search_results << [tweet.user.name, tweet.text]\n # binding.pry\n end\n timeline_search_results\n end",
"def get_twitter_query(project_id, query_id)\n get \"projects/#{project_id}/twitterqueries/#{query_id}\"\n end",
"def get_tweets\n Rails.cache.fetch('stops', :expires_in => 30) {\n results = []\n \n Twitter::Search.new('#gbnyc').from('garrettb').from('jakebellacera').per_page(100).since_date('2010-02-25').fetch().results.each do |result|\n if result.geo.present?\n results << {\n :text => result.text,\n :from_user => result.from_user,\n :created_at => result.created_at,\n :lat => result.geo.coordinates[0],\n :lng => result.geo.coordinates[1]\n }\n end\n end\n \n results\n }\n end",
"def stream_search\n\n @@first_time = false\n unless @@warning\n @tweets = @@stream.get_tweets params[:keywords], params[:exclude],\n\t\t\t\t params[:language], params[:latitude],\n params[:longitude], params[:radius],\n\t\t\t\t params[:distance]\n #check\n unless @@old_tweets.size == 0\n @tweets.each do |tweet|\n @@old_tweets.each do |ot|\n if tweet.id == ot.id\n @tweets.delete tweet\n end\n end\n end\n end\n #update old\n @@old_tweets = @tweets\n\n else\n @tweets = Array.new\n end\n @tweet_jsons = Array.new(params[:numTweets].to_i)\n (0..(params[:numTweets].to_i - 1)).each do |i|\n if !@tweets[i].nil?\n @tweet_jsons[i] = @@stream.jsonify_tweet(@tweets[@tweets.length - 1 - i])\n @tweet_jsons[i][:image] = @tweet_jsons[i][:image].to_s\n end\n end\n\n render json: {tweets: @tweet_jsons, num_tweets: @tweets.size}\n end",
"def search(searchString, token)\n query = {\n \"q\": searchString,\n \"type\": \"track\",\n \"limit\": 1\n }\n\n headers = {\n \"Accept\": \"application/json\",\n \"Authorization\": \"Bearer #{token}\"\n }\n\n response = HTTParty.get(\"https://api.spotify.com/v1/search\", :query => query, :headers => headers)\n jBody = JSON.parse(response.body)\n result = {\n \"id\": \"spotify:track:#{jBody[\"tracks\"][\"items\"].first[\"id\"]}\",\n \"name\": jBody[\"tracks\"][\"items\"].first[\"name\"],\n \"artist\": jBody[\"tracks\"][\"items\"].first[\"artists\"].first[\"name\"]\n }\n\n return result\n\nend",
"def recipe_search_results_for(search, number=100)\n Faraday.get \"#{RECIPE_SEARCH_URL}#{search}&number=#{number}&apiKey=#{spoonacular_key}\"\n end",
"def collect_tweets\n result = []\n begin\n @hashtags.each do |hashtag|\n result.push search(hashtag)\n end\n\n store_last_id calculate_last_id result\n filter_tweets_with_urls result\n\n rescue EOFError, SocketError, Twitter::Error::ClientError\n @logger.error \"Connection to Twitter seems to be not available.\"\n return nil\n end\n end",
"def new_tweets\n q = search.q(@search_term)\n q = q.since_id(@last_id) if @last_id\n tweets = q.fetch\n tweets.reverse!\n\n @last_id = tweets.last.id_str if tweets.last\n\n tweets\n end",
"def fetch\n infos = []\n client.search(url, query).take(limit).each do |result|\n response = Hashie::Mash.new(result.to_hash)\n infos << store_info(response)\n end \n infos.reject(&:blank?)\n #TODO: Exception need to handled\n rescue Twitter::Error\n Rails.logger.error(\"Twitter fetch throwing error check the connection\")\n end",
"def search\n search = Favorite.search do\n fulltext params[:query]\n end\n \n @favorites = search.results\n \n respond_with @favorites\n end",
"def result\n\t\tusername = params[:username]\n\n\t begin\n\t \t@twitter = API::Twitter.tweets username\n\t rescue Exception => e\n\t \t@twitter = []\n\t end\n\n\t begin\n\t \t@github_user = API::GitHub.user username\n\t \t@github_repos = API::GitHub.repos username\n\t rescue Exception => e\n\t \t@github_user = \"\"\n\t\t @github_repos = []\n\t end\n\n\t begin\n\t \t@gems = API::RubyGems.published username\n\t rescue Exception => e\n\t \t@gems = []\n\t end\n\n\t render \"result\"\n\tend",
"def suggest\n @result = Artist.search( params[:term] )\n \n respond_to do |format|\n format.html\n format.json { render :json => @result }\n end\n end",
"def show\n @search_tweet = SearchTweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @search_tweet }\n end\n end",
"def index\n number_tweets = if params[\"count\"] then params[\"count\"].to_i else 10 end\n tweet_ids = []\n if @user.interests\n for i in 1..number_tweets\n interest = @user.interests.sample\n tweet = Rails.application.config.twitter_client.search(\"#{interest[:hashtag]}\", count: 1).take(1)\n tweet_ids.push(tweet.first.id.to_s)\n end\n end\n\n render json: tweet_ids, status: :ok\n end",
"def get_tweets(list)\n if list.authorized?(@user)\n list.tweets\n else\n []\n end\nend",
"def search\n unless params[:search].blank?\n @search = Sunspot.search(KyuEntry) do\n fulltext params[:search]\n end\n @kyu = @search.results\n end\n end",
"def search\n send_request\n parse_response\n end",
"def twitter\n @data['social']['twitter']\n end",
"def search(plaintext)\n call(:search, :plaintext => plaintext)[:search_response][:return]\n end",
"def run\n super\n \n #\n # Do the google search\n #\n results = GSearchParser.webSearch(@object.name.gsub(\" \",\"%20\"))\n \n results.each do |r|\n #\n # Parse the results for known patterns \n #\n \n # Check to see if this is a twitter result&\n # grab the username if so\n if r.title =~ /on Twitter/\n \n @task_logger.log \"Found a twitter account! (#{r.title}\"\n account_name = r.title.gsub(/<.?em>/,\"\").split(\"@\").last.split(\")\").first\n \n @task_logger.log_good \"Storing a twitter account! (#{account_name})\"\n @object.usernames << account_name\n \n @object.save\n end\n\n # TODO - we can do the same thing with the linkedin URL, but we'll need to tweak\n # gsearch-parser in order to get it out\n\n end\n \n end",
"def searchSpotify(inArtist)\n tArtist = CGI.escape(inArtist)\n \n outstring = open('http://ws.spotify.com/search/1/artist?q='+tArtist, 'User-Agent' => 'Ruby-Wget').read\n\n outdata = outstring.split(\"<opensearch:totalResults>\")\n\n outdata.delete_at(0);\n\n if outdata[0].split(\"</opensearch:totalResults>\")[0].to_i > 0\n outinfo = outstring.split(\"<artist href=\");\n return outinfo[1].split(\">\")[0];\n else\n return 0\n end\n end",
"def tweets_for state\n\n\t\tsdb = AWS::SimpleDB.new(access_key_id: $aws_access, secret_access_key: $aws_secret)\n\n\t\tdomain = sdb.domains['cspp51050-final']\n\t\tresults = domain.items.where(state: state)\n\n\t\tconvert_sdb_to_objects results\n\t\t\n\tend",
"def show\n user = user_from_token\n @tweet = user.tweets.where(:id => params[:id])\n render :json => @tweet\n end",
"def search_results\n @results = User.search(params[:search])\n end",
"def index\n if params[:q]\n tweets = Tweet.where(\"email ILIKE ?\", \"%#{params[:q]}%\")\n else\n tweets = Tweet\n end\n tweets = tweets.page(params[:page]).per(params[:size])\n respond_to do |format|\n format.html { render locals: {tweets: tweets} }\n format.json { render json: tweets, include: params[:include] }\n # render json: tweets, include: params[:include]\n end\nend",
"def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end",
"def show\n @destination = Destination.find(params[:id])\n setup_show_data\n\n client = TwitterHelper.get_client\n @twitter_data = client.search(\"to: #{@destination.city}, travel\", :result_type => \"recent\").take(3)\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @destination }\n end\n end",
"def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end",
"def search_for(verse)\n @query = {\n \"passage\" => verse\n }\n\n @results = self.class.get(\"#{@url}bible.php?\", :query => @query)\n\n @item = @results.parsed_response['bible']['range']['item']\n\n if @item.is_a? Array\n @text = @item.map do |item| \n \"#{item['verse']} #{item['text']} \\n\"\n end.join('')\n else\n @text = @item['text']\n end\n\n @text\n end",
"def index\n\n if params[:q]\n @tweets = Tweet.where('content LIKE ?', \"%#{params[:q]}%\").order(created_at: :desc).page params[:page]\n elsif user_signed_in?\n @tweets = Tweet.tweets_for_me(current_user).or(current_user.tweets).order(created_at: :desc).page params[:page]\n else\n @tweets = Tweet.eager_load(:user, :likes).order(created_at: :desc).page params[:page]\n end\n\n @tweet = Tweet.new\n @user_likes = Like.where(user: current_user).pluck(:tweet_id)\n end",
"def grab_tweets &block\n NSLog \"grab_tweets\"\n self.spinner.startAnimation self\n TwitterSearch.new(self.search_term) do |tweets|\n @tweets = tweets\n block[]\n self.spinner.stopAnimation self\n end\n end",
"def get_tweets(list)\n if list.authorized?(@user)\n list.tweets\n else\n [] # \"magic\" return value\n end\nend",
"def get_results\n \n stories = []\n blog_posts = [] \n tweets = []\n base_errors = []\n last_date = nil\n @voter_ids = []\n \n # searchterms = search_terms.gsub(\" and \", \" \").gsub(\"\\r\", \"\").split(\"\\n\").collect{|s| \"(\"+s+\")\"}.join( \" OR \" )\n terms_set = search_terms.split(\"\\n\")\n \n start_time = Time.zone.now\n @total_results = 0\n @new_results = 0\n update_attributes!( :last_started => Time.zone.now, :status=>\"executing\", :seconds_to_execute=>nil, :total_results=>nil, :new_results=>nil )\n \n terms_set.each do |terms|\n next if terms.strip.blank?\n procs = []\n @second_phase_topic_post_queue = Queue.new # Use Queue to ensure thread safety.\n\n if( true )\n twitter_proc = Proc.new do\n begin\n logger.info( \"Searching Twitter with #{terms} : #{DateTime.now.ltf}\" ) \n searcher = TS.new( terms, nil, last_date, nil, 0, $APP_CONFIG[:search][:ts_debug_level] )\n _tweets = []\n while( !TEST_MODE && tweet = searcher.next_result )\n _tweets << tweet\n # puts \"tweet: #{tweet.inspect}\"\n # debug_msg( tweet.to_s, 2 )\n process_result tweet\n end\n logger.info( \"Twitter (#{terms}) results: #{_tweets.length} : #{DateTime.now.ltf}\" )\n end\n end\n procs << twitter_proc\n end\n\n begin\n threading = $APP_CONFIG[:search][:use_threading]\n if( threading )\n # puts(\"Executing search in multi-threaded mode.\")\n threads = []\n procs.each do |proc|\n thread = Thread.new(proc, Thread.current) do |search_proc, caller_thread|\n begin\n Poll.connection.reconnect!\n search_proc.call\n rescue Exception\n Thread.current[:exception] = $!\n end\n end\n threads << thread\n end\n # debug_msg \"Waiting on Threads \" + threads.join(\" \")\n threads.each do |thread| \n thread.join\n if thread[:exception]\n raise thread[:exception]\n end\n end\n # debug_msg \"Passed wait on Threads\"\n else\n # puts(\"Executing search in single-threaded mode.\")\n procs.each do |proc|\n proc.call\n end\n end\n\n rescue Exception => exception\n # logger.error $!.inspect\n # logger.error $!.backtrace.join(\"\\n\")\n raise $!\n end\n end\n perform_reach_lookups\n update_attributes!( :last_updated => Time.zone.now, :status=>\"completed\", :seconds_to_execute=>Time.zone.now-start_time, :total_results=>@total_results, :new_results=>@new_results )\n end",
"def get_search_result(url)\n c = Curl::Easy.new(url)\n c.userpwd = BIBLE_KEY + ':X'\n c.perform\n return c.body_str\nend",
"def get_search_result(url)\n c = Curl::Easy.new(url)\n c.userpwd = BIBLE_KEY + ':X'\n c.perform\n return c.body_str\nend",
"def tweet\r\n\treturn \"tweet tweet tweet\"\r\n\tend",
"def search\n user = User.qa_app_user\n text = URI.decode(params[:search])\n @chatouts = Qa.search_feed(user, Qa::GROUP_ID , text)\n end",
"def index\n reader = inject( Java::pl.goldmann.confitura.beans.TweetReader )\n \n @tweets = reader.read\n @total = reader.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tweets }\n end\n end",
"def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end",
"def search\n terms = @authority.search(url_search)\n render json: terms\n end",
"def search_itunes(term)\n base = \"https://itunes.apple.com/search?term=\"\n url = base + term\n response = HTTParty.get(url)\n return JSON.parse(response)\nend"
] | [
"0.8690462",
"0.7994195",
"0.7743022",
"0.77180386",
"0.7610012",
"0.75524044",
"0.7549618",
"0.73038965",
"0.7235854",
"0.7158196",
"0.7112229",
"0.70813894",
"0.7063754",
"0.7062807",
"0.7028427",
"0.7021699",
"0.70064896",
"0.69585836",
"0.69265914",
"0.6892464",
"0.6871703",
"0.6863099",
"0.68482465",
"0.6846212",
"0.68067867",
"0.6788406",
"0.6774208",
"0.67405313",
"0.6708987",
"0.67082477",
"0.6700412",
"0.6602623",
"0.6601561",
"0.658717",
"0.6566735",
"0.6553115",
"0.6542425",
"0.6538085",
"0.6477389",
"0.6432988",
"0.642644",
"0.6416438",
"0.640217",
"0.63950735",
"0.6387202",
"0.6379262",
"0.6365877",
"0.63655454",
"0.6363231",
"0.63414323",
"0.63268185",
"0.63135767",
"0.6301737",
"0.63008595",
"0.6279343",
"0.6273436",
"0.62592375",
"0.6244969",
"0.62282366",
"0.6210657",
"0.6187749",
"0.6185753",
"0.6177574",
"0.6163958",
"0.61514497",
"0.6139001",
"0.61289465",
"0.61087054",
"0.60818994",
"0.6072096",
"0.6070237",
"0.6065244",
"0.6041512",
"0.60324234",
"0.6031059",
"0.6030392",
"0.6030205",
"0.601078",
"0.5998911",
"0.5998861",
"0.5981809",
"0.5979918",
"0.597053",
"0.5970173",
"0.59631705",
"0.5961601",
"0.5960274",
"0.59573996",
"0.5955278",
"0.59551233",
"0.595422",
"0.59537417",
"0.59266835",
"0.59266835",
"0.5925446",
"0.5897378",
"0.58868974",
"0.58864397",
"0.58824044",
"0.5877587"
] | 0.78962815 | 2 |
Return a specified user from Twitter | def twitter_user
@twitter_user ||= TwitterClient.new.user(@user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_from_twitter_as_hash(screen_name_or_twitter_id)\n Rails.cache.fetch(\"/users/show/#{screen_name_or_twitter_id}\", :expires_in => 2.hours) { twitter.get(\"/users/show/#{screen_name_or_twitter_id}\") }\n end",
"def get_user_detail_by_twitter_id(twitter_id)\n @user = User.find(:select=>\"*\",:conditions=>[\"twitter_id=#{twitter_id}\"])\n return @user\n end",
"def twitter_user\n @twitter_user ||= prepare_access_token(self.token, self.secret)\n end",
"def twitter\n unless @twitter_user\n provider = self.authentications.find_by_provider('twitter')\n @twitter_user = Twitter::Client.new(:oauth_token => provider.token, :oauth_token_secret => provider.secret )rescue nil\n end\n @twitter_user\n end",
"def tweet_user(tweet) \n if ! tweet.is_a?(String)\n base = tweet.has_key?(:from_user) ? tweet[:from_user] : tweet[:user][:screen_name]\n else\n base = tweet\n end\n base =~ /^@/ ? base : \"@#{base}\"\n end",
"def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end",
"def get_user_id_by_twitter_id(twitter_id)\n @user = User.find(:first ,:select=>\"id\",:conditions=>[\"twitter_id=?\",twitter_id])\n return @user.id\n end",
"def user\n if is_partial?\n TwitterUserPartial.from_hash raw_user\n else\n TwitterUser.from_hash raw_user\n end\n end",
"def set_twitter_user\n @twitter_user = current_user.twitter_users.find(params[:id])\n end",
"def fetch_user\n user = Twitter.user(screen_name)\n Lead.from_twitter(user)\n end",
"def get_profile( twitter_id ) \n if twitter_id.class == Fixnum\n data = Net::HTTP.get_response('twitter.com', \"/users/show.json?user_id=#{twitter_id}\").body\n else\n data = Net::HTTP.get_response('twitter.com', \"/users/show/#{twitter_id}.json\").body\n end\n \n # we convert the returned JSON data to native Ruby\n # data structure - a hash\n result = JSON.parse(data)\n \n # if the hash has 'Error' as a key, we raise an error\n if result.has_key? \"error\"\n raise TwitterError.new result[\"error\"]\n end\n result\n end",
"def twitter_user_id\n raw['id']\n end",
"def set_twitter_user\n @twitter_user = TwitterUser.find(params[:id])\n end",
"def get_login_by_twitter_id(twitter_id)\n @user = User.find(:first ,:select=>\"login\",:conditions=>[\"twitter_id=?\",twitter_id])\n return @user.login\n end",
"def find_twitter_handle\n self.match(/(\\@\\w+)/i)\n return $1\n end",
"def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end",
"def get_twitter(npo)\n\t\trequire 'net/http'\n\t\trequire 'rexml/document'\n\n begin\n\n res = Net::HTTP.get(URI.parse(\"http://api.twitter.com/1/users/show.xml?screen_name=#{npo.twitter}\"))\n document = REXML::Document.new(res)\n\n if document.root.elements[2]\n document.root.elements[2].expanded_name == 'error' ? nil : npo.twitter\n end\n rescue\n nil\n end\n\tend",
"def lookup_user (user_id)\n tweets = IBM_DB.exec(@conn, \"SELECT * from tweets t WHERE user_id = #{user_id}\")\n #TODO: Verify manually, cannot count results in DB2\n #debug 'user: ' + user_id.to_s + \" had \" + resp.count.to_s + \" tweets\"\n debug \"fetched tweets for user: \" + user_id.to_s\n end",
"def twitter_profile\n @network = current_user.network ||= Network.new\n (@network.twitter.nil?) ? \"\" : @network.twitter\n end",
"def twitter_url\n twitter_user.blank? ? nil : \"#{TWITTER_URL}#{twitter_user}\"\n end",
"def userid_from_username(username)\n data = JSON(open(\"http://api.twitter.com/1/users/show/#{username}.json\").read)\n data[\"id\"]\n end",
"def id_from_user(u)\n u.is_a?(Twitter::User) ? u.id : u\n end",
"def user_tweets(user_id)\n twitter.user_timeline(user_id)\n end",
"def user_tweets screen_name\n\t\tTwitter.user_timeline(screen_name.to_s)\n\tend",
"def search_user(q)\n uri = \"https://api.twitter.com/1/users/search.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"get\",\n :params =>{:q=>q, :include_entities=>\"true\"})\n oauth_helper = OAuth::Client::Helper.new(req, oauth_params.merge(:request_uri => uri))\n sign_request(req,uri)\n hydra = Typhoeus::Hydra.new\n hydra.queue(req)\n hydra.run \n \n profile_list = Array.new\n\n JSON.parse(req.response.body).each do |raw|\n profile_list.push([\n raw[\"id\"].to_s,\n raw[\"profile_image_url\"].to_s,\n raw[\"name\"].to_s,\n raw[\"screen_name\"].to_s]\n )# prepare to cash into database, not sure\n end\n profile_list.sort!{|x,y| x[0]<=>y[0]} \n end",
"def user\n @user ||= @uri && client.user(@uri.split(':')[2])\n end",
"def user_connect_to_twitter(user)\n access = nil\n if user.twitter_token\n user_credentials = @t_credentials.clone # Keep consumer token\n # but override with user's access token\n user_credentials[:access_token] = user.twitter_token\n user_credentials[:access_token_secret] = user.twitter_secret\n# puts \"Using this token for #{user.ublog_name}: #{user_credentials[:access_token]}/#{user_credentials[:access_token_secret]}\"\n begin\n access = TwitterAPI::Access.new(user_credentials)\n rescue StandardError, Timeout::Error\n puts \"Failed to access Twitter for user #{user.ublog_name}:\\n\" + $!\n # Didn't expect this. User needs to get new token sometime.\n end\n end\n access\n end",
"def fetch_details_from_twitter\n\t\t# twitter_object = Twitter::Client.new(\n\t\t# \t:oauth_token => self.token,\n\t\t# \t:oauth_token_secret => self.secret\n\t\t# \t)\n\t\t# twitter_data = Twitter.user(self.uid.to_i)\n\t\t# self.username = twitter_data.username\n\t\t# self.save\n\t\t# self.user.username = twitter_data.username if self.user.username.blank?\n\t\t# self.user.image = twitter_data.profile_image_url if self.user.image.blank?\n\t\t# self.user.location = twitter_data.location if self.user.location.blank?\n\t\t# self.user.save(:validate => false)\n\t\tself.user.has_twitter = true\n\t\tself.user.save\n\tend",
"def show\n @word = Word.find(params[:id])\n if current_user.authentications[2]==\"twitter\"\n @tweet_search = current_user.twitter.search(@word.word)\n else\n @tweet_search\n end\n end",
"def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end",
"def tw_profile_url\n \"http://twitter.com/intent/user?user_id=#{tw_user_id}\"\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def twitter_url(username)\n \"https://twitter.com/#!/#{username}\"\n end",
"def user_by_name(user = \"default\")\n url = user =~ /^http/ ? user : \"http://gdata.youtube.com/feeds/users/#{user}\"\n parser = YouTubeG::Parser::UserFeedParser.new(url, request_headers, request_options)\n parser.parse\n end",
"def show\n @twitter_user = TwitterUser.find(params[:id])\n @follower_ids = Twitter.follower_ids(@twitter_user.twitter_username).collection\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_user }\n end\n end",
"def user(user, use_ssl=false) \n url = @base_url + \"/#{user}\"\n GitHub::User.new(JSON.parse(open(url).read)[\"user\"])\n end",
"def user(user_id = nil)\n user_id = username if user_id.nil? || user_id == \"\"\n if user_id.to_i.to_s == user_id.to_s\n users = connection.get(connection.build_url('users', :userids => user_id)).body\n else\n users = connection.get(connection.build_url('users', :logins => user_id)).body\n end\n users.map!{|hash| hash.values.first}\n users.first\n end",
"def callback\n @request_token = OAuth::RequestToken.new(TwitterauthController.consumer, session[:request_token], session[:request_token_secret])\n # Exchange the request token for an access token.\n @access_token = @request_token.get_access_token\n @response = TwitterauthController.consumer.request(:get, '/account/verify_credentials.json', @access_token, { :scheme => :query_string })\n case @response\n when Net::HTTPSuccess\n user_info = JSON.parse(@response.body)\n unless user_info['screen_name']\n flash[:notice] = \"Authentication failed\"\n redirect_to :action => :index\n return\n end\n @user = User.find_or_initialize_by_twitter_id(user_info['id'])\n if @user.new_record? || @user.twitter_token != @access_token.token\n @user.twitter_token = @access_token.token\n @user.twitter_secret = @access_token.secret\n @user.save!\n end\n # Store the user in the session\n UserSession.create(@user)\n # Redirect to the show page\n redirect_back_or_default root_url\n else\n RAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n # The user might have rejected this application. Or there was some other error during the request.\n flash[:notice] = \"Authentication failed\"\n redirect_to login_url\n return\n end\n end",
"def twitter\n @data['social']['twitter']\n end",
"def select_twitter_account(&callback)\n account_type = @store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter)\n\n @store.requestAccessToAccountsWithType(account_type, options: nil, completion: -> (granted, error) do\n if granted\n @accounts = @store.accountsWithAccountType(account_type)\n if @accounts.length > 0\n Dispatch::Queue.main.async do\n next_step = -> (account, &firebase_handler) do\n self.authenticate_account(account, &firebase_handler)\n end\n callback.call(nil, @accounts, next_step)\n end if callback\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'No Twitter accounts detected on phone. Please add one in the settings first.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'Access to twitter accounts denied.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n end)\n end",
"def retrieve(user_id:)\n User.new get_request(\"users/#{user_id}\").body.dig(\"user\")\n end",
"def show\n user = user_from_token\n @tweet = user.tweets.where(:id => params[:id])\n render :json => @tweet\n end",
"def getUserInfo(doc, tweet)\n\t@username = doc.at_css(\".js-action-profile-name b\").text\n\tputs \"Username: #{@username}\"\n\n\t@name = doc.at_css(\".show-popup-with-id\").text\n\tputs \"Name: #{@name}\"\n\n\t@user_location = tweet[/\\([\\s]*@([^\\)]+)\\)/i]\n\tif @user_location != nil\n\t\t@user_location = @user_location[3..(@user_location.length - 2)]\n\t\tputs \"User Location: #{@user_location}\"\n\tend\nend",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end",
"def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end",
"def in_reply_to_user\n previous_tweet.try(:author).try(:screen_name) || params[:in_reply_to_user]\n end",
"def callback\n\t\t# I didn't abstract this part since we don't have the user data yet.\n\t\t\n\t @request_token = OAuth::RequestToken.new(get_consumer,\n\t session[:request_token],\n\t session[:request_token_secret]) # generate request token using OAuth consumer obj\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t # and existing request token, token secret\n\n\t # Exchange the request token for an access token.\n\t @access_token = @request_token.get_access_token # access token is the application-user combo auth to twitter\n\n\t\t# do a request using the OAuth consumer, to twitter.com/account/verify_credentials.json\n\t\t# USING our access token, so we can GET the data about the user that is described with the access token\n\t @response = get_consumer.request(:get, '/account/verify_credentials.json', @access_token, { :scheme => :query_string })\t\t\n\t\t\n\t case @response\n\t when Net::HTTPSuccess\n\t user_info = JSON.parse(@response.body) # json parse the response\n\n\t unless user_info['screen_name']\n\t\t\t\t\t# for one reason or another -- no screen name was found, auth failed\n\t flash[:notice] = \"Authentication failed\"\n\t redirect_to :action => :index\n\t return\n\t end\n\n\t # We have an authorized user, save the information to the database.\n\t\t\t\tfinduser = User.find_by_twitter_name(user_info['screen_name'])\n\t\t\t\tif finduser.nil?\n\t\t\t\t\t@user = User.create do |u|\n\t\t\t\t\t\tu.twitter_name = user_info['screen_name']\n\t\t\t\t\t\tu.token = @access_token.token\n\t\t\t\t\t\tu.secret = @access_token.secret\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t@user.save!\n\t\t\t\telse\n\t\t\t\t\tfinduser.token = @access_token.token\n\t\t\t\t\tfinduser.secret = @access_token.secret\n\t\t\t\t\tfinduser.save!\n\t\t\t\t\t\n\t\t\t\t\t@user = finduser\n\t\t\t\tend\n\t\n\t\t\t\tsession[:user_id] = @user.id\n\n\t # Redirect to the show page\n\t redirect_to('/home')\n\t else\n\t RAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n\t # The user might have rejected this application. Or there was some other error during the request.\n\t flash[:notice] = \"Authentication failed\"\n\t redirect_to :action => :index\n\t end\n\tend",
"def get_user(name, user_list = users)\n return name if name.instance_of?(GoodData::Membership)\n name.downcase!\n user_list.each do |user|\n return user if user.uri.downcase == name ||\n user.login.downcase == name ||\n user.email.downcase == name\n end\n nil\n end",
"def twitter\n callback_from :twitter\n end",
"def get_current_user\n request(Route.new(:GET, '/users/@me'))\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def screen_name\n TWITTER_CLIENT.user(uid.to_i).screen_name\n end",
"def user(id = 'self')\n get(\"users/#{id}\").user\n end",
"def get_user(name, user_list = users)\n return member(name) if name.instance_of?(GoodData::Membership)\n return member(name) if name.instance_of?(GoodData::Profile)\n name = name.is_a?(Hash) ? name[:login] || name[:uri] : name\n return nil unless name\n name.downcase!\n user_list.find do |user|\n user.uri && user.uri.downcase == name ||\n user.login && user.login.downcase == name\n end\n end",
"def get_user(handle)\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/user/#{handle}\", nil, nil, false)\n end",
"def show\n @influencer = Influencer.find(params[:id])\n @twitter_profile = Influencer.get_twitter_profile(@influencer.twitter)\n end",
"def twitter(name: T.unsafe(nil), nickname: T.unsafe(nil), uid: T.unsafe(nil)); end",
"def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end",
"def tweet_users\n if authors.size > 1\n \"#{submitting_author.nice_name} et al.\"\n else\n submitting_author.nice_name\n end\n end",
"def callback\n\t\tself.twitagent.exchange_request_for_access_token( session[:request_token], session[:request_token_secret], params[:oauth_verifier] )\n\t\t\n\t\tuser_info = self.twitagent.verify_credentials\n\t\t\n\t\t#raise OauthSystem::RequestError unless user_info['id'] && user_info['screen_name'] && user_info['profile_image_url']\n\t\t\n\t\t# We have an authorized user, save the information to the database.\n\t\t@user = User.find_by_screen_name(user_info['screen_name'])\n\t\tif @user\n\t\t\t@user.token = self.twitagent.access_token.token\n\t\t\t@user.secret = self.twitagent.access_token.secret\n\t\t\t@user.profile_image_url = user_info['profile_image_url']\n\t\telse\n\t\t\t@user= User.new({ \n\t\t\t\t:twitter_id => user_info['id'],\n\t\t\t\t:screen_name => user_info['screen_name'],\n\t\t\t\t:token => self.twitagent.access_token.token,\n\t\t\t\t:secret => self.twitagent.access_token.secret,\n\t\t\t\t:profile_image_url => user_info['profile_image_url'] })\n\t\tend\n\t\tif @user.save!\n\t\t\tself.current_user = @user\n\t\telse\n\t\t\traise OauthSystem::RequestError\n\t\tend\n\t\t# Redirect to the show page\n\t\tredirect_to user_path(@user)\n\t\t\n\trescue\n\t\t# The user might have rejected this application. Or there was some other error during the request.\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n\t\tflash[:error] = \"Twitter API failure (account login)\"\n\t\tredirect_to root_url\n\tend",
"def get_count_by_twitter_id(twitter_id)\n @user = User.count(:conditions=>[\"twitter_id=#{twitter_id}\"])\n return @user\n end",
"def show\n @tweet = Tweet.find(params[:id])\n @user=User.all\n end",
"def user(user_id)\n response = connection.get do |req|\n req.url \"/user/#{user_id}\", simple_params\n end\n response.body[0]\n end",
"def twitter_oauth(access_token)\n user_info = access_token.extra.raw_info\n external_user_id = user_info.id\n email = \"#{user_info.screen_name}@twitter.com\"\n account = self.by_twitter_id(external_user_id).first || self.by_twitter_email(email).first\n if account.blank?\n account = self.new\n account.email = email\n account.provider = Provider::TWITTER\n account.external_user_id = user_info.id\n account.skip_confirmation!\n if user_info.name\n first_name, last_name = user_info.name.split\n account.build_profile :first_name => first_name, :last_name => last_name\n end\n account.save\n end\n account\n end",
"def get_user(id, &block)\n get(\"#{@base_url}/user/#{id}/json\", user_mapping, block)\n end",
"def twitter\n \toauth.authorize_from_access(oauth_token, oauth_secret)\n\t @twitter ||= Twitter::Base.new(oauth)\n end",
"def user(user_name)\n OctocatHerder::User.fetch(user_name, connection)\n end",
"def user(body)\n User.find(body[:id])\n end",
"def get_user_by_auth_token\n user = UserSession.find_by_auth_token!(params[:auth_token]).user\n\n json_response 200,\n success: true,\n message_id: 'ok',\n message: I18n.t('success.ok'),\n data: {\n user: user.slice(:id, :username)\n }\n end",
"def get_client(name, pin)\n # Find a user and print his details\n rows = @db.execute( \"SELECT * FROM users WHERE name=? and pin=?\", name, pin)\n if rows.size == 0\n # User not found. Ask them to auth\n puts \"You should really authorize, #{name}\"\n return false\n end\n begin\n @oauth.authorize_from_access(rows[0][3], rows[0][4])\n rescue\n puts \"Failed to authorize user #{name}: #{$!}\"\n return false\n end\n Twitter::Base.new(@oauth)\n end",
"def user\n user = JSON.parse(RestClient.get(\"https://api.discord.bio/v1/user/details/#{slug}\"))\n\n DBio::User.new(user['payload'])\n end",
"def get_user(uri = nil, data = nil)\n\n # Return the user from the cache if available\n user = self.users[uri]\n return user if user\n\n # Get user from the JSON API and add to the cache\n #json = self.api.call(\"users/#{id_from_uri(uri)}\")\n #if json\n # user = User.new(uri, self, self.email_selector, self.ldap_lookup, json: json)\n # self.users[user.uri] = user\n # user\n #else\n # # TODO: this is a hack, just return the URI for now if the lookup fails\n # uri\n #end\n nil\n\n end",
"def twitter\n handle_oauth\n end",
"def twitter_link(player)\n if player.twitter_screen_name\n # clean up any bad characters in a player's twitter name\n twitter_user = player.twitter_screen_name.sub(/^.*[@\\/]/, '')\n\n link_to(\"@\" + twitter_user, \"http://twitter.com/#{twitter_user}\")\n end\n end",
"def create_from_tw\n client = Twitter::Client.new(\n :consumer_key => CONFIG[:tw_consumer_key],\n :consumer_secret => CONFIG[:tw_consumer_secret],\n :oauth_token => params[:tw_access_token],\n :oauth_token_secret => params[:tw_access_token_secret])\n\n @user = User.add_from_tw(\n client.user,\n params[:tw_access_token],\n params[:tw_access_token_secret],\n @source)\n end",
"def user(id_or_username = \"my\", params = {})\n if id_or_username.is_a?(Fixnum) || id_or_username == 'my'\n find_user_by_id id_or_username, params\n else\n find_user_by_username id_or_username, params\n end\n end",
"def user(user_id_or_url = nil, options = {})\n options = make_options(:user_id, user_id_or_url, options)\n get(options)\n end",
"def set_tweet\n @tweet = current_user.tweets.find(params[:id])\n end",
"def twitter_url; \"https://twitter.com/#{twitter}\" end",
"def apply_twitter(omniauth)\n if (extra = omniauth['extra']['user_hash'] rescue false)\n end\n end",
"def get_user(user_name:)\n validate_user_name(:user_name, user_name)\n\n wrap_response(@connection.get(user_path(user_name))).fmap { |r|\n SftpgoClient::User.new(r.body)\n }\n end",
"def get_twitter_status\n logger.info 'Getting twitter'\n begin\n c = Grackle::Client.new\n twitter = c.statuses.user_timeline?(:screen_name => 'paulcarlile', :count => 2)\n rescue Grackle::TwitterError\n twitter = Grackle::TwitterError\n end\n end",
"def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend",
"def get(user_id)\n User.find user_id\n end",
"def find_tweets(current_user)\n @screen_name = current_user.authentications[2].to_s\n @another_tweet = self.twitter.user_timeline(@screen_name)\n @tweet = Tweets.new\n @another_tweet.each do |t|\n @tweet.screenname = t.screen_name\n @tweet.text = t.text\n @tweet.created_at = t.created_at\n end\n @tweet.save\n end",
"def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end",
"def user\n Webmetrics.users.find_one('_id' => id)\n end",
"def get_user(id)\n @client.raw('get', \"/config/users/#{id}\")\n end",
"def find_user\n results = @ldap.search( :base => options[:ldap][:base], :filter => user_filter)\n return results.first\n end",
"def current_user\n @current_user ||= TwitterUser.where(twitter_id: session[:current_user]).first\n rescue\n ensure_logout\n end",
"def get_me\n url = \"#{@api_base_path}/users/me\"\n handle_timeouts do\n response = self.class.get(url, headers: auth_header)\n convert_response(response, \"user\")\n end\n end",
"def retweeted_by_me(options={})\n perform_get(\"statuses/retweeted_by_me.#{Twitter.format}\", options)\n end",
"def get_user(user_id)\n return User.find(user_id)\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n\n self.login = user_info['screen_name']\n self.twitter_name = user_info['name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end",
"def get_user(screen_name)\n result = self.class.get(\"/users/#{screen_name}\", :headers => @headers)\n puts \"#{result.headers['x-ratelimit-remaining']} requests left!\"\n JSON.parse(result.body)\n\n end",
"def user(id:)\n User.find(id)\n end",
"def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end",
"def find_friends\n puts 'Enter the other user\\'s twitter handle'\n @other_user = gets\n @friends = Twitter.friend_ids(@other_user).ids\nend",
"def get_user_info user\n unless user.known_user.nil?\n known_user = user.known_user\n is_me = known_user.is_current_user || false\n return is_me ? \"people/me\" : known_user.person_name\n end\n get_one_of user\nend"
] | [
"0.7574586",
"0.757112",
"0.7473761",
"0.74678403",
"0.7417528",
"0.73607737",
"0.7356598",
"0.7271338",
"0.71384966",
"0.7107479",
"0.7039584",
"0.70374835",
"0.7031068",
"0.7017989",
"0.68920445",
"0.68843776",
"0.6844438",
"0.6824777",
"0.67040557",
"0.65976465",
"0.658888",
"0.65775967",
"0.6574105",
"0.6536952",
"0.6516243",
"0.6509184",
"0.64932287",
"0.6460164",
"0.6452714",
"0.64045656",
"0.64041173",
"0.63826454",
"0.63668793",
"0.636359",
"0.63401616",
"0.6327886",
"0.63020873",
"0.6294713",
"0.62834626",
"0.6259015",
"0.62509143",
"0.6242417",
"0.6229191",
"0.6226224",
"0.62248045",
"0.6222158",
"0.62115264",
"0.6161623",
"0.61517125",
"0.61504745",
"0.61472344",
"0.6139378",
"0.6132939",
"0.6130084",
"0.6126821",
"0.6124005",
"0.61126846",
"0.61067784",
"0.6085812",
"0.60847026",
"0.6080482",
"0.60791165",
"0.6077908",
"0.6075506",
"0.60752666",
"0.60702664",
"0.6064857",
"0.60551786",
"0.6050766",
"0.6048897",
"0.6042476",
"0.6037759",
"0.60373133",
"0.6037082",
"0.60327643",
"0.6032663",
"0.60277355",
"0.60265",
"0.6023141",
"0.6013106",
"0.60003996",
"0.59998685",
"0.5996311",
"0.5988833",
"0.59871864",
"0.5982958",
"0.597118",
"0.59686893",
"0.5966452",
"0.596333",
"0.59554327",
"0.5954766",
"0.5942967",
"0.5942936",
"0.59426457",
"0.5938031",
"0.59376717",
"0.5936347",
"0.59360504",
"0.59330124"
] | 0.7708476 | 0 |
Use during getting, prepend the ID to any exception | def identify_error
begin
yield
rescue => ex
ex.message.insert(0, "#{@id} error: ")
raise
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id\n _id rescue nil\n end",
"def invalid_id_number; end",
"def error_id\n Apartment::Tenant.current.to_s + \"/\" + id.to_s\n end",
"def fix_id(id, format, extra)\n id << \".\" + format if !format.blank?\n id << \".\" + extra if !extra.blank?\n return id\n end",
"def id\n raise \"Item.id not set\" unless @id\n $stderr.puts \"Item.id >#{@id}<\"\n @id\n end",
"def return_id\n\t\treturn @idStr\n\tend",
"def id\n #NOOP\n end",
"def ID_missing\n\t\t$log.warn \"TODO ID missing\"\n\tend",
"def id_member(field, index)\n [\n key_format(field),\n key_format(\n object.errors.details\n .dig(field, index, :error)\n .to_s.downcase\n .split\n .join('_')\n )\n ].join('#')\n end",
"def safe_resource_identity(new_resource)\n new_resource.identity.to_s\n rescue => e\n \"unknown identity (due to #{e.class})\"\n end",
"def id\n to_nil _response_entity.fetch(\"entityId\", nil)\n end",
"def id\n raise NotImplementedError\n end",
"def temp_id\n #reverting to just plain id, see issue #89\n self.id\n end",
"def get_string\n get_item ? get_item.alert.id : ''\n end",
"def ensure_id\n self[:_id] = ( id ? escape_doc_id : database.server.next_uuid )\n end",
"def format_id\n id.delete('-')\n end",
"def id\n '1234567890'\n end",
"def get!(id)\n raise NotSupportedError\n end",
"def id_number; end",
"def id\n super.to_s.tr('.', '_')\n end",
"def get_id\n\t\treturn id\n\tend",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def fallback_name\n if aws_item.respond_to? :id\n aws_item.id\n else\n raise NotImplementedError\n end\n end",
"def ensure_id\n self[:_id] = ( id ? escape_doc_id : database.server.next_uuid )\n end",
"def get_id()\n @id\n end",
"def get_id()\n @id\n end",
"def unique_id\n to_nil _response_entity.fetch(\"entityEnglishId\", nil)\n end",
"def ensure_identifier\n # ensure an existing identifier is reserved (if needed for EZID)\n return resource.identifier.to_s if resource&.identifier&.identifier.present?\n\n resource.ensure_identifier(mint_id)\n end",
"def to_find_id_str\n raise NotImplementedException\n end",
"def id ; @record.id if @record ; end",
"def dedupe_id\n raise NotImplementedError\n end",
"def get_uuid_in_exception\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/uuidInException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithUUIDException.new(\r\n 'uuid in exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def icn_id_unique\n return if icn_id.nil?\n return if (conflicting_name = other_names_with_same_icn_id.first).blank?\n\n errors.add(:base, :name_error_icn_id_in_use.t(\n number: icn_id, name: conflicting_name.real_search_name\n ))\n end",
"def by_id(id)\n raise NotImplementedError.new\n end",
"def unfriendly_id?; end",
"def get_id()\n return @id\n end",
"def resource_id_column\n\t\t\t\t\t\traise \"Not implemented.\"\n\t\t\t\t\tend",
"def id\n @values.fetch('id') { \n @values['id'] = nil\n }\n end",
"def identifier\n id_value || super\n end",
"def id_lookup(id)\n id = id.to_i\n if (id >= 128) && (id <= 255)\n id = \"oem_data_#{id}\"\n elsif DMI::ID_TO_DESCRIPTION.key?(id)\n id = DMI::ID_TO_DESCRIPTION[id]\n else\n Ohai::Log.debug(\"unrecognized header id; falling back to 'unknown'\")\n id = \"unknown_dmi_id_#{id}\"\n end\n rescue\n Ohai::Log.debug(\"failed to look up id #{id}, returning unchanged\")\n id\n end",
"def id\n raise NotImplementedError\n end",
"def get id\n @map[id] || (raise \"#{id} not registered\")\n end",
"def probably_unique_id\n @probably_unique_id||=complete_path.base26_hash\n end",
"def create_record_for_not_found_response; end",
"def id\n key?(:id) ? method_missing(:id) : nil\n end",
"def id\n @id ||= @response['id']\n end",
"def raise_if_no_id(params)\n raise 'No ID to make request' unless !params[:id].nil?\n end",
"def id\n raise MissingPrimaryKey\n end",
"def id\n get_val(:id)\n end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def list_id\n raise 'answer a unique, never changing value'\n end",
"def precheck_domain_id(domain)\n raise DomainNotFoundException.new(\"Domain not specified\") if domain.blank?\n raise DomainNotFoundException.new(\"Domain #{domain} not found\") if ['.','..'].include?(domain)\n end",
"def id\n self._id.to_s if self._id\n end",
"def oldid(value)\n merge(oldid: value.to_s)\n end",
"def oldid(value)\n merge(oldid: value.to_s)\n end",
"def record_not_found\n begin\n yield\n rescue ActiveRecord::RecordNotFound\n logger.error(\"Attempt to #{action_name} invalid id #{params[:id]}\")\n flash[:error] = \"Invalid ID specified for #{action_name} action.\"\n redirect_to :action => 'index'\n end\n end",
"def rarity_id(c)\n Rarity.find_by(name: c['rarity']).id\nrescue NoMethodError\n Rarity.find_by(name: 'Common').id\nend",
"def real_id\n @id\n end",
"def real_id\n @id\n end",
"def id\n @id || self.class.name.underscore.split('/').last #gsub('/', '_')\n end",
"def entry_id\n raise NotImplementedError\n end",
"def id() end",
"def getId\n @id\n end",
"def make_id\n \"#{self.class.name.downcase}#{id}\"\n end",
"def reserve_id(doi:)\n if id_exists?\n @resource.identifier.to_s\n else\n ezid_client.create_identifier(doi, status: 'reserved', profile: 'datacite')\n doi\n end\n end",
"def find_record(xero_id)\n raise_must_override\n end",
"def id_for(request)\n raise NotImplementedError\n end",
"def get_name(ex)\n ex['id'] || \"#{ex['exchange']}:#{ex['crypto']}:#{ex['fiat']}\"\n end",
"def find(id) \n unless id.is_a? Integer \n raise StringIntoIntegerError, \"you must type a number, not a word\"\n end\n\n candidate[:id] == id \n\n rescue StringIntoIntegerError => my_exception\n puts \"An error of type #{my_exception.class} occurred.\"\n puts \"Message is: #{my_exception.message}.\"\n puts \"The issue comes from #{my_exception.backtrace.inspect}.\"\n\nend",
"def fire_duplicate_id(old_entity, new_entity); end",
"def identifier\n issue.identifier\n end",
"def id\n raise Errno::ENOENT, \"This object has been deleted.\" if self.deleted?\n raise \"No ID on object.\" if !@id\n return @id\n end",
"def live_lookup_item_id\n id || folio_item&.id || barcode\n end",
"def entityID\n end",
"def entityID\n end",
"def id\n return self[:id]\n end",
"def item_lookup_id\n item.blank? ? nil : item.item_id\n end",
"def item_lookup_id\n item.blank? ? nil : item.item_id\n end",
"def item_lookup_id\n item.blank? ? nil : item.item_id\n end",
"def limit_id\n [field_id(link_errors: true), 'info'].join('-')\n end",
"def id\n return @id\n end",
"def get(id)\n raise NotSupportedError\n end",
"def id_check(el, id, base)\n if NC_REGEXP.match(id)\n # ID may only be specified once for the same URI\n if base\n uri = URIRef.intern(\"##{id}\", base, :normalize => false)\n if @id_mapping[id] && @id_mapping[id] == uri\n warn = \"ID addtribute '#{id}' may only be defined once for the same URI\"\n add_debug(el, warn)\n raise RdfContext::ParserException.new(warn) if @strict\n end\n \n @id_mapping[id] = uri\n # Returns URI, in this case\n else\n id\n end\n else\n warn = \"ID addtribute '#{id}' must be a NCName\"\n add_debug(el, \"ID addtribute '#{id}' must be a NCName\")\n add_debug(el, warn)\n raise RdfContext::ParserException.new(warn) if @strict\n nil\n end\n end",
"def resolve_friendly_id_conflict(candidates)\n candidates.first + friendly_id_config.sequence_separator + SecureRandom.uuid\n end",
"def _id\n @id\n end",
"def record_not_unique_json(exception)\n code = 405\n original_message = exception.message\n exception = ActiveRecord::RecordNotUnique.new(Status::Errors::ERROR_NON_UNIQUE_DB_ID[\"message\"])\n render :json => Status::Errors.exception_json(exception, code, original_message).to_json, :status => code\n end"
] | [
"0.6401947",
"0.63159853",
"0.6027114",
"0.5939986",
"0.5810798",
"0.57606584",
"0.57374054",
"0.5703896",
"0.56836647",
"0.5671199",
"0.56609386",
"0.5619931",
"0.5540316",
"0.55389",
"0.55183214",
"0.5501152",
"0.5497123",
"0.5494911",
"0.5491441",
"0.5470526",
"0.5465639",
"0.5464248",
"0.5464248",
"0.5464248",
"0.5464248",
"0.5461309",
"0.54598045",
"0.5450933",
"0.5450933",
"0.54339",
"0.543327",
"0.5432774",
"0.5424052",
"0.5419044",
"0.5415489",
"0.54030544",
"0.5402242",
"0.53941154",
"0.5386736",
"0.53777677",
"0.53740805",
"0.53712785",
"0.5368681",
"0.53630257",
"0.5347494",
"0.533721",
"0.5324958",
"0.5318003",
"0.53170717",
"0.5316305",
"0.53068155",
"0.5304846",
"0.52988434",
"0.52988434",
"0.52988434",
"0.52988434",
"0.52988434",
"0.52988434",
"0.52988434",
"0.52988434",
"0.52988434",
"0.52988434",
"0.52988434",
"0.52988434",
"0.52969545",
"0.52936274",
"0.5288823",
"0.528735",
"0.528735",
"0.5279548",
"0.5271358",
"0.5265739",
"0.5265739",
"0.52523607",
"0.5246261",
"0.52438617",
"0.52426124",
"0.52310747",
"0.5230515",
"0.5224928",
"0.52084076",
"0.520836",
"0.51979196",
"0.5197569",
"0.519613",
"0.51959044",
"0.519013",
"0.51897866",
"0.51897866",
"0.5188807",
"0.51853657",
"0.5185211",
"0.5185211",
"0.51846343",
"0.518449",
"0.51828504",
"0.5182172",
"0.5173515",
"0.51676184",
"0.51674926"
] | 0.5382579 | 39 |
Parse out a percentage (as a float) | def parse(text)
text.gsub(/[\s%]/, '').strip.to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(string)\n string = string.tr(\",\", \".\").delete(\"~\")\n if (match = string.match(/^(\\d*\\.?\\d*)$/))\n match[1].to_f\n elsif (match = string.match(/^(\\d*\\.?\\d*)%$/))\n match[1].to_f / 100\n elsif (match = string.match(/^(\\d*\\.?\\d*)[:\\/](\\d*\\.?\\d*)$/))\n match[1].to_f / match[2].to_f\n elsif (match = string.match(/^(.+)\\=(.+)$/))\n match[1].strip.to_l / match[2].strip.to_l\n end\n rescue ArgumentError\n # to_l raises when string isn't a valid length.\n nil\n end",
"def perc_to_f(str)\n str.gsub(/%/, \"\").to_f / 100.0\n end",
"def percent\n self.scan(/./).join('%')\n end",
"def parse_percentage_expression\n regex = /(?<percentage>-?[\\d.]+)% (?<operator>(off?|on)) (?<expr>.*$)/\n match = @expression.match(regex)\n\n if match\n operator = match.named_captures[\"operator\"]\n percentage = match.named_captures[\"percentage\"]\n expr = match.named_captures[\"expr\"]\n\n percentage_expr = \"#{expr} * #{percentage.to_f/100}\"\n\n case operator\n when 'of'\n @expression = percentage_expr\n when 'off'\n @expression = \"#{expr} - (#{percentage_expr})\"\n when 'on'\n @expression = \"#{expr} + (#{percentage_expr})\"\n end\n end\n end",
"def percentage(percent, total)\n percent.to_f / total * 100\nend",
"def percentage(value)\n unless value.is_a?(Sass::Script::Number) && value.unitless?\n raise ArgumentError.new(\"#{value} is not a unitless number\")\n end\n Sass::Script::Number.new(value.value * 100, ['%'])\n end",
"def formatPercentageValue(input)\n output = input.gsub(/\\(/, \"\")\n output.gsub!(/%\\)$/, \"\")\n return output\n end",
"def percentage\n 0.0\n end",
"def percent\n \"%0.1f%%\" % (to_f * 100)\n end",
"def validate_format_percentage(name, value)\n DataTypeValidator.validate name, Float, value, ->(arg) { arg >= 0.0 && arg <= 1.0 }\n end",
"def percent!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n\n type = PERCENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 163:11: '%'\n match( 0x25 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 29 )\n\n end",
"def get_percentage(report)\n percent = (report[:position] / report[:length]) * 100\n percent.round\n end",
"def average_percentage_passed_float\n return self.data[\"average_percent_passed\"].to_f\n end",
"def percentage; end",
"def number_percent number\n\t\tnumber_to_percentage(number, precision: 0)\n\tend",
"def to_percentage\n percentage = (object.popularity * 100).round(1)\n precision = if (object.popularity * 100).to_i == percentage\n 0\n else\n 1\n end\n number_to_percentage(percentage, precision: precision)\n end",
"def read_percentage(max=255)\n max = max.to_f\n value = read.to_f\n result = (value / max) * 100\n result = 0.0 if result < 0\n result = 100.0 if result > 100\n\n result\n end",
"def get_percentage\n r = get_status[:percent]\n r.blank? ? nil : r.to_i\n end",
"def frac_to_float(str)\n numerator, denominator = str.split(\"/\").map(&:to_f)\n denominator ||= 1\n numerator/denominator\n end",
"def vol_perc\n if match = @args[:props][\"volume\"].to_s.match(/(\\d+):\\s*([\\d\\.]+)%/)\n return match[2].to_i\n end\n \n raise \"Could not figure out the volume from properties: '#{@args[:props]}'.\"\n end",
"def percentage=(_arg0); end",
"def percentage=(percentage)\n @progressBar.fraction = percentage.to_f\n end",
"def remaining_percent\n (remaining_pints.to_f)/(124.to_f)\n end",
"def percent()\n ''\n end",
"def quality_percentage\n require 'hpricot'\n doc = Hpricot(File.read(\"#{Continuous4r::WORK_DIR}/flog/index.html\"))\n doc.search('//h3') do |h3|\n if h3.inner_text.match(/^Project average score/)\n score = h3.inner_text.split(/Project average score : /)[1].to_f\n if score > 100.0\n percent = 0\n elsif score < 11.0\n percent = 100\n else\n percent = ((100.0 - score) * 100.0) / 89.0\n end\n return percent\n end\n end\n end",
"def percent_of_total\n # Prevents a error caused by attempting to round the value NaN\n poll.total_points == 0 ? 0 : (score.to_f/poll.total_points.to_f * 100).round\n end",
"def routing_fraction_to_percentage(fraction)\n \"#{(fraction * 100).to_i}%\"\n end",
"def percent_progress\n data[:percent_progress]\n end",
"def percent_progress\n data[:percent_progress]\n end",
"def percent_val\n dollar_amt ? ((dollar_amt / Contract.sum(:dollar_amt)) * 100) : nil\n end",
"def completion_percentage\n fields = %w(first_name last_name address postal_code city country birthday phone_number avatar.present? )\n sum_add = 100.0 / fields.count\n fields.inject(0) { |sum, field| sum + (field.split('.').inject(self) { |us, o| us.send(o) }.blank? ? 0 : sum_add) }.round.to_i\n end",
"def format_pct_value(ror)\n (ror * 100).round(1)\n end",
"def extract_amount(value)\n value.match(/[\\d.,]*\\d+[.,]\\d+/)[0].gsub(/[.,]/,'').to_f/100\n end",
"def parse(line)\n line.split(',').map { |v| (v.to_f * 100).to_i }\n end",
"def scrub_percentage percentage\n p = percentage.to_i\n return p if (0..100).to_a.include?(p)\n p > 100 ? 100 : 0\n end",
"def parse_float(value)\n Float(value.to_s.gsub(',','.'))\n rescue ArgumentError\n nil\n end",
"def percent_correct\n # Check for divide by zero. Than calculate the percentage otherwise.\n if @turns.size == 0\n 0.0\n else\n # Calculate percentage, truncate value to one decimal place.\n ((number_correct.to_f / @turns.size.to_f) * 100.0).truncate(1)\n end\n end",
"def percent_of(number)\n percent = (self.to_f / number.to_f) * 100 if number > 0\n percent ||= 0.0\n end",
"def calc_percent(n, total)\n (n.to_f/total.to_f) * 100.0\nend",
"def get_float(node)\n node.content.squish.gsub(/[^\\d\\.]+/, '').to_f if node.present? && node.content.present?\n end",
"def vat_amount(percentage)\n percentage.to_f / 100.0 * order_line.line_total_net if order_line.valid?\n end",
"def response_percentage\n return 0 unless self.response_count >= 1\n sprintf(\"%0.1f\", (self.response_count / self.poll.response_count.to_f) * 100.0)\n end",
"def percent(count, total)\n (count/total.to_f)*100\nend",
"def percentagize(average)\n number_with_precision(((average / 10) * 100), precision: 1)\n end",
"def pick_percentage\n self.score.to_f / Matchup.amount_finished.to_f\n end",
"def findFivtyPercent(input)\r\noutput=input/2\r\n# by default ruby returns the last calculated value. No need of return statement at this point\r\nreturn output\r\nend",
"def calculate_total_percent(result, out_of)\n total = result.total_mark\n\n percent = BLANK_MARK\n\n # Check for NA mark or division by 0\n unless total.nil? || out_of == 0\n percent = (total / out_of) * 100\n end\n percent\n end",
"def calculate_total_percent(result, out_of)\n total = result.total_mark\n\n percent = BLANK_MARK\n\n # Check for NA mark or division by 0\n unless total.nil? || out_of == 0\n percent = (total / out_of) * 100\n end\n percent\n end",
"def percent\n self[:percentage] = (self[:current] <= self[:max] ? self[:current]/self[:max]*100 : self[:max])\n end",
"def percentage(number, precision = 2)\n return if number.to_s.empty?\n\n ret = \"%02.#{ precision }f%\" % number\n ret.gsub(/\\.0*%$/, '%')\n end",
"def percentage\n \tamount / expense.cost\n end",
"def percent_complete\n (accepted_points.to_f / total_points * 100.0).round(1)\n end",
"def parse(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\nend",
"def get_resource_fraction(entry_data_type, entry_data)\n unit_type = (entry_data & 0xF)\n case unit_type\n when COMPLEX_UNIT_FRACTION\n unit_name = \"%\"\n when COMPLEX_UNIT_FRACTION_PARENT\n unit_name = \"%p\"\n else\n unit_name = \"\"\n end\n\n # Return float as a percentage\n return (complex_to_float(entry_data) * 100).to_s + unit_name\n end",
"def percent(version = @spec.version)\n matching = @comments.select do |comment|\n comment['version'] == version\n end\n\n works = matching.select do |comment| comment['works_for_me'] end.length\n\n percent = (matching.length.to_f / works * 100)\n percent = 0 if percent.nan?\n percent = 100 if percent > 100\n\n \"%2.0f%%\" % percent\n end",
"def percent(version = @spec.version)\n matching = @comments.select do |comment|\n comment['version'] == version\n end\n\n works = matching.select do |comment| comment['works_for_me'] end.length\n\n percent = (matching.length.to_f / works * 100)\n percent = 0 if percent.nan?\n percent = 100 if percent > 100\n\n \"%2.0f%%\" % percent\n end",
"def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end",
"def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end",
"def get_percentage_string current = 0, total = 0\n result = \"0\"\n if total <= 0\n result = \"NaN\"\n else\n itmd = current * 100 / total\n result = itmd.to_s + \"%\"\n end\n\n\n result\n end",
"def parse_float attr_name, xpath\n v = parse_value xpath\n v = v.to_f if v.respond_to?(:to_f)\n send(\"#{attr_name}=\", v)\n end",
"def number_to_percentage(value, options = {})\n NumberToPercentage.convert(value, options)\n end",
"def percentage_of_passives\n calculator.percentage_of_passives\n end",
"def getPercentageDifference(value1, value2)\n if value1 == 0\n return 0\n end\n result = ((value2 - value1)/value1)*100\n result\n end",
"def fraction_to_float(fraction)\n return 0.0 if fraction == \"0\"\n sign = PDG::single_character(fraction) == \"+\" ? 1.0 : -1.0\n sign * Rational(*(fraction[1..-1].split(\"/\").map(&:to_i))).to_f\n end",
"def markup_percent\n return nil if trade_price.nil? || retail_price.nil? || trade_price == 0\n if tax_category.included_in_retail?\n 100 * (retail_price - trade_price_with_tax) / trade_price_with_tax\n else\n 100 * (retail_price - trade_price) / trade_price\n end\n end",
"def to_f\n @val / @div.to_f\n end",
"def two_pt_pct\n return 0.0 if two_pt.zero? || two_pt_a.zero?\n\n (two_pt.to_f/two_pt_a).round(3)\n end",
"def get_percentage(lines_hit, lines_found, bold=false)\n perc = lines_hit.to_f / lines_found.to_f * 100.0\n color = case when perc >= 90; 32 when perc >= 75; 33 else 31 end\n if bold then color = \"1;#{color}\" end\n perc = perc.finite? ? format('%5.1f%%', perc) : ' ' * 6\n perc = \"\\x1b[#{color}m#{perc}\\x1b[0m\" if @options[:color] and color\n perc\n end",
"def parse_price(e)\n # prices can be restricted\n begin\n return e.css('span')[1].content.gsub(',', '.').to_f\n rescue\n return 0.0\n end\n end",
"def event_percentage_for(type, round_percentage=false)\n @sc ||= host_stats\n if %W(high medium low tcp udp icmp all).include?(type)\n calc = ((@sc[:\"#{type}\"].to_f / (@sc[:all].to_f)) * 100)\n if round_percentage\n return \"#{calc.round}\"\n else\n return \"#{calc}\"\n end\n else\n raise \"Error: #{type} is not an acceptable severity. Possible options include: all, tdp, udp, icmp, high, medium and low.\"\n end\n end",
"def percent_against\n (votes_against.to_f * 100 / (self.votes.size + 0.0001)).round\n end",
"def amount\n @percent\n end",
"def amount\n @percent\n end",
"def display_pct()\n\t sprintf('%0.3f', self.pct())\n\tend",
"def calc_response(resp)\n r = []\n\n resp.each do |re|\n r << re[1]\n end\n sprintf('%.2f', (r.inject(:+).to_f / r.length.to_f))\n end",
"def stat_ftc\n percentage(self.heifers_first, self.heifers_first_calved)\n end",
"def sanitize_js_pct(inJSPct)\n\t if inJSPct < 0.0\n\t\t 0.0\n\t end\n\t if inJSPct > 1.0 and inJSPct < 2.0\n\t\t 1.0\n\t end\n\t if inJSPct > 100.0\n\t\t 100.0\n\t end\n\t if inJSPct > 1.0\n\t\t inJSPct / 100.0\n\t else\n\t\t inJSPct\n\t end\n end",
"def get_percent_pos \n send_cmd(\"get_percent_pos\")\n end",
"def format_to_float(str)\n return str.to_f if !str.include?(\":\")\n \n array = str.split(\":\").reverse!\n total = 0.0\n array.each_with_index do |x, i|\n if i == 0\n total += x.to_f\n else\n total += (x.to_f * (60 ** i))\n end\n end\n \n total\n end",
"def parse_uptime(up)\n if up =~ /load averages?: (.*)/\n a,b,c = $1.split(/\\s+|,\\s+/)\n (a.to_f + b.to_f + c.to_f) / 3\n end\n end",
"def parse_uptime(up)\n if up =~ /load averages?: (.*)/\n a,b,c = $1.split(/\\s+|,\\s+/)\n (a.to_f + b.to_f + c.to_f) / 3\n end\n end",
"def percent_for\n (votes_for.to_f * 100 / (self.votes.size + 0.0001)).round\n end",
"def percentage_for(count, total, round=2)\n begin\n percentage = ((count.to_f / total.to_f) * 100).round(round)\n return 100.round(round) if percentage.round > 100\n percentage\n rescue FloatDomainError\n 0\n end\n end",
"def percent_ptn(kcal)\n (kcal * 100 / tee(kcal)).round(2)\n end",
"def percent_answered\n percent_answered_int.to_s + \"%\"\n end",
"def do_percent s; a = mega_pop(s); b = mega_pop(s); s[:stack].push(b%a); end",
"def vote_percentage(type)\n animals_votes = @db[\"select * from votes where animal_id in \\\n (select id from animals where type = '#{type}')\"]\n begin\n (animals_votes.count / @db[:votes].count.to_f * 100).round\n rescue FloatDomainError\n 50 # we have no data, it's 50:50\n end\n end",
"def percentage_of_promoters\n calculator.percentage_of_promoters\n end",
"def no_float(str)\n\t(str.to_f) == 0\ntotal_cents = ((str).to_f * 100).to_i\nend",
"def fee_as_percentage\n (merchant.fee * 100).to_i\n end",
"def percent_correct\n division_to_integer = (number_correct.to_f / @count)\n ((number_correct.to_f / @count) * 100).to_i\n end",
"def percent_or_pixel(number)\n number.to_f.zero? ? \"1px\" : \"#{number}%\"\n end",
"def calculate_fractional\n calculate_fractional ||= if @value.positive?\n @value / 100.rationalize\n else\n -100 / @value.rationalize\n end\n end",
"def to_str_percent(amount)\n\n percent = amount * 100\n\n return format(\"%2.2f\\%\", percent)\n\n end",
"def three_pt_pct\n return 0.0 if three_p.zero? || three_p_a.zero? \n\n (three_p.to_f/three_p_a).round(3)\n end",
"def parse_score(str)\n score = str[/(\\s|^)([1-9]\\d*|0)(\\.\\d{1,3})?(\\s|$)/]\n raise OutteError.new \"Couldn't find / understand the score\" if score.nil?\n raise OutteError.new \"The score is incorrect\" if !verify_score(score.to_f)\n score.to_f\nend",
"def get_percentage(number, differential, min)\n if differential == 0\n percentage = number\n else\n percentage = (number.to_f - min) / (differential)\n end\n percentage\n end",
"def get_porcentaje\n if @porcentaje.length==1\n \"(#{@porcentaje[0]}%)\"\n else\n \"(#{@porcentaje[0]} - #{@porcentaje[1]}%)\"\n end\n \n end",
"def post_process_float( val )\n\t\t\treturn Float( val.to_s )\n\t\tend",
"def user_percentage(user)\n\t\tworth \t\t= self.worth\n\t\tgrade \t\t= self.user_grade(user)\n\t\t\n\t\tif !grade.blank? && !worth.blank? && worth != 0\n\t\t\tpercent \t= (grade.to_f / worth.to_f) * 100\n\t\t\treturn percent\n\t\tend\n\tend"
] | [
"0.73787385",
"0.72825503",
"0.69483334",
"0.68342865",
"0.6810938",
"0.67334825",
"0.67295235",
"0.6727258",
"0.6716521",
"0.6677001",
"0.66509783",
"0.6631067",
"0.6560657",
"0.65534985",
"0.6470235",
"0.64059305",
"0.63977706",
"0.6391433",
"0.6383352",
"0.63677",
"0.63518125",
"0.63399255",
"0.6324044",
"0.63178116",
"0.6293722",
"0.62661755",
"0.62139",
"0.62075925",
"0.62075925",
"0.6196227",
"0.6195671",
"0.6182966",
"0.6154913",
"0.6142441",
"0.6141831",
"0.6139554",
"0.61010534",
"0.60765904",
"0.6072198",
"0.60471416",
"0.6043296",
"0.6024305",
"0.5981629",
"0.59590894",
"0.5957622",
"0.59575987",
"0.59512967",
"0.59512967",
"0.5949462",
"0.5949426",
"0.5940672",
"0.59379584",
"0.59357643",
"0.59199035",
"0.591791",
"0.591791",
"0.59144586",
"0.59144586",
"0.58954483",
"0.58537936",
"0.5849388",
"0.5845218",
"0.5839203",
"0.57905334",
"0.57815987",
"0.5778673",
"0.5770951",
"0.57639015",
"0.5760812",
"0.57600296",
"0.57547337",
"0.5752986",
"0.5752986",
"0.57493436",
"0.5744144",
"0.5715462",
"0.5711031",
"0.57079405",
"0.5697018",
"0.56850594",
"0.56850594",
"0.56722456",
"0.5669579",
"0.56649333",
"0.56630284",
"0.5658949",
"0.56588256",
"0.5654647",
"0.56396514",
"0.5635822",
"0.56207293",
"0.5612225",
"0.5606028",
"0.5604902",
"0.56041765",
"0.55979455",
"0.55953634",
"0.5594465",
"0.5586839",
"0.5585969"
] | 0.74519306 | 0 |
this doesnt work for 40!! its 39. float issue? | def test_change_margin_check_margin()
@item1.change_margin(40)
assert_equal(40, @item1.margin)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fractional; end",
"def Float(p0) end",
"def fahr_freezing_temp\n puts (32 - 32) * 0.5556#.round\nend",
"def prec_f() end",
"def irpoliinsaturadas\n vag=(grasaspoli * 100) / 70\n vag.round(2)\n end",
"def irpoliinsaturadasp\n vag=(valorgrasaspolip * 100) / 70\n vag.round(2)\n end",
"def valorsalp\n\t\tvag=(sal * 70) / 100\n vag.round(2)\n\tend",
"def valormonograsasp\n\t\tvag=(grasasmono * 70) / 100\n vag.round(2)\n\tend",
"def convert( temp_in_farenheit)\n (temp_in_farenheit.to_f - 32) * 5/9\nend",
"def irgrasassaturadas\n vag=(cgrasassa * 100) / 70\n vag.round(2)\n end",
"def valoralmidonp\n\t\tvag=(almidon * 70) / 100\n vag.round(2)\n\tend",
"def floor() end",
"def irgrasassaturadasp\n vag=(valorgrasassatup * 100) / 70\n vag.round(2)\n end",
"def ir_grasa_saturada \n\t\t@ir_grasa_saturada = (@saturadas/20.to_f)*100\n\t\t@ir_grasa_saturada.round(1)\n\tend",
"def converttemp (f)\n return (f-32) * (5/9.0)\nend",
"def convert(f)\n (f - 32.0) * 5 / 9\nend",
"def convert_temp(f)\n return (f - 32) * 5/9\nend",
"def round() end",
"def number_f\n return @number_f\n end",
"def f(x)\n (2**(30.403243784-x**2)).floor * 10**(-9)\nend",
"def prec_i() end",
"def decimal_places; end",
"def ir_sal \n\t\t@ir_sal = (@sal/6.to_f)*100\n\t\t@ir_sal.round(1)\n\tend",
"def tfullness\n ttaken.to_f/tlimit.to_f\n end",
"def convert(degrees_F = 73)\r\n (degrees_F - 32) * 5 / 9.0\r\nend",
"def irfibrap\n vag=(valorfibrap * 100) / 50\n vag.round(2)\n end",
"def irsalp\n vag=(valorsalp * 100) / 6\n vag.round(2)\n end",
"def convert(temp_f)\n (temp_f - 32) * 5 / 9\nend",
"def remaining_pints\n ((current_weight-14.25)/0.45).to_i > 0 ? ((current_weight-14.25)/0.45).to_i : 0\n end",
"def decimal_limit; end",
"def irpolialcoholesp\n vag=(valorpolialcoholesp * 100) / 90\n vag.round(2)\n end",
"def irmonograsaslp\n vag=(valormonograsasp * 100) / 70\n vag.round(2)\n end",
"def unote_finale\n @unote_finale ||= begin\n r = ((unombre_points.to_f / nombre_points_total) * 20).round(1)\n r.to_i != r || r = r.to_i\n r\n end\n end",
"def valorgrasaspolip\n\t\tvag=(grasaspoli * 70) / 100\n vag.round(2)\n\tend",
"def round_float(float, places); end",
"def c2f(c)\n (c*9.0/5+32).to_f.round(2)\nend",
"def irgrasas\n vag=(cgrasas * 100) / 70\n vag.round(2)\n end",
"def round_down_number(float)\nend",
"def max_altitude; end",
"def precision; end",
"def round\n end",
"def iralmidonp\n vag=(valoralmidonp * 100) / 90\n vag.round(2)\n end",
"def round_to_nearest_cash_value; end",
"def valorgrasassatup\n\t\tvag=(cgrasassa * 70) / 100\n vag.round(2)\n\tend",
"def eround(decimal_points = 0)\n (\"%.#{decimal_points}e\" % self).to_f\n end",
"def valorpolialcoholesp\n\t\tvag=(polialcoholes * 70) / 100\n vag.round(2)\n\tend",
"def irgrasasp\n vag=(valorgrasassatup * 100) / 70\n vag.round(2)\n end",
"def uberXL_fare_calculator(distance, minutes)\n base_fareXL = 3.85\n xlTotal = base_fareXL + (0.50 * minutes.to_i) + (2.85 * distance.to_i)\n if xlTotal < 10.50\n puts 10.50\n else\n puts \"The total for an UberXL is #{xlTotal}\"\n end\nend",
"def ctof(temp)\n temp * (9.0 / 5.0) + 32\nend",
"def relative(x); x.to_f/@game.height; end",
"def floor\n end",
"def price_in_sterling \n\t\tprice * 1.5\n\tend",
"def flotante()\n\t\tflotante = @num/@den.to_f\n\t\treturn flotante\n\tend",
"def get_double_value\n\t\tend",
"def defla(y=40,f=2)\n self.to_f*((1-(f.fdiv(100)))**y)\n end",
"def valorfibrap\n\t\tvag=(fibra * 70) / 100\n vag.round(2)\n\tend",
"def calc_upg_gigjoules_ch4 (val1 = 0.03778, val2 = calc_upg_ch4)\n\t\t(val1 * val2).round 2 \n\tend",
"def floor()\n #This is a stub, used for indexing\n end",
"def irhidratos\n vag=(hcarbono * 100) / 260\n vag.round(2)\n end",
"def ir_energetico \n\t\t@ener_ir = ener_kj\n\t\t@ir_energetico = (@ener_ir/8400.to_f) * 100\n\t\t@ir_energetico.round(1)\n\tend",
"def ir_hidratos \n\t\t@hidratos_ir = hidratos\n\t\t@ir_hidratos = (@hidratos_ir/260.to_f)*100\n\t\t@ir_hidratos.round(1)\n\tend",
"def shutter_speed_range; end",
"def ctof (degres)\n return ((degres * 1.8) + 32)\nend",
"def rm_edgy_x() (ppu_x * reg_radius).round + 5 end",
"def utilityF(delta)\n\treturn 1.0 if delta <= 0\n\treturn 2.0 ** (-delta / 30.0)\nend",
"def iralmidon\n vag=(almidon * 100) / 90\n vag.round(2)\n end",
"def kw_per_ton_to_cop(kw_per_ton)\n \n return 3.517/kw_per_ton\n \nend",
"def mag_from_db(decible)\r\n 10 ** (decible / 20.0)\r\n end",
"def irmonograsas\n vag=(grasasmono * 100) / 70\n vag.round(2)\n end",
"def round_up_number(float)\nend",
"def valorvityminp\n\t\tvag=(vitymin * 70) / 100\n vag.round(2)\n end",
"def decimals; num_dec; end",
"def boiling_point(elevation, boiling_ft)\n \televation * boiling_ft + 100\nend",
"def boiling_point(elevation, boiling_ft)\n \televation * boiling_ft + 100\nend",
"def irhidratosp\n vag=(valorhidratosp * 100) / 260\n vag.round(2)\n end",
"def in_fahrenheit\n\t\tif(@unit.to_s == \"f\")\n\t\t\t@degree\n\t\telse\n\t\t\t(@degree * (9.0/5.0)) + 32\n\t\tend\n\tend",
"def normal_speed(speed,takeoff_speed)\n return speed/takeoff_speed\nend",
"def ctof(temp)\n\t(temp * 9/5.0) + 32\nend",
"def ctof(cel)\n (cel * 9.0) / 5.0 + 32\nend",
"def convert(temp_in_fahrenheit)\n (temp_in_fahrenheit.to_f - 32) * 5/9\nend",
"def legendary_value(options)\n (5.00/25.00)\n end",
"def ctof(ctemp)\n32.0+(ctemp*9.0/5.0)\nend",
"def in_fahrenheit\n \t@f ? @f : @c * 9.0 / 5.0 + 32\n end",
"def convert(degree_fahrenheit)\n \n degree_celius = (degree_fahrenheit - 32)/1.8\n\nend",
"def value_round(resolution,value)\n y=1\n resolution.times {|n| y=y*10}\n if resolution == 0\n value = (value.round)/y\n else\n value = (value.round)/(y*1.0)\n end\nend",
"def numeric?; float?; end",
"def ctof(temp)\n ctof = (temp * (9.0/5.0)) + 32\nend",
"def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend",
"def farenheit\n self.to_f\n end",
"def ctof(c)\n\tc * (9.0 / 5.0) + 32\nend",
"def conversion_precision; end",
"def base_radius\n 200\n end",
"def ctof(temp)\n return temp*9/5.to_f + 32\nend",
"def ftoc(tempF)\n (tempF - 32.0)*5.0/9.0\nend",
"def convert(num)\n return num = num * 0.453592\nend",
"def valorenergeticoKJp\n\t\tvag=(valorenergeticoKJ * 70) / 100\n\t\tvag.round(2)\n\tend",
"def danger_temp\n 45\n end",
"def ctof temp2\n (temp2*1.8) + 32\nend",
"def calc_potential_wtruck_fueled(val1= calc_upg_ch4, val2= 35750)\n\t\t(val1 / val2).round 1\n\tend",
"def ctof(c)\n ((c * 1.8) + 32).round(1)\nend",
"def c2f(c)\n c * 9.0 / 5 + 32\nend"
] | [
"0.6774252",
"0.672812",
"0.6570865",
"0.65675396",
"0.6512004",
"0.64751947",
"0.646948",
"0.6417826",
"0.6384445",
"0.63770753",
"0.6364956",
"0.6363551",
"0.63534266",
"0.634874",
"0.6340488",
"0.6296843",
"0.6268328",
"0.62656295",
"0.61920637",
"0.6189428",
"0.61871594",
"0.61674505",
"0.6132002",
"0.6117043",
"0.61058813",
"0.6102393",
"0.6098243",
"0.6070731",
"0.6063701",
"0.60636014",
"0.6056782",
"0.6050658",
"0.6024693",
"0.6020252",
"0.60005575",
"0.60001326",
"0.5991396",
"0.59821653",
"0.59815913",
"0.5978526",
"0.5975501",
"0.5972889",
"0.597219",
"0.59621924",
"0.59448725",
"0.59397644",
"0.59234107",
"0.591714",
"0.5916846",
"0.5915853",
"0.59130543",
"0.5906009",
"0.59054095",
"0.5897604",
"0.58972436",
"0.5895",
"0.58834743",
"0.5881382",
"0.5878632",
"0.58762425",
"0.5874355",
"0.5870338",
"0.58651",
"0.5864824",
"0.58629996",
"0.58625704",
"0.5861852",
"0.58530086",
"0.5841913",
"0.5839923",
"0.583764",
"0.5825207",
"0.5823005",
"0.5823005",
"0.58217657",
"0.5820241",
"0.58128905",
"0.5811787",
"0.58099586",
"0.5806796",
"0.58061504",
"0.5803718",
"0.58022016",
"0.5796369",
"0.5792786",
"0.5790047",
"0.578124",
"0.5780469",
"0.5767181",
"0.57666874",
"0.576614",
"0.576263",
"0.5760875",
"0.57608336",
"0.576063",
"0.575741",
"0.5756212",
"0.5755817",
"0.5752801",
"0.57525724",
"0.57524693"
] | 0.0 | -1 |
Authentication page for user | def new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loginpage\n end",
"def authenticate_user\n \tif !logged_in?\n \tredirect_to login_url\n \tend\n end",
"def authentication\n if UserSession.find.nil?\n respond_to do |format|\n format.html { redirect_to(\"/login\", :notice => 'You must be logged in') }\n end\n end\n end",
"def displayLoginPage()\n\t# User Name: \n\t# Password:\n\t# Forgot Password?\tNew User?\n\treturn\nend",
"def login_page\n end",
"def authenticate_user\n redirect_to \"/login\" unless logged_in?\n end",
"def authenticate_user\n\t\trender_unauthorized unless current_user\n\tend",
"def authenticate\n redirect_to '/login' unless current_user\n end",
"def authenticate\n begin\n if !session[:user_guid]\n redirect_to(root_path)\n elsif session[:user_guid] != User.find_by(id: session[:user_id].to_i).guid\n redirect_to(logout_user_path)\n end\n rescue\n redirect_to(logout_user_path)\n end\n end",
"def user_authentication\n end",
"def authenticate\n redirect_to login_path if !logged_in\n end",
"def home\n authenticate!\n end",
"def authenticate\n unless current_user\n redirect_to login_path, alert: 'You are not authenticated to view this page. Please log in or sign up at first.'\n end\n end",
"def authenticate\n redirect_to(root_path) unless session[:username]\n end",
"def authenticate\n # if login failed, show error message\n if session[:login]\n # redirect_to '/index'\n else\n # continue showing the view\n end\n end",
"def auth_user\n\t\t@user = User.find_by(id: params[:id] )\n\t\tif @user \n\t\t\tif current_user? @user \n\t\t\t\t@view = nil\n\t\t\telse\t#show @user \n\t\t\t\tflashs = { error: \"Insufficient priviledge on @#{@user.login}\" }\n\t\t\t\tuser_show(@user.to_slug, flashs)\n\t\t\tend\n\t\telse\n\t\t\tflashs = { error: \"Invalid user id : #{params[:id].to_i}\" }\n\t\t\tredirect_format(\"/\", flashs, params[:callback] )\n\t\tend\n\tend",
"def authenticate\n if sesssion[:user_id].nil?\n redirect_to login_path, notice: \"You must log in first.\"\n end\n end",
"def authenticate\n if logged_in_user\n redirect_to root_url unless current_user?(find_user)\n end\n end",
"def authenticate_user\n redirect_to login_path unless logged_in_user?\n end",
"def authenticate_user!(options = {})\n head :unauthorized unless signed_in?\n end",
"def authenticate_user!\n \tunless current_user?\n \trender status: :unauthorized\n \tend\n end",
"def authenticate_user!\n unless @current_user\n head :unauthorized\n end\n end",
"def authenticate\n \treturn if controller_name == \"pages\"\n \tif !logged_in?\n \t\tflash[:alert] = \"Must be an admin or a nutritionist\"\n \t\tredirect_to root_path\n \tend\n end",
"def authenticate\n redirect_to login_url, danger: \"Please Login\" unless current_user\n end",
"def authenticate!\n\t #when we solve the require relative problem write the line: unless session[:user_id] && User.where(id: session[:user_id])\n\n\t\tif session[:user_id] && User.where(id: session[:user_id]).exists? #if the user id saved in session does not belong to any user, also direct to general homepage\n\t\t\ttrue\n\t\telse\n\t\t\tsession[:original_request] = request.path_info\n\t\t\tfalse\n\t\tend\nend",
"def auth\n #redirect to login page unless already logged in\n redirect_to new_user_session_path, alert: \"You must login to access that page\" unless logged_in?\n end",
"def authenticate\n if @current_user\n else\n redirect_to login_url\n end\n end",
"def authenticate\n unless logged_in?\n redirect_to login_url\n end\n end",
"def index\n res = create_request2(root_url + '/login/auth', 'tequila.epfl.ch')\n redirect_to ('https://tequila.epfl.ch/cgi-bin/tequila/requestauth?request' + res)\n end",
"def check_login!\n u = check_and_get_user\n redirect to('/signin.html') unless u\n u\n end",
"def auth_user\n redirect_to new_user_session_url unless user_signed_in?\n end",
"def authenticate_user\n redirect_to root_path unless signed_in?\n end",
"def authorized\n if logged_in?\n return View(\"sessions/page_requires_login\"); \n end\n return View(\"Index\")\n end",
"def auth\n end",
"def auth\n end",
"def login\n # show LOGIN form\n\n end",
"def login\n @user = User.find_or_create_from_auth_hash(auth_hash)\n @user_name = @user.display_name\n\n session[:current_user_id] = @user.id\n\n render :login, :layout => false\n end",
"def authenticate\n if session[:account].blank?\n @is_login = false\n reset_session\n render \"login/error\"\n else\n @is_login = true\n @user = User.where( \"account = ?\", session[:account] )[0]\n end\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def authenticate_signin\n\t Client.authenticate(params[:email], params[:password]) || render_unauthorized\n\t end",
"def authenticate\n authenticated_session || render_unauthorized\n end",
"def authenticate\n unless session[:user_id]\n session['return_url'] = request.url\n logger.debug request.url\n # Recreate user abilities on each login\n @current_ability = nil\n redirect_to polymorphic_url(:new_user_session)\n end\n end",
"def user_authenticated\n redirect_to root_url, alert: 'You must be logged in to go here' unless current_user\n end",
"def authenticate_user\n if session[:user_id].blank?\n redirect_to root_path\n end\n end",
"def login\n email = params[:email]\n password = params[:password]\n render plain: User.check_credentials(email, password)\n end",
"def authenticate_user\n render_403 'Invalid user.' if @user.blank? || !@user.active?\n end",
"def authenticate_user!(options = {})\n head :unauthorized unless signed_user_in?\n end",
"def authenticate\n if not current_user\n redirect_to signin_path, notice: 'Not logged in'\n end\n end",
"def authenticate\n if !logged_in? || current_user.nil?\n redirect '/login'\n end\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def require_auth\n\n # When no user is logged in, redirect the visitor to the login page\n if @user.nil?\n respond_to do |format|\n format.html { redirect_to :controller => :auth, :action => :login }\n end\n end\n\n end",
"def login\n if request.get?\n if User.current.logged?\n #redirect_to home_url\n redirect_to browse_models_url\n end\n else\n authenticate_user\n end\n rescue AuthSourceException => e\n logger.error \"An error occured when authenticating #{params[:username]}: #{e.message}\"\n render_error :message => e.message\n end",
"def authenticate!\r\n\tif !current_user\r\n\t\tredirect \"/login\"\r\n\tend\r\nend",
"def authenticate_and_load_user\n \t@logged_in_user = User.where(id:session[:user_id]).first\n\n \tif @logged_in_user.nil?\n \t\tflash[:error] = 'You must be authenticated to visit this page'\n \t\t# Save the user's intended destination in the session, so we can\n \t\t# take them there once they've logged in.\n \t\tsession[:requested_fullpath] = request.fullpath\n \t\tredirect_to controller:'public', action:'login'\n \t\tfalse # return false to prevent execution of controller methods\n \telse\n \t\ttrue\n \tend\n end",
"def login()\n session[:cas_user] = nil\n \n if request.post?\n clear_page_vars\n user = User.authenticate(params[:username])\n if user\n session[:cas_user] = user.username\n \n # Cache some common looked-up user fields.\n person = lookup_cas_user(user.username)\n if person\n session[:title] = person.title\n session[:phone] = person.phone\n end\n \n uri = session[:original_uri]\n session[:original_uri] = nil\n home = user_home(user) \n redirect_to(uri || {:action => home})\n else\n flash.now[:notice] = \"Invalid user.\" \n end\n end\n end",
"def authenticate\n self.logged_in_user = User.authenticate(params[:user][:email], params[:user][:password])\n if is_logged_in?\n #redirect_to index_url\n redirect_to :controller => 'pages', :action => 'admin'\n else\n flash[:error] = \"I'm sorry, either your email or password are incorrect\"\n redirect_to :controller => 'account', :action => 'login'\n end\n end",
"def authenticate\n user = nil\n user = User.find_by_id(session[:user_id]) if session[:user_id].present?\n if !user.present?\n session[:user_id] = nil\n flash[:alert] = \"You must be logged in to access this page\"\n redirect_to login_path(:return_to => request.fullpath)\n end\n end",
"def authenticate_user\n if !current_user\n redirect_to login_path\n end\n end",
"def authenticate_user\n if !current_user\n redirect_to login_path\n end\n end",
"def custom_user_auth\n\t\t\tunless student_signed_in? || admin_signed_in?\n\t\t\t\tredirect_to root_path, notice: \"You have to sign in.\"\n\t\t\tend\n\t\tend",
"def login_post\n @user = User.find_by_username(params[:user][:username])\n \n if @user == nil or not @user.password_valid?(params[:user][:password]) then\n respond_to do |format|\n format.html { redirect_to login_users_path, notice: \"Either the username or password is invalid. Please try again.\"}\n format.json { head :no_content }\n end\n return\n else\n session[:user] = @user\n\n if session[:previous_page] then\n respond_to do |format| \n session[:no_back] = true\n format.html { redirect_to session[:previous_page] }\n format.json { head :no_content }\n end\n\n session[:previous_page] = nil\n return\n end\n \n logged_in_home_page = users_path + '/' + session[:user][:id].to_s\n respond_to do |format|\n format.html { redirect_to gardens_path}\n format.json { head :no_content }\n end\n return\n end\n end",
"def sign_in\n\t\t user = User.find_by_username(params[:username])\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n flash[:notice]=\"hello #{user.name}\"\n case user.role\n when \"s\"\n redirect_to supervisor_index_path and return\n when \"a\"\n redirect_to receptionnist_index_path and return\n end \n else\n flash[:error]= \"Invalid username or password\"\n redirect_to root_url and return\n end\n\tend",
"def authenticate_user\n case request.format\n when /text\\/html/\n redirect_to new_session_path unless current_user\n when /application\\/json/\n head :unauthorized unless current_user\n end\n\n end",
"def authenticate_user\n if session[:user_id]\n # set current user object to @current_user object variable\n puts \"===============================================auth_if==============================================\"\n @current_user = User.find session[:user_id]\n return true\n else\n puts \"===============================================auth_else==============================================\"\n redirect_to(:controller => 'welcome', :action => 'index')\n return false\n end\n end",
"def login \n @user = User.new\n @current_uri = request.env['PATH_INFO']\n render \"users/new\", :layout => \"signup_login\"\n end",
"def auth\n session[:referer] = request.env['HTTP_REFERER'] if request.env['HTTP_REFERER']\n userparams = params[:user]\n @user = User.auth(userparams[:login],userparams[:password])\n #\n respond_to do |format|\n if @user.nil?\n logger.debug(\"User not found\")\n #login failed\n flash[:notice] = t('general.login_password_not_found')\n format.js { }\n format.xml { render :xml => {:auth => 'Failed', :description => flash[:notice]}.to_xml }\n format.html {redirect_to(:action=>'login')}\n elsif @user && !@user.active\n logger.debug(\"User is not active\")\n flash[:notice] = t('general.user_not_activated')\n format.js { }\n format.xml { render :xml => {:auth => 'Failed', :description => flash[:notice]}.to_xml }\n format.html {redirect_to(:action=>'login')}\n else\n #loged in\n session[:user] = @user.id\n logger.debug(session.inspect)\n @user.update_attribute(:updated_at, Time.now)\n format.js {}\n format.xml { render :xml => {:auth => 'OK', :user => @user}.to_xml }\n format.html {redirect_to(session[:referer] || '/')}\n end\n end\n \n end",
"def ensure_authenticated_user\r\n head :unauthorized unless current_user\r\n end",
"def authenticate_user\n if !user_logged_in?\n # Store current url path for future reference\n store_location\n # Redirect to home page with error flash\n flash[:error] = \"Please Signin to access this page\"\n redirect_to root_path\n end\n end",
"def authenticate_user\n unless signed_in?\n redirect_to login_url, notice: \"Please log in first\"\n end\n end",
"def login\n\t#Login Form\n end",
"def auth\n\n encrypted = Digest::SHA256.hexdigest(params['password'])\n user = User.find(:first,:conditions => [\"user = ? or password = ? \",params['user'],encrypted])\n\n\n respond_to do |format|\n if user\n #session\n session[:user] = user.user\n session[:user_role] = user.role\n format.html { redirect_to :controller => \"applications\",:action => \"index\" }\n else\n format.html { render :action => \"index\" , notice: 'Login error.'}\n end\n\n end\n end",
"def login\n end",
"def show\n\t\t@user = User.find_by_md5(params[:id])\n\t\t@admin = User.find(1)\n\t\tsignin_and_active(@user,@admin)\n\n\tend",
"def login\n\t @user = current_user\n\t respond_to do |format|\n\t format.html {render :text => \"#{@user.id}\"}\n\t #format.xml {render :text => \"#{@user.id}\" }\n\t format.json {render :json => \"#{@user.id}\"}\n\t end\n\tend",
"def authenticate_user\n if session[:user]\n return true\n else\n session[:return_to] = request.fullpath\n redirect_to(:controller => 'users', :action => 'login')\n flash[:notice] = \"You need to login to view the requested page! \"\n flash[:color]= \"invalid\"\n return false\n end\n end",
"def sign_in_user user\n user.fetch_pages\n sign_in_and_redirect user, :event => :authentication\n user\n end",
"def authenticate_user!(*args)\n if request.get? && !logged_in?\n session[:return_to] = request.fullpath\n session[:return_to_for_new_user] = request.fullpath\n end\n super\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def authenticate\n\t\tunless admin?\n\t\t\tflash[:error] = 'unauthorized access'\n\t\t\tredirect_to home_path\n\t\tend\n\tend",
"def authenticate_user\n# save current page for redirection after login\n redirect_to controller: :user, action: :login unless logged_in? \n current_user\n end",
"def authenticate_user!\n unless current_user?\n render status: :unauthorized\n end\n end",
"def auth(controller)\n #controller.reset_session\n token = controller.params[:access_token]\n user = User.where(:access_token => token).first\n if user\n controller.sign_in(user)\n\n ## TODO: We should change the token here.\n\n data = \"<login\"\n data += \" name='#{user.name}'\"\n data += \" email='#{user.email}'\"\n data += \" roles='#{user.role_symbols.join(\",\")}'\"\n data += \" authToken='#{token}'\"\n data += \"/>\"\n controller.render :xml => data, :status => 200\n else\n controller.render :xml => \"<NoWay/>\", :status => 404\n end\n end",
"def login\n\n end",
"def login\n\n end",
"def authenticate_user!\n redirect_to '/auth/sweetsuite' unless access_token && current_user\n end",
"def authenticate\n\t\tif user_signed_in?\n\t\t\ttrue\n\t\telse\n\t\t\tredirect_to new_user_session_path, format: 'js', alert: \"please login to vote\"\n\t\tend\n\tend",
"def authenticate\n return redirect_to(sign_in_url) unless signed_in?\n end"
] | [
"0.7355386",
"0.72648567",
"0.72240555",
"0.71717376",
"0.7170952",
"0.7103944",
"0.7039346",
"0.7037468",
"0.70302737",
"0.7024364",
"0.70205873",
"0.7002982",
"0.69805145",
"0.6974057",
"0.6970712",
"0.6958569",
"0.69407356",
"0.692904",
"0.69278985",
"0.6924855",
"0.69185823",
"0.69184226",
"0.6885784",
"0.687983",
"0.6868588",
"0.6863429",
"0.68609124",
"0.6847161",
"0.6830072",
"0.67949545",
"0.67905235",
"0.678655",
"0.67825305",
"0.67758524",
"0.67758524",
"0.6771904",
"0.67627645",
"0.6757396",
"0.674356",
"0.674356",
"0.674356",
"0.6734271",
"0.6734271",
"0.6734271",
"0.6734271",
"0.6733184",
"0.6733078",
"0.67275614",
"0.67216724",
"0.672125",
"0.67063934",
"0.6705824",
"0.6701987",
"0.668324",
"0.6683134",
"0.6676527",
"0.6674873",
"0.6671112",
"0.6669741",
"0.66695946",
"0.6669063",
"0.6662914",
"0.6653801",
"0.66468877",
"0.66468877",
"0.6644717",
"0.66266334",
"0.662223",
"0.6621806",
"0.66189283",
"0.66104996",
"0.66081285",
"0.6602365",
"0.6593696",
"0.6590551",
"0.6588915",
"0.6581034",
"0.6579952",
"0.65797037",
"0.65760285",
"0.6569781",
"0.65683085",
"0.65657216",
"0.6565049",
"0.6565049",
"0.6565049",
"0.6565049",
"0.6565049",
"0.6565049",
"0.6565049",
"0.6565049",
"0.6565049",
"0.65645665",
"0.6554204",
"0.65500975",
"0.6547107",
"0.65361303",
"0.65361303",
"0.65331274",
"0.6519378",
"0.6514639"
] | 0.0 | -1 |
Authenticate user based on email and password | def create
result = @api_service.sign_in(params.slice(:email, :password).as_json)
if result&.dig("user", "auth_token").present?
cookies[:auth_token] = result&.dig("user", "auth_token")
redirect_to edit_user_path(id: 1), notice: "Signed in successfully"
else
flash.now[:alert] = result&.dig("error", "message")
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate!\n user = User.where(email: params[\"email\"]).first\n if user && user.authenticate(params[\"password\"])\n success!(user)\n else\n fail!(\"Could not log in\")\n end \n end",
"def authenticate(email, password)\n user = User.find_for_authentication(email: email)\n user.try(:valid_password?, password) ? user : nil\n end",
"def authenticate(email, password)\n user = User.find_by_email(email) #find user exist in db\n return user if user && user.password == password #authenticate pwd\n nil\n end",
"def authenticate!\n username_password_hash = username_password\n \n username = username_password_hash['username']\n password = username_password_hash['password']\n\n user = User.find_by_email(username)\n if user.nil? || user.password != password\n fail! :message => \"strategies.password.failed\"\n else\n success! user\n end\n end",
"def authenticate!\n if params[:user]\n user = User.find_by(email: params[:user][:user_name])\n if user and user.local? and user.valid_password?(params[:user][:password])\n success!(user)\n else\n fail\n end\n elsif auth\n user = User.find_by(email: auth.credentials.first)\n if user and user.local? and user.valid_password?(auth.credentials[1])\n success!(user)\n else\n fail\n end\n else\n fail\n end\n end",
"def authenticate_signin(email, password)\n Credentials::Password.authenticate_email email, password\n end",
"def authenticate(email, password)\n u = first(:email => email)\n u && u.activated? && u.authenticated?(password) ? u : nil\n end",
"def authenticate?(email, password)\n user = User.find_by_email email\n return nil if user.nil?\n return user if user.has_password?(password)\n end",
"def authenticate_by_email_password(email, password)\n user = User.find_by(email: email.downcase)\n\n if user && user.authenticate(password)\n @user = user\n @token = create_access_token\n\n true\n else\n false\n end\n end",
"def authenticate_signin\n\t Client.authenticate(params[:email], params[:password]) || render_unauthorized\n\t end",
"def authenticate(email, password)\n query = <<SQL\nSELECT id, account_name, nick_name, email\nFROM users\nWHERE email = ? AND passhash = SHA2(CONCAT(?, salt), 512)\nSQL\n result = db.xquery(query, email, password).first\n unless result\n raise Isucon5::AuthenticationError\n end\n session[:user_id] = result[:id]\n result\n end",
"def authenticate\n user = User.find_by(email: params[:email].to_s.downcase)\n\n if user && user.authenticate(params[:password])\n auth_token = JsonWebToken.encode({user_id: user.id})\n render json: {auth_token: auth_token, user: user}, status: :ok\n else\n render json: {error: 'Invalid username / password'}, status: :unauthorized\n end\n end",
"def authenticate\r\n if User.exists?(email: auth_params[:email])\r\n auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\r\n render json: {\r\n code: 200,\r\n success: true,\r\n message: \"Logged in Successfully\",\r\n auth_token: auth_token\r\n }\r\n else\r\n render json: {\r\n code: 400,\r\n success: false,\r\n message: \"Invalid credentials\"\r\n }\r\n end\r\n end",
"def user_authenticated_with_warden email, password\n user = User.where(email: email).first\n if user && user.valid_password?(password)\n user\n else\n nil\n end\n end",
"def authenticate(username_or_email, password)\n user = PublicEarth::Db::User.new\n if username_or_email.blank?\n user.errors.add_to_base(\"NO_USERNAME\")\n elsif password.blank?\n user.errors.add_to_base(\"NO_PASSWORD\")\n else\n existing = find_by_username_or_email(username_or_email)\n if existing\n if active?(existing.id)\n begin\n user.attributes = one.authenticate(username_or_email, password)\n user.authenticated = true\n rescue\n user.errors.add(:username, \"INVALID_PASSWORD\")\n end\n else\n user.errors.add_to_base(\"UNCONFIRMED\")\n end\n else\n user.errors.add_to_base(\"INVALID_ACCOUNT\")\n end\n end\n user\n end",
"def authenticate(email, password)\n # Because we use bcrypt we can't do this query in one part, first\n # we need to fetch the potential user\n user = User.find_by(email: email)\n\n if user\n # Then compare the provided password against the hashed one in the db.\n if BCrypt::Password.new(user.password).is_password? password\n # If they match we return the user\n return user\n end\n end\n # If we get here it means either there's no user with that email, or the wrong\n # password was provided. But we don't want to let an attacker know which.\n return nil\n end",
"def authenticate email, pass, expire=nil\n email.downcase!\n user = User.get(email)\n if user.nil? or not user.origin.split(',').include?('local')\n return false\n end\n if user.password == pass && !pass.empty?\n generate_and_set_session_key(email, expire)\n return true\n end\n false\n end",
"def authenticate\n command = AuthenticateUser.call(params[:email].to_s.strip.downcase, params[:password])\n if command.success?\n @auth_token = command.result\n else\n render json: { error: command.errors }, status: :unauthorized\n end\n end",
"def authenticate\n command = AuthenticateUser.call(params[:email], params[:password])\n\n if command.success?\n json_response(auth_token: command.result)\n else\n json_response({ error: command.errors }, :unauthorized)\n end\n end",
"def check_credentials\n @user = User.where(email: params[:email]).first\n if @user && @user.valid_password?(params[:password])\n head :ok\n else\n head :unauthorized\n end\n end",
"def authenticate\n email = auth_params[:email]\n password = auth_params[:password]\n auth_token = AuthenticateUser.new(email, password).call\n user = User.find_by(email: email)\n\n json_response({\n user: {\n **user.get_sanitized_user,\n auth_token: auth_token,\n }\n }, :accepted)\n end",
"def authenticate(password)\n user && user.password == password\n end",
"def login\n email = params[:email]\n password = params[:password]\n render plain: User.check_credentials(email, password)\n end",
"def authenticate(attrs_or_email, password=nil)\n email = attrs_or_email.is_a?(Hash) ? attrs_or_email[:email] : attrs_or_email\n password = attrs_or_email.is_a?(Hash) ? attrs_or_email[:password] : password\n \n response = MLS.get('/account', {:email => email, :password => password})\n MLS::Account::Parser.parse(response.body)\n rescue MLS::Exception::Unauthorized => response\n nil\n end",
"def authenticate!(password)\n raise_if_blank password, 'password'\n resp = API.connection.post 'users/sign_in', { \n user: {\n email: @email, \n password: password\n }\n }\n\n case resp.status\n when 201\n refresh_from_user_response resp\n when 401\n raise Teachable::AuthError, resp.body['error']\n else\n raise Teachable::Error, 'Unknown response.'\n end\n end",
"def authenticate(name_or_email, password)\n m = active.find_by_email(name_or_email)\n m = active.find_by_name(name_or_email) unless m \n m && m.authenticated?(password) ? m : nil\n end",
"def authenticate_user\n user = User.where(email: params[:email]).first\n if user.password == params[:password]\n render json: payload(user)\n else\n render json: {errors: ['Invalid Password']}, status: :unauthorized\n end\n rescue NoMethodError\n render_not_found \"Email not registered\"\n end",
"def authenticate\n command = AuthenticateUser.call(params[:email], params[:password])\n\n if command.success?\n if command.result[:isVerified]\n \trender json: command.result\n else\n \trender json: { error: 'Please check your email for instructions to verify your account!' }, status: 400\n end\n else\n render json: { error: \"Invalid credentials!\" }, status: :unauthorized\n end\n end",
"def authenticate\n user = User.active.where(\"email_id = ?\", self.email_id).first\n if user.present?\n return user.hashed_password == Digest::SHA1.hexdigest(user.password_salt.to_s + self.password)\n end\n return false\n end",
"def authenticate\n user = User.find_by_email(auth_params[:email])\n return json_response({message: 'Invalid credentials'}, :unauthorized) if !user.present?\n user.last_login = Time.now\n user.save!\n auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n render json: { auth_token: auth_token}\n end",
"def authenticates?(email, password)\n account = dealer_dao.get_by_email(email)\n !account.nil? && !account.identity.nil? && account.identity.auth?(email, password)\n end",
"def attempt_login\n if params[:email].present? && params[:password].present?\n found_user = User.where(email: params[:email]).first\n authorized_user = found_user.authenticate(params[:password]) if found_user\n end\n\n if authorized_user\n authenticate_user(found_user.id)\n flash[:notice] = 'You are now logged in.'\n redirect_to(challenge_index_path)\n else\n flash.now[:notice] = 'Invalid email/password combination.'\n render('login')\n end\n end",
"def user\n user = User.find_by_email(email)\n return user if user && user.authenticate(password)\n errors.add :user_authentication, 'invalid credentials'\n nil\n end",
"def authenticate\n if @user = User.authenticate(params[:email], params[:password])\n render json: {message: @user, success: true}, status: 200\n else\n render json: {message: \"Authentication failed\", success: false}, status: :ok\n end\n end",
"def authenticate(password)\n raise ArgumentError, \"email must be set\" if (self.email.nil? || self.email.to_s.empty?)\n response = Http.custom_auth_get(\n self.email,\n password,\n \"/accounts/api/auth/\"\n )\n raise \"unexpected response: #{response.code} - #{response.body}\" unless response.code == 200\n true\n rescue *[RestClient::Unauthorized] => e\n false\n end",
"def user\n user = User.find_by_email(email)\n return user if user&.authenticate(password)\n\n errors.add :user_authentication, 'invalid credentials'\n nil\n end",
"def submit\n user = User.where(email: email).first\n if user && !user.password.nil? && user.password == password\n user\n else\n errors.add(:base, :invalid_credentials)\n nil\n end\n end",
"def authenticated_user\n User.where(email: email_from_headers, password: password_from_headers).first\n end",
"def authenticate\n\t\tauth_token =\n\t\t\tAuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n\t\tjson_response(auth_token: auth_token)\n\tend",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token, config: get_current_configuration, provider: 'email')\n end",
"def login\n user = User.find_by_email(params[:email])\n\n if user && user.valid_password?(params[:password])\n expose user, serializer: CompactUserSerializer\n else\n error! :invalid_resource, user.try(:errors),\n metadata: { error_description: \"Invalid login information.\" }\n end\n end",
"def call\n user = User.find(email: @email)\n\n return user if user&.authenticate(@password)\n\n raise(Exceptions::InvalidEmailOrPassword)\n end",
"def authenticate_user_from_token\n authenticate_with_http_token do |token, options|\n user_email = options[:email]\n user_email && User.where(email: user_email, authentication_token: token).first\n end\n end",
"def signin_check_credentials\n user = User.find_by!(email: params[:email])\n if user.authenticate(params[:password])\n render json: { notice: :ok, user: user }\n else\n render json: { error: I18n.t('api.errors.invalid_credentials') }, status: 400 # :unauthorized\n end\n end",
"def authenticate_user(username,password)\n User.authenticate(username,password)\n end",
"def authenticate_user(username,password)\n User.authenticate(username,password)\n end",
"def authenticate!\n resource = mapping.to.where(:username => authentication_hash[:email]).first if authentication_hash\n resource ||= mapping.to.new if resource.nil?\n\n username = authenticate_against_ebay(authentication_hash[:email], password)\n\n if username\n resource.username = username\n resource.password = password\n resource.password_confirmation = password\n resource.save if resource.changed?\n end\n\n return fail(:invalid) unless username and resource\n\n if validate(resource) { not resource.nil? }\n success!(resource)\n end\n end",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token)\n end",
"def create\n email = params[:email]\n password = params[:password]\n @user = User.find_by_email(email)\n if user.authenticate(@user)\n respond_with(@user)\n else\n respond_with(@user, status: :error)\n end\n end",
"def authenticate(user, password, account)\n user == @user &&\n (password.nil? || password == @password) &&\n (account.nil? || account == @account)\n end",
"def authenticate(username, password)\n if user = find_by_username(username)\n if user.correct_password?(password)\n user\n end\n end\n end",
"def authenticate(password)\n true\n end",
"def authenticate(login, password)\n u = find_in_state :first, :active, \n :conditions => [\"admin_users.login = ? OR admin_users.email = ?\", login, login]\n u && u.authenticated?(password) ? u : nil\n end",
"def login\n if User.find_by(email: user_params[:email]).try(:authenticate, user_params[:password])\n puts \"GOTIT \", user_params[:email], \"dssdf\"\n render json: User.find_by(email: user_params[:email])\n else\n puts \"MISSEDIT \", user_params[:email], \"dssdf\"\n render json: \"false\"\n end\n end",
"def create\n\t resource = User.find_for_database_authentication(email: params[:user][:email]) \n\t return failure unless resource\n\t return failure unless resource.valid_password?(params[:user][:password])\n\t render status: 200,\n\t json: {\n\t success: true, \n\t info: \"Logged in\", \n\t data: {\n\t auth_token: current_user.authentication_token\n\t }\n\t }\n\tend",
"def authenticate\n\t \tcommand = AuthenticateUser.call(params[:email], params[:password],'email_login')\n\t @user = User.find_by_email(params[:email])\n\t if command.success?\n\t \tif @user.user_type == \"site\"\n\t \t\tUserMailer.login(@user).deliver_later\n\t \t\trender json: { auth_token: command.result,\n\t \t\t\t\t\t user_type: @user.user_type,\n\t \t\t\t\t\t user_id: @user.id,\n\t \t\t\t\t\t roles: @user.roles }\n\t \telsif @user.user_type == \"startup\"\n\t \t\tUserMailer.login(@user).deliver_later\n\t \t\tstartup_user = StartupUser.find_by_user_id(@user.id)\n\t \t\tprogram_id = startup_user.startup_profile.startup_registration.program.id\n\t \t\trender json: { auth_token: command.result,\n\t \t\t\t\t\t\t user_type: @user.user_type,\n\t \t\t\t\t\t\t user_id: @user.id,\n\t \t\t\t\t\t\t startup_profile_id: startup_user.startup_profile_id,\n\t \t\t\t\t\t\t program_id: program_id }\n\t \telsif @user.user_type == \"mentor\"\n\t \t\tUserMailer.login(@user).deliver_later\n\t \t\tmentor_user = MentorUser.find_by_user_id(@user.id)\n\t \t\trender json: { auth_token: command.result,\n\t \t\t\t\t\t\t user_type: @user.user_type,\n\t \t\t\t\t\t\t user_id: @user.id}\t\t\t\t\t \n\t \tend\n\t \t\t@user.access_token = command.result\n\t \t@user.save!\n\t else\n\t render json: { message: command.errors[:message][0] }, status: :unauthorized\n\t end\n\t end",
"def create\n \n user = User.find_by_email(params[:email])\n Rails.logger.debug(\"Attempting to authenticate: #{user.inspect}\")\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to root_path, :notice => 'You have been successfully logged in.'\n else\n render 'new'\n end\n\n end",
"def authenticate(email_or_username, password)\n return nil if email_or_username.blank?\n member = find_by_email_or_username(email_or_username)\n if member && member.password == password\n return member\n else\n return nil\n end\n end",
"def authenticate password\n if self.password == password\n true\n else\n false\n end\n end",
"def auth email_or_token, password = nil\n password ? post(\"auth\", email: email_or_token, password: password) :\n post(\"auth/#{email_or_token}\")\n end",
"def login\n email = params[:user][:email]\n password = params[:user][:password]\n\n user = User.authenticate_by_email(email, password)\n\n\n if user\n session[:email] = user.email\n flash[:notice] = 'Welcome.'\n redirect_to :root\n else\n flash.now[:error] = 'Unknown user. Please check your username and password.'\n render :action => \"sign_in\"\n end\n\n end",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token)\n end",
"def login_user(email, clean_password)\n user_data = User.find_by_email email\n return false unless user_data\n password = user_data.password\n return false unless password == hash_str(clean_password)\n return user_data\n end",
"def authenticate\n auth_response =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_response[:token], user_name: auth_response[:user_name])\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |email, password| \n User.authenticated?(email, password, request.remote_ip)\n end\n end",
"def authenticate(field, password)\n @u = find_active_with_conditions(MA[:login_field] => field)\n @u = @u && @u.authenticated?(password) ? @u : nil\n end",
"def login\n user = User.find_by(email: params[:email])\n if (user && user.authenticate(params[:password]))\n render json: {user: user.user_information, token: JWT.encode({userId: user.id}, 'secret')}\n else\n render json: {errors: \"Invalid email/password combination. Please try again or register if you do not already have an account.\"}\n end\n end",
"def authenticate\n if session[:account].blank?\n @is_login = false\n reset_session\n render \"login/error\"\n else\n @is_login = true\n @user = User.where( \"account = ?\", session[:account] )[0]\n end\n end",
"def authenticate\n self.logged_in_user = User.authenticate(params[:user][:email], params[:user][:password])\n if is_logged_in?\n #redirect_to index_url\n redirect_to :controller => 'pages', :action => 'admin'\n else\n flash[:error] = \"I'm sorry, either your email or password are incorrect\"\n redirect_to :controller => 'account', :action => 'login'\n end\n end",
"def login\n user = User.find_by_email(params[:user][:email])\n if user == nil\n flash[:errors] = [\"Email not found!\"]\n redirect_to :back\n else\n if user.authenticate(params[:user][:password])\n session[:user_id] = user.id\n redirect_to '/channels/main'\n else\n flash[:errors] = [\"Password does not match!\"]\n redirect_to :back\n end\n end\n end",
"def login_correctly\r\n\t\tuserid = \"correct_user@email.com\"\r\n\t\tpassword = \"correct_password\"\r\n\tend",
"def authenticate_user_from_token!\n authenticate_with_http_token do |token, options|\n user_email = options[:email].presence\n user = user_email && User.find_by_email(user_email)\n\n if user && Devise.secure_compare(user.authentication_token, token)\n sign_in user, store: false\n end\n end\n end",
"def authenticate_user(username, password)\n api(\"AuthenticateUser\", username, password)\n end",
"def authenticate(username_or_email, password, remember = false)\n user=self.find_by_username(username_or_email) || self.find_by_email(username_or_email)\n if user\n expected_password=encrypt_password(password, user.password_seed)\n unless expected_password == user.hashed_password && user.active\n user = nil \n else\n user.create_remember_me_token if remember\n end\n end\n return user\n end",
"def authenticate\n auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n user = User.find_by_email(auth_params[:email])\n render json: user.attributes.merge!({ token: auth_token, role: Role.find(user.role_id) })\n end",
"def login\n\t\t# Checks if there's a user associated\n\t\t# with the given email.\n\t\tu = User.find_by_email(params[:email])\n\n\t\t# If we find an email and the user\n\t\t# supplied the correct password we \n\t\t# login the user by starting a session.\n\t\t# We also redirect the user to the\n\t\t# control panel.\n\t\tif u && u.authenticate(params[:password])\n\t\t\t@id = u.id\n\t\t\t@token = Base64.encode64(params[:email] + ':' + params[:password])[0..-2]\n\n\t\t\tsession[:userid] = u.id\n\t\t\trender :template => 'api/v1/login/success'\n\t\telse\n\t\t\trender :status => 401, :template => 'api/v1/login/failure'\n\t\tend\n\tend",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n render json: { auth_token: auth_token, user: find_user }\n end",
"def login\n if( params[:email].present? && params[:password].present? )\n user = User.where(\"lower(email)=?\",params[:email].downcase).first\n if user && user.valid_password?(params[:password])\n render json: user\n else\n render json: \"error\"\n end\n else\n render json: \"error\"\n end\n end",
"def authenticate\n @username = params[:username]\n @password = params[:password]\n user = User.find_by(username: @username)\n\n # NEED TO ADD THE PASSWORD VERIFICATION BACK IN\n if user && user.authenticate(@password)\n render json: { auth_token: user.generate_auth_token, user_id: user.id, user_name: user.name }\n else\n render json: { error: 'Invalid username or password' }, status: :unauthorized\n end\n end",
"def login\n user = User.find_by(email: user_login_params[:email])\n\n if user && user.authenticate(user_login_params[:password])\n token = create_token(user.id)\n render json: {\n user: user.attributes.except(\"password_digest\"),\n token: token,\n }, status: :ok\n else\n render json: {error: \"unauthorized\"}, status: :unauthorized\n end\n end",
"def login\n user = User.find_by(email: user_login_params[:email])\n\n if user && user.authenticate(user_login_params[:password])\n token = create_token(user.id)\n render json: {\n user: user.attributes.except(\"password_digest\"),\n token: token,\n }, status: :ok\n else\n render json: {error: \"unauthorized\"}, status: :unauthorized\n end\n end",
"def authenticate_signin(signin)\n Credentials::Password.authenticate_email signin.email, signin.password\n end",
"def login\n @user = User.find_by(email: params[:email])\n if @user\n if @user.authenticate(params[:password])\n render json: @user, serializer: CurrentUserSerializer\n else\n @error = {error: \"Email and/or password does not exist, please try again\"}\n render json: @error, status: 403\n end\n else\n @error = {error: \"Email and/or password does not exist, please try again\"}\n render json: @error, status: 403\n end\n end",
"def authenticate(login, password)\n u = users.query_for_authenticate(login).as(entity).one\n App.logger.debug \"RW users-repo.authenticate, user: #{u}\"\n if u && u.authenticate(password)\n # This bit clears a password_reset_code (this assumes it's not needed, cuz user just authenticated successfully).\n (u.password_reset_code = nil; u.save) if u.password_reset_code\n u\n else\n nil\n end\n end",
"def user\n\t\taccount = Account.find_by_email(email)\n\t\t# If everything is true, the user will be returned\n\t\treturn account if account && account.valid_password?(password) #account.authenticate(password) #user&.authenticate?(password) #user && user.authenticate(password) \n\t\t# If not, the method will return nil\n\t\terrors.add :user_authentication, 'invalid credentials' \n\t\tnil \n\tend",
"def authenticate_user_from_token!\n user_email = params[:user_email].presence\n user = user_email && User.find_by_email(user_email)\n\n # Notice how we use Devise.secure_compare to compare the token\n # in the database with the token given in the params, mitigating\n # timing attacks.\n\n if user && Devise.secure_compare(user.authentication_token, params[:user_token])\n sign_in user, store: false\n end\n end",
"def authenticate_user_from_token!\n authenticate_with_http_token do |token, options|\n user_email = options[:email].presence\n user = user_email && User.find_by_email(user_email)\n\n if user && Devise.secure_compare(user.api_token, token)\n sign_in user, store: false\n end\n end\n end",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n # kindly refactor and add more keys to the response object when needed\n response = { \n status: Message.success,\n data: {\n token: auth_token\n } \n }\n json_response(response, 200)\n end",
"def password_authentication\n if user = User.authenticate(params[:login], params[:password])\n successful_login(user,params[:url])\n else\n failed_login(user, \"Couldn't log you in as '#{params[:login]}'\")\n end\n end",
"def login\n @user = User.where(email: params[:user][:email]).first\n\n if @user.present? && @user.authenticate(params[:user][:password])\n session[:user_id] = @user.id\n render status: 200, notice: \"Signed in successfully\"\n else\n render status: 401, alert: \"Error signing in\"\n end\n end",
"def login(name_or_email, plain_password)\n name_or_email.downcase! # \n if name_or_email.include?(\"@\")\n user = User.find_by_email(name_or_email)\n else\n user = User.find_by_username(name_or_email)\n end\n if user == nil || user.password != plain_password || !user.validated\n user = nil\n end\n return user\nend",
"def login_from_params\n authenticate(params[:password])\n end",
"def authenticate_user_from_token!\n user_email = params[:user_email]\n user = user_email && User.find_by_email(user_email)\n\n if user && Devise.secure_compare(user.auth_token, params[:user_token])\n old_password = user.encrypted_password\n new_password = SecureRandom.hex\n\n user.update_attribute :password, new_password\n\n begin\n sign_in_with_casino user.email, new_password, params[:service]\n rescue Exception => e\n Appsignal.add_exception e\n Rails.logger e\n end\n\n user.update_column :encrypted_password, old_password\n end\n end",
"def login\n\t\t@user = User.where(:email => params[:email]).first\n\t\t@response = Hash.new\n\n\t\tif @user\n\t\t\tif @user.valid_password?(params[:password])\n\t\t\t\t@response[:auth_token] = @user.authentication_token\n\t\t\telse\n\t\t\t\t@response[:error] = \"incorrect_password\"\n\t\t\tend\n\t\telse\n\t\t\t@response[:error] = \"incorrect_email\"\n\t\tend\n\n\t\trespond_with(@response, :location => nil)\n\tend",
"def create\n user = User.find_by(email: params[:email])\n if user && user.authenticate(params[:password])\n log_in(user)\n flash[\"success\"] = \"Connection réussie.\"\n redirect_to root_path\n else\n flash[\"danger\"] = \"Adresse email ou mot de passe non valide.\"\n render :new\n end\n end",
"def create\n user = User.find_by(email: params[:email])\n\n p user\n p params[:email]\n p params\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to user_path(user)\n else\n redirect_to authentication_index_path\n end\n end",
"def login(params)\n begin\n # This is a object of User model\n user = User.new\n\n presentable_error_response(\"BLANK_EMAIL_PASSWORD\") if all_params_present(params[:email], params[:password])\n presentable_error_response(\"INVALID_EMAIL_PASSWORD\") unless user.find_email_password(params[:email],params[:password])\n\n return prepare_success_response(user.create_authentication_token(user.find_data_by_email((params[:email]).downcase)))\n rescue DataBaseException => e\n presentable_error_response(\"INTERNAL_ISSUE\")\n end\n end",
"def authenticate!(password)\n\t\t\tauth = User.perform_request User.api_url(\"users/authenticate\", {}), :post,\n\t\t\t\t{ email: self.email,\n\t\t\t\t\tpassword: password }, true\n\n\t\t\t# A bit of additional code here to keep the initialization tidy\n\t\t\tif auth\n\t\t\t\tif(self.respond_to? :token=)\n\t\t\t\t\tself.token = auth['data']['token']\n\t\t\t\telse\n\t\t\t\t\tself.class.send(:define_method, \"token=\") { |value| @token=value }\n\t\t\t\t\tself.class.send(:define_method, \"token\") { @token }\n\t\t\t\t\tself.token = auth['data']['token']\n\t\t\t\tend\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend",
"def authenticate(username, password)\n user = find_user(username)\n hash = BCrypt::Password.new(user.password) rescue nil\n (hash && hash == password) ? user : nil\n end",
"def authenticate( name, password, request = nil )\n user = [ by_email( :key => name ), by_login( :key => name ) ].flatten.compact.first\n \n if ( user && user.encrypted_password == password && user.single_access_token.nil? )\n user.set_env_success request \n user \n elsif( user )\n user.set_env_failure\n nil\n end\n end",
"def email_auth(email, password)\n params = {\n \"email\" => email,\n \"passwd\" => password\n }\n\n response = request(:post, \"/CMD_API_EMAIL_AUTH\", params)\n\n if response.has_key?(\"error\")\n Integer(response[\"error\"]) == 0\n end\n end"
] | [
"0.8652116",
"0.8289102",
"0.82730454",
"0.82612836",
"0.82458925",
"0.8162527",
"0.7993756",
"0.7990024",
"0.79389846",
"0.7835821",
"0.7797384",
"0.77341723",
"0.77281624",
"0.7726959",
"0.7725414",
"0.77238226",
"0.7695794",
"0.76811177",
"0.76717466",
"0.76545775",
"0.76288885",
"0.7626763",
"0.75958985",
"0.7593431",
"0.7591271",
"0.756381",
"0.7548986",
"0.7544797",
"0.75362885",
"0.75265247",
"0.75157654",
"0.7474985",
"0.7460529",
"0.7458438",
"0.7451173",
"0.7432928",
"0.73948085",
"0.73821723",
"0.7381866",
"0.7378925",
"0.73646426",
"0.73606503",
"0.73590696",
"0.73418003",
"0.7325604",
"0.7325604",
"0.7313445",
"0.73131484",
"0.7302933",
"0.7298579",
"0.7285356",
"0.7272181",
"0.7270847",
"0.72662324",
"0.72614825",
"0.7250998",
"0.72393596",
"0.72305775",
"0.7220703",
"0.7220511",
"0.7216424",
"0.72126913",
"0.7210695",
"0.7200609",
"0.71862996",
"0.7183279",
"0.718039",
"0.71785057",
"0.717833",
"0.71770626",
"0.71762073",
"0.7173166",
"0.717166",
"0.71444833",
"0.7142048",
"0.7125522",
"0.7121859",
"0.7098653",
"0.70972544",
"0.70937645",
"0.70937645",
"0.7088302",
"0.7087705",
"0.7082418",
"0.7081158",
"0.70763564",
"0.7072827",
"0.7063336",
"0.70628786",
"0.7057339",
"0.7057094",
"0.7047453",
"0.70461136",
"0.70386297",
"0.7025435",
"0.70219254",
"0.70209694",
"0.7019765",
"0.7017124",
"0.70139074",
"0.7013683"
] | 0.0 | -1 |
Private method to load API service | def load_api_service
@api_service = ApiService.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api\n @api ||= PrismicService.init_api\n end",
"def data_service\n DataServicesApi::Service.new(url: api_service_url)\n end",
"def method_missing(method_sym, *arguments, &block)\n if self.class.service_class(method_sym)\n # load service from cache if available\n service = instance_variable_get(\"@#{method_sym}\")\n return service if service\n\n service = self.class.service(method_sym, @api_client)\n service.service_manager = self\n instance_variable_set(\"@#{method_sym}\", service)\n else\n super\n end\n end",
"def load_cached_api\n api = nil\n\n if File.exists?(self.class::API_CACHE)\n File.open(self.class::API_CACHE) do |file|\n api = Marshal.load(file)\n end\n else\n api = @client.discovered_api(self.class::API_NAME, self.class::API_VERSION)\n File.open(self.class::API_CACHE, 'w') do |file|\n Marshal.dump(api, file)\n end\n end\n\n api\n end",
"def load_apis\n Dir.glob(File.join(ROOT, \"api\", \"**\", \"*.rb\")).each do |api|\n require api\n end\n end",
"def service_require\n ruby_file_path @api, service_name_full\n end",
"def set_api\n @api = Api.find(params[:id])\n rescue\n @api = Api.new\n end",
"def set_api\n @api = Api.find(params[:id])\n end",
"def set_api\n @api = Api.find(params[:id])\n end",
"def api\n # Should return an instance of the API instantiated \n # with the credentials passed into the initialized.\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new \n end",
"def initialize(api)\n @api = api\n end",
"def set_api\n @api = Api.find(params[:id])\n end",
"def load_jsonapi(c)\n return nil unless c.has_key?(\"jsonapi\")\n @jsonapi = JsonApi.new(c[\"jsonapi\"])\n end",
"def load_instance\n native_service.send(key)\n end",
"def find_service(id)\n self.class.get(\"/services/#{id}.json?apikey=#{apikey}\")\n end",
"def api\n @http ||= Http.new(config)\n end",
"def api_object\n unless $api\n $api = FyberAPI.new(\n 'b07a12df7d52e6c118e5d47d3f9e60135b109a1f',\n {\n appid: 157,\n format: 'json',\n device_id: '2b6f0cc904d137be2e1730235f5664094b83',\n locale: 'de',\n ip: '109.235.143.113'\n }\n )\n end\n $api\n end",
"def load_api_config api_version\n lib = File.dirname(File.dirname(__FILE__))\n path = \"#{lib}/api_config/#{service_name}-#{api_version}.yml\"\n YAML.load(File.read(path))\n end",
"def initialize(config)\n @registered = false;\n @logger = Service.get_logger\n @name = config['name']\n @dependencies = config['dependencies']\n config['api_modules'] << API::Base\n @keys = Keys.new\n @served_key = @keys.gen\n @responses = {}\n\n @served_object = ServedObject.new(self,\n @served_key, config['api_modules'])\n\n # allow special methods in development and testing environments\n Util.environment_apis(@served_object, @served_key)\n\n models, controller_class = require_libraries\n\n @models = {}\n add_models(models)\n\n @authenticator = Service.get 'Authenticator'\n @manager = Service.get 'Manager'\n\n # must be after add_models as controller creates a whitelist\n # of what can be called and that list needs to include the models\n # for CRUD to work\n @controller = controller_class.new(self, @manager) if controller_class\n\n# need = @client.dependencies_not_satisfied(@dependencies)\n# if need != []\n# puts 'Dependencies not met: ' + need.join(\",\")\n# end\n\n @uri = Service.start @name, @served_object\n @manager.register_component(@name)\n @registered = true\n at_exit {\n if @registered\n @manager.unregister_component(@name)\n end\n Service.stop\n ActiveRecord::Base.remove_connection\n }\n\n self\n end",
"def api(options = {})\n @api ||= case url.host\n when String then RestClient::Resource.new(url.host, options)\n else RestClient::Resource.new(API_ENDPOINT.host, options)\n end\n end",
"def service\n @service ||= fetcher.get(Service, service_id)\n end",
"def api\n @config = ZipMoney::Configuration\n configure_api if @_api.nil?\n \t @_api\n end",
"def api_service(service, **opt)\n opt[:user] = current_user unless opt.key?(:user)\n service = service.class unless service.is_a?(Class)\n service.instance(**opt)\n end",
"def load_apis\n connected = []\n @auth.each { |api, auth_hash|\n if auth_hash[:connect]\n api_resolved = Bunsen::API.create api => auth_hash\n instance_variable_set(\"@\" + api.to_s, api_resolved)\n instance_variable_get(\"@\" + api.to_s)\n self.class.send(:attr_accessor, api)\n connected << api.to_s\n end\n \n }\n @connected_apis = connected\n end",
"def api; end",
"def api; end",
"def restful_api\n @restful_api ||= AlephApi::RestfulApiClient.new(url: @restful_api_url)\n end",
"def initialize\n @services = {}\n end",
"def api\n @api ||= PrismicService.init_api(access_token)\n rescue Prismic::API::PrismicWSAuthError => e\n reset_access_token!\n raise e\n end",
"def api\n @api\n end",
"def preload\n @configuration.reject { |_, v| v[:service][:root].nil? }\n .each { |_, v| ServiceClient.get_client(v[:wsdl], v[:endpoint], v[:service], v[:savon_log]) }\n end",
"def initialize(api_url)\n\t\turi = URI(api_url)\n\t\tcall_api(uri)\n\tend",
"def setup_api\n if white_listed?(path)\n @api = Api.new\n return\n end\n\n email, password = http_basic_auth_info\n\n if !email.blank? and !password.blank?\n user = User.find_by_email(email)\n if user.password == password\n @api = Api.new(user)\n else\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n begin\n if current_user\n @api = Api.new(current_user)\n else\n render(:nothing => true, :status => :unauthorized)\n end\n rescue NameError\n @api = Api.new\n end\n end\n end",
"def initialize\n @response_format = 'json'\n @scheme = 'http'\n @host = 'api.wordnik.com'\n @hosts = []\n @load_balancer = nil\n @base_path = '/v4'\n @user_agent = \"ruby-#{Wordnik::VERSION}\"\n # Build the default set of resource names from the filenames of the API documentation\n begin\n api_docs_path = File.join(File.dirname(__FILE__), '../../api_docs')\n @resource_names = Dir.glob(File.join(api_docs_path, '*.json')).map {|f| f.split('/').last.sub('.json', '') }.sort\n true\n rescue\n raise 'Problem loading the resource files in ./api_docs/'\n end\n end",
"def api\n @api ||= Prismic.api('https://middleman-sandbox.cdn.prismic.io/api') || PrismicService.init_api\n end",
"def api_client\n self.class.api_client\n end",
"def boot!\n @api_client = Google::APIClient.new(\n application_name: config.application_name,\n application_version: config.application_version,\n user_agent: user_agent\n )\n discover!\n authorize!\n end",
"def load_local_apiproxy_factory\n with_jars(%w{lib shared appengine-local-runtime-shared.jar},\n %w{lib impl appengine-api-stubs.jar},\n %w{lib impl appengine-local-runtime.jar}\n ) do\n return Java.ComGoogleAppengineToolsDevelopment.ApiProxyLocalFactory\n end\n end",
"def engines_api\n @engines_api ||= Services::EnginesApi.new( system_api_url, @token, @settings )\n end",
"def initialize(api_obj)\n @api_obj = api_obj\n end",
"def api\n return Runtime.instance.set_if(self, :api) do\n LapisLazuli::API.new\n end\n end",
"def ingest_api\n engine = requested_engine(IngestService)\n # noinspection RubyMismatchedReturnType\n engine ? IngestService.new(base_url: engine) : api_service(IngestService)\n end",
"def services\n @services ||= ApiFactory.new 'Repos::Services'\n end",
"def service; end",
"def load_api_source(source=nil, source_vars=nil)\n load_source_for(Elastics::Template::Api, source, source_vars)\n end",
"def api\n @api ||= Battlenet.new(:eu)\n end",
"def set_rest_api\n @rest_api = RestApi.find(params[:id])\n end",
"def set_api_v1_scraper\n @api_v1_scraper = Api::V1::Scraper.find(params[:id])\n end",
"def setup_api\n #\n @api = Api.new(current_user)\n\n #\n if white_listed?(path)\n return\n end\n\n #\n token = params[:token] || request.headers['X-Api-Token'] || request.headers['X-API-TOKEN']\n\n unless token.blank?\n user = nil\n token = Token.where(:kind => 'api', :uuid => token.to_s).first\n\n if token and token.context.is_a?(User)\n user = token.context\n end\n\n if user\n @api.user = user\n else\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n email, password = http_basic_auth_info\n\n if !email.blank? and !password.blank?\n user = User.where(:email => email).first\n\n if user and user.password == password\n @api.user = user\n else\n headers['WWW-Authenticate'] = ('Basic realm=\"\"' % realm)\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n if defined?(current_user) and current_user\n @api.user = current_user\n else\n @api.user = nil\n #headers['WWW-Authenticate'] = ('Basic realm=\"\"' % realm)\n #render(:nothing => true, :status => :unauthorized)\n #return\n end\n end\n end\n\n #\n unless @api.route?(@path) or @path == 'index'\n render :nothing => true, :status => 404\n end\n end",
"def api_class(options={})\n @api_class ||= {}\n return @api_class[options[:api] || self.api] if @api_class[options[:api] || self.api]\n\n @api_class[options[:api] || self.api] = ExternalAPI.const_get((options[:api] || self.api).to_s.gsub(/(?:^|_)(.)/) { $1.upcase })\n end",
"def create_adwords_api\n config_filename = File.join(Rails.root, 'config', 'adwords_api.yml')\n @api = AdwordsApi::Api.new(config_filename)\n end",
"def load_service(file, source_code)\r\n begin\r\n _info(\"Loading service definitions from #{file}.\")\r\n precompiler = ServicePrecompiler.new(file, source_code)\r\n precompiler.precompile()\r\n clean_source_code = precompiler.get_modified_source_code()\r\n class_def = define_class(classname=\"#{file}ServiceBuilder\", superclazz=ServiceConfigurationBuilder)\r\n class_def.add_method_def(methodname='configure',sourcecode=clean_source_code)\r\n service_builder = class_def.compile()\r\n resolved = service_builder.build(self.context())\r\n services.push(service_builder)\r\n return resolved\r\n rescue Exception => ex\r\n _debug(ex.message, ex)\r\n end\r\n end",
"def service_instance(id)\n @@configuration_cache[id] or @@configuration_cache[id] = Psych.load_file(\"#{data_dir}/service/#{id}\")\n end",
"def api(registered_api_name)\n api_mapping[:default_api] = Jeckle::Setup.registered_apis.fetch(registered_api_name)\n rescue KeyError => e\n raise Jeckle::NoSuchAPIError, registered_api_name\n end",
"def api\n @api ||= WeatherApiCalls.new\n end",
"def new_api\n load_config\n require 'extensions/metasploit/extension.rb'\n @api = BeEF::Extension::Metasploit::RpcClient.instance\n @api.unit_test_init()\n end",
"def get_adwords_api\n @api ||= create_adwords_api\n end",
"def api\n return @api\n end",
"def api(params = {})\n Celluloid::Logger.info \"Registering api...\"\n self.use_api = true\n self.api_host = params[:host] || '127.0.0.1'\n self.api_port = params[:port] || '4321'\n end",
"def method_missing(method_sym, *arguments, &block)\n # ignore classes\n return true if method_sym == :klass\n\n # load service from cache if available\n service = instance_variable_get(\"@#{method_sym.to_s}\")\n\n # service is not cached yet -> first request\n unless service\n # create a Core::ServiceLayer::Service\n current_user_identity_url = @current_user.service_url('identity', {region: @region, interface: 'public'}) rescue nil\n params = {\n auth_url: Core.keystone_auth_endpoint(current_user_identity_url),\n region: @region,\n }\n if @current_user\n params[:token] = @current_user.token\n params[:domain_id] = @current_user.domain_id\n params[:project_id] = @current_user.project_id\n end\n\n service = self.class.service(method_sym,params)\n service.services=self\n service.current_user = @current_user\n service.service_user = @service_user\n # new service is instantiated -> cache it for further use in the same controller request.\n instance_variable_set(\"@#{method_sym.to_s}\", service)\n end\n\n return service\n end",
"def initialize\n begin\n @api_methods = Api_methods\n @api_version = Api_version\n rescue StandardError => e\n $log.error(sprintf(\"%s: %s\", __method__, e.message))\n raise\n end\n end",
"def initialize\n @ewallet_services = {}\n build_service_map\n end",
"def initialize(api, endpoint, namespace, version)\n if self.class() == AdsCommon::SavonService\n raise NoMethodError, 'Tried to instantiate an abstract class'\n end\n @api, @version, @namespace = api, version, namespace\n @headerhandler = []\n @client = create_savon_client(endpoint, namespace)\n end",
"def service(service_name, api_client)\n klazz = service_class(service_name)\n\n # raise an error unless the class inherits from Service\n unless klazz < Core::ServiceLayer::Service\n raise ServiceParentError,\n \"service #{klazz.name} is not a subclass of \\\n Core::ServiceLayer::Service\"\n end\n\n # create an instance of the service class\n klazz.try(:new, api_client)\n end",
"def parse_api api_yaml\n api = ::Google::Protobuf::Api.new\n api.name = api_yaml[NAME_KEY] if api_yaml.key? NAME_KEY\n api.version = api_yaml[VERSION_KEY] if api_yaml.key? VERSION_KEY\n api\n end",
"def apis; end",
"def enable_apis\n dir = \"/app/apis/#{@project_name}/#{@scaffold_name}s/base_apis.rb\"\n base_dir = \"#{Dir.pwd}/app/apis/#{@project_name}/#{@scaffold_name}s\"\n unless File.exists?(File.join(Dir.pwd,dir))\n FileUtils.mkdir base_dir unless File.exists?(base_dir)\n source = \"#{@gem_path}/lib/modules/scaffold/base_apis.rb\"\n FileUtils.cp(source,File.join(Dir.pwd,dir))\n config_apis\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{dir}\"\n mount_apis\n end\n end",
"def use_service_end_point\n self.api_end_point = \"/services/#{self.service_id}#{self.class::API_END_POINT}\" if self.service_id\n end",
"def api\n if @api.nil?\n @api = BigBlueButton::BigBlueButtonApi.new(self.url, self.salt,\n self.version.to_s, false)\n end\n @api\n end",
"def make_api_call (api_path)\n uri = URI.parse(GPS_CLIENT_SETTINGS[\"url\"] + api_path)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.scheme==\"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n request = Net::HTTP::Get.new(uri.request_uri)\n request['API-SECRET'] = client_secret\n response = http.request(request) \n make_adapter_response(response)\n end",
"def api\n # Only instantiate the API if needed. validate_update doesn't require it, so we shouldn't\n # make an unnecessary request to get the app_access_token.\n @api ||= API.new(app_access_token)\n end",
"def fabricate_via_api!\n validate_reuse_preconditions\n\n resource_web_url(api_get)\n rescue Errors::ResourceNotFoundError\n super\n ensure\n self.class.resources[reuse_as] ||= {\n tests: Set.new,\n resource: self\n }\n\n self.class.resources[reuse_as][:attributes] ||= all_attributes.each_with_object({}) do |attribute_name, attributes|\n attributes[attribute_name] = instance_variable_get(\"@#{attribute_name}\")\n end\n self.class.resources[reuse_as][:tests] << Runtime::Example.location\n end",
"def set_api_stub\n return @_api_stub if @_api_stub\n @_api_stub = Her::API.new\n allow(MnoEnterprise::BaseResource).to receive(:her_api).and_return(@_api_stub = Her::API.new)\n @_api_stub\n end",
"def initialize(game_id, game_key, base_url=Flox::DEFAULT_URL)\n @service = RestService.new(game_id, game_key, base_url)\n self.login_guest\n end",
"def set_api\r\n api = EVEAPI::API.new\r\n api.api_id = api_key.api_id\r\n api.v_code = api_key.v_code\r\n api.character_id = id\r\n api\r\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key \n end",
"def load_config(file = nil)\n api_name = api.class.to_s.gsub('::', '_').gsub(/([^_A-Z])([A-Z])/,'\\1_\\2').downcase!\n file ||= \"#{config_dir}/#{api_name}.rb\"\n return unless File.exist?(file)\n\n proc = Proc.new {} # create proc to grab binding\n eval(IO.read(file), proc.binding, file)\n end",
"def api_client\n @api_client ||= ::Lokalise.client LokaliseRails.api_token, {enable_compression: true}.merge(LokaliseRails.timeouts)\n end",
"def api_only; end",
"def api_only; end",
"def api_only; end",
"def load(file)\r\n if file.starts_with? '.'\r\n bootstrap_path = File.dirname(self.context().config.bootstrap_file)\r\n file = File.join(bootstrap_path, File.basename(file))\r\n end\r\n source_code = load_script_resource(file) # does *safe* IO\r\n load_service(file, source_code)\r\n end",
"def initialize( api_key )\n @api_key = api_key\n end",
"def initialize(config, service_info)\n self.config = config\n self.service_info = service_info\n\n @api_provider = config.api_provider\n end",
"def set_api_config\n @api_config = ApiConfig.find(params[:id])\n end",
"def do_get\n Net::HTTP.get(URI.parse(api_url))\n end",
"def get_adwords_api()\n Rails.logger.info(\"# ApplicationController with OAuth: #{ENV[\"OAUTH_CLIENT_ID\"]}\")\n @api ||= create_adwords_api()\n return @api\n end",
"def set_api(*args); end",
"def set_api(*args); end",
"def initialize(service)\n @service = service\n end",
"def initialize(params)\n\n fail 'missing API Base URL' if params[:api_base_url].nil?\n fail 'missing API Key' if params[:api_key].nil?\n fail 'missing API Secret' if params[:api_secret].nil?\n\n params[:api_base_url] = params[:api_base_url].gsub(/\\/$/, '') # remove trailing slash\n params[:api_spec] = false if params[:api_spec].nil?\n\n set_manifest(params)\n\n end",
"def scryfall; ScryfallApi.new end",
"def api_model\n api_model_nane.constantize\n end",
"def initialize\n self.api_root = BASE_URL\n end",
"def lookup_services(extension, arg)\n extension += \"/#{arg}\"\n uri = URI.parse(API_URL + extension)\n response = connect(uri)\n puts response.body\n end",
"def load_eventful\n @eventful = Eventful::API.new '36d8PjJXGWNdH592'\n end",
"def fb_load_api\n\n\n end",
"def create_adwords_api()\n config_filename = File.join(Rails.root, 'config', 'adwords_api.yml.erb')\n template = ERB.new File.new(config_filename).read\n processed = YAML.load template.result(binding)\n @api = AdwordsApi::Api.new(processed)\n token = session[:token]\n # If we have an OAuth2 token in session we use the credentials from it.\n if token\n credentials = @api.credential_handler()\n credentials.set_credential(:oauth2_token, token)\n credentials.set_credential(:client_customer_id, selected_account)\n end\n return @api\n end",
"def set_api_namespace\n @api_namespace = ApiNamespace.friendly.find(params[:id])\n end"
] | [
"0.68924063",
"0.6859681",
"0.6827161",
"0.68155384",
"0.67120504",
"0.6692524",
"0.65503263",
"0.6486344",
"0.6486344",
"0.6456455",
"0.6454877",
"0.64273906",
"0.6424875",
"0.6351732",
"0.6325336",
"0.6222585",
"0.615099",
"0.6147298",
"0.6120337",
"0.6119487",
"0.61189526",
"0.6109411",
"0.6051946",
"0.6028698",
"0.5999938",
"0.5999938",
"0.5999427",
"0.59923744",
"0.5991732",
"0.59816325",
"0.5966389",
"0.5965141",
"0.5954394",
"0.5947837",
"0.59471405",
"0.59212756",
"0.5917626",
"0.58979434",
"0.5895564",
"0.58917326",
"0.5882385",
"0.5874062",
"0.58585525",
"0.58553255",
"0.5849343",
"0.5849289",
"0.5847828",
"0.5835938",
"0.58303005",
"0.5821487",
"0.5809858",
"0.58072835",
"0.5806087",
"0.57828265",
"0.5782231",
"0.577759",
"0.57622343",
"0.57621473",
"0.5761672",
"0.57498795",
"0.5743106",
"0.57367605",
"0.57248485",
"0.57235324",
"0.57158804",
"0.57035995",
"0.5701245",
"0.56882",
"0.56849563",
"0.5684639",
"0.5683927",
"0.5683315",
"0.5674554",
"0.5668372",
"0.56663626",
"0.56652915",
"0.5663231",
"0.56567323",
"0.5656517",
"0.56478184",
"0.56478184",
"0.56478184",
"0.5633985",
"0.563254",
"0.5631182",
"0.56289476",
"0.5628915",
"0.5619377",
"0.56153375",
"0.56153375",
"0.5614442",
"0.5608474",
"0.5604898",
"0.5601857",
"0.5594298",
"0.5592394",
"0.5590983",
"0.5580522",
"0.55769885",
"0.55763566"
] | 0.873317 | 0 |
For when Mailchimp is testing that our webhook works | def confirm_webhook
render :json => "ok", :status => 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def webhook\n puts \"webhook params: #{params.inspect}\"\n if GoCardless.webhook_valid?(params[:payload])\n render :text => \"true\", :status => 200\n else\n render :text => \"false\", :status => 403\n end\n end",
"def webhook\n @config = ZipMoney::Configuration \n @_webhook = ZipMoney::WebHook if @_webhook.nil?\n @_webhook\n end",
"def test_webhook(url)\n URI(url).host == \"fabrikam-fiber-inc.visualstudio.com\"\n end",
"def webhook\n ReportMailer.admin_webhook_email(request.fullpath, params, request.env).deliver\n # From: https://gist.github.com/josevalim/fb706b1e933ef01e4fb6\n # Insecure token authentication system. Simple requires providing the token\n # Should be extracted into an authenticate_with_token! method if used in more than one place.\n token = params[:token].presence\n logger.debug \"Token: #{token.to_s}\"\n if token[0] == 'u' # using a user's auth token\n user = User.find_by(authentication_token: token.to_s)\n # http://stackoverflow.com/questions/10253366/need-to-return-json-formatted-404-error-in-rails\n return render json: { error: \"not-found\" }.to_json, status: 404 if !user\n company = user.company\n elsif token[0] == 'c' # using a company's auth token\n company = Company.find_by(authentication_token: token.to_s)\n # http://stackoverflow.com/questions/10253366/need-to-return-json-formatted-404-error-in-rails\n return render json: { error: \"not-found\" }.to_json, status: 404 if !company\n # TODO: use optional params[:user] to swap token and identify user as one that triggered\n else # unknown auth token\n # http://stackoverflow.com/questions/10253366/need-to-return-json-formatted-404-error-in-rails\n return render json: { error: \"not-found\" }.to_json, status: 404\n end\n \n # Set delay to default (15 seconds) if not set\n params[:delay] ||= '15'\n \n # TODO: Flesh out to handle multiple test suites\n # TODO: Use optional params[:url] to identify testing suite\n # need to get test suite (default: first)\n test_suite = company.test_suites.first\n # TODO: Flesh out to handle multiple test environments properly\n # TODO: Use optional params[:environment] to identify testing environment\n # need to get test_environment (default: first || production)\n test_environment = test_suite.test_environments.first\n \n #render json: { company: company, test_suite: test_suite, test_environment: test_environment }\n @report = Report.new(company_id: company.id, test_suite_id: test_suite.id, test_environment_id: test_environment.id)\n @report.initiated_at = Time.now\n @report.initiated_by = token # store webhook as initiator\n @report.status = \"Queued\"\n \n if @report.save\n \n @report.test_suite.test_cases.order('id ASC').each do |test_case|\n @report.results.create({ status: 'Queued', report_id: @report, test_case_id: test_case.id, test_environment_id: @report.test_environment_id })\n end\n \n env = @report.test_environment.name.downcase\n env = 'staging' if env == 'mirror'\n @report.delay(run_at: params[:delay].to_i.seconds.from_now).run!(env, params[:local])\n\n # TODO: make sure proper mail is sent.\n ReportMailer.delay(run_at: params[:delay].to_i.seconds.from_now).admin_requested_report_triggered_email(@report)\n ReportMailer.delay(run_at: params[:delay].to_i.seconds.from_now).requested_report_triggered_email(@report)\n\n render json: @report.to_json( :only => [:id, :initiated_at, :initiated_by, :status, :created_at] ), status: :created, location: @report\n else\n render json: @report.errors, status: :unprocessable_entity\n end\n end",
"def webhooks\n puts \"*************** inside webhooks ************************\"\n puts \"***params: \" + params.inspect\n puts \"*********************************************************\"\n # Check to insure valid freshbooks api request.\n if params[:system] == \"https://skunkwerxperformanceautomotivellc.freshbooks.com\"\n puts \"**************** inside params[:system] ***************\"\n puts \"***params: \" + \" - \" + params.inspect + \" - \"\n # Callback Verify action for all webhook methods;\n if params[\"name\"] == \"callback.verify\"\n puts \"****************** inside callback.verify **************\"\n puts \"***params[:verifier]: \" + params[:verifier]\n puts \"********************************************************\"\n callback_verify(params[:verifier])\n end\n # Freshbooks sends notification on item create, update and destroy.\n if params[\"key\"] == \"item.create\"\n puts \"********************* inside item.create **************\"\n puts \"***params[:object_id] : \" + params[:object_id]\n item_create(params[:object_id])\n puts \"******************************************************\"\n end\n\n if params[\"key\"] == \"item.update\"\n puts \"********************* inside item.update **************\"\n puts \"***params[:object_id] : \" + params[:object_id]\n item_update(params[:object_id])\n puts \"******************************************************\"\n end\n\n if params[\"key\"] == \"item.delete\"\n puts \"********************* inside item.delete ***************\"\n puts \"***params[:object_id] : \" + params[:object_id]\n item_delete(params[:object_id])\n puts \"******************************************************\"\n end\n # Send response status ok.\n head 200\n end\n end",
"def webhook_response\n # if get request, checks if it is the subscription call\n # if it is, echoes back the hub.challenge token\n if request.get?\n params = request.query_parameters\n\n if params['hub.mode'] == 'subscribe' && params['hub.verify_token'] == ENV['VERIFICATION_TOKEN']\n render json: { 'hub.challenge': params['hub.challenge'] }, status: :ok\n else\n raise 'Bad Request'\n end\n\n # if post request, checks if it is an activity creation post\n elsif request.post?\n params = request.request_parameters\n\n if params['object_type'] == 'activity' && params['aspect_type'] == 'create'\n # potentially should make it only change if the name is one of the default ones, so custom names won't be overriden\n this_user = User.find(params['owner_id'])\n this_user.update_user_token!(@client)\n\n user_client = this_user.generate_user_client\n\n updated_activity = user_client.update_activity(\n id: params['object_id'],\n name: Quote.order(\"RANDOM()\").first.format_quote\n )\n render json: {}, status: :ok\n else\n render json: {}, status: :ok\n end\n else\n raise 'Bad Request'\n end\n end",
"def webhook\n @webhook = params\n logger.info \"Webhook recieved, data: #{@webhook}\"\n\n sweepstake = \"grand-national-2023\"\n emojis = [\"🐎\", \"🐴\", \"🏇\", \"horse\"]\n\n begin\n if @webhook[\"type\"] == \"transaction.created\" and emojis.include? @webhook[\"data\"][\"notes\"].strip.downcase and @webhook[\"data\"][\"amount\"] == 200\n logger.info \"This is a #{sweepstake} payment\"\n payee = @webhook[\"data\"][\"counterparty\"][\"name\"]\n logger.info \"from #{payee}\"\n\n project = \"pub-tracker-live\"\n base_url = \"https://firestore.googleapis.com/v1/projects/#{project}/databases/(default)/documents\"\n response = JSON.parse(RestClient.get(\"#{base_url}/sweepstakes/#{sweepstake}\").body)\n current_pot = response[\"fields\"][\"pot\"].values[0].to_f\n match = nil\n response = JSON.parse(RestClient.get(\"#{base_url}/users?pageSize=100&mask.fieldPaths=displayName&mask.fieldPaths=photoURL\").body)\n response[\"documents\"].each do |user|\n account = {\n user: user[\"fields\"][\"displayName\"][\"stringValue\"],\n userPhotoURL: user[\"fields\"][\"photoURL\"][\"stringValue\"]\n }\n if account[:user].strip.downcase.eql? payee.strip.downcase\n logger.info(\"who is #{account}\")\n match = account\n end\n end\n if match\n data = {\n \"fields\": {\n \"user\": { \"stringValue\": match[:user] },\n \"userPhotoURL\": { \"stringValue\": match[:userPhotoURL] }\n }\n }\n else\n data = {\n \"fields\": {\n \"user\": { \"stringValue\": payee },\n \"userPhotoURL\": { \"stringValue\": \"/flags/Monzo.png\" }\n }\n }\n end\n available_teams = []\n response = JSON.parse(RestClient.get(\"#{base_url}/sweepstakes/#{sweepstake}/teams?pageSize=100\").body)\n response[\"documents\"].each do |team|\n available_teams << team[\"name\"] if team[\"fields\"][\"user\"][\"stringValue\"] == \"TBC\"\n end\n if available_teams.length > 0\n url = \"https://firestore.googleapis.com/v1/#{available_teams.sample.gsub(\" \", \"%20\")}?updateMask.fieldPaths=user&updateMask.fieldPaths=userPhotoURL\"\n response = RestClient.patch(url, data.to_json, content_type: :json)\n logger.info response.body\n data = {\n \"fields\": {\n \"pot\": { \"doubleValue\": current_pot + 2 },\n }\n }\n response = RestClient.patch(\"#{base_url}/sweepstakes/#{sweepstake}?updateMask.fieldPaths=pot\", data.to_json, content_type: :json)\n logger.info response.body\n else\n logger.info \"No teams left for #{payee}, they will need a refund\"\n end\n else\n logger.info \"This is not a #{sweepstake} payment\"\n logger.info \"#{@webhook[\"type\"]} (#{@webhook[\"type\"] == \"transaction.created\"})\"\n logger.info \"#{@webhook[\"data\"][\"notes\"].strip.downcase} (#{emojis.include? @webhook[\"data\"][\"notes\"].strip.downcase})\"\n logger.info \"#{@webhook[\"data\"][\"amount\"]} (#{@webhook[\"data\"][\"amount\"] == 200})\"\n end\n rescue => e\n logger.info \"Error: #{e.message}\"\n end\n\n respond_to do |format|\n format.html # webook.html.erb\n format.json { render json: @webhook, callback: params[:callback] }\n format.xml { render xml: @webhook }\n end\n end",
"def deploy_webhook\n unless daemon.stress_test_mode\n user_thread.schedule do\n CallNewMailWebhook.new(mail_log, envelope, raw_eml).delay.run\n end\n end\n return true\n end",
"def send_to_mailchimp\n if email_address.present?\n if verified.present?\n if verified.start_with?('Verified')\n begin\n\n gibbon = Gibbon::Request.new\n mailchimpSend = gibbon.lists(Cohorts::Application.config.cohorts_mailchimp_list_id).members(Digest::MD5.hexdigest(email_address.downcase)).upsert(\n body: { email_address: email_address.downcase,\n status: 'subscribed',\n merge_fields: { FNAME: first_name || '',\n LNAME: last_name || '',\n MMERGE3: geography_id || '',\n MMERGE4: postal_code || '',\n MMERGE5: participation_type || '',\n MMERGE8: primary_device_description || '',\n MMERGE9: secondary_device_id || '',\n MMERGE10: secondary_device_description || '',\n MMERGE11: primary_connection_id || '',\n MMERGE12: primary_connection_description || '',\n MMERGE13: primary_device_id || '',\n MMERGE14: preferred_contact_method || '' } }\n )\n\n Rails.logger.info(\"[People->send_to_mailchimp] Sent #{id} to Mailchimp: #{mailchimpSend}\")\n rescue Gibbon::MailChimpError => e\n Rails.logger.fatal(\"[People->send_to_mailchimp] fatal error sending #{id} to Mailchimp: #{e.message}\")\n end\n end\n end\n end\n end",
"def sendToMailChimp\n if email_address.present?\n if verified.present?\n if verified.start_with?('Verified')\n begin\n\n gibbon = Gibbon::Request.new\n mailchimpSend = gibbon.lists(Logan::Application.config.cut_group_mailchimp_list_id).members(Digest::MD5.hexdigest(email_address.downcase)).upsert(\n body: { email_address: email_address.downcase,\n status: 'subscribed',\n merge_fields: { FNAME: first_name || '',\n LNAME: last_name || '',\n MMERGE3: geography_id || '',\n MMERGE4: postal_code || '',\n MMERGE5: participation_type || '',\n MMERGE6: voted || '',\n MMERGE7: called_311 || '',\n MMERGE8: primary_device_description || '',\n MMERGE9: secondary_device_id || '',\n MMERGE10: secondary_device_description || '',\n MMERGE11: primary_connection_id || '',\n MMERGE12: primary_connection_description || '',\n MMERGE13: primary_device_id || '',\n MMERGE14: preferred_contact_method || '' } }\n )\n\n Rails.logger.info(\"[People->sendToMailChimp] Sent #{id} to Mailchimp: #{mailchimpSend}\")\n rescue Gibbon::MailChimpError => e\n Rails.logger.fatal(\"[People->sendToMailChimp] fatal error sending #{id} to Mailchimp: #{e.message}\")\n end\n end\n end\n end\n end",
"def webhooks\n \n data = JSON.parse(params['json'])\n# puts \"\"\n# puts data.inspect\n # if it's an authorization webhook.\n if data['type'].include?(\"member.authorization\")\n\n # fetch the user for this webhook.\n user = User.find_by(kpass_id: data['data']['object']['member']['id'])\n \n # if we found the user in our sample app..\n if user.present?\n \n\n # if the webhook is telling us they've been approved..\n if data['type'] == \"member.authorization.approved\"\n\n # for some reason if we save user with password the session is kicked out\n\n\n # update the username of the user, since we should have access to it now\n user.username = data['data']['object']['member']['username']\n # user.password = 'batterypop' #devise throws exception without a password upon save\n user.birthday = data['data']['object'][\"member\"][\"birthday\"]\n user.gender = data['data']['object'][\"member\"][\"gender\"]\n user.username_avatar_age_gender = data['data']['object'][\"keys\"][\"username_avatar_age_gender\"]\n user.access_to_moderated_chats = data['data']['object'][\"keys\"][\"access_to_moderated_chats\"]\n user.youtube_and_3rdparty_videos = data['data']['object'][\"keys\"][\"batterypop_youtube_and_3rdparty_videos\"]\n user.publish_public_profile = data['data']['object'][\"keys\"][\"batterypop_publish_public_profile\"]\n\n user.save\n\n\n\n # if the webhook is telling us that our authorization has been revoked..\n elsif data['type'] == \"member.authorization.revoked\"\n\n # destroy the user.\n # user.destroy\n anonymize_user(user)\n\n # if the webhook is telling us that the parent of an under-13 user has\n # denied our ability to see personal information for this user..\n elsif data['type'] == \"member.authorization.rejected\"\n\n # destroy the user.\n # user.destroy\n anonymize_user(user)\n end\n\n end\n\n end\n\n # communicate back to kpass that we've received the webhook.\n render json: [true]\n\n end",
"def verified_request?; end",
"def webhook_to_concierge\n request_body = read_request_body(env)\n json_payload = json_decode(request_body)\n return false unless json_payload.success?\n\n @webhook_payload = json_payload.value\n event = webhook_payload[\"event\"]\n\n case event\n when \"quote_instant\"\n concierge_request.quote(webhook_payload)\n when \"checkout_instant\"\n concierge_request.checkout(webhook_payload)\n when \"booked_instant\"\n concierge_request.booking(webhook_payload)\n when \"cancelled\"\n concierge_request.cancelled(webhook_payload)\n else\n # event is not recognized and should not be handled.\n false\n end\n end",
"def test_successful_purchase_encryption_credit_card_webhook_metadata\n test_successful_purchase_credit_card_webhook_metadata(true)\n end",
"def test_successful_purchase_encryption_stored_card_webhook_metadata\n test_successful_purchase_stored_card_webhook_metadata(true)\n end",
"def send_webhook\n config = Rails.application.config_for(:webhooks)\n\n return unless config.webhooks\n\n config.webhooks.each do |_k, webhook|\n next if webhook.nil?\n\n url = URI(webhook)\n headers = { 'content-type' => 'application/json' }\n payload = {\n 'job_id' => id,\n 'job_type' => kind,\n 'status' => status,\n 'results' => results.count\n }.to_json\n res = Net::HTTP.post(URI(url), payload, headers)\n\n res.code\n end\n end",
"def register_webhook\n\t\t\t\t\trequire \"open-uri\"\n\t\t\t\t\trequire \"net/http\"\n\t\t\t\t\trequire \"openssl\"\n\n\t\t\t\t\turi = URI.parse(\"#{self.add_on.jive_url}/api/core/v3/webhooks\")\n\t\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\t\thttp.use_ssl = true\n\t\t\t\t\t#http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n\t\t\t\t\trequest = Net::HTTP::Post.new(uri.request_uri)\n\n\t\t\t\t\trequest[\"Content-Type\"] = \"application/json\"\n\t\t\t\t\trequest[\"Authorization\"] = \"Bearer #{self.oauth_token.access_token}\"\n\n\t\t\t\t\tbody = {\n\t\t\t\t\t\t\"callback\" => self.callback,\n\t\t\t\t\t\t\"object\" => self.object,\n\t\t\t\t\t}\n\t\t\t\t\tbody[\"events\"] = self.events if !self.events.to_s.empty?\n\n\t\t\t\t\trequest.body = body.to_json\n\n\t\t\t\t\tresponse = http.request(request)\n\n\t\t\t\t\t# Need 2XX status code\n\t\t\t\t\tif !response.code.to_i.between?(200, 299)\n\t\t\t\t\t\terrors[:base] << \"#{request.inspect} => #{response.body}\"\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\tjson_body = JSON.parse(response.body)\n\n\t\t\t\t\tself.webhook_id = json_body[\"id\"]\n\n\t\t\t\t\ttrue\n\t\t\t\tend",
"def test_successful_purchase_encryption_credit_card_recurring_webhook_metadata\n test_successful_purchase_credit_card_recurring_webhook_metadata(true)\n end",
"def receive_inbound_email_from_fixture(*args); end",
"def receive_inbound_email_from_fixture(*args); end",
"def webhook_url?\n !webhook_url.nil?\n end",
"def test_push_webhook(repo, hook_id, options = {})\n boolean_from_response :post, \"#{Repository.path repo}/hooks/#{hook_id}/tests\", options\n end",
"def webhook\n\t\tpayload = {event: params, company_id: params[:company_id]}\n\t\tBraintree::WebhookService.new.instrument(payload)\n\t\thead :ok\n\t# rescue StandardError\n\t\t# head :unauthorized\n\tend",
"def cmd_notify_test\n\t\t\t\tprint_status(\"Sending tests message\")\n\t\t\t\tif read_settings()\n\t\t\t\t\tself.framework.events.add_session_subscriber(self)\n\t\t\t\t\tdata = \"{'text': '#{@user_name} Metasploit is online on #{$source}! Hack the Planet!', 'channel': '#{@channel}', 'username': '#{@bot_name}', 'icon_emoji': 'http://emojipedia-us.s3.amazonaws.com/cache/46/2e/462e369e465fd7b52537f6370227b52b.png'}\"\n\t\t\t\t\turl = URI.parse(@webhook_url)\n\t\t\t\t\thttp = Net::HTTP.new(url.host, url.port)\n\t\t\t\t\thttp.use_ssl = true\n\t\t\t\t\tresp = http.post(url.path, data)\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Could not set Slack Web API settings.\")\n\t\t\t\tend\n\t\t\tend",
"def test_successful_purchase_encryption_stored_card_recurring_webhook_metadata\n test_successful_purchase_stored_card_recurring_webhook_metadata(true)\n end",
"def receive\n # I chose to store the whole webhook response, as well as breaking out\n # certain pieces of it into columns on the Webhooks model. IMO, it makes\n # things a bit more easy to read and work with.\n\n # Storing the whole webhook might not be the best solution here, but in\n # the future, if something from the original webhook was needed, we have\n # record of it and can find/work with it.\n data = JSON.parse(request.body.read)\n event = data['payload']['event']\n event_name = data['payload']['event_type']['name']\n start_time = event['start_time']\n end_time = event['end_time']\n\n canceled = event['canceled']\n canceler = event['canceler_name']\n cancel_reason = event['cancel_reason']\n canceled_at = event['canceled_at']\n\n invitee = data['payload']['invitee']\n invitee_name = invitee['name']\n invitee_email = invitee['email']\n\n Webhook.create(\n data: data.as_json, \n canceled: canceled,\n event_name: event_name,\n start_time: start_time,\n end_time: end_time,\n canceler: canceler,\n cancel_reason: cancel_reason,\n canceled_at: canceled_at,\n invitee_name: invitee_name,\n invitee_email: invitee_email)\n end",
"def respond_to_slack_button json\n\n if json['token'] != ENV['SLACK_VERIFICATION_TOKEN'] \n halt 403, 'Incorrect slack token'\n end\n \n puts \"token valid\"\n\n call_back = json['callback_id']\n action_name = json['actions'].first[\"name\"]\n action_text = json['actions'].first[\"text\"]\n action_value = json['actions'].first[\"value\"]\n channel = json['channel']['id']\n team_id = json['team']['id']\n user_id = json['user']['id']\n time_stamp = json['message_ts']\n \n team = Team.find_by(user_id: user_id)\n puts team\n\n if team.nil?\n client.chat_postMessage(channel: channel, text:\"You don't have Jude installed. Click the below link to install: http://agile-stream-68169.herokuapp.com/\", unfurl_links: true)\n return\n end\n \n puts \"team found!\"\n \n client = team.get_client\n\n event = Event.create(team_id: team_id, type_name: \"button_click\", user_id: user_id, text: call_back, channel: channel, direction: \"incoming\", timestamp: Time.at(time_stamp.to_f) )\n event.team = team\n event.save!\n\n case call_back\n when 'to-do'\n \n case action_name\n when \"add assignment\"\n\n $assignment = Assignment.create\n message = \"Great! Let's add an assignment!\"\n client.chat_postMessage(channel: channel, text: message, attachments: interactive_assignment_course, as_user: true)\n add_outgoing_event event, team, \"interaction\", \"add assignment course\"\n\n { text: \"You selected 'add an assignment'\" , replace_original: true }.to_json\n\n when \"show assignments\"\n\n message = get_upcoming_assignments team\n client.chat_postMessage(channel: channel, text: message, as_user: true)\n add_outgoing_event event, team, \"message\", \"upcoming assignments\"\n\n { text: \"You selected 'show upcoming assignments'\" , replace_original: true }.to_json\n\n when \"show next\"\n\n message = get_upcoming_events team\n client.chat_postMessage(channel: channel, text: message, as_user: true)\n add_outgoing_event event, team, \"message\", \"upcoming events\"\n\n { text: \"You selected 'show upcoming schedule'\" , replace_original: true }.to_json\n\n else\n 200\n end\n\n when \"course_assignment\"\n\n if action_name == \"add course\"\n client.chat_postMessage(channel: channel, text: \"Enter Course Name starting with *course name: *\", as_user: true)\n add_outgoing_event event, team, \"message\", \"upcoming assignments\"\n\n { text: \"You selected 'add a course'\" , replace_original: true }.to_json\n else\n message = \"You're adding an assignment for #{action_name}!\"\n \n $assignment_record = \"Assignment for #{action_name}: \"\n $assignment.course_name = action_name\n $assignment.user_id = user_id\n $assignment.team_id = team_id\n client.chat_postMessage(channel: channel, text: message, attachments: [{\"text\": \"Please type your assignment details in <= 140 chars\", \"callback_id\": \"assignment_text\"}].to_json, as_user: true)\n add_outgoing_event event, team, \"message\", \"add assignment description\"\n\n { text: \"You selected 'add an assignment'\" , replace_original: true }.to_json\n end\n \n when \"add event\"\n\n if action_name == \"add assignment\"\n\n $assignment_record = \"\"\n \n client.chat_postMessage(channel: channel, text: \"Let's add an assignment!\", attachments: interactive_assignment_course, as_user: true)\n { text: \"You selected 'add an assignment'\" , replace_original: true }.to_json\n\n elsif action_name == \"add course\"\n\n client.chat_postMessage(channel: channel, text: \"Enter Course Name starting with *course name: *\", as_user: true)\n { text: \"You selected 'add a course'\" , replace_original: true }.to_json\n\n else\n \n 200\n\n end\n\n when \"confirm_assignment\"\n\n if action_name == \"confirm\"\n\n $assignment.save!\n create_calendar_event team, $assignment\n\n client.chat_postMessage(channel: channel, as_user: true)\n { text: \"The assignment has been added to your Google Calendar.\" , replace_original: true }.to_json\n \n else\n\n client.chat_postMessage(channel: channel, text: \"Add assignment\", attachments: interactive_assignment_course, as_user: true)\n { text: \"Please add the assignment again!\" , replace_original: true }.to_json\n\n end\n\n when \"confirm_course\"\n\n if action_name == \"confirm\"\n\n create_course $course_object\n client.chat_postMessage(channel: channel, text: \"The course has been added to your list of courses.\", as_user: true)\n { text: \"The course has been added to your list of courses.\" , replace_original: true }.to_json\n \n else\n\n client.chat_postMessage(channel: channel, text: \"Enter Course Name starting with *course name: *\", as_user: true)\n { text: \"Please add the course again!\" , replace_original: true }.to_json\n\n end\n\n else\n 200\n # do nothing... \n end\nend",
"def test_successful_authorize_credit_card_webhook_metadata\n test_successful_purchase_credit_card_webhook_metadata(false, true, false)\n end",
"def fetch_and_validate_webhook\n @client_webhook_setting = ClientWebhookSetting.get_from_memcache(@webhook_id)\n return error_with_identifier('resource_not_found', 'cm_gsk_favw_1'\n ) if @client_webhook_setting.blank? || @client_webhook_setting.status != GlobalConstant::ClientWebhookSetting.active_status ||\n @client_webhook_setting.client_id != @client_id\n success\n end",
"def fetch_and_validate_webhook\n @client_webhook_setting = ClientWebhookSetting.get_from_memcache(@webhook_id)\n return error_with_identifier('resource_not_found', 'cm_gsk_favw_1'\n ) if @client_webhook_setting.blank? || @client_webhook_setting.status != GlobalConstant::ClientWebhookSetting.active_status ||\n @client_webhook_setting.client_id != @client_id\n success\n end",
"def passes_mailchimp_email_check\n begin\n $mailchimp.lists.subscribe $mailchimp_test_list,\n { email: email },\n nil, # merge vars (idk, mailchimp terms)\n 'html', # email format (doesn't matter)\n false, # whether or not double opt-in is sent\n false, # throw error if email exists\n true, # replace_interests\n false # don't send a welcome email\n rescue Exception => e\n puts e\n errors.add :mailchimp_error, e.message\n else\n # if no error, then we sucessfully subscribed, so we should unsubscribe\n $mailchimp.lists.unsubscribe $mailchimp_test_list,\n { email: email },\n true,\n false\n end\n end",
"def stash_webhook?\n # This payload is the `Web Post Hooks for Bitbucket Server` hook plugin.\n # https://marketplace.atlassian.com/apps/1211539/web-post-hooks-for-bitbucket-server?hosting=server&tab=overview\n # https://confluence.atlassian.com/bitbucketserver/post-service-webhook-for-bitbucket-server-776640367.html\n @headers.key?('HTTP_X_ATLASSIAN_TOKEN')\n end",
"def webhook\n\t\t# 學說話\n\t\tbegin\n\t\t\treply_text = command_trigger(channel_id, received_text)\n\t\trescue\n\t\t\tnil\n\t\tend\n\t\t# 關鍵字回覆\n\t\treply_text = keyword_reply(channel_id, received_text) if reply_text.nil?\n\n\t\t# 傳送訊息到 line\n\t\tresponse = reply_to_line(reply_text)\n\n\t\t# 回應 200\n\t\thead :ok\n\tend",
"def bitbucket_server_webhook?\n # https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html\n @headers.key?('HTTP_X_EVENT_KEY') && @headers.key?('HTTP_X_REQUEST_ID')\n end",
"def send_incoming_webhook(key, feature, channel_id)\n payload = $redis.get(\"payload:#{key}\")\n if payload.nil?\n payload = {\n :text => \"\"\n }\n attachments = []\n attachments << build_attachment(key, feature)\n payload[:attachments] = attachments\n $redis.setex(\"payload:#{key}\", 60*60*24, payload.to_json)\n else\n payload = JSON.parse(payload)\n end\n payload[:channel] = channel_id\n HTTParty.post(ENV[\"INCOMING_WEBHOOK_URL\"], :body => payload.to_json)\nend",
"def test_successful_authorize_stored_card_webhook_metadata\n test_successful_purchase_credit_card_webhook_metadata(false, true, true)\n end",
"def perform\n r = validate_and_sanitize\n return r unless r.success?\n\n create_client_webhook_setting\n\n success_with_data(webhook: @client_webhook_setting.get_hash)\n end",
"def register_at_mailchimp!\n if ENV['RAILS_ENV'] == 'production' && ENV['mailchimp_api_key'].present? && ENV['initial_aid_list_id'].present?\n gibbon = Gibbon::Request.new(api_key: ENV['mailchimp_api_key'])\n list_id = ENV['initial_aid_list_id']\n gibbon.lists(list_id).members.create(\n body: {\n email_address: email,\n status: 'subscribed'\n }\n )\n else\n Rails.logger.info \"On production, I would have registered #{self} at mailchimp.\"\n end\n end",
"def gitlab_webhook?\n # https://docs.gitlab.com/ce/user/project/integrations/webhooks.html\n @headers.key?('HTTP_X_GITLAB_EVENT')\n end",
"def test_successful_authorize_encryption_credit_card_webhook_metadata\n test_successful_purchase_credit_card_webhook_metadata(true, true)\n end",
"def initialize webhook\n @nfe_webhook = @nfe_account.nfe_webhook\n @webhook = webhook\n \n response = update\n end",
"def test_successful_authorize_stored_card_recurring_webhook_metadata\n test_successful_purchase_credit_card_recurring_webhook_metadata(false, true, true)\n end",
"def verify_webhook_signature\n their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, ENV['GITHUB_WEBHOOK_SECRET'], @payload_raw)\n halt 401 unless their_digest == our_digest\n\n log_action\n end",
"def test_message_success\n response = Slackpost.send_message('gem test 1', TEST_CHANNEL)\n assert response.code == '200'\n end",
"def send_webhook!(tag)\n response = Net::HTTP.post(\n URI(\"https://webhook.site/b069a239-60dd-47ec-9dba-1f4295639a8d\"),\n { tag: tag.name }.to_json,\n \"Content-Type\": \"application/json\"\n )\n\n raise WebhookError unless response.is_a?(Net::HTTPSuccess)\n end",
"def bitbucket_webhook?\n # https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html\n @headers.key?('HTTP_X_EVENT_KEY') && @headers.key?('HTTP_X_HOOK_UUID')\n end",
"def webhook_subscribe\n # verify the string parameters\n if params['hub.mode'] == 'subscribe' &&\n params['hub.topic'] == @feed.url &&\n params['hub.challenge'].present?\n\n @feed.status = 'subscription_requested' # 17 mins\n if params['hub.lease_seconds'].present? && params['hub.lease_seconds'].to_i > 0\n @feed.expiration_date = DateTime.now + Rational(params['hub.lease_seconds'].to_i, 86_400)\n unless @feed.save\n # log error\n logger.error \"FEED SAVE TO DB ERROR:#{@feed.inspect}\"\n end\n end\n\n render status: 200, plain: params['hub.challenge']\n else\n render status: 422, plain: 'Invalid parameters'\n end\n end",
"def test_scheduled_email(recipient)\n @fullname = recipient.fullname\n @email = recipient.email\n @password = recipient.password\n @company_name = \"A&S Designs\"\n @support_email = \"support@codingsherpa.com\"\n @url = \"http://zdesign.codingsherpa.com\"\n \n logger.info \"AppLog: test_Scheudled_email \" + recipient.fullname\n \n mail(:to => recipient.email,\n :subject => \"Scheduled email from \" + @company_name + \"!\")\n end",
"def test_successful_authorize_encryption_stored_card_webhook_metadata\n test_successful_purchase_stored_card_webhook_metadata(true, true)\n end",
"def webhook_url\n return @config[ :webhook ]\n end",
"def send_webhooks(user, answer)\n answer_remove_list(answer, user)\n end",
"def test_successful_authorize_encryption_stored_card_recurring_webhook_metadata\n test_successful_purchase_stored_card_recurring_webhook_metadata(true, true)\n end",
"def webhook\r\n WebhookController.instance\r\n end",
"def test_emails\n end",
"def panic_tapped\n\n data = {answer: 1, email: App::Persistence['email'], cohort: App::Persistence['cohort']}\n\n BubbleWrap::HTTP.post(\"http://equanimity.herokuapp.com/users/m/:id/responses\", {payload: data}) do |response|\n\n puts data\n # puts \"response = #{response}\"\n # puts \"response.body = #{response.body.to_str rescue ''}\"\n # puts \"response.error_message = #{response.error_message}\"\n # puts \"response.status_code = #{response.status_code.to_s rescue ''}\"\n # puts \"response ok = #{response.ok?}\"\n\n if response.ok?\n\n App.alert(\"Thanks!\")\n else\n App.alert(\"Something went wrong...\")\n end\n end\n end",
"def setup_incoming_webhook\n @uri = URI.parse \"https://#{@options['team']}.slack.com/services/hooks/incoming-webhook?token=#{@options['incoming_token']}\"\n @http = Net::HTTP.new(@uri.host, @uri.port)\n @http.use_ssl = true\n @http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n end",
"def webhooks\n @webhooks ||= WebhookRegistry.new\n end",
"def post_webhook\n HTTParty.post(\n \"https://api.trello.com/1/tokens/#{user.token}/webhooks/?key=#{ENV['TRELLO_KEY']}\",\n query: {\n description: \"Sprint webhook user#{user.id}\",\n callbackURL: \"#{ENV['BASE_URL']}webhooks\",\n idModel: trello_ext_id\n },\n headers: { \"Content-Type\" => \"application/json\" }\n )\n end",
"def tfs_webhook?\n # https://docs.microsoft.com/en-us/vsts/service-hooks/services/webhooks\n return false unless @data.key? 'resource'\n return false unless @data.key? 'eventType'\n\n true\n end",
"def receive_test\n setup_http\n\n http_get(\"#{BASE_URL}\")\n\n { ok: true, message: \"OAuth token is valid\" }\n rescue => ex\n { ok: false, message: ex.message }\n end",
"def test_email\n @brother.post_notification(\n \"Email testing. \",\n \"This email serves solely to ascertain that ADP Dashboard emails can reach your email address. \",\n root_url\n )\n\n redirect_to root_url, flash: { notice: \"Test email sent to #{@brother.email}. \" }\n end",
"def github_webhook\n payload = JSON.parse(params[:payload])\n requested_branch = payload['ref'].split('/').last\n branch_is_valid = @project.git? && @project.watched_branches.include?(requested_branch)\n if branch_is_valid\n revision = payload['after']\n other_fields = { description: 'github webhook', user_id: current_user.id }\n CommitCreator.perform_once @project.id, revision, other_fields: other_fields\n end\n respond_to do |format|\n format.json do\n render status: :ok, json: { success: branch_is_valid }\n end\n end\n end",
"def send_email_changed_notification?; end",
"def verify_webhook_signature\n their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, WEBHOOK_SECRET, @payload_raw)\n halt 401 unless their_digest == our_digest\n\n # The X-GITHUB-EVENT header provides the name of the event.\n # The action value indicates the which action triggered the event.\n logger.debug \"---- received event #{request.env['HTTP_X_GITHUB_EVENT']}\"\n logger.debug \"---- action #{@payload['action']}\" unless @payload['action'].nil?\n end",
"def webhook_error(code, body, payload, transaction, stack)\n @code = code\n @body = body\n @payload = payload\n @transaction = transaction\n @stack = stack\n mail(:to => stack.seller_email, :subject => \"Payly: Webhook error on #{stack.product_name}\")\n end",
"def work\n setup\n\n # status\n status_url = @base_url + \"/status\"\n res = get(status_url)\n output_res(res, @logger)\n\n if res.code.to_i != 200\n msg = 'response code is not 200'\n failure(msg, @logger)\n end\n\n if res.body != 'ok'\n msg = 'response body is not ok'\n failure(msg, @logger)\n end\n\n # slack/feed\n register_url = @base_url + '/v1/slack/feed'\n text = 'rss2slack_register, markezine, <https://markezine.jp/rss/new/20/index.xml>'\n body = make_body(@var, text)\n res = post(register_url, body)\n output_res(res, @logger)\n # {\"attachments\":[{\"fallback\":\"successflluy registerd markezine\",\"color\":\"good\",\"fields\":[{\"title\":\"successflluy registerd markezine\",\"short\":false}],\"footer\":\"from Rss2Slack\",\"ts\":1511707196}],\"username\":\"Rss2Slack\"}\n\n if res.code.to_i != 200\n msg = 'response code is not 200'\n failure(msg, @logger)\n end\n\n json = JSON.parse(res.body)\n if json.nil? || json.empty?\n msg = 'response body is nil or empty'\n failure(msg, @logger)\n end\n\n username = json['username']\n if username != 'Rss2Slack'\n msg = 'username is not Rss2Slack'\n failure(msg, @logger)\n end\n\n attachments = json['attachments']\n if attachments.nil? || attachments.empty?\n msg = 'attachments is nil or empty'\n failure(msg, @logger)\n end\n\n attachment = attachments[0]\n if attachment.nil? || attachment.empty?\n msg = 'attachment is nil or empty'\n failure(msg, @logger)\n end\n\n fields = attachment['fields']\n if fields.nil? || fields.empty?\n msg = 'fields is nil or empty'\n failure(msg, @logger)\n end\n\n field = fields[0]\n if !field['title'].to_s.include?('successflluy registerd')\n msg = 'response title is invalid'\n failure(msg, @logger)\n end\n\n @logger.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')\n @logger.debug('@ @')\n @logger.debug('@ Successfully integration test! @')\n @logger.debug('@ @')\n @logger.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')\nrescue => e\n failure(e, @logger)\nend",
"def create\n Webhook.log(params)\n \n render text: \"\\nhello chargify\\n\\n\", layout: false, status: 200, :content_type => 'application/xml'\n\n # respond_to do |format|\n # if @webhook.save\n # format.html { redirect_to @webhook, notice: 'Webhook was successfully created.' }\n # format.json { render json: @webhook, status: :created, location: @webhook }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @webhook.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def do_request(homework)\n uri = URI.parse('https://webhook.site/1e9a10c7-54e0-414b-a1a7-3a7dad38c56d')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')\n req.body = {\n homework_source: homework.source_code,\n student: fullname,\n pr_title: homework.pr_title\n }.to_json\n http.request(req)\n end",
"def after_update_challenge\n send_email_after_canceled_reactive\n send_email_after_change_start_date\n end",
"def test!\n begin\n send_message!(:recipient_email => '_', :subject => 'meh')\n rescue Excon::Errors::Error, Timeout::Error\n false\n rescue MessageRejectedError, RecipientRejectedError\n true\n else\n false # Gateway is being weird, should never accept that message\n end\n end",
"def handshake_approved?\n return false if params[:token] != ENV[\"SLACK_TOKEN\"]\n return false unless !event_type_supported?\n\n return true\n end",
"def test!\n begin\n send_message!(:recipient_number => '_', :body => '')\n rescue Excon::Errors::Error\n false\n rescue MessageRejectedError\n true\n else\n false # Gateway is being weird, should never accept that message\n end\n end",
"def verify_callback; end",
"def verify_callback; end",
"def check_signature!\n request.body.rewind\n payload_raw = request.body.read # We need the raw text of the body to check the webhook signature\n begin\n @payload = JSON.parse payload_raw\n rescue\n @payload = {}\n end\n\n # Check X-Hub-Signature to confirm that this webhook was generated by GitHub, and not a malicious third party.\n # The way this works is: We have registered with GitHub a secret, and we have stored it locally in WEBHOOK_SECRET.\n # GitHub will cryptographically sign the request payload with this secret. We will do the same, and if the results\n # match, then we know that the request is from GitHub (or, at least, from someone who knows the secret!)\n # If they don't match, this request is an attack, and we should reject it.\n # The signature comes in with header x-hub-signature, and looks like \"sha1=123456\"\n # We should take the left hand side as the signature method, and the right hand side as the\n # HMAC digest (the signature) itself.\n their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, WEBHOOK_SECRET, payload_raw)\n halt 401 unless their_digest == our_digest\n @payload\n end",
"def create_submission_stub(_payload)\n {\n 'message' => 'Application Received',\n 'data' => {\n 'carmacase' => {\n 'id' => 'aB935000000F3VnCAK',\n 'createdAt' => DateTime.now.iso8601\n }\n }\n }\n end",
"def contact_kitten?( request, kitten )\n return true\n end",
"def webhook_example_event(sample_name)\n data = webhook_example_events(sample_name).first\n if data['raw_params'] && (mandrill_events_data = data['raw_params']['mandrill_events'])\n data['raw_params']['mandrill_events'] = URI.decode_www_form_component(mandrill_events_data)\n end\n data\n end",
"def github_webhook?\n # https://developer.github.com/v3/activity/events/types/#pushevent\n @headers.key?('HTTP_X_GITHUB_EVENT')\n end",
"def send_feedback_to_slack\n send_request_to_slack(make_positive_response)\n end",
"def webhook_params\n params.require(:webhook).permit(:request)\n end",
"def calendly_invitee_created\n puts \"Webhook call received for event created by #{calendly_invitee_email}\"\n if Profile.email_exist?(calendly_invitee_email)\n # do nothing\n else\n send_mail_to_invitee\n send_mail_for_event_deletion\n\n\n # Send mail to user, to created profile on our site.\n # Delete Event from calendly, (No documentation for the same)\n end\n end",
"def send_to_teams_channel\n response = self.class.post(ENV['TEAMS_WEBHOOK'],\n :body => {\"text\" => \"Pincode:- #{@pincode} has some vaccine for 18-45 age group. Try booking now!\"}.to_json,\n :headers => { 'Content-Type' => 'application/json' } )\n puts response.code\n end",
"def send_email_changed_notification; end",
"def respond_to_slack_event json\n \n # find the team\n team_id = json['team_id']\n api_app_id = json['api_app_id']\n event = json['event']\n event_type = event['type']\n event_user = event['user']\n event_text = event['text']\n event_channel = event['channel']\n event_ts = event['ts']\n \n team = Team.find_by(team_id: team_id)\n \n # didn't find a match... this is junk! \n return if team.nil?\n \n # see if the event user is the bot user \n # if so we shoud ignore the event\n return if team.bot_user_id == event_user\n \n event = Event.create(team_id: team_id, type_name: event_type, user_id: event_user, text: event_text, channel: event_channel, direction: \"incoming\", timestamp: Time.at(event_ts.to_f) )\n event.team = team\n event.save!\n \n client = team.get_client\n \n event_to_action client, event, team\nend",
"def set_webhook\n @webhook = Webhook.find(params[:id])\n end",
"def set_webhook\n @webhook = Webhook.find(params[:id])\n end",
"def test_integration_branch_is_optional\n modified_payload = modify_payload(payload)\n svc = service({'server_url' => 'nowhere', 'username' => 'someone', 'password' => '12345', 'central_repository' => '1'}, modified_payload)\n svc.xmlrpc_client = @server\n svc.receive_push\n\n assert @server.closed_bugs.include?(1)\n assert @server.bug_posts.include?(4)\n end",
"def test_webhook_subscription(subscription_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/webhooks/subscriptions/{subscription_id}/test',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def webhooks\n @webhooks_manager\n end",
"def webhook_payload\n {}\n end",
"def add_user_to_mailchimp \n Rails.logger.info(\"Mailchimp subscribe request being made\")\n unless self.email.include?('@example.com')\n mailchimp = Hominid::API.new(AppConstants.mailchimp_key) \n list_id = mailchimp.find_list_id_by_name AppConstants.mailchimp_list \n info = { }\n result = mailchimp.list_subscribe(list_id, self.email, info, 'html', false, true, false, true)\n Rails.logger.info(\"Mailchimp subscribed for the email id #{self.email} to #{AppConstants.mailchimp_list}\")\n end\n end",
"def webhook\n header = \"<h4>#{params[:verb]} #{params[:url]}</h4><p>Server: <b>#{params[:mode]}</b></p>\"\n query = if params[:params] then \"<p>Params: <pre>#{params[:params]}</pre></p>\" else \"\" end\n session = if params[:session] then \"<p>Session Attribute: <pre>#{params[:session]}</pre></p>\" else \"\" end\n exception = \"<p>Exception: <pre>#{params[:exception]}</pre></p>\"\n content = header + query + session + exception\n @project_logs = ProjectLog.create(project: @project, category: 'ERROR', content: content, date: Date.today)\n render nothing: true\n end",
"def receive_test\n setup_http\n\n if update_status?\n receive_test_status\n else\n simple_failure(\"Nothing happened\")\n end\n end",
"def allow_mails_from_merchant\n end",
"def call_mattermost (data = {}, url = [Config['Mattermost']['url'], 'hooks', Config['Mattermost']['webhook_code']].join('/'), header = {content_type: :json, accept: :json})\n\tif !data.has_key?(:login_id)\n\t\tpayload = data.merge(Config['DefaultPayload'])\n\telse\n\t\tpayload = data\n\tend\n\n\t# Just in case, though we may not need text\n\tunless payload.has_key?(:text) or payload.has_key?(:attachments)\n\t\tpayload['text'] = 'This was triggered on: ' + Time.now.strftime(\"%d/%m/%Y %H:%M\") #Feel free to change this\n\tend\n\n\tresponse = RestClient.post url, payload.to_json, {content_type: :json, accept: :json}\n\n\treturn response\nend",
"def create_webhook(post_url, include_received_email, events)\n include_received_email = include_received_email ? true : false\n url = \"v2/#{account_id}/webhooks\"\n\n make_json_api_request :post, url, private_generate_resource(\n \"webhooks\",\n {\n \"post_url\" => post_url,\n \"include_received_email\" => include_received_email,\n \"events\" => events\n }\n )\n end",
"def is_valid_message?(params)\n settings.environment == :development || (params[:token] == ENV['OUTGOING_WEBHOOK_TOKEN'] && params[:bot_id].nil?)\nend",
"def incoming_verification\n # API Check\n raise 'You shall not pass!' unless params[:api_key] == Settings.twilio.webhooks_api_key\n\n # Handle verification\n user = get_user_for_phone_verification\n user.mark_phone_as_verified! if user\n\n render nothing: true\n end",
"def update\n webhook.update(webhook_params)\n respond_with(webhook)\n end"
] | [
"0.67869085",
"0.6571325",
"0.6552353",
"0.6531604",
"0.63817245",
"0.6359207",
"0.63590926",
"0.6242446",
"0.6233506",
"0.62312764",
"0.6208684",
"0.61513346",
"0.61503863",
"0.6099582",
"0.607256",
"0.6063292",
"0.6039634",
"0.601697",
"0.59806085",
"0.59806085",
"0.5965347",
"0.5962909",
"0.59613335",
"0.59601384",
"0.5954679",
"0.59527487",
"0.59514666",
"0.59357727",
"0.5927097",
"0.5927097",
"0.5900243",
"0.5899539",
"0.589911",
"0.5887374",
"0.58854234",
"0.5875578",
"0.58628416",
"0.5855939",
"0.5849503",
"0.58402765",
"0.583562",
"0.5830198",
"0.58120525",
"0.58076185",
"0.5805778",
"0.5796076",
"0.57916087",
"0.57818186",
"0.57777363",
"0.5777092",
"0.5775255",
"0.57696104",
"0.57566345",
"0.5744051",
"0.5741185",
"0.5739703",
"0.5734414",
"0.57318586",
"0.5729434",
"0.57182336",
"0.57154965",
"0.57124305",
"0.57096577",
"0.5701056",
"0.5690983",
"0.568923",
"0.5668635",
"0.5662436",
"0.5656906",
"0.56563985",
"0.5649461",
"0.56438893",
"0.563241",
"0.563241",
"0.562969",
"0.56286234",
"0.5624657",
"0.5624607",
"0.56238115",
"0.5622322",
"0.5621894",
"0.5606993",
"0.5606821",
"0.5603383",
"0.56019163",
"0.5600857",
"0.5600857",
"0.55935997",
"0.5590067",
"0.55858666",
"0.557888",
"0.5570219",
"0.55648005",
"0.55496764",
"0.5546983",
"0.5543583",
"0.5542777",
"0.5540744",
"0.5537729",
"0.5536194"
] | 0.6655412 | 1 |
Fetch and store Mailchimp Lists, Groupings and Groups | def refresh_lists
settings = current_user.settings_for("mailchimp")
unless settings && settings.settings["api_key"]
flash[:warning] = "You need to configure your Mailchimp API key!"
redirect_to(root_url) and return
end
counts = Mailchimp.refresh_lists_for(current_user)
flash[:notice] = "Successfully cached #{pluralize counts[:lists], 'list'}, #{pluralize counts[:groupings], 'grouping'}, and #{pluralize counts[:groups], 'group'}."
redirect_to(root_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mailing\n gb = Gibbon.new\n @lists = Hash.new\n for i in 1..gb.lists['total'] do\n list_id = gb.lists['data'][i - 1]['id']\n name = gb.lists['data'][i - 1]['name']\n @lists[name] = []\n members = gb.list_members({:id => list_id})\n members['data'].map { |m| @lists[name].push(m['email']) }\n end\n end",
"def membership_list_for_group(email)\n Gaps::DB::Cache.with_cache_key(\"mygroupinfos:#{email}\") do\n membership_list(email)\n end\n end",
"def mcget_list_menbers(list_id)\n # 82dfd7f973, a38ec3df9c\n begin\n lists_res = setup_mcapi.lists.list({'list_id' => list_id})\n @list = lists_res['data'][0]\n members_res = setup_mcapi.lists.members(list_id)\n @members = members_res['data']\n rescue Mailchimp::ListDoesNotExistError\n flash[:error] = \"The list could not be found\"\n redirect_to \"/lists/\"\n rescue Mailchimp::Error => ex\n if ex.message\n flash[:error] = ex.message\n else\n flash[:error] = \"An unknown error occurred\"\n end\n redirect_to \"/lists/\"\n end\n end",
"def populate\n storage = MultiJson.decode(collection.find_one['boom']) || []\n \n storage['lists'].each do |lists|\n lists.each do |list_name, items|\n @lists << list = List.new(list_name)\n\n items.each do |item|\n item.each do |name,value|\n list.add_item(Item.new(name,value))\n end\n end\n end\n end \n end",
"def all_lists\n FfcrmMailchimp::Api.all_lists.map(&:stringify_keys).map { |list| new( list ) }\n end",
"def make_mailchimp_list(from_name, from_email, event)\n Person.roles.keys.each_with_index do |role, index|\n if index == 0 \n participant_ids = []\n Participant.statuses.keys.each do |s|\n response = gibbon.lists.create(make_mailchimp_hash(from_name, from_email, event, role, s))\n participant_ids << response['id']\n end\n event.mailchimp_ids << participant_ids.join(',')\n else\n response = gibbon.lists.create(make_mailchimp_hash(from_name, from_email, event, role))\n event.mailchimp_ids << response['id']\n end\n end\n end",
"def member_of_mailing_list(email, list_name)\n\tbegin\n\t\tlist_id = Rails.configuration.mailing_lists[:mailchimp_list_ids][list_name.to_sym]\n\t\tGibbon::Request.lists(list_id).members(email_md5_hash(email)).retrieve\n\trescue Gibbon::MailChimpError => e\n\t\tputs \"MailChimp error while retrieving member info: #{e.title}; #{e.detail}; status: #{e.status_code}; email: #{email}; list: #{list_name}\"\n\tend\nend",
"def index\n @mail_lists = MailList.all\n end",
"def groups\n FfcrmMailchimp::Group.groups_for(id)\n end",
"def empty_mailing_lists\n\tbegin\n\t\tmailing_lists.each do |list_name|\n\t\t\tlist_id = Rails.configuration.mailing_lists[:mailchimp_list_ids][list_name.to_sym]\n\t\t\tr = Gibbon::Request.lists(list_id).members.retrieve params: {fields: 'members.email_address'}\n\t\t\tr['members'].try(:each) do |member|\n\t\t\t\temail = member['email_address']\n\t\t\t\tGibbon::Request.lists(list_id).members(email_md5_hash(email)).delete\n\t\t\tend\n\t\tend\n\trescue Gibbon::MailChimpError => e\n\t\tputs \"MailChimp error while deleting: #{e.title}; #{e.detail}; status: #{e.status_code}\"\n\tend\nend",
"def listed\n @listed = response[\"listed\"]\n @listed[\"groups\"].each do |group|\n @listed[\"items\"].map!{|item| Foursquared::Response::List.new(client, item)}\n end\n @listed\n end",
"def retrieve\n\t\t@gibbon.lists(\"c3c516a4aa\").members.retrieve\n\tend",
"def retrieve\n\t\t@gibbon.lists(\"c3c516a4aa\").members.retrieve\n\tend",
"def index\n @list_groups = ListGroup.all\n end",
"def list\n perform_request(Entities::MarketingEmail, 'newsletter/list.json')\n end",
"def list\n @mailing_list.contacts(limit: 10000).map{|contact| contact.email}\n end",
"def sendToMailChimp\n if email_address.present?\n if verified.present?\n if verified.start_with?('Verified')\n begin\n\n gibbon = Gibbon::Request.new\n mailchimpSend = gibbon.lists(Logan::Application.config.cut_group_mailchimp_list_id).members(Digest::MD5.hexdigest(email_address.downcase)).upsert(\n body: { email_address: email_address.downcase,\n status: 'subscribed',\n merge_fields: { FNAME: first_name || '',\n LNAME: last_name || '',\n MMERGE3: geography_id || '',\n MMERGE4: postal_code || '',\n MMERGE5: participation_type || '',\n MMERGE6: voted || '',\n MMERGE7: called_311 || '',\n MMERGE8: primary_device_description || '',\n MMERGE9: secondary_device_id || '',\n MMERGE10: secondary_device_description || '',\n MMERGE11: primary_connection_id || '',\n MMERGE12: primary_connection_description || '',\n MMERGE13: primary_device_id || '',\n MMERGE14: preferred_contact_method || '' } }\n )\n\n Rails.logger.info(\"[People->sendToMailChimp] Sent #{id} to Mailchimp: #{mailchimpSend}\")\n rescue Gibbon::MailChimpError => e\n Rails.logger.fatal(\"[People->sendToMailChimp] fatal error sending #{id} to Mailchimp: #{e.message}\")\n end\n end\n end\n end\n end",
"def write_email_to_mail_chimp\n require 'xmlrpc/client'\n chimpApi ||= XMLRPC::Client.new2(\"http://api.mailchimp.com/1.2/\")\n begin\n chimpApi.call(\"listSubscribe\", @mail_chimp_api_key, @mail_chimp_list_id, email, {}, 'html', false, true, true)\n rescue Exception => e\n self.errors << e.message\n end\n remove_duplicate_errors\n end",
"def lists\n @lists = response[\"lists\"]\n if @lists and @lists[\"groups\"]\n @lists[\"groups\"].each do |group|\n group[\"items\"].map!{|item| Foursquared::Response::List.new(client, item)}\n end\n end\n @lists\n end",
"def email_list\n end",
"def send_to_mailchimp\n if email_address.present?\n if verified.present?\n if verified.start_with?('Verified')\n begin\n\n gibbon = Gibbon::Request.new\n mailchimpSend = gibbon.lists(Cohorts::Application.config.cohorts_mailchimp_list_id).members(Digest::MD5.hexdigest(email_address.downcase)).upsert(\n body: { email_address: email_address.downcase,\n status: 'subscribed',\n merge_fields: { FNAME: first_name || '',\n LNAME: last_name || '',\n MMERGE3: geography_id || '',\n MMERGE4: postal_code || '',\n MMERGE5: participation_type || '',\n MMERGE8: primary_device_description || '',\n MMERGE9: secondary_device_id || '',\n MMERGE10: secondary_device_description || '',\n MMERGE11: primary_connection_id || '',\n MMERGE12: primary_connection_description || '',\n MMERGE13: primary_device_id || '',\n MMERGE14: preferred_contact_method || '' } }\n )\n\n Rails.logger.info(\"[People->send_to_mailchimp] Sent #{id} to Mailchimp: #{mailchimpSend}\")\n rescue Gibbon::MailChimpError => e\n Rails.logger.fatal(\"[People->send_to_mailchimp] fatal error sending #{id} to Mailchimp: #{e.message}\")\n end\n end\n end\n end\n end",
"def create\n @contact_group = ContactGroup.new(params[:contact_group])\n contacts = params[:contacts]\n respond_to do |format|\n if @contact_group.save\n \tunless contacts.blank?\n contacts.each do |contact|\n @contact_group.contact_lists << ContactList.find(contact)\n end\n end\n flash[:notice] = \"#{@contact_group.name} was successfully created.\"\n format.html { redirect_to(admin_contact_groups_url) }\n format.xml { render :xml => @contact_group, :status => :created, :location => @contact_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contact_group.errors, :status => :unprocessable_entity }\n end\n end\n \n end",
"def write_email_to_mail_chimp\n require 'xmlrpc/client'\n chimpApi ||= XMLRPC::Client.new2(\"http://api.mailchimp.com/1.2/\")\n\n begin\n chimpApi.call(\"listSubscribe\", @mail_chimp_api_key, @mail_chimp_list_id, email, {}, 'html', false, true, true)\n rescue Exception => e\n self.errors.add_to_base(e.message + \" (MailChimp)\")\n end\n end",
"def maillist_prod\n maillist_parse(maillist_prod_file)\n end",
"def initialize_emails\n @emails = MailingList.first.emails\n end",
"def get_mails\n if params[:action] == 'get_mails'\n Log.add_info(request, params.inspect)\n end\n\n if !params[:pop].nil? and params[:pop] == 'true'\n\n mail_account_id = params[:mail_account_id]\n SqlHelper.validate_token([mail_account_id])\n\n begin\n new_arrivals_h = {}\n\n if mail_account_id.blank?\n mail_accounts = MailAccount.find_all(\"user_id=#{@login_user.id}\")\n mail_accounts.each do |mail_account|\n emails = Email.do_pop(mail_account)\n unless emails.empty?\n new_arrivals_h[mail_account.id] ||= []\n new_arrivals_h[mail_account.id] |= emails\n end\n end\n else\n mail_account = MailAccount.find(mail_account_id)\n emails = Email.do_pop(mail_account)\n unless emails.empty?\n new_arrivals_h[mail_account.id] ||= []\n new_arrivals_h[mail_account.id] |= emails\n end\n end\n\n unless new_arrivals_h.empty?\n flash[:notice] = t('mail.received', :count => new_arrivals_h.values.flatten.length)\n\n # FEATURE_MAIL_FILTERS >>>\n new_arrivals_h.each do |mail_account_id, emails|\n mail_filters = MailFilter.get_for(mail_account_id, true, MailFilter::TRIGGER_CHECKING)\n filter_next = true\n\n emails.each do |email|\n mail_filters.each do |filter|\n filter_next = filter.execute(email)\n break unless filter_next\n end\n break unless filter_next\n end\n end\n # FEATURE_MAIL_FILTERS <<<\n end\n rescue => evar\n if evar.to_s.starts_with?('ERROR:')\n flash[:notice] = evar.to_s\n else\n flash[:notice] = 'ERROR:' + t('mail.receive_error') + '<br/>' + evar.to_s\n end\n Log.add_error(nil, evar)\n end\n end\n\n @folder_id = params[:id]\n SqlHelper.validate_token([@folder_id])\n\n if @folder_id == TreeElement::ROOT_ID.to_s\n @emails = nil\n else\n=begin\n# @emails = MailFolder.get_mails_to_show(@folder_id, @login_user)\n=end\n# FEATURE_PAGING_IN_TREE >>>\n @sort_col = (params[:sort_col] || 'sent_at')\n @sort_type = (params[:sort_type] || 'DESC')\n SqlHelper.validate_token([@sort_col, @sort_type], ['.'])\n\n sql = EmailsHelper.get_list_sql(@login_user, params[:keyword], [@folder_id], @sort_col, @sort_type, 0, nil)\n @email_pages, @emails, @total_num = paginate_by_sql(Email, sql, 10)\n# FEATURE_PAGING_IN_TREE <<<\n end\n\n session[:mailfolder_id] = @folder_id\n\n render(:partial => 'ajax_folder_mails', :layout => false)\n end",
"def fetch_messages(gmail, label, criteria, save_attachments)\n mails = []\n gmail.mailbox(label).search(criteria).each do |email|\n subject = \"#{Mail::Encodings.value_decode(email.subject)}\"\n puts \"----------\"\n puts \"[#{email.uid}] #{subject}\"\n from = sender(email.from)\n to = recipients(email.to)\n attachments = attachments(email)\n body = extract_body(email)\n\n # TODO: saving attachments should be configurable\n if save_attachments && email.message.attachments.any?\n puts \"Attachments:\"\n email.message.attachments.each do |attachment|\n save_attachment(email, attachment)\n end\n end\n\n mails << { :uid => email.uid,\n :date => Time.parse(email.date),\n :subject => subject,\n :from => from,\n :to => to,\n :body => body,\n :attachments => attachments }\n end\n mails\n end",
"def setup_data\n # get a list of current year's members@ emails\n year = Time.new.year.to_s\n archive = Dir[File.join(MAIL_ROOT, \"members\", \"#{year}*\", \"*\")]\n\n # select messages that have a subject line starting with [MEMBER NOMINATION]\n emails = []\n archive.each do |email|\n next if email.end_with? '/index'\n message = IO.read(email, mode: 'rb')\n next unless message[/^Date: .*/].to_s.include? year\n subject = message[/^Subject: .*/]\n next if not subject # HACK: allow script to continue if bogus email\n next if subject =~ /board nominations$/ # not a nomination!\n subjectUC = subject.upcase\n next unless subjectUC =~ /BOARD/\n next unless subjectUC =~ /NOMI[NM]ATION/\n mail = Mail.new(message.encode(message.encoding, crlf_newline: true))\n mail.subject.sub!(/\\bDelacratez\\b/, 'Delacretaz') # typo\n emails << mail if mail.subject =~ /^\\[?BOARD NOMI[MN]ATION\\]?/i\n end\n\n # parse nominations for names and ids\n nominations = ASF::MemberFiles.board_nominees.map do |id, hash|\n {id: id, name: hash['Public Name'], nominator: hash['Nominated by']}\n end\n\n # preload names\n ASF::Person.preload('cn',\n nominations.map {|nominee| ASF::Person.find(nominee[:id])})\n\n return nominations, emails\nend",
"def index\n @email_lists = EmailList.all\n end",
"def set_mailchimp\n @mailchimp = Mailchimp.first\n end",
"def groups\r\n @groups ||= fetch_groups\r\n end",
"def fetch_group_data\n response = fetch_data(@@SETTINGS.group_tab)\n unless response.nil?\n adjust_groups response\n end\n end",
"def fetch\n @members = []\n page = 0\n\n begin\n page += 1\n url = open(\"#{base_url}/memberslistxml?p=#{page}\", {:proxy => true})\n member_data = REXML::Document.new(url.read).root\n\n @group_id64 = member_data.elements['groupID64'].text.to_i if page == 1\n total_pages = member_data.elements['totalPages'].text.to_i\n\n member_data.elements['members'].elements.each do |member|\n @members << SteamId.new(member.text.to_i, false)\n end\n end while page < total_pages\n\n super\n end",
"def subscribe_to_mailchimp(action = true)\n gibbon = Gibbon::Request.new\n gibbon.timeout = 15\n list_id = Rails.application.config.list_id\n\n response = gibbon.lists(list_id).members(Digest::MD5.hexdigest(self.email)).upsert(body: {\n email_address: self.email, \n status: action ? \"subscribed\" : \"unsubscribed\", \n })\n \n response\n end",
"def get_mails()\n emails = Mail.find(:what => :first, :count => 20, :order => :asc)\n relevant = filter_mails emails\n parse_mails relevant\n end",
"def subscribe\n mailchimp = Gibbon::API.new\n result = mailchimp.lists.subscribe({\n :id => ENV[\"MAILCHIMP_LIST_ID\"],\n :email => {:email => self.email},\n :merge_vars => {\n :FNAME => self.fname,\n :LNAME => self.lname,\n :COHORT_ID => self.cohort_id,\n :SCHOOL => self.school.name,\n :CITY => self.cohort.city.name,\n :SDATE => self.cohort.start_date,\n :EDATE => self.cohort.end_date,\n :ENV => Rails.env\n },\n :double_optin => false,\n :update_existing => true,\n :send_welcome => false\n })\n Rails.logger.info(\"Subscribed #{self.email} to MailChimp\") if result\n\n end",
"def push_to_lists_and_feeds\n add_to_stories_lists\n pushed_user_ids = add_to_friend_feeds\n pushed_user_ids\n end",
"def mailboxes_list\n get \"mailboxes\"\n end",
"def send_group_list\n I3.server.send_object(I3.directory.find_all_groups)\n end",
"def fetch_contacts\n case params[:importer]\n when OTHER_EMAIL then params[:emails].split(',')\n when GMAIL, YAHOO, HOTMAIL, OUTLOOK, LINKEDIN then params[:contacts]\n end\n end",
"def list\n @contact_groups = Admin::ContactGroup.names\n\n render json: { contactGroups: @contact_groups }\n end",
"def api\n # Instantiate an instance of Gibbon with the API key provided to this adapter.\n # We only work with the lists api here, so namespace into that.\n Gibbon::API.new(@campaignable_api_key).lists \n end",
"def list\n @client.call(method: :get, path: 'recipient-lists')\n end",
"def listgroup \n @groups = Group.where(:company_id => params[:id])\n #@lst= []\n # @groups.each do |group| \n # @lst << JSON.parse(group.to_json).merge(member_nbr: group.users.count)\n # end\n # format.json { render :json => @lst } \n render 'list'\n end",
"def belonging_groups\n contact_groups = []\n @contact.contact_groups.each do |group|\n contact_groups << { _id: group['_id'].to_s, lbl: group['label'] }\n end\n\n respond_to do |format|\n format.js {}\n format.json { render json: contact_groups }\n end\n end",
"def import_gmail_contacts\n @group = DiscussionGroup.find(params[:id])\n if @login_user.is_member_of_discussion_group(@group.id)\n if request.post?\n begin\n @contacts = Contacts::Gmail.new(params[:email], params[:password]).contacts\n @contacts.each{|c| c[0] = c[1] if c[0].blank? }\n @contacts = @contacts.sort{|a,b| a[0].nil? ? -1 : b[0].nil? ? 1 : a[0].downcase <=> b[0].downcase }\n rescue Exception => e\n @message = e.message == \"Username or password are incorrect\" ? \"Username or password is incorrect.\" : e.message\n end\n respond_to do |format|\n format.js\n end\n else\n respond_to do |format|\n format.html { render :layout => false}\n end\n end\n else\n flash[:notice] = \"You can not invite the user in this group.\"\n redirect_to :back\n end\n end",
"def memberships\n @list.client.get(\"#{url}/memberships\")\n end",
"def my_groups(options={})\n @my_groups = nil if options.delete(:force_download)\n @my_groups ||= objects_from_response(TheCity::Group, :get, \"/me/groups\", options)\n end",
"def index\n groups = get_collection(assignment.groups) || return\n\n group_data = include_memberships(groups)\n\n respond_to do |format|\n format.xml do\n render xml: group_data.to_xml(root: 'groups', skip_types: 'true')\n end\n format.json { render json: group_data }\n end\n end",
"def index\n @collection_groups = CollectionGroup.all\n end",
"def create_group\n @mailing_list_group = MailingListGroup.new\n @mailing_list_group.user = current_user\n @mailing_list_group.name = current_user.new_mailing_list_name\n @ok = @mailing_list_group.save\n render 'update_list'\n end",
"def index\n @mailing_lists = MailingList.all\n @email = @mailing_lists.collect(&:email).join(\"; \")\n end",
"def list(options={})\n Mailgun.submit(:get, campaign_url, options)[\"items\"] || []\n end",
"def fetch_data\n parse_data(self.organization.find_data(self.data_path, \n :include => [:url, :name, :description, :picture]))\n end",
"def list\n @groups = Group.find(:all, :order => 'name')\n end",
"def process\n result[:citation_groups] = citation_groups\n end",
"def update_list\n\t\tif emails_changed? and from_contacts\n\t\t\temails_was_arr = emails_was.split(\",\")\n\t\t\temails_arr = emails.split(\",\")\n\t\t\tdeleted_emails = emails_was_arr.diff emails_arr\n\t\t\tadded_emails = emails_arr.diff - emails_was_arr\n\t\t\t\n\t\t\tdeleted_emails.each do |email|\n\t\t\t\tnewsletter.email_service(delete_member_from_list(email))\n\t\t\tend\n\n\t\t\tadded_emails.each do |email|\n\t\t\t\tnewsletter.email_service(add_member_to_list(email))\n\t\t\tend\n\t\tend\n\tend",
"def lists\n load_user_lists\n end",
"def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend",
"def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend",
"def set_mailing_list\n @mailing_list = MailingList.find(params[:id])\n end",
"def index\n @group_addon_lists = GroupAddonList.all\n end",
"def initialize(mailchimp_api_key, mailchimp_list_id)\n\t\t@mak = mailchimp_api_key\n\t\t@mli = mailchimp_list_id\n\t\t@mc = Mailchimp::API.new(mailchimp_api_key)\n\tend",
"def import\n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb @hub.name, hub_path(@hub)\n add_breadcrumb @group.name, hub_group_path(@group)\n add_breadcrumb 'Import contacts', import_hub_group_path(@hub, @group)\n \n append_title 'Import contacts'\n \n @example_data = <<-IMPORT\nEmail\tTelephone\tName\njon.doe@example.com\t(123) 456-7890\tJon Doe\njane_doe@example.com\t(234) 567-8901\tJane Doe\nfoo+bar@example.com\t(345) 678-9012\tFoo Bar\nIMPORT\n @example_data.chop!\n \n respond_to do |format|\n format.html # import.html.erb\n format.json { render :json => @group }\n end\n end",
"def yammer_group_coworkers\n set = []\n self.cached_yammer_groups.each do |group|\n set += self.company.cached_yammer_group_contacts(group.id)\n end\n return set\n end",
"def build_lists\n @callday = [' ','SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY']\n @callback = [' ', 'SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY']\n @contact_method = ['CALL', 'EMAIL', 'TEXT']\n @called = ['NO', 'NO ANSWER', 'YES']\n @ordered = [' ', 'NO', 'YES']\n @windows = ['10am - noon', 'noon - 2pm', '2pm - 4pm', '4pm - 6pm']\n @alt_contact = [' ', 'ZINGLE', 'TEXT', 'VOICE MAIL', 'OTHER']\n @rep = []\n reps = []\n\n if @user == 'ADMIN'\n users = User.all\n else\n users = User.where(manager_id: current_user.manager_id.upcase)\n end\n users.each do |u|\n if u.email.upcase != 'ADMIN' && u.email.upcase != 'TECH'\n reps.push(u.email.upcase)\n end\n end\n reps.sort!\n reps.each do |r|\n @rep.push(r)\n end\n reps.unshift(\"ALL\")\n if session[:called_rep].blank?\n if @user == 'ADMIN' || @user == 'TECH'\n session[:called_rep] = reps[1]\n else\n session[:called_rep] = @user\n end\n end\n @reps = []\n i = 1\n @selected_rep = 0\n reps.each do |r|\n select_item = []\n select_item.push(r)\n select_item.push(i)\n @reps.push(select_item)\n if r == session[:called_rep]\n @selected_rep = i\n end\n i += 1\n end\n session[:calllist_reps] = @reps\n\n @isr_list = []\n tempisr = []\n tempisr.push(' ')\n isrlist = IsrList.all\n isrlist.each do |c|\n if c.name && !tempisr.include?(c.name)\n tempisr.push(c.name)\n end\n end\n @isr_list = tempisr.sort\n @isr_user = false\n if @isr_list.include?(@user)\n @isr_user = true\n end\n end",
"def fetch_meli_boxes!(filters={})\n puts \"# AccountSyncWorker.fetch_meli_boxes! filters: #{filters}\"\n query_meli_boxes filters do |partial_orders, data, opts|\n puts \"# AccountSyncWorker.fetch_meli_boxes! opts: #{opts}\"\n add_to_collection partial_orders, opts\n ##\n # TODO\n # Enqueue collection instead of adding to collection\n # enqueue_meli_query opts\n ##\n end\n end",
"def show\n #p \"IN GROUP SHOW !!!!!\"\n @id = params[:id]\n #p @id\n @messages = Array.new\n response = RestClient.get 'https://gtcollab.herokuapp.com/api/group-messages/?group=' + @id , {authorization: $token}\n objArray = JSON.parse(response.body)\n p \" DAN!\"\n objArray['results'].each do |msg|\n message = Message.new\n message.content = msg['content']\n message.time = msg['timestamp']\n message.creator = msg['creator']['username']\n message.creator_id = msg['creator']['id']\n @messages << message\n end\n\n response = RestClient.get 'https://gtcollab.herokuapp.com/api/groups/' + @id , {authorization: $token}\n objArray = JSON.parse(response.body)\n p \"dd ||||||\"\n p objArray\n members = Array.new\n @group = Group.new\n @group.id = objArray[\"id\"]\n @group.name = objArray[\"name\"]\n @group.course_id = objArray[\"course\"] #id\n @group.creator_id = objArray[\"creator\"][\"id\"]\n @group.creator_username = objArray[\"creator\"][\"username\"]\n @group.creator_firstname = objArray[\"creator\"][\"first_name\"]\n @group.creator_lastname = objArray[\"creator\"][\"last_name\"]\n @group.creator_email = objArray[\"creator\"][\"email\"]\n \n objArray[\"members\"].each do |member|\n members << member\n end\n @group.members = members\n\n\n response = RestClient.get 'https://gtcollab.herokuapp.com/api/users/?courses_as_member=' + @group.course_id.to_s , {authorization: $token}\n objArray = JSON.parse(response.body)\n #p \"COUNTTT\"\n #p objArray[\"count\"]\n @count = objArray[\"count\"].to_s\n\n mem_list = Array.new\n\n p members\n objArray[\"results\"].each do |member|\n p member[\"id\"].to_i\n if members.include? member[\"id\"].to_i\n p member[\"id\"].to_i\n p \"is a memeber <-\"\n else\n p member[\"id\"].to_i\n p \"not a memeber <-\"\n mem_list << member\n end\n end\n @all_members = mem_list\n\n #hash = group.as_json\n #@mymeetings[hash[\"id\"]] = hash\n end",
"def list_groups\n BrickFTP::API::Group.all\n end",
"def list_groups\n BrickFTP::API::Group.all\n end",
"def collect_group_details\n return @groups_cache ||= @group_provider.groups unless @group_provider.nil?\n\n []\n end",
"def update_mailchimp(list_name, old_email = self[email_column])\n apikey ||= chimpLogin(monkeybrains[:username], monkeybrains[:password])\n list_id ||= find_mailing_list(apikey, list_name)\n vars = {}\n vars.merge!({\"FNAME\" => self[fname_column]}) if self.has_attribute?(fname_column)\n vars.merge!({\"LNAME\" => self[lname_column]}) if self.has_attribute?(lname_column)\n vars.merge!({\"EMAIL\" => self[email_column]})\n chimpUpdate(apikey, list_id[\"id\"], old_email, vars, self[type_column], true)\n rescue XMLRPC::FaultException\n end",
"def get_email_list(email)\n mail_list_array = []\n response = get_emails(email)\n if !response.blank?\n json_body = JSON.parse(response.body)\n if !json_body[\"items\"].blank?\n Rails.logger.info \"Total Emails: #{json_body[\"items\"].count}\"\n json_body[\"items\"].each do |item|\n Rails.logger.info \"Subject: #{item['message']['headers']['subject']}\"\n Rails.logger.info \"Storage Url: #{item['storage']['url']}\"\n mail_list_array.push(item['storage']['url'])\n end\n end\n end\n mail_list_array\n end",
"def use_saved_list\n logger.debug \"**** USE SAVED LIST ****\"\n \n show_params(params) #debug params and put them in logs\n \n\tsaved_contact_list_id = params[:saved_contact_list][:saved_contact_list_id] if !params[:saved_contact_list].blank?\n saved_contact_list_id = params[:saved_contact_list_id] unless params[:saved_contact_list_id].blank?\n\t \n if !saved_contact_list_id.blank?\n \n @saved_contact_list = SavedContactList.find(saved_contact_list_id)\n\t \n\t # Paginate saved contact list role contactinfos\n\t # to make the pagination quick and efficient for large lists and \n\t # the role contactinfos sorted by person full name (last_name first)\n\t # or by organisation name we have to use specially created\n\t # saved_lists_contacts\t \n\t number_of_contacts_per_page = 25\n\t total_number_of_contacts = SavedRoleContactinfo.find(:all, :select => 'role_contactinfo_id', :conditions => ['saved_contact_list_id = ?', saved_contact_list_id])\n\t \n\t @saved_list_contacts_pages = Paginator.new self, total_number_of_contacts.length, number_of_contacts_per_page, params[:page]\n\n\t selected_list_contacts = ActiveRecord::Base.connection.execute(\"SELECT role_contactinfo_id \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \" FROM saved_lists_contacts \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \" WHERE saved_contact_list_id=#{@saved_contact_list.saved_contact_list_id} \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \" ORDER BY contact_name \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \" LIMIT #{@saved_list_contacts_pages.items_per_page.to_i} \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \" OFFSET #{@saved_list_contacts_pages.current.offset.to_i}\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t @contacts = Array.new\n\t selected_list_contacts.each do |c_id|\n\t @contacts.push(RoleContactinfo.find(c_id['role_contactinfo_id']))\n\t end\n\t \n session[:contacts_from_search] = @contacts\n \n @already_selected = session[SELECTED_CONTACTS]\n logger.debug \"Contacts from saved list @ #{@contacts}\"\n \n # processing for existent contacts from mailout or saved contact lists\n saved_list_contacts = session[:list_contacts]\n mailout_list_contacts = session[:mailout_contacts]\n if saved_list_contacts != nil\n @already_selected = @already_selected + saved_list_contacts\n end\n if mailout_list_contacts != nil\n @already_selected = @already_selected + mailout_list_contacts\n end \n \n end\n \n render :partial => 'use_saved_list'\n end",
"def add_ids_to_campaignmember(obj,instance_url,access_token)\n json_payload = nil\n campaign_id = obj[\"event\"][\"id\"]\n contact_email = obj[\"profile\"][\"email\"]\n contact_fn = escape_characters(obj[\"profile\"][\"first_name\"])\n contact_ln = escape_characters(obj[\"profile\"][\"last_name\"])\n contact_email = obj[\"order\"][\"email\"] if contact_email.nil?\n contact_email = escape_characters(contact_email)\n checked_in = nil\n checked_in = \"Responded\" if obj[\"checked_in\"]\n campaign_search_string =\n url_encode(\n \"FIND {#{campaign_id}}\" \\\n \" IN ALL FIELDS\" \\\n \" RETURNING Campaign(Id)\")\n contact_search_string =\n url_encode(\n \"FIND {#{contact_fn}\" \\\n \" AND #{contact_ln}\" \\\n \" AND #{contact_email}}\" \\\n \" IN ALL FIELDS\" \\\n \" RETURNING Contact(Id)\")\n campaign_base_uri = \"#{instance_url}/services/data/v29.0/search/?q=#{campaign_search_string}\"\n begin\n campaign_query_response = rest_call(\"get\",campaign_base_uri,json_payload,access_token)\n @json_campaign = JSON.parse(campaign_query_response)[0]\n end until !@json_campaign.nil?\n contact_base_uri = \"#{instance_url}/services/data/v29.0/search/?q=#{contact_search_string}\"\n contact_query_response = rest_call(\"get\",contact_base_uri,json_payload,access_token)\n json_contact = JSON.parse(contact_query_response)[0]\n unless json_contact.nil?\n obj.store(\"ContactId\",json_contact[\"Id\"])\n obj.store(\"CampaignId\",@json_campaign[\"Id\"])\n obj.store(\"Status\",checked_in) unless checked_in.nil?\n else\n obj = nil\n end\n return obj\n end",
"def get_email_list\n return get_townhall_list_and_url.map{|town, url| {town => get_townhall_email(url)}}\n end",
"def get_mailboxes\n get(\"mailboxes\")\n end",
"def fetch\n @github.fetch\n @stackoverflow.fetch\n @acuk.fetch\n @jobs = data.shuffle\n end",
"def maillist_dev\n maillist_parse(maillist_dev_file)\n end",
"def index\r\n @receive_groups = ReceiveGroup.all\r\n end",
"def set_lists\n\t\t\t@lists = @intranet.lists\n\t\tend",
"def use_saved_list\n logger.debug \"**** USE SAVED LIST ****\"\n \n show_params(params) #debug params and put them in logs\n saved_contact_list_id = params[:search][:list_id]\n if saved_contact_list_id != ''\n @saved_contact_list = SavedContactList.find(saved_contact_list_id)\n @contacts = @saved_contact_list.contributors\n \n session[:contacts_from_search] = @contacts\n \n @already_selected = session[SELECTED_CONTACTS]\n logger.debug \"Contributors from saved list @ #{@contacts}\"\n \n # processing for existent contacts from mailout or saved contact lists\n saved_list_contacts = session[:list_contacts]\n mailout_list_contacts = session[:mailout_contacts]\n if saved_list_contacts != nil\n @already_selected = @already_selected + saved_list_contacts\n end\n if mailout_list_contacts != nil\n @already_selected = @already_selected + mailout_list_contacts\n end \n \n #Given we have got this far, store the search details in the session\n session[:last_search_details ] = {:list => @saved_contact_list.id}\n end\n render :layout => false\n end",
"def index\n @group_requests = GroupRequest.all\n end",
"def list\r\n\t\t@current_area = 'newsletter_signups'\r\n\t\t@current_menu = 'newsletter_signups'\r\n\r\n\t\tsort_order ||= get_sort_order(\"s-name\", [\"first_name\", \"last_name\"])\r\n\t\tsort_order ||= get_sort_order(\"s-email\", \"email\")\r\n\t\tsort_order ||= \"id ASC\"\r\n\r\n\t\tpage = params[:page] ? params[:page].to_i : 1\r\n\t\titems_per_page = 30\r\n\t\toffset = (page - 1) * items_per_page\r\n\r\n\t\tif params[:delete] and params[:select]\r\n\t\t\tc = params[:select].keys.collect do |cur_key|\r\n\t\t\t\tNewsletterSignup.delete(cur_key.to_i)\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\t@signup_count = NewsletterSignup.count\r\n\r\n\t\t@pages = Paginator.new(self, @signup_count, items_per_page, page)\r\n\r\n\t\t@signups = NewsletterSignup.find(:all, :order => sort_order)\r\n\tend",
"def list(options={})\n Mailgun.submit(:get, complaint_url, options)[\"items\"] || []\n end",
"def extract_items(list)\n if (items = super).any?\n items.first['contentDetails'].fetch 'relatedPlaylists', {}\n end\n end",
"def add_user_to_mailchimp \n Rails.logger.info(\"Mailchimp subscribe request being made\")\n unless self.email.include?('@example.com')\n mailchimp = Hominid::API.new(AppConstants.mailchimp_key) \n list_id = mailchimp.find_list_id_by_name AppConstants.mailchimp_list \n info = { }\n result = mailchimp.list_subscribe(list_id, self.email, info, 'html', false, true, false, true)\n Rails.logger.info(\"Mailchimp subscribed for the email id #{self.email} to #{AppConstants.mailchimp_list}\")\n end\n end",
"def existing_ce_group\n self.refresh_access_token!\n\n response = @oauth_access_token.get(\n 'https://www.google.com/m8/feeds/groups/default/full?max-results=100000',\n {\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n ).body\n\n doc = Nokogiri::XML(response)\n\n ids = doc.xpath('//atom:entry/atom:id', {'atom' => ATOM_NAMESPACE}).map do |e|\n e.content.split('/')[-1]\n end\n\n titles = doc.xpath('//atom:entry/atom:title', {'atom' => ATOM_NAMESPACE}).map do |e|\n e.content\n end\n\n entries = Hash[titles.zip(ids)]\n entries['Contact Exchange']\n end",
"def set_mail_list\n @mail_list = MailList.find(params[:id])\n end",
"def mygroups\n @user = User.find_by(email: user_params[:email])\n\n @usergroups = @user.studygroups_users\n @mygroups = []\n\n @usergroups.each { |group|\n @studygroup = Studygroup.find_by(id: group.studygroup_id)\n @mygroups.push(@studygroup)\n\n }\n render json: @mygroups\n end",
"def index\n @group_members = GroupMember.all\n end",
"def subscribe_to_lists(list_names, email)\n walk_recipients(list_names, email) do |lr, list_id, contact_id|\n if lr.nil?\n ::Mailjet::Listrecipient.create(list_id: list_id, contact_id: contact_id, is_unsubscribed: 'false')\n elsif lr.is_unsubscribed\n lr.update_attributes(is_unsubscribed: 'false', unsubscribed_at: nil)\n end\n end\n rescue ::Mailjet::ApiError\n # ignore\n end",
"def build_project_lists\n # call the application controller connect funtion\n conn = basecamp_connect\n unless conn \n raise \"url or authkey not set\"\n end\n projects = Basecamp::Project.find_by_status(conn, 'active')\n @project_list = projects.collect{|p| [p.name, p.id] }.sort_by{|name, id| name }\n @mantis_list = MantisProjectTable.order(\"name\").all.collect{|p| [ p.name, p.id ] }\n end",
"def fetch\n ##\n # an array of { category_id: number, news: array }\n @fetched = News.fetch_and_store_news_from_all_agency_feed!\n render :fetch, status: :ok\n end",
"def create_areamail_lists(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/areamail/lists.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'page' => options['page'],\r\n 'pagesize' => options['pagesize'],\r\n 'areamailsid' => options['areamailsid'],\r\n 'dateCreated' => options['date_created']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def export_csv\n\n group_array = []\n @page = 1\n @per_page = 50\n\n groups = @context.get(:groups, :page => @page, :per_page => @per_page, :access_token => ENV[\"API_TOKEN\"])\n group_array << groups\n group_array, group_hash = check_paging(groups, group_array, \"groups\", @context, true)\n\n group_array.each_with_index do |group, index|\n is_new = index == 0 ? true : false\n membership_array = []\n @page = 1\n\n group_model = Group.find(group['id'], :params => { :access_token => ENV[\"API_TOKEN\"] })\n memberships = group_model.get(:memberships, :page => @page, :per_page => @per_page, :access_token => ENV[\"API_TOKEN\"])\n membership_array << memberships\n membership_array, @membership_hash = check_paging(memberships, membership_array, \"memberships\", group_model, is_new)\n end\n\n export_data = [group_array, @membership_hash]\n perform_export(export_data) \n\n respond_to do |format|\n format.html { render :inline => \"<a href=<%= @download_url %>>Download CSV</a>\" }\n format.json { render :json => @download_url.to_json }\n end\n end",
"def batch_subscribe(emails=[])\n # Do this using a batch call to the MailChimp API for performance rather than lots of single API calls.\n api.batch_subscribe({\n \t:id => @campaignable_list_id,\n :batch => emails.map {|email| {:email => { :email => email }} }, # Map all users in the system into a mailchimp collcation.\n :double_optin => false, # Don't require email authorization.\n :update_existing => true, # Don't error if adding existing subscriber.\n :replace_interests => false # Don't send a welcome email when they're added to the list. \n })\n end",
"def fetch_medals\n updated_medals = []\n medal_divs = @career.search(\"div.medalBlock\")\n medal_divs.each do |div| \n ranked = (div/\"span.top\").inner_html.gsub(\",\",\"\").to_i\n social = (div/\"span.bot\").inner_html.gsub(\",\",\"\").to_i\n name_id = MEDAL_IDS[div.at(\"div\")[:id]]\n updated_medals << { :medal_name_id => name_id, :playlist_type => 1, :gamertag_id => self.id, :quantity => ranked }\n updated_medals << { :medal_name_id => name_id, :playlist_type => 2, :gamertag_id => self.id, :quantity => social }\n end\n return updated_medals\n end",
"def load_groups(input)\n groups = Hash.new\n while g = parse_rfc822_header(input)\n date = parse_date(g['Date-Created'])\n groups[g['Name']] = Newsgroup.new(g['Name'], date, g['Description'])\n end\n return groups\n end",
"def list(options={})\n response = Mailgun.submit(:get, list_url, options)[\"items\"] || []\n end"
] | [
"0.7106344",
"0.6650071",
"0.62344825",
"0.6084809",
"0.60549235",
"0.6026354",
"0.59572196",
"0.58818847",
"0.5798306",
"0.57596856",
"0.56996727",
"0.56779045",
"0.56779045",
"0.5629777",
"0.5627818",
"0.5622494",
"0.5601823",
"0.55877674",
"0.5560389",
"0.5520661",
"0.5502938",
"0.54980165",
"0.54953337",
"0.54811627",
"0.54721826",
"0.54673946",
"0.54661065",
"0.5459485",
"0.5452384",
"0.54507774",
"0.5446558",
"0.54424644",
"0.5426281",
"0.5395735",
"0.539299",
"0.5391549",
"0.5371017",
"0.53680784",
"0.53599066",
"0.53421307",
"0.53337955",
"0.53098637",
"0.52932054",
"0.52839726",
"0.52796835",
"0.5271631",
"0.52615345",
"0.52592987",
"0.52469844",
"0.5239766",
"0.52364945",
"0.5230871",
"0.52081287",
"0.5206388",
"0.5195457",
"0.5194592",
"0.5193709",
"0.5187583",
"0.518428",
"0.518428",
"0.5180731",
"0.5178482",
"0.517436",
"0.51669836",
"0.5166693",
"0.5161784",
"0.51519734",
"0.51464343",
"0.5144587",
"0.5144587",
"0.51390046",
"0.51318425",
"0.5131761",
"0.51258475",
"0.51241076",
"0.5115174",
"0.51151544",
"0.51090103",
"0.51069164",
"0.5101002",
"0.5095145",
"0.5093388",
"0.50866944",
"0.50846106",
"0.5083897",
"0.5083359",
"0.5083058",
"0.5075694",
"0.5072495",
"0.50644684",
"0.5063007",
"0.50625205",
"0.5060478",
"0.5056688",
"0.5051016",
"0.5045139",
"0.5044699",
"0.50427234",
"0.5042397",
"0.5041375"
] | 0.6590449 | 2 |
"type": "subscribe", "fired_at": "20090326 21:35:57", "data[id]": "8a25ff1d98", "data[list_id]": "a6b5da1054", | def customer_mailchimp_subscribed
{
:list_id => data['list_id'],
:fired_at => params['fired_at'],
:mailchimp_id => data['id'],
:email => data['email'],
:email_type => data['email_type'],
:merges => data['merges'],
:ip_opt => params['ip_opt'],
:ip_signup => params['ip_signup'],
:human => "#{data['email']} subscribed to Mailchimp list with ID #{data['list_id']}"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscribers\n subscriber_data = RunrWatcherServer.runr_session_get(\"subscribers\")\n return [] unless subscriber_data.present?\n list = subscriber_data[:subscribers][\"list\"]\n return [] unless list.present?\n JSON.parse list\n end",
"def http_raw_notify_data\n {\n \"id\"=>\"b9879d2b-052f-4a0a-8a3f-3e72049e4d19\", \n \"event\"=>\"invoice_paid\", \n \"payload\"=> invoice_data\n }.to_json\n end",
"def customer_mailchimp_unsubscribed\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :campaign_id => data['campaign_id'],\n :human => \"#{data['email']} unsubscribed from Mailchimp list with ID #{data['list_id']}\"\n }\n end",
"def subscribe(data)\n # @channels (local tracker)\n # push channel name into subscribe list, if and only if not already in subscribe list\n end",
"def subscribe_to_newsletter\n @attributes[:subscribe_to_newsletter]\n end",
"def subscribe_frame d, h\n h[:ack] = 'auto' unless ['client', 'client-individual'].include?(h[:ack])\n create_frame 'SUBSCRIBE', [{:id => OnStomp.next_serial}, h, {:destination => d}]\n end",
"def inbound_payload\n JSON.parse(data)['inbound']['payload']\n end",
"def subscribe\n \nend",
"def subscribes\n @subscribes ||= user_data_as_array('subscribe')\n @subscribes\n end",
"def subscribe(list)\n l = ActsAsIcontact::List.find(list)\n s = ActsAsIcontact::Subscription.new(:contactId => id, :listId => l.id)\n s.save\n end",
"def subid\n unsubscribe[:subid]\n end",
"def customerio_payload\n {\n alert: { id: 12345 },\n metric: { name: \"sample_alert\", type: \"gauge\" },\n measurements: [{\n value: 3.14,\n source: \"foo:bar.uid:123\"\n }, {\n value: 1.23,\n source: \"foo:bar.uid:234\"\n }],\n trigger_time: Time.now.to_i\n }.with_indifferent_access\n end",
"def subscription_id\n @event.attributes[:subscription_id]\n end",
"def listOfSubscribedEvents (bookieEmail)\r\n events = @BetESS.fMapOfAllEvents\r\n subscribedEvents = @BetESS.fGetSubscribedEventsFrom(bookieEmail)\r\n\r\n puts \"\\t\\tSubscribed Events:\"\r\n subscribedEvents.each {|eventID| puts \"#{events[eventID].toString}------\"}\r\n puts \"########\"\r\n end",
"def on_subscription_success\n end",
"def webhook_subscribe\n # verify the string parameters\n if params['hub.mode'] == 'subscribe' &&\n params['hub.topic'] == @feed.url &&\n params['hub.challenge'].present?\n\n @feed.status = 'subscription_requested' # 17 mins\n if params['hub.lease_seconds'].present? && params['hub.lease_seconds'].to_i > 0\n @feed.expiration_date = DateTime.now + Rational(params['hub.lease_seconds'].to_i, 86_400)\n unless @feed.save\n # log error\n logger.error \"FEED SAVE TO DB ERROR:#{@feed.inspect}\"\n end\n end\n\n render status: 200, plain: params['hub.challenge']\n else\n render status: 422, plain: 'Invalid parameters'\n end\n end",
"def subscribed; end",
"def get_subscriptions\n subscriptions = []\n\n # Load the checks\n file = File.read(CHECKS)\n checks = JSON.parse(file)\n\n for check in checks\n subscriptions |= check[\"subscribers\"]\n end\n\n return subscriptions\nend",
"def http_message\n {\n data: {\n type: \"events\",\n id: event.id,\n attributes: {\n updated_at: event.updated_at,\n }\n }\n }.to_json\n end",
"def subscribed_at\n Time.parse params['subscr_date']\n end",
"def events\n data[\"events\"]\n end",
"def get_data(event, data={})\n self['event'] = event\n self['properties'] = data \n self['properties']['token'] = @key\n self['properties']['time'] = Time.now.to_i\n \n Base64.encode64(JSON.generate(self))\n end",
"def subscribe_to_list(user, list, options={})\n post(\"/#{user}/#{list}/subscribers.json\")\n end",
"def customer_mailchimp_email_updated\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :new_mailchimp_id => data['id'],\n :new_email => data['new_email'],\n :old_email => data['old_email'],\n :human => \"#{data['email']} updated their email address on Mailchimp, from '#{data['old_email']}' to '#{data['new_email']}'.\"\n }\n end",
"def subscribe!\n # TODO: Implement\n end",
"def history_data\n @id = params[:id]\n @item_history = []\n @item_name = @item_names[@id.to_i]\n json_str = Net::HTTP.get(URI.parse(\"http://#{THINGSPEAK_SERVER}/channels/#{OT_CHANNEL}/feed.json?results=200\")) \n parsed_hash = ActiveSupport::JSON.decode(json_str)\n parsed_hash[\"feeds\"].each do |e|\n if e[\"field1\"] == @id\n item = {}\n t = Time.strptime(e[\"created_at\"], \"%FT%T%z\")\n item[\"time\"] = t.strftime(\"%b %d, %Y %H:%M:%S\")\n item[\"curr_loc\"] = e[\"field4\"]\n @item_history.push(item)\n end\n end\n\n render :template => \"static/history_data\", :formats => [:json], :handlers => \"haml\", :layout => false\n end",
"def trackgen_info;\treturn @json_data['trackgen_info'];\tend",
"def registration_ids\n [user.profile.web_push_subscription.except('expirationTime').deep_symbolize_keys]\n end",
"def invite\n @data['invite']\n end",
"def subscriber_list(statuspage_id)\n request :method => :get,\n :url => @url + 'subscriber/list/' + statuspage_id\n end",
"def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end",
"def get_subscriber_of_list(user, list, subscriber_id)\n get(\"/#{user}/#{list}/subscribers/#{subscriber_id}.json\")\n end",
"def message(event)\n msg = JSON.parse(event.data, :symbolize_names => true) rescue {}\n seq = msg[:message_sequence]\n if msg[:ping] == 'PING'\n Firehose.logger.debug \"WS ping received, sending pong\"\n @ws.send JSON.generate :pong => 'PONG'\n elsif !@subscribed && seq.kind_of?(Integer)\n Firehose.logger.debug \"Subscribing at message_sequence #{seq}\"\n subscribe seq\n end\n end",
"def get_doc_id(notification)\n notification[\"id\"]\nend",
"def build_payload(issuer, push_notification_url, uuid)\n iat = Time.zone.now.to_i\n {\n iss: Rails.application.routes.url_helpers.root_url,\n iat: iat,\n exp: iat + 12.hours.to_i,\n jti: jti(iat),\n aud: push_notification_url,\n events: {\n EVENT_TYPE_URI => {\n subject: {\n subject_type: 'iss-sub',\n iss: issuer,\n sub: uuid,\n },\n },\n },\n }\n end",
"def event_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'event',\n 'Event' => 'click',\n 'EventKey' => 'ping', # will send a pong\n }\nend",
"def webhook_event_type_mapping\n {\n 'AUTHORISATION' => 'one_time_subscription_charged',\n # 'subscription.charged' => 'recurring_subscription_charged',\n # 'subscription.halted' => 'recurring_subscription_cancelled',\n # 'subscription.cancelled' => 'recurring_subscription_cancelled'\n }\n end",
"def scrobble( params )\n LastFM.requires_authentication\n # Tracks are passed to the service using array notation for each of the above params\n array_params = {}\n params.each do |hkey, hval|\n hval = hval.to_i if hval.is_a?(Time)\n Array(hval).each_with_index do |aval, index|\n array_params[\"#{hkey}[#{index}]\"] = aval\n end\n end\n LastFM.post( \"track.scrobble\", array_params )\n end",
"def data\n @payload['data']\n end",
"def show\n render json: @event_subscription\n end",
"def customer_mailchimp_profile_updated\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :human => \"#{data['email']} updated Mailchimp profile information.\"\n }\n end",
"def load_realtime_data\n proto = Net::HTTP.get(URI.parse(realtime_url))\n data = Transit_realtime::FeedMessage.decode(proto)\n\n schedule_data = []\n data.entity.each do |entity|\n if entity.field?(:trip_update)\n schedule_data << entity.trip_update.to_hash_value\n end\n end\n schedule_data\n end",
"def webhook_example_event(sample_name)\n data = webhook_example_events(sample_name).first\n if data['raw_params'] && (mandrill_events_data = data['raw_params']['mandrill_events'])\n data['raw_params']['mandrill_events'] = URI.decode_www_form_component(mandrill_events_data)\n end\n data\n end",
"def on_message_data_event(ctx); end",
"def metadata\n {\n :user_id => user.id.to_s,\n :user => user.to_s.truncate(500),\n (subscription.subscribable_type.downcase + '_id').to_sym => subscription.subscribable.id.to_s,\n subscription.subscribable_type.downcase.to_sym => subscription.subscribable.to_s\n }\n end",
"def on_message_data_event(ctx) end",
"def subscribe_to_channel; end",
"def get_event_results(subsessionID)\n res = $client.post('/membersite/member/GetSubsessionResults',\n \"subsessionID=#{subsessionID}\", $headers)\n JSON.parse res.body\nend",
"def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end",
"def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end",
"def list_subscribers(user, list)\n get(\"/#{user}/#{list}/subscribers.json\")\n end",
"def subscriber_activities(identifier)\n connection.get(\"subscribers/#{identifier}/activity\")\n end",
"def fGetSubscribedEventsFrom(email)\n @users.getSubscribedEventsFrom(email)\n end",
"def subscribe(email, user_info = {}, email_type = \"html\", update_existing = true, double_opt = false)\n begin\n @api.call(\"listSubscribe\", @api_key, @list_id, email, user_info, email_type, double_opt, update_existing, false)\n rescue\n false\n end\n end",
"def payload\n msg = {\n data: {\n alert: alert,\n badge: badge || \"Increment\",\n },\n }\n msg[:data][:sound] = sound if sound.present?\n msg[:data][:title] = title if title.present?\n msg[:data].merge! @data if @data.is_a?(Hash)\n\n if @expiration_time.present?\n msg[:expiration_time] = @expiration_time.respond_to?(:iso8601) ? @expiration_time.iso8601(3) : @expiration_time\n end\n if @push_time.present?\n msg[:push_time] = @push_time.respond_to?(:iso8601) ? @push_time.iso8601(3) : @push_time\n end\n\n if @expiration_interval.is_a?(Numeric)\n msg[:expiration_interval] = @expiration_interval.to_i\n end\n\n if query.where.present?\n q = @query.dup\n if @channels.is_a?(Array) && @channels.empty? == false\n q.where :channels.in => @channels\n end\n msg[:where] = q.compile_where unless q.where.empty?\n elsif @channels.is_a?(Array) && @channels.empty? == false\n msg[:channels] = @channels\n end\n msg\n end",
"def subid\n subscription_node[:subid]\n end",
"def send_message(message)\n message = JSON.parse(message)\n params = {email:message[\"email\"],project:message[\"project\"],event:message[\"event\"],count:message[\"count\"]}\n @connection.get '/activities', params\n end",
"def get_realtime_data(context_id:)\n {\n method: \"WebAudio.getRealtimeData\",\n params: { contextId: context_id }.compact\n }\n end",
"def payload; message[:payload]; end",
"def subscribe(event)\n has_subscriptions.create(subscribed_id: event.id)\n end",
"def receive_data(data)\n @buffer.extract(data).each do |line|\n payload = { :uuid => @uuid, \n :message => line,\n :host => @host,\n :user => @user }\n @global_history_fanout.publish(payload.to_json)\n end\n end",
"def testSubscribe1()\n topic = \"_Subscribe1_\"\n conn = Scalaris::PubSub.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.subscribe(@testTime.to_s + topic + i.to_s, $_TEST_DATA[i])\n end\n \n # check if the subscribers were successfully saved:\n (0..($_TEST_DATA.length - 1)).each do |i|\n topic1 = topic + i.to_s\n subscribers = conn.get_subscribers(@testTime.to_s + topic1)\n assert(subscribers.include?($_TEST_DATA[i]),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" does not exist for topic \\\"\" + topic1 + \"\\\"\")\n assert_equal(1, subscribers.length,\n \"Subscribers of topic (\" + topic1 + \") should only be [\" + $_TEST_DATA[i] + \"], but is: \" + subscribers.to_s)\n end\n \n conn.close_connection()\n end",
"def subscribe \n @subscription = MQ.new\n @subscription.queue(@uuid).bind(@subscription.fanout('global_history')).subscribe do |result|\n x = Mash.new(JSON::parse(result))\n puts \"received: #{x[:uuid]} #{x[:user]}@#{x[:host]}$ #{x[:message]}\"\n if x[:uuid] != @uuid\n @pause = true\n File.open(path, \"a\") {|f| f.puts(x[:message])}\n skip_ahead\n @pause = false\n schedule_next_read\n end\n end\n end",
"def subscription_created(user_id, discount_code:, products:, subscription_id:, subscription_mrr:, subscription_time_interval:, subscription_value:)\n track(user_id, SubscriptionCreated.new(\n discount_code: discount_code,\n products: products,\n subscription_id: subscription_id,\n subscription_mrr: subscription_mrr,\n subscription_time_interval: subscription_time_interval,\n subscription_value: subscription_value \n ))\n end",
"def index\n # TODO pull out api key before pushing to github & pull out binding prys\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n subId = message[:data][0][:id]\n else\n # Port is open in our router\n params = { url: SUBSCRIPTION_URL, events: ['invitee.created', 'invitee.canceled'] }\n newRes = HTTParty.post URL, body: params, headers: HEADERS\n message = JSON.parse newRes.body, symbolize_names: true\n # TODO need error handling\n subId = message[:id]\n end\n end\n end",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def subscribed()\n\t\t#add access token to header\n\t\theader = {\"Authorization\": \"Bearer #{@adal_response.access_token}\"}\n\t\t#poll to get available content\n\t\trequest_uri = \"https://manage.office.com/api/v1.0/#{@tenantid}/activity/feed/subscriptions/list\"\n response = Requests.request(\"GET\", request_uri, headers: header)\n @logger.info(\"[#{@content_type}] Subscription list: \\n#{response.json()}}\")\n\n\t\tresponse.json().each do |item|\n\t\t\tif item[\"contentType\"] == @content_type\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\tfalse\n\tend",
"def received_at\n params[:json]['message_time']\n end",
"def create\n @subscription = Subscription.create(params[:subscription])\n gb = Gibbon::API.new(\"6f8672a5c2393d1441c54d3be3fb79a1-us1\")\n gb.lists.subscribe({:id => \"c0ca5b3d41\", :email => {:email => params[:subscription][:email]}, :merge_vars => {:FNAME => '', :LNAME => ''}, :double_optin => false})\n end",
"def event_subscription(event)\n ActiveSupport::Notifications.subscribe(event[:id]) do |*, event_id, data|\n filtered_data = data.slice(*event[:allowed_data])\n filtered_data[:event_name] = event[:id]\n filtered_data[:event_id] = event_id\n\n if event[:id] == \"sql.active_record\"\n if data.key?(:binds)\n binds = data[:binds].each_with_object({}) { |bind, output| output[bind.name] = '?' if defined?(bind.name) }\n filtered_data[:binds] = JSON.dump(binds) unless binds.empty?\n end\n\n # Rails < 6.1 included connection_id in the event data, but now\n # includes the connection object instead\n if data.key?(:connection) && !data.key?(:connection_id)\n # the connection ID is the object_id of the connection object\n filtered_data[:connection_id] = data[:connection].object_id\n end\n end\n\n Bugsnag.leave_breadcrumb(\n event[:message],\n filtered_data,\n event[:type],\n :auto\n )\n end\n end",
"def subscribe(user, device_id, subscription)\n if @subscriptionLists.hasKey device_id\n device = @subscriptionLists.getRepositoryObject(device_id).getObject\n subscriptions = Hash.new\n subscriptions = @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject if @subscriptionLists.hasKey(\"subscriptions\")\n\n #puts \"\\n\\n_____________________Sub Queues_______________________\\n#{subscriptions}\\n\\nLooking for #{subscription}\\n__________________________________\"\n\n if subscriptions.key? subscription\n sub = subscriptions[subscription]\n #sub.addDevice(device_id)\n if(sub != nil && sub.hasDevice?(device_id)) # Device Already subscribed so let the user know\n return \"{\\\"subscribe\\\": \\\"Device already subscribed to #{subscription}\\\"}\"\n else #Lets subscribe the user(only implemented locally, not on the firebase server)\n device.addSubscription(sub)\n sub.addDevice(device)\n @subscriptionLists.commitObject(\"subscriptions\", subscriptions, false) #List of all subscription lists with device ids\n @subscriptionLists.commitObject(device_id, device, false) #We also keep a list of subscriptions with the particular device id... do we need this??\n\n return \"{\\\"subscribe\\\": \\\"Device subscribed to #{subscription}\\\"}\"\n end\n else\n return '{\"subscribe\": \"Subscription queue('+subscription+') does not exist.\"}'\n end\n else\n return '{\"subscribe\": \"Device not registered\"}'\n end\n end",
"def generate_subscription_payload(amount, category, desc, merch_trans_id, \n merch_prod_id, merch_sub_id, \n sub_recurrances, redirect_uri, opts={})\n sub_period_amount = (opts[:sub_period_amount] || 1) \n sub_period = (opts[:sub_period] || 'MONTHLY')\n is_purchase_on_no_active_sub = (opts[:iponas] || false)\n channel = (opts[:channel] || \"MOBILE_WEB\")\n\n payload = {\n :Amount => amount,\n :Category => category,\n :Description => desc,\n :MerchantTransactionId => merch_trans_id,\n :MerchantProductId => merch_prod_id,\n :MerchantSubscriptionIdList => merch_sub_id,\n :SubscriptionRecurrences => sub_recurrances,\n :MerchantPaymentRedirectUrl => redirect_uri,\n :SubscriptionPeriodAmount => sub_period_amount,\n :SubscriptionPeriod => sub_period,\n :IsPurchaseOnNoActiveSubscription => is_purchase_on_no_active_sub,\n :Channel => channel,\n }.to_json\nend",
"def add_subscriber(list_id, email, name)\n Result.new(Subscriber_Add(\"ListID\" => list_id, \"Email\" => email, \"Name\" => name))\n end",
"def testSubscribe2()\n topic = \"_Subscribe2\"\n conn = Scalaris::PubSub.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.subscribe(@testTime.to_s + topic, $_TEST_DATA[i])\n end\n \n # check if the subscribers were successfully saved:\n subscribers = conn.get_subscribers(@testTime.to_s + topic)\n (0..($_TEST_DATA.length - 1)).each do |i|\n assert(subscribers.include?($_TEST_DATA[i]),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" does not exist for topic \\\"\" + topic + \"\\\"\")\n end\n assert_equal(nil, self.class._getDiffElement(subscribers, $_TEST_DATA),\n \"unexpected subscriber of topic \\\"\" + topic + \"\\\"\")\n \n conn.close_connection()\n end",
"def on_stream_receive(item)\n parsed = JSON.parse(item)\n\n tw = Tweet.new({\n :tweet_id => parsed['id_str'],\n :text => parsed['text'],\n :twitter_id => parsed['user']['id'],\n :screen_name => parsed['user']['screen_name'],\n :profile_image_url => parsed['user']['profile_image_url'],\n :location => parsed['user']['location']\n })\n tw.save!\n\n # Delete old tweets\n oldest_tweet_saved = Tweet.order('created_at desc').limit(1).offset(50).first\n if oldest_tweet_saved\n Tweet.where(\"created_at < ?\", oldest_tweet_saved.created_at).each { |tw| tw.destroy }\n end\n\n ::PubSub.channel(\"ws_server\").publish tw.to_json\n end",
"def cfapi(events)\n messages = []\n\n # For each event\n events.each do |event|\n # Create an outbound event; this can be serialized to json and sent\n event_hash = {\n 'timestamp' => timestamp_in_milliseconds(event.get('@timestamp')),\n 'text' => (event.get('message') or ''),\n }\n\n # Map fields from the event to the desired form\n event_hash['fields'] = merge_hash(event.to_hash)\n .reject { |key,value| @adjusted_fields.has_key?(key) and @adjusted_fields[key] == nil } # drop banned fields\n .map {|k,v| [ @adjusted_fields.has_key?(k) ? @adjusted_fields[k] : k,v] } # rename fields\n .map {|k,v| { 'name' => (safefield(k)), 'content' => v } } # Convert a hashmap {k=>v, k2=>v2} to a list [{name=>k, content=>v}, {name=>k2, content=>v2}]\n\n messages.push(event_hash)\n end # events.each do\n\n { 'events' => messages } # Framing required by CFAPI.\n end",
"def event_memo_for(key)\n ::JSON.parse(@response.body.gsub(/.*(\\{.*\\}).*/, '\\1'))[key.to_s]\n end",
"def collect_unknown(event_name, event_data)\n puts \"unexpected event: #{event_name}\\nstoring event data in #{SQS_CFG['queues'][0]}-moo queue\"\n message = { \n message_body: event_data.to_json,\n message_attributes: {\n event_name: {\n string_value: event_name.to_s,\n data_type: \"String\",\n },\n event_time: {\n string_value: (event_data.dig('metadata', 'event_time') || event_data.dig('data', 0, 'eventTime')).to_s,\n data_type: \"String\",\n },\n }\n }\n Shoryuken::Client.queues(\"#{SQS_CFG['queues'][0]}-moo\").send_message(message)\n # LiveEvents.perform_async(event_data, queue: \"#{SQS_CFG['queues'][0]}-moo\")\nrescue => e\n pp ['moo queue failed, saving payload to file', e, event_name]\n # write event and payload to file\n open('log/payload-cache.js', 'a') do |f|\n f << \"\\n//#{event_name}\\n\"\n f << event_data.to_json\n end\nend",
"def IsSubscribed=(arg0)",
"def IsSubscribed=(arg0)",
"def devices_to_unsubscribe\n devices = []\n connection = self.create_connection(:feedback)\n connection.open\n while line = connection.read(38)\n feedback = line.unpack('N1n1H140')\n timestamp = Time.at(feedback[0])\n token = feedback[2].scan(/.{0,8}/).join(' ').strip\n if token && timestamp\n devices << {:token => token, :timestamp => timestamp}\n end\n end\n connection.close\n devices\n rescue OpenSSL::PKey::RSAError, Errno::ECONNRESET\n []\n end",
"def announce_list(listname,domain)\n doc = request(\"announcement_list-list_subscribers\",{ \"listname\" => listname, \"domain\" => domain})\n api_error?(doc)\n (doc/:data).inject([]) { |subs, sub| subs << Subscriber.new_from_xml(sub); subs }\n end",
"def email_cleaned\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :campaign_id => data['campaign_id'],\n :email => data['email'],\n :reason => data['reason'],\n :human => \"#{data['email']} was cleaned from Mailchimp list with ID #{data['list_id']}. Reason: '#{data['reason']}'\"\n }\n end",
"def set_payload(data)\n @payload = { \n 'caption' => data['caption']['text'], \n 'photo_url' => data['images']['standard_resolution']['url'],\n 'title' => \"#{data['user']['username']}_#{data['created_time']}\"\n }\n @log.debug(\"Payload is #{@payload}\")\n end",
"def subscribe\n mailchimp = Gibbon::API.new\n result = mailchimp.lists.subscribe({\n :id => ENV[\"MAILCHIMP_LIST_ID\"],\n :email => {:email => self.email},\n :merge_vars => {\n :FNAME => self.fname,\n :LNAME => self.lname,\n :COHORT_ID => self.cohort_id,\n :SCHOOL => self.school.name,\n :CITY => self.cohort.city.name,\n :SDATE => self.cohort.start_date,\n :EDATE => self.cohort.end_date,\n :ENV => Rails.env\n },\n :double_optin => false,\n :update_existing => true,\n :send_welcome => false\n })\n Rails.logger.info(\"Subscribed #{self.email} to MailChimp\") if result\n\n end",
"def event_list\n events_list\n end",
"def event(data)\n # Prepare the event object.\n id = @next_event_id\n @next_event_id += 1\n event = data.merge :id => id, :server_ts => Time.now.to_f\n @events << event\n\n # Broadcast the event to users.\n @users.each do |user|\n next unless user.session\n user.session.sync_events\n end\n end",
"def subscription_status\n @json_body['subscription_status']\n end",
"def on_message_data_start_event(ctx) end",
"def event_context\n {\n service: service,\n category: category,\n name: name,\n data: data,\n timestamp: Time.now.utc,\n uuid: SecureRandom.uuid\n }\n end",
"def state_events(state)\n api_return = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?stateCode=' + state + '&apikey=' + $ticket_master_api_key)\n JSON.parse(api_return)\nend",
"def create\n puts \"==========================\"\n puts \"CREATE\"\n JSON[params[\"updates\"].read].each do |notification|\n user = User.find(notification[\"subscriptionId\"])\n if user\n case notification[\"collectionType\"]\n when \"sleep\"\n user.fitbit.client.sleep_on_date(notification[\"date\"])[\"sleep\"].each do |data|\n sleep_event = { user_id: notification[\"subscriptionId\"], provider: params[:app_id], body: data }\n sleep_logger.info sleep_event\n end\n end\n end\n end\n render text: \"\", status: 204\n end",
"def subscription_term; end",
"def delivery_details; message[:delivery_details]; end",
"def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end",
"def webhook_payload\n {}\n end",
"def event_data\n {\n user_kyc_detail: @user_kyc_detail.get_hash,\n admin: @user_kyc_detail.get_last_acted_admin_hash\n }\n end",
"def subscribe!\n url = \"#{GRAPH_URL}/me/subscribed_apps?access_token=#{ENV['MESSENGER_BOT_ACCESS_TOKEN']}\"\n data = RestClient.post(url, nil)\n if data\n json = JSON.parse(data)\n json['success']\n else\n false\n end\n end"
] | [
"0.5999414",
"0.5978768",
"0.57443494",
"0.5717597",
"0.5698974",
"0.56845605",
"0.5588418",
"0.55851257",
"0.5563251",
"0.55236775",
"0.5500315",
"0.5499309",
"0.547075",
"0.54653543",
"0.54242164",
"0.5415669",
"0.5391406",
"0.53794944",
"0.5363186",
"0.53216493",
"0.5306188",
"0.5277868",
"0.5268719",
"0.5263627",
"0.52540666",
"0.5253646",
"0.5237567",
"0.52368754",
"0.52215266",
"0.52208173",
"0.5203639",
"0.51977694",
"0.51783144",
"0.51642054",
"0.51554257",
"0.51554006",
"0.5148636",
"0.5136632",
"0.512403",
"0.5116912",
"0.51003695",
"0.5081446",
"0.5076871",
"0.5073916",
"0.50659305",
"0.5065727",
"0.5051503",
"0.50494516",
"0.5045486",
"0.5045486",
"0.5043862",
"0.50351083",
"0.501754",
"0.49983123",
"0.4989708",
"0.4986334",
"0.4984135",
"0.4979193",
"0.49766463",
"0.49742728",
"0.49711606",
"0.49676555",
"0.4964116",
"0.49637616",
"0.49632144",
"0.49577507",
"0.49577507",
"0.49577507",
"0.49556327",
"0.49515685",
"0.4949344",
"0.49457705",
"0.4939634",
"0.49282402",
"0.4926535",
"0.49228263",
"0.49198917",
"0.4913648",
"0.4908673",
"0.4901725",
"0.49000764",
"0.49000764",
"0.48932818",
"0.4887887",
"0.48855698",
"0.4884838",
"0.4877523",
"0.48762253",
"0.48734766",
"0.48702922",
"0.4867602",
"0.48598215",
"0.4859393",
"0.4857843",
"0.4852136",
"0.48511153",
"0.48485786",
"0.48365757",
"0.48333004",
"0.48313496"
] | 0.64715093 | 0 |
"type": "unsubscribe", "fired_at": "20090326 21:40:57", "data[action]": "unsub", "data[reason]": "manual", "data[id]": "8a25ff1d98", "data[list_id]": "a6b5da1054", | def customer_mailchimp_unsubscribed
{
:list_id => data['list_id'],
:fired_at => params['fired_at'],
:mailchimp_id => data['id'],
:email => data['email'],
:email_type => data['email_type'],
:merges => data['merges'],
:ip_opt => params['ip_opt'],
:campaign_id => data['campaign_id'],
:human => "#{data['email']} unsubscribed from Mailchimp list with ID #{data['list_id']}"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def successful_unsubscribe\n end",
"def unsubscribed\n @attributes[:unsubscribed]\n end",
"def unsubscribe_from_list(user, list)\n delete(\"/#{user}/#{list}/subscribers.json\")\n end",
"def unsubscribe; end",
"def subid\n unsubscribe[:subid]\n end",
"def unsubscribe\n end",
"def unsubscribed\n end",
"def unsubscribed\n end",
"def unsubscribed\n\tend",
"def mcunsubscribe_list(list_id, email)\n # list_id = 'a38ec3df9c'\n # email = \"alex882204@gmail.com\"\n begin\n setup_mcapi.lists.unsubscribe(list_id, {'email' => email}, delete_member = false, send_goodbye = true, send_notify = true)\n # flash[:success] = \"#{email} subscribed successfully\"\n puts \"#{email} unsubscribed successfully\"\n rescue Mailchimp::ListAlreadySubscribedError\n # flash[:error] = \"#{email} is already subscribed to the list\"\n puts \"#{email} is already unsubscribed to the list\"\n rescue Mailchimp::ListDoesNotExistError\n # flash[:error] = \"The list could not be found\"\n puts \"The list could not be found\"\n # redirect_to \"/lists/\"\n return\n rescue Mailchimp::Error => ex\n if ex.message\n # flash[:error] = ex.message\n puts \"#{ex.message}\"\n else\n # flash[:error] = \"An unknown error occurred\"\n puts \"An unknown error occurred\"\n end\n end\n # redirect_to \"/lists/#{list_id}\"\n end",
"def unsubscribe(msg)\n false\n end",
"def unsubscribe(uuid)\n post_json(\"#{endpoint}/unsubscribe/#{uri_encode(uuid)}\")\n end",
"def unsubscribe(uuid)\n post_json(\"#{endpoint}/unsubscribe/#{uri_encode(uuid)}\")\n end",
"def unsubscribe\n email = Base64.decode64(params[:token])\n Subscription.where(email: email).destroy_all\n end",
"def unsubscribe()\n end",
"def unsubscribe\n mailchimp = Gibbon::API.new\n result = mailchimp.lists.unsubscribe({\n :id => ENV[\"MAILCHIMP_LIST_ID\"],\n :email => {:email => self.email},\n :delete_member => true, # this is NOT the default value\n :send_notify => true,\n :send_goodbye => true\n })\n Rails.logger.info(\"Unsubscribed #{self.email} from MailChimp\") if result\n end",
"def unsubscribe(name)\n id = @subs[name]\n\n self.send(msg: 'unsub', id: id)\n end",
"def unsubscribe()\n \n end",
"def unsubscribed; end",
"def unsubscribe(email)\n\t # Logic for mailchimp unsubscription.\n\t api.unsubscribe({\n\t \t:id => @campaignable_list_id,\n\t :email => {\n\t :email => email\n\t }, \n\t :send_goodbye => false, # Don't send a goodbye email.\n\t :send_notify => false # Don't notify the user of the unsubscription.\n\t })\n end",
"def unsubscribe_all\n send_action('unsubscribe_all')\n end",
"def unsubscribed\n # This will broadcast that user unsubscribed but the frontend will not receive the final broadcast\n p '**** ChatChannel unsubscribed'\n notification = {notification: 'User X has dropped off'}\n # ActionCable.server.broadcast(params[:room], notification)\n send_broadcast(params[:room], notification)\n end",
"def unsubscribe(email)\n\t # Logic for mailchimp unsubscription.\n\t api.lists(@campaignable_list_id).members(subscriber_hash(email)).update(body: { status: \"unsubscribed\" })\n rescue Gibbon::MailChimpError => e\n # Reraise any non 404 errors.\n raise unless e.status_code == 404\n # Log rails errors into the rails logger.\n Rails.logger.warn \"unsubscribe: User #{email} not found!\"\n end",
"def unsubscribe_from_all(id_or_email)\n make_json_api_request :post, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/unsubscribe_all\"\n end",
"def unsubscribed(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Recipients/Unsubscribed\", params: params)\n end",
"def unsubscribe_url\n nil\n end",
"def unsubscribe_from_channel; end",
"def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end",
"def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end",
"def on_unsubscribed(event, total)\n client.debug({context: :monitor, action: :punsubscribe, event: event, total: total}.to_json)\n end",
"def unsubscribed_reason\n @attributes[:unsubscribed_reason]\n end",
"def unsubscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'unsubscribe')\n connection.send_stanza pres, &blk\n end",
"def unsubscribe(message_hsh)\n # sender = message_hsh[:sender]\n # runr_data_set_get(sender)\n end",
"def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end",
"def unsubscribe\n respond_to do |format|\n if @contact.unsubscribe(params[:list_id])\n # format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n flash.now[:notice] = 'Unsubscribe successful.'\n format.html { render :show }\n format.json { render :show, status: :created, location: @contact }\n else\n @allow_change_to_email = true\n flash.now[:notice] = 'Unsubscribe successful.'\n redirect_to request.referer\n end\n end\n end",
"def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end",
"def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end",
"def list(options={})\n Mailgun.submit(:get, unsubscribe_url, options)[\"items\"]\n end",
"def unsubscribe\n @conn.send_data :opcode => UNSUBSCRIBE, :channel => @name\n end",
"def unsubscribe(id_or_email, options = {})\n url = \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/remove\"\n url += options[:campaign_id] ? \"?campaign_id=#{options[:campaign_id]}\" : \"\"\n make_json_api_request :post, url\n end",
"def newsletter_unsubscribe_alert(subscription, email)\n\t\t@list_name = User.human_attribute_name subscription\n\t\t@email = email\n\t\tsendgrid_category 'Newsletter Unsubscribe Alert'\n\t\tmail subject: \"User with email #{email} has unsubscribed from \\\"#{@list_name}\\\" newsletters\", to: ADMIN_EMAIL\n\tend",
"def unsubscribe(event)\n has_subscriptions.find_by(subscribed_id: event.id).destroy\n end",
"def unsubscribe!\n self.unsubscribed = true\n save\n end",
"def unsubscribe\n user = User.where(email: params[:md_email]).first\n user.unsubscribe!\n\n redirect_to root_path, notice: t(\"unsubscribed\")\n end",
"def handle_unsubscribe(client, data)\n topic = @engine.unsubscribe_client_from_topic(client, data[0])\n\n trigger(:unsubscribe, client, topic.uri)\n end",
"def unsubscribe_url(id:, email:)\n token =\n Base64.encode64(\"#{id}:#{email}\")\n\n \"#{connection.url_prefix}unsubscribe?token=#{token}\"\n end",
"def unsubscribe(id:, email:)\n request do\n response =\n connection.post(\"#{id}/unsubscribe\", 'email' => email)\n\n parse(response.body)\n end\n end",
"def unsubscribe(current_email, send_goodbye = false, send_notification = false)\n begin\n @api.call(\"listUnsubscribe\", @api_key, @list_id, current_email, true, send_goodbye, send_notification)\n rescue\n false\n end\n end",
"def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end",
"def unsubscribe_notifications\n authorize resource\n redirect_to user_path(current_user, anchor: 'unsubscribes')\n end",
"def unsubscribe(recipient_id)\n @api.delete(\"#{@api.path}/List/#{@id}/Unsubscribe/#{recipient_id}\")\n end",
"def remove_user_from_mailchimp\n unless self.email.include?('@example.com')\n mailchimp = Hominid::API.new(AppConstants.mailchimp_key)\n list_id = mailchimp.find_list_id_by_name AppConstants.mailchimp_list\n result = mailchimp.list_unsubscribe(list_id, self.email, true, false, true) \n Rails.logger.info(\"Mailchimp unsubscribed for email id #{self.email}\")\n end\n end",
"def unsubscribe(params)\n web_id = params[\"web_id\"]\n\n subscriber = nil\n enabled_models.each { |model| subscriber ||= model.constantize.find_by_mail_chimp_id(web_id) }\n\n subscriber.subscribed_to_list = false\n subscriber.save_without_update_list_member(:validate => false)\n end",
"def unsubscribe_from_lists(list_names, email)\n walk_recipients(list_names, email) do |lr, _l, _c|\n lr.update_attributes(is_unsubscribed: 'true', unsubscribed_at: nil) if lr && !lr.is_unsubscribed\n end\n rescue ::Mailjet::ApiError\n # ignore\n end",
"def unsubscribe(email)\n if email.present?\n FfcrmMailchimp.logger.info(\"#{Time.now.to_s(:db)} FfcrmMailchimp::OutboundSync: unsubscribing #{email} from all mailchimp lists.\")\n ffcrm_list_ids.each do |list_id|\n FfcrmMailchimp::Api.unsubscribe(list_id, email)\n end\n end\n end",
"def destroy\n event = Subscription.find(params[:id]).event\n current_user.unsubscribe(event)\n redirect_to event\n end",
"def unsubscribe(url, id = nil, opts = {}, &block)\n feed_id = \"#{id ? id : Base64.urlsafe_encode64(url)}\"\n if block\n @verifications[feed_id] ||= {}\n @verifications[feed_id]['unsubscribe'] = block\n end\n @response = http_post(SUPERFEEDR_ENDPOINT,\n opts.merge({\n :params => {\n :'hub.mode' => 'unsubscribe',\n :'hub.verify' => @params[:async] ? 'async' : 'sync',\n :'hub.topic' => url,\n :'hub.callback' => generate_callback(url, feed_id)\n },\n :userpwd => \"#{@params[:login]}:#{@params[:password]}\"\n }))\n @error = @response.to_s\n @params[:async] && @response.code == '202' || @response.code == '204' # We return true to indicate the status.\n end",
"def delete(\n start_date: nil, end_date: nil, email: nil)\n res = connection.post(\n '/api/unsubscribes.delete.json',\n default_params(\n start_date: start_date,\n end_date: end_date,\n email: email))\n craft_response(res)\n end",
"def unsubscribe\n @entry.subscribers.delete(current_user)\n end",
"def unsubscribe\n logger.info \"Loading MemberSubscriber unsubscribe action - remote\"\n @subscriber = @current_resource\n logger.debug \"Subscriber attributes hash: #{@subscriber.attributes.inspect}\" if @subscriber\n @merchant_store = MerchantStore.find(@subscriber.merchant_store.id)\n logger.debug \"Merchant-store attributes hash: #{@merchant_store.attributes.inspect}\" if @merchant_store\n if @subscriber.present? && @merchant_store.present?\n logger.debug \"Subscriber found in database. Starting unsubscribe process: #{@subscriber.attributes}\"\n if @subscriber.destroy\n logger.debug \"Unsubscribe completed successfully: #{@subscriber.attributes}\"\n #Send opt-out e-mail to member\n MemberMailer.delay.web_opt_out(@subscriber.member.id, @merchant_store.id)\n logger.debug \"Sending delayed unsubscribe email to member\"\n else\n logger.debug \"Error unsubscribing via Google Maps\" \n logger.fatal \"Error unsubscribing via Google Maps\" \n end\n end\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js \n end\n end",
"def unsubscribe\n user = Subscriber.find_by_unique_identifier(params[:id])\n user.update_attribute(:is_subscribed, false)\n user.save!\n render\n end",
"def bulk_unsubscribe(slug:, govuk_request_id: nil, body: nil, sender_message_id: nil)\n post_json(\n \"#{endpoint}/subscriber-lists/#{slug}/bulk-unsubscribe\",\n {\n body: body,\n sender_message_id: sender_message_id,\n }.compact,\n {\n \"Govuk-Request-Id\" => govuk_request_id,\n }.compact,\n )\n end",
"def do_unsubscribe(subid)\n unsubscribe(@nodename,subid)\n end",
"def testUnsubscribe2()\n topic = \"_UnubscribeString2\"\n conn = Scalaris::PubSub.new()\n \n # first subscribe all test \"urls\"...\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.subscribe(@testTime.to_s + topic, $_TEST_DATA[i])\n end\n \n # ... then unsubscribe every second url:\n (0..($_TEST_DATA.length - 1)).step(2) do |i|\n conn.unsubscribe(@testTime.to_s + topic, $_TEST_DATA[i])\n end\n \n # check whether the subscribers were successfully saved:\n subscribers = conn.get_subscribers(@testTime.to_s + topic)\n subscribers_expected = []\n (1..($_TEST_DATA.length - 1)).step(2) do |i|\n subscribers_expected << $_TEST_DATA[i]\n assert(subscribers.include?($_TEST_DATA[i]),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" does not exist for topic \\\"\" + topic + \"\\\"\")\n end\n \n # check whether the unsubscribed urls were unsubscribed:\n (0..($_TEST_DATA.length - 1)).step(2) do |i|\n assert(!(subscribers.include?($_TEST_DATA[i])),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" should have been unsubscribed from topic \\\"\" + topic + \"\\\"\")\n end\n \n assert_equal(nil, self.class._getDiffElement(subscribers, subscribers_expected),\n \"unexpected subscriber of topic \\\"\" + topic + \"\\\"\")\n \n conn.close_connection()\n end",
"def unsubscribed\n @chatroom = Chatroom.find(params[:id])\n @chatroom.unsubscribe()\n end",
"def devices_to_unsubscribe\n devices = []\n connection = self.create_connection(:feedback)\n connection.open\n while line = connection.read(38)\n feedback = line.unpack('N1n1H140')\n timestamp = Time.at(feedback[0])\n token = feedback[2].scan(/.{0,8}/).join(' ').strip\n if token && timestamp\n devices << {:token => token, :timestamp => timestamp}\n end\n end\n connection.close\n devices\n rescue OpenSSL::PKey::RSAError, Errno::ECONNRESET\n []\n end",
"def subid=(subid)\n unsubscribe[:subid] = subid\n end",
"def unsubscribe2\n if Spree::Chimpy::Subscriber.where(email:self.email).first\n self.unsubscribe\n end\n end",
"def unsubscribes(date, page=1, page_size=1000, order_field=\"date\", order_direction=\"asc\")\n options = { :query => { \n :date => date,\n :page => page,\n :pagesize => page_size,\n :orderfield => order_field,\n :orderdirection => order_direction } }\n response = get \"unsubscribes\", options\n Hashie::Mash.new(response)\n end",
"def unsubscribed\n location_id = params[:location_id].to_i\n @@locations_with_subscribers.delete(location_id)\n end",
"def unsubscribe_from_notifications(client, collection)\n mirror = client.discovered_api('mirror', 'v1')\n result = client.execute(\n :api_method => mirror.subscriptions.delete,\n :parameters => { 'id' => collection })\n if result.error?\n puts \"An error occurred: #{result.data['error']['message']}\"\n end\n end",
"def unsubscribed?\n self.type == :unsubscribed\n end",
"def get options = {}\n unsubscribe_url = \"suppression/unsubscribes\"\n query_api(unsubscribe_url, process_header_options(options))\n end",
"def batch_unsubscribe(emails=[])\n # Do this using a batch call to the MailChimp API for performance rather than lots of single API calls.\n api.batch_unsubscribe({\n \t:id => @campaignable_list_id,\n :batch => emails.map {|email| {:email => { :email => email }} }, # Map all users in the system into a mailchimp collcation.\n :send_goodbye => false, # Don't send a goodbye email.\n :send_notify => false # Don't notify the user of the unsubscription. \n })\n end",
"def unsubscribe_from_newsletter\n email = current_user ? current_user.email : ''\n @newsletter = Newsletter.find_newsletter(params['token'])\n\n if @newsletter\n result = @newsletter.unsubscribe(email)\n respond_to do |format|\n if result\n msg = I18n.t('nms.unsubscribe_successuful')\n format.html { redirect_back fallback_location: main_app.index_url, notice: msg }\n format.json { render json: { success: true, msg: msg } }\n else\n msg = I18n.t('nms.Email_NotExists')\n format.html { redirect_back fallback_location: main_app.index_url, alert: msg }\n format.json { render json: { success: false, msg: msg } }\n end\n end\n end\n end",
"def punsubscribe(*channels); end",
"def unsubscribe(list_id, subscribers = [])\n attrs = {\n listId: list_id,\n subscribers: subscribers\n }\n Iterable.request(conf, '/lists/unsubscribe').post(attrs)\n end",
"def unsubscribe(device_id, subscription)\n #puts \"\\n\\n------------------------------\\nUnsubscribe from: #{subscription}\\n--------------------------------------\"\n if @subscriptionLists.hasKey device_id\n device = @subscriptionLists.getRepositoryObject(device_id).getObject\n device.removeSubscription(subscription)\n @subscriptionLists.commitObject(device_id, device, false)\n end\n if @subscriptionLists.hasKey(\"subscriptions\")\n subscriptions = @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n if(subscriptions.key? subscription)\n subs = subscriptions[subscription]\n subs.removeDevice(device_id)\n @subscriptionLists.commitObject(\"subscriptions\", subscriptions, false)\n return \"{\\\"unsubscribe\\\": \\\"Device unsubscribed from #{subscription}\\\"}\"\n end\n else\n return '{\"unsubscribe\": \"No subscriptions available\"}'\n end\n end",
"def unsubscribe! (user_id)\n check_auth :unsubscribe\n \n response = connection.post do |req|\n req.url \"/user/unsubscribe/#{user_id}\"\n req.body = { :format => @format }\n end\n response\n end",
"def unsubscribe_params\n params.require(:unsubscribe).permit(:from_type, :from_id)\n end",
"def unsubscribe?\n self.type == :unsubscribe\n end",
"def unsubscribe\n \n @conversation.subscriptions.delete(@user) if @conversation.subscriptions.exists?(@user.id)\n @notice = \"You will now no longer receive email notifications about new replies in this conversation.\"\n \n respond_to do |format|\n format.html {\n redirect_to(@conversation, notice: @notice) and return\n return \n }\n format.js\n end\n \n end",
"def unsubscribe!(reason = nil)\n update!(unsubscribed_at: ::Caffeinate.config.time_now, unsubscribe_reason: reason)\n\n caffeinate_campaign.to_dripper.run_callbacks(:on_unsubscribe, self)\n end",
"def all\n get(\"#{domain}/unsubscribes\")\n end",
"def unsubscribe_to_email\n @subscription.unsubscribe_to_email\n return_back_or_ajax\n end",
"def customer_mailchimp_subscribed\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :ip_signup => params['ip_signup'],\n :human => \"#{data['email']} subscribed to Mailchimp list with ID #{data['list_id']}\"\n }\n end",
"def newsletter_unsubscribe_key(newsletter)\n h = name.hash\n h = -h if h < 0\n return \"#{id*47}:#{'%x' % h}\"\n end",
"def unsubscribeCollection\n if !session[:user_id]\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n end\n\n roomname = params[:unsubscribecollection][\"roomname\"]\n collectionnodename = params[:unsubscribecollection][\"collectionnodename\"]\n\n begin\n am = session[:am]\n acc = Account.find_by_username(session[:user_id])\n if(acc.nil?)\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n return\n end\n am.keepalive(acc.username, acc.password)\n\n result = am.unsubscribeCollection(roomname, collectionnodename)\n flash[:result] = \"subscribeCollection result success: \" + result\n redirect_to :action => 'accountManager'\n rescue Exception => msg\n flash[:notice] = msg\n end\n\n end",
"def unsubscribe\n @subscriber = MailchimpSubscriber.new params[:mailchimp_subscriber]\n\n if @subscriber.valid?\n GoGoGibbon::Commands.unsubscribe @subscriber, GoGoGibbon::Config.subscribed\n end\n\n respond_to do |format|\n format.html { redirect_to(mailchimp_subscribers_url, :notice => 'User was successfully unsubscribed.') }\n end\n end",
"def batch_unsubscribe(email)\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end",
"def unsubscribed\n puts \"#{current_user.displayname} left!\"\n end",
"def unsubscribe(message, local = false, &callback)\n response = make_response(message)\n client_id = message['clientId']\n subscription = [message['subscription']].flatten\n\n @engine.client_exists(client_id) do |exists|\n response['error'] = Error.client_unknown(client_id) unless exists\n response['error'] = Error.parameter_missing('clientId') if client_id.nil?\n response['error'] = Error.parameter_missing('subscription') if message['subscription'].nil?\n\n response['subscription'] = message['subscription'] || []\n\n subscription.each do |channel|\n next if response['error']\n response['error'] = Error.channel_forbidden(channel) unless local or Channel.subscribable?(channel)\n response['error'] = Error.channel_invalid(channel) unless Channel.valid?(channel)\n\n next if response['error']\n @engine.unsubscribe(client_id, channel)\n end\n\n response['successful'] = response['error'].nil?\n callback.call(response)\n end\n end",
"def unsubscribe\n debug [self.name, \"terminated\"]\n unsubscribe_request\n end",
"def delete_subscriptions\n end",
"def unsubscrible\n NewsletterMailer.unsubscrible\n end",
"def unsubscribed # :doc:\n # Override in subclasses\n end",
"def testUnsubscribe1()\n topic = \"_UnsubscribeString1_\"\n conn = Scalaris::PubSub.new()\n \n # first subscribe test \"urls\"...\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.subscribe(@testTime.to_s + topic + i.to_s, $_TEST_DATA[i])\n end\n \n # ... then unsubscribe every second url:\n (0..($_TEST_DATA.length - 1)).step(2) do |i|\n conn.unsubscribe(@testTime.to_s + topic + i.to_s, $_TEST_DATA[i])\n end\n \n # check whether the subscribers were successfully saved:\n (1..($_TEST_DATA.length - 1)).step(2) do |i|\n topic1 = topic + i.to_s\n subscribers = conn.get_subscribers(@testTime.to_s + topic1)\n assert(subscribers.include?($_TEST_DATA[i]),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" does not exist for topic \\\"\" + topic1 + \"\\\"\")\n assert_equal(1, subscribers.length,\n \"Subscribers of topic (\" + topic1 + \") should only be [\\\"\" + $_TEST_DATA[i] + \"\\\"], but is: \" + subscribers.to_s)\n end\n \n # check whether the unsubscribed urls were unsubscribed:\n (0..($_TEST_DATA.length - 1)).step(2) do |i|\n topic1 = topic + i.to_s\n subscribers = conn.get_subscribers(@testTime.to_s + topic1)\n assert(!(subscribers.include?($_TEST_DATA[i])),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" should have been unsubscribed from topic \\\"\" + topic1 + \"\\\"\")\n assert_equal(0, subscribers.length,\n \"Subscribers of topic (\" + topic1 + \") should only be [], but is: \" + subscribers.to_s)\n end\n \n conn.close_connection()\n end",
"def unsubscribe(mailbox)\n tagged_response(\"UNSUBSCRIBE\", to_utf7(mailbox))\n end",
"def unsubscribe(subscriber)\n @subscriber = subscriber\n mail to: subscriber.email, subject: \"Unsubscribed from ML@B\"\n end",
"def unsubscribe(options = {})\n unsubscribed_at = options[:unsubscribed_at] || Time.current\n new_attributes = { subscribing: false, unsubscribed_at: unsubscribed_at,\n subscribing_to_email: false, unsubscribed_to_email_at: unsubscribed_at,\n optional_targets: optional_targets }\n optional_target_names.each do |optional_target_name|\n new_attributes[:optional_targets] = new_attributes[:optional_targets].merge(\n Subscription.to_optional_target_key(optional_target_name) => false,\n Subscription.to_optional_target_unsubscribed_at_key(optional_target_name) => Subscription.convert_time_as_hash(subscribed_at))\n end\n update(new_attributes)\n end"
] | [
"0.7093893",
"0.67585737",
"0.6753457",
"0.654267",
"0.6537029",
"0.64951944",
"0.64703214",
"0.64703214",
"0.6458982",
"0.64323497",
"0.64226466",
"0.63964117",
"0.63964117",
"0.63933295",
"0.6350215",
"0.6344921",
"0.6344216",
"0.6323642",
"0.62809145",
"0.6274924",
"0.6273437",
"0.62623674",
"0.6243912",
"0.62390506",
"0.6229842",
"0.622221",
"0.6220065",
"0.6211177",
"0.6211177",
"0.6149243",
"0.6129664",
"0.6115056",
"0.6114774",
"0.6082049",
"0.6073901",
"0.6042176",
"0.6042176",
"0.60231024",
"0.60190094",
"0.60056376",
"0.60017383",
"0.5992125",
"0.5982206",
"0.59724694",
"0.59666324",
"0.5961359",
"0.5938244",
"0.59150463",
"0.59109706",
"0.5886511",
"0.588078",
"0.587869",
"0.58732796",
"0.5871488",
"0.5869497",
"0.58575374",
"0.5856671",
"0.58557963",
"0.5846123",
"0.5839933",
"0.5839805",
"0.5836403",
"0.5832019",
"0.58248824",
"0.5818133",
"0.58124435",
"0.5807641",
"0.57931834",
"0.5790615",
"0.5769404",
"0.57666904",
"0.5746214",
"0.5731996",
"0.57114834",
"0.5709622",
"0.5695375",
"0.56884694",
"0.5676805",
"0.56763273",
"0.5669726",
"0.56631684",
"0.5652479",
"0.5651571",
"0.56402403",
"0.5636076",
"0.5633934",
"0.56235766",
"0.56228614",
"0.561559",
"0.56147504",
"0.5611493",
"0.5610643",
"0.56092155",
"0.55963844",
"0.5588535",
"0.55870205",
"0.55744827",
"0.5571727",
"0.5571451",
"0.55673164"
] | 0.7201231 | 0 |
"type": "profile", "fired_at": "20090326 21:31:21", "data[id]": "8a25ff1d98", "data[list_id]": "a6b5da1054", | def customer_mailchimp_profile_updated
{
:list_id => data['list_id'],
:fired_at => params['fired_at'],
:mailchimp_id => data['id'],
:email => data['email'],
:email_type => data['email_type'],
:merges => data['merges'],
:ip_opt => params['ip_opt'],
:human => "#{data['email']} updated Mailchimp profile information."
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trackgen_info;\treturn @json_data['trackgen_info'];\tend",
"def profile_data(uid, field)\n begin\n JSON.parse(RestClient.get construct_url(\"user/#{uid}/#{field}\"))\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end \n end",
"def get_member_brief_stats(custid)\n res = $client.get(\"/membersite/member/CareerStats.do?custid=#{custid}\", $headers)\n start = res.body.index('buf = \\'{\"memberSince\"') + 7\n length = res.body.index(\"MemberProfile.driver = extractJSON\") - 3 - start\n data = res.body[start, length]\n JSON.parse data\nend",
"def profile_data(access_token)\n response = uphold_conn.get do |req|\n req.url UPHOLD_PROFILE_PATH\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers[:Authorization] = \"Bearer #{access_token}\"\n end\n JSON.parse(response.body, symbolize_names: true)\n end",
"def parse_profile_data_json(profile_string)\n profile_hash_org = MultiJson.decode(profile_string)['profile-list']['researcher-profile']\n profile_hash = {\n :firstname => profile_hash_org['first-name'],\n :lastname => profile_hash_org['last-name'],\n }\n puts \"Final hash with profile data from JSON\"\n pp profile_hash\n return profile_hash\n end",
"def get_user_timeline_as_hash( id=nil, login=@login, password=@password )\n json_data = get_user_timeline( login, password, id, 'json', count )\n hash_data = JSON.parse( json_data )\n timeline = Array.new\n i = 0\n\n #debugger\n hash_data.each do |data|\n timeline[i] = Hash.new\n timeline[i][:name] = data['user']['name']\n timeline[i][:icon_url] = data['user']['profile_image_url']\n timeline[i][:text] = data['text']\n i += 1\n end\n timeline\n end",
"def identifier\n @json['profile']['identifier'] rescue nil\n end",
"def meta_data\n u_ids = object.message_status.user_ids\n {\n read_by_count: u_ids.count,\n read_by: User.select(:id,:name,:last_name).where(\"users.id IN (?)\",u_ids).map {|u| {id: u.id,name: full_name(u.name,u.last_name)}},\n is_read: object.read\n }\n end",
"def facebook_data_about(item, keys = {})\n begin\n res = JSON.parse(token_get(item) || \"{}\") \n keys[:as] ? res[keys[:as]] : res\n rescue SocketError, Errno::ECONNRESET, OAuth2::HTTPError, EOFError => e\n # TODO :: hoptoad\n nil\n end\n end",
"def history_data\n @id = params[:id]\n @item_history = []\n @item_name = @item_names[@id.to_i]\n json_str = Net::HTTP.get(URI.parse(\"http://#{THINGSPEAK_SERVER}/channels/#{OT_CHANNEL}/feed.json?results=200\")) \n parsed_hash = ActiveSupport::JSON.decode(json_str)\n parsed_hash[\"feeds\"].each do |e|\n if e[\"field1\"] == @id\n item = {}\n t = Time.strptime(e[\"created_at\"], \"%FT%T%z\")\n item[\"time\"] = t.strftime(\"%b %d, %Y %H:%M:%S\")\n item[\"curr_loc\"] = e[\"field4\"]\n @item_history.push(item)\n end\n end\n\n render :template => \"static/history_data\", :formats => [:json], :handlers => \"haml\", :layout => false\n end",
"def facebook_uid\n @json['uid']\n end",
"def list_arrays_assigned_to_profile(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/arrays\", args)\nend",
"def profile\n render_json 0,\"ok\",current_member.as_profile\n end",
"def customerio_payload\n {\n alert: { id: 12345 },\n metric: { name: \"sample_alert\", type: \"gauge\" },\n measurements: [{\n value: 3.14,\n source: \"foo:bar.uid:123\"\n }, {\n value: 1.23,\n source: \"foo:bar.uid:234\"\n }],\n trigger_time: Time.now.to_i\n }.with_indifferent_access\n end",
"def load_profile(token)\n profile = GoogleService.user_info(token)\n email_field = profile[\"emails\"].select do |email| \n email[\"type\"] == \"account\"\n end\n\n email = email_field[0][\"value\"] if email_field && email_field.size > 0\n\n {:displayName => profile[\"displayName\"],\n :image => profile[\"image\"][\"url\"],\n :url => profile[\"url\"],\n :email => email} \n end",
"def inbound_payload\n JSON.parse(data)['inbound']['payload']\n end",
"def get_data(event, data={})\n self['event'] = event\n self['properties'] = data \n self['properties']['token'] = @key\n self['properties']['time'] = Time.now.to_i\n \n Base64.encode64(JSON.generate(self))\n end",
"def profile\n @profile ||= begin\n profile_xml = repository.datastream(:pid => pid, :dsid => dsid)\n profile_xml.gsub! '<datastreamProfile', '<datastreamProfile xmlns=\"http://www.fedora.info/definitions/1/0/management/\"' unless profile_xml =~ /xmlns=/\n doc = Nokogiri::XML(profile_xml)\n h = doc.xpath('/management:datastreamProfile/*', {'management' => \"http://www.fedora.info/definitions/1/0/management/\"} ).inject({}) do |sum, node|\n sum[node.name] ||= []\n sum[node.name] << node.text\n sum\n end\n h.select { |key, value| value.length == 1 }.each do |key, value|\n h[key] = value.first\n end\n\n h\n rescue\n {}\n end\n end",
"def payload(id, username)\n {\n exp: (Time.now + 30.minutes).to_i,\n iat: Time.now.to_i,\n iss: ENV['JWT_ISSUER'],\n user: {\n id: id,\n username: username\n }\n }\n end",
"def payload(id, username)\n {\n exp: (Time.now + 30.minutes).to_i,\n iat: Time.now.to_i,\n iss: ENV['JWT_ISSUER'],\n user: {\n id: id,\n username: username\n }\n }\n end",
"def user_activity\n device_id = request.headers['device_id']\n string = request.body.read\n activity = ActiveSupport::JSON.decode(string)\n a_ids = []\n if !activity.empty?\n begin\n activity.each do |a|\n if a['user_id'].nil?\n a['device_id'] = device_id\n end\n id = a['event_id']\n a.delete('event_id')\n logger.info\"=====#{a}\"\n UserActivity.create(a)\n a_ids << id\n end\n rescue Exception => e\n logger.info \"===Exception in creating usage #{e}\"\n # @error = \"#{e.message} for #{e.try(:record).try(:class).try(:name)}\"\n end\n respond_to do |format|\n format.json { render json: a_ids }\n end\n end\n\nend",
"def user_activity_live_data\n [\n {\n key: 'active_in_last_hour',\n name: t('statistics.entries.users.currently_active'),\n data: ExternalUser.joins(:submissions)\n .where(['submissions.created_at >= ?', DateTime.now - 5.minutes])\n .distinct('external_users.id').count,\n },\n {\n key: 'submissions_per_minute',\n name: t('statistics.entries.exercises.submissions_per_minute'),\n data: (Submission.where('created_at >= ?', DateTime.now - 1.hour).count.to_f / 60).round(2),\n unit: '/min',\n axis: 'right',\n },\n ]\n end",
"def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end",
"def payload(temp)\n num = temp.values[0]\n {\n :url => \"http://jumpstartlab.com/blog#{num}\",\n :requestedAt => \"#{Time.new}\",\n :respondedIn => 37,\n :referredBy => \"http://jumpstartlab.com\",\n :requestType => \"GET\",\n :eventName => \"socialLogin\",\n :userAgent => \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2)\"\\\n \"AppleWebKit/537.17 (KHTML, like Gecko)\"\\\n \"Chrome/24.0.1309.0 Safari/537.17\",\n :resolutionWidth => \"1920\",\n :resolutionHeight => \"1280\",\n :ip => \"63.29.38.211\"\n }\nend",
"def raw_info\n yql = \"select * from social.profile where guid='#{uid}'\"\n request = \"https://query.yahooapis.com/v1/yql?q=#{encode_uri_component(yql)}&format=json\"\n @raw_info ||= MultiJson.decode(access_token.get(request).body)\n rescue ::Errno::ETIMEDOUT\n raise ::Timeout::Error\n end",
"def get_time_profiles(obj = nil)\n session[:time_profiles] = {}\n region_id = obj ? obj.region_id : MiqRegion.my_region_number\n time_profiles = TimeProfile.profiles_for_user(session[:userid], region_id)\n time_profiles.collect { |tp| session[:time_profiles][tp.id] = tp.description }\n end",
"def get_profile\n \n profil =\n Excon.get(\n 'https://eastus.api.cognitive.microsoft.com/speaker/identification/v2.0/text-independent/profiles',\n headers: {\n 'Content-Type' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\"\n },\n body: JSON.generate(\"locale\": 'en-us')\n )\n return profil.body\n parsed = JSON.parse(profil.body)\n return parsed['profiles']\n rescue Excon::Error => e\n puts \"Error: #{e}\"\n\n end",
"def data\n attributes['data']\n end",
"def profile(token, secret)\n self.access_token = self.get_access_token(token, secret)\n req = self.access_token.request(:get, PAL_EPNTS['profile_url']+PAL_EPNTS['profile_fields'],{'x-li-format' => 'json','Content-Type'=>'application/json'})\n req.body\n end",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def dissect_to_record_hashes\n end",
"def data\n @gesturedata = Gesture.select('data').where(\"id =?\" , params[:id])\n render json: @gesturedata[0][:data]\n end",
"def load_realtime_data\n proto = Net::HTTP.get(URI.parse(realtime_url))\n data = Transit_realtime::FeedMessage.decode(proto)\n\n schedule_data = []\n data.entity.each do |entity|\n if entity.field?(:trip_update)\n schedule_data << entity.trip_update.to_hash_value\n end\n end\n schedule_data\n end",
"def social\n @data['social']\n end",
"def recent\n @calls = Call.where(\"audio_id IS NOT NULL\").order(\"start ASC\").limit(50).map do |call|\n { :id => call.id,\n :start => call.start,\n :end => call.end,\n :frequency => call.frequency,\n :group_full_name => call.group.full_name,\n :group_name => call.group.name }\n end\n \n respond_to do |format|\n format.html { render \"index\" }\n format.json { render json: @calls }\n end\n end",
"def json_value\n result = []\n parts.each do |item|\n (start, ending) = item.split('/', 2)\n\n start = Tilia::VObject::DateTimeParser.parse_date_time(start)\n\n # This is a duration value.\n if ending[0] == 'P'\n result << [\n start.strftime('%Y-%m-%dT%H:%M:%S'),\n ending\n ]\n else\n ending = Tilia::VObject::DateTimeParser.parse_date_time(ending)\n result << [\n start.strftime('%Y-%m-%dT%H:%M:%S'),\n ending.strftime('%Y-%m-%dT%H:%M:%S')\n ]\n end\n end\n\n result\n end",
"def cookie_value\n @screen_data.to_json\n end",
"def element_to_result(e)\n result = Hash.new\n result['date'] = e.updated_at.strftime(\"%d-%m-%Y %H:%M\")\n result['user'] = e.user.email\n result['interaction'] = e.interaction.resource_type\n result\n end",
"def ga_datum_params\n params.require(:ga_datum).permit(:ga_label_id, :profile, :json)\n end",
"def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end",
"def attributes\n \tdata = super # get the current JSON object\n \trecipient = object\n\n data[:is_visible] = 1 # visible by default\n\n relationship_id = data[:relationship_id]\n relationship = Relationship.find_by(id: relationship_id)\n data[:relationship] = relationship\n\n primary_address = recipient.addresses.first\n data[:primary_address] = primary_address\n\n addresses = recipient.addresses\n data[:addresses] = addresses\n\n occasions = Array.new\n\n recipient_occasions = recipient.recipient_occasions.live\n recipient_occasions.each do |recipient_occasion|\n\n occasion_data = Hash.new\n occasion_data[:recipient_occasion] = recipient_occasion\n occasion = recipient_occasion.occasion\n occasion_data[:occasion] = occasion\n occasions << occasion_data\n\n end\n\n data[:occasions] = occasions\n\n # profile picture if it exists\n profile_picture = recipient.profile_pictures.first\n if profile_picture && profile_picture.picture?\n data[:profile_picture] = profile_picture.picture.url\n end\n\n data\n\n end",
"def build_body(metric, timestamp, value)\n {\n \"metric\" => metric,\n \"timestamp\" => timestamp,\n \"value\" => value,\n \"tags\" => { \"status\" => \"test\" }\n }.to_json\nend",
"def grab_info(name)\n\n\n\n\n result = HTTParty.get(\"https://graph.facebook.com/#{name}\")\n\n user_fb = JSON.parse(result)\n\n# id = result[\"id\"]\n# name = result[\"name\"]\n# gender = result[\"gender\"]\n# locale = result[\"locale\"]\n# un = result[\"username\"]\n\nend",
"def invite\n @data['invite']\n end",
"def data\n @payload['data']\n end",
"def profile\n @property[:profile]\n end",
"def extract_event_detail( sql_response )\n details = sql_response.split(';')\n standard_points = details[0].to_f\n time_swam_detail = details[1].split(':')\n time_swam = Timing.new( time_swam_detail[2], time_swam_detail[1], time_swam_detail[0] )\n meeting_id = details[2].to_i\n scheduled_date = Date.parse( details[3] )\n { :standard_points => standard_points, :time_swam => time_swam, :meeting_id => meeting_id, :scheduled_date => scheduled_date }\n end",
"def GetProfileData()\n uri = URI(API_URL + 'me')\n\n return PerformRestrictedGet(uri)\n end",
"def pluck_sir_trevor_type(json, type) \n hash = JSON.parse(json)\n if hash.has_key?(\"data\")\n item = hash[\"data\"].select { |item| item[\"type\"] == type }\n item.first\n end\n end",
"def victims_responded_line_items\n # campaign.victims.each {|victim| @victims = victim.opened? ? victim : nil}\n\n [[\"UID\", \"Email\", \"Sent\", \"Clicked\", \"Opened\", \"Password\", \"Time\"]] +\n @victims_responded.map do |victim|\n [victim.uid, \n victim.email_address, \n victim.sent.to_s, \n victim.clicked?.to_s, \n victim.opened?.to_s, \n victim.password?.to_s, \n victim.updated_at.to_s ]\n end\n end",
"def parse_profile(html)\n profile = {}\n profile[\"username\"] = html.at_css('.vcard-username').text # Must have username, will raise error is not found\n profile[\"fullname\"] = (node = html.at_css('.vcard-fullname')).nil? ? \"\" : node.text\n profile[\"location\"] = (node = html.at_xpath(\"//*[@class='vcard-details']/li[2]\")).nil? ? \"\" : node.text\n profile[\"email\"] = (node = html.at_xpath(\"//*[@class='vcard-details']/li[3]\")).nil? ? \"\" : node.text\n profile[\"link\"] = (node = html.at_xpath(\"//*[@class='vcard-details']/li[4]\")).nil? ? \"\" : node.text\n profile[\"join_date\"] = (node = html.xpath(\"//*[@class='join-date']/@datetime\").first).nil? ? \"\" : node.value\n profile\n end",
"def hash\n [campaign, number, customer, scheduled_start, child, description, category_type, overview, priority, date_event, product_event, phone, event_name, event_number, time_difference, type_event, primary_phone_call_id, parent_phone_call_id, product_name, product_name_g, scheduled_start_parent, description_parent, act_status_name_parent, organisation_name, organisation_id, action_status, actual_start, actual_end, owner, partner, time_shift, regarding_object_id, phone_call_subject, summary_table_event_id, lead_id, lead_name, contact_id, contact_full_name, account_id, account_name, parent_account_id, parent_account_name, customer_created_on, contact_taxid_number, contact_pin, account_registration_code, account_taxid_number, account_pin, lead_pin, parent_account_registration_code, parent_account_taxid_number, parent_account_pin, address_name, actionnr, campaign_rank, setting_id, ignor_nedozvon, primary_activity_id, activity_serial_number, contact_person_id, contact_person_id_name, phone_call_type, party_id, color, time, created_by, created_on, modified_by, modified_on, id, name, state_code, status_code].hash\n end",
"def event_memo_for(key)\n ::JSON.parse(@response.body.gsub(/.*(\\{.*\\}).*/, '\\1'))[key.to_s]\n end",
"def format_entity(data)\n { \n uid: data['FixtureId'],\n name: name(data),\n tournament_name: tournament_name(data),\n country_name: country_name(data),\n team_names: team_names(data)\n }\n end",
"def name\n @json['profile']['name']['formatted'] rescue nil\n end",
"def event_data\n {\n user_kyc_detail: @user_kyc_detail.get_hash,\n admin: @user_kyc_detail.get_last_acted_admin_hash\n }\n end",
"def build_profile_hash(co, id=nil)\r\n\tprofile = Hash.new\r\n\tif (id != nil) then profile['id'] = id\r\n\telse profile['status'] = 1 end\r\n\r\n\tprofile['name'] = co['name']\r\n profile['profile_type_id'] = VENDOR_ID\r\n\tprofile['attributes'] = {\r\n\t\t'vendor_name' => co['name'],\r\n 'bitsight_inherited_security_rating' => scale_unit(co['rating'],250,900,10,0,true).round(1).to_s,\r\n 'bitsight_rating' => co['rating'].to_s,\r\n 'bitsight_rating_date' => Date.parse(co['rating_date']).strftime('%m/%d/%Y'),\r\n 'bitsight_guid' => co['guid'],\r\n 'bitsight_full_vendor_risk_assessment_complete' => 'No'\r\n\t\t}\r\n\tprofile\r\nend",
"def bio\n @data['bio']\n end",
"def fire_from_code\n if params['code'].nil?\n json_response({ \"status\": 'error', \"error\": 'invalid code' }, 400)\n return\n end\n fire = Fire.find_by(firecode: params['code'])\n if fire.nil?\n json_response({ \"status\": 'error', \"error\": 'invalid code' }, 400)\n return\n end\n user = User.find_by(userid: fire.userid)\n\n json_response({\n \"image\": fire.image,\n \"who\": fire.reporter,\n \"phone\": fire.phone,\n \"x\": fire.x,\n \"y\": fire.y,\n \"reported\": fire.reported\n }, 200)\n end",
"def json\n fields = dataset.dataset_fields\n e_doc = Hpricot(open(url))\n data = {\"id\"=> id, \"url\"=> url }\n fields.each do |field|\n p field\n data[field.name] = (e_doc/field.css).text.strip\n end\n puts data.inspect \n \n data.to_json \n end",
"def is_profile_list? \n request.env['RAW_POST_DATA'] =~ %r[<QueryProfileList>] \n end",
"def results\n x = Profile.all.select { |profile| profile.user_id == self.id }\n k = x.map {|profile| profile[:name]}\n v = x.map do |profile|\n if profile[:sentiment_id] == 1\n \"Negative\"\n elsif profile[:sentiment_id] == 2\n \"Positive\"\n elsif profile[:sentiment_id] == 3\n \"Neutral\"\n end\n end\n hash = [k, v].transpose.to_h\n sleep(3)\n hash\n end",
"def hash\n [list_id, email, phone, gender, first_name, last_name, is_unsubscribed, is_blacklisted, _custom_attribute_].hash\n end",
"def live_effort_data\n\n # Params should include at least splitId and bibNumber. Params may also include timeIn and timeOut.\n # This endpoint returns as many of the following as it can determine:\n # { effortId (integer), name (string), reportedText (string), dropped (bool), finished (bool),\n # timeFromLastReported (\"hh:mm\"), timeInAid (\"mm minutes\"), timeInExists (bool), timeOutExists (bool),\n # timeInStatus ('good', 'questionable', 'bad'), timeOutStatus ('good', 'questionable', 'bad') }\n\n if @event.available_live\n reporter = LiveDataEntryReporter.new(event: @event, params: params)\n render json: reporter.full_report\n else\n render json: live_entry_unavailable(@event), status: :forbidden\n end\n end",
"def profile\n student = Student.find(params[:id])\n chart_data = StudentProfileChart.new(student).chart_data\n @serialized_data = {\n current_educator: current_educator,\n student: student.serialized_data,\n notes: student.student_notes.map { |note| serialize_student_note(note) },\n feed: student_feed(student),\n chart_data: chart_data,\n intervention_types_index: intervention_types_index,\n educators_index: educators_index,\n attendance_data: {\n discipline_incidents: student.most_recent_school_year.discipline_incidents,\n tardies: student.most_recent_school_year.tardies,\n absences: student.most_recent_school_year.absences\n }\n }\n end",
"def id\n data[:id]\n end",
"def fetch_profile_data\n puts \"Step 10: Extracting freelancer profile data\"\n freelance_profile_page = FreelancerProfilePage.new\n data = freelance_profile_page.get_profile_header\n data2 = data.find_element(css: \".overlay-container\")\n title = data2.find_element(css: \"h3\").text\n description = data2.find_elements(css: \"o-profile-overview\").first.text\n skills = freelance_profile_page.get_profile_skills.collect{|t| t.text}\n\n @profile_data = {\n title: title,\n description: description,\n skills: skills\n }\n puts \"Profile data extracted successfully\"\n end",
"def get_all_time_sampling_profile\n {\n method: \"Memory.getAllTimeSamplingProfile\"\n }\n end",
"def key_timings\n \"timings\"\n end",
"def retrieve_meds(name)\n user_list = JSON.parse(File.read(\"./files/user_info.json\"))\n user_list[\"Users\"].each do |user|\n if user[\"Name\"] == name\n user[\"Medication\"].each do |med|\n puts \"Name: #{med[\"Med_Name\"]}\"\n puts \"Intake Time: #{med[\"Intake_Time\"]}\"\n puts \"Duration: #{med[\"Duration\"]}\"\n puts \"Extra Info: #{med[\"Extra_Info\"]}\"\n end\n end\n end\nend",
"def profile_payload_builder\n mappings = {\n 'email' => './profile/email',\n 'first_name' => './profile/givenName',\n 'last_name' => './profile/familyName',\n 'phone_number' => './profile/phoneNumber',\n 'job_title' => './profile/jobTitle',\n 'street' => './profile/street',\n 'mobile' => './profile/mobile',\n 'city' => './profile/city',\n 'postal_code' => './profile/postalCode',\n 'country' => './profile/country',\n 'state' => './profile/state',\n 'gender' => './profile/gender',\n 'about' => './profile/aboutMe',\n }\n\n profile = profile_diff\n\n # .dup to avoid \"can't add a new key into hash during iteration\"\n profile.dup.each_key do |k|\n profile[mappings[k]] = profile.delete(k) if mappings[k]\n end\n\n profile\n end",
"def patient_visit_list\n yes_concept = ConceptName.find_by_name('YES').concept_id\n hiv_reception_breakdown = {}\n\n (patient_visits || []).each do |v|\n # visit_date = v['obs_datetime'].to_date\n visit_type = v['name']\n ans_given = v['value_coded'].to_i == yes_concept\n patient_id = v['patient_id'].to_i\n patient_present = (visit_type.match(/patient/i) && ans_given ? true : false)\n guardian_present = (visit_type.match(/person/i) && ans_given ? true : false)\n\n if hiv_reception_breakdown[patient_id].blank?\n demographics = client_data(patient_id)\n hiv_reception_breakdown[patient_id] = {\n patient_present: false, guardian_present: false,\n given_name: demographics['given_name'],\n family_name: demographics['family_name'],\n gender: demographics['gender'],\n birthdate: demographics['birthdate'],\n arv_number: demographics['arv_number']\n }\n end\n\n hiv_reception_breakdown[patient_id][:patient_present] = patient_present if visit_type.match(/patient/i)\n hiv_reception_breakdown[patient_id][:guardian_present] = guardian_present if visit_type.match(/person/i)\n end\n\n hiv_reception_breakdown\n end",
"def profile; Profile.get(self.profile_id); end",
"def facebook_profile_params\n [:id, :name, :email, :token, :token_type, :expiration, {:raw => facebook_raw_params} ]\n end",
"def data\n timestamp = @timestamp.call\n time_str = @time_str.call\n @data ||= listings.map do |listing|\n {\n id: listing['id'],\n timestamp: timestamp,\n time_str: time_str,\n title: listing.css('h2 > a > span.atcui-truncate.ymm > span').text,\n # price: listing.css('.primary-price').text.delete(\"$\").delete(\",\"),\n price: listing.css('.primary-price span').text.delete(\"$\").delete(\",\"),\n mileage: listing.css('.mileage .atcui-bold').text.delete(\",\"),\n color: listing.css('.color .atcui-block').text,\n distance: listing.css('.distance-cont').text.split(' ')[0],\n image: listing.css('.media-img').css('img')[0]['src'],\n link: \"http://www.autotrader.com#{listing.css('a').first['href']}\"\n }\n end\n end",
"def map_added_rpx_data( rpx_data )\n\t\tself.rpx_identifier = rpx_data['profile']['identifier']\n\n\t\t# map some additional fields, e.g. photo_url\n\t\tself.photo_url = rpx_data['profile']['photo'] if photo_url.blank?\n\tend",
"def as_basic_json(time = nil)\n _b = anonymous_time_verification\n self.anonymous_time_verification = time if time\n res = as_json(only: [:id, :email, :phone_number, :first_name, :last_name, :mention_key, :sex, :full_name, :avatar_url])\n self.anonymous_time_verification = _b\n res\n end",
"def instance_profile_id\n data.instance_profile_id\n end",
"def webhook_event_details(payload:)\n payment_fee = payload.dig(:NotificationRequestItem, :splits)&.find_all { |split| split[:type] == 'PaymentFee' }&.first\n\n {\n attempt_token: nil,\n amount_currency: payload.dig(:NotificationRequestItem, :amount, :currency),\n amount_cents: payload.dig(:NotificationRequestItem, :amount, :value),\n status: payload.dig(:NotificationRequestItem, :success) == 'true' ? 'Success' : 'Failure',\n external_payment_id: payload.dig(:NotificationRequestItem, :pspReference),\n email: payload.dig(:NotificationRequestItem, :additionalData, :shopperEmail), # optional\n contact: nil, # optional\n event: payload.dig(:NotificationRequestItem, :eventCode),\n external_subscription_id: payload.dig(:NotificationRequestItem, :additionalData, :\"recurring.recurringDetailReference\"),\n payment_gateway_fee_cents: payment_fee.nil? ? nil : payment_fee[:amount][:value], # optional\n payment_gateway_fee_currency: payment_fee.nil? ? nil : payment_fee[:amount][:currency] # optional\n }\n end",
"def visitors(id, date)\n begin\n # json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=today&metrics=ym:s:users&filters=ym:pv:URL=@'ships'&id=33242200&oauth_token=8d3f347e9bfe4be49785fc3922ccc4e1\"))\n json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=#{date.strftime(\"%Y-%m-%d\")}&metrics=ym:s:users&filters=ym:pv:URL=@%27ships/#{id}%27&id=33242200&oauth_token=AQAAAAADvq36AAQsNhxUuZrk40_bsQtY8fXNqrU\"))\n rescue Exception => e\n logger.debug(\"---------------------- #{e}\")\n retry\n end\n\n if (json.present? and json.code == \"200\")\n data_hash = JSON.parse(json.body)\n if data_hash[\"data\"].present?\n visitors = data_hash[\"data\"][0][\"metrics\"][0] \n else\n visitors = nil\n end\n else\n visitors = nil\n end\n\n return visitors\n end",
"def reading_chart_data_json\n profile_chart = StudentProfileChart.new(@student)\n { star_series_reading_percentile: profile_chart.star_series_reading_percentile }\n end",
"def get_user_info_from_id_token id_token\n token_parts = id_token.split(\".\")\n encoded_token = token_parts[1]\n leftovers = token_parts[1].length.modulo(4)\n if leftovers == 2\n encoded_token << \"==\"\n elsif leftovers == 3\n encoded_token << \"=\"\n end\n decoded_token = Base64.urlsafe_decode64(encoded_token)\n jwt = JSON.parse decoded_token\n {email: jwt[\"unique_name\"], name: jwt[\"name\"]}\n end",
"def scrape_data_for_profile_page(html)\n page = Nokogiri::HTML(html)\n return nil if !page.css(\"div[class~=errorMessage]\").empty?\n profile_name = page.css(\"div[class~=aboutBar]\").css(\"div[class~=about]\").css(\"div[class~=name]\").text.to_s.strip\n if profile_name.empty?\n profile_name = page.css(\"h1[class~=userProfileHeaderName]\").text.strip\n end\n followers_count = page.css(\"div[class~=FollowerCount]\").text.to_s.strip.split[0].tr(\",\", \"\")\n info_bar = page.css(\"div[class~=UserInfoBar]\").css(\"div[class~=tabs]\").text.to_s.strip.tr(\"\\n\",\" \")\n if info_bar.empty?\n info_bar = page.css(\"div[class~=UserInfoBar]\").css(\"ul[class~=userStats]\").text.to_s.strip.tr(\"\\n\",\" \")\n followed_info_bar = page.css(\"div[class~=UserInfoBar]\").css(\"ul[class~=followersFollowingLinks]\").text.to_s.strip.tr(\"\\n\",\" \")\n followed = followed_info_bar.match(/\\d?,?\\d+ Following/).to_s.split[0].tr(\",\",\"\")\n else\n followed = info_bar.match(/\\d?,?\\d+ Following/).to_s.split[0].tr(\",\",\"\")\n end\n pins = info_bar.match(/\\d?,?\\d+ Pins/).to_s.split[0].tr(\",\",\"\")\n likes = info_bar.match(/\\d?,?\\d+ Likes/).to_s.split[0].tr(\",\",\"\")\n bio = page.css(\"p[class~=aboutText]\").text.to_s.strip\n if bio.empty?\n bio = page.css(\"p[class~=userProfileHeaderBio]\").text.to_s.strip\n end\n boards = page.css(\"div[class~=BoardCount]\").text.to_s.split[0].tr(\",\", \"\")\n return {\"profile_name\" => profile_name, \"followers_count\" => followers_count, \"profile_description\" => bio,\n \"boards_count\" => boards, \"pins_count\" => pins, \"likes_count\" => likes, \"followed\" => followed}\n end",
"def profile_info_items(user)\n occupation = [\"Occupation\", user.occupation]\n company = [\"Company\", user.company]\n location = [\"Location\", user.location]\n birthday = [\"Birthday\", user.birthday? ? user.birthday.strftime(\"%m/%d/%Y\") : nil]\n [ occupation, company, location, birthday ]\n end",
"def get_movies_of_specific_character(specific_character_data)\n specific_character_films = specific_character_data.first[\"films\"]\nend",
"def extract_and_set_fields\n @type = raw_event['type']\n @is_public = raw_event['public']\n @payload = raw_event['payload']\n @id = raw_event['id']\n # https://github.com/igrigorik/gharchive.org/blob/c9ae11426e5bcc30fe15617d009dfc602697ecde/bigquery/schema.js#L17-L38\n @repo = parse_repo\n\n # https://github.com/igrigorik/gharchive.org/blob/c9ae11426e5bcc30fe15617d009dfc602697ecde/bigquery/schema.js#L39-L70\n @actor = parse_actor\n\n # https://github.com/igrigorik/gharchive.org/blob/c9ae11426e5bcc30fe15617d009dfc602697ecde/bigquery/schema.js#L71-L102\n @org = parse_org\n\n @created_at = parse_created_at\n end",
"def sample_feed\n\n \"{\\\"kind\\\": \\\"Listing\\\", \\\"data\\\": {\\\"modhash\\\": \\\"\\\", \\\"children\\\": [{\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"theverge.com\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"technology\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19c7yz\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"Time Warner Cable says there's no consumer demand for gigabit internet\\\", \\\"media\\\": null, \\\"score\\\": 3504, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"\\\", \\\"subreddit_id\\\": \\\"t5_2qh16\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 12656, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/technology/comments/19c7yz/time_warner_cable_says_theres_no_consumer_demand/\\\", \\\"name\\\": \\\"t3_19c7yz\\\", \\\"created\\\": 1362016864.0, \\\"url\\\": \\\"http://www.theverge.com/2013/2/27/4036128/time-warner-cable-no-consumer-demand-for-fiber-gigabit-internet\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"ground-zero\\\", \\\"created_utc\\\": 1361988064.0, \\\"ups\\\": 16160, \\\"num_comments\\\": 2735, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"youtu.be\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {\\\"content\\\": \\\"<iframe width=\\\\\\\"600\\\\\\\" height=\\\\\\\"338\\\\\\\" src=\\\\\\\"http://www.youtube.com/embed/zAIPL5O9Uwk?feature=oembed\\\\\\\" frameborder=\\\\\\\"0\\\\\\\" allowfullscreen></iframe>\\\", \\\"width\\\": 600, \\\"scrolling\\\": false, \\\"height\\\": 338}, \\\"subreddit\\\": \\\"videos\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19dmwp\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"How long do you think it took him to learn this? \\\", \\\"media\\\": {\\\"type\\\": \\\"youtu.be\\\", \\\"oembed\\\": {\\\"provider_url\\\": \\\"http://www.youtube.com/\\\", \\\"description\\\": \\\"Sleight of Hand: Ravi solves the rubik's cube while juggling! This guy should be knighted Sir Ravi the juggler.\\\", \\\"title\\\": \\\"Sir Ravi The Juggler\\\", \\\"url\\\": \\\"http://www.youtube.com/watch?v=zAIPL5O9Uwk\\\", \\\"type\\\": \\\"video\\\", \\\"author_name\\\": \\\"steveberkecomedy\\\", \\\"height\\\": 338, \\\"width\\\": 600, \\\"html\\\": \\\"<iframe width=\\\\\\\"600\\\\\\\" height=\\\\\\\"338\\\\\\\" src=\\\\\\\"http://www.youtube.com/embed/zAIPL5O9Uwk?feature=oembed\\\\\\\" frameborder=\\\\\\\"0\\\\\\\" allowfullscreen></iframe>\\\", \\\"thumbnail_width\\\": 480, \\\"version\\\": \\\"1.0\\\", \\\"provider_name\\\": \\\"YouTube\\\", \\\"thumbnail_url\\\": \\\"http://i3.ytimg.com/vi/zAIPL5O9Uwk/hqdefault.jpg\\\", \\\"thumbnail_height\\\": 360, \\\"author_url\\\": \\\"http://www.youtube.com/user/steveberkecomedy\\\"}}, \\\"score\\\": 3135, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"http://c.thumbs.redditmedia.com/KysA6IGLgfm4Xikt.jpg\\\", \\\"subreddit_id\\\": \\\"t5_2qh1e\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 10434, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/videos/comments/19dmwp/how_long_do_you_think_it_took_him_to_learn_this/\\\", \\\"name\\\": \\\"t3_19dmwp\\\", \\\"created\\\": 1362055718.0, \\\"url\\\": \\\"http://youtu.be/zAIPL5O9Uwk\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"allucinate\\\", \\\"created_utc\\\": 1362026918.0, \\\"ups\\\": 13569, \\\"num_comments\\\": 732, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"consortiumnews.com\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"politics\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19ddao\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"A newly discovered document reveals that President Reagan and his national security team in 1981 approved Guatemala\\\\u2019s extermination of both leftist guerrillas and their \\\\u201ccivilian support mechanisms,\\\\u201d a green light that opened a path to genocide against hundreds of Mayan villages\\\", \\\"media\\\": null, \\\"score\\\": 2876, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"\\\", \\\"subreddit_id\\\": \\\"t5_2cneq\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 7565, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/politics/comments/19ddao/a_newly_discovered_document_reveals_that/\\\", \\\"name\\\": \\\"t3_19ddao\\\", \\\"created\\\": 1362048048.0, \\\"url\\\": \\\"http://consortiumnews.com/2013/02/21/how-reagan-promoted-genocide/\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"alllie\\\", \\\"created_utc\\\": 1362019248.0, \\\"ups\\\": 10441, \\\"num_comments\\\": 1368, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"imgur.com\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"pics\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19cczu\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"Photographer's girlfriend leads him around the world\\\", \\\"media\\\": null, \\\"score\\\": 2779, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"http://f.thumbs.redditmedia.com/-9vI7aYMld4FYVr5.jpg\\\", \\\"subreddit_id\\\": \\\"t5_2qh0u\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 69801, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/pics/comments/19cczu/photographers_girlfriend_leads_him_around_the/\\\", \\\"name\\\": \\\"t3_19cczu\\\", \\\"created\\\": 1362020742.0, \\\"url\\\": \\\"http://imgur.com/a/HlXzY\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"makemisteaks\\\", \\\"created_utc\\\": 1361991942.0, \\\"ups\\\": 72580, \\\"num_comments\\\": 4523, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"self.IAmA\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"IAmA\\\", \\\"selftext_html\\\": \\\"<!-- SC_OFF --><div class=\\\\\\\"md\\\\\\\"><p>Hey Reddit, I\\\\u2019m John Cusack. I make films and we can talk about that if you like, but I\\\\u2019m also on the board of directors of a new organization called <a href=\\\\\\\"https://pressfreedomfoundation.org\\\\\\\">Freedom of the Press Foundation</a>. My fellow board members include legendary whistleblower Daniel Ellsberg, writers Glenn Greenwald and Xeni Jardin, award-winning documentary filmmaker Laura Poitras, and EFF co-founder John Perry Barlow.</p>\\\\n\\\\n<p>We all came together in December to try to start a broad movement to help protect and defend the First Amendment, given secrecy is at an all time high and whistleblowers have never been under greater attack. I wrote about it for <a href=\\\\\\\"http://www.huffingtonpost.com/john-cusack/why-im-donating-to-fund-t_b_2632389.html\\\\\\\">Huffington Post here</a>. You can also read the two talks I did with leading free speech law professor Jonathan Turley and Kevin McCabe <a href=\\\\\\\"http://www.huffingtonpost.com/john-cusack/what-is-an-assange_b_2317824.html\\\\\\\">here</a> and <a href=\\\\\\\"http://www.huffingtonpost.com/john-cusack/what-is-an-assange-part-2_b_2402236.html\\\\\\\">here</a>. </p>\\\\n\\\\n<p>Back in 2010, WikiLeaks was cut-off from payment processors despite committing no crime, after unofficial pressure from a couple Congressman. We wanted to make sure that doesn\\\\u2019t happen to another journalism organization again, but we also wanted to help other organizations bring transparency to government.</p>\\\\n\\\\n<p>So, we\\\\u2019re taking donations to WikiLeaks, but also supporting three other innovative organizations, the Bureau of Investigative Journalism, Truthout, and Public Integrity.</p>\\\\n\\\\n<p>They each have a specific secrecy-busting project on US drone strikes, the Guantanamo trials, and US defense spending that your money will fund. And every two months, we&#39;re going to support a new bundle of organizations similar to these. You can go to our website and donate to any or all of these organizations here: <a href=\\\\\\\"https://pressfreedomfoundation.org\\\\\\\">https://pressfreedomfoundation.org</a></p>\\\\n\\\\n<p>So hopefully you donate. But whether or not you do, spread the word around and read and support these organizations that are doing such important work. Obviously everyone can&#39;t afford to donate, but awareness and knowledge is just as important.</p>\\\\n\\\\n<p>Ask me anything though.</p>\\\\n\\\\n<p>You can <a href=\\\\\\\"http://twitter.com/johncusack\\\\\\\">follow me on Twitter here</a> and Freedom of the Press Foundation&#39;s <a href=\\\\\\\"http://twitter.com/freedomofpress\\\\\\\">Twitter account is here</a>.</p>\\\\n\\\\n<p><a href=\\\\\\\"https://twitter.com/johncusack/status/306844877914796033\\\\\\\">Proof it&#39;s me</a>. </p>\\\\n\\\\n<p><strong>UPDATE:</strong> Thanks Reddit this was great fun...I hope to do it again. Follow me on twitter <a href=\\\\\\\"http://twitter.com/johncusack\\\\\\\">@johncusack</a>. I&#39;ll be back soon if you&#39;d like!</p>\\\\n</div><!-- SC_ON -->\\\", \\\"selftext\\\": \\\"Hey Reddit, I\\\\u2019m John Cusack. I make films and we can talk about that if you like, but I\\\\u2019m also on the board of directors of a new organization called [Freedom of the Press Foundation](https://pressfreedomfoundation.org). My fellow board members include legendary whistleblower Daniel Ellsberg, writers Glenn Greenwald and Xeni Jardin, award-winning documentary filmmaker Laura Poitras, and EFF co-founder John Perry Barlow.\\\\n\\\\nWe all came together in December to try to start a broad movement to help protect and defend the First Amendment, given secrecy is at an all time high and whistleblowers have never been under greater attack. I wrote about it for [Huffington Post here](http://www.huffingtonpost.com/john-cusack/why-im-donating-to-fund-t_b_2632389.html). You can also read the two talks I did with leading free speech law professor Jonathan Turley and Kevin McCabe [here](http://www.huffingtonpost.com/john-cusack/what-is-an-assange_b_2317824.html) and [here](http://www.huffingtonpost.com/john-cusack/what-is-an-assange-part-2_b_2402236.html). \\\\n\\\\nBack in 2010, WikiLeaks was cut-off from payment processors despite committing no crime, after unofficial pressure from a couple Congressman. We wanted to make sure that doesn\\\\u2019t happen to another journalism organization again, but we also wanted to help other organizations bring transparency to government.\\\\n\\\\nSo, we\\\\u2019re taking donations to WikiLeaks, but also supporting three other innovative organizations, the Bureau of Investigative Journalism, Truthout, and Public Integrity.\\\\n\\\\nThey each have a specific secrecy-busting project on US drone strikes, the Guantanamo trials, and US defense spending that your money will fund. And every two months, we're going to support a new bundle of organizations similar to these. You can go to our website and donate to any or all of these organizations here: https://pressfreedomfoundation.org\\\\n\\\\nSo hopefully you donate. But whether or not you do, spread the word around and read and support these organizations that are doing such important work. Obviously everyone can't afford to donate, but awareness and knowledge is just as important.\\\\n\\\\nAsk me anything though.\\\\n\\\\nYou can [follow me on Twitter here](http://twitter.com/johncusack) and Freedom of the Press Foundation's [Twitter account is here](http://twitter.com/freedomofpress).\\\\n\\\\n[Proof it's me](https://twitter.com/johncusack/status/306844877914796033). \\\\n\\\\n**UPDATE:** Thanks Reddit this was great fun...I hope to do it again. Follow me on twitter [@johncusack](http://twitter.com/johncusack). I'll be back soon if you'd like!\\\\n\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": \\\"\\\", \\\"id\\\": \\\"19cdc3\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"Hey, it's John Cusack. I'm here talk to about Freedom of the Press Foundation, among other things. Ask me anything. \\\", \\\"media\\\": null, \\\"score\\\": 2758, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"self\\\", \\\"subreddit_id\\\": \\\"t5_2qzb6\\\", \\\"edited\\\": 1362020028.0, \\\"link_flair_css_class\\\": \\\"actor\\\", \\\"author_flair_css_class\\\": null, \\\"downs\\\": 16911, \\\"saved\\\": false, \\\"is_self\\\": true, \\\"permalink\\\": \\\"/r/IAmA/comments/19cdc3/hey_its_john_cusack_im_here_talk_to_about_freedom/\\\", \\\"name\\\": \\\"t3_19cdc3\\\", \\\"created\\\": 1361992195.0, \\\"url\\\": \\\"http://www.reddit.com/r/IAmA/comments/19cdc3/hey_its_john_cusack_im_here_talk_to_about_freedom/\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"johncusackFPF\\\", \\\"created_utc\\\": 1361992195.0, \\\"ups\\\": 19669, \\\"num_comments\\\": 3546, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"i.imgur.com\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"funny\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19c9rm\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"This dog just wandered over to our yard, so we checked her tags...\\\", \\\"media\\\": null, \\\"score\\\": 2744, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"\\\", \\\"subreddit_id\\\": \\\"t5_2qh33\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 34441, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/funny/comments/19c9rm/this_dog_just_wandered_over_to_our_yard_so_we/\\\", \\\"name\\\": \\\"t3_19c9rm\\\", \\\"created\\\": 1362018275.0, \\\"url\\\": \\\"http://i.imgur.com/ZOI2gIv.jpg\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"heythereanna\\\", \\\"created_utc\\\": 1361989475.0, \\\"ups\\\": 37185, \\\"num_comments\\\": 530, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"98fm.com\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"movies\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": \\\"\\\", \\\"id\\\": \\\"19cito\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"Liam Neeson on why there won't be a Taken 3: \\\\\\\"She can\\\\u2019t get taken again. That\\\\u2019s just bad parenting\\\\\\\"\\\", \\\"media\\\": null, \\\"score\\\": 2712, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"http://f.thumbs.redditmedia.com/gnnopi32RMk6t5JA.jpg\\\", \\\"subreddit_id\\\": \\\"t5_2qh3s\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": \\\"article\\\", \\\"author_flair_css_class\\\": null, \\\"downs\\\": 23892, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/movies/comments/19cito/liam_neeson_on_why_there_wont_be_a_taken_3_she/\\\", \\\"name\\\": \\\"t3_19cito\\\", \\\"created\\\": 1362024842.0, \\\"url\\\": \\\"http://www.98fm.com/2012/category-entertainment/gossipgirl/category-showbiz/liam-neeson-on-98fm/\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"indian22\\\", \\\"created_utc\\\": 1361996042.0, \\\"ups\\\": 26604, \\\"num_comments\\\": 956, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"en.wikipedia.org\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"todayilearned\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19dh1p\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"TIL that during the 2008 world hops shortage, the Samuel Adams brewery sold 108 craft breweries their excess hops, at cost, to help prevent them from going under.\\\", \\\"media\\\": null, \\\"score\\\": 2747, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"http://b.thumbs.redditmedia.com/gJR_GDy3kIicMvfI.jpg\\\", \\\"subreddit_id\\\": \\\"t5_2qqjc\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 20131, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/todayilearned/comments/19dh1p/til_that_during_the_2008_world_hops_shortage_the/\\\", \\\"name\\\": \\\"t3_19dh1p\\\", \\\"created\\\": 1362050865.0, \\\"url\\\": \\\"http://en.wikipedia.org/wiki/Samuel_Adams_%28beer%29#2008_hops_shortage\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"basherrr\\\", \\\"created_utc\\\": 1362022065.0, \\\"ups\\\": 22878, \\\"num_comments\\\": 1058, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"i.imgur.com\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"funny\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19d4oh\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"I was wrestling with my dog and forgot that he never misses an opportunity to eat\\\", \\\"media\\\": null, \\\"score\\\": 2670, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"\\\", \\\"subreddit_id\\\": \\\"t5_2qh33\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 35105, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/funny/comments/19d4oh/i_was_wrestling_with_my_dog_and_forgot_that_he/\\\", \\\"name\\\": \\\"t3_19d4oh\\\", \\\"created\\\": 1362041272.0, \\\"url\\\": \\\"http://i.imgur.com/Ou8nznv.jpg\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"Draxan\\\", \\\"created_utc\\\": 1362012472.0, \\\"ups\\\": 37775, \\\"num_comments\\\": 672, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"guardian.co.uk\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"worldnews\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19cuvf\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"'Marijuana cannon' used to fire drugs over US border seized in Mexico\\\", \\\"media\\\": null, \\\"score\\\": 2615, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"\\\", \\\"subreddit_id\\\": \\\"t5_2qh13\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 10977, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/worldnews/comments/19cuvf/marijuana_cannon_used_to_fire_drugs_over_us/\\\", \\\"name\\\": \\\"t3_19cuvf\\\", \\\"created\\\": 1362033789.0, \\\"url\\\": \\\"http://www.guardian.co.uk/world/2013/feb/27/marijuana-cannon-us-border-seized-mexico?CMP=SOCNETTXT6965\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"ROFLMFAO\\\", \\\"created_utc\\\": 1362004989.0, \\\"ups\\\": 13592, \\\"num_comments\\\": 1111, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"qkme.me\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"AdviceAnimals\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19d808\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"I quit my job today. I always knew my boss was a good guy... and this was his response.\\\", \\\"media\\\": null, \\\"score\\\": 2597, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"http://d.thumbs.redditmedia.com/sCHhhTDPoWhpxfB-.jpg\\\", \\\"subreddit_id\\\": \\\"t5_2s7tt\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 27315, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/AdviceAnimals/comments/19d808/i_quit_my_job_today_i_always_knew_my_boss_was_a/\\\", \\\"name\\\": \\\"t3_19d808\\\", \\\"created\\\": 1362044036.0, \\\"url\\\": \\\"http://qkme.me/3t64fr\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"gkden\\\", \\\"created_utc\\\": 1362015236.0, \\\"ups\\\": 29912, \\\"num_comments\\\": 538, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"en.wikipedia.org\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"todayilearned\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19cqtc\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"TIL that between the time it was discovered and the time it was unclassified as a planet, Pluto did not even complete one revolution around the sun.\\\", \\\"media\\\": null, \\\"score\\\": 2535, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"http://c.thumbs.redditmedia.com/VdchAMfVmfNExMCz.jpg\\\", \\\"subreddit_id\\\": \\\"t5_2qqjc\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 11685, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/todayilearned/comments/19cqtc/til_that_between_the_time_it_was_discovered_and/\\\", \\\"name\\\": \\\"t3_19cqtc\\\", \\\"created\\\": 1362030771.0, \\\"url\\\": \\\"http://en.wikipedia.org/wiki/Pluto??#Orbit_and_rotation\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"mjski1429\\\", \\\"created_utc\\\": 1362001971.0, \\\"ups\\\": 14220, \\\"num_comments\\\": 647, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"i.imgur.com\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"aww\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19cez4\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"When I Reddit from my phone laying down, this happens on top of me...\\\", \\\"media\\\": null, \\\"score\\\": 2520, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"http://e.thumbs.redditmedia.com/QAHK2-QMz211Wy4R.jpg\\\", \\\"subreddit_id\\\": \\\"t5_2qh1o\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 17878, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/aww/comments/19cez4/when_i_reddit_from_my_phone_laying_down_this/\\\", \\\"name\\\": \\\"t3_19cez4\\\", \\\"created\\\": 1362022169.0, \\\"url\\\": \\\"http://i.imgur.com/cnjxQpk.jpg\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"divine_intuition\\\", \\\"created_utc\\\": 1361993369.0, \\\"ups\\\": 20398, \\\"num_comments\\\": 630, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"imgur.com\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"funny\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19cj1s\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"Apparently, Poseidon plays for my school's Water Polo team\\\", \\\"media\\\": null, \\\"score\\\": 2457, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"\\\", \\\"subreddit_id\\\": \\\"t5_2qh33\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 29072, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/funny/comments/19cj1s/apparently_poseidon_plays_for_my_schools_water/\\\", \\\"name\\\": \\\"t3_19cj1s\\\", \\\"created\\\": 1361996215.0, \\\"url\\\": \\\"http://imgur.com/vRV6zeG\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"Sixxish\\\", \\\"created_utc\\\": 1361996215.0, \\\"ups\\\": 31529, \\\"num_comments\\\": 769, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}, {\\\"kind\\\": \\\"t3\\\", \\\"data\\\": {\\\"domain\\\": \\\"science.nbcnews.com\\\", \\\"banned_by\\\": null, \\\"media_embed\\\": {}, \\\"subreddit\\\": \\\"science\\\", \\\"selftext_html\\\": null, \\\"selftext\\\": \\\"\\\", \\\"likes\\\": null, \\\"link_flair_text\\\": null, \\\"id\\\": \\\"19cefe\\\", \\\"clicked\\\": false, \\\"title\\\": \\\"500-million-year-old sea creature unearthed\\\", \\\"media\\\": null, \\\"score\\\": 2440, \\\"approved_by\\\": null, \\\"over_18\\\": false, \\\"hidden\\\": false, \\\"thumbnail\\\": \\\"\\\", \\\"subreddit_id\\\": \\\"t5_mouw\\\", \\\"edited\\\": false, \\\"link_flair_css_class\\\": null, \\\"author_flair_css_class\\\": null, \\\"downs\\\": 5410, \\\"saved\\\": false, \\\"is_self\\\": false, \\\"permalink\\\": \\\"/r/science/comments/19cefe/500millionyearold_sea_creature_unearthed/\\\", \\\"name\\\": \\\"t3_19cefe\\\", \\\"created\\\": 1362021808.0, \\\"url\\\": \\\"http://science.nbcnews.com/_news/2013/02/27/17119273-500-million-year-old-sea-creature-unearthed\\\", \\\"author_flair_text\\\": null, \\\"author\\\": \\\"newsfollower\\\", \\\"created_utc\\\": 1361993008.0, \\\"ups\\\": 7850, \\\"num_comments\\\": 544, \\\"num_reports\\\": null, \\\"distinguished\\\": null}}], \\\"after\\\": \\\"t3_19cefe\\\", \\\"before\\\": null}}\"\n end",
"def value_for_item(it)\n it.data[uuid]\n end",
"def summary(info)\n\treturn info[\"currently\"][\"summary\"]\nend",
"def parse_for_event_ids( json )\n \tid_list = Array.new\n\n \tparsed = JSON.parse( json )\n \torders = parsed[\"user_tickets\"][1][\"orders\"]\n\n \torders.each do |item| \n id = item[\"order\"][\"event\"][\"id\"]\n id_list.push(id)\n end\n\n return id_list;\n end",
"def fields\n preview_json['fields']\n end",
"def load_profile_data\n @profile_data = Nokogiri::HTML(open(\"#{PROFILE_URI}/#{@uid}\"))\n end",
"def get_detail_info(fids)\n uri = \"https://api.twitter.com/1/users/lookup.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fids, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra = Typhoeus::Hydra.new\n hydra.queue(req)\n hydra.run\n JSON.parse(req.response.body)\n \n end",
"def metadata\n output = shell!(\"ffprobe -v quiet -print_format json -show_format -show_streams #{file.path.shellescape}\")\n json = JSON.parse(output)\n json.with_indifferent_access\n end",
"def metadata\n output = shell!(\"ffprobe -v quiet -print_format json -show_format -show_streams #{file.path.shellescape}\")\n json = JSON.parse(output)\n json.with_indifferent_access\n end",
"def types_and_paths\n [\n [OBJECT, [\"data\"]],\n [[\"HigherLevelReview\"], %w[data type]],\n [OBJECT, %w[data attributes]],\n [[String, nil], %w[data attributes receiptDate]],\n [BOOL, %w[data attributes informalConference]],\n [[Array, nil], %w[data attributes informalConferenceTimes]],\n [[String, nil], [\"data\", \"attributes\", \"informalConferenceTimes\", 0]],\n [[String, nil], [\"data\", \"attributes\", \"informalConferenceTimes\", 1]],\n [[nil], [\"data\", \"attributes\", \"informalConferenceTimes\", 2]],\n [[*OBJECT, nil], %w[data attributes informalConferenceRep]],\n *(\n if informal_conference_rep? # ... name and phoneNumber must be present\n [\n [[String], %w[data attributes informalConferenceRep name]],\n [[String, Integer], %w[data attributes informalConferenceRep phoneNumber]]\n ]\n else\n []\n end\n ),\n [[String, Integer, nil], %w[data attributes informalConferenceRep phoneNumberCountryCode]],\n [[String, Integer, nil], %w[data attributes informalConferenceRep phoneNumberExt]],\n [BOOL, %w[data attributes sameOffice]],\n [BOOL, %w[data attributes legacyOptInApproved]],\n [[String], %w[data attributes benefitType]],\n [OBJECT, %w[data attributes veteran]],\n [[String], %w[data attributes veteran ssn]],\n [[*OBJECT, nil], %w[data attributes claimant]],\n *(\n if claimant_object_present? # ... participantId and payeeCode must be present\n [\n [[String], %w[data attributes claimant participantId]],\n [[String], %w[data attributes claimant payeeCode]]\n ]\n else\n []\n end\n ),\n [[String, nil], %w[data attributes claimant addressLine1]],\n [[String, nil], %w[data attributes claimant addressLine2]],\n [[String, nil], %w[data attributes claimant city]],\n [[String, nil], %w[data attributes claimant stateProvinceCode]],\n [[String, nil], %w[data attributes claimant countryCode]],\n [[String, nil], %w[data attributes claimant zipPostalCode]],\n [[String, nil], %w[data attributes claimant phoneNumber]],\n [[String, nil], %w[data attributes claimant phoneNumberCountryCode]],\n [[String, nil], %w[data attributes claimant phoneNumberExt]],\n [[String, nil], %w[data attributes claimant emailAddress]],\n [[Array], [\"included\"]],\n # [OBJECT, [\"included\", 0]],\n # [[\"ContestableIssue\"], [\"included\", 0, \"type\"]],\n # [[Integer, nil], [\"included\", 0, \"attributes\", \"decisionIssueId\"]],\n # [[String, nil], [\"included\", 0, \"attributes\", \"ratingIssueId\"]],\n # [[String, nil], [\"included\", 0, \"attributes\", \"ratingDecisionIssueId\"]],\n # [[Array, nil], [\"included\", 0, \"attributes\", \"legacyAppealIssues\"]]\n # [OBJECT, [\"included\", 1]],\n # [[\"ContestableIssue\"], [\"included\", 1, \"type\"]],\n # [[Integer, nil], [\"included\", 1, \"attributes\", \"decisionIssueId\"]],\n # [[String, nil], [\"included\", 1, \"attributes\", \"ratingIssueId\"]],\n # [[String, nil], [\"included\", 1, \"attributes\", \"ratingDecisionIssueId\"]],\n # [[Array, nil], [\"included\", 1, \"attributes\", \"legacyAppealIssues\"]]\n # ...\n *for_array_at_path_enumerate_types_and_paths( # ^^^\n array_path: [\"included\"],\n types_and_paths: [\n [OBJECT, []],\n [[\"ContestableIssue\"], [\"type\"]],\n [[String, Integer, nil], %w[attributes decisionIssueId]],\n [[String, Integer, nil], %w[attributes ratingIssueId]],\n [[String, Integer, nil], %w[attributes ratingDecisionIssueId]]\n ]\n )\n ]\n end",
"def metadata\n {\n :user_id => user.id.to_s,\n :user => user.to_s.truncate(500),\n (subscription.subscribable_type.downcase + '_id').to_sym => subscription.subscribable.id.to_s,\n subscription.subscribable_type.downcase.to_sym => subscription.subscribable.to_s\n }\n end",
"def profile\n _uuid = uuid.gsub(/-/, '')\n url = \"https://sessionserver.mojang.com/session/minecraft/profile/#{_uuid}\"\n response = Net::HTTP.get_response(URI.parse(url))\n json = JSON.parse(response.body)\n end",
"def events\n data[\"events\"]\n end"
] | [
"0.5621395",
"0.549105",
"0.5414451",
"0.5411209",
"0.53774613",
"0.53614426",
"0.532061",
"0.52865446",
"0.5200691",
"0.5182363",
"0.5174451",
"0.50722224",
"0.50630736",
"0.5050609",
"0.50498444",
"0.503773",
"0.5036641",
"0.50324535",
"0.501359",
"0.501359",
"0.50117403",
"0.50100267",
"0.50091755",
"0.49977082",
"0.49731594",
"0.49712417",
"0.49635282",
"0.49530384",
"0.49213544",
"0.4917092",
"0.4917092",
"0.49061096",
"0.49045354",
"0.48971167",
"0.48957556",
"0.48929048",
"0.48870322",
"0.48860988",
"0.48749414",
"0.48729694",
"0.48518127",
"0.48507154",
"0.48475066",
"0.48440468",
"0.4842516",
"0.48413724",
"0.48347893",
"0.48309585",
"0.4829595",
"0.4824024",
"0.48234645",
"0.48163968",
"0.48109388",
"0.48104763",
"0.48100623",
"0.48098508",
"0.48090824",
"0.480614",
"0.48052904",
"0.48042277",
"0.48008138",
"0.4798816",
"0.47978842",
"0.47955725",
"0.47938073",
"0.47937146",
"0.47911158",
"0.4778429",
"0.4777275",
"0.4776374",
"0.47756857",
"0.47513133",
"0.4750044",
"0.47434023",
"0.47409943",
"0.47355008",
"0.4734099",
"0.47340387",
"0.47319293",
"0.47299325",
"0.47286412",
"0.47232658",
"0.47149602",
"0.4713755",
"0.47132465",
"0.47129485",
"0.4712752",
"0.47096002",
"0.4702432",
"0.47021452",
"0.47013414",
"0.47009385",
"0.4699637",
"0.46987456",
"0.4698434",
"0.4698434",
"0.46973628",
"0.46949852",
"0.46916658",
"0.46893036"
] | 0.56294674 | 0 |
"type": "upemail", "fired_at": "20090326\ 22:15:09", "data[list_id]": "a6b5da1054", "data[new_id]": "51da8c3259", | def customer_mailchimp_email_updated
{
:list_id => data['list_id'],
:fired_at => params['fired_at'],
:new_mailchimp_id => data['id'],
:new_email => data['new_email'],
:old_email => data['old_email'],
:human => "#{data['email']} updated their email address on Mailchimp, from '#{data['old_email']}' to '#{data['new_email']}'."
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_cleaned\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :campaign_id => data['campaign_id'],\n :email => data['email'],\n :reason => data['reason'],\n :human => \"#{data['email']} was cleaned from Mailchimp list with ID #{data['list_id']}. Reason: '#{data['reason']}'\"\n }\n end",
"def http_raw_notify_data\n {\n \"id\"=>\"b9879d2b-052f-4a0a-8a3f-3e72049e4d19\", \n \"event\"=>\"invoice_paid\", \n \"payload\"=> invoice_data\n }.to_json\n end",
"def update_sent_at\n unless (data = params[:data]).blank?\n clean_data = URI.unescape(data)\n update_list = clean_data.split(\"\\n\").map do |value|\n id, time = value.split('|')\n [OutboundMail.find(id), Time.parse(time)]\n end\n update_list.each do |item|\n outbound_mail, time = item\n outbound_mail.update_column(:sent_at, time)\n end\n ActiveSupport::Notifications.instrument(\"rake.messages.send\", {:text => \"update sent_at: #{update_list.length} records\"})\n end\n\n render :json => \"OK\\n\"\n end",
"def customer_mailchimp_unsubscribed\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :campaign_id => data['campaign_id'],\n :human => \"#{data['email']} unsubscribed from Mailchimp list with ID #{data['list_id']}\"\n }\n end",
"def customer_mailchimp_profile_updated\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :human => \"#{data['email']} updated Mailchimp profile information.\"\n }\n end",
"def get_doc_id(notification)\n notification[\"id\"]\nend",
"def invite\n @data['invite']\n end",
"def msgData(arr)\n return data = {\"rusr\" => arr[0][1..-1].split(\"!\")[0], \"raddress\" => arr[0].split(\"!\")[1], \"type\" => arr[1], \"who\" => arr[2], \"event\" => arr[3][1..-1], \"args\" => arr[4..-1].join(\" \")}\n end",
"def customer_mailchimp_subscribed\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :ip_signup => params['ip_signup'],\n :human => \"#{data['email']} subscribed to Mailchimp list with ID #{data['list_id']}\"\n }\n end",
"def webhook_event_details(payload:)\n payment_fee = payload.dig(:NotificationRequestItem, :splits)&.find_all { |split| split[:type] == 'PaymentFee' }&.first\n\n {\n attempt_token: nil,\n amount_currency: payload.dig(:NotificationRequestItem, :amount, :currency),\n amount_cents: payload.dig(:NotificationRequestItem, :amount, :value),\n status: payload.dig(:NotificationRequestItem, :success) == 'true' ? 'Success' : 'Failure',\n external_payment_id: payload.dig(:NotificationRequestItem, :pspReference),\n email: payload.dig(:NotificationRequestItem, :additionalData, :shopperEmail), # optional\n contact: nil, # optional\n event: payload.dig(:NotificationRequestItem, :eventCode),\n external_subscription_id: payload.dig(:NotificationRequestItem, :additionalData, :\"recurring.recurringDetailReference\"),\n payment_gateway_fee_cents: payment_fee.nil? ? nil : payment_fee[:amount][:value], # optional\n payment_gateway_fee_currency: payment_fee.nil? ? nil : payment_fee[:amount][:currency] # optional\n }\n end",
"def send_email_through_data(gmail)\n gmail = gmail\n read_hash(gmail,read_json)\n end",
"def extract_message(item)\n # message = item[\"message\"]\n # timestamp = DateTime.parse(item[\"@timestamp\"]).strftime(\"%Y-%m-%d %H:%M:%S\") rescue nil\n # from = REGEX_EMAIL.match(REGEX_FROM_EMAIL.match(message)[0])[0] rescue nil\n # to = REGEX_EMAIL.match(REGEX_TO_EMAIL.match(message)[0])[0] rescue nil\n # status = REGEX_STATUS.match(message)[0].split(\"=\")[1] rescue nil\n # subject = REGEX_SUBJECT.match(message)[0].split(\" \")[1..-2].join(\" \") rescue nil\n # error_message = ( status == \"deferred\" || status == \"bounced\" ) ? ( REGEX_ERROR_MESSAGE.match(message)[0] rescue nil ) : nil\n { :timestamp => item[:timestamp],\n :status => item[:status],\n :from => item[:from] ,\n :to => item[:to] ,\n :subject => item[:subject],\n }.merge( item[:error_message] ? { error_message: item[:error_message].split(\" \")[1..-1].join(\" \") } : {})\n end",
"def delivery_details; message[:delivery_details]; end",
"def decode_workitem( email )\n ldebug { \"decoding workitem from: #{email}\" }\n analysis_error_response( email )\n arwi_id = get_arwi_id_for_decode( email )\n puts \"listener got arwi:#{arwi_id}\"\n return unless arwi_id && arwi_id.to_s.size > 0\n workitem = MailItem.get_workitem( arwi_id, 'delete', \"listener\" )\n puts \"listener can not got workitem for arwi:#{arwi_id}\" unless workitem\n return unless workitem\n puts \"listener got wi:#{workitem.class}, #{workitem}\"\n workitem[\"attachment\"] = email[:attachment]\n workitem[\"email_from\"] = email[:from].join(',')\n begin\n SMOperation.build( email, workitem )\n email[:subject] = Kconv.toutf8(email[:subject])\n # _ps_type = $1 if /\\+([a-z]+)?_?([\\d]+)@/ =~ email[:to]\n # step = SMSpreadsheet.get_stepname_from_spreadsheet( workitem.fei.wfname, _ps_type )\n event = Hash.new\n event[:title] = \"#{email[:subject]}\"\n event[:desc] = \"#{email[:body]}\"\n calendar_name = workitem.fields['user_name'] || 'default'\n SMGoogleCalendar.create_event( event, calendar_name )\n rescue Exception => e\n puts \"decode_workitem error: #{e.message}\"\n end\n print \"#{@blue_underline}3.listener processed workitem:#{@normal} #{workitem}\\n\"\n workitem\n end",
"def element_to_result(e)\n result = Hash.new\n result['date'] = e.updated_at.strftime(\"%d-%m-%Y %H:%M\")\n result['user'] = e.user.email\n result['interaction'] = e.interaction.resource_type\n result\n end",
"def inbound_payload\n JSON.parse(data)['inbound']['payload']\n end",
"def customerio_payload\n {\n alert: { id: 12345 },\n metric: { name: \"sample_alert\", type: \"gauge\" },\n measurements: [{\n value: 3.14,\n source: \"foo:bar.uid:123\"\n }, {\n value: 1.23,\n source: \"foo:bar.uid:234\"\n }],\n trigger_time: Time.now.to_i\n }.with_indifferent_access\n end",
"def hash\n [attachments, created_by_id, created_by_name, created_on, id, modified_by_id, modified_by_name, modified_on, name, owners, status_id, status_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_home_city, address_home_country, address_home_is_primary, address_home_line1, address_home_state, address_home_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, current_position_company_id, current_position_company_name, current_position_title, current_position_when_end, current_position_when_start, description, education_accreditation_id, education_accreditation_name, education_honors, education_institution_id, education_institution_name, education_when_end, education_when_start, email_address_other, email_address_other_is_primary, email_address_personal, email_address_personal_is_primary, email_address_work, email_address_work_is_primary, ethnicity_id, ethnicity_name, external_primary_key, first_name, gender_id, gender_name, key_date_anniversary, key_date_birthday, key_date_other, last_name, middle_name, nick_name, phone_number_fax, phone_number_fax_extension, phone_number_fax_is_primary, phone_number_home, phone_number_home_extension, phone_number_home_is_primary, phone_number_mobile, phone_number_mobile_extension, phone_number_mobile_is_primary, phone_number_other, phone_number_other_extension, phone_number_other_is_primary, phone_number_skype, phone_number_skype_extension, phone_number_skype_is_primary, phone_number_work_direct, phone_number_work_direct_extension, phone_number_work_direct_is_primary, phone_number_work_main, phone_number_work_main_extension, phone_number_work_main_is_primary, preferred_contact_method_type_id, preferred_contact_method_type_name, record_type, related_contact_assistant_first_name, related_contact_assistant_id, related_contact_assistant_is_primary, related_contact_assistant_last_name, related_contact_client_first_name, related_contact_client_id, related_contact_client_is_primary, related_contact_client_last_name, related_contact_other_first_name, related_contact_other_id, related_contact_other_is_primary, related_contact_other_last_name, related_contact_referred_by_first_name, related_contact_referred_by_id, related_contact_referred_by_is_primary, related_contact_referred_by_last_name, related_contact_spouse_first_name, related_contact_spouse_id, related_contact_spouse_is_primary, related_contact_spouse_last_name, salary, salary_details, salutation_id, salutation_name, social_aim, social_aim_is_primary, social_facebook_chat, social_facebook_chat_is_primary, social_face_time, social_face_time_is_primary, social_google_talk, social_google_talk_is_primary, social_icq, social_icq_is_primary, social_other, social_other_is_primary, social_skype, social_skype_is_primary, social_twitter, social_twitter_is_primary, social_yahoo_msg, social_yahoo_msg_is_primary, source_id, source_name, suffix_id, suffix_name, tags, website_blog, website_blog_is_primary, website_business, website_business_is_primary, website_facebook, website_facebook_is_primary, website_linked_in, website_linked_in_is_primary, website_other, website_other_is_primary, website_personal, website_personal_is_primary].hash\n end",
"def admin_1099_received_list\n %w( tt_1099_received_list@booktrope.com )\n end",
"def export_emails(data)\n\t\t\t\t\t\tmy_string = \"\"\n\t\t\t\t\t\t\t\tmatch_val = 0\n\t\t\t\t\t\t\t\t\t\tloc_urn = \"\"\n\t\t\t\t\t\t\t\t\t\t\t\temails = \"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata[\"configurable_attributes\"].each do |item|\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarr = []\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif item[\"category\"] == \"Location\" && item[\"location_urn\"] != nil\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# only push values that are emails\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmy_string = item[\"value\"]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# puts my_string\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmatch_val = /@/ =~ my_string\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# puts match_val\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif match_val >= 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# add data to csv\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarr.push(item[\"location_urn\"], item[\"value\"])\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tadd_to_csv arr\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\nend",
"def webhook_example_event(sample_name)\n data = webhook_example_events(sample_name).first\n if data['raw_params'] && (mandrill_events_data = data['raw_params']['mandrill_events'])\n data['raw_params']['mandrill_events'] = URI.decode_www_form_component(mandrill_events_data)\n end\n data\n end",
"def valid_send_properties\n {\n :$user_id => $user_id,\n\t :$send_to => $user_id,\n :$verification_type => '$email',\n :$brand_name => 'all',\n :$language => 'en',\n :$event => {\n :$session_id => 'gigtleqddo84l8cm15qe4il',\n :$verified_event => '$login',\n :$reason => '$automated_rule',\n :$ip => '192.168.1.1',\n :$browser => {\n :$user_agent => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'\n }\n }\n }\nend",
"def http_message\n {\n data: {\n type: \"events\",\n id: event.id,\n attributes: {\n updated_at: event.updated_at,\n }\n }\n }.to_json\n end",
"def assemble_collection_specific\n # TODO custom field text_type_k\n @json[\"sender_k\"] = get_text(@xpaths[\"sender\"])\n end",
"def append_info_to_payload(payload); end",
"def reason_updated\n data['reasonUpdated']\n end",
"def payload(temp)\n num = temp.values[0]\n {\n :url => \"http://jumpstartlab.com/blog#{num}\",\n :requestedAt => \"#{Time.new}\",\n :respondedIn => 37,\n :referredBy => \"http://jumpstartlab.com\",\n :requestType => \"GET\",\n :eventName => \"socialLogin\",\n :userAgent => \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2)\"\\\n \"AppleWebKit/537.17 (KHTML, like Gecko)\"\\\n \"Chrome/24.0.1309.0 Safari/537.17\",\n :resolutionWidth => \"1920\",\n :resolutionHeight => \"1280\",\n :ip => \"63.29.38.211\"\n }\nend",
"def mail_to_json(content, timestamp)\n {\n \"rfc822_base64\"=>Base64.encode64(content),\n \"name\"=>self.name,\n \"retrieved_at\"=>timestamp.to_s,\n \"source_info\"=>\"connector_class: #{self.class}, connector_name: #{self.name}, dav_uri: #{self.dav_uri}, mailbox: #{self.mailbox}\"\n }.to_json\n end",
"def extract_event_detail( sql_response )\n details = sql_response.split(';')\n standard_points = details[0].to_f\n time_swam_detail = details[1].split(':')\n time_swam = Timing.new( time_swam_detail[2], time_swam_detail[1], time_swam_detail[0] )\n meeting_id = details[2].to_i\n scheduled_date = Date.parse( details[3] )\n { :standard_points => standard_points, :time_swam => time_swam, :meeting_id => meeting_id, :scheduled_date => scheduled_date }\n end",
"def filter(event)\n\n input_log = event.get(@source_field)\n\n # tag if field isn't present\n if input_log.nil?\n event.set(\"VALID\", '0')\n event.tag(\"source_field_is_nil\")\n return [event]\n end\n\n if input_log.empty?\n event.set(\"VALID\", '0')\n event.tag(\"source_field_is_empty\")\n return [event]\n end\n\n # parsing\n parsed_log = parse_mail_log(input_log)\n\n # drop if not valid log\n if parsed_log.nil?\n event.set(\"VALID\", '0')\n event.tag(\"parsed_unavailable\")\n return []\n end\n\n # mc 필드는 반드시 값이 있어야 함\n if parsed_log[\"MC\"].nil?\n event.set(\"VALID\", '0')\n event.tag(\"parsed_unavailable\")\n return []\n end\n\n # set event\n parsed_log.keys.each do |key_field|\n # 원래 필드명의 소문자명과 해당 값을 키-밸류로 매핑하여 event에 입력\n event.set(\"#{key_field.downcase}\", parsed_log[key_field])\n end\n event.set(\"VALID\", '1')\n\n # puts \"---- test ----\"\n # puts \">> parsed_log :\\n#{parsed_log}\"\n\n # return event\n [event]\nend",
"def test_add_batched_events()\n # Parameters for the API call\n body = JSON.parse('[{\"metadata\":{\"foo\":\"ruby\"},\"request\":{\"time\":\"2019-01-09T04:45:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:45:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:46:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:46:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:47:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:47:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:48:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"metadata\":{\"bar\":\"ruby\"},\"response\":{\"time\":\"2019-01-09T04:48:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"exfzweachxjgznvKUYrxFcxv]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:49:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:49:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:50:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:50:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"xcvkrjmcfghwuignrmcmhxdhaaezse4w]s98y18cx98q3yhwmnhcfx43f\"}]').map{|element|\n result = EventModel.from_hash(element)\n result.request.time = Time.now.utc.iso8601\n result.response.time = (Time.now.utc + 1).iso8601\n result\n }\n\n # Perform the API call through the SDK function\n self.class.controller.create_events_batch(body)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 201)\n end",
"def send_new_notifcation(server, metric, metric_details)\n servername = server.upcase\n #puts metric_details.class\n subject = \"[WATCHCAT] Issue on #{server}\"\n body = \"#{servername} has a problem with #{metric[server]}. \\n #{metric[server]} is \\n\"\n if (metric_details.class == Array)\n metric_details.each do |detail|\n detail.each do |k,v|\n body << \"#{k} - #{v} \\n\" \n end\n body << \"---------- \\n\"\n end\n else\n body << metric_details.to_s\n end\n \n #send email\n send_mail(subject, body)\n \nend",
"def new_email_from_existing(oldEmail)\n newEmail=\"\"\n_count\n oldEmail.split(\"\").each do |a|\n if(a == '@')\n newEmail+= @@unique_email_marker.to_s\n @@unique_email_marker+=1\n end\n newEmail+=a\n end\n newEmail\nend",
"def update(data)\n return self.firebase.update(\"patients/#{self.uid}/medication_schedule/#{self.id}/\", data)\n end",
"def get_info(params)\n begin\n \n id = \"abc123abc123abc123abc123\"\n result = @mandrill.messages.info id\n # {\"smtp_events\"=>[{\"diag\"=>\"250 OK\", \"ts\"=>1365190001, \"type\"=>\"sent\"}],\n # \"template\"=>\"example-template\",\n # \"opens_detail\"=>\n # [{\"ts\"=>1365190001,\n # \"location\"=>\"Georgia, US\",\n # \"ip\"=>\"55.55.55.55\",\n # \"ua\"=>\"Linux/Ubuntu/Chrome/Chrome 28.0.1500.53\"}],\n # \"sender\"=>\"sender@example.com\",\n # \"ts\"=>1365190000,\n # \"email\"=>\"recipient.email@example.com\",\n # \"_id\"=>\"abc123abc123abc123abc123\",\n # \"metadata\"=>{\"website\"=>\"www.example.com\", \"user_id\"=>\"123\"},\n # \"clicks_detail\"=>\n # [{\"ts\"=>1365190001,\n # \"location\"=>\"Georgia, US\",\n # \"ip\"=>\"55.55.55.55\",\n # \"ua\"=>\"Linux/Ubuntu/Chrome/Chrome 28.0.1500.53\",\n # \"url\"=>\"http://www.example.com\"}],\n # \"subject\"=>\"example subject\",\n # \"state\"=>\"sent\",\n # \"clicks\"=>42,\n # \"opens\"=>42,\n # \"tags\"=>[\"password-reset\"]}\n\n rescue Mandrill::Error => e\n # Mandrill errors are thrown as exceptions\n puts \"A mandrill error occurred: #{e.class} - #{e.message}\"\n # A mandrill error occurred: Mandrill::UnknownMessageError - No message exists with the id 'McyuzyCS5M3bubeGPP-XVA'\n raise\n end\n end",
"def history_data\n @id = params[:id]\n @item_history = []\n @item_name = @item_names[@id.to_i]\n json_str = Net::HTTP.get(URI.parse(\"http://#{THINGSPEAK_SERVER}/channels/#{OT_CHANNEL}/feed.json?results=200\")) \n parsed_hash = ActiveSupport::JSON.decode(json_str)\n parsed_hash[\"feeds\"].each do |e|\n if e[\"field1\"] == @id\n item = {}\n t = Time.strptime(e[\"created_at\"], \"%FT%T%z\")\n item[\"time\"] = t.strftime(\"%b %d, %Y %H:%M:%S\")\n item[\"curr_loc\"] = e[\"field4\"]\n @item_history.push(item)\n end\n end\n\n render :template => \"static/history_data\", :formats => [:json], :handlers => \"haml\", :layout => false\n end",
"def hash\n [campaign, number, customer, scheduled_start, child, description, category_type, overview, priority, date_event, product_event, phone, event_name, event_number, time_difference, type_event, primary_phone_call_id, parent_phone_call_id, product_name, product_name_g, scheduled_start_parent, description_parent, act_status_name_parent, organisation_name, organisation_id, action_status, actual_start, actual_end, owner, partner, time_shift, regarding_object_id, phone_call_subject, summary_table_event_id, lead_id, lead_name, contact_id, contact_full_name, account_id, account_name, parent_account_id, parent_account_name, customer_created_on, contact_taxid_number, contact_pin, account_registration_code, account_taxid_number, account_pin, lead_pin, parent_account_registration_code, parent_account_taxid_number, parent_account_pin, address_name, actionnr, campaign_rank, setting_id, ignor_nedozvon, primary_activity_id, activity_serial_number, contact_person_id, contact_person_id_name, phone_call_type, party_id, color, time, created_by, created_on, modified_by, modified_on, id, name, state_code, status_code].hash\n end",
"def new_mail\n poll_response['num_unread'].to_i\n end",
"def updateNotifications(data)\r\n self.comment_status = data[:comment_status].to_i\r\n self.experience_status = data[:experience_status].to_i\r\n self.experience_p_status = data[:experience_p_status].to_i\r\n self.feelike_status = data[:feelike_status].to_i\r\n self.follows_status = data[:follows_status].to_i\r\n save\r\n end",
"def set_payload(data)\n @payload = { \n 'caption' => data['caption']['text'], \n 'photo_url' => data['images']['standard_resolution']['url'],\n 'title' => \"#{data['user']['username']}_#{data['created_time']}\"\n }\n @log.debug(\"Payload is #{@payload}\")\n end",
"def hash\n [ab_campaign_data, confirmation_to, created_on, delivered_on, format_type, html_content, id, is_transactional, mailing_lists, name, plain_content, reply_to_email, scheduled_for, sender, status, subject, timezone, updated_on, web_location].hash\n end",
"def to_freckle_entry\n {\n :entry => {\n :minutes => '25min',\n :date => created_at.strftime('%Y-%m-%d'),\n :description => tags.join(', '),\n :user => \"#{user.freckle_login}@letsfreckle.com\"\n }\n }\n end",
"def payload; message[:payload]; end",
"def get_data(event, data={})\n self['event'] = event\n self['properties'] = data \n self['properties']['token'] = @key\n self['properties']['time'] = Time.now.to_i\n \n Base64.encode64(JSON.generate(self))\n end",
"def test_parse_rating\n rating = 's0.commentId=4619476;s0.creationDate=new Date(1297641726000);s0.name=\"Jason Piers\";s0.townAndCountry=\"London UK\";s0.voteCount=393;s0.yourComments=\"This business isnt a penny business, last week the DM ran a story on the chap who sells the clothes donated to the salvation army making \\u00A311m and the Sally Army making \\u00A316M from it, hardly a two bob industry.\"; '\n json_rating = @dailymail.parse_rating(rating)\n # puts json_rating\n end",
"def event_memo_for(key)\n ::JSON.parse(@response.body.gsub(/.*(\\{.*\\}).*/, '\\1'))[key.to_s]\n end",
"def received_at\n params[:json]['message_time']\n end",
"def pull_emilys_event_data(event_website) #event_website must be a string\n\n event_title = ScrapeEventURLs.create(event_website, \".bsd-contribForm-aboveContent/h1\")[0][7..-8]\n\n description_raw, date_location_raw = ScrapeEventURLs.create(event_website, \".bsd-contribForm-aboveContent/p\")[0..1]\n description = description_raw.gsub(\"<p>\", \"\").gsub(\"</p>\", \"\").gsub(\"\\r\", \"\").gsub(\"\\n\", \"\")\n\n date_times_raw, location_raw = date_location_raw.split(\"<br><br>\")\n stripped_date_times_raw = date_times_raw.gsub(\"\\n\", \"\").gsub(\"\\r\", \"\").gsub(\"<p>\", \"\")\n date_raw, both_times = stripped_date_times_raw.split(\"<br>\")\n start_time_raw, end_time_raw = both_times.split(\" - \")\n event_location = location_raw.gsub(\"\\r\\n\", \"\").gsub(\"<br>\", \" \").gsub(\"</p>\", \"\")\n\n\n #This block transforms intermediate date, times, and location into start_time and end_time strings that include date, 24time, and timezone\n date_string = FormatDateTime.date_string(date_raw)\n start_time, end_time = FormatDateTime.time_string(start_time_raw, end_time_raw)\n timezone = \"+0000\" #using UTC as default for now because DetermineTimezone.zone(event_location) is not yet working\n start_time = \"#{date_string} #{start_time} #{timezone}\"\n end_time = \"#{date_string} #{end_time} #{timezone}\"\n\n\n #These 2 categories can't yet be determined from url data, so they are given assumptions based on knowledge of Emilys List events in general\n free = false\n cta_type = \"onsite\"\n\n parsed_event = CreateJsonObject.create_json_object(event_title, description, free, start_time, end_time, cta_type, event_website)\n [parsed_event, event_location]\nend",
"def email_payload\n {\n personalizations: [\n {\n to: [\n email: @to,\n name: @to_name\n ]\n }\n ],\n from: {\n email: @from,\n name: @from_name\n },\n subject: @subject,\n content: [\n {\n type: 'text/plain',\n value: @body\n }\n ]\n }.to_json\n end",
"def get_townhall_mail(full_url, name, array_final)\n general_townhall = Nokogiri::HTML(open(full_url))\n townhall_mail = general_townhall.at('td:contains(\"@\")').text.strip\n array_final << {name => townhall_mail}\nend",
"def webhook_payload\n {}\n end",
"def cfapi(events)\n messages = []\n\n # For each event\n events.each do |event|\n # Create an outbound event; this can be serialized to json and sent\n event_hash = {\n 'timestamp' => timestamp_in_milliseconds(event.get('@timestamp')),\n 'text' => (event.get('message') or ''),\n }\n\n # Map fields from the event to the desired form\n event_hash['fields'] = merge_hash(event.to_hash)\n .reject { |key,value| @adjusted_fields.has_key?(key) and @adjusted_fields[key] == nil } # drop banned fields\n .map {|k,v| [ @adjusted_fields.has_key?(k) ? @adjusted_fields[k] : k,v] } # rename fields\n .map {|k,v| { 'name' => (safefield(k)), 'content' => v } } # Convert a hashmap {k=>v, k2=>v2} to a list [{name=>k, content=>v}, {name=>k2, content=>v2}]\n\n messages.push(event_hash)\n end # events.each do\n\n { 'events' => messages } # Framing required by CFAPI.\n end",
"def webster_hall_parse!\n response = Net::HTTP.get('api.ticketweb.com', '/snl/EventAPI.action?key=kFiQQQiHkGJpeA5xCfHd&version=1&orgId=136373,141422,137573&method=json')\n json = JSON.parse(response)\n\n json['events'].each do |event|\n Event.where(\n name: event['eventname'],\n description: event['description'],\n url: event['eventurl'],\n date: event['dates']['startdate'].to_time(\"Eastern Time (US & Canada)\").utc,\n venue_id: id\n ).first_or_create!\n end\n end",
"def update_fields_from_system_i\n json = User.system_i_json(self.email)\n self.employee_number = json[:employee_number]\n self.title = json[:title]\n self.save\n end",
"def webhook_update(existing_data, new_data)\n end",
"def add_metadata(msg)\n return {:timestamp=>Time.now.utc.strftime('%FT%T.%3NZ'),\n :msg=>msg,\n :ip=>@ip,\n :pid=>@pid}\n end",
"def invoice_data\n {\n \"id\"=>\"050b550a-1f4d-4c1e-a0b7-7d9a27e44c4a\",\n \"status\"=>\"ready_to_ship\", \n \"payment_address\"=>\"bitcoin_public_address\", \n \"price\"=>\"0.00012350\", \n \"price_currency\"=>\"BTC\", \n \"base_price\"=>\"31.66\", \n \"base_price_currency\"=>\"USD\", \n \"spot_rate\"=>\"0.00123504\", \n \"usd_spot_rate\"=>\"1.0\", \n \"crypto_payout_split\"=>80, \n \"confirmations_required\"=>6, \n \"notification_level\"=>nil, \n \"redirect_url\"=>\"http://test_redirect_url.com\", \n \"order_id\"=>\"237\", \n \"item_name\"=>nil, \n \"item_sku\"=>nil, \n \"item_description\"=>nil, \n \"physical\"=>nil, \n \"customer_name\"=>\"Customer Name\", \n \"customer_address_1\"=>nil, \n \"customer_address_2\"=>nil, \n \"customer_city\"=>nil, \n \"customer_region\"=>nil, \n \"customer_country\"=>nil, \n \"customer_postal_code\"=>nil, \n \"customer_email\"=>nil, \n \"customer_phone\"=>nil, \n \"user_defined_1\"=>nil, \n \"user_defined_2\"=>nil, \n \"user_defined_3\"=>nil, \n \"user_defined_4\"=>nil, \n \"user_defined_5\"=>nil, \n \"user_defined_6\"=>nil, \n \"user_defined_7\"=>nil, \n \"user_defined_8\"=>nil, \n \"data\"=>nil, \n \"expires_at\"=>\"2014-01-24T00:01:03.602Z\", \n \"created_at\"=>\"2014-01-23T23:46:03.997Z\", \n \"updated_at\"=>\"2014-01-23T23:49:40.777Z\", \n \"server_time\"=>\"2014-01-24T00:26:39Z\", \n \"callback_url\"=>\"test_redirect_url.com/notify/237\", \n \"merchant_id\"=>\"d91c8756-5174-4388-b4e0-8c3593529a32\"\n }\n end",
"def victims_responded_line_items\n # campaign.victims.each {|victim| @victims = victim.opened? ? victim : nil}\n\n [[\"UID\", \"Email\", \"Sent\", \"Clicked\", \"Opened\", \"Password\", \"Time\"]] +\n @victims_responded.map do |victim|\n [victim.uid, \n victim.email_address, \n victim.sent.to_s, \n victim.clicked?.to_s, \n victim.opened?.to_s, \n victim.password?.to_s, \n victim.updated_at.to_s ]\n end\n end",
"def create\n puts \"==========================\"\n puts \"CREATE\"\n JSON[params[\"updates\"].read].each do |notification|\n user = User.find(notification[\"subscriptionId\"])\n if user\n case notification[\"collectionType\"]\n when \"sleep\"\n user.fitbit.client.sleep_on_date(notification[\"date\"])[\"sleep\"].each do |data|\n sleep_event = { user_id: notification[\"subscriptionId\"], provider: params[:app_id], body: data }\n sleep_logger.info sleep_event\n end\n end\n end\n end\n render text: \"\", status: 204\n end",
"def e_email_keys\n '{root_url} => site url, {date} => order date, {number} => order number, {name} => client first name, {full_name}, {order_table} => table of products of the order, {shipping_name} => shipping method name, {tracking_url} => the url of tracking, {shipping_info} => Shipping info, {billing_info} => Billing info, {invoice_number} => Sequential Invoice Number, {url} => Order Url'\n end",
"def received_at\n params['date'] + params['time']\n end",
"def patch_event(json_body, user_id, group_id, event_id)\n event = Event.find(event_id)\n\n json_body.each do |operation_line|\n if operation_line[\"op\"] == \"add\"\n if operation_line[\"path\"] == \"/voters\"\n email_to_add = operation_line[\"value\"]\n event.voters << Voter.create(email: email_to_add)\n elsif operation_line[\"path\"] == \"/restaurants\"\n\n end\n\n end\n\n end\n end",
"def build_body(metric, timestamp, value)\n {\n \"metric\" => metric,\n \"timestamp\" => timestamp,\n \"value\" => value,\n \"tags\" => { \"status\" => \"test\" }\n }.to_json\nend",
"def parse\n new_emails = emails.delete(\",\")#removes commas\n individual_emails = new_emails.split.uniq #splits emails and deletes repetes\n end",
"def get_message_formatted(raw, time)\n {\n :data => raw,\n :timestamp => timestamp(time)\n }\n end",
"def collect_unknown(event_name, event_data)\n puts \"unexpected event: #{event_name}\\nstoring event data in #{SQS_CFG['queues'][0]}-moo queue\"\n message = { \n message_body: event_data.to_json,\n message_attributes: {\n event_name: {\n string_value: event_name.to_s,\n data_type: \"String\",\n },\n event_time: {\n string_value: (event_data.dig('metadata', 'event_time') || event_data.dig('data', 0, 'eventTime')).to_s,\n data_type: \"String\",\n },\n }\n }\n Shoryuken::Client.queues(\"#{SQS_CFG['queues'][0]}-moo\").send_message(message)\n # LiveEvents.perform_async(event_data, queue: \"#{SQS_CFG['queues'][0]}-moo\")\nrescue => e\n pp ['moo queue failed, saving payload to file', e, event_name]\n # write event and payload to file\n open('log/payload-cache.js', 'a') do |f|\n f << \"\\n//#{event_name}\\n\"\n f << event_data.to_json\n end\nend",
"def email_kyc_approve(data_to_format)\n {}\n end",
"def rebuildevent(e)\n if USEMEMCACHE != true\n static = Staticentry.find(e.staticentry.id)\n else\n static = Staticentry.get_cache(e.staticentry.id)\n end\n entries = e.payload.split('/111/')\n hash = Hash.new\n entries.each do |m|\n map = m.split('/000/')\n hash.store('<<<' + map[0] + '>>>',map[1])\n end\n p = static.data\n hash.each do |key, val|\n p = p.gsub(key,val)\n p = p.gsub(\"\\n\", \"<br/>\")\n end\n return p\n end",
"def send_notification\n @emails = EmployeeEmail.all\n if @emails == []\n return\n else\n #rather unwise to have my api key just sitting here in the code, need to check if a new api-key can be generated\n RestClient.post \"https://api:key-5f4ada711a8a86a1292bcfe23aa9d0aa\"\\\n \"@api.mailgun.net/v2/sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org/messages\",\n :from => \"Excited User <mailgun@sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org>\",\n :to => send_who_us,\n :subject => \"Ovuline Notification Test\",\n #ack! I need to find a way to get @company info into this next line\n :text => \"This is the Ovuline Notification System test message! A company (need to make this more specific) has submitted information to the Quotes Table! Is that former sentence incomplete or otherwise incorrect? Oh no! A bug!\"\n end\n end",
"def notification(data)\n type = data.delete(\"type\") || data.delete(:type) || data.delete(\"type\") || data.delete(:type)\n zone = to_demiurge_name(data.delete(\"zone\") || data.delete(:zone) || @item.zone)\n location = to_demiurge_name(data.delete(\"location\") || data.delete(:location) || @item.location)\n actor = to_demiurge_name(data.delete(\"actor\") || data.delete(:actor) || @item)\n @item.engine.send_notification(data, type: type.to_s, zone: zone, location: location, actor: actor, include_context: true)\n nil\n end",
"def unmarshal(data)\n event = Hash.new { |hash, key| hash[key] = [] }\n\n data.split(\"\\n\").each do |line|\n key, value = line.split(/: ?/, 2)\n next if key =~ /^\\s*$/\n\n event[key.to_sym] << value\n end\n\n event.inject({}) do |hash, (key, value)|\n hash.update key => value.join(\"\\n\")\n end\n end",
"def fetch_email_details(email_id)\n to_email(ItemId.new(email_id))\n end",
"def hash\n [list_id, email, phone, gender, first_name, last_name, is_unsubscribed, is_blacklisted, _custom_attribute_].hash\n end",
"def activity_update(email, time, user_activity )\n # @actor = user_activity.extract_object(:actor)\n # @subject_object = user_activity.extract_object(:subject)\n # \n # @secondary_subject = user_activity.extract_object(:secondary_subject)\n # @event_type = user_activity.event_type\n # @project\n extract_params(user_activity) \n @user_activity = user_activity\n \n mail( :to => email, \n :subject => \"piliPoto | Activity Update: #{time}\", \n :bcc => [\"rajakuraemas@gmail.com\"] )\n \n user_activity.mark_notification_sent \n end",
"def update_message(data); end",
"def update_message(data); end",
"def hash\n [additional_contact_billing_id, additional_contact_billing_is_primary, additional_contact_billing_name, additional_contact_executive_sponsor_id, additional_contact_executive_sponsor_is_primary, additional_contact_executive_sponsor_name, additional_contact_hiring_manager_id, additional_contact_hiring_manager_is_primary, additional_contact_hiring_manager_name, additional_contact_internal_recruiter_id, additional_contact_internal_recruiter_is_primary, additional_contact_internal_recruiter_name, additional_contact_other_id, additional_contact_other_is_primary, additional_contact_other_name, attachments, created_by_id, created_by_name, created_on, expected_value, external_email_address, id, job_code, last_activity_date, last_engagement_date, modified_by_id, modified_by_name, modified_on, owners, status_id, status_name, time_to_close, actual_value, additional_contact_client_first_name, additional_contact_client_id, additional_contact_client_is_primary, additional_contact_client_last_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, bill_rate, bonus, commission, company_id, company_name, compensation, compensation_details, custom_field1, custom_field10, custom_field11, custom_field12, custom_field13, custom_field14, custom_field15, custom_field16, custom_field17, custom_field18, custom_field19, custom_field2, custom_field20, custom_field21, custom_field22, custom_field23, custom_field24, custom_field25, custom_field26, custom_field27, custom_field28, custom_field29, custom_field3, custom_field30, custom_field4, custom_field5, custom_field6, custom_field7, custom_field8, custom_field9, description, discount, estimated_close_date, external_primary_key, fee, fee_percent, hourly_rate, is_lead, is_on_hold, job_title_id, job_title_name, job_types, lead_source_id, lead_source_name, margin, name, number_of_openings, opportunity_type_id, opportunity_type_name, parent_job_id, parent_job_name, pay_rate, potential_value, priority_id, priority_name, probability, salary, start_date, tags, total_hours, website_description, website_description_is_primary, website_other, website_other_is_primary].hash\n end",
"def hash\n [deleted, edited_by_user, email_communication_sequence_email_uuid, email_communication_sequence_uuid, email_container_cjson, email_container_cjson_last_modified_dts, email_template_vm_path, filter_profile_equation_json, individually_render, library_item_oid, magic_link, merchant_id, pending_review, preview_text, rejected, requires_review, screenshot_large_full_url, screenshot_large_viewport_url, screenshot_small_full_url, screenshot_small_viewport_url, smart_sending, storefront_oid, subject, suspended_for_spam, transactional_email, version].hash\n end",
"def received_at\n return nil unless (temp_extended_received_at = read_attribute(:received_at))\n temp_received_at1 = encrypt_remove_pre_and_postfix(temp_extended_received_at, 'received_at', 5)\n temp_received_at2 = YAML::load(temp_received_at1)\n temp_received_at2 = temp_received_at2.to_time if temp_received_at2.class.name == 'Date'\n temp_received_at2\n end",
"def message\n @data['message']\n end",
"def hash\n [new_businessunitid, campaign_id, description, objective, new_url_script, new_url_menu, new_url_pricelist, new_min_interval, new_logic_number_1, new_logic_number_2, new_logic_number_3, new_logic_number_4, new_next_data, new_next_newcustomer, new_next_timezones, new_types_campaing, new_next_oldcustomer, new_redial_max, new_system_auto_avaya, new_apc_job, new_personal_phonecall, new_nedozvon_max, new_count_phonecall_log, new_maxday_callback, new_customertimefrom, new_customertimeto, new_interactive_script, new_isdemo_access, call_count, sub_type, sub_type_name, name, summary_call_count, my_call_count].hash\n end",
"def test_invite_change_significant_change\n old_message = <<ICS\nBEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT\nUID:foobar\nDURATION:PT1H\nSEQUENCE:1\nORGANIZER;CN=Strunk:mailto:strunk@example.org\nATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org\nATTENDEE;CN=One:mailto:one@example.org\nATTENDEE;CN=Two:mailto:two@example.org\nDTSTART:20140716T120000Z\nDTEND:20140716T130000Z\nEND:VEVENT\nEND:VCALENDAR\nICS\n\n new_message = <<ICS\nBEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT\nUID:foobar\nDURATION:PT2H\nSEQUENCE:2\nORGANIZER;CN=Strunk:mailto:strunk@example.org\nATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org\nATTENDEE;CN=Two:mailto:two@example.org\nATTENDEE;CN=Three:mailto:three@example.org\nDTSTART:20140716T120000Z\nDTEND:20140716T130000Z\nEND:VEVENT\nEND:VCALENDAR\nICS\n\n version = Tilia::VObject::Version::VERSION\n\n expected = [\n {\n 'uid' => 'foobar',\n 'method' => 'CANCEL',\n 'component' => 'VEVENT',\n 'sender' => 'mailto:strunk@example.org',\n 'sender_name' => 'Strunk',\n 'recipient' => 'mailto:one@example.org',\n 'recipient_name' => 'One',\n 'significant_change' => true,\n 'message' => <<ICS\nBEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Tilia//Tilia VObject #{version}//EN\nCALSCALE:GREGORIAN\nMETHOD:CANCEL\nBEGIN:VEVENT\nUID:foobar\nDTSTAMP:**ANY**\nSEQUENCE:2\nDTSTART:20140716T120000Z\nDTEND:20140716T130000Z\nORGANIZER;CN=Strunk:mailto:strunk@example.org\nATTENDEE;CN=One:mailto:one@example.org\nEND:VEVENT\nEND:VCALENDAR\nICS\n },\n {\n 'uid' => 'foobar',\n 'method' => 'REQUEST',\n 'component' => 'VEVENT',\n 'sender' => 'mailto:strunk@example.org',\n 'sender_name' => 'Strunk',\n 'recipient' => 'mailto:two@example.org',\n 'recipient_name' => 'Two',\n 'significant_change' => true,\n 'message' => <<ICS\nBEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Tilia//Tilia VObject #{version}//EN\nCALSCALE:GREGORIAN\nMETHOD:REQUEST\nBEGIN:VEVENT\nUID:foobar\nDURATION:PT2H\nSEQUENCE:2\nORGANIZER;CN=Strunk:mailto:strunk@example.org\nATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org\nATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org\nATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org\nDTSTART:20140716T120000Z\nDTEND:20140716T130000Z\nEND:VEVENT\nEND:VCALENDAR\nICS\n },\n {\n 'uid' => 'foobar',\n 'method' => 'REQUEST',\n 'component' => 'VEVENT',\n 'sender' => 'mailto:strunk@example.org',\n 'sender_name' => 'Strunk',\n 'recipient' => 'mailto:three@example.org',\n 'recipient_name' => 'Three',\n 'significant_change' => true,\n 'message' => <<ICS\nBEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Tilia//Tilia VObject #{version}//EN\nCALSCALE:GREGORIAN\nMETHOD:REQUEST\nBEGIN:VEVENT\nUID:foobar\nDURATION:PT2H\nSEQUENCE:2\nORGANIZER;CN=Strunk:mailto:strunk@example.org\nATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org\nATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org\nATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org\nDTSTART:20140716T120000Z\nDTEND:20140716T130000Z\nEND:VEVENT\nEND:VCALENDAR\nICS\n }\n ]\n\n parse(old_message, new_message, expected, 'mailto:strunk@example.org')\n end",
"def general_payload\n payload = Hash.new\n payload['PayloadVersion'] = 1 # do not modify\n payload['PayloadUUID'] = UUIDTools::UUID.random_create().to_s # should be unique\n\n # string that show up in UI, customisable\n payload['PayloadOrganization'] = \"ACME Inc.\"\n payload\nend",
"def get_string_to_hash(info)\r\n\t\treturn \"#{info['id']}|#{info['prev_hash']}|#{info['transaction'].join(':')}|#{info['ts'][:sec]}.#{info['ts'][:nsec]}\".strip\r\n\tend",
"def user_activity\n device_id = request.headers['device_id']\n string = request.body.read\n activity = ActiveSupport::JSON.decode(string)\n a_ids = []\n if !activity.empty?\n begin\n activity.each do |a|\n if a['user_id'].nil?\n a['device_id'] = device_id\n end\n id = a['event_id']\n a.delete('event_id')\n logger.info\"=====#{a}\"\n UserActivity.create(a)\n a_ids << id\n end\n rescue Exception => e\n logger.info \"===Exception in creating usage #{e}\"\n # @error = \"#{e.message} for #{e.try(:record).try(:class).try(:name)}\"\n end\n respond_to do |format|\n format.json { render json: a_ids }\n end\n end\n\nend",
"def hash\n [completed_date_time, created_date_time, envelope_id, envelope_uri, expire_date_time, folder_id, folder_uri, is21_cfr_part11, owner_name, recipients, recipients_uri, sender_company, sender_email, sender_name, sender_user_id, sent_date_time, status, subject, template_id, template_uri].hash\n end",
"def get_note_list\n note = queued_email_note\n note ? note.value.to_s.split(\",\") : nil\n end",
"def trackgen_info;\treturn @json_data['trackgen_info'];\tend",
"def build_payload(issuer, push_notification_url, uuid)\n iat = Time.zone.now.to_i\n {\n iss: Rails.application.routes.url_helpers.root_url,\n iat: iat,\n exp: iat + 12.hours.to_i,\n jti: jti(iat),\n aud: push_notification_url,\n events: {\n EVENT_TYPE_URI => {\n subject: {\n subject_type: 'iss-sub',\n iss: issuer,\n sub: uuid,\n },\n },\n },\n }\n end",
"def data_for_role_general_mailing\n {}\n end",
"def send_message(message)\n message = JSON.parse(message)\n params = {email:message[\"email\"],project:message[\"project\"],event:message[\"event\"],count:message[\"count\"]}\n @connection.get '/activities', params\n end",
"def process\n data = JSON.parse(@message)\n Log.info data.ai\n end",
"def notification_daily_send_time\n @attributes[:notification_daily_send_time]\n end",
"def notification_daily_send_time\n @attributes[:notification_daily_send_time]\n end",
"def filter(event)\n unknown_val = 0\n ka_avl_val = 0\n ka_wmq_val = 0\n ka_eng_val = 0\n ka_oth_val = 0\n hika_mon_val = 0\n hika_mai_val = 0\n hika_tro_val = 0\n hika_rfp_val = 0\n string = event.get(\"message\")\n uniq_ary = string.split(/\\t/).group_by{|e| e}.map{|k, v| [k, v.length]}.each.with_index(0){\n |k, i|\n if i == 0\n # 第一欄為設備類型\n event.set(\"01_device_class\", k[0])\n elsif i == 1\n # 第二欄為設備ID\n event.set(\"02_device_id\", k[0])\n else\n if k[0] == ':'\n unknown_val = unknown_val + k[1]\n elsif k[0] != ''\n field = k[0].sub(\":\",\"_\").downcase\n if field.include? 'avl'\n ka_avl_val = ka_avl_val + k[1]\n elsif field.include? 'wmq'\n ka_wmq_val = ka_wmq_val + k[1]\n elsif field.include? 'eng'\n ka_eng_val = ka_eng_val + k[1]\n elsif field.include? 'rwk' or field.include? 'apw' or field.include? 'rev'\n ka_oth_val = ka_oth_val + k[1]\n elsif field.include? 'wmo' or field.include? 'mon' or field.include? 'mng'\n hika_mon_val = hika_mon_val + k[1]\n elsif field.include? 'oma' or field.include? 'wma' or field.include? 'mai'\n hika_mai_val = hika_mai_val + k[1]\n elsif field.include? 'tbl' or field.include? 'tbs' or field.include? 'una'\n hika_tro_val = hika_tro_val + k[1]\n elsif field.include? 'rfp'\n hika_rfp_val = hika_rfp_val + k[1]\n else\n unknown_val = unknown_val + k[1]\n end\n else \n unknown_val = unknown_val + k[1]\n end\n end\n }\n \n event.set(\"10_ka_avl_val\", ka_avl_val)\n event.set(\"11_ka_wmq_val\", ka_wmq_val)\n event.set(\"12_ka_eng_val\", ka_eng_val)\n event.set(\"13_ka_oth_val\", ka_oth_val)\n event.set(\"14_hika_mon_val\", hika_mon_val)\n event.set(\"15_hika_mai_val\", hika_mai_val)\n event.set(\"16_hika_tro_val\", hika_tro_val)\n event.set(\"17_hika_rfp_val\", hika_rfp_val)\n event.set(\"99_unknown_val\", unknown_val)\n\n path = event.get('path')\n filedate = path[-8, 8]\n if filedate.to_i > 0 and filedate.length == 8\n event.set('filedate', filedate)\n end\n\n return [event]\n end",
"def event_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'event',\n 'Event' => 'click',\n 'EventKey' => 'ping', # will send a pong\n }\nend",
"def email_kyc_report_issue(data_to_format)\n {}\n end",
"def fire_from_code\n if params['code'].nil?\n json_response({ \"status\": 'error', \"error\": 'invalid code' }, 400)\n return\n end\n fire = Fire.find_by(firecode: params['code'])\n if fire.nil?\n json_response({ \"status\": 'error', \"error\": 'invalid code' }, 400)\n return\n end\n user = User.find_by(userid: fire.userid)\n\n json_response({\n \"image\": fire.image,\n \"who\": fire.reporter,\n \"phone\": fire.phone,\n \"x\": fire.x,\n \"y\": fire.y,\n \"reported\": fire.reported\n }, 200)\n end",
"def parse_for_event_ids( json )\n \tid_list = Array.new\n\n \tparsed = JSON.parse( json )\n \torders = parsed[\"user_tickets\"][1][\"orders\"]\n\n \torders.each do |item| \n id = item[\"order\"][\"event\"][\"id\"]\n id_list.push(id)\n end\n\n return id_list;\n end",
"def transform_ticket(ticket)\n fields = []\n fields << ticket['id']\n fields << ticket['status']\n fields << ticket['subject']\n fields << get_component(ticket['custom_fields'])\n fields << clean_text(ticket['description'], 5)\n fields << get_user_name(ticket['requester_id'])\n created = Date.parse(ticket['created_at'])\n updated = Date.parse(ticket['updated_at'])\n fields << created.to_s\n fields << updated.to_s\n fields << (updated - created).to_i\n fields << jira_escalated?(ticket['tags'])\n end"
] | [
"0.6213054",
"0.57850266",
"0.5681093",
"0.5540804",
"0.55029696",
"0.53624773",
"0.53202635",
"0.5304917",
"0.53043294",
"0.52784836",
"0.52484655",
"0.5196279",
"0.51936203",
"0.519108",
"0.5152175",
"0.5138144",
"0.51369935",
"0.5114219",
"0.5059403",
"0.5059069",
"0.50580454",
"0.50570357",
"0.5044662",
"0.50318307",
"0.5009726",
"0.5008219",
"0.49941674",
"0.4975609",
"0.4963992",
"0.49460277",
"0.49454254",
"0.4938257",
"0.49380267",
"0.49291775",
"0.49261546",
"0.4922493",
"0.49047428",
"0.48834342",
"0.48792693",
"0.4877474",
"0.4869786",
"0.48661995",
"0.4862555",
"0.48560643",
"0.4854296",
"0.48425844",
"0.4842473",
"0.484216",
"0.484156",
"0.48385534",
"0.4838307",
"0.4837451",
"0.48342562",
"0.4824952",
"0.48136964",
"0.4808615",
"0.4804523",
"0.4800828",
"0.48003983",
"0.479567",
"0.47940806",
"0.47925234",
"0.47839344",
"0.4779757",
"0.47750473",
"0.4774397",
"0.4771171",
"0.47540534",
"0.47521174",
"0.47485417",
"0.4746091",
"0.47446498",
"0.47434285",
"0.47426277",
"0.4742335",
"0.4742335",
"0.473948",
"0.47339985",
"0.4728769",
"0.4727554",
"0.4725832",
"0.47219002",
"0.47195244",
"0.47182003",
"0.47173572",
"0.47125322",
"0.47121415",
"0.47119334",
"0.4709751",
"0.4705449",
"0.47035536",
"0.47025308",
"0.46923295",
"0.46923295",
"0.46916872",
"0.46870005",
"0.46769607",
"0.4673707",
"0.46735808",
"0.4665649"
] | 0.61849403 | 1 |
"type": "cleaned", "fired_at": "20090326 22:01:00", "data[list_id]": "a6b5da1054", "data[campaign_id]": "4fjk2ma9xd", "data[reason]": "hard", | def email_cleaned
{
:list_id => data['list_id'],
:fired_at => params['fired_at'],
:campaign_id => data['campaign_id'],
:email => data['email'],
:reason => data['reason'],
:human => "#{data['email']} was cleaned from Mailchimp list with ID #{data['list_id']}. Reason: '#{data['reason']}'"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [campaign, number, customer, scheduled_start, child, description, category_type, overview, priority, date_event, product_event, phone, event_name, event_number, time_difference, type_event, primary_phone_call_id, parent_phone_call_id, product_name, product_name_g, scheduled_start_parent, description_parent, act_status_name_parent, organisation_name, organisation_id, action_status, actual_start, actual_end, owner, partner, time_shift, regarding_object_id, phone_call_subject, summary_table_event_id, lead_id, lead_name, contact_id, contact_full_name, account_id, account_name, parent_account_id, parent_account_name, customer_created_on, contact_taxid_number, contact_pin, account_registration_code, account_taxid_number, account_pin, lead_pin, parent_account_registration_code, parent_account_taxid_number, parent_account_pin, address_name, actionnr, campaign_rank, setting_id, ignor_nedozvon, primary_activity_id, activity_serial_number, contact_person_id, contact_person_id_name, phone_call_type, party_id, color, time, created_by, created_on, modified_by, modified_on, id, name, state_code, status_code].hash\n end",
"def campaign_status\n {\n :list_id => data['list_id'],\n :campaign_id => data['id'],\n :subject => data['subject'],\n :status => data['status'],\n :reason => data['reason'],\n :human => \"Campaign Status (ID: #{data['id']}) - Subject: '#{data['subject']}', Status: '#{data['status']}', Reason: '#{data['reason']}'\"\n }\n end",
"def reason_updated\n data['reasonUpdated']\n end",
"def customer_mailchimp_email_updated\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :new_mailchimp_id => data['id'],\n :new_email => data['new_email'],\n :old_email => data['old_email'],\n :human => \"#{data['email']} updated their email address on Mailchimp, from '#{data['old_email']}' to '#{data['new_email']}'.\"\n }\n end",
"def payload\n # Get the original challenge to figure out the stuff to be deleted.\n # We are re-requesting the original challenge instead of tracking which\n # entries are to be deleted client-side to minimize race conditions. Race\n # conditions aren't totally eliminated, but the window is largely smaller\n # in this case. Plus the logic is much simpler too :)\n\n # do not pass values that are not being fetched from sfdc. will overwrite with null\n\n @json_payload = {\n challenge: {\n detail: {\n account: account,\n contact: contact,\n winner_announced: winner_announced,\n terms_of_service: terms_of_service,\n scorecard_type: scorecard_type,\n submission_details: submission_details,\n status: status,\n start_date: start_date_for_payload,\n requirements: requirements,\n name: name,\n end_date: end_date_for_payload,\n description: description,\n comments: comments,\n additional_info: additional_info,\n challenge_type: challenge_type,\n community_judging: community_judging,\n auto_announce_winners: auto_announce_winners,\n community: community,\n community_judging: community_judging,\n auto_announce_winners: auto_announce_winners,\n cmc_task: cmc_task,\n challenge_id: challenge_id,\n post_reg_info: post_reg_info,\n require_registration: require_registration\n },\n reviewers: reviewers.map {|name| {name: name}}, # not being updated in sfdc\n platforms: platforms.map {|name| {name: name}},\n technologies: technologies.map {|name| {name: name}},\n prizes: prizes,\n commentNotifiers: commentNotifiers.map {|name| {name: name}}, # not being updated in sfdc\n assets: assets.map {|filename| {filename: filename}},\n }\n }\n \n remove_nil_keys # remove keys if they are nil so we don't overwrite in sfdc\n\n @json_payload\n end",
"def customer_mailchimp_unsubscribed\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :campaign_id => data['campaign_id'],\n :human => \"#{data['email']} unsubscribed from Mailchimp list with ID #{data['list_id']}\"\n }\n end",
"def parse_data(data)\n # 結果が確定していない為、集計対象外\n return if unclosed?(data)\n\n site_id = data[\"_id\"][\"site_id\"]\n user_id = data[\"_id\"][\"user_id\"]\n user_code = data[\"_id\"][\"user_code\"]\n user_staff_address_uid = data[\"_id\"][\"user_staff_address_uid\"]\n group_id = data[\"_id\"][\"group_id\"]\n date = data[\"_id\"][\"date\"]\n fiscal_year = data[\"_id\"][\"fiscal_year\"]\n month = data[\"_id\"][\"month\"]\n start_at = data[\"_id\"][\"start_at\"]\n end_at = data[\"_id\"][\"end_at\"]\n capital_code = data[\"_id\"][\"capital_code\"]\n project_code = data[\"_id\"][\"project_code\"]\n detail_code = data[\"_id\"][\"detail_code\"]\n file_id = data[\"_id\"][\"file_id\"]\n\n duty_day_time_minute = data[\"duty_day_time_minute\"]\n duty_day_in_work_time_minute = data[\"duty_day_in_work_time_minute\"]\n duty_night_time_minute = data[\"duty_night_time_minute\"]\n\n leave_day_time_minute = data[\"leave_day_time_minute\"]\n leave_night_time_minute = data[\"leave_night_time_minute\"]\n\n week_in_compensatory_minute = data[\"week_in_compensatory_minute\"]\n holiday_compensatory_minute = data[\"holiday_compensatory_minute\"]\n break_time_minute = data[\"break_time_minute\"]\n\n unrate_week_out_compensatory_minute = data[\"week_out_compensatory_minute\"]\n week_out_compensatory_minute = 0\n\n # 週内、週外残業(土日)があった場合、休出区分割増にならない\n if week_in_compensatory_minute > 0 || unrate_week_out_compensatory_minute > 0\n duty_day_time_minute += leave_day_time_minute\n duty_night_time_minute += leave_night_time_minute\n\n leave_day_time_minute = 0\n leave_night_time_minute = 0\n end\n\n # 週外残業は、その週の業務時間合計が 38.75h (2325m) を超えない場合、割増がつかない\n week_working = nil\n if unrate_week_out_compensatory_minute > 0\n @week_working_extractor.week_at(site_id, user_id, date.to_date)\n week_working = @week_working_extractor.week_working\n week_working_minute = @week_working_extractor.week_minutes\n\n if week_working_minute >= 2325\n unrate_week_out_compensatory_minute = 0\n week_out_compensatory_minute = data[\"week_out_compensatory_minute\"]\n end\n end\n\n @subtractors[user_id] ||= Gws::Affair::Subtractor.new(threshold)\n w_c_m = week_out_compensatory_minute # 0. 025/100\n i_w_m = duty_day_in_work_time_minute # 1. 100/100\n d_d_m = duty_day_time_minute # 2. 125/100\n l_d_m = leave_day_time_minute # 3. 135/100\n d_n_m = duty_night_time_minute # 4. 150/100\n l_n_m = leave_night_time_minute # 5. 160/100\n\n under_minutes, over_minutes = @subtractors[user_id].subtract(w_c_m, i_w_m, d_d_m, l_d_m, d_n_m, l_n_m)\n\n under_overtime_minute = under_minutes.sum\n over_overtime_minute = over_minutes.sum\n overtime_minute = under_overtime_minute + over_overtime_minute\n\n @prefs[user_id] ||= {}\n @prefs[user_id][file_id] = {\n # user\n user_id: user_id,\n user_code: user_code,\n user_staff_address_uid: user_staff_address_uid,\n\n # group\n group_id: group_id,\n\n # date\n date: date.localtime,\n fiscal_year: fiscal_year,\n month: month,\n start_at: start_at.localtime,\n end_at: end_at.localtime,\n\n # capital\n capital_code: capital_code,\n project_code: project_code,\n detail_code: detail_code,\n\n # minutes\n week_in_compensatory_minute: week_in_compensatory_minute,\n holiday_compensatory_minute: holiday_compensatory_minute,\n week_out_compensatory_minute: week_out_compensatory_minute,\n unrate_week_out_compensatory_minute: unrate_week_out_compensatory_minute,\n break_time_minute: break_time_minute,\n week_working: week_working,\n overtime_minute: overtime_minute,\n under: {\n duty_day_time_minute: under_minutes[2].to_i,\n duty_night_time_minute: under_minutes[4].to_i,\n duty_day_in_work_time_minute: under_minutes[1].to_i,\n leave_day_time_minute: under_minutes[3].to_i,\n leave_night_time_minute: under_minutes[5].to_i,\n week_out_compensatory_minute: under_minutes[0].to_i,\n overtime_minute: under_overtime_minute\n },\n over: {\n duty_day_time_minute: (over_minutes[2].to_i + over_minutes[1].to_i),\n duty_night_time_minute: over_minutes[4].to_i,\n leave_day_time_minute: over_minutes[3].to_i,\n leave_night_time_minute: over_minutes[5].to_i,\n week_out_compensatory_minute: over_minutes[0].to_i,\n overtime_minute: over_overtime_minute\n }\n }\n end",
"def victims_responded_line_items\n # campaign.victims.each {|victim| @victims = victim.opened? ? victim : nil}\n\n [[\"UID\", \"Email\", \"Sent\", \"Clicked\", \"Opened\", \"Password\", \"Time\"]] +\n @victims_responded.map do |victim|\n [victim.uid, \n victim.email_address, \n victim.sent.to_s, \n victim.clicked?.to_s, \n victim.opened?.to_s, \n victim.password?.to_s, \n victim.updated_at.to_s ]\n end\n end",
"def hash\n [ab_campaign_data, confirmation_to, created_on, delivered_on, format_type, html_content, id, is_transactional, mailing_lists, name, plain_content, reply_to_email, scheduled_for, sender, status, subject, timezone, updated_on, web_location].hash\n end",
"def update_sent_at\n unless (data = params[:data]).blank?\n clean_data = URI.unescape(data)\n update_list = clean_data.split(\"\\n\").map do |value|\n id, time = value.split('|')\n [OutboundMail.find(id), Time.parse(time)]\n end\n update_list.each do |item|\n outbound_mail, time = item\n outbound_mail.update_column(:sent_at, time)\n end\n ActiveSupport::Notifications.instrument(\"rake.messages.send\", {:text => \"update sent_at: #{update_list.length} records\"})\n end\n\n render :json => \"OK\\n\"\n end",
"def cud_response_to_qa(data)\n resp = {}\n data['attributes'].each do |field|\n if Cud.fields.has_key?(field[\"name\"])\n resp[Cud.fields[field[\"name\"]]] = field[\"value\"]\n end\n end\n # Data['attributes'] no longer has affiliation information. They are passed seperately\n aff = []\n if data.fetch('affiliations', nil) && data['affiliations'].any?\n data['affiliations'].each do |field|\n # field has the following keys - source, affiliation, status, startDate, endDate, lastUpdated, dateAdded\n # The affiliations have endDate. If endDate < today - 1 year, we should not use that affiliation\n endDate = Time.parse(field['endDate'][\"$date\"]) rescue nil\n if field['source'] != \"UAS_DARS\" && endDate && endDate > Time.now.ago(1.year)\n aff.push(field[\"affiliation\"])\n end\n end\n end\n if !aff.empty?\n val = aff.max_by(&:length)\n resp[\"current_affiliation\"] = val\n else\n resp[\"current_affiliation\"] = \"\"\n end\n #TODO: If there are no affiliations, we should not use that person\n resp\n end",
"def customerio_payload\n {\n alert: { id: 12345 },\n metric: { name: \"sample_alert\", type: \"gauge\" },\n measurements: [{\n value: 3.14,\n source: \"foo:bar.uid:123\"\n }, {\n value: 1.23,\n source: \"foo:bar.uid:234\"\n }],\n trigger_time: Time.now.to_i\n }.with_indifferent_access\n end",
"def webhook_event_details(payload:)\n payment_fee = payload.dig(:NotificationRequestItem, :splits)&.find_all { |split| split[:type] == 'PaymentFee' }&.first\n\n {\n attempt_token: nil,\n amount_currency: payload.dig(:NotificationRequestItem, :amount, :currency),\n amount_cents: payload.dig(:NotificationRequestItem, :amount, :value),\n status: payload.dig(:NotificationRequestItem, :success) == 'true' ? 'Success' : 'Failure',\n external_payment_id: payload.dig(:NotificationRequestItem, :pspReference),\n email: payload.dig(:NotificationRequestItem, :additionalData, :shopperEmail), # optional\n contact: nil, # optional\n event: payload.dig(:NotificationRequestItem, :eventCode),\n external_subscription_id: payload.dig(:NotificationRequestItem, :additionalData, :\"recurring.recurringDetailReference\"),\n payment_gateway_fee_cents: payment_fee.nil? ? nil : payment_fee[:amount][:value], # optional\n payment_gateway_fee_currency: payment_fee.nil? ? nil : payment_fee[:amount][:currency] # optional\n }\n end",
"def check_time_constraints_payload(record, resp_data)\n # We never return time_constraints = null\n assert_equal record.time_constraints.count, resp_data[\"time_constraints\"].count\n for i in 0..record.time_constraints.count-1 do\n #puts record.time_constraints[i].to_json\n #puts resp_data[\"time_constraints\"][i]\n check_payload(resp_data[\"time_constraints\"][i],\n record.time_constraints[i],\n [:key_id, :start_time, :end_time, :start_offset, :end_offset], nil, nil)\n end\n end",
"def filter(event)\n unknown_val = 0\n ka_avl_val = 0\n ka_wmq_val = 0\n ka_eng_val = 0\n ka_oth_val = 0\n hika_mon_val = 0\n hika_mai_val = 0\n hika_tro_val = 0\n hika_rfp_val = 0\n string = event.get(\"message\")\n uniq_ary = string.split(/\\t/).group_by{|e| e}.map{|k, v| [k, v.length]}.each.with_index(0){\n |k, i|\n if i == 0\n # 第一欄為設備類型\n event.set(\"01_device_class\", k[0])\n elsif i == 1\n # 第二欄為設備ID\n event.set(\"02_device_id\", k[0])\n else\n if k[0] == ':'\n unknown_val = unknown_val + k[1]\n elsif k[0] != ''\n field = k[0].sub(\":\",\"_\").downcase\n if field.include? 'avl'\n ka_avl_val = ka_avl_val + k[1]\n elsif field.include? 'wmq'\n ka_wmq_val = ka_wmq_val + k[1]\n elsif field.include? 'eng'\n ka_eng_val = ka_eng_val + k[1]\n elsif field.include? 'rwk' or field.include? 'apw' or field.include? 'rev'\n ka_oth_val = ka_oth_val + k[1]\n elsif field.include? 'wmo' or field.include? 'mon' or field.include? 'mng'\n hika_mon_val = hika_mon_val + k[1]\n elsif field.include? 'oma' or field.include? 'wma' or field.include? 'mai'\n hika_mai_val = hika_mai_val + k[1]\n elsif field.include? 'tbl' or field.include? 'tbs' or field.include? 'una'\n hika_tro_val = hika_tro_val + k[1]\n elsif field.include? 'rfp'\n hika_rfp_val = hika_rfp_val + k[1]\n else\n unknown_val = unknown_val + k[1]\n end\n else \n unknown_val = unknown_val + k[1]\n end\n end\n }\n \n event.set(\"10_ka_avl_val\", ka_avl_val)\n event.set(\"11_ka_wmq_val\", ka_wmq_val)\n event.set(\"12_ka_eng_val\", ka_eng_val)\n event.set(\"13_ka_oth_val\", ka_oth_val)\n event.set(\"14_hika_mon_val\", hika_mon_val)\n event.set(\"15_hika_mai_val\", hika_mai_val)\n event.set(\"16_hika_tro_val\", hika_tro_val)\n event.set(\"17_hika_rfp_val\", hika_rfp_val)\n event.set(\"99_unknown_val\", unknown_val)\n\n path = event.get('path')\n filedate = path[-8, 8]\n if filedate.to_i > 0 and filedate.length == 8\n event.set('filedate', filedate)\n end\n\n return [event]\n end",
"def build_body(metric, timestamp, value)\n {\n \"metric\" => metric,\n \"timestamp\" => timestamp,\n \"value\" => value,\n \"tags\" => { \"status\" => \"test\" }\n }.to_json\nend",
"def test_add_batched_events()\n # Parameters for the API call\n body = JSON.parse('[{\"metadata\":{\"foo\":\"ruby\"},\"request\":{\"time\":\"2019-01-09T04:45:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:45:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:46:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:46:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:47:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:47:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:48:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"metadata\":{\"bar\":\"ruby\"},\"response\":{\"time\":\"2019-01-09T04:48:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"exfzweachxjgznvKUYrxFcxv]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:49:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:49:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:50:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:50:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"xcvkrjmcfghwuignrmcmhxdhaaezse4w]s98y18cx98q3yhwmnhcfx43f\"}]').map{|element|\n result = EventModel.from_hash(element)\n result.request.time = Time.now.utc.iso8601\n result.response.time = (Time.now.utc + 1).iso8601\n result\n }\n\n # Perform the API call through the SDK function\n self.class.controller.create_events_batch(body)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 201)\n end",
"def extract_event_detail( sql_response )\n details = sql_response.split(';')\n standard_points = details[0].to_f\n time_swam_detail = details[1].split(':')\n time_swam = Timing.new( time_swam_detail[2], time_swam_detail[1], time_swam_detail[0] )\n meeting_id = details[2].to_i\n scheduled_date = Date.parse( details[3] )\n { :standard_points => standard_points, :time_swam => time_swam, :meeting_id => meeting_id, :scheduled_date => scheduled_date }\n end",
"def customer_mailchimp_subscribed\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :ip_signup => params['ip_signup'],\n :human => \"#{data['email']} subscribed to Mailchimp list with ID #{data['list_id']}\"\n }\n end",
"def pull_emilys_event_data(event_website) #event_website must be a string\n\n event_title = ScrapeEventURLs.create(event_website, \".bsd-contribForm-aboveContent/h1\")[0][7..-8]\n\n description_raw, date_location_raw = ScrapeEventURLs.create(event_website, \".bsd-contribForm-aboveContent/p\")[0..1]\n description = description_raw.gsub(\"<p>\", \"\").gsub(\"</p>\", \"\").gsub(\"\\r\", \"\").gsub(\"\\n\", \"\")\n\n date_times_raw, location_raw = date_location_raw.split(\"<br><br>\")\n stripped_date_times_raw = date_times_raw.gsub(\"\\n\", \"\").gsub(\"\\r\", \"\").gsub(\"<p>\", \"\")\n date_raw, both_times = stripped_date_times_raw.split(\"<br>\")\n start_time_raw, end_time_raw = both_times.split(\" - \")\n event_location = location_raw.gsub(\"\\r\\n\", \"\").gsub(\"<br>\", \" \").gsub(\"</p>\", \"\")\n\n\n #This block transforms intermediate date, times, and location into start_time and end_time strings that include date, 24time, and timezone\n date_string = FormatDateTime.date_string(date_raw)\n start_time, end_time = FormatDateTime.time_string(start_time_raw, end_time_raw)\n timezone = \"+0000\" #using UTC as default for now because DetermineTimezone.zone(event_location) is not yet working\n start_time = \"#{date_string} #{start_time} #{timezone}\"\n end_time = \"#{date_string} #{end_time} #{timezone}\"\n\n\n #These 2 categories can't yet be determined from url data, so they are given assumptions based on knowledge of Emilys List events in general\n free = false\n cta_type = \"onsite\"\n\n parsed_event = CreateJsonObject.create_json_object(event_title, description, free, start_time, end_time, cta_type, event_website)\n [parsed_event, event_location]\nend",
"def customer_mailchimp_profile_updated\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :human => \"#{data['email']} updated Mailchimp profile information.\"\n }\n end",
"def process\n data = JSON.parse(@message)\n Log.info data.ai\n end",
"def inbound_payload\n JSON.parse(data)['inbound']['payload']\n end",
"def filter_messages(json, start_date, end_date)\n return json if start_date.nil? && end_date.nil?\n to_ret = Array.new\n json.each do | message |\n message_date = Date.strptime(message[\"created_at\"].to_s, '%s')\n if message_date >= start_date && message_date <= end_date\n to_ret << message\n end\n end\n return to_ret\nend",
"def collect_unknown(event_name, event_data)\n puts \"unexpected event: #{event_name}\\nstoring event data in #{SQS_CFG['queues'][0]}-moo queue\"\n message = { \n message_body: event_data.to_json,\n message_attributes: {\n event_name: {\n string_value: event_name.to_s,\n data_type: \"String\",\n },\n event_time: {\n string_value: (event_data.dig('metadata', 'event_time') || event_data.dig('data', 0, 'eventTime')).to_s,\n data_type: \"String\",\n },\n }\n }\n Shoryuken::Client.queues(\"#{SQS_CFG['queues'][0]}-moo\").send_message(message)\n # LiveEvents.perform_async(event_data, queue: \"#{SQS_CFG['queues'][0]}-moo\")\nrescue => e\n pp ['moo queue failed, saving payload to file', e, event_name]\n # write event and payload to file\n open('log/payload-cache.js', 'a') do |f|\n f << \"\\n//#{event_name}\\n\"\n f << event_data.to_json\n end\nend",
"def webhook\n @webhook = params\n logger.info \"Webhook recieved, data: #{@webhook}\"\n\n sweepstake = \"grand-national-2023\"\n emojis = [\"🐎\", \"🐴\", \"🏇\", \"horse\"]\n\n begin\n if @webhook[\"type\"] == \"transaction.created\" and emojis.include? @webhook[\"data\"][\"notes\"].strip.downcase and @webhook[\"data\"][\"amount\"] == 200\n logger.info \"This is a #{sweepstake} payment\"\n payee = @webhook[\"data\"][\"counterparty\"][\"name\"]\n logger.info \"from #{payee}\"\n\n project = \"pub-tracker-live\"\n base_url = \"https://firestore.googleapis.com/v1/projects/#{project}/databases/(default)/documents\"\n response = JSON.parse(RestClient.get(\"#{base_url}/sweepstakes/#{sweepstake}\").body)\n current_pot = response[\"fields\"][\"pot\"].values[0].to_f\n match = nil\n response = JSON.parse(RestClient.get(\"#{base_url}/users?pageSize=100&mask.fieldPaths=displayName&mask.fieldPaths=photoURL\").body)\n response[\"documents\"].each do |user|\n account = {\n user: user[\"fields\"][\"displayName\"][\"stringValue\"],\n userPhotoURL: user[\"fields\"][\"photoURL\"][\"stringValue\"]\n }\n if account[:user].strip.downcase.eql? payee.strip.downcase\n logger.info(\"who is #{account}\")\n match = account\n end\n end\n if match\n data = {\n \"fields\": {\n \"user\": { \"stringValue\": match[:user] },\n \"userPhotoURL\": { \"stringValue\": match[:userPhotoURL] }\n }\n }\n else\n data = {\n \"fields\": {\n \"user\": { \"stringValue\": payee },\n \"userPhotoURL\": { \"stringValue\": \"/flags/Monzo.png\" }\n }\n }\n end\n available_teams = []\n response = JSON.parse(RestClient.get(\"#{base_url}/sweepstakes/#{sweepstake}/teams?pageSize=100\").body)\n response[\"documents\"].each do |team|\n available_teams << team[\"name\"] if team[\"fields\"][\"user\"][\"stringValue\"] == \"TBC\"\n end\n if available_teams.length > 0\n url = \"https://firestore.googleapis.com/v1/#{available_teams.sample.gsub(\" \", \"%20\")}?updateMask.fieldPaths=user&updateMask.fieldPaths=userPhotoURL\"\n response = RestClient.patch(url, data.to_json, content_type: :json)\n logger.info response.body\n data = {\n \"fields\": {\n \"pot\": { \"doubleValue\": current_pot + 2 },\n }\n }\n response = RestClient.patch(\"#{base_url}/sweepstakes/#{sweepstake}?updateMask.fieldPaths=pot\", data.to_json, content_type: :json)\n logger.info response.body\n else\n logger.info \"No teams left for #{payee}, they will need a refund\"\n end\n else\n logger.info \"This is not a #{sweepstake} payment\"\n logger.info \"#{@webhook[\"type\"]} (#{@webhook[\"type\"] == \"transaction.created\"})\"\n logger.info \"#{@webhook[\"data\"][\"notes\"].strip.downcase} (#{emojis.include? @webhook[\"data\"][\"notes\"].strip.downcase})\"\n logger.info \"#{@webhook[\"data\"][\"amount\"]} (#{@webhook[\"data\"][\"amount\"] == 200})\"\n end\n rescue => e\n logger.info \"Error: #{e.message}\"\n end\n\n respond_to do |format|\n format.html # webook.html.erb\n format.json { render json: @webhook, callback: params[:callback] }\n format.xml { render xml: @webhook }\n end\n end",
"def failed_body\n %{\n responseEnvelope.ack=FAILURE&responseEnvelope.timestamp=2010-07-27T17%3a46%3a58&responseEnvelope.version=1.0&errorList.error(0).errorId=580028&errorList.error(0).message=A+URL+supplied+is+malformed&errorList.error(0).parameter=returnUrl&errorList.error(1).errorId=580029&errorList.error(1).message=A+required+parameter+was+not+provided&errorList.error(1).parameter=returnUrl&errorList.error(2).errorId=580028&errorList.error(2).message=A+URL+supplied+is+malformed&errorList.error(2).parameter=cancelUrl&errorList.error(3).errorId=580029&errorList.error(3).message=A+required+parameter+was+not+provided&errorList.error(3).parameter=cancelUrl&errorList.error(4).errorId=580029&errorList.error(4).message=A+required+parameter+was+not+provided&errorList.error(4).parameter=memo&errorList.error(5).errorId=580022&errorList.error(5).message=Invalid+parameter&errorList.error(5).parameter=memo&errorList.error(6).errorId=580022&errorList.error(6).message=Invalid+parameter&errorList.error(6).parameter=senderEmail&errorList.error(7).errorId=580029&errorList.error(7).message=A+required+parameter+was+not+provided&errorList.error(7).parameter=senderEmail&errorList.error(8).errorId=580029&errorList.error(8).message=A+required+parameter+was+not+provided&errorList.error(8).parameter=senderFirstname&errorList.error(9).errorId=580029&errorList.error(9).message=A+required+parameter+was+not+provided&errorList.error(9).parameter=senderLastname\n }\n end",
"def serialize_campaign_meta(campaign)\n {\n milestones: campaign\n .milestones\n .order(estimates_at: :desc)\n .map { |milestone| serialize_campaign_milestone(milestone) },\n total_invited_count: campaign.contributors.where.not(referrer: nil).count,\n early_bird_until: campaign.early_bird_until,\n estimate_first_releasing_in: campaign.estimate_first_releasing_in,\n estimate_end_releasing_in: campaign.estimate_end_releasing_in,\n first_releasing_percentage: campaign.first_releasing_percentage,\n estimate_releasing_days_interval: campaign.estimate_releasing_days_interval,\n estimate_releasing_percentage_per_interval: ((100 - campaign.first_releasing_percentage).to_d / (campaign.estimate_end_releasing_in - campaign.estimate_first_releasing_in).to_i * campaign.estimate_releasing_days_interval).to_f.truncate(4),\n contribution_chart: campaign.hourly_contributions.order(timestamp: :asc).limit(CHART_POINTS_LIMIT).pluck(:timestamp, :amount).map { |i| [i[0], i[1].to_f.truncate(4)] }\n }\n end",
"def request_data(code)\n request_data = {\n \"request\" => {\n \"passengers\" => {\n \"adultCount\" => \"1\"\n },\n \"slice\" => [\n {\n \"origin\" => \"OMA\",\n \"destination\" => code,\n \"date\" => (Date.today + 1).to_s\n }\n ],\n \"solutions\" => \"1\"\n }\n }\nend",
"def test_detect_json_auto_triggered_with_one_field\n setup_gce_metadata_stubs\n json_string = '{\"msg\": \"test log entry 0\", \"tag2\": \"test\", ' \\\n '\"data\": 5000, \"some_null_field\": null}'\n PRESERVED_KEYS_TIMESTAMP_FIELDS.each do |timestamp_fields|\n setup_logging_stubs do\n @logs_sent = []\n d = create_driver(DETECT_JSON_CONFIG)\n %w[message log msg].each do |field|\n d.emit(PRESERVED_KEYS_MAP.merge(\n field => json_string\n ).merge(timestamp_fields))\n end\n d.run\n end\n expected_params = COMPUTE_PARAMS.merge(\n labels: COMPUTE_PARAMS[:labels].merge(LABELS_MESSAGE)\n )\n verify_log_entries(3, expected_params, 'jsonPayload') do |entry|\n fields = entry['jsonPayload']\n assert_equal 4, fields.size, entry\n assert_equal 'test log entry 0', fields['msg'], entry\n assert_equal 'test', fields['tag2'], entry\n assert_equal 5000, fields['data'], entry\n assert_nil fields['some_null_field'], entry\n end\n end\n end",
"def element_to_result(e)\n result = Hash.new\n result['date'] = e.updated_at.strftime(\"%d-%m-%Y %H:%M\")\n result['user'] = e.user.email\n result['interaction'] = e.interaction.resource_type\n result\n end",
"def send_pulse\n require 'rest-client'\n\n response = RestClient.get 'http://gpdigital.crabdance.com/api/v0/aircast_status.php?location=all'\n response = JSON.parse(response)\n\n response.each do |d|\n\n d[\"last_active\"] = Time.zone.parse(d[\"LastAlive\"])\n d[\"beforetime\"] = Time.zone.parse(d[\"OpenTime\"])\n d[\"aftertime\"] = Time.zone.parse(d[\"CloseTime\"])\n now = DateTime.now\n unless now.between?(d[\"beforetime\"], d[\"aftertime\"])\n end\n end\n\n # variable = Mailjet::Send.create(messages: [{\n # 'From'=> {\n # 'Email'=> 'leo@palmsolutions.co',\n # 'Name'=> 'Leo'\n # },\n # 'To'=> [\n # {\n # 'Email'=> 'leo@palmsolutions.co',\n # 'Name'=> 'Leo Lope Lofranco'\n # }\n # ],\n # 'Subject'=> 'Aircast Pulse',\n # 'TextPart'=> 'Dear HGS, welcome to Mailjet! May the delivery force be with you!',\n # 'HTMLPart'=> '<h3>Dear passenger 1, welcome to Mailjet!</h3>≷br/>May the delivery force be with you!'\n # }]\n # )\n # p variable.attributes['Messages']\n end",
"def data_for flowcell_id\n script = ScriptPaths.lims_data\n lims_results = %x[#{script} #{flowcell_id}]\n lims_results.force_encoding(\"iso-8859-1\")\n data = {\"samples\" => []}\n unless lims_results =~ /^[F|f]lowcell not found/\n data = JSON.parse(lims_results)\n end\n data\n end",
"def save_with_all_properties data\n @heart_rate_array = []\n self.laps = []\n self.distance_m = 0\n self.sport = data['Activities']['Activity']['Sport']\n self.activity_id = data['Activities']['Activity']['Id']\n self[:start_time] ||= DateTime.parse(data['Activities']['Activity']['Id'])\n if data['Activities']['Activity']['Lap'].class == Array\n data['Activities']['Activity']['Lap'].each do |lap|\n parse_lap lap\n end\n else\n parse_lap data['Activities']['Activity']['Lap']\n end\n self.avg_heart_rate = @heart_rate_array.sum / @heart_rate_array.count\n self.trimp = calculate_trimp\n end",
"def collect_time_information\n ### Time information\n mark_data_time_information = Array.new\n time_information = @case_details[:case][:system][:time]\n\n mark_data_time_information << 'Answer the following about each time period present in the evidence on the system'\n time_information.each do | key, value | mark_data_time_information << \"-#{key.capitalize}::#{value}\"\n end\n mark_data_time_information << ''\n\n return mark_data_time_information\n end",
"def build\n\t {\n\t \tcampaign_name: advertiser_report['campaign_name'].tr(\"_\", \" \"),\n\t \tstart_date: campaign['start_on'],\n\t \tend_date: campaign['end_on'],\n\t \tmedia_budget: campaign['media_budget'],\n\t \tmedia_spent: advertiser_report['total_campaign_cost'],\n\t \timpressions: advertiser_report['impressions'],\n\t \tclicks: advertiser_report['clicks'],\n\t \tctr: advertiser_report['ctr'],\n\t \tconversions: advertiser_report['conversions'],\n\t \tecpm: calc_ecpm_for(advertiser_report),\n\t \tecpc: calc_ecpc_for(advertiser_report),\n\t \tecpa: calc_ecpa_for(advertiser_report),\n\t \tcreative_name: advertiser_report['creative_name']\n\t \t# spent:\n\t }\n\tend",
"def live_effort_data\n\n # Params should include at least splitId and bibNumber. Params may also include timeIn and timeOut.\n # This endpoint returns as many of the following as it can determine:\n # { effortId (integer), name (string), reportedText (string), dropped (bool), finished (bool),\n # timeFromLastReported (\"hh:mm\"), timeInAid (\"mm minutes\"), timeInExists (bool), timeOutExists (bool),\n # timeInStatus ('good', 'questionable', 'bad'), timeOutStatus ('good', 'questionable', 'bad') }\n\n if @event.available_live\n reporter = LiveDataEntryReporter.new(event: @event, params: params)\n render json: reporter.full_report\n else\n render json: live_entry_unavailable(@event), status: :forbidden\n end\n end",
"def hash\n [new_businessunitid, campaign_id, description, objective, new_url_script, new_url_menu, new_url_pricelist, new_min_interval, new_logic_number_1, new_logic_number_2, new_logic_number_3, new_logic_number_4, new_next_data, new_next_newcustomer, new_next_timezones, new_types_campaing, new_next_oldcustomer, new_redial_max, new_system_auto_avaya, new_apc_job, new_personal_phonecall, new_nedozvon_max, new_count_phonecall_log, new_maxday_callback, new_customertimefrom, new_customertimeto, new_interactive_script, new_isdemo_access, call_count, sub_type, sub_type_name, name, summary_call_count, my_call_count].hash\n end",
"def json_fields\n\n mappings = {}\n\n json = self.record.json\n if !json\n return mappings\n end\n\n mappings['language'] = json['language']\n\n if json['notes']\n json['notes'].each do |note|\n if note['type'] == 'physloc' and !note['content'].blank?\n mappings['physical_location_note'] = note['content'].map { |cont| \"#{cont}\" }.join(\"; \")\n end\n end\n end\n\n if json['dates']\n json['dates']\n .select { |date| date['expression'].present? }\n .group_by { |date| date['label'] }\n .each { |label, dates|\n mappings[\"#{label}_date\"] = dates\n .map { |date| date['expression'] }\n .join(\"; \")\n }\n end\n\n mappings['restrictions_apply'] = json['restrictions_apply']\n mappings['display_string'] = json['display_string']\n\n instances = json.fetch('instances', false)\n if !instances\n return mappings\n end\n\n mappings['requests'] = instances\n .select{ |instance| !instance['digital_object'] }\n .each_with_index\n .map { |instance, i|\n request = {}\n\n instance_count = i + 1\n\n request['Request'] = \"#{instance_count}\"\n\n request[\"instance_is_representative_#{instance_count}\"] = instance['is_representative']\n request[\"instance_last_modified_by_#{instance_count}\"] = instance['last_modified_by']\n request[\"instance_instance_type_#{instance_count}\"] = instance['instance_type']\n request[\"instance_created_by_#{instance_count}\"] = instance['created_by']\n\n container = instance['sub_container']\n if container\n request[\"instance_container_grandchild_indicator_#{instance_count}\"] = container['indicator_3']\n request[\"instance_container_child_indicator_#{instance_count}\"] = container['indicator_2']\n request[\"instance_container_grandchild_type_#{instance_count}\"] = container['type_3']\n request[\"instance_container_child_type_#{instance_count}\"] = container['type_2']\n\n request[\"instance_container_last_modified_by_#{instance_count}\"] = container['last_modified_by']\n request[\"instance_container_created_by_#{instance_count}\"] = container['created_by']\n\n top_container = container['top_container']\n if top_container\n request[\"instance_top_container_ref_#{instance_count}\"] = top_container['ref']\n\n top_container_resolved = top_container['_resolved']\n if top_container_resolved\n request[\"instance_top_container_long_display_string_#{instance_count}\"] = top_container_resolved['long_display_string']\n request[\"instance_top_container_last_modified_by_#{instance_count}\"] = top_container_resolved['last_modified_by']\n request[\"instance_top_container_display_string_#{instance_count}\"] = top_container_resolved['display_string']\n request[\"instance_top_container_restricted_#{instance_count}\"] = top_container_resolved['restricted']\n request[\"instance_top_container_created_by_#{instance_count}\"] = top_container_resolved['created_by']\n request[\"instance_top_container_indicator_#{instance_count}\"] = top_container_resolved['indicator']\n request[\"instance_top_container_barcode_#{instance_count}\"] = top_container_resolved['barcode']\n request[\"instance_top_container_type_#{instance_count}\"] = top_container_resolved['type']\n request[\"instance_top_container_uri_#{instance_count}\"] = top_container_resolved['uri']\n\n collection = top_container_resolved['collection']\n if collection\n request[\"instance_top_container_collection_identifier_#{instance_count}\"] = collection\n .select { |c| c['identifier'].present? }\n .map { |c| c['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_collection_display_string_#{instance_count}\"] = collection\n .select { |c| c['display_string'].present? }\n .map { |c| c['display_string'] }\n .join(\"; \")\n end\n\n series = top_container_resolved['series']\n if series\n request[\"instance_top_container_series_identifier_#{instance_count}\"] = series\n .select { |s| s['identifier'].present? }\n .map { |s| s['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_series_display_string_#{instance_count}\"] = series\n .select { |s| s['display_string'].present? }\n .map { |s| s['display_string'] }\n .join(\"; \")\n end\n\n end\n end\n end\n\n request\n }\n\n return mappings\n end",
"def filter(event)\n\n input_log = event.get(@source_field)\n\n # tag if field isn't present\n if input_log.nil?\n event.set(\"VALID\", '0')\n event.tag(\"source_field_is_nil\")\n return [event]\n end\n\n if input_log.empty?\n event.set(\"VALID\", '0')\n event.tag(\"source_field_is_empty\")\n return [event]\n end\n\n # parsing\n parsed_log = parse_mail_log(input_log)\n\n # drop if not valid log\n if parsed_log.nil?\n event.set(\"VALID\", '0')\n event.tag(\"parsed_unavailable\")\n return []\n end\n\n # mc 필드는 반드시 값이 있어야 함\n if parsed_log[\"MC\"].nil?\n event.set(\"VALID\", '0')\n event.tag(\"parsed_unavailable\")\n return []\n end\n\n # set event\n parsed_log.keys.each do |key_field|\n # 원래 필드명의 소문자명과 해당 값을 키-밸류로 매핑하여 event에 입력\n event.set(\"#{key_field.downcase}\", parsed_log[key_field])\n end\n event.set(\"VALID\", '1')\n\n # puts \"---- test ----\"\n # puts \">> parsed_log :\\n#{parsed_log}\"\n\n # return event\n [event]\nend",
"def webhook_example_event(sample_name)\n data = webhook_example_events(sample_name).first\n if data['raw_params'] && (mandrill_events_data = data['raw_params']['mandrill_events'])\n data['raw_params']['mandrill_events'] = URI.decode_www_form_component(mandrill_events_data)\n end\n data\n end",
"def hash\n [active, category_id, category_specifics, condition_description, condition_id, consecutive_failures, custom_category1, custom_category2, dispatch_time_max, domestic_1_additional_cost, domestic_1_first_cost, domestic_2_additional_cost, domestic_2_first_cost, domestic_3_additional_cost, domestic_3_first_cost, domestic_4_additional_cost, domestic_4_first_cost, ebay_auction_id, ebay_specific_inventory, ebay_template_name, ebay_template_oid, end_time, free_shipping, free_shipping_method, international_1_additional_cost, international_1_first_cost, international_2_additional_cost, international_2_first_cost, international_3_additional_cost, international_3_first_cost, international_4_additional_cost, international_4_first_cost, last_status_dts, listed_dispatch_time_max, listed_ebay_template_oid, listing_dts, listing_duration, listing_price, listing_price_override, listing_type, marketplace_analysis, marketplace_analysis_perform, marketplace_final_value_fee_percentage, marketplace_last_check_dts, marketplace_lowest, marketplace_map_violation, marketplace_multiplier, marketplace_other_price, marketplace_other_seller, marketplace_other_shipping, marketplace_other_total, marketplace_our_additional_profit_potential, marketplace_our_price, marketplace_our_profit, marketplace_our_shipping, marketplace_our_total, marketplace_overhead, marketplace_profitable, next_attempt_dts, next_listing_duration, no_promotional_shipping, packaging_handling_costs, previous_ebay_auction_id, quantity, reserve_price, send_dimensions_and_weight, start_time, status, target_dispatch_time_max].hash\n end",
"def receive\n # I chose to store the whole webhook response, as well as breaking out\n # certain pieces of it into columns on the Webhooks model. IMO, it makes\n # things a bit more easy to read and work with.\n\n # Storing the whole webhook might not be the best solution here, but in\n # the future, if something from the original webhook was needed, we have\n # record of it and can find/work with it.\n data = JSON.parse(request.body.read)\n event = data['payload']['event']\n event_name = data['payload']['event_type']['name']\n start_time = event['start_time']\n end_time = event['end_time']\n\n canceled = event['canceled']\n canceler = event['canceler_name']\n cancel_reason = event['cancel_reason']\n canceled_at = event['canceled_at']\n\n invitee = data['payload']['invitee']\n invitee_name = invitee['name']\n invitee_email = invitee['email']\n\n Webhook.create(\n data: data.as_json, \n canceled: canceled,\n event_name: event_name,\n start_time: start_time,\n end_time: end_time,\n canceler: canceler,\n cancel_reason: cancel_reason,\n canceled_at: canceled_at,\n invitee_name: invitee_name,\n invitee_email: invitee_email)\n end",
"def group_time_accounted_hash(params,tcol)\r\n lookup_activities = current_company.company_activity_types\r\n activities = ReportsHelper.get_lookups(lookup_activities)\r\n conditions,data,total_data,table_headers = {},[],{},[]\r\n duration,billamount,discount,override,finalamount = 0,0,0,0,0\r\n if params[:report][:selected] == \"matter\"\r\n\r\n tcol.group_by(&:matter_id).each do|label,col|\r\n key = nil\r\n client = nil\r\n col.each do |obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n if !key and obj.matter\r\n key = obj.matter.clipped_name\r\n client = \" Contact : \" + (obj.matter.contact ? obj.matter.contact.name : \"\")\r\n end\r\n duration += actual_duration.to_f if actual_duration\r\n billamount = billamount + (obj.actual_activity_rate * actual_duration.to_f)\r\n discount += obj.billing_percent if obj.billing_percent\r\n override += obj.final_billed_amount if obj.billing_method_type == 3\r\n finalamount += obj.final_billed_amount if obj.final_billed_amount\r\n\r\n\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize),actual_duration,activities[obj.activity_type],obj.is_billable ? \"Yes\" : \"No\",obj.actual_activity_rate,obj.actual_activity_rate * actual_duration.to_f,obj.billing_percent,obj.billing_method_type == 3 ? obj.final_billed_amount : '',obj.final_billed_amount]\r\n end\r\n next unless key\r\n total_data[key] = data\r\n conditions[key] = client\r\n\r\n data = []\r\n end\r\n conditions[:entries] = [duration,billamount,discount,override,finalamount]\r\n column_widths = { 0 => 60, 1 => 80, 2 => 80 , 3 => 120 , 4 => 60 , 5 => 60 , 6 => 60 ,7 => 70 , 8 => 60 , 9 => 60}\r\n table_headers = [t(:label_date),t(:text_lawyer),t(:label_duration_hrs),t(:text_activity_type),t(:text_billable),\"Rate/hr($)\",\"#{t(:text_bill)} #{t(:text_amt)}\",t(:text_discount_p),\"#{t(:text_override)} #{t(:text_amt)}\",\"#{t(:label_final_bill)} #{t(:text_amt)}\"]\r\n alignment = { 0 => :right, 1 => :right} if params[:format] == \"pdf\"\r\n elsif params[:report][:selected] == \"contact\"\r\n tcol.group_by(&:contact_id).each do|label,col|\r\n key = nil\r\n\r\n col.each do |obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n if !key and obj.contact\r\n key = obj.contact.name\r\n\r\n end\r\n duration += actual_duration.to_f if actual_duration\r\n billamount = billamount + (obj.actual_activity_rate * actual_duration.to_f)\r\n discount += obj.billing_percent if obj.billing_percent\r\n override += obj.final_billed_amount if obj.billing_method_type == 3\r\n finalamount += obj.final_billed_amount if obj.final_billed_amount\r\n\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize),obj.matter ? obj.matter.clipped_name : \"\",actual_duration,activities[obj.activity_type],obj.is_billable ? \"Yes\" : \"No\",obj.actual_activity_rate,obj.actual_activity_rate * actual_duration.to_f,obj.billing_percent,obj.billing_method_type == 3 ? obj.final_billed_amount : '',obj.final_billed_amount]\r\n end\r\n next unless key\r\n total_data[key] = data\r\n\r\n data = []\r\n end\r\n conditions[:entries] = [duration,billamount,discount,override,finalamount]\r\n column_widths = { 0 => 60, 1 => 80, 2 => 80 , 3 => 60 , 4 => 80 , 5 => 60 , 6 => 60 ,7 => 60 , 8 => 70 , 9 => 60,10 => 60}\r\n table_headers = [t(:label_date),t(:text_lawyer),t(:text_matter),t(:label_duration_hrs),t(:text_activity_type),t(:text_billable),\"#{t(:label_rate_hr)}\",\"#{t(:text_bill)} #{t(:text_amt)}\",t(:text_discount_p),\"#{t(:text_override)} #{t(:text_amt)}\",\"#{t(:label_final_bill)} #{t(:text_amt)}\"]\r\n end\r\n\r\n [total_data,conditions,table_headers,column_widths, alignment]\r\n\r\n end",
"def http_raw_notify_data\n {\n \"id\"=>\"b9879d2b-052f-4a0a-8a3f-3e72049e4d19\", \n \"event\"=>\"invoice_paid\", \n \"payload\"=> invoice_data\n }.to_json\n end",
"def hash\n [click_rate_formatted, created_dts, deleted, email_campaign_uuid, email_communication_sequence_uuid, end_once_customer_purchases, end_once_customer_purchases_anywhere, esp_campaign_folder_uuid, esp_domain_user, esp_domain_uuid, esp_friendly_name, library_item_oid, memberships, merchant_id, name, open_rate_formatted, prevent_sending_due_to_spam, revenue_formatted, revenue_per_customer_formatted, scheduled_dts, screenshot_large_full_url, sms_esp_twilio_uuid, sms_phone_number, status, status_dts, storefront_oid].hash\n end",
"def clean_update(data, parameter_hash)\n\n factory = RGeo::Geographic.simple_mercator_factory(:srid => 4326)\n\n for item in data\n\n # Record event source\n item['miner_data_source'] = parameter_hash['source']\n\n\n # Clean Location Data for filtering before formatting\n raw_location = item[parameter_hash['location']]\n\n longitude = raw_location['coordinates'][0]\n latitude = raw_location['coordinates'][1]\n\n rgeo_point = factory.point(longitude, latitude)\n\n item['rgeo_location'] = factory.collection([rgeo_point])\n\n\n # Clean Time Field\n if parameter_hash['source'] == 'san_francisco'\n\n time = Time.strptime(item['time'], '%H:%M')\n date = DateTime.parse(item['date'])\n\n item['ruby_date_time'] = DateTime.new(date.year, date.month, \n date.day, time.hour, time.min, time.sec, time.zone)\n\n # Other 2 timefields are uniform\n else\n\n date_key = parameter_hash['fields']['date']\n\n no_utc_time = DateTime.parse(item[date_key])\n\n item['ruby_date_time'] = no_utc_time.new_offset('-08:00')\n\n end\n\n end\n\n return data\n\nend",
"def condition(response)\ncondition = response.condition['text']\nend",
"def history_data\n @id = params[:id]\n @item_history = []\n @item_name = @item_names[@id.to_i]\n json_str = Net::HTTP.get(URI.parse(\"http://#{THINGSPEAK_SERVER}/channels/#{OT_CHANNEL}/feed.json?results=200\")) \n parsed_hash = ActiveSupport::JSON.decode(json_str)\n parsed_hash[\"feeds\"].each do |e|\n if e[\"field1\"] == @id\n item = {}\n t = Time.strptime(e[\"created_at\"], \"%FT%T%z\")\n item[\"time\"] = t.strftime(\"%b %d, %Y %H:%M:%S\")\n item[\"curr_loc\"] = e[\"field4\"]\n @item_history.push(item)\n end\n end\n\n render :template => \"static/history_data\", :formats => [:json], :handlers => \"haml\", :layout => false\n end",
"def webhook_payload\n {}\n end",
"def extract_raw_flights_from_json(json)\n if json[:FlightList] && json[:FlightList][:Flight]\n json[:FlightList][:Flight]\n else\n []\n end\n end",
"def index\n if params[:type] == \"t_webhooks\"\n redirect_to t_webhooks_path(:start_date => params[:start_date], :end_date => params[:end_date], :event => params[:event], \n :type => \"t_webhooks\") \n return\n end\n \n set_dates\n set_ip_list\n \n @count_array = []\n @this_event = params[:event] || \"unique_opened\"\n @event_list = [@this_event,\"sent\"]\n @esp_list = [\"gmail\",\"hotmail\",\"yahoo\",\"other\"]\n @esp_list.each_with_index do |esp, esp_index|\n @count_array[esp_index] = []\n 2.times do |j|\n @count_array[esp_index][j] = MWebhook.where(\"date_sent >= ? AND date_sent <= ?\", @start_date, @end_date)\n .send(esp).send(@event_list[j])\n .group('date_sent', 'sending_ip').count\n end\n end\n end",
"def extract_fields\n @assets.each do |value| \n online_only = value['is_asset_online_event']\n if !online_only\n next if @online_auctions_only == true # save only online events\n end\n asset = get_required_fields(value,@required_fields)\n asset[:listed_date] = DateTime.now.strftime('%Y-%m-%d')\n asset[:end_date] = asset[:start_date] #because auction end date has not been specified in json object\n if value['buying_format'].strip == 'auction'\n asset[:auction] = true \n else\n asset[:auction] = false \n end\n next if asset[:current_price].nil? #Don't save assets who's price have not been set\n asset[:internet_sale] = online_only.nil? ? true : false\n asset[:img_large] = get_resource_link(asset[:img_large])\n asset[:img_thumbnail] = get_resource_link(asset[:img_thumbnail]) \n if value['auction_type'] == 'residential'\n asset[:residential] = true\n else\n asset[:residential] = false\n end\n log(\"Fetched property #{asset[:source_asset_id]} from #{@home_url}\")\n #check for field/parse errors here before pushing\n @assets_extracted.push(asset)\n end\n end",
"def service_response_data\n {\n webhook: @client_webhook_setting.get_hash\n }\n end",
"def controlfield_008(json, xml)\n created_maint_events = json['agent_maintenance_histories'].select { |amh| amh['maintenance_event_type'] == 'created' }\n pos0_5 = if created_maint_events.any?\n created_maint_events.first['event_date'].strftime('%y%m%d')\n else\n '000000'\n end\n\n if json['agent_record_controls']&.any?\n arc = json['agent_record_controls'].first\n case arc['romanization']\n when 'int_std'\n pos_7 = 'a'\n when 'nat_std'\n pos_7 = 'b'\n when 'nl_assoc_std'\n pos_7 = 'c'\n when 'nl_bib_agency_std'\n pos_7 = 'd'\n when 'local_standard'\n pos_7 = 'e'\n when 'unknown_standard'\n pos_7 = 'f'\n when 'conv_rom_cat_agency'\n pos_7 = 'g'\n when 'not_applicable'\n pos_7 = 'n'\n end\n\n pos_8 = if arc['language']['eng']\n 'e'\n elsif arc['language']['fre']\n 'f'\n else\n '|'\n end\n\n case arc['government_agency_type']\n when 'ngo'\n pos_28 = ' '\n when 'sac'\n pos_28 = 'a'\n when 'multilocal'\n pos_28 = 'c'\n when 'fed'\n pos_28 = 'f'\n when 'int_gov'\n pos_28 = 'I'\n when 'local'\n pos_28 = 'l'\n when 'multistate'\n pos_28 = 'm'\n when 'undetermined'\n pos_28 = 'o'\n when 'provincial'\n pos_28 = 's'\n when 'unknown'\n pos_28 = 'u'\n when 'other'\n pos_28 = 'z'\n when 'natc'\n pos_28 = '|'\n end\n\n case arc['reference_evaluation']\n when 'tr_consistent'\n pos_29 = 'a'\n when 'tr_inconsistent'\n pos_29 = 'b'\n when 'not_applicable'\n pos_29 = 'n'\n when 'natc'\n pos_29 = '|'\n end\n\n case arc['name_type']\n when 'differentiated'\n pos_32 = 'a'\n when 'undifferentiated'\n pos_32 = 'b'\n when 'not_applicable'\n pos_32 = 'n'\n when 'natc'\n pos_32 = '|'\n end\n\n case arc['level_of_detail']\n when 'fully_established'\n pos_33 = 'a'\n when 'memorandum'\n pos_33 = 'b'\n when 'provisional'\n pos_33 = 'c'\n when 'preliminary'\n pos_33 = 'd'\n when 'not_applicable'\n pos_33 = 'n'\n when 'natc'\n pos_33 = '|'\n end\n\n case arc['modified_record']\n when 'not_modified'\n pos_38 = ' '\n when 'shortened'\n pos_38 = 's'\n when 'missing_characters'\n pos_38 = 'x'\n when 'natc'\n pos_38 = '|'\n end\n\n case arc['cataloging_source']\n when 'nat_bib_agency'\n pos_39 = ' '\n when 'ccp'\n pos_39 = 'c'\n when 'other'\n pos_39 = 'd'\n when 'unknown'\n pos_39 = 'u'\n when 'natc'\n pos_39 = '|'\n end\n else\n pos_7 = '|'\n pos_8 = '|'\n pos_28 = '|'\n pos_29 = '|'\n pos_32 = '|'\n pos_33 = '|'\n pos_38 = '|'\n pos_39 = '|'\n end\n\n xml.controlfield(tag: '008') do\n xml.text \"#{pos0_5}n#{pos_7}#{pos_8}aznnnaabn #{pos_28}#{pos_29} a#{pos_32}#{pos_33} #{pos_38}#{pos_39}\"\n end\n end",
"def slack_message\n [\n {\n type: 'section',\n text: {\n type: 'mrkdwn',\n text: \"Performed #{@item_count} fixity #{'check'.pluralize(@item_count)} \" \\\n \"in #{@job_time} seconds on #{fixity_host}\"\n },\n fields: [\n { type: 'mrkdwn', text: ':white_check_mark: *Successes*' },\n { type: 'mrkdwn', text: ':warning: *Failures*' },\n { type: 'plain_text', text: (@item_count - @errors).to_s },\n { type: 'plain_text', text: @errors.to_s }\n ]\n }\n ]\n end",
"def invoice_data\n {\n \"id\"=>\"050b550a-1f4d-4c1e-a0b7-7d9a27e44c4a\",\n \"status\"=>\"ready_to_ship\", \n \"payment_address\"=>\"bitcoin_public_address\", \n \"price\"=>\"0.00012350\", \n \"price_currency\"=>\"BTC\", \n \"base_price\"=>\"31.66\", \n \"base_price_currency\"=>\"USD\", \n \"spot_rate\"=>\"0.00123504\", \n \"usd_spot_rate\"=>\"1.0\", \n \"crypto_payout_split\"=>80, \n \"confirmations_required\"=>6, \n \"notification_level\"=>nil, \n \"redirect_url\"=>\"http://test_redirect_url.com\", \n \"order_id\"=>\"237\", \n \"item_name\"=>nil, \n \"item_sku\"=>nil, \n \"item_description\"=>nil, \n \"physical\"=>nil, \n \"customer_name\"=>\"Customer Name\", \n \"customer_address_1\"=>nil, \n \"customer_address_2\"=>nil, \n \"customer_city\"=>nil, \n \"customer_region\"=>nil, \n \"customer_country\"=>nil, \n \"customer_postal_code\"=>nil, \n \"customer_email\"=>nil, \n \"customer_phone\"=>nil, \n \"user_defined_1\"=>nil, \n \"user_defined_2\"=>nil, \n \"user_defined_3\"=>nil, \n \"user_defined_4\"=>nil, \n \"user_defined_5\"=>nil, \n \"user_defined_6\"=>nil, \n \"user_defined_7\"=>nil, \n \"user_defined_8\"=>nil, \n \"data\"=>nil, \n \"expires_at\"=>\"2014-01-24T00:01:03.602Z\", \n \"created_at\"=>\"2014-01-23T23:46:03.997Z\", \n \"updated_at\"=>\"2014-01-23T23:49:40.777Z\", \n \"server_time\"=>\"2014-01-24T00:26:39Z\", \n \"callback_url\"=>\"test_redirect_url.com/notify/237\", \n \"merchant_id\"=>\"d91c8756-5174-4388-b4e0-8c3593529a32\"\n }\n end",
"def data\n timestamp = @timestamp.call\n time_str = @time_str.call\n @data ||= listings.map do |listing|\n {\n id: listing['id'],\n timestamp: timestamp,\n time_str: time_str,\n title: listing.css('h2 > a > span.atcui-truncate.ymm > span').text,\n # price: listing.css('.primary-price').text.delete(\"$\").delete(\",\"),\n price: listing.css('.primary-price span').text.delete(\"$\").delete(\",\"),\n mileage: listing.css('.mileage .atcui-bold').text.delete(\",\"),\n color: listing.css('.color .atcui-block').text,\n distance: listing.css('.distance-cont').text.split(' ')[0],\n image: listing.css('.media-img').css('img')[0]['src'],\n link: \"http://www.autotrader.com#{listing.css('a').first['href']}\"\n }\n end\n end",
"def transform_data(data)\n data.select! { |key, _| %w[type availability].include?(key.to_s) }\n\n return unless data['type'] == 'weekly'\n\n availability = data['availability']\n return unless availability\n\n availability.each do |week, value|\n return nil unless schedule_days.include?(week)\n\n availability[week] = ['true', true].include? value\n end\n\n data\n end",
"def service_response_data\n {\n webhook: @client_webhook_setting.get_hash,\n test_send_id: lock_id\n }\n end",
"def valid_send_properties\n {\n :$user_id => $user_id,\n\t :$send_to => $user_id,\n :$verification_type => '$email',\n :$brand_name => 'all',\n :$language => 'en',\n :$event => {\n :$session_id => 'gigtleqddo84l8cm15qe4il',\n :$verified_event => '$login',\n :$reason => '$automated_rule',\n :$ip => '192.168.1.1',\n :$browser => {\n :$user_agent => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'\n }\n }\n }\nend",
"def hash\n [date, campaign_revenue, total_campaign_revenue, campaign_refund, total_campaign_refund, campaign_discount_costs, total_campaign_discount_costs, campaign_refunded_discounts, total_campaign_refunded_discounts, campaign_free_items, total_campaign_free_items, coupon_redemptions, total_coupon_redemptions, coupon_rolledback_redemptions, total_coupon_rolledback_redemptions, referral_redemptions, total_referral_redemptions, coupons_created, total_coupons_created, referrals_created, total_referrals_created, added_loyalty_points, total_added_loyalty_points, deducted_loyalty_points, total_deducted_loyalty_points].hash\n end",
"def analyze(_evidence, _current)\n {\n # Your return has to go here. This reformats the hashed return into\n # chief understands. Remember the output must corrospond to one of the\n # values in the database structure.\n # Typically This would be in the form.\n\n # blank_status:\n # {\n # value: 'Met', # or Unmet\n # confidence: 3, # or what ever you think it should be.\n # explanation: \"My Text to appear in the evidence field\"\n # }\n }\n end",
"def campaign_debug\n days_between_calls = AdminSetting.find_by_name(\"Days between calls\").present? ? AdminSetting.find_by_name(\"Days between calls\").value : 3\n sql = \"\n select\n a.minutes,\n de.did_e164,\n dep.title clec,\n a.carrier_title\n from data_entryway de\n inner join data_entryway_provider dep on de.entryway_provider = dep.id\n left join (\n select\n sc.entryway_id,\n dlac.title carrier_title,\n sum(sc.seconds / 60) minutes\n from summary_call sc\n inner join data_listener_ani_carrier dlac on dlac.id = sc.listener_ani_carrier_id\n where sc.date >= '#{(DateTime.now - 1.day).strftime(\"%Y-%m-%d\")}'\n and sc.date < '#{DateTime.now.strftime(\"%Y-%m-%d\")}'\n group by sc.entryway_id\n ) a on de.id = a.entryway_id\n left join reachout_tab_mapping_rule rtmr on dep.title = rtmr.entryway_provider and a.carrier_title = rtmr.carrier_title\n where de.is_deleted = 0\n and substr(de.did_e164,1,4) not in ('1600','1700')\n and dep.title in\n (\n select distinct rtmr2.entryway_provider\n from reachout_tab_mapping_rule rtmr2\n )\n and de.gateway_id = '#{params[:gateway_id]}'\n group by de.entryway_provider\n order by a.minutes desc\n \"\n clecs = ActiveRecord::Base.connection.execute(sql).to_a\n sql = \"SELECT rtlmg.ani_e164,rtlmg.carrier_title,rtmr.entryway_provider FROM\n `reachout_tab_listener_minutes_by_gateway` as rtlmg\n LEFT JOIN reachout_tab_mapping_rule as rtmr on rtmr.carrier_title = rtlmg.carrier_title \n WHERE gateway_id = #{params[:gateway_id]} AND rtlmg.ani_e164 NOT IN\n (SELECT phone_number FROM admin_dnc_list) AND rtlmg.ani_e164 NOT IN \n (SELECT phone_number FROM reachout_tab_campaign_listener WHERE\n DATE(campaign_date)> '#{(DateTime.now - days_between_calls.to_i.days).strftime(\"%Y-%m-%d\")}')\n AND rtlmg.ani_e164 != '' AND length(rtlmg.ani_e164) = 11\n GROUP BY rtmr.entryway_provider\"\n grouped_listeners = ActiveRecord::Base.connection.execute(sql).to_a\n render json: {station_clec: clecs, listener_clecs: grouped_listeners.map{|x| x[2]}}\n end",
"def received_at\n params[:json]['message_time']\n end",
"def format_realtime message\n message[\"dsb\"] = message[\"dsb\"].to_i\n \n message[\"tmpr\"] = message[\"tmpr\"].to_f if message[\"tmpr\"]\n message[\"tmprC\"] = message[\"tmprC\"].to_f if message[\"tmprC\"]\n message[\"tmprF\"] = message[\"tmprF\"].to_f if message[\"tmprF\"]\n \n message[\"sensor_num\"] = message.delete(\"sensor\").to_i\n message[\"sensor_type\"] = message.delete(\"type\").to_i\n\n message[\"time\"] = Time.parse(message[\"time\"])\n message[\"radio_id\"] = message.delete(\"id\").to_i\n\n total_watts = 0\n # Format the channel watts\n if ch1 = message.delete(\"ch1\")\n message[\"ch1_watts\"] = ch1[\"watts\"].to_i \n total_watts += message[\"ch1_watts\"]\n end\n if ch2 = message.delete(\"ch2\")\n message[\"ch2_watts\"] = ch2[\"watts\"].to_i\n total_watts += message[\"ch2_watts\"]\n end\n if ch3 = message.delete(\"ch3\")\n message[\"ch3_watts\"] = ch3[\"watts\"].to_i \n total_watts += message[\"ch3_watts\"]\n end\n\n message[\"total_watts\"] = total_watts\n \n message\n end",
"def m_webhook_params\n params.require(:m_webhook).permit(:event, :email, :hook_id, :camp_id, :campaign_name, :date_sent, :date_event, :ts_event, :ts_sent, :tag, :url, :sending_ip, :esp, :uer, :reason, :ts, :origin_id, :list_id)\n end",
"def hash\n [created, customer_impact_duration, customer_impact_end, customer_impact_scope, customer_impact_start, customer_impacted, detected, fields, modified, notification_handles, public_id, resolved, time_to_detect, time_to_internal_response, time_to_repair, time_to_resolve, title].hash\n end",
"def campaigns_analytics_async\n month_ago = Date.today - 29.days\n campaign_ids = current_organization.campaigns.pluck(:id)\n\n ca = CampaignAnalytic.where(campaign_id: campaign_ids).where('created_at >= ?', month_ago)\n\n campaigns_data = ca.map { |x| {created_at: x.created_at, sent_sms: x.sent_sms}}\n\n people_reached_data = []\n daily_sent_sms = []\n ((Date.today - 29.days)..Date.today).each do |date|\n new_date = date.to_time.to_i * 1000\n\n campaign_data_select = campaigns_data.select { |t| t[:created_at].to_date == date }\n\n sms_sent_sum = campaign_data_select.map { |x| x[:sent_sms] }.sum\n\n if daily_sent_sms.empty?\n daily_sent_sms.push({x: new_date, y: 0})\n else\n daily_sent_sms.push({x: new_date, y: (sms_sent_sum-people_reached_data.last[:y])})\n end\n\n people_reached_data.push({ x: new_date, y: sms_sent_sum })\n end\n\n render json: [\n {\n values: people_reached_data,\n key: I18n.t('analytics.campaigns.sms_sent'),\n color: \"#2ca02c\"\n },\n {\n values: daily_sent_sms,\n key: I18n.t('analytics.campaigns.daily_sms_sent'),\n color: \"#00ff99\"\n }\n ], root: false\n\n end",
"def extract_message(item)\n # message = item[\"message\"]\n # timestamp = DateTime.parse(item[\"@timestamp\"]).strftime(\"%Y-%m-%d %H:%M:%S\") rescue nil\n # from = REGEX_EMAIL.match(REGEX_FROM_EMAIL.match(message)[0])[0] rescue nil\n # to = REGEX_EMAIL.match(REGEX_TO_EMAIL.match(message)[0])[0] rescue nil\n # status = REGEX_STATUS.match(message)[0].split(\"=\")[1] rescue nil\n # subject = REGEX_SUBJECT.match(message)[0].split(\" \")[1..-2].join(\" \") rescue nil\n # error_message = ( status == \"deferred\" || status == \"bounced\" ) ? ( REGEX_ERROR_MESSAGE.match(message)[0] rescue nil ) : nil\n { :timestamp => item[:timestamp],\n :status => item[:status],\n :from => item[:from] ,\n :to => item[:to] ,\n :subject => item[:subject],\n }.merge( item[:error_message] ? { error_message: item[:error_message].split(\" \")[1..-1].join(\" \") } : {})\n end",
"def hash\n [account_id, campaign_id, csp_id, reseller_id, status, create_date, auto_renewal, billed_date, brand_id, usecase, sub_usecases, description, embedded_link, embedded_phone, affiliate_marketing, number_pool, age_gated, direct_lending, subscriber_optin, subscriber_optout, subscriber_help, sample1, sample2, sample3, sample4, sample5, message_flow, help_message, reference_id, mock, next_renewal_or_expiration_date].hash\n end",
"def build_analytics_events_payload\n events = []\n 1000.times do\n event = {\n 'timestamp' => Process.clock_gettime(Process::CLOCK_REALTIME),\n 'name' => +'Controller/foo/bar',\n 'type' => +'Transaction',\n 'duration' => rand,\n 'databaseDuration' => rand,\n 'databaseCallCount' => rand,\n 'gcCumulative' => rand,\n 'host' => +'lo-calhost',\n 'color' => +'blue-green',\n 'shape' => +'squarish',\n 'texture' => +'sort of lumpy like a bag of frozen peas'\n }\n events << [event, {}]\n end\n [rand(1000000), events]\n end",
"def process_shot_result(shot_result)\n shot_result.split(/:|\\s/).each_slice(2) do |location, result|\n field[location] = result.to_sym \n has_hit(location) if field[location] == :hit\n end\n end",
"def cfapi(events)\n messages = []\n\n # For each event\n events.each do |event|\n # Create an outbound event; this can be serialized to json and sent\n event_hash = {\n 'timestamp' => timestamp_in_milliseconds(event.get('@timestamp')),\n 'text' => (event.get('message') or ''),\n }\n\n # Map fields from the event to the desired form\n event_hash['fields'] = merge_hash(event.to_hash)\n .reject { |key,value| @adjusted_fields.has_key?(key) and @adjusted_fields[key] == nil } # drop banned fields\n .map {|k,v| [ @adjusted_fields.has_key?(k) ? @adjusted_fields[k] : k,v] } # rename fields\n .map {|k,v| { 'name' => (safefield(k)), 'content' => v } } # Convert a hashmap {k=>v, k2=>v2} to a list [{name=>k, content=>v}, {name=>k2, content=>v2}]\n\n messages.push(event_hash)\n end # events.each do\n\n { 'events' => messages } # Framing required by CFAPI.\n end",
"def caliper_count(event_name, sent, expected)\n \n # original hash, cloned, compact (no nil), strings, keys\n copy_sent = sent.clone.compact.stringify_keys.keys\n copy_expected = expected.clone.stringify_keys.keys\n \n # what's missing, get the difference\n missing = copy_sent - copy_expected # | copy_expected - copy_sent\n missing = missing.reject { |k| ['id'].include? k }\n if missing.size.positive?\n sample = missing.map { |k| \"#{k}:::#{sent.fetch(k)}\"}\n err = <<~ERRLOG\n event_name: ims_#{event_name}\n count: { sent: #{sent.keys.count}, defined: #{copy_expected.count} }\n summary: { event_name: ims_#{event_name}, undefined: #{missing.to_s.gsub('\"', '')} }\n sample: { event_name: ims_#{event_name}, undefined: #{sample} }\n message: #{sent.to_json}\n\n ERRLOG\n # store in log file, print if interactive\n open('log/ddl-undefined.log', 'a') { |f| f << err }\n puts err if $stdout.isatty\n end\nend",
"def types_and_paths\n [\n [OBJECT, [\"data\"]],\n [[\"HigherLevelReview\"], %w[data type]],\n [OBJECT, %w[data attributes]],\n [[String, nil], %w[data attributes receiptDate]],\n [BOOL, %w[data attributes informalConference]],\n [[Array, nil], %w[data attributes informalConferenceTimes]],\n [[String, nil], [\"data\", \"attributes\", \"informalConferenceTimes\", 0]],\n [[String, nil], [\"data\", \"attributes\", \"informalConferenceTimes\", 1]],\n [[nil], [\"data\", \"attributes\", \"informalConferenceTimes\", 2]],\n [[*OBJECT, nil], %w[data attributes informalConferenceRep]],\n *(\n if informal_conference_rep? # ... name and phoneNumber must be present\n [\n [[String], %w[data attributes informalConferenceRep name]],\n [[String, Integer], %w[data attributes informalConferenceRep phoneNumber]]\n ]\n else\n []\n end\n ),\n [[String, Integer, nil], %w[data attributes informalConferenceRep phoneNumberCountryCode]],\n [[String, Integer, nil], %w[data attributes informalConferenceRep phoneNumberExt]],\n [BOOL, %w[data attributes sameOffice]],\n [BOOL, %w[data attributes legacyOptInApproved]],\n [[String], %w[data attributes benefitType]],\n [OBJECT, %w[data attributes veteran]],\n [[String], %w[data attributes veteran ssn]],\n [[*OBJECT, nil], %w[data attributes claimant]],\n *(\n if claimant_object_present? # ... participantId and payeeCode must be present\n [\n [[String], %w[data attributes claimant participantId]],\n [[String], %w[data attributes claimant payeeCode]]\n ]\n else\n []\n end\n ),\n [[String, nil], %w[data attributes claimant addressLine1]],\n [[String, nil], %w[data attributes claimant addressLine2]],\n [[String, nil], %w[data attributes claimant city]],\n [[String, nil], %w[data attributes claimant stateProvinceCode]],\n [[String, nil], %w[data attributes claimant countryCode]],\n [[String, nil], %w[data attributes claimant zipPostalCode]],\n [[String, nil], %w[data attributes claimant phoneNumber]],\n [[String, nil], %w[data attributes claimant phoneNumberCountryCode]],\n [[String, nil], %w[data attributes claimant phoneNumberExt]],\n [[String, nil], %w[data attributes claimant emailAddress]],\n [[Array], [\"included\"]],\n # [OBJECT, [\"included\", 0]],\n # [[\"ContestableIssue\"], [\"included\", 0, \"type\"]],\n # [[Integer, nil], [\"included\", 0, \"attributes\", \"decisionIssueId\"]],\n # [[String, nil], [\"included\", 0, \"attributes\", \"ratingIssueId\"]],\n # [[String, nil], [\"included\", 0, \"attributes\", \"ratingDecisionIssueId\"]],\n # [[Array, nil], [\"included\", 0, \"attributes\", \"legacyAppealIssues\"]]\n # [OBJECT, [\"included\", 1]],\n # [[\"ContestableIssue\"], [\"included\", 1, \"type\"]],\n # [[Integer, nil], [\"included\", 1, \"attributes\", \"decisionIssueId\"]],\n # [[String, nil], [\"included\", 1, \"attributes\", \"ratingIssueId\"]],\n # [[String, nil], [\"included\", 1, \"attributes\", \"ratingDecisionIssueId\"]],\n # [[Array, nil], [\"included\", 1, \"attributes\", \"legacyAppealIssues\"]]\n # ...\n *for_array_at_path_enumerate_types_and_paths( # ^^^\n array_path: [\"included\"],\n types_and_paths: [\n [OBJECT, []],\n [[\"ContestableIssue\"], [\"type\"]],\n [[String, Integer, nil], %w[attributes decisionIssueId]],\n [[String, Integer, nil], %w[attributes ratingIssueId]],\n [[String, Integer, nil], %w[attributes ratingDecisionIssueId]]\n ]\n )\n ]\n end",
"def check_calendar_event_data_validity(event_data)\n schema =\n {\n 'type' => 'object',\n 'required' => %w(Title Description StartDateTime EndDateTime StartDay\n EndDay GroupId RecurrenceInfo HasVisibilityRestrictions\n VisibilityRestrictions CalendarEventViewUrl),\n 'properties' =>\n {\n 'Title' => { 'type' => 'integer' },\n \"Description\" => { 'type' => 'integer' },\n \"StartDateTime\" => { 'type' => %w(string nil) }, # UTCDateTime || nil\n \"EndDateTime\" => { 'type' => %w(string nil) }, # UTCDateTime || nil\n \"StartDay\" => { 'type' => %w(string nil) }, # LocalDateTime || nil\n \"EndDay\" => { 'type' => %w(string nil) }, # LocalDateTime || nil\n \"GroupId\" => { 'type' => %w(integer nil) }, # D2LID || nil\n \"RecurrenceInfo\" =>\n {\n 'type' => 'object',\n 'required' => %w(RepeatType RepeatEvery RepeatOnInfo RepeatUntilDate),\n 'properties' =>\n {\n \"RepeatType\" => { 'type' => 'integer' }, # number -- repeat type\n \"RepeatEvery\" => { 'type' => 'integer' }, # number\n \"RepeatOnInfo\" => # Calendar.RepeatOnInfo\n {\n 'type' => 'object',\n 'required' => %w(Monday Tuesday Wednesday Thursday Friday\n Saturday Sunday),\n 'properties' =>\n {\n \"Monday\" => { 'type' => 'boolean' }, # boolean\n \"Tuesday\" => { 'type' => 'boolean' }, # boolean\n \"Wednesday\" => { 'type' => 'boolean' }, # boolean\n \"Thursday\" => { 'type' => 'boolean' }, # boolean\n \"Friday\" => { 'type' => 'boolean' }, # boolean\n \"Saturday\" => { 'type' => 'boolean' }, # boolean\n \"Sunday\" => { 'type' => 'boolean' }, # boolean\n }\n },\n \"RepeatUntilDate\" => { 'type' => 'string' } # UTCDATETIME\n }\n }, # Calendar.RecurrenceInfo\n \"HasVisibilityRestrictions\" => { 'type' => 'boolean' },\n \"VisibilityRestrictions\" =>\n {\n 'type' => 'object',\n 'required' => %w(Type Range HiddenRangeUnitType StartDate EndDate),\n 'properties' =>\n {\n \"Type\" => { 'type' => 'integer' }, # <number:VISIBILITY_T>,\n \"Range\" => { 'type' => %w(integer nil) }, # <number>|null,\n \"HiddenRangeUnitType\" => { 'type' => %w(integer nil) }, # <number:HIDDENUNIT_T>|null,\n \"StartDate\" => { 'type' => %w(string nil) }, # <string:UTCDateTime>|null,\n \"EndDate\" => { 'type' => %w(string nil) } # <string:UTCDateTime>|null,\n }\n }, # Calendar.VisibilityInfo\n \"CalendarEventViewUrl\" => { 'type' => 'string' } # url\n }\n }\n JSON::Validator.validate!(schema, event_data, validate_schema: true)\nend",
"def delivery_details; message[:delivery_details]; end",
"def webhook_hash(conditions)\n web_hash = {}\n param_conditions = conditions_to_param_form(conditions)\n param_conditions.each do |_title, params|\n web_hash.merge!(params[:number] => params[:webhook_data])\n end\n web_hash\n end",
"def valid_attributes\n { \n \"name\" => \"Dummy Sale\",\n \"description\"=>\"Dummy event description data\", \n \"start_date\"=> Time.zone.now.strftime(\"%Y/%m/%d %H:%M:%S %z\"), \n \"end_date\"=> (Time.zone.now+2.months).strftime(\"%Y/%m/%d %H:%M:%S %z\"), \n \"permalink\" => taxon.permalink,\n \"eventable_type\"=> taxon.class.to_s,\n \"eventable_id\" => taxon.id.to_s,\n \"is_active\"=>\"1\", \n \"is_hidden\"=>\"0\", \n \"is_permanent\"=>\"0\"\n }\n end",
"def patient_visit_list\n yes_concept = ConceptName.find_by_name('YES').concept_id\n hiv_reception_breakdown = {}\n\n (patient_visits || []).each do |v|\n # visit_date = v['obs_datetime'].to_date\n visit_type = v['name']\n ans_given = v['value_coded'].to_i == yes_concept\n patient_id = v['patient_id'].to_i\n patient_present = (visit_type.match(/patient/i) && ans_given ? true : false)\n guardian_present = (visit_type.match(/person/i) && ans_given ? true : false)\n\n if hiv_reception_breakdown[patient_id].blank?\n demographics = client_data(patient_id)\n hiv_reception_breakdown[patient_id] = {\n patient_present: false, guardian_present: false,\n given_name: demographics['given_name'],\n family_name: demographics['family_name'],\n gender: demographics['gender'],\n birthdate: demographics['birthdate'],\n arv_number: demographics['arv_number']\n }\n end\n\n hiv_reception_breakdown[patient_id][:patient_present] = patient_present if visit_type.match(/patient/i)\n hiv_reception_breakdown[patient_id][:guardian_present] = guardian_present if visit_type.match(/person/i)\n end\n\n hiv_reception_breakdown\n end",
"def build_cases\n @campaigns = {}\n\n x_g_10\n x_g_5_le_10\n x_g_0_le_5\n x_e_0\n end",
"def game_data\r\n [\r\n {start_at: '20.11.2022 17:00', place: 'Al-Chaur', team1_name: 'Katar', team2_name: 'Ecuador', group: GROUP_A, round: GROUP},\r\n\r\n {start_at: '21.11.2022 14:00', place: 'Ar-Rayyan', team1_name: 'England', team2_name: 'Iran', group: GROUP_B, round: GROUP},\r\n {start_at: '21.11.2022 17:00', place: 'Doha', team1_name: 'Senegal', team2_name: 'Niederlande', group: GROUP_A, round: GROUP},\r\n {start_at: '21.11.2022 20:00', place: 'Ar-Rayyan', team1_name: 'USA', team2_name: 'Wales', group: GROUP_B, round: GROUP},\r\n\r\n {start_at: '22.11.2022 11:00', place: 'Lusail', team1_name: 'Argentinien', team2_name: 'Saudi-Arabien', group: GROUP_C, round: GROUP},\r\n {start_at: '22.11.2022 14:00', place: 'Doha', team1_name: 'Dänemark', team2_name: 'Tunesien', group: GROUP_D, round: GROUP},\r\n {start_at: '22.11.2022 17:00', place: 'Doha', team1_name: 'Mexiko', team2_name: 'Polen', group: GROUP_C, round: GROUP},\r\n {start_at: '22.11.2022 20:00', place: 'Al Wakrah', team1_name: 'Frankreich', team2_name: 'Australien', group: GROUP_D, round: GROUP},\r\n\r\n {start_at: '23.11.2022 11:00', place: 'Al-Chaur', team1_name: 'Marokko', team2_name: 'Kroatien', group: GROUP_F, round: GROUP},\r\n {start_at: '23.11.2022 14:00', place: 'Ar-Rayyan', team1_name: 'Deutschland', team2_name: 'Japan', group: GROUP_E, round: GROUP},\r\n {start_at: '23.11.2022 17:00', place: 'Doha', team1_name: 'Spanien', team2_name: 'Costa Rica', group: GROUP_E, round: GROUP},\r\n {start_at: '23.11.2022 20:00', place: 'Ar-Rayyan', team1_name: 'Belgien', team2_name: 'Kanada', group: GROUP_F, round: GROUP},\r\n\r\n {start_at: '24.11.2022 11:00', place: 'Al Wakrah', team1_name: 'Schweiz', team2_name: 'Kamerun', group: GROUP_G, round: GROUP},\r\n {start_at: '24.11.2022 14:00', place: 'Doha', team1_name: 'Uruguay', team2_name: 'Südkorea', group: GROUP_H, round: GROUP},\r\n {start_at: '24.11.2022 17:00', place: 'Doha', team1_name: 'Portugal', team2_name: 'Ghana', group: GROUP_H, round: GROUP},\r\n {start_at: '24.11.2022 20:00', place: 'Lusail', team1_name: 'Brasilien', team2_name: 'Serbien', group: GROUP_G, round: GROUP},\r\n\r\n {start_at: '25.11.2022 11:00', place: 'Ar-Rayyan', team1_name: 'Wales', team2_name: 'Iran', group: GROUP_B, round: GROUP},\r\n {start_at: '25.11.2022 14:00', place: 'Doha', team1_name: 'Katar', team2_name: 'Senegal', group: GROUP_A, round: GROUP},\r\n {start_at: '25.11.2022 17:00', place: 'Ar-Rayyan', team1_name: 'Niederlande', team2_name: 'Ecuador', group: GROUP_A, round: GROUP},\r\n {start_at: '25.11.2022 20:00', place: 'Al-Chaur', team1_name: 'England', team2_name: 'USA', group: GROUP_B, round: GROUP},\r\n\r\n {start_at: '26.11.2022 11:00', place: 'Al Wakrah', team1_name: 'Tunesien', team2_name: 'Australien', group: GROUP_D, round: GROUP},\r\n {start_at: '26.11.2022 14:00', place: 'Doha', team1_name: 'Polen', team2_name: 'Saudi-Arabien', group: GROUP_C, round: GROUP},\r\n {start_at: '26.11.2022 17:00', place: 'Doha', team1_name: 'Frankreich', team2_name: 'Dänemark', group: GROUP_D, round: GROUP},\r\n {start_at: '26.11.2022 20:00', place: 'Lusail', team1_name: 'Argentinien', team2_name: 'Mexiko', group: GROUP_C, round: GROUP},\r\n\r\n {start_at: '27.11.2022 11:00', place: 'Ar-Rayyan', team1_name: 'Japan', team2_name: 'Costa Rica', group: GROUP_E, round: GROUP},\r\n {start_at: '27.11.2022 14:00', place: 'Doha', team1_name: 'Belgien', team2_name: 'Marokko', group: GROUP_F, round: GROUP},\r\n {start_at: '27.11.2022 17:00', place: 'Ar-Rayyan', team1_name: 'Kroatien', team2_name: 'Kanada', group: GROUP_F, round: GROUP},\r\n {start_at: '27.11.2022 20:00', place: 'Al-Chaur', team1_name: 'Spanien', team2_name: 'Deutschland', group: GROUP_E, round: GROUP},\r\n\r\n {start_at: '28.11.2022 11:00', place: 'Al Wakrah', team1_name: 'Kamerun', team2_name: 'Serbien', group: GROUP_G, round: GROUP},\r\n {start_at: '28.11.2022 14:00', place: 'Doha', team1_name: 'Südkorea', team2_name: 'Ghana', group: GROUP_H, round: GROUP},\r\n {start_at: '28.11.2022 17:00', place: 'Doha', team1_name: 'Brasilien', team2_name: 'Schweiz', group: GROUP_G, round: GROUP},\r\n {start_at: '28.11.2022 20:00', place: 'Lusail', team1_name: 'Portugal', team2_name: 'Uruguay', group: GROUP_H, round: GROUP},\r\n\r\n {start_at: '29.11.2022 16:00', place: 'Al-Chaur', team1_name: 'Niederlande', team2_name: 'Katar', group: GROUP_A, round: GROUP},\r\n {start_at: '29.11.2022 16:00', place: 'Ar-Rayyan', team1_name: 'Ecuador', team2_name: 'Senegal', group: GROUP_A, round: GROUP},\r\n {start_at: '29.11.2022 20:00', place: 'Ar-Rayyan', team1_name: 'Wales', team2_name: 'England', group: GROUP_B, round: GROUP},\r\n {start_at: '29.11.2022 20:00', place: 'Doha', team1_name: 'Iran', team2_name: 'USA', group: GROUP_B, round: GROUP},\r\n\r\n {start_at: '30.11.2022 16:00', place: 'Al Wakrah', team1_name: 'Australien', team2_name: 'Dänemark', group: GROUP_D, round: GROUP},\r\n {start_at: '30.11.2022 16:00', place: 'Doha', team1_name: 'Tunesien', team2_name: 'Frankreich', group: GROUP_D, round: GROUP},\r\n {start_at: '30.11.2022 20:00', place: 'Doha', team1_name: 'Polen', team2_name: 'Argentinien', group: GROUP_C, round: GROUP},\r\n {start_at: '30.11.2022 20:00', place: 'Lusail', team1_name: 'Saudi-Arabien', team2_name: 'Mexiko', group: GROUP_C, round: GROUP},\r\n\r\n {start_at: '01.12.2022 16:00', place: 'Ar-Rayyan', team1_name: 'Kroatien', team2_name: 'Belgien', group: GROUP_F, round: GROUP},\r\n {start_at: '01.12.2022 16:00', place: 'Doha', team1_name: 'Kanada', team2_name: 'Marokko', group: GROUP_F, round: GROUP},\r\n {start_at: '01.12.2022 20:00', place: 'Ar-Rayyan', team1_name: 'Japan', team2_name: 'Spanien', group: GROUP_E, round: GROUP},\r\n {start_at: '01.12.2022 20:00', place: 'Al-Chaur', team1_name: 'Costa Rica', team2_name: 'Deutschland', group: GROUP_E, round: GROUP},\r\n\r\n {start_at: '02.12.2022 16:00', place: 'Al Wakrah', team1_name: 'Ghana', team2_name: 'Uruguay', group: GROUP_H, round: GROUP},\r\n {start_at: '02.12.2022 16:00', place: 'Doha', team1_name: 'Südkorea', team2_name: 'Portugal', group: GROUP_H, round: GROUP},\r\n {start_at: '02.12.2022 20:00', place: 'Doha', team1_name: 'Serbien', team2_name: 'Schweiz', group: GROUP_G, round: GROUP},\r\n {start_at: '02.12.2022 20:00', place: 'Lusail', team1_name: 'Kamerun', team2_name: 'Brasilien', group: GROUP_G, round: GROUP},\r\n\r\n # Achtelfinale\r\n {start_at: '03.12.2022 16:00', place: 'Ar-Rayyan', team1_placeholder_name: '1. Gruppe A', team2_placeholder_name: '2. Gruppe B', group: nil, round: ROUND_OF_16},\r\n {start_at: '03.12.2022 20:00', place: 'Ar-Rayyan', team1_placeholder_name: '1. Gruppe C', team2_placeholder_name: '2. Gruppe D', group: nil, round: ROUND_OF_16},\r\n\r\n {start_at: '04.12.2022 16:00', place: 'Doha', team1_placeholder_name: '1. Gruppe D', team2_placeholder_name: '2. Gruppe C', group: nil, round: ROUND_OF_16},\r\n {start_at: '04.12.2022 20:00', place: 'Al-Chaur', team1_placeholder_name: '1. Gruppe B', team2_placeholder_name: '2. Gruppe A', group: nil, round: ROUND_OF_16},\r\n\r\n {start_at: '05.12.2022 16:00', place: 'Al Wakrah', team1_placeholder_name: '1. Gruppe E', team2_placeholder_name: '2. Gruppe F', group: nil, round: ROUND_OF_16},\r\n {start_at: '05.12.2022 20:00', place: 'Doha', team1_placeholder_name: '1. Gruppe G', team2_placeholder_name: '2. Gruppe H', group: nil, round: ROUND_OF_16},\r\n\r\n {start_at: '06.12.2022 16:00', place: 'Doha', team1_placeholder_name: '1. Gruppe F', team2_placeholder_name: '2. Gruppe E', group: nil, round: ROUND_OF_16},\r\n {start_at: '06.12.2022 20:00', place: 'Lusail', team1_placeholder_name: '1. Gruppe H', team2_placeholder_name: '2. Gruppe G', group: nil, round: ROUND_OF_16},\r\n\r\n # Viertelfinale\r\n {start_at: '09.12.2022 16:00', place: 'Doha', team1_placeholder_name: 'Sieger AF 5', team2_placeholder_name: 'Sieger AF 6', group: nil, round: QUARTERFINAL},\r\n {start_at: '09.12.2022 20:00', place: 'Lusail', team1_placeholder_name: 'Sieger AF 1', team2_placeholder_name: 'Sieger AF 2', group: nil, round: QUARTERFINAL},\r\n {start_at: '10.12.2022 16:00', place: 'Doha', team1_placeholder_name: 'Sieger AF 7', team2_placeholder_name: 'Sieger AF 8', group: nil, round: QUARTERFINAL},\r\n {start_at: '10.12.2022 20:00', place: 'Al-Chaur', team1_placeholder_name: 'Sieger AF 3', team2_placeholder_name: 'Sieger AF 4', group: nil, round: QUARTERFINAL},\r\n\r\n # Halbfinale\r\n {start_at: '13.12.2022 20:00', place: 'Lusail', team1_placeholder_name: 'Sieger VF 1', team2_placeholder_name: 'Sieger VF 2', group: nil, round: SEMIFINAL},\r\n {start_at: '14.12.2022 20:00', place: 'Al-Chaur', team1_placeholder_name: 'Sieger VF 3', team2_placeholder_name: 'Sieger VF 4', group: nil, round: SEMIFINAL},\r\n\r\n # Spiel um Platz 3\r\n {start_at: '17.12.2022 16:00', place: 'Ar-Rayyan', team1_placeholder_name: 'Verlierer HF 1', team2_placeholder_name: 'Verlierer HF 2', group: nil, round: PLACE_3},\r\n\r\n # Finale\r\n {start_at: '18.12.2022 16:00', place: 'Lusail', team1_placeholder_name: 'Sieger HF 1', team2_placeholder_name: 'Sieger HF 2', group: nil, round: FINAL},\r\n ]\r\nend",
"def impression_data(matching_key, bucketing_key, split_name, treatment, time = nil)\n {\n k: matching_key,\n b: bucketing_key,\n f: split_name,\n t: treatment[:treatment],\n r: applied_rule(treatment[:label]),\n c: treatment[:change_number],\n m: time || (Time.now.to_f * 1000.0).to_i,\n pt: nil\n }\n end",
"def group_time_accounted_array(params,tcol)\r\n \r\n conditions,data,table_headers,duration = {},[],[],0\r\n \r\n \r\n lookup_activities = current_company.company_activity_types\r\n activities = ReportsHelper.get_lookups(lookup_activities)\r\n\r\n if params[:report][:selected] == \"all\"\r\n billamount,discount,override,finalamount,num_discount = 0,0,0,0,0\r\n tcol.each do |obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n\r\n duration += actual_duration.to_f if actual_duration\r\n unless obj.is_internal\r\n billamount = billamount + (obj.actual_activity_rate * actual_duration.to_f)\r\n# discount += obj.billing_percent if obj.billing_percent\r\n if obj.billing_percent\r\n discount += obj.billing_percent\r\n num_discount += 1\r\n end\r\n override += obj.final_billed_amount if obj.billing_method_type == 3\r\n finalamount += obj.final_billed_amount if obj.final_billed_amount\r\n end\r\n\r\n unless obj.is_internal #Not Internal\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize),obj.contact ? obj.contact.name : \"\",obj.matter ? obj.matter.clipped_name : \"\",\"No\",actual_duration,activities[obj.activity_type],obj.is_billable ? \"Yes\" : \"No\",obj.actual_activity_rate,obj.actual_activity_rate * actual_duration.to_f,obj.billing_percent,obj.billing_method_type == 3 ? obj.final_billed_amount : '',obj.final_billed_amount]\r\n else\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize), \"N.A\",\"N.A\",\"Yes\",actual_duration,activities[obj.activity_type],\"N.A\",\"N.A\",\"N.A\",\"N.A\",\"N.A\",\"N.A\"]\r\n end\r\n end\r\n # This condition applied to avoid 0/0 = (Not A Number) with ref to Bug -Bug #7108 Shows junk value in T&E PDF report --Rahul P.\r\n if (discount>0 and num_discount>0)\r\n discount = (discount.to_f/num_discount.to_f)\r\n else\r\n discount = 0\r\n end\r\n #raise discount.inspect\r\n conditions[:table_width] = 750\r\n conditions[:all_entries] = [duration,billamount,discount,override,finalamount]\r\n column_widths = { 0 => 60, 1 => 60, 2 => 60 , 3 => 60 , 4 => 40 , 5 => 70 , 6 => 60 ,7 => 40 , 8 => 60 , 9 => 60,10 => 60,11 => 60 , 12 => 60}\r\n table_headers = [t(:label_date),t(:text_lawyer),t(:label_client),t(:text_matter),t(:label_internal),t(:label_duration_hrs),t(:text_activity_type),t(:text_billable),\"#{t(:label_rate_hr)}\",\"#{t(:text_bill)} #{t(:text_amt)}\",t(:text_discount_p),\"#{t(:text_override)} #{t(:text_amt)}\",\"#{t(:label_final_bill)} #{t(:text_amt)}\"]\r\n alignment = { 0 => :center, 1 => :left,2 => :left, 3 => :left,4 => :center,6 => :left, 7 => :center,10=>:center} if params[:format] == \"pdf\"\r\n \r\n elsif params[:report][:selected] == \"internal\"\r\n \r\n \r\n tcol.each do |obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n duration += actual_duration.to_f if obj.actual_duration\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize),actual_duration,activities[obj.activity_type]]\r\n end\r\n conditions[:internal_entries] = [duration]\r\n table_headers = [t(:label_date),t(:text_lawyer),t(:label_duration_hrs),t(:text_activity_type)]\r\n column_widths = { 0 => 100, 1 => 100, 2 => 100 , 3 => 100} \r\n end\r\n \r\n [data,conditions,table_headers,column_widths, alignment]\r\n \r\n end",
"def add_ids_to_campaignmember(obj,instance_url,access_token)\n json_payload = nil\n campaign_id = obj[\"event\"][\"id\"]\n contact_email = obj[\"profile\"][\"email\"]\n contact_fn = escape_characters(obj[\"profile\"][\"first_name\"])\n contact_ln = escape_characters(obj[\"profile\"][\"last_name\"])\n contact_email = obj[\"order\"][\"email\"] if contact_email.nil?\n contact_email = escape_characters(contact_email)\n checked_in = nil\n checked_in = \"Responded\" if obj[\"checked_in\"]\n campaign_search_string =\n url_encode(\n \"FIND {#{campaign_id}}\" \\\n \" IN ALL FIELDS\" \\\n \" RETURNING Campaign(Id)\")\n contact_search_string =\n url_encode(\n \"FIND {#{contact_fn}\" \\\n \" AND #{contact_ln}\" \\\n \" AND #{contact_email}}\" \\\n \" IN ALL FIELDS\" \\\n \" RETURNING Contact(Id)\")\n campaign_base_uri = \"#{instance_url}/services/data/v29.0/search/?q=#{campaign_search_string}\"\n begin\n campaign_query_response = rest_call(\"get\",campaign_base_uri,json_payload,access_token)\n @json_campaign = JSON.parse(campaign_query_response)[0]\n end until !@json_campaign.nil?\n contact_base_uri = \"#{instance_url}/services/data/v29.0/search/?q=#{contact_search_string}\"\n contact_query_response = rest_call(\"get\",contact_base_uri,json_payload,access_token)\n json_contact = JSON.parse(contact_query_response)[0]\n unless json_contact.nil?\n obj.store(\"ContactId\",json_contact[\"Id\"])\n obj.store(\"CampaignId\",@json_campaign[\"Id\"])\n obj.store(\"Status\",checked_in) unless checked_in.nil?\n else\n obj = nil\n end\n return obj\n end",
"def delete_dates(data) \n ['created_at', 'updated_at', 'timestamp', 'location'].each do |key|\n data.delete key if data[key]\n end\n data\nend",
"def track(event, data, true_performed_at=nil)\n if event.blank?\n raise ValidationError.new('event required')\n end\n\n event = event.to_s.underscore\n\n # if !event.in?(EVENTS) \n # raise ValidationError.new(\"unknown event #{event}\")\n # end\n\n if data.blank?\n raise ValidationError.new('data required')\n end\n\n data = data.with_indifferent_access\n\n schema = begin\n \"CXMapTracker::#{event.classify}Schema\".constantize\n rescue NameError\n CXMapTracker::EventSchema\n end\n \n validation = schema.call(data)\n if validation.failure?\n raise ValidationError.new('data invalid', validation.messages)\n end\n\n params = data.select{|_, v| v.present?}\n \n # convert to JSON\n if params[:event_properties].present?\n params[:event_properties] = params[:event_properties].to_json\n end\n \n if params[:context].present?\n params[:context] = params[:context].to_json\n end\n \n # add common attributes\n params[:app_key] = app_key\n params[:event] = event\n params[:tracker_sent_at] = Time.now.utc.iso8601\n params[:tracker_ver] = CXMap.tracker_version\n params[:tracker_name] = CXMap.tracker_name\n params[:true_performed_at] = true_performed_at.utc.iso8601 if true_performed_at.present?\n\n request(params)\n\n true\n end",
"def fix_temps(con_full)\n\t ##Rails.logger.debug \"\\nes287_debug fix_temp: #{__FILE__} line(#{__LINE__}) con_full=#{con_full.inspect}\\n\"\n\t if @document.nil?\n\t iarray = nil\n\t else\n\t ##Rails.logger.debug \"\\nes287_debug fix_temp: #{__FILE__} line(#{__LINE__}) @document.item_record_display=#{@document['item_record_display'].inspect}\\n\"\n\t iarray = @document['item_record_display']\n\t end\n\t items = []\n\t if iarray.nil?\n\t return con_full\n\t end\n\t iarray.each do |ite|\n\t items << JSON.parse(ite)\n\t end\n\t ##Rails.logger.debug \"\\nes287_debug fix_temp: #{__FILE__} line(#{__LINE__}) items=#{items}\\n\"\n\t # for each holding record, count the items\n\t cond2 = []\n\t con_full.each do |loc|\n\t loc2 = loc\n\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) location=#{loc['location_name']} callnumber=#{loc['call_number']} holding_id=#{loc['holding_id'][0]}\\n\"\n\t #select from items array those with matching mfhd_id, and count them. how many items on this mfhd?\n\t im = items.select {|i| i['mfhd_id'] == loc['holding_id'][0] }\n\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) items matching=#{im.inspect} and count for this holding = #{im.count}\\n\"\n\t tm = im.select {|i| !i['temp_location']['code'].blank? }\n\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) items matching with temp=#{tm.inspect} and count with temps= #{tm.count}\\n\"\n\t tl = (im.select {|i| !i['temp_location']['code'].blank? }).each{|x| x.keep_if{|k,v| k== 'temp_location'}}\n\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) tl=#{tl.inspect}\\n\"\n\t #select from items array those with matching mfhd_id and a temp loc, and count them. how many items on this mfhd with a temp location?\n\t if tm.count > 0 and tm.count == im.count\n\t\tloc2['location_name'] = tl[0]['temp_location']['name']\n\t\tloc2['location_code'] = tl[0]['temp_location']['code']\n\t\tloc2['copies'][0].delete('temp_locations')\n\t end\n\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) loc2=#{loc2.inspect}\\n\"\n\t cond2 << loc2\n\t end\n\t ##Rails.logger.debug \"\\nes287_debug #{__FILE__} line(#{__LINE__}) cond2=#{cond2.inspect}\\n\"\n\t cond2\n\t end",
"def payload\n msg = {\n data: {\n alert: alert,\n badge: badge || \"Increment\",\n },\n }\n msg[:data][:sound] = sound if sound.present?\n msg[:data][:title] = title if title.present?\n msg[:data].merge! @data if @data.is_a?(Hash)\n\n if @expiration_time.present?\n msg[:expiration_time] = @expiration_time.respond_to?(:iso8601) ? @expiration_time.iso8601(3) : @expiration_time\n end\n if @push_time.present?\n msg[:push_time] = @push_time.respond_to?(:iso8601) ? @push_time.iso8601(3) : @push_time\n end\n\n if @expiration_interval.is_a?(Numeric)\n msg[:expiration_interval] = @expiration_interval.to_i\n end\n\n if query.where.present?\n q = @query.dup\n if @channels.is_a?(Array) && @channels.empty? == false\n q.where :channels.in => @channels\n end\n msg[:where] = q.compile_where unless q.where.empty?\n elsif @channels.is_a?(Array) && @channels.empty? == false\n msg[:channels] = @channels\n end\n msg\n end",
"def receive_issue_impact_change(config, payload)\n room = find_campfire_room(config)\n\n users_text = if payload[:impacted_devices_count] == 1\n 'This issue is affecting at least 1 user who has crashed '\n else\n \"This issue is affecting at least #{payload[:impacted_devices_count]} users who have crashed \"\n end\n\n crashes_text = if payload[:crashes_count] == 1\n 'at least 1 time. '\n else\n \"at least #{payload[:crashes_count]} times. \"\n end\n\n message = \"[#{payload[:app][:name]}] #{payload[:title]} in #{payload[:method]} \"\n message << users_text\n message << crashes_text\n message << payload[:url].to_s\n\n resp = room.speak(message)\n unless resp.is_a?(Hash) && resp.message\n raise \"Campfire Message Post Failed: #{(resp.map {|e| e.join(' ') }).join(', ')}\"\n end\n { :campfire_message_id => resp.message.id }\n end",
"def attributes\n \tdata = super # get the current JSON object\n \trecipient = object\n\n data[:is_visible] = 1 # visible by default\n\n relationship_id = data[:relationship_id]\n relationship = Relationship.find_by(id: relationship_id)\n data[:relationship] = relationship\n\n primary_address = recipient.addresses.first\n data[:primary_address] = primary_address\n\n addresses = recipient.addresses\n data[:addresses] = addresses\n\n occasions = Array.new\n\n recipient_occasions = recipient.recipient_occasions.live\n recipient_occasions.each do |recipient_occasion|\n\n occasion_data = Hash.new\n occasion_data[:recipient_occasion] = recipient_occasion\n occasion = recipient_occasion.occasion\n occasion_data[:occasion] = occasion\n occasions << occasion_data\n\n end\n\n data[:occasions] = occasions\n\n # profile picture if it exists\n profile_picture = recipient.profile_pictures.first\n if profile_picture && profile_picture.picture?\n data[:profile_picture] = profile_picture.picture.url\n end\n\n data\n\n end",
"def update(data)\n return self.firebase.update(\"patients/#{self.uid}/medication_schedule/#{self.id}/\", data)\n end",
"def hash\n [additional_contact_billing_id, additional_contact_billing_is_primary, additional_contact_billing_name, additional_contact_executive_sponsor_id, additional_contact_executive_sponsor_is_primary, additional_contact_executive_sponsor_name, additional_contact_hiring_manager_id, additional_contact_hiring_manager_is_primary, additional_contact_hiring_manager_name, additional_contact_internal_recruiter_id, additional_contact_internal_recruiter_is_primary, additional_contact_internal_recruiter_name, additional_contact_other_id, additional_contact_other_is_primary, additional_contact_other_name, attachments, created_by_id, created_by_name, created_on, expected_value, external_email_address, id, job_code, last_activity_date, last_engagement_date, modified_by_id, modified_by_name, modified_on, owners, status_id, status_name, time_to_close, actual_value, additional_contact_client_first_name, additional_contact_client_id, additional_contact_client_is_primary, additional_contact_client_last_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, bill_rate, bonus, commission, company_id, company_name, compensation, compensation_details, custom_field1, custom_field10, custom_field11, custom_field12, custom_field13, custom_field14, custom_field15, custom_field16, custom_field17, custom_field18, custom_field19, custom_field2, custom_field20, custom_field21, custom_field22, custom_field23, custom_field24, custom_field25, custom_field26, custom_field27, custom_field28, custom_field29, custom_field3, custom_field30, custom_field4, custom_field5, custom_field6, custom_field7, custom_field8, custom_field9, description, discount, estimated_close_date, external_primary_key, fee, fee_percent, hourly_rate, is_lead, is_on_hold, job_title_id, job_title_name, job_types, lead_source_id, lead_source_name, margin, name, number_of_openings, opportunity_type_id, opportunity_type_name, parent_job_id, parent_job_name, pay_rate, potential_value, priority_id, priority_name, probability, salary, start_date, tags, total_hours, website_description, website_description_is_primary, website_other, website_other_is_primary].hash\n end",
"def parse_departures(json)\n # this will return blank if there are any failures in the API request\n return [] if json[\"FailedRequest\"].present? or json[\"AgencyList\"].first[\"Agency\"].blank?\n\n sane_departures = Hash.new { |hash, key| hash[key] = {} }\n routes = json[\"AgencyList\"].first[\"Agency\"].first[\"RouteList\"].first[\"Route\"] rescue []\n routes.each do |route_json|\n # Again, special case for BART, it doesn't have route_direction\n if route_json[\"RouteDirectionList\"]\n route_json[\"RouteDirectionList\"].first[\"RouteDirection\"].map do |dir|\n times = dir[\"StopList\"].first[\"Stop\"].first[\"DepartureTimeList\"].first[\"DepartureTime\"] rescue []\n times ||= []\n key = route_json[\"Name\"] + \" - \" + dir[\"Name\"]\n # found that, sometimes the API returns departure times greater than 90 minutes\n sane_departures[key] = {\"route_idf\" => \"#{agency.name}~#{route_json[\"Code\"]}~#{dir[\"Code\"]}\",\"times\" => times.select {|t| t.to_i <= 90 }}\n end \n else\n times = route_json[\"StopList\"].first[\"Stop\"].first[\"DepartureTimeList\"].first[\"DepartureTime\"] rescue []\n times ||= []\n key = route_json[\"Name\"]\n # sane_departures[key] = times.select {|t| t.to_i < 90 }\n sane_departures[key] = {\"route_idf\" => \"#{agency.name}~#{route_json[\"Code\"]}\",\"times\" => times.select {|t| t.to_i <= 90 }}\n end\n end rescue nil\n sane_departures\n end",
"def fetch_skill_data (skill_id,timediff)\n @current_time = Time.now\n #response = JSON.parse((InContactApi::Connection.base.get \"/inContactAPI/services/v2.0/skills/\"+skill_id.to_s+\"/summary?startDate=\"+ (@current_time-timediff).utc.iso8601 + \"&endDate=\" + @current_time.utc.iso8601).body)['skillSummaries'].first\n full_response = JSON.parse((InContactApi::Connection.base.get \"/inContactAPI/services/v2.0/skills/summary?startDate=\"+ (@current_time-timediff).utc.iso8601 + \"&endDate=\" + @current_time.utc.iso8601).body)['skillSummaries']\n File.open(\"newtest.json\",\"w+\"){|f| f.write(full_response)}\n @full_data = full_response\n full_response_length = full_response.length.to_i\n response = {}\n #get response for Sales Department alone using sales id\n (0...full_response_length).each do |resp| \n response = (full_response[resp]['SkillId'].to_i === skill_id.to_i) ? full_response[resp] : \"do nothing\"\n (response != \"do nothing\") ? break : next\n end\n if (skill_id == 122099)\n other_sales_depts = [\"122125\",\"122100\",\"147347\",\"134509\"] \n other_sales_depts.each do |dept_skill_id|\n (0...full_response_length).each do |resp|\n #actual_response = (dept_response[resp]['SkillId'].to_i === dept_skill_id.to_i) ? dept_response[resp] : \"nothing found\"\n actual_response = (full_response[resp]['SkillId'].to_i === dept_skill_id.to_i) ? ((full_response[resp]) ? append_values(response,full_response[resp]) : false) : \"nothing found\"\n (actual_response != \"do nothing\") ? break : next\n end\n end \n \n #Caching Sales values in database\n Sale.create(:QueueCount => response[\"QueueCount\"],:AbandonRate => response[\"AbandonRate\"],:AgentsWorking => response[\"AgentsWorking\"],:AgentsUnavailable => response[\"AgentsUnavailable\"],:LongestQueueDur => response[\"LongestQueueDur\"],:AverageWrapTime => response[\"AverageWrapTime\"],:AverageSpeedToAnswer => response[\"AverageSpeedToAnswer\"],:AverageTalkTime => response[\"AverageTalkTime\"])\n #Service Department\n else\n other_service_depts = [\"122133\",\"134577\"] #['Service Support','Printed']\n other_service_depts.each do |dept_skill_id|\n (0...full_response_length).each do |resp|\n actual_response = (full_response[resp]['SkillId'].to_i === dept_skill_id.to_i) ? ((full_response[resp]) ? append_values(response,full_response[resp]) : false) : \"nothing found\"\n (actual_response != \"do nothing\") ? break : next\n end\n end \n #Caching Service values in database\n Service.create(:QueueCount => response[\"QueueCount\"],:AbandonRate => response[\"AbandonRate\"],:AgentsWorking => response[\"AgentsWorking\"],:AgentsUnavailable => response[\"AgentsUnavailable\"],:LongestQueueDur => response[\"LongestQueueDur\"],:AverageWrapTime => response[\"AverageWrapTime\"],:AverageSpeedToAnswer => response[\"AverageSpeedToAnswer\"],:AverageTalkTime => response[\"AverageTalkTime\"])\n end\n response['LongestQueueDur']=format_agent_time(response['LongestQueueDur'])\n response['AverageWrapTime']=format_agent_time(response['AverageWrapTime'])\n response['AverageSpeedToAnswer']=format_agent_time(response['AverageSpeedToAnswer'])\n response['AverageTalkTime']=format_agent_time(response['AverageTalkTime'])\n response\n end",
"def respond_to_slack_event json\n \n # find the team\n team_id = json['team_id']\n api_app_id = json['api_app_id']\n event = json['event']\n event_type = event['type']\n event_user = event['user']\n event_text = event['text']\n event_channel = event['channel']\n event_ts = event['ts']\n \n team = Team.find_by(team_id: team_id)\n \n # didn't find a match... this is junk! \n return if team.nil?\n \n # see if the event user is the bot user \n # if so we shoud ignore the event\n return if team.bot_user_id == event_user\n \n event = Event.create(team_id: team_id, type_name: event_type, user_id: event_user, text: event_text, channel: event_channel, direction: \"incoming\", timestamp: Time.at(event_ts.to_f) )\n event.team = team\n event.save!\n \n client = team.get_client\n \n event_to_action client, event, team\nend",
"def sensation_parse_message(json_str)\n m = JSON.parse(json_str)\n if m[\"duration_watched\"] > 100000\n @logger.warn \"Dropping message '#{m.inspect}'\"\n return nil\n end\n m\n end",
"def webster_hall_parse!\n response = Net::HTTP.get('api.ticketweb.com', '/snl/EventAPI.action?key=kFiQQQiHkGJpeA5xCfHd&version=1&orgId=136373,141422,137573&method=json')\n json = JSON.parse(response)\n\n json['events'].each do |event|\n Event.where(\n name: event['eventname'],\n description: event['description'],\n url: event['eventurl'],\n date: event['dates']['startdate'].to_time(\"Eastern Time (US & Canada)\").utc,\n venue_id: id\n ).first_or_create!\n end\n end",
"def date\n success ? { 'datesent' => sent } : {}\n end"
] | [
"0.5644173",
"0.5541001",
"0.54635406",
"0.5271407",
"0.5236314",
"0.5213901",
"0.51805097",
"0.51797944",
"0.5157291",
"0.5120727",
"0.5099303",
"0.5061041",
"0.5058922",
"0.50314",
"0.5026635",
"0.5021494",
"0.50193137",
"0.5004807",
"0.4940935",
"0.49341482",
"0.4931532",
"0.49243593",
"0.49140844",
"0.49092707",
"0.4898459",
"0.48945802",
"0.48911676",
"0.48627537",
"0.486253",
"0.48446396",
"0.484402",
"0.48398632",
"0.48384613",
"0.48302847",
"0.48282602",
"0.4827859",
"0.47937936",
"0.4790617",
"0.47828266",
"0.47784567",
"0.47713634",
"0.47667095",
"0.47648874",
"0.4760895",
"0.47509858",
"0.47506958",
"0.47462523",
"0.4739391",
"0.4737854",
"0.4733105",
"0.47325063",
"0.47277185",
"0.47160113",
"0.47156984",
"0.47144872",
"0.47072327",
"0.47039673",
"0.47016737",
"0.47005254",
"0.46926644",
"0.46843246",
"0.46769166",
"0.46643022",
"0.46574175",
"0.46567327",
"0.46531555",
"0.4652863",
"0.46509886",
"0.46506578",
"0.46497747",
"0.4645074",
"0.4642633",
"0.46370664",
"0.46339294",
"0.4631395",
"0.46282074",
"0.4608526",
"0.46084434",
"0.4604821",
"0.459838",
"0.45966592",
"0.4596365",
"0.4593692",
"0.4592686",
"0.45888767",
"0.45804867",
"0.4580304",
"0.45797253",
"0.4579304",
"0.45759964",
"0.45754275",
"0.45743525",
"0.45681643",
"0.45642856",
"0.4563585",
"0.45584083",
"0.45548165",
"0.45510432",
"0.4550073",
"0.45469078"
] | 0.6565988 | 0 |
"type": "campaign", "fired_at": "20090326 21:31:21", "data[id]": "5aa2102003", "data[subject]": "Test Campaign Subject", "data[status]": "sent", "data[reason]": "", "data[list_id]": "a6b5da1054" | def campaign_status
{
:list_id => data['list_id'],
:campaign_id => data['id'],
:subject => data['subject'],
:status => data['status'],
:reason => data['reason'],
:human => "Campaign Status (ID: #{data['id']}) - Subject: '#{data['subject']}', Status: '#{data['status']}', Reason: '#{data['reason']}'"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_cleaned\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :campaign_id => data['campaign_id'],\n :email => data['email'],\n :reason => data['reason'],\n :human => \"#{data['email']} was cleaned from Mailchimp list with ID #{data['list_id']}. Reason: '#{data['reason']}'\"\n }\n end",
"def customer_mailchimp_subscribed\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :ip_signup => params['ip_signup'],\n :human => \"#{data['email']} subscribed to Mailchimp list with ID #{data['list_id']}\"\n }\n end",
"def hash\n [campaign, number, customer, scheduled_start, child, description, category_type, overview, priority, date_event, product_event, phone, event_name, event_number, time_difference, type_event, primary_phone_call_id, parent_phone_call_id, product_name, product_name_g, scheduled_start_parent, description_parent, act_status_name_parent, organisation_name, organisation_id, action_status, actual_start, actual_end, owner, partner, time_shift, regarding_object_id, phone_call_subject, summary_table_event_id, lead_id, lead_name, contact_id, contact_full_name, account_id, account_name, parent_account_id, parent_account_name, customer_created_on, contact_taxid_number, contact_pin, account_registration_code, account_taxid_number, account_pin, lead_pin, parent_account_registration_code, parent_account_taxid_number, parent_account_pin, address_name, actionnr, campaign_rank, setting_id, ignor_nedozvon, primary_activity_id, activity_serial_number, contact_person_id, contact_person_id_name, phone_call_type, party_id, color, time, created_by, created_on, modified_by, modified_on, id, name, state_code, status_code].hash\n end",
"def hash\n [ab_campaign_data, confirmation_to, created_on, delivered_on, format_type, html_content, id, is_transactional, mailing_lists, name, plain_content, reply_to_email, scheduled_for, sender, status, subject, timezone, updated_on, web_location].hash\n end",
"def campaigns\n response = get 'campaigns'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def customer_mailchimp_email_updated\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :new_mailchimp_id => data['id'],\n :new_email => data['new_email'],\n :old_email => data['old_email'],\n :human => \"#{data['email']} updated their email address on Mailchimp, from '#{data['old_email']}' to '#{data['new_email']}'.\"\n }\n end",
"def add_ids_to_campaignmember(obj,instance_url,access_token)\n json_payload = nil\n campaign_id = obj[\"event\"][\"id\"]\n contact_email = obj[\"profile\"][\"email\"]\n contact_fn = escape_characters(obj[\"profile\"][\"first_name\"])\n contact_ln = escape_characters(obj[\"profile\"][\"last_name\"])\n contact_email = obj[\"order\"][\"email\"] if contact_email.nil?\n contact_email = escape_characters(contact_email)\n checked_in = nil\n checked_in = \"Responded\" if obj[\"checked_in\"]\n campaign_search_string =\n url_encode(\n \"FIND {#{campaign_id}}\" \\\n \" IN ALL FIELDS\" \\\n \" RETURNING Campaign(Id)\")\n contact_search_string =\n url_encode(\n \"FIND {#{contact_fn}\" \\\n \" AND #{contact_ln}\" \\\n \" AND #{contact_email}}\" \\\n \" IN ALL FIELDS\" \\\n \" RETURNING Contact(Id)\")\n campaign_base_uri = \"#{instance_url}/services/data/v29.0/search/?q=#{campaign_search_string}\"\n begin\n campaign_query_response = rest_call(\"get\",campaign_base_uri,json_payload,access_token)\n @json_campaign = JSON.parse(campaign_query_response)[0]\n end until !@json_campaign.nil?\n contact_base_uri = \"#{instance_url}/services/data/v29.0/search/?q=#{contact_search_string}\"\n contact_query_response = rest_call(\"get\",contact_base_uri,json_payload,access_token)\n json_contact = JSON.parse(contact_query_response)[0]\n unless json_contact.nil?\n obj.store(\"ContactId\",json_contact[\"Id\"])\n obj.store(\"CampaignId\",@json_campaign[\"Id\"])\n obj.store(\"Status\",checked_in) unless checked_in.nil?\n else\n obj = nil\n end\n return obj\n end",
"def customer_mailchimp_unsubscribed\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :campaign_id => data['campaign_id'],\n :human => \"#{data['email']} unsubscribed from Mailchimp list with ID #{data['list_id']}\"\n }\n end",
"def campaigns_records\n [\n [101, 'disabled', '1', 'New Description for campaign 11'],\n [102, 'disabled', '2', 'Description for campaign 12'],\n [103, 'enabled', '3', 'Description for campaign 13'],\n [104, 'enabled', '4', 'Description for campaign 14']\n ]\n end",
"def send_message(message)\n message = JSON.parse(message)\n params = {email:message[\"email\"],project:message[\"project\"],event:message[\"event\"],count:message[\"count\"]}\n @connection.get '/activities', params\n end",
"def set_subject\n url = Settings.hqva_mobile.url\n icn = user.icn\n appointment_id = data[:appointment_id]\n\n {\n use: SUBJECT_USE,\n value: \"#{url}/appointments/v1/patients/#{icn}/Appointment/#{appointment_id}\"\n }\n end",
"def invite\n @data['invite']\n end",
"def update_sent_at\n unless (data = params[:data]).blank?\n clean_data = URI.unescape(data)\n update_list = clean_data.split(\"\\n\").map do |value|\n id, time = value.split('|')\n [OutboundMail.find(id), Time.parse(time)]\n end\n update_list.each do |item|\n outbound_mail, time = item\n outbound_mail.update_column(:sent_at, time)\n end\n ActiveSupport::Notifications.instrument(\"rake.messages.send\", {:text => \"update sent_at: #{update_list.length} records\"})\n end\n\n render :json => \"OK\\n\"\n end",
"def to_s\n '#<Twilio.Messaging.V1.CampaignList>'\n end",
"def cud_response_to_qa(data)\n resp = {}\n data['attributes'].each do |field|\n if Cud.fields.has_key?(field[\"name\"])\n resp[Cud.fields[field[\"name\"]]] = field[\"value\"]\n end\n end\n # Data['attributes'] no longer has affiliation information. They are passed seperately\n aff = []\n if data.fetch('affiliations', nil) && data['affiliations'].any?\n data['affiliations'].each do |field|\n # field has the following keys - source, affiliation, status, startDate, endDate, lastUpdated, dateAdded\n # The affiliations have endDate. If endDate < today - 1 year, we should not use that affiliation\n endDate = Time.parse(field['endDate'][\"$date\"]) rescue nil\n if field['source'] != \"UAS_DARS\" && endDate && endDate > Time.now.ago(1.year)\n aff.push(field[\"affiliation\"])\n end\n end\n end\n if !aff.empty?\n val = aff.max_by(&:length)\n resp[\"current_affiliation\"] = val\n else\n resp[\"current_affiliation\"] = \"\"\n end\n #TODO: If there are no affiliations, we should not use that person\n resp\n end",
"def index\n @campaigns = site.campaigns.by_campaign_and_day.all\n render :json => @campaigns\n end",
"def inbound_payload\n JSON.parse(data)['inbound']['payload']\n end",
"def campaigns(client_id)\n response = Client_GetCampaigns(\"ClientID\" => client_id)\n return [] if response.empty?\n unless response[\"Code\"].to_i != 0\n response[\"Campaign\"].collect{|c| Campaign.new(c[\"CampaignID\"].to_i, c[\"Subject\"], c[\"SentDate\"], c[\"TotalRecipients\"].to_i)}\n else\n raise response[\"Code\"] + \" - \" + response[\"Message\"]\n end\n end",
"def survey_campaign(survey_id, id)\n get(\"survey/#{survey_id}/surveycampaign/#{id}\")\n end",
"def campaign_params\n params.require(:campaign).permit(:displayname, :hooks_json_string)\n end",
"def http_raw_notify_data\n {\n \"id\"=>\"b9879d2b-052f-4a0a-8a3f-3e72049e4d19\", \n \"event\"=>\"invoice_paid\", \n \"payload\"=> invoice_data\n }.to_json\n end",
"def mcget_campaign(campaign_id)\n # campaigns_res = setup_mcapi.campaigns.list( {campaign_id: \"f5666d1862\"} )\n campaigns_res = setup_mcapi.campaigns.list( {campaign_id: campaign_id} )\n search_campaign(campaigns_res)\n end",
"def request_data(code)\n request_data = {\n \"request\" => {\n \"passengers\" => {\n \"adultCount\" => \"1\"\n },\n \"slice\" => [\n {\n \"origin\" => \"OMA\",\n \"destination\" => code,\n \"date\" => (Date.today + 1).to_s\n }\n ],\n \"solutions\" => \"1\"\n }\n }\nend",
"def campaigns(options={})\n response = connection.get do |req|\n \treq.url \"campaigns\", options\n end\n return_error_or_body(response)\n \tend",
"def send_pulse\n require 'rest-client'\n\n response = RestClient.get 'http://gpdigital.crabdance.com/api/v0/aircast_status.php?location=all'\n response = JSON.parse(response)\n\n response.each do |d|\n\n d[\"last_active\"] = Time.zone.parse(d[\"LastAlive\"])\n d[\"beforetime\"] = Time.zone.parse(d[\"OpenTime\"])\n d[\"aftertime\"] = Time.zone.parse(d[\"CloseTime\"])\n now = DateTime.now\n unless now.between?(d[\"beforetime\"], d[\"aftertime\"])\n end\n end\n\n # variable = Mailjet::Send.create(messages: [{\n # 'From'=> {\n # 'Email'=> 'leo@palmsolutions.co',\n # 'Name'=> 'Leo'\n # },\n # 'To'=> [\n # {\n # 'Email'=> 'leo@palmsolutions.co',\n # 'Name'=> 'Leo Lope Lofranco'\n # }\n # ],\n # 'Subject'=> 'Aircast Pulse',\n # 'TextPart'=> 'Dear HGS, welcome to Mailjet! May the delivery force be with you!',\n # 'HTMLPart'=> '<h3>Dear passenger 1, welcome to Mailjet!</h3>≷br/>May the delivery force be with you!'\n # }]\n # )\n # p variable.attributes['Messages']\n end",
"def get_campaign(campaign_id)\n request(:get, \"api/1/campaigns/#{campaign_id}\").campaign\n end",
"def campaign_params\n params.require(:campaign).permit(:name, :body, :sent, :successful, :error,:direcion , :data)\n end",
"def victims_responded_line_items\n # campaign.victims.each {|victim| @victims = victim.opened? ? victim : nil}\n\n [[\"UID\", \"Email\", \"Sent\", \"Clicked\", \"Opened\", \"Password\", \"Time\"]] +\n @victims_responded.map do |victim|\n [victim.uid, \n victim.email_address, \n victim.sent.to_s, \n victim.clicked?.to_s, \n victim.opened?.to_s, \n victim.password?.to_s, \n victim.updated_at.to_s ]\n end\n end",
"def add_event_push_campaign(payload)\n post(url_(\"event-pushcampaign\"), payload)\n end",
"def customer_mailchimp_profile_updated\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :human => \"#{data['email']} updated Mailchimp profile information.\"\n }\n end",
"def campaign\n company.campaign\n end",
"def customerio_payload\n {\n alert: { id: 12345 },\n metric: { name: \"sample_alert\", type: \"gauge\" },\n measurements: [{\n value: 3.14,\n source: \"foo:bar.uid:123\"\n }, {\n value: 1.23,\n source: \"foo:bar.uid:234\"\n }],\n trigger_time: Time.now.to_i\n }.with_indifferent_access\n end",
"def audience\n @campaign = Campaign.find(params[:id])\n end",
"def data_for_role_general_mailing\n {}\n end",
"def campaign_params\n # 多対多関連のチェックボックスに対応\n # http://qiita.com/gotohiro55/items/0d76ac9412b04a431e32\n p = params.require(:campaign).permit(:campaign_source_id, :source_campaign_identifier, :network_id, :campaign_category_id, :name, :detail, :icon_url, :url, :requirement, :requirement_detail, :period, :price, :payment, :payment_is_including_tax, :point, :available, :medium_ids => [])\n p[:medium_ids] ||= []\n p\n end",
"def email_payload\n {\n personalizations: [\n {\n to: [\n email: @to,\n name: @to_name\n ]\n }\n ],\n from: {\n email: @from,\n name: @from_name\n },\n subject: @subject,\n content: [\n {\n type: 'text/plain',\n value: @body\n }\n ]\n }.to_json\n end",
"def cfapi(events)\n messages = []\n\n # For each event\n events.each do |event|\n # Create an outbound event; this can be serialized to json and sent\n event_hash = {\n 'timestamp' => timestamp_in_milliseconds(event.get('@timestamp')),\n 'text' => (event.get('message') or ''),\n }\n\n # Map fields from the event to the desired form\n event_hash['fields'] = merge_hash(event.to_hash)\n .reject { |key,value| @adjusted_fields.has_key?(key) and @adjusted_fields[key] == nil } # drop banned fields\n .map {|k,v| [ @adjusted_fields.has_key?(k) ? @adjusted_fields[k] : k,v] } # rename fields\n .map {|k,v| { 'name' => (safefield(k)), 'content' => v } } # Convert a hashmap {k=>v, k2=>v2} to a list [{name=>k, content=>v}, {name=>k2, content=>v2}]\n\n messages.push(event_hash)\n end # events.each do\n\n { 'events' => messages } # Framing required by CFAPI.\n end",
"def data\r\n {\r\n \"key\" => api_key,\r\n \"message\" => message,\r\n \"async\" => async,\r\n \"ip_pool\" => ip_pool,\r\n \"send_at\" => send_at\r\n }\r\n end",
"def create_submission_stub(_payload)\n {\n 'message' => 'Application Received',\n 'data' => {\n 'carmacase' => {\n 'id' => 'aB935000000F3VnCAK',\n 'createdAt' => DateTime.now.iso8601\n }\n }\n }\n end",
"def hash\n [account_id, campaign_id, csp_id, reseller_id, status, create_date, auto_renewal, billed_date, brand_id, usecase, sub_usecases, description, embedded_link, embedded_phone, affiliate_marketing, number_pool, age_gated, direct_lending, subscriber_optin, subscriber_optout, subscriber_help, sample1, sample2, sample3, sample4, sample5, message_flow, help_message, reference_id, mock, next_renewal_or_expiration_date].hash\n end",
"def serialize_campaign_meta(campaign)\n {\n milestones: campaign\n .milestones\n .order(estimates_at: :desc)\n .map { |milestone| serialize_campaign_milestone(milestone) },\n total_invited_count: campaign.contributors.where.not(referrer: nil).count,\n early_bird_until: campaign.early_bird_until,\n estimate_first_releasing_in: campaign.estimate_first_releasing_in,\n estimate_end_releasing_in: campaign.estimate_end_releasing_in,\n first_releasing_percentage: campaign.first_releasing_percentage,\n estimate_releasing_days_interval: campaign.estimate_releasing_days_interval,\n estimate_releasing_percentage_per_interval: ((100 - campaign.first_releasing_percentage).to_d / (campaign.estimate_end_releasing_in - campaign.estimate_first_releasing_in).to_i * campaign.estimate_releasing_days_interval).to_f.truncate(4),\n contribution_chart: campaign.hourly_contributions.order(timestamp: :asc).limit(CHART_POINTS_LIMIT).pluck(:timestamp, :amount).map { |i| [i[0], i[1].to_f.truncate(4)] }\n }\n end",
"def build\n\t {\n\t \tcampaign_name: advertiser_report['campaign_name'].tr(\"_\", \" \"),\n\t \tstart_date: campaign['start_on'],\n\t \tend_date: campaign['end_on'],\n\t \tmedia_budget: campaign['media_budget'],\n\t \tmedia_spent: advertiser_report['total_campaign_cost'],\n\t \timpressions: advertiser_report['impressions'],\n\t \tclicks: advertiser_report['clicks'],\n\t \tctr: advertiser_report['ctr'],\n\t \tconversions: advertiser_report['conversions'],\n\t \tecpm: calc_ecpm_for(advertiser_report),\n\t \tecpc: calc_ecpc_for(advertiser_report),\n\t \tecpa: calc_ecpa_for(advertiser_report),\n\t \tcreative_name: advertiser_report['creative_name']\n\t \t# spent:\n\t }\n\tend",
"def mcget_campaign_content(campaign_id)\n # campaigns_res = setup_mcapi.campaigns.content(\"f5666d1862\")\n campaigns_res = setup_mcapi.campaigns.content( campaign_id )\n end",
"def set_payload(data)\n @payload = { \n 'caption' => data['caption']['text'], \n 'photo_url' => data['images']['standard_resolution']['url'],\n 'title' => \"#{data['user']['username']}_#{data['created_time']}\"\n }\n @log.debug(\"Payload is #{@payload}\")\n end",
"def get_campaign(access_token, campaign_id)\n url = Util::Config.get('endpoints.base_url') +\n sprintf(Util::Config.get('endpoints.campaign'), campaign_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::Campaign.create(JSON.parse(response.body))\n end",
"def create\n @campaign = Campaign.new(params[:campaign])\n @campaign.build_campaign_stat\n @campaign.campaign_stats_custom.build\n respond_to do |format|\n if @campaign.save\n \n format.html { redirect_to @campaign, notice: 'Campaign was successfully created and sent for review.' }\n format.json { render json: @campaign, status: :created, location: @campaign }\n else\n format.html { render action: \"new\" }\n format.json { render json: @campaign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process\n data = JSON.parse(@message)\n Log.info data.ai\n end",
"def show\n render json: @campaign, include: [\n '*', characters: [:class, :race, :player, status: [:alignment]]\n ]\n end",
"def show\n render json: @campaign\n end",
"def data\n @payload['data']\n end",
"def broadcast_report_data(period)\n unread_msg = all_unread_broadcast_messages(period)\n read_msg = all_read_broadcast_messages(period)\n count_sms = count_broadcast_sms(period)\n res = [[period.to_s.report_period_to_title, 'Unread Messages', 'Read Messages', 'SMS Sent']]\n unread_msg.each{|k, v| res << [k, v, read_msg[k], count_sms[k]] }\n res\n end",
"def general_payload\n payload = Hash.new\n payload['PayloadVersion'] = 1 # do not modify\n payload['PayloadUUID'] = UUIDTools::UUID.random_create().to_s # should be unique\n\n # string that show up in UI, customisable\n payload['PayloadOrganization'] = \"ACME Inc.\"\n payload\nend",
"def get_contact_campaigns(id)\n return make_request(\"#{self.endpoint}/#{id}/campaigns\")\n end",
"def all_event_push_campaigns\n get(url_(\"event-pushcampaign\"))\n end",
"def send_email_through_data(gmail)\n gmail = gmail\n read_hash(gmail,read_json)\n end",
"def mccreate_campaign(type, opts, content)\n # create(type, options, content, segment_opts = nil, type_opts = nil) \n # setup_mcapi.campaigns.create(\"regular\", {list_id: \"a38ec3df9c\", subject: \"Gibbon is cool\", from_email: \"milton@gr33nmedia.com\", from_name: \"Darth Vader\", generate_text: true}, {template_id: \"<html><head></head><body><h1>Foo</h1><p>Bar</p></body></html>\"})\n \n begin\n campaign = setup_mcapi.campaigns.create(type, {list_id: opts[\"list_id\"], subject: opts[\"subject\"], from_email: opts[\"from_email\"], from_name: opts[\"from_name\"], generate_text: true}, {html: content}) \n error = {'error' => true, 'campaign' => campaign[\"id\"]}\n rescue Mailchimp::Error => e\n puts \"A Mailchimp error occurred\"\n error = {'error' => false, 'campaign' => nil}\n end \n return error\n end",
"def send_bulk_email(message, subject = 'Notification')\n client = IronWorkerNG::Client.new\n payload = {}\n payload['message'] = message\n payload['Subject'] = subject\nend",
"def campaign_params\n params.require(:campaign).permit(:title, :description, :campaign_type_id)\n end",
"def http_message\n {\n data: {\n type: \"events\",\n id: event.id,\n attributes: {\n updated_at: event.updated_at,\n }\n }\n }.to_json\n end",
"def delivery_details; message[:delivery_details]; end",
"def email_kyc_approve(data_to_format)\n {}\n end",
"def create\n @campaign = Campaign.new(campaign_params)\n @campaign.organization = current_organization\n date = Date.strptime campaign_params[:expires_at], '%d/%m/%Y'\n @campaign.expires_at = date if date.present?\n\n # Spam check\n begin\n Rails.logger.info \"SPAM_SCORE:\"+SpamController.new.check_spam_score(@campaign.message)\n rescue\n Rails.logger.info \"SPAM_SCORE: spam service error\"\n end\n\n respond_to do |format|\n if @campaign.save\n\n if DigitsClient.exists?\n gcm = GCM.new(Rails.application.secrets[:gcm_api_key])\n\n options = {\n data: {\n organization_name: current_organization.organization_name,\n avatar_normal: current_organization.avatar_normal,\n message: @campaign.message,\n campaign_id: @campaign.id\n }\n }\n response = gcm.send_with_notification_key \"/topics/organization_#{current_organization.id}\", options\n Rails.logger.info response\n end\n\n format.html { redirect_to @campaign, notice: I18n.t('campaigns.created') }\n format.json { render :show, status: :created, location: @campaign }\n else\n format.html { render :new }\n format.json { render json: @campaign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_add_batched_events()\n # Parameters for the API call\n body = JSON.parse('[{\"metadata\":{\"foo\":\"ruby\"},\"request\":{\"time\":\"2019-01-09T04:45:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:45:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:46:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:46:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:47:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:47:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:48:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"metadata\":{\"bar\":\"ruby\"},\"response\":{\"time\":\"2019-01-09T04:48:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"exfzweachxjgznvKUYrxFcxv]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:49:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:49:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"},{\"request\":{\"time\":\"2019-01-09T04:50:42.914\",\"uri\":\"https://api.acmeinc.com/items/reviews/\",\"verb\":\"PATCH\",\"api_version\":\"1.1.0\",\"ip_address\":\"61.48.220.123\",\"headers\":{\"Host\":\"api.acmeinc.com\",\"Accept\":\"*/*\",\"Connection\":\"Keep-Alive\",\"User-Agent\":\"Dalvik/2.1.0(Linux;U;Android5.0.2;C6906Build/14.5.A.0.242)\",\"Content-Type\":\"application/json\",\"Content-Length\":\"126\",\"Accept-Encoding\":\"gzip\"},\"body\":{\"items\":[{\"direction_type\":1,\"discovery_id\":\"fwfrf\",\"liked\":false},{\"direction_type\":2,\"discovery_id\":\"d43d3f\",\"liked\":true}]}},\"response\":{\"time\":\"2019-01-09T04:50:42.914\",\"status\":500,\"headers\":{\"Date\":\"Tue,6Jan201923:46:49GMT\",\"Vary\":\"Accept-Encoding\",\"Pragma\":\"no-cache\",\"Expires\":\"-1\",\"Content-Type\":\"application/json;charset=utf-8\",\"X-Powered-By\":\"ARR/3.0\",\"Cache-Control\":\"no-cache\",\"Arr-Disable-Session-Affinity\":\"true\"},\"body\":{\"Error\":\"InvalidArgumentException\",\"Message\":\"Missingfieldfield_a\"}},\"user_id\":\"my_user_id\",\"company_id\":\"my_company_id\",\"session_token\":\"xcvkrjmcfghwuignrmcmhxdhaaezse4w]s98y18cx98q3yhwmnhcfx43f\"}]').map{|element|\n result = EventModel.from_hash(element)\n result.request.time = Time.now.utc.iso8601\n result.response.time = (Time.now.utc + 1).iso8601\n result\n }\n\n # Perform the API call through the SDK function\n self.class.controller.create_events_batch(body)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 201)\n end",
"def get_json_payload(object_type,obj)\n case\n when object_type == \"Campaign\"\n csv = CSV.read('data/campaign_fields.csv')\n when object_type == \"Contact\"\n csv = CSV.read('data/contact_fields.csv')\n when object_type == \"CampaignMember\"\n csv = CSV.read('data/campaignmember_fields.csv')\n when object_type == \"CampaignMemberPatch\"\n csv = CSV.read(\"data/campaignmemberpatch_fields.csv\")\n end\n payload = build_payload_from_csv(csv,obj)\n # Short-term solution to excessive titles and incorrect titles\n if object_type == \"Campaign\"\n payload[\"Name\"] = payload[\"Name\"][0..79] if payload[\"Name\"].length > 80\n elsif object_type == \"Contact\"\n payload[\"Email\"] = obj[\"order\"][\"email\"] if obj[\"profile\"][\"email\"].nil?\n payload[\"Email\"] = payload[\"Email\"].gsub(',','')\n end\n json_payload = JSON.generate(payload)\n end",
"def assemble_collection_specific\n # TODO custom field text_type_k\n @json[\"sender_k\"] = get_text(@xpaths[\"sender\"])\n end",
"def campaigns_analytics_async\n month_ago = Date.today - 29.days\n campaign_ids = current_organization.campaigns.pluck(:id)\n\n ca = CampaignAnalytic.where(campaign_id: campaign_ids).where('created_at >= ?', month_ago)\n\n campaigns_data = ca.map { |x| {created_at: x.created_at, sent_sms: x.sent_sms}}\n\n people_reached_data = []\n daily_sent_sms = []\n ((Date.today - 29.days)..Date.today).each do |date|\n new_date = date.to_time.to_i * 1000\n\n campaign_data_select = campaigns_data.select { |t| t[:created_at].to_date == date }\n\n sms_sent_sum = campaign_data_select.map { |x| x[:sent_sms] }.sum\n\n if daily_sent_sms.empty?\n daily_sent_sms.push({x: new_date, y: 0})\n else\n daily_sent_sms.push({x: new_date, y: (sms_sent_sum-people_reached_data.last[:y])})\n end\n\n people_reached_data.push({ x: new_date, y: sms_sent_sum })\n end\n\n render json: [\n {\n values: people_reached_data,\n key: I18n.t('analytics.campaigns.sms_sent'),\n color: \"#2ca02c\"\n },\n {\n values: daily_sent_sms,\n key: I18n.t('analytics.campaigns.daily_sms_sent'),\n color: \"#00ff99\"\n }\n ], root: false\n\n end",
"def update_campaign(access_token, campaign)\n url = Util::Config.get('endpoints.base_url') +\n sprintf(Util::Config.get('endpoints.campaign'), campaign.id)\n url = build_url(url)\n payload = campaign.to_json\n response = RestClient.put(url, payload, get_headers(access_token))\n Components::Campaign.create(JSON.parse(response.body))\n end",
"def campaign_params\n params.require(:campaign).permit(:tier, :name, :status, :start_date, :end_date, :user_id, :vendor_id, :customer_id, :specialist_id, :manager_id, :survey_sent, :template, :ready, :template_id, :executive_sponsor, reviewer_ids: [], question_ids: [], questions_attributes: [:id, :metric_id, :kpi_id, :rt_supplier, :rt_business_unit, :rt_strategic_sourcing, :rt_supplier_diversity, :rt_governance, :srm, :weight, :opt1, :opt2, :opt3, :opt4, :opt5, :opt6, :opt7, '_destroy', responses_attributes: [:id, :answer_option, :question_id, :reviewer_id, :comment]], reviewers_attributes: [:id, :first_name, :last_name, :email, :reviewer_type_id, :survey_sent, :title, :division, :bu, :location, :platform, :_destroy])\n end",
"def extract_message(item)\n # message = item[\"message\"]\n # timestamp = DateTime.parse(item[\"@timestamp\"]).strftime(\"%Y-%m-%d %H:%M:%S\") rescue nil\n # from = REGEX_EMAIL.match(REGEX_FROM_EMAIL.match(message)[0])[0] rescue nil\n # to = REGEX_EMAIL.match(REGEX_TO_EMAIL.match(message)[0])[0] rescue nil\n # status = REGEX_STATUS.match(message)[0].split(\"=\")[1] rescue nil\n # subject = REGEX_SUBJECT.match(message)[0].split(\" \")[1..-2].join(\" \") rescue nil\n # error_message = ( status == \"deferred\" || status == \"bounced\" ) ? ( REGEX_ERROR_MESSAGE.match(message)[0] rescue nil ) : nil\n { :timestamp => item[:timestamp],\n :status => item[:status],\n :from => item[:from] ,\n :to => item[:to] ,\n :subject => item[:subject],\n }.merge( item[:error_message] ? { error_message: item[:error_message].split(\" \")[1..-1].join(\" \") } : {})\n end",
"def campaign_params\n params[:campaign].permit(:subject, :detail, :due_date, :cover)\n end",
"def index\n @campaigns = Campaign.all\n render json: @campaigns\n end",
"def payload\n msg = {\n data: {\n alert: alert,\n badge: badge || \"Increment\",\n },\n }\n msg[:data][:sound] = sound if sound.present?\n msg[:data][:title] = title if title.present?\n msg[:data].merge! @data if @data.is_a?(Hash)\n\n if @expiration_time.present?\n msg[:expiration_time] = @expiration_time.respond_to?(:iso8601) ? @expiration_time.iso8601(3) : @expiration_time\n end\n if @push_time.present?\n msg[:push_time] = @push_time.respond_to?(:iso8601) ? @push_time.iso8601(3) : @push_time\n end\n\n if @expiration_interval.is_a?(Numeric)\n msg[:expiration_interval] = @expiration_interval.to_i\n end\n\n if query.where.present?\n q = @query.dup\n if @channels.is_a?(Array) && @channels.empty? == false\n q.where :channels.in => @channels\n end\n msg[:where] = q.compile_where unless q.where.empty?\n elsif @channels.is_a?(Array) && @channels.empty? == false\n msg[:channels] = @channels\n end\n msg\n end",
"def get_info(params)\n begin\n \n id = \"abc123abc123abc123abc123\"\n result = @mandrill.messages.info id\n # {\"smtp_events\"=>[{\"diag\"=>\"250 OK\", \"ts\"=>1365190001, \"type\"=>\"sent\"}],\n # \"template\"=>\"example-template\",\n # \"opens_detail\"=>\n # [{\"ts\"=>1365190001,\n # \"location\"=>\"Georgia, US\",\n # \"ip\"=>\"55.55.55.55\",\n # \"ua\"=>\"Linux/Ubuntu/Chrome/Chrome 28.0.1500.53\"}],\n # \"sender\"=>\"sender@example.com\",\n # \"ts\"=>1365190000,\n # \"email\"=>\"recipient.email@example.com\",\n # \"_id\"=>\"abc123abc123abc123abc123\",\n # \"metadata\"=>{\"website\"=>\"www.example.com\", \"user_id\"=>\"123\"},\n # \"clicks_detail\"=>\n # [{\"ts\"=>1365190001,\n # \"location\"=>\"Georgia, US\",\n # \"ip\"=>\"55.55.55.55\",\n # \"ua\"=>\"Linux/Ubuntu/Chrome/Chrome 28.0.1500.53\",\n # \"url\"=>\"http://www.example.com\"}],\n # \"subject\"=>\"example subject\",\n # \"state\"=>\"sent\",\n # \"clicks\"=>42,\n # \"opens\"=>42,\n # \"tags\"=>[\"password-reset\"]}\n\n rescue Mandrill::Error => e\n # Mandrill errors are thrown as exceptions\n puts \"A mandrill error occurred: #{e.class} - #{e.message}\"\n # A mandrill error occurred: Mandrill::UnknownMessageError - No message exists with the id 'McyuzyCS5M3bubeGPP-XVA'\n raise\n end\n end",
"def response_mailing_information(id, action = 'sends', params = {})\n get(\"/response/#{id}/#{action}\", params)\n end",
"def create(name, template_id, list_ids = [], attrs = {})\n body = attrs.merge(name: name, templateId: template_id, listIds: list_ids)\n Iterable.request(conf, '/campaigns/create').post(body)\n end",
"def get_test_email_recipients(campaign_mailout)\n\t\n \tproject_team_emails = Hash.new\n\t\n\tmarketing_campaign = campaign_mailout.marketing_campaign\n\tproject = marketing_campaign.project\n\t\n\tproject_team_members = project.project_team_members.map{|pm| pm.person}.uniq\n\t\t\n\tproject_team_members.each do |person|\n\t user_contactinfos = person.roles.collect{ |r| r.role_contactinfos.collect{|rc| rc.contactinfo }}.flatten.compact\n\t \n\t user_contactinfos.each do |c|\n\t\t project_team_emails.store(c.email_1, c.email_1) unless c.email_1.blank?\n\t\t project_team_emails.store(c.email_2, c.email_2) unless c.email_2.blank?\n\t\t project_team_emails.store(c.email_3, c.email_3) unless c.email_3.blank?\n\t end\n\tend\n\tproject_team_emails = project_team_emails \t\n \t\n\treturn project_team_emails\n end",
"def webhook_example_event(sample_name)\n data = webhook_example_events(sample_name).first\n if data['raw_params'] && (mandrill_events_data = data['raw_params']['mandrill_events'])\n data['raw_params']['mandrill_events'] = URI.decode_www_form_component(mandrill_events_data)\n end\n data\n end",
"def campaign; Campaign.get(self.campaign_id); end",
"def campaign; Campaign.get(self.campaign_id); end",
"def get_triggered_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"triggered\", :fields => \"incident_number\" }\n end",
"def export_emails(data)\n\t\t\t\t\t\tmy_string = \"\"\n\t\t\t\t\t\t\t\tmatch_val = 0\n\t\t\t\t\t\t\t\t\t\tloc_urn = \"\"\n\t\t\t\t\t\t\t\t\t\t\t\temails = \"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata[\"configurable_attributes\"].each do |item|\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarr = []\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif item[\"category\"] == \"Location\" && item[\"location_urn\"] != nil\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# only push values that are emails\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmy_string = item[\"value\"]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# puts my_string\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmatch_val = /@/ =~ my_string\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# puts match_val\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif match_val >= 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# add data to csv\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarr.push(item[\"location_urn\"], item[\"value\"])\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tadd_to_csv arr\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\nend",
"def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Messaging.V1.CampaignInstance #{values}>\"\n end",
"def respond_to_slack_event json\n \n # find the team\n team_id = json['team_id']\n api_app_id = json['api_app_id']\n event = json['event']\n event_type = event['type']\n event_user = event['user']\n event_text = event['text']\n event_channel = event['channel']\n event_ts = event['ts']\n \n team = Team.find_by(team_id: team_id)\n \n # didn't find a match... this is junk! \n return if team.nil?\n \n # see if the event user is the bot user \n # if so we shoud ignore the event\n return if team.bot_user_id == event_user\n \n event = Event.create(team_id: team_id, type_name: event_type, user_id: event_user, text: event_text, channel: event_channel, direction: \"incoming\", timestamp: Time.at(event_ts.to_f) )\n event.team = team\n event.save!\n \n client = team.get_client\n \n event_to_action client, event, team\nend",
"def m_webhook_params\n params.require(:m_webhook).permit(:event, :email, :hook_id, :camp_id, :campaign_name, :date_sent, :date_event, :ts_event, :ts_sent, :tag, :url, :sending_ip, :esp, :uer, :reason, :ts, :origin_id, :list_id)\n end",
"def as_json(options)\n super().merge!(type: \"subject\")\n end",
"def list(options={})\n Mailgun.submit(:get, campaign_url, options)[\"items\"] || []\n end",
"def build_analytics_events_payload\n events = []\n 1000.times do\n event = {\n 'timestamp' => Process.clock_gettime(Process::CLOCK_REALTIME),\n 'name' => +'Controller/foo/bar',\n 'type' => +'Transaction',\n 'duration' => rand,\n 'databaseDuration' => rand,\n 'databaseCallCount' => rand,\n 'gcCumulative' => rand,\n 'host' => +'lo-calhost',\n 'color' => +'blue-green',\n 'shape' => +'squarish',\n 'texture' => +'sort of lumpy like a bag of frozen peas'\n }\n events << [event, {}]\n end\n [rand(1000000), events]\n end",
"def campaign_params\n params.require(:campaign).permit(:title, :description, :tenant_id)\n end",
"def initialize_freshdesk_data(autopilot_contact,autopilot_event)\n\t\tlastname = autopilot_contact[\"LastName\"].nil? ? \"\" : autopilot_contact[\"LastName\"]\n\t {\n\t \"name\" => autopilot_contact[\"FirstName\"] +\" \"+lastname,\n\t \t\"email\" => autopilot_contact[\"Email\"],\n\t \t\"phone\" => autopilot_contact[\"Phone\"].nil? ? \"\" : autopilot_contact[\"Phone\"].to_s,\n\t\t\"job_title\" => autopilot_contact[\"Title\"],\n\t \t\"mobile\" => autopilot_contact[\"MobilePhone\"].nil? ? \"\" : autopilot_contact[\"MobilePhone\"].to_s,\n\t \t\"twitter_id\" => autopilot_contact[\"Twitter\"],\n\t \t\"address\" => get_address(autopilot_contact),\n\t \t\"custom_fields\" => {}\n\t }\n\tend",
"def campaign_params\n\t\tparams.require(:campaign).permit(:title, :questionnaire_id)\n\tend",
"def campaign\n @model = 'campaign'\n @key = 'title'\n @values = Campaign.all.order(created_at: :desc)\n render 'campaigns'\n end",
"def mccreate_campaign_template(type, opts)\n # setup_mcapi.campaigns.create(\"regular\", {list_id: \"a38ec3df9c\", subject: \"Gibbon is cool\", from_email: \"milton@gr33nmedia.com\", from_name: \"Darth Vader\", template_id: 198041, generate_text: true}, {})\n setup_mcapi.campaigns.create(type, opts, content = nil, segment_opts = nil, type_opts = nil) \n end",
"def create\n @campaign = Campaign.new(campaign_params)\n\n if @campaign.save\n render json: @campaign\n else\n render json: @campaign.errors, status: :unprocessable_entity\n end\n end",
"def email_kyc_report_issue(data_to_format)\n {}\n end",
"def build_payload(issuer, push_notification_url, uuid)\n iat = Time.zone.now.to_i\n {\n iss: Rails.application.routes.url_helpers.root_url,\n iat: iat,\n exp: iat + 12.hours.to_i,\n jti: jti(iat),\n aud: push_notification_url,\n events: {\n EVENT_TYPE_URI => {\n subject: {\n subject_type: 'iss-sub',\n iss: issuer,\n sub: uuid,\n },\n },\n },\n }\n end",
"def as_json(options = {})\n {\n :id => self.id,\n :title => self.subject.name,\n :description => self.description || \"\",\n :start => starts_at.rfc822,\n :end => ends_at.rfc822,\n :allDay => self.all_day,\n :recurring => false,\n :url => Rails.application.routes.url_helpers.routine_path(id)\n }\n end",
"def create\n @campaign = Campaign.create!(name: params[:name], dm_id: params[:dm_id], theme: params[:theme], setting: params[:setting], calendar_id: params[:calendar_id], starting_level: params[:starting_level], skillset_id: params[:skillset_id], custom_notes: params[:custom_notes], starting_month: params[:month], starting_weekday: params[:weekday], starting_day: params[:day], starting_year: params[:year], starting_age: params[:age], current_month: params[:month], current_weekday: params[:weekday], current_day: params[:day], current_year: params[:year], current_age: params[:age])\n\n params[:race_ids].each do |ri|\n CampaignRace.create!(campaign_id: @campaign.id, race_id: ri)\n end\n\n params[:klass_ids].each do |ki|\n CampaignKlass.create!(campaign_id: @campaign.id, klass_id: ki)\n end\n\n render json: @campaign, status: 201\n\n end",
"def post subject, text, options = {}\n date = if options[:date] then\n if String === options[:date] then\n DateTime.parse(options[:date])\n else\n options[:date]\n end\n else\n DateTime.now\n end\n\n\n callhash = {\n :event => text,\n :subject => subject,\n :year => date.year,\n :mon => date.month,\n :day => date.day,\n :hour => date.hour,\n :min => date.min,\n :lineendings => \"unix\",\n :props => {}\n }\n\n if options[:security] then\n callhash[:security]=options[:security]\n end\n\n {\n :mood => :current_mood,\n :music => :current_music,\n :preformatted => :opt_preformatted,\n :nocomments => :opt_nocomments,\n :picture => :picture_keyword,\n :noemail => :opt_noemail,\n :backdated => :opt_backdated\n }.each do |option_name, lj_option_name|\n if options[option_name] then\n callhash[:props][lj_option_name] = options[option_name]\n end\n end\n\n postevent callhash\n end",
"def attributes\n \tdata = super # get the current JSON object\n \trecipient = object\n\n data[:is_visible] = 1 # visible by default\n\n relationship_id = data[:relationship_id]\n relationship = Relationship.find_by(id: relationship_id)\n data[:relationship] = relationship\n\n primary_address = recipient.addresses.first\n data[:primary_address] = primary_address\n\n addresses = recipient.addresses\n data[:addresses] = addresses\n\n occasions = Array.new\n\n recipient_occasions = recipient.recipient_occasions.live\n recipient_occasions.each do |recipient_occasion|\n\n occasion_data = Hash.new\n occasion_data[:recipient_occasion] = recipient_occasion\n occasion = recipient_occasion.occasion\n occasion_data[:occasion] = occasion\n occasions << occasion_data\n\n end\n\n data[:occasions] = occasions\n\n # profile picture if it exists\n profile_picture = recipient.profile_pictures.first\n if profile_picture && profile_picture.picture?\n data[:profile_picture] = profile_picture.picture.url\n end\n\n data\n\n end",
"def history_data\n @id = params[:id]\n @item_history = []\n @item_name = @item_names[@id.to_i]\n json_str = Net::HTTP.get(URI.parse(\"http://#{THINGSPEAK_SERVER}/channels/#{OT_CHANNEL}/feed.json?results=200\")) \n parsed_hash = ActiveSupport::JSON.decode(json_str)\n parsed_hash[\"feeds\"].each do |e|\n if e[\"field1\"] == @id\n item = {}\n t = Time.strptime(e[\"created_at\"], \"%FT%T%z\")\n item[\"time\"] = t.strftime(\"%b %d, %Y %H:%M:%S\")\n item[\"curr_loc\"] = e[\"field4\"]\n @item_history.push(item)\n end\n end\n\n render :template => \"static/history_data\", :formats => [:json], :handlers => \"haml\", :layout => false\n end"
] | [
"0.5975898",
"0.5762865",
"0.5715143",
"0.569575",
"0.56628025",
"0.5376054",
"0.5373471",
"0.53494716",
"0.53301656",
"0.5320408",
"0.5264978",
"0.5246386",
"0.52330554",
"0.52212316",
"0.52072406",
"0.52053136",
"0.50999343",
"0.5090078",
"0.5073651",
"0.50715154",
"0.50434583",
"0.50316554",
"0.5029006",
"0.5026037",
"0.5025313",
"0.50247556",
"0.5024106",
"0.5000412",
"0.49998954",
"0.49944198",
"0.49855855",
"0.49792886",
"0.4978179",
"0.49739668",
"0.49708202",
"0.49706087",
"0.49703243",
"0.49589634",
"0.49352095",
"0.49342874",
"0.4924198",
"0.4911541",
"0.49070838",
"0.49038643",
"0.4901451",
"0.48967797",
"0.48907974",
"0.48863542",
"0.48838452",
"0.48763525",
"0.48675302",
"0.48614433",
"0.4861212",
"0.4859542",
"0.48580042",
"0.48567852",
"0.4853219",
"0.485166",
"0.48509717",
"0.48425096",
"0.48419514",
"0.4837298",
"0.48328948",
"0.48254132",
"0.4811327",
"0.48048082",
"0.4802764",
"0.48008272",
"0.4799384",
"0.47952867",
"0.4791538",
"0.47874632",
"0.47855374",
"0.47833288",
"0.4779384",
"0.47793558",
"0.4769981",
"0.4769585",
"0.4769585",
"0.47679126",
"0.47590938",
"0.4758115",
"0.4753601",
"0.4750236",
"0.4747135",
"0.47470057",
"0.47380412",
"0.47373626",
"0.47357905",
"0.47315276",
"0.4728658",
"0.47234508",
"0.47231406",
"0.4722285",
"0.4720915",
"0.47111169",
"0.47105804",
"0.47049883",
"0.47031885",
"0.47000024"
] | 0.6306562 | 0 |
Returns the set of line numbers corresponding to the lines that were changed in a specified file. | def modified_lines_in_file(file)
subcmd = 'show --format=%n'
@modified_lines ||= {}
@modified_lines[file] ||=
Overcommit::GitRepo.extract_modified_lines(file, subcmd: subcmd)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_modified_lines(file)\n git_range_info_line_regex = /^@@ .+\\+(?<line_number>\\d+),/\n git_modified_line_regex = /^\\+(?!\\+|\\+)/\n file_info = git.diff_for_file(file)\n line_number = 0\n lines = []\n file_info.patch.split(\"\\n\").each do |line|\n starting_line_number = 0\n case line\n when git_range_info_line_regex\n starting_line_number = Regexp.last_match[:line_number].to_i\n when git_modified_line_regex\n lines << line_number\n end\n line_number += 1 if line_number.positive?\n line_number = starting_line_number if line_number.zero? && starting_line_number.positive?\n end\n lines\n end",
"def git_modified_lines(file)\n git_range_info_line_regex = /^@@ .+\\+(?<line_number>\\d+),/ \n git_modified_line_regex = /^\\+(?!\\+|\\+)/\n git_removed_line_regex = /^[-]/\n git_not_removed_line_regex = /^[^-]/\n file_info = git.diff_for_file(file)\n line_number = 0\n lines = []\n file_info.patch.split(\"\\n\").each do |line|\n starting_line_number = 0\n case line\n when git_range_info_line_regex\n starting_line_number = Regexp.last_match[:line_number].to_i\n when git_modified_line_regex\n lines << line_number\n end\n line_number += 1 if line_number > 0\n line_number = starting_line_number if line_number == 0 && starting_line_number > 0\n end\n lines\n end",
"def changed_lines(changed_file)\n diff = git.diff_for_file(changed_file)\n return [] unless diff\n\n diff.patch.split(\"\\n\").select { |line| %r{^[+-]}.match?(line) }\n end",
"def extract_modified_lines(file_path, options)\n lines = Set.new\n\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --no-ext-diff -U0 #{flags} #{refs} -- '#{file_path}'`.\n scan(DIFF_HUNK_REGEX) do |start_line, lines_added|\n lines_added = (lines_added || 1).to_i # When blank, one line was added\n cur_line = start_line.to_i\n\n lines_added.times do\n lines.add cur_line\n cur_line += 1\n end\n end\n\n lines\n end",
"def extract_modified_lines(file_path, options)\n lines = Set.new\n\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --no-color --no-ext-diff -U0 #{flags} #{refs} -- \"#{file_path}\"`.\n scan(DIFF_HUNK_REGEX) do |start_line, lines_added|\n lines_added = (lines_added || 1).to_i # When blank, one line was added\n cur_line = start_line.to_i\n\n lines_added.times do\n lines.add cur_line\n cur_line += 1\n end\n end\n\n lines\n end",
"def modified_lines_in_file(file)\n staged = squash?\n refs = 'HEAD^ HEAD' if merge_commit?\n @modified_lines ||= {}\n @modified_lines[file] ||=\n Overcommit::GitRepo.extract_modified_lines(file, staged: staged, refs: refs)\n end",
"def modified_lines_in_file(_file)\n EMPTY_SET\n end",
"def updated_lines\n io = @diff.each_line\n path = nil\n\n found = []\n\n while true\n line = io.next\n if line =~ FILE_PATTERN\n path = $1\n end\n\n if hunk_header?(line)\n line_numbers = line_numbers_for_destination(line)\n found << [ path, line_numbers ]\n end\n end\n rescue StopIteration\n return found\n end",
"def lines_affected\n @lines_affected = line_codes_affected.map {|l| Line.get(l.strip)}\n end",
"def find_file_lines(file)\n file.open { |f| find_number_lines(f) }\n end",
"def filter_matched_lines(matched_files)\n matched_lines = []\n\n matched_files.each do |file|\n diff = git.diff_for_file(file)\n next if diff.binary?\n\n patch_lines = diff.patch.split(\"\\n\").map(&:strip)\n diff_start_line = [patch_lines.select { |line| line.start_with? \"@@\" }].flatten.compact\n next if diff_start_line.empty?\n\n start_line_number = patch_lines.index(diff_start_line[0]) + 1\n matched_lines += patch_lines[start_line_number, patch_lines.count - 1]\n .map(&:strip)\n .select { |line| line.start_with? \"+\" }\n end\n\n return [matched_lines].flatten.compact\n end",
"def currently_changed_files\n `git status --porcelain`.split(\"\\n\").map{ |file| file.split.last }\n end",
"def line_diff\n return { :added => @added_lines, :removed => @removed_lines }\n end",
"def find_number_lines(opened_file)\n start_time = Time.now.to_i\n total_file_lines = opened_file.each_line.inject(0) { |total, _amount| total + 1 }\n opened_file.rewind\n if Rails.env.development?\n end_time = Time.now.to_i\n puts(\"1. Lines ==> #{total_file_lines} in #{((end_time - start_time) / 60).round(2)}\")\n end\n total_file_lines\n end",
"def diff_lines\n @diff_lines ||=\n Gitlab::Diff::Parser.new.parse(raw_diff.each_line, diff_file: self).to_a\n end",
"def find_changes(lines)\n # look for a `changes` marker\n if idx = lines.index{ |line| /^changes\\:?\\s*$/i =~ line }\n return idx\n end\n\n # look for an enumerated list in reverse order\n if idx = lines.reverse.index{ |line| /^1\\.\\ / =~ line }\n idx = lines.size - idx - 1\n return idx \n end\n\n # look for first outline bullet\n if idx = lines.index{ |line| /^\\*\\ / =~ line }\n return idx\n end\n\n return nil\n end",
"def changed_files\n # FIXME: Implement properly once changed detection is available.\n files\n end",
"def line_breakpoints(file_path)\n return [] if @source_breakpoints[canonical_file_path(file_path)].nil?\n @source_breakpoints[canonical_file_path(file_path)].map(&:line)\n end",
"def modified_files\n diff = git.diff(local_branch, remote_branch(local_branch))\n diff.stats[:files].keys\n end",
"def all_changed_files\n Set.new\n .merge(git.added_files.to_a)\n .merge(git.modified_files.to_a)\n .merge(git.renamed_files.map { |x| x[:after] })\n .subtract(git.renamed_files.map { |x| x[:before] })\n .to_a\n .sort\n end",
"def changed_files\n DeliveryTruck::Helpers.changed_files(\n DeliveryTruck::Helpers.pre_change_sha(node),\n node['delivery']['change']['sha'],\n node\n )\n end",
"def lines\n repository.files.map do |file|\n repository.read(file).to_s.lines.count\n end.sum\n end",
"def index_for(file, line_number)\n diff_for_file(file).fetch(:diff_chunks).\n reduce(0) do |index, position:, size:, diff:|\n # Unless we are processing the target chunk\n unless line_number.between?(position, position + size)\n next index + 1 + diff.lines.count\n end\n\n position -= 1 # rebase position on first line of chunk\n index_in_chunk = diff.lines.find_index do |line|\n position += 1 unless line.first == '-'\n position == line_number\n end\n\n return index + 1 + index_in_chunk\n end\n\n nil # if this line number is not in diff\n end",
"def test_get_line_number_03\n old_positions = OriginalFile.get_line_number(1)\n old_array_line_number=[1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52]\n assert_equal old_array_line_number,old_positions.values_at(0..50)\n\n new_positions = OriginalFile.get_line_number(2)\n new_array_line_number=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51]\n assert_equal new_array_line_number,new_positions.values_at(0..50)\n end",
"def covered_lines\n covered_lines = 0\n @files.select { |f|\n @file_whitelist.include? f.filename\n }.each do |file|\n original_result[file.filename].each do |line_result|\n covered_lines += 1 if line_result and line_result > 0\n end\n end\n covered_lines\n end",
"def get_lines(filename); end",
"def find_patch_for_line_number(file_patches, line_number)\n file_patches.detect do |patch|\n patch.changed_line_numbers.include?(line_number)\n end\n end",
"def line_codes_affected\n @attrs['LinesAffected'].split(\";\").reject {|s| s.empty? || s.nil?}\n end",
"def lines\n @lines ||= line_codes.map {|l| Line.get(l)}\n end",
"def line2offsets(line_number)\n offsetlines.select do |offset, lines| \n lines.member?(line_number) \n end.keys\n end",
"def get_lines\n lines = []\n read_file.each_line{|l| lines << l.chomp }\n @total_lines = lines.shift.to_i\n lines\n end",
"def files_changed_as_set(files)\n changed_files = files.select { |file| git.modified_files.include? file }\n not_changed_files = files.select { |file| !changed_files.include? file }\n all_files_changed = not_changed_files.empty?\n no_files_changed = changed_files.empty?\n return all_files_changed || no_files_changed\nend",
"def extract_modified_lines(file_path, options); end",
"def extract_modified_lines(file_path, options); end",
"def modified_files\n file_stats.count { |file| file.status == :modified }\n end",
"def file_line_count(file_name)\n line_count = `wc -l < #{file_name}`.to_i\n LoggerHelper.print_to_log(\"Count of lines in '#{file_name}' is #{line_count}\")\n line_count\n end",
"def get_file_lines_of_code!(f)\n count = 0;\n File.foreach(f) {count+=1}\n #print(\"#{count}\")\n count\n end",
"def modified_files\n `git diff --cached --name-only --diff-filter=ACM --ignore-submodules=all`.split \"\\n\"\n end",
"def get_files_modified\r\n\tgit_result = IO.popen('git status -u --porcelain').read\r\n\tgit_result.split(/[\\r\\n]+/).uniq.map!{|file| file.slice 3..-1}\r\nend",
"def get_uncommitted_files\n\t\t\tlist = read_command_output( 'hg', 'status', '-n', '--color', 'never' )\n\t\t\tlist = list.split( /\\n/ )\n\n\t\t\ttrace \"Changed files: %p\" % [ list ]\n\t\t\treturn list\n\t\tend",
"def file_revisions(file)\n file = file.gsub(%r{^/}, '')\n output = sh_string(\"git log --format='%h|%s|%aN|%ai' -n100 #{ShellTools.escape(file)}\")\n output.to_s.split(\"\\n\").map do |log_result|\n commit, subject, author, date = log_result.split('|')\n date = Time.parse(date.sub(' ', 'T')).utc.iso8601\n { commit: commit, subject: subject, author: author, date: date }\n end\n end",
"def git_changed_line\n `git diff | grep ' #{name} (' | grep '+ '`\n end",
"def lines\n old_order_lines\n end",
"def ruby_lines\n repository.files(:pattern => /.rb/).map do |file|\n repository.read(file).to_s.lines.count\n end.sum\n end",
"def extract_change_count_from_git_log(log_text)\n lines = log_text.split(\"\\n\" )\n change_lines=lines.find_all do | line |\n line.include?('changed')\n end\n change_lines.length\nend",
"def comment_lines\n repository.files.map do |file|\n content = repository.read(file)\n content.to_s.lines.map do |line|\n first = line.strip[0]\n first = first.chr if first\n first == '#' ? 1 : 0\n end.sum\n end.sum\n end",
"def line_count(file)\n\t\tf = File.new(file)\n\t\tnum_newlines = 0\n\t\twhile (c = f.getc) != nil\n\t\t\tnum_newlines += 1 if c == $/\n\t\tend\n\t\tnum_newlines\n\tend",
"def git_modified_files_info()\n modified_files_info = Hash.new\n updated_files = (git.modified_files - git.deleted_files) + git.added_files\n updated_files.each {|file|\n modified_lines = git_modified_lines(file)\n modified_files_info[File.expand_path(file)] = modified_lines\n }\n modified_files_info\n end",
"def missed_lines\n missed_lines = 0\n @files.select { |f|\n @file_whitelist.include? f.filename\n }.each do |file|\n original_result[file.filename].each do |line_result|\n missed_lines += 1 if line_result == 0\n end\n end\n missed_lines\n end",
"def changed_files_since_deploy\n if File.exists?(\"log/latest-REVISION-syntaxcheck\")\n revision = File.read(\"log/latest-REVISION-syntaxcheck\").chomp\n\n `git whatchanged #{revision}..HEAD`.split(\"\\n\").select{|l| l =~ /^\\:/}.collect {|l| l.split(\"\\t\")[1]}.sort.uniq\n else\n puts \"log/latest-REVISION-syntaxcheck not found. run 'cap fetch_currently_deployed_version' to get it\"\n []\n end\n end",
"def lines(path)\n @path = path\n @lines = []\n @state = @syntax.start_state\n @errors.in_file_lines(path) { |line| scan_line(line.chomp) }\n return @lines\n end",
"def line_numbers=(line_numbers)\n filter_run_including :line_numbers => line_numbers.map{|l| l.to_i}\n end",
"def decorate(diff_file)\n if content = read_file(diff_file)\n diff_file.highlighted_diff_lines = content.map do |line|\n Gitlab::Diff::Line.init_from_hash(line)\n end\n end\n end",
"def previously_changed_files\n `git show --pretty=\"format:\" --name-only`.split(\"\\n\")\n end",
"def hilite_new_infections(file)\n return \"unchanged\" if prev_scan.nil? || prev_scan.infections == scan.infections\n Thread.current[:prev_infections] ||= prev_scan.infections.collect{|infection| infection.file}\n return (Thread.current[:prev_infections].include?(file) ? \"unchanged\" : \"changed\")\nend",
"def changes\n @changes ||= Set.new\n end",
"def changes\n @changes ||= Set.new\n end",
"def changed\n _find_changed_twins!(@_changes)\n\n @_changes\n end",
"def file_statistics(filename)\n line_count = 0; loc_count = 0;\n \n File.new(filename, 'r').each_line do |line|\n line.strip!\n line_count += 1\n \n # don't count blank lines or comment lines in LOC\n loc_count += 1 if line.gsub(/[\\/\\*\\s]/i, \"\").length > 1 && line.match(/^\\/\\//).nil?\n end\n \n {:line_count => line_count, :loc_count => loc_count}\n end",
"def count_lines(all_lines_from_file)\n all_lines_from_file.lines.count\nend",
"def update_line_numbers!\n each_with_index do |lo, new_line_number|\n lo.line_number = new_line_number\n end\n end",
"def affected_lines_range\n (line_no..line_no + replaced_text.count(\"\\n\"))\n end",
"def build_warnings\n flagged_results = Set.new\n\n changeset.each_changed_line do |filepath, line_no|\n dist_from_line_no = lambda do |res|\n return BigDecimal::INFINITY if line_no < res.first_line\n\n res_lines = res.first_line..res.last_line\n return BigDecimal::INFINITY unless res_lines.cover?(line_no)\n\n line_no - res.first_line\n end\n dist_from_line_no_sorter = lambda do |res1, res2|\n dist_from_line_no[res1] <=> dist_from_line_no[res2]\n end\n next unless results[filepath]\n\n res = results[filepath].min(&dist_from_line_no_sorter)\n flagged_results << res if res&.uncovered?(line_no)\n end\n flagged_results\n end",
"def count_lines()\n start_time = Time.now\n @file_lines = 0 \n last_block_position = 0\n prev_block_position = -1\n Rula.log(Logger::DEBUG,\"Reading file #{@filename} lines count\",self)\n file_handle = File.open(@filename,'rb')\n while data = file_handle.read(@@BLOCK_SIZE)\n original_size = data.length\n last_occurence = data.rindex(Rula.options[:line_separator])\n difference_in_size = original_size - last_occurence\n\n if data.length==1 then\n break\n end\n\n if !last_occurence.nil? then\n data = data[0..last_occurence]\n file_handle.pos -= difference_in_size\n end\n @file_lines += data.scan(/([^|#{Rula.options[:line_separator]}].*)#{Rula.options[:line_separator]}/).length\n \n (0...@@BUFFERS).each {|i| \n @buffers[i].add_hash(last_block_position, prev_block_position, file_handle.pos, @file_lines)\n }\n prev_block_position = last_block_position \n last_block_position = file_handle.pos\n end\n Rula.log(Logger::DEBUG,\"Counted #{@file_lines} lines for file #{@filename}\",self)\n ensure\n Rula.log(Logger::DEBUG,\"Counting lines ran #{(Time.now - start_time) * 1000} ms\",self)\n file_handle.close()\n load_buffer_data(0)\n end",
"def find_previous_dotlines(file, expression)\n count = 0\n file.each_line do |line|\n count +=1\n if line.include?(expression)\n return count\n end\n end\n return nil\nend",
"def lines\n @document.lines @line_numbers\n end",
"def additions_map\n if @changes.empty?\n self.additions\n end\n\n map = []\n starting_line = ending_line = 0\n\n @changes.each do |addition|\n if starting_line == 0\n starting_line = ending_line = addition.line_number\n elsif addition.line_number == ( ending_line + 1 )\n ending_line = addition.line_number\n else # this row is not part of the last rows \"group\"\n map.push([starting_line, ending_line])\n starting_line = ending_line = addition.line_number\n end\n end\n map.push([starting_line, ending_line])\n map\n end",
"def changeset\n @changeset ||= git_diff.map do |diff_file|\n file_diff = FileDiff.new(diff_file)\n file_diff unless FormattingChecker.pure_formatting?(file_diff)\n end.compact\n end",
"def each_change\n old_ln = old_ln_cache = 0\n new_ln = new_ln_cache = 0\n\n @changes.each_with_index do |line, i|\n if line =~ /@ -(\\d+),\\d+ \\+(\\d+),\\d+/\n old_ln_cache = $1.to_i\n new_ln_cache = $2.to_i\n end\n\n type = LINE_TYPES[line[0]]\n case type\n when :add\n old_ln = ''\n new_ln = new_ln_cache\n new_ln_cache += 1\n when :del\n old_ln = old_ln_cache\n old_ln_cache += 1\n new_ln = ''\n when :info\n old_ln = new_ln = '...'\n else\n new_ln = new_ln_cache\n old_ln = old_ln_cache\n old_ln_cache += 1\n new_ln_cache += 1\n end\n\n yield(line, type, @index + i, old_ln, new_ln)\n end\n end",
"def src_lines(pr)\n count_lines(src_files(pr))\n end",
"def lines\n File\n .read(@source_path)\n .lines\n .map(&:chomp)\n .reject { |line| line.strip.empty? || line.match(Tokens::COMMENT_MATCHER) }\n end",
"def patch_lines\n old_line, new_line = old_start, new_start\n \n old_lines = diff.old_object && diff.old_object.data_lines\n new_lines = diff.new_object && diff.new_object.data_lines\n \n diff_data = summary.split(/(\\d+)/)\n lines = []\n i = 0\n while i < diff_data.length\n line_type, line_count = diff_data[i][0], diff_data[i + 1].to_i\n i += 2\n line_count.times do\n case line_type\n when ?+\n line = [nil, new_line, nil, nil]\n new_line += 1\n when ?-\n line = [old_line, nil, nil, nil]\n old_line += 1\n when ?\\\\\n newline_text = '\\\\ No newline at end of file'\n line = [old_line, new_line, newline_text, newline_text]\n else\n line = [old_line, new_line, nil, nil]\n old_line += 1\n new_line += 1\n end\n line[2] ||= line[0] && old_lines[line[0] - 1]\n line[3] ||= line[1] && new_lines[line[1] - 1]\n lines << line\n end\n end\n lines\n end",
"def changed_files(parent_sha, change_sha, node)\n response = shell_out!(\n \"git diff --name-only #{parent_sha} #{change_sha}\",\n cwd: repo_path(node)\n ).stdout.strip\n\n changed_files = []\n response.each_line do |line|\n changed_files << line.strip\n end\n changed_files\n end",
"def altered_files; (modified + added + removed).sort; end",
"def lineoffsets\n result = {}\n offsetlines.each do |offset, lines|\n lines.each do |line|\n result[line] ||= []\n result[line] << offset\n end\n end\n result\n end",
"def get_lines(filename)\n return File.open(filename, 'r').readlines\nend",
"def get_lines(filename)\n return File.open(filename, 'r').readlines\nend",
"def get_lines(filename)\n return File.open(filename, 'r').readlines\nend",
"def changed_paths_check(revision,repo)\n `svnlook changed -r #{revision} #{repo}`.split(\"\\n\")\n end",
"def diff_lines_for_serializer\n strong_memoize(:diff_lines_for_serializer) do\n lines = highlighted_diff_lines\n\n next if lines.empty?\n next if blob.nil?\n\n last_line = lines.last\n\n if last_line.new_pos < total_blob_lines(blob) && !deleted_file?\n match_line = Gitlab::Diff::Line.new(\"\", 'match', nil, last_line.old_pos, last_line.new_pos)\n lines.push(match_line)\n end\n\n lines\n end\n end",
"def show_changed_files(status)\n status.each_line do |line|\n if line =~ /^#\\t/ # only print out the changed files (I think)\n if line =~ /new file:|modified:|deleted:/\n puts \" #{line}\" \n else\n puts \" #{line.chop}\\t\\t(may need to be 'git add'ed)\" \n end\n end\n end\nend",
"def svn_status(current_dir)\n modified_files = []\n `svn status #{current_dir}`.split(/\\n/).map do |file|\n file =~ /(\\?|\\!|\\~|\\*|\\+|A|C|D|I|M|S|X)\\s*([\\w\\W]*)/\n\n if file =~ /^M/\n modified_files << file.split[-1]\n elsif file =~ /^C/\n raise \"ERROR: file found in conflict: #{file.split[-1]}\"\n end\n end\n return modified_files\nend",
"def refs(file, line, col); end",
"def refs(file, line, col); end",
"def change_checker\n `svnlook changed #{@repo} -r #{@revision}`.split(\"\\n\")\n end",
"def source_for(file)\n return @last_lines if file == @last_file\n\n @last_file, @last_lines = file, nil\n if File.exists?(file)\n @last_lines = File.readlines(file)\n end\n @last_lines\n end",
"def changed?\n @changed ||= sorted_file != IO.read(file)\n end",
"def trace_file_lines(path)\n begin\n File.open(path, 'r') { |file| file.read.lines }\n rescue Errno::ENOENT\n p \"Não foi possível o arquivo (nome inválido)\"\n exit\n end\n end",
"def size_in_lines(filepath)\n f = File.new(filepath)\n f.readlines[-1]\n count = f.lineno.to_s\n puts \"The link check report contains #{count} lines.\".blue\n puts \"To see the report, open the #{filepath} file.\".blue\n end",
"def diff_file(from_file, to_file, context=3)\n seq1 = File.open(from_file).readlines\n from_mtime = File.stat(from_file).mtime\n seq2 = File.open(to_file).readlines\n to_mtime = File.stat(to_file).mtime\n sdiff = Diff::LCS.sdiff(seq1, seq2)\n diff_lines(seq1, seq2, from_file, to_file, from_mtime, \n to_mtime, context)\n end",
"def covered_lines\n coverage_statistics[:line]&.covered\n end",
"def modified_files\n @modified_files ||= begin\n @modified_files = []\n\n rewritten_commits.each do |rewritten_commit|\n refs = \"#{rewritten_commit.old_hash} #{rewritten_commit.new_hash}\"\n @modified_files |= Overcommit::GitRepo.modified_files(refs: refs)\n end\n\n filter_modified_files(@modified_files)\n end\n end",
"def find_matching_source_lines\n\t\tmatches = []\n\n\t\tsource_files = $hoespec.spec.files.grep( /\\.(h|c|rb)$/ )\n\t\tsource_files -= self.quality_check_whitelist\n\n\t\tsource_files.each do |filename|\n\t\t\tprevious_line = nil\n\n\t\t\tIO.foreach( filename ).with_index do |line, i|\n\t\t\t\tmatches << [filename, i + 1, line] if yield( line, previous_line )\n\t\t\t\tprevious_line = line\n\t\t\tend\n\t\tend\n\n\t\treturn matches\n\tend",
"def count_lines(file)\n n = 0\n while file.gets\n n += 1\n end\n n\n end",
"def file_changed(start_commit, end_commit, filepath)\n command = \"git diff --name-only '#{start_commit}..#{end_commit}' -- #{filepath}\"\n changed_file = `#{command}`.strip\n return !changed_file.empty?\n end",
"def potential_lines(filename); end",
"def relevant_assignment_lines(line_range)\n result = []\n original_line_indent = processed_source\n .line_indentation(line_range.first)\n relevant_line_indent_at_level = true\n\n line_range.each do |line_number|\n current_line_indent = processed_source.line_indentation(line_number)\n blank_line = processed_source.lines[line_number - 1].blank?\n\n if (current_line_indent < original_line_indent && !blank_line) ||\n (relevant_line_indent_at_level && blank_line)\n break\n end\n\n result << line_number if assignment_lines.include?(line_number) &&\n current_line_indent == original_line_indent\n\n unless blank_line\n relevant_line_indent_at_level = \\\n current_line_indent == original_line_indent\n end\n end\n\n result\n end",
"def lines_of_code\n coverage_statistics[:line]&.total\n end",
"def each\n # Prefixes of all diff lines, indicating their types\n # For example: `\" - + -+ ---+++ --+ -++\"`\n line_prefixes = lines.each_with_object(+\"\") { |line, s| s << (line[0] || ' ') }.gsub(/[^ +-]/, ' ')\n\n line_prefixes.scan(LINE_PAIRS_PATTERN) do\n # For `\"---+++\"`, `begin_index == 0`, `end_index == 6`\n begin_index, end_index = Regexp.last_match.offset(:del_ins)\n\n # For `\"---+++\"`, `changed_line_count == 3`\n changed_line_count = (end_index - begin_index) / 2\n\n halfway_index = begin_index + changed_line_count\n (begin_index...halfway_index).each do |i|\n # For `\"---+++\"`, index 1 maps to 1 + 3 = 4\n yield [i, i + changed_line_count]\n end\n end\n end",
"def source_for(file)\n return @last_lines if file == @last_file\n @last_file, @last_lines = file, nil\n if File.exists?(file)\n @last_lines = File.readlines(file)\n end\n end"
] | [
"0.76706094",
"0.7519632",
"0.7404835",
"0.71209306",
"0.7103931",
"0.7047567",
"0.70006347",
"0.6767158",
"0.67452025",
"0.6700643",
"0.6094435",
"0.6069913",
"0.60499334",
"0.60404664",
"0.60083395",
"0.5993386",
"0.59645873",
"0.5940394",
"0.5920645",
"0.588639",
"0.5870205",
"0.5861295",
"0.58091295",
"0.5791426",
"0.57896596",
"0.57723475",
"0.57480544",
"0.57394725",
"0.5630449",
"0.562838",
"0.5607237",
"0.56008387",
"0.558899",
"0.558899",
"0.55820656",
"0.5579086",
"0.55692214",
"0.55618566",
"0.5557342",
"0.55490375",
"0.55441785",
"0.5531916",
"0.5529144",
"0.55114955",
"0.5506289",
"0.54955846",
"0.54842794",
"0.5472393",
"0.54535043",
"0.54507834",
"0.5448246",
"0.54435295",
"0.5432489",
"0.5430847",
"0.5430282",
"0.5421397",
"0.5421397",
"0.541394",
"0.5401692",
"0.5396492",
"0.5364817",
"0.53506005",
"0.53357536",
"0.53330773",
"0.5324271",
"0.5318174",
"0.52976984",
"0.5292794",
"0.5282332",
"0.5279497",
"0.52767694",
"0.52597",
"0.52575743",
"0.5251168",
"0.5249065",
"0.5244354",
"0.5244354",
"0.5244354",
"0.523611",
"0.522147",
"0.520881",
"0.52064157",
"0.520267",
"0.520267",
"0.5200706",
"0.519526",
"0.5194054",
"0.5191855",
"0.5175864",
"0.51721543",
"0.51671064",
"0.5165657",
"0.5145852",
"0.51434934",
"0.51419896",
"0.5137856",
"0.5121449",
"0.5118278",
"0.5114407",
"0.5111073"
] | 0.7196825 | 3 |
Returns whether the commit that triggered this hook is the first commit on the branch. | def initial_commit?
return @initial_commit unless @initial_commit.nil?
@initial_commit = !Overcommit::Utils.execute(%w[git rev-parse HEAD~]).success?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_commit?\n !Overcommit::Utils.execute(%w[git rev-parse HEAD]).success?\n end",
"def initial_commit?\n !Overcommit::Utils.execute(%w[git rev-parse HEAD]).success?\n end",
"def single_commit?\n commit_range? && (first_commit == last_commit)\n end",
"def detached_head?\n rebased_branch.empty?\n end",
"def nothing_to_commit?\n @git.status do |file, status|\n return false unless status.empty?\n end\n return true\n end",
"def one?\n when_branches.one?\n end",
"def merge_commit?\n !squash?\n end",
"def anything_to_commit?(name)\n git(name).status.changed.present?\n end",
"def new_commit_to?(filename, branch_or_tag='master') \n\t\tlog = repo.log(branch_or_tag, filename)\n\t\tif log.first.committed_date > last_commit.committed_date \n\t\t\treturn true \n\t\telse \n\t\t\treturn false\n\t\tend\n\tend",
"def first_committed_commit\n get_all_commits_in_repo.last\n end",
"def fast_forward?\n rebased_commits.empty?\n end",
"def has_post_commit_hook?\n Dir.entries('.git/hooks').include? 'post-commit'\n end",
"def is_commit()\n @is_commit\n end",
"def last_commit_changed_status?\n ref = last_commit.ref\n last_commits = commits.where(ref: ref).last(2)\n\n if last_commits.size < 2\n false\n else\n last_commits[0].status != last_commits[1].status\n end\n end",
"def needs_checkout?\n expected = ref.sha1\n actual = rev_parse('HEAD')\n\n ! (expected == actual)\n end",
"def on_branch?\n at_path do\n matches = git_with_identity('branch', '--no-color', '-a').match %r{\\*\\s+(.*)}\n matches[1] unless %r{(\\(detached from|\\(HEAD detached at|\\(no branch)}.match?(matches[1])\n end\n end",
"def new_commits?()\n\t\treturn @new_commits if @new_commits.is_a?(Boolean) \n\t\thead = repo().commits.first\n\t\tif head.committed_date > last_commit.committed_date \n\t\t\t@new_commits = true\n\t\telse\n\t\t\t@new_commits = false \n\t\tend\n\t\treturn @new_commits\n\tend",
"def first_commit\n\tcommit = nil\n\tresp = github_api(\"commits\")\n\tsha = resp[-1][\"commit\"][\"sha\"]\n\twhile true\n\t\tr = github_api(\"commits?sha=#{sha}&per_page=100\")\n\t\tif r.count != 1 \n\t\t\tsha = r[-1][\"sha\"]\n\t\t\tnext\n\t\tend\n\t\tcommit = r[0]\n\t\tbreak\n\tend\n\tcommit\nend",
"def normal_commit?\n !ARGV[1] || ARGV[1] == 'message'\n end",
"def milestone_commit?\n self.milestones.collect(&:version_number).include? self.logical_version_number - 1\n end",
"def branch?(sha)\n return false if sha.nil?\n return false unless sha = resolve(sha)\n return false unless commit = git.get(:commit, sha)\n \n blob = commit.tree/FILE\n blob && blob.data.empty? ? true : false\n end",
"def pr_is_intra_branch(req)\n return false unless pr_has_head_repo(req)\n\n if req['head']['repo']['owner']['login'] ==\n req['base']['repo']['owner']['login'] and\n req['head']['repo']['full_name'] == req['base']['repo']['full_name']\n true\n else\n false\n end\n end",
"def committed?()\n return nil\n end",
"def deployed?\n git_info[\"deployed_commit_sha\"].present?\n end",
"def current_branch\n repo.branches.find(&:head?)\n end",
"def nothing_to_commit?\n Dir.chdir @root do\n cmd = \"git status\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n # Check if status indicates nothing to commit\n return /nothing to commit/.match stdout\n end\n end",
"def sub_branch?\n !root?\n end",
"def latest?\n self == self.class.branch(branch).first\n end",
"def added?\n branch != BASE && !changed?\n end",
"def has_changes?(branch)\n zombie_check\n end",
"def current_branch\n repo.branches.find(&:head?)\n end",
"def latest_revision?\n selected_revision == 'HEAD' || selected_revision == repos.latest_revision\n end",
"def in_git?\n Kernel.system('git rev-parse --show-prefix 2>/dev/null')\n end",
"def issue_linked_to_same_commit?(issue)\n repository.same_commits_in_scope(issue.changesets, self).any?\n end",
"def get_initial_commit\n\t\t`git rev-list --max-parents=0 HEAD`.chomp\n\tend",
"def next_commit\n h = history\n h.each_index { |i| return (i != 0 && h[i - 1]) if h[i].date <= @commit.date }\n h.last # FIXME. Does not work correctly if history is too short\n end",
"def safe_start_commit_sha\n start_commit_sha || merge_request.target_branch_sha\n end",
"def git_hook_needed?\n !File.executable?(@git_hook_path) || !File.read(@git_hook_path).match(/#{@pf_git_hook_name} \\$1/) || !pf_git_hook_valid?\n end",
"def anything_to_commit?(directory)\n directory && false\n end",
"def entry_changed?(path, commit = @commit)\n entry = get_entry_hash(path, commit)\n # if at a root commit, consider it changed if we have this file;\n # i.e. if we added it in the initial commit\n parents = commit.parents\n if parents.empty?\n return !entry.nil?\n end\n # check each parent commit (a merge has 2+ parents)\n parents.each do |parent|\n parent_entry = get_entry_hash(path, parent)\n # neither exists, no change\n if !entry && !parent_entry\n next\n # only in one of them, change\n elsif !entry || !parent_entry\n return true\n # otherwise it's changed if their ids aren't the same\n elsif entry[:oid] != parent_entry[:oid] # rubocop:disable Lint/DuplicateBranch\n return true\n end\n end\n false\n end",
"def committed?\n @state == :committed\n end",
"def needs_commit?(dir = Dir.pwd, file = nil)\n rval = false\n Dir.chdir(dir) do\n status = %x{git status}\n if file.nil?\n rval = true unless status =~ /nothing to commit \\(working directory clean\\)|nothing added to commit but untracked files present/\n if status =~ /nothing added to commit but untracked files present/\n puts \"WARNING: untracked files present in #{dir}\"\n show_changed_files(status)\n end\n else\n rval = true if status =~ /^#\\t.*modified: #{file}/\n end\n end\n rval\nend",
"def last_commit(branch, filename)\n lc = @repo.log(branch, filename, {:n => 1})\n lc.empty? ? nil : lc.first\n end",
"def is_branch_build\n self.pull_request_number == '-1'\n end",
"def last_commited_commit\n get_all_commits_in_repo.first\n end",
"def empty?\n @commits.empty?\n end",
"def first?\n not first.nil?\n end",
"def fast_forward?\n branch_merge && ancestor != remote &&\n ancestor == @local_parent &&\n @local_parent.branch != remote.branch\n end",
"def branch_exists?(branch = branch_name)\n git.capturing.rev_parse({:verify => true, :quiet => true}, \"refs/heads/#{branch}\")\n true\n rescue MiniGit::GitError\n false\n end",
"def tracking_branch?(ref)\n ref && grit.remotes.find {|remote| remote.name == ref }\n end",
"def needs_pushing?(dir = Dir.pwd)\n rval = false\n branch = get_branch\n if is_origin_branch? branch\n Dir.chdir(dir) do\n rval = (%x{git diff \"#{branch}\"..origin/\"#{branch}\"}.size > 0)\n end\n end\n rval\nend",
"def run_git_first_commit\n raise \"Git 1st commit failed\" unless system(\"set +x; git commit\")\n end",
"def first?\n if defined? @first\n false\n else\n @first = false\n true\n end\n end",
"def intra_branch?(pr)\n q = <<-QUERY\n select IF(base_repo_id = head_repo_id, true, false) as intra_branch\n from pull_requests where id = ?\n QUERY\n db.fetch(q, pr[:id]).first[:intra_branch]\n end",
"def first?\n position <= 1\n end",
"def empty_branch?(branch)\n (is_branch & (1 << branch)) == 0\n end",
"def empty?\n is_branch == 0\n end",
"def match?\n source_repo_match? && @build.master_branch?\n end",
"def has_remote_tracking_branch(repo)\n return false if $branch_name.empty?\n\n begin\n return !repo.branches[$remote_branch].nil?\n rescue\n return false\n end\nend",
"def next_commit\n h = history\n h.each_index { |i| return (i == 0 ? nil : h[i - 1]) if h[i].date <= @commit.date }\n h.last # FIXME. Does not work correctly if history is too short\n end",
"def on_first_component?\n @current_component == @focusables.first\n end",
"def branches?\n ! branch_targets.empty?\n end",
"def git_commit_initial\n commit \"Initial Commit\"\n end",
"def first_in_queue?\n return false unless in_queue?\n self.send(queue_position_column) == 1\n end",
"def exist?\n File.exist? File.join(path, '.git/HEAD')\n end",
"def any_updates?\n change_history.size > 1\n end",
"def any_updates?\n change_history.size > 1\n end",
"def commit\n @commit ||= $repo.log.object(@rev || 'master').path(@name).first\n end",
"def should_handle?\n build.repo_source? && build.master_branch? && build.success?\n end",
"def first?\n return false unless in_list?\n my_position == 1\n end",
"def first?\n return false unless in_list?\n my_position == 1\n end",
"def first?\n self[position_column] <= 1\n end",
"def root_command?\n parents.empty?\n end",
"def git_has_remote_branch?(branch)\n `git config branch.#{branch}.merge`.strip == ''\n end",
"def has_parent?\n not history.empty?\n end",
"def git_HEAD\n Dir.chdir(@dir) do\n commit = `git rev-parse HEAD`\n raise \"git rev-parse HEAD failed: #{$?.exitstatus}\" if $?.exitstatus != 0\n commit.chomp\n end\n end",
"def branches_containing_commit(commit_ref); end",
"def git_get_current_branch()\n current_branch = `git branch`.split(/\\n/).find{ |l| l.start_with?(\"*\") }\n \n if current_branch\n current_branch =~ /\\*\\s+(.+)/\n $~[1]\n end \nend",
"def branches_containing_commit(commit_ref); end",
"def first?\n self.previous_id.nil?\n end",
"def git?\n is_a?(Git) # :-)\n end",
"def check_commit\n return if @tree\n \n data = @base.lib.commit_data(@objectish)\n set_commit(data)\n end",
"def oldest_commit\n commits.last\n end",
"def git_changes?(patchdef)\n patchdef.find {|p| p[1] =~ /^[^.]/}\n end",
"def first?\n result = @first[-1]\n @first[-1] = false\n result\n end",
"def branches_containing_commit(commit_ref)\n `git branch --column=dense --contains #{commit_ref}`.\n sub(/\\((HEAD )?detached (from|at) .*?\\)/, ''). # ignore detached HEAD\n split(/\\s+/).\n reject { |s| s.empty? || s == '*' }\n end",
"def merged?(sha)\n not git_call(\"rev-list #{sha} ^HEAD 2>&1\").split(\"\\n\").size > 0\n end",
"def intra_branch?(pr_id)\n q = <<-QUERY\n select IF(base_repo_id = head_repo_id, true, false) as intra_branch\n from pull_requests where id = ?\n QUERY\n if_empty(db.fetch(q, pr_id).all, :intra_branch)\n end",
"def git?\n dir? '.git'\n end",
"def git?\n dir? '.git'\n end",
"def commit_required?\n @entry_set.each do |e|\n return true if e.dirty\n end\n @comment != @stored_comment || @entry_set != @stored_entries || @create\n end",
"def backported_from_master?\n branch != 'origin/master' && self.class.exists?(:branch => 'origin/master', :message => message, :author => author)\n end",
"def entry_changed?(commit, path)\n parent = commit.parents[0]\n entry = commit.tree.path(path) rescue nil\n\n # if at a root commit, consider it changed if we have this file;\n # i.e. if we added it in the initial commit\n if !parent\n return entry != nil\n end\n\n parent_entry = begin\n parent.tree.path(path)\n rescue Rugged::TreeError\n begin\n parent.tree.path(path + '.json')\n rescue Rugged::TreeError\n nil\n end\n end\n\n # does exist in either, no change\n if !entry && !parent_entry\n false\n # only in one of them, change\n elsif !entry || !parent_entry\n true\n # otherwise it's changed if their ids arent' the same\n else\n entry[:oid] != parent_entry[:oid]\n end\n end",
"def check_duplicata_pr_branch(pr)\n puts `git branch --list #{pr}`\n `git branch -D #{pr} 2>/dev/null` if $CHILD_STATUS.exitstatus.zero?\n end",
"def git_repo?\n !repository_root.to_s.empty?\n end",
"def first?\n # return false unless in_list?\n self.send(position_column) == 1\n end",
"def last_commit\n self.lookup self.head.target\n end",
"def git?\n !!git_directory\n end",
"def root?\n depth == 1\n end",
"def git_tag?\n mcr_log? && bg?\n end"
] | [
"0.7892316",
"0.7892316",
"0.7040554",
"0.67317414",
"0.6728145",
"0.6632289",
"0.6598481",
"0.64903975",
"0.6471433",
"0.64154357",
"0.63823813",
"0.63488525",
"0.63393813",
"0.63331914",
"0.6328761",
"0.63133544",
"0.62486887",
"0.62273306",
"0.6138494",
"0.61362016",
"0.6090829",
"0.60730165",
"0.60403395",
"0.6022937",
"0.60222036",
"0.6021906",
"0.6015967",
"0.60033417",
"0.59899235",
"0.59862417",
"0.5983234",
"0.59695184",
"0.5945584",
"0.59100926",
"0.59046054",
"0.58812666",
"0.58803964",
"0.58413637",
"0.58410954",
"0.5823859",
"0.58161104",
"0.5810564",
"0.5799377",
"0.5799236",
"0.577848",
"0.57598597",
"0.57304347",
"0.57184577",
"0.57178265",
"0.5713408",
"0.5699838",
"0.56968373",
"0.5686789",
"0.5680211",
"0.56650555",
"0.5664275",
"0.565945",
"0.56552523",
"0.5653195",
"0.5620196",
"0.5617475",
"0.5615126",
"0.55950487",
"0.55922264",
"0.5575811",
"0.55491394",
"0.55491394",
"0.5543848",
"0.5543819",
"0.553395",
"0.553395",
"0.5530802",
"0.5529361",
"0.55229014",
"0.5512265",
"0.54970956",
"0.5495809",
"0.54955214",
"0.5494779",
"0.549309",
"0.54875654",
"0.5472167",
"0.5471829",
"0.54642755",
"0.5457371",
"0.5452313",
"0.5446381",
"0.544476",
"0.54444516",
"0.54444516",
"0.5440095",
"0.5435794",
"0.54194236",
"0.5408343",
"0.54068637",
"0.5404338",
"0.5397357",
"0.5393253",
"0.5387083",
"0.53813475"
] | 0.7954759 | 0 |
method to create an array of event times. Will use this to create array of start_at times and endat times | def make_event_times_array(dates_array, hour, min)
event_times = Array.new
dates_array.each_index do |index|
event_times[index] = create_event_time(dates_array[index],hour, min)
end
return event_times
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_times_array(padding = true)\n @times = (padding) ? [@start_dt - 1.hour] : [@start_dt]\n \n # and including every 1/2 hour until one hour after the selected end time\n while true do\n tmp = @times.last + 30.minutes\n (padding) ? (tmp == (@end_dt + 1.hour)) ? break : '' : (tmp == @end_dt) ? break : ''\n @times.push(tmp)\n end\n end",
"def get_time_slot_array\n time_slot_array = [\"07:00\", \"07:30\", \"08:00\", \"08:30\", \"09:00\", \"09:30\", \"10:00\", \"10:30\",\n \"11:00\", \"11:30\", \"12:00\", \"12:30\", \"13:00\", \"13:30\", \"14:00\", \"14:30\",\n \"15:00\", \"15:30\", \"16:00\", \"16:30\", \"17:00\", \"17:30\", \"18:00\", \"18:30\",\n \"19:00\", \"19:30\", \"20:00\", \"20:30\", \"21:00\"]\n end",
"def get_start_times\n times = []\n self.start_time.split('%').each do |t|\n times.push(DateTime.strptime(t, '%m-%d-%Y %H:%M'))\n end\n times\n end",
"def get_runtime_timestamps\n all_events = events.to_a\n start_time = DateTime.parse(all_events.first['timestamp'])\n completion_time = DateTime.parse(all_events.last['timestamp'])\n [start_time, completion_time]\n end",
"def time_slots\n collection=[]\n start_time=Time.now.beginning_of_hour\n end_time=Time.now.tomorrow.midnight-1.hour\n time=start_time\n\n while time < end_time\n collection<<[time.beginning_of_hour.hour, time.beginning_of_hour]\n time=time+1.hour\n end\n\n collection\n end",
"def start_times\n \t@start_time1 = self.start_time1\n\n @start_time2 = self.start_time2\n\n @start_time3 = self.start_time3\n\n start_times = [@start_time1, @start_time2, @start_time3]\n end",
"def create_event_array(start_at_array, end_at_array, event_name, activity_id)\n\t\tevents_array = Array.new\n\n\t\tstart_at_array.each_index do |index|\n\t\t\tevent_hash = Hash.new\n\n\t\t\tevent_hash[:start_at] = start_at_array[index]\n\t\t\tevent_hash[:end_at] = end_at_array[index]\n\t\t\tevent_hash[:name] = event_name\n\t\t\tevent_hash[:activity_id] = activity_id\n\n\t\t\tevents_array[index]= event_hash\n\t\tend\n\n\t\treturn events_array\n\tend",
"def recalc_times(starting_at=0, list=@events)\n t = (starting_at == 0) ? 0 : list[starting_at - 1].time_from_start\n list[starting_at .. -1].each do |e|\n t += e.delta_time\n e.time_from_start = t\n end\n end",
"def generate_time\n\t\tret = Array.new\n\t\tcount unless @fileinfo[:count]\n\t\ttrigger unless @fileinfo[:trigger]\n\t\tsampling unless @fileinfo[:sampling]\n\n\t\t(0..@fileinfo[:count] - @fileinfo[:trigger] - 1).each {|i| \n\t\t\tret << (i * @fileinfo[:sampling] * 1e-6)\n\t\t}\n\t\treturn ret\n\tend",
"def times\n @stamps\n end",
"def timecodes\n return [] if start_time.nil?\n start_hour = start_time.strftime(\"%H\")\n start_min = start_time.strftime(\"%M\").to_i < 30 ? \"00\" : \"30\"\n curr_time = Time.parse(\"#{start_hour}:#{start_min}\")\n timecode_array = []\n while curr_time < Time.parse(\"#{end_time.strftime(\"%H\")}:#{end_time.strftime(\"%M\")}\") - 1.second\n timecode_array << \"#{curr_time.strftime(\"%H\").to_i}:#{curr_time.strftime(\"%M\")}\"\n curr_time = curr_time + 30.minutes\n end\n timecode_array_with_days = []\n %w(monday tuesday wednesday thursday friday saturday sunday).each do |day|\n timecode_array_with_days << timecode_array.collect{|t| \"#{t}_#{day}\"}.flatten if read_attribute(day)\n end\n timecode_array_with_days.flatten\n end",
"def start_times\n relevant_events_scope.\n interval_starts.\n unscope(:order).\n order(:video_time).\n pluck(:video_time)\n end",
"def recalc_times(starting_at=0, list=@events)\n\tt = (starting_at == 0) ? 0 : list[starting_at - 1].time_from_start\n\tlist[starting_at .. -1].each { | e |\n\t t += e.delta_time\n\t e.time_from_start = t\n\t}\n end",
"def events_in_period\n t0 = start.midnight\n tf = finish.end_of_day\n\n events = []\n while t0 < tf\n t1 = [t0.advance(days: 21), tf].min\n events.concat(dog.stream(t0, t1, tags: @job_tags)[1]['events'])\n t0 = t1\n end\n events\n end",
"def time_fragments\n []\n end",
"def times_for_schedule_update_requests(start_time, end_time)\n times = []\n\n task_time = start_time.beginning_of_day + 15.hours\n task_time += 1.day if task_time < start_time\n\n while task_time < end_time\n times << task_time\n task_time += 1.day\n end\n\n times\n end",
"def time_range\n range_time = []\n (1..12).each do |n|\n time = n == 1 ? 12 : n - 1\n range_time << \"#{time}:00 am\"\n range_time << \"#{time}:30 am\"\n end\n (1..12).each do |n|\n time = n == 1 ? 12 : n - 1\n range_time << \"#{time}:00 pm\"\n range_time << \"#{time}:30 pm\"\n end\n range_time\n end",
"def generate_time_slots(time_entries)\n time_entries.map { |entry| extract_available_slots(entry) }.flatten\n end",
"def to_a(resolution: :hour)\n return [] if @start.nil? && @finish.nil?\n\n if finish < start\n to_time_array(start, TimeOfDay.new(23), resolution) +\n to_time_array(TimeOfDay.new(0), finish, resolution)\n else\n to_time_array(start, finish, resolution)\n end\n end",
"def get_timeslots_12hrs\n \t#create the new array\n \t@timeslots_12hrs = Array.new\n\n for i in 0...@timeslots.length\n @temp_holder = @timeslots[i].split(':')\n @temp_holder[0] = @temp_holder[0].to_i\n if @temp_holder[0] > 12\n @temp_holder[0] = @temp_holder[0] - 12\n @timeslots_12hrs.push(@temp_holder[0].to_s + \":\" + @temp_holder[1] + \"pm\")\n elsif @temp_holder[0] == 12\n @timeslots_12hrs.push(@temp_holder[0].to_s + \":\" + @temp_holder[1] + \"pm\")\n else\n @timeslots_12hrs.push(@timeslots[i] + \"am\")\n end\n end\n\n return @timeslots_12hrs\n end",
"def get_timeslots_12hrs\n #create the new array\n timeslots_12hrs = Array.new\n\n for i in 0...@timeslots.length\n temp_holder = @timeslots[i].split(':')\n temp_holder[0] = temp_holder[0].to_i\n\n if temp_holder[0] > 12\n temp_holder[0] = temp_holder[0] - 12\n timeslots_12hrs.push(temp_holder[0].to_s + \":\" + temp_holder[1] + \"pm\")\n elsif temp_holder[0] == 12\n timeslots_12hrs.push(temp_holder[0].to_s + \":\" + temp_holder[1] + \"pm\")\n else\n timeslots_12hrs.push(@timeslots[i] + \"am\")\n end\n end\n\n return timeslots_12hrs\n end",
"def datetimes\n intervals.map do |interval|\n datetimes = []\n datetime = interval.first_datetime\n while datetime <= interval.last_datetime\n datetimes << datetime\n datetime = datetime + frequency.duration\n end\n datetimes\n end\n end",
"def restaurant_time_select\n\t\ttimes = (0..23).map { |hour| [formatted_time(hour), hour] }\n\tend",
"def timeslots\n data['timeslots'].map { |ts|\n Timeslot.new(\n Time.at(ts['start_date']),\n Time.at(ts['end_date'] || ts['start_date']),\n data['timezone']\n )\n }.reject(&:finished?).sort_by(&:start_date)\n end",
"def map_events\n mapped_timeline = Timeline.new\n self.each do |time,events|\n mapped_timeline[time] = events.map{|event| yield event }\n end\n mapped_timeline\n end",
"def create_int_array\n [first.time_to_int, last.time_to_int]\n end",
"def timeslots\n\t\tif (self != nil)\n\t\t\tcompany = self.company\n\t\t\tstart_time = company.start_time\n\t\t\tend_time = company.end_time\n\t\t\tcompany_duration = (( end_time - start_time )/60).round(2)\n\t\t\tno_of_slots = ( company_duration / (self.time_slot.hour*60 + self.time_slot.min) ).to_i\n\t\t\ttime_slot_array =Array.new\n\t\t\tremember_hour = start_time.hour.round\n\t\t\tremember_min = start_time.min\n\t\t\tno_of_slots.times do | index |\n\t\t\t\ta = remember_hour == 0 ? \"00\" : remember_hour\n\t\t\t\tb = remember_min == 0 ? \"00\" : remember_min\n\t\t\t\tc = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour == 0 ? \"00\" :((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\td = (remember_min + self.time_slot.min) % 60 == 0 ? \"00\" : (remember_min + self.time_slot.min) % 60\n\t\t\t\ttime_slot_array << [\"#{a}:#{b}-#{c}:#{d}\", index]\n\t\t\t\tremember_hour = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\tremember_min = (remember_min + self.time_slot.min) % 60\n\t\t\tend\n\t\t\ttime_slot_array\n\t\tend\n\tend",
"def getTimes()\n return @times\n end",
"def fetch_events_time(range_begin_in_secs, range_end_in_secs)\n #\n # collect from_time beginning of day (in seconds)\n #\n frt = self.from_time.beginning_of_day.to_i\n\n case self.recurrence_type\n when \"NO_RECURRENCE\"\n self.no_recurrence_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_DAYS\"\n self.recur_every_n_days_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_WEEKS\"\n self.recur_every_n_weeks_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_MONTHS\"\n self.recur_every_n_months_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_YEARS\"\n self.recur_every_n_years_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_DAYS_OF_WEEK\"\n self.recur_every_days_of_week_dates(range_begin_in_secs, range_end_in_secs, frt)\n else\n []\n end\n end",
"def day_times\n @day_times ||= available_times.map(&:day_time)\n @day_times\n end",
"def times_for_send_update_requests(start_time, end_time)\n times = []\n\n task_time = start_time.beginning_of_hour + 30.minutes\n task_time += 1.hour if task_time < start_time\n\n while task_time < end_time\n times << task_time\n task_time += 1.hour\n end\n\n times\n end",
"def watch_frequency\n starts, ends = start_times, end_times\n start_index, end_index = 0, 0\n frequencies = []\n active_intervals = 0\n return [] if end_times.empty?\n (0..end_times.last).each do |video_time|\n start_advance = elements_till(starts, start_index) { |time| time <= video_time }\n end_advance = elements_till(ends, end_index) { |time| time < video_time }\n\n active_intervals += start_advance - end_advance\n start_index += start_advance\n end_index += end_advance\n\n frequencies << active_intervals\n end\n frequencies\n end",
"def map_events!\n each do |time,events|\n self[time] = events.map{|event| yield event }\n end\n end",
"def slots\n slot_start = start_time\n slot_end = slot_start + slot_length\n while slot_end <= end_time\n slot = ::V2::TimeSlot.new(start_time: slot_start, end_time: slot_end, event_id: @event_id)\n @slots << slot if slot.valid? && slot.save\n slot_start = slot_end + buffer\n slot_end = slot_start + slot_length\n end\n\n @slots\n end",
"def timings\n\t\treturn [] unless self.timing_line?\n\t\ta,b = @value.split(' --> ')\n\t\treturn [SubtitleTiming.new(a), SubtitleTiming.new(b)]\n\tend",
"def get_time_list(from,to)\n time_list = Array.new\n time_list.push(from)\n temp_from = from.split(\" \")[0]\n temp_to = to.split(\" \")[0]\n date_from = Date.parse temp_from\n date_to = Date.parse temp_to\n if date_to < date_from\n puts \"from is starttime,to is endtime\"\n return nil\n end\n time = Array.new\n date_from.upto( date_to){ |i| time.push(i.to_s); time_list.push(\"#{i} 24:00:00\")}\n time_list[time_list.size-1] = to\n return time,time_list\n end",
"def get_times(hash)\n\ttimes = hash.map { |name, time| time }\nend",
"def segments_for_timestamps(start_timestamp, end_timestamp, granularity)\n start_ts = time_segment_for_timestamp(start_timestamp, granularity)\n end_ts = time_segment_for_timestamp(end_timestamp, granularity)\n\n segments = [start_ts]\n ts = start_ts\n while ts < end_ts\n ts += granularity\n segments << ts\n end\n\n segments\n end",
"def speeches\n self.time_slots\n end",
"def commit_time_line events\n events.map(&:date).uniq.sort.each_cons(2).map {|before,after| [before, (after.to_i - before.to_i) / (60 * 60 * 24)] }\nend",
"def calc_event_rows\n @events_start = [{},{},{},{},{},{},{}]\n @events_end = [{},{},{},{},{},{},{}]\n @event_span = [{},{},{},{},{},{},{}]\n (0..(num_days-1)).each do |day|\n if !events[day].nil?\n events[day].each do |event|\n if !event.all_day\n if event.start_time < (date + day.days)\n start_row = 0\n else\n start_row = (event.start_time.seconds_since_midnight / (60*30)).to_i\n end\n if @events_start[day].member?(start_row)\n @events_start[day][start_row] << event\n else\n @events_start[day][start_row] = [event]\n end\n if event.end_time >= (date + (day+1).days)\n end_row = NUM_HALF_HOURS-1\n else\n end_row = ((event.end_time.seconds_since_midnight-1) / (60*30)).to_i\n end\n if @events_end[day].member?(end_row)\n @events_end[day][end_row] << event\n else\n @events_end[day][end_row] = [event]\n end\n @event_span[day][event] = end_row - start_row + 1\n end\n end\n end\n end\n end",
"def all_timeslots\n unless @all_timeslots.present?\n @all_timeslots = (1..5).map do |day_id|\n Timeslot.new(self, day_id, @day_start_minute, @day_end_minute)\n end\n end\n\n @all_timeslots\n end",
"def default_time_slots\n start_time = Time.parse(\"9:00\")\n end_time = Time.parse(\"20:30\")\n slots = []\n t = start_time\n while t <= end_time\n slots << t.strftime(\"%H:%M\")\n t += 30.minutes;\n end\n\n slots\n end",
"def time_travel_offsets\n @time_travel_offsets ||= []\n end",
"def time_rows\n rows = []\n (0..NUM_HALF_HOURS-1).each do |half_hour|\n cols = []\n row = content_tag :tr do\n cols << hour_cell(half_hour)\n cols << minute_cell(half_hour)\n (0..(num_days-1)).each do |day|\n cols << event_cells(half_hour,day)\n end\n cols.join.html_safe\n end\n rows << row\n end\n rows.join.html_safe\n end",
"def next_times(count)\n\n next_time ? [ next_time ] : []\n end",
"def events(range_begin = nil, range_end = nil, time_filters_in_secs = [])\n #\n # If range_begin is nil, use from_time attribute from the model.\n #\n range_begin = range_begin || self.from_time\n range_begin = Event.convert_to_datetime(range_begin).beginning_of_day.to_i\n\n #\n # If range_end is nil, use recurrence_end attribute from the model.\n # note: range_end may still be nil if no recurrence_end is specified\n # note: range_end is exclusive. substract with DAY_IN_SECONDS to\n # become inclusive (see arshaw fullcalendar docs)\n #\n range_end = Event.convert_to_datetime(range_end).end_of_day.to_i - DAY_IN_SECONDS if range_end\n range_end = [range_end, self.recurrence_end.try(:end_of_day).try(:to_i)].compact.min\n\n arr = []\n self.fetch_events_time(range_begin, range_end).each do |e|\n event_from_time_in_secs = e +\n (self.from_time.hour * HOUR_IN_SECONDS) +\n (self.from_time.min * MINUTE_IN_SECONDS)\n event_thru_time_in_secs = event_from_time_in_secs + self.duration\n\n unless time_filters_in_secs.include? event_from_time_in_secs\n arr << Event.new(self, event_from_time_in_secs, event_thru_time_in_secs)\n end\n end\n\n arr\n end",
"def get_hours_array hours\n hours_array = []\n hours.each { |h| hours_array << h.date }\n return hours_array\n end",
"def generate from, upto\n events = []\n from.upto(upto).map { |date|\n wdays.each { |day| day.generate date, events }\n }\n events\n end",
"def to_array\n\n [\n @seconds,\n @minutes,\n @hours,\n @days,\n @months,\n @weekdays,\n @monthdays,\n @timezone ? @timezone.name : nil\n ]\n end",
"def get_times\n @start_time = case params[:start]\n when Hash\n DateTime.civil(params[:start][:year].to_i, params[:start][:month].to_i, params[:start][:day].to_i, params[:start][:hour].to_i, params[:start][:minute].to_i, 0)\n when String\n DateTime.strptime(params[:start], \"%Y:%m:%d %h:%m:%s\")\n else nil\n end\n @end_time = case params[:end]\n when Hash\n DateTime.civil(params[:end][:year].to_i, params[:end][:month].to_i, params[:end][:day].to_i, params[:end][:hour].to_i, params[:end][:minute].to_i, 0)\n when String\n DateTime.strptime(params[:end], \"%Y:%m:%d %h:%m:%s\")\n else DateTime.now\n end\n logger.debug \"#{@start_time} to #{@end_time}\"\n end",
"def time_entries(start_date, end_date)\n opts = {\n params: {\n start_date: start_date.to_datetime.iso8601,\n end_date: end_date.to_datetime.iso8601\n }\n }\n\n begin\n response = toggl_resource['time_entries'].get(opts)\n rescue => e\n raise 'Error getting Toggl data: ' + e.response\n end\n data = JSON.parse response\n\n data.map do |entry|\n duration = entry['duration'].to_f\n\n # Negative duration means the task is currently running.\n # In this case, we'll set duration to how long it's been running\n if duration < 0\n duration = Time.now - Time.at(duration.abs)\n end\n\n {\n description: entry['description'],\n start: Date.parse(entry['start']),\n duration: duration\n }\n end\n end",
"def get_events()\n\t\tevents = []\n\n\t\t@DB[:events].order(:date).each do |event|\n\t\t\tnewTimeslots = []\n\t\t\t@DB[:timeslots].where(parent_table: 'events', parent_id: event[:'id']).each do |timeslot|\n\t\t\t\tnewTimeslots.push(DateTime.parse(timeslot[:'time']))\n\t\t\tend\n\n\t\t\tnewAttendees = []\n\t\t\t@DB[:attendees].where(parent_id: event[:'id']).each do |attendee|\n\t\t\t\tattendeeTimeslots = []\n\t\t\t\t@DB[:timeslots].where(parent_table: 'attendees', parent_id: attendee[:'id']).each do |timeslot|\n\t\t\t\t\tattendeeTimeslots.push(DateTime.parse(timeslot[:'time']))\n\t\t\t\tend\n\n\t\t\t\tnewAttendee = Attendee.new(attendee[:'name'], attendeeTimeslots)\n\t\t\t\tnewAttendees.push(newAttendee)\n\t\t\tend\n\n\t\t\tnewEvent = Event.new(event[:'name'], event[:'description'], newTimeslots, newAttendees, event[:'id'])\n\t\t\tif newEvent.get_date >= @epoch\n\t\t\t\tevents.push(newEvent)\n\t\t\tend\n\t\tend\n\n\t\treturn events\n\tend",
"def time_range\n start_time..end_time\n end",
"def build_ics_time(booking)\n times = Hash.new\n start_date = booking.startdate\n end_date = booking.enddate\n start_time = booking.starttime\n end_time = booking.endtime\n\n dtstart = Time.new start_date.year,start_date.month,start_date.day,start_time.hour,start_time.min,start_time.sec\n dtend = Time.new start_date.year,start_date.month,start_date.day,end_time.hour,end_time.min,end_time.sec\n dtstamp = Time.now\n last_modified = Time.now\n\n times.store :dtstart,dtstart.getutc\n times.store :dtend,dtend.getutc\n times.store :dtstamp, dtstamp.getutc\n times.store :last_modified, last_modified.getutc\n\n return times\n\n end",
"def dates\n\t\t@times = { \n\t\t\t:haiti=>{\n\t\t\t\t:one_week_before=>\tTime.new(2010,01,5),\n\t\t\t\t:event\t\t\t=>\tTime.new(2010,01,12),\n\t\t\t\t:one_week_after\t=>\tTime.new(2010,01,19),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2010,02,12)\n\t\t\t},\n\n\t\t\t:philippines=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t},\n\t\t\t:phil=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t}\n\t\t}\n\tend",
"def __evolve_time__\n map { |value| value.__evolve_time__ }\n end",
"def times\n @times ||= {\n start: (starttime && starttime.strftime(\"%l:%M %P\")) || 'TBD',\n start_excel: (starttime && starttime.strftime(\"%T\")) || 'TBD',\n end: (endtime && endtime.strftime(\"%l:%M %P\")) || 'TBD',\n end_excel: (endtime && endtime.strftime(\"%T\")) || 'TBD',\n }\n end",
"def times_for(indexes)\n indexes.map { |index| index2time(index) }\n end",
"def recalc_delta_from_times(starting_at=0, list=@events)\n\tprev_time_from_start = 0\n\tlist[starting_at .. -1].each { | e |\n\t e.delta_time = e.time_from_start - prev_time_from_start\n\t prev_time_from_start = e.time_from_start\n\t}\n end",
"def time\n\talltime = Array.new\n\tslices = 10\n\ti = 0\n\twhile i < slices.to_i do\n\t\talltime.push(Time.now)\n\t\ti+=1\n\tend\n\tyield\nend",
"def events_in_time_range(start_date_string, end_date_string)\n return self.events if self.events.nil?\n\n if(start_date_string.is_a?(String))\n # I was told there would be no timezones :/\n start_time = DateTime.parse(start_date_string).to_time.utc\n end_time = DateTime.parse(end_date_string).to_time.utc\n else\n start_time = start_date_string\n end_time = end_date_string\n end\n\n self.events.select do |e| \n created_at_time = DateTime.parse(e.created_at).to_time.utc\n created_at_time >= start_time && created_at_time < end_time\n end\n end",
"def shift time_delta\n map{|time,events| [time+time_delta, events] }\n end",
"def split(range = nil)\n if self.record_category and self.activity?\n entry_end = self.end_timestamp || Time.now\n time = range ? [self.timestamp, range.begin.midnight.in_time_zone].max : self.timestamp\n end_time = range ? [entry_end, range.end.midnight.in_time_zone].min : entry_end\n list = Array.new\n while time < end_time\n new_end = [entry_end, (time + 1.day).midnight.in_time_zone].min\n list << [time, new_end, self]\n time = new_end\n end\n else\n return [self.timestamp, nil, self]\n end\n list\n end",
"def get_timecodes(at, drift_behind, drift_ahead)\n now = timeint(at)\n timecode_start = timecode(now - drift_behind)\n timecode_end = timecode(now + drift_ahead)\n (timecode_start..timecode_end).step(1).to_a\n end",
"def init_timevec\n value_hash[:bartime] ||= model.time_vector(symbol, begin_time, end_time)\n compute_timestamps(begin_time, end_time)\n end",
"def events\n events = []\n now = Time.now\n @countdowns.times.each do |id, show_time|\n # Prevents extra refreshes\n latest_time = show_time.latest\n events << CalendarEvent.new(\n Shows.find_show(id.to_s).title,\n latest_time,\n latest_time + (60*60*3)\n ) unless (latest_time - now) > (60*60*24*7)\n end\n events.sort! {|a,b| a.start_time <=> b.start_time}\n end",
"def at(*times)\n @hours = []\n @mins = []\n \n times.each do |time|\n @hour, @min, meridian = parse_time(time)\n\n raise \"invalid hour value for 'at'\" if @hour > 12 && meridian\n raise \"invalid minute value for 'at'\" if @min > 59\n\n case meridian\n when 'am'\n @hour = 0 if @hour == 12 \n when 'pm'\n @hour += 12 if @hour < 12\n end\n\n raise \"invalid hour value for 'at'\" if @hour > 23\n\n @hours << @hour\n @mins << @min\n end\n \n self\n end",
"def recalc_delta_from_times(starting_at=0, list=@events)\n prev_time_from_start = 0\n # We need to sort the sublist. sublist.sort! does not do what we want.\n # We call mergesort instead of Array.sort because sort is not stable\n # (it can mix up the order of events that have the same start time).\n # See http://wiki.github.com/adamjmurray/cosy/midilib-notes for details.\n list[starting_at .. -1] = MIDI::Array.new(list[starting_at .. -1]).mergesort do |e1, e2|\n e1.time_from_start <=> e2.time_from_start\n end\n list[starting_at .. -1].each do |e|\n e.delta_time = e.time_from_start - prev_time_from_start\n prev_time_from_start = e.time_from_start\n end\n end",
"def split_playtime(start)\n number = []\n number[0] = start / 60 / 60\n number[1] = start / 60 % 60\n number[2] = start % 60\n return number\n end",
"def split_playtime(start)\r\r\n number = []\r\r\n number[0] = start / 60 / 60\r\r\n number[1] = start / 60 % 60\r\r\n number[2] = start % 60\r\r\n return number\r\r\n end",
"def get_device_times(id, from, to)\n node = find_start(id, from)\n list = Array.new\n while node && node.value < to_epoch(to) do\n list.push(node.value)\n break unless node.next\n node = node.next\n end\n return list\nend",
"def time_entries\n get_ticket_property_list(\"time_entries\" , Unfuddled::TimeEntry)\n end",
"def to_a(resolution: :hour)\n resolution_multiplier = resolution == :hour ? 60 * 60 : 60\n time_units = ((start - finish) / resolution_multiplier).abs.to_i\n\n Array.new(time_units) do |time_unit|\n start + (time_unit * resolution_multiplier)\n end\n end",
"def generate_time_blocks(windows)\n results = windows.map do |window|\n\n # Create a date based n todays date, but with the time changed to\n # that of the entry start/end.\n entry_start = base.change(\n hour: window.start_time.hour,\n min: window.start_time.minute)\n\n # By rounding off with #floor, we go the easy route (no partial time blocks)\n # Note: iterator is zero based.\n blocks = (window.duration / block_size).floor.times.map { |i|\n\n start_time = Skej::Warp.zone(\n entry_start + (i * block_size).minutes,\n session.chosen_office.time_zone)\n\n end_time = Skej::Warp.zone(\n start_time + block_size.minutes,\n session.chosen_office.time_zone)\n\n target_day = Skej::NLP.parse(session, window.day)\n .strftime('%A')\n .downcase\n .to_sym\n\n TimeBlock.new(\n session: session,\n time_entry_id: window.time_entry.id,\n business_id: session.business_id,\n time_sheet_id: window.time_sheet_id,\n office_id: window.office_id,\n day: target_day,\n start_time: start_time,\n end_time: end_time)\n\n }\n end.flatten # results\n end",
"def time_range\n return 0 if start_hour.blank? || start_minute.blank?\n\n return 0 if end_hour.blank? || end_minute.blank?\n\n hours_between_times\n end",
"def to_a\n [ xnow, ynow ]\n end",
"def timespan\n [Time.parse(items.last['created_at']).utc, Time.parse(items.first['created_at']).utc] rescue nil\n end",
"def timespan\n [Time.parse(items.last['created_at']).utc, Time.parse(items.first['created_at']).utc] rescue nil\n end",
"def time_slots\n\n # you can book by the hour, and you can stay for an hour\n reservation_interval = 1.hour\n\n # Determine the earliest time we will allow reservation\n # It can't be in the past, we'll start 10 minutes from now\n start_time = Time.zone.now + 10.minutes\n # Then we have to round to the next hour block\n start_time = Time.zone.at( (start_time.to_f / reservation_interval).ceil * reservation_interval )\n # Then, if we are still earlier than opening hour, just use the opening hour\n # We can use the 'max' Array method\n start_time = [start_time, start_time.change(hour: opening_hour)].max\n\n # Determine the furthest in the future we will allow reservations\n end_time = (start_time + 3.days).change(hour: closing_hour)\n\n # Now, we want to make a list of every hour between our start_time and our end_time\n # For this we can use a begin... end while condition loop.\n # We'll start with an empty array that will hold all the hours,\n # and a variable to hold each hour, which we will keep increasing by 1 hour, and then add to our array\n # Our loop condition will have us stop looping once we've reached the end time\n\n all_times = []\n a_time = start_time\n\n begin\n\n # add this time to our list of times\n all_times << a_time\n\n # increment the time\n a_time += reservation_interval\n\n # Once we get to closing time, we have to skip ahead to the next day's opening\n # That way you can't make a reservation at 2am\n if (a_time + reservation_interval) > a_time.change(hour: closing_hour)\n a_time = (a_time + 1.day).change(hour:opening_hour)\n end\n\n end while a_time < end_time\n\n all_times\n end",
"def timestamps(metric_name, start_timestamp, end_timestamp=Time.now)\n stats(metric_name, start_timestamp, end_timestamp).map{|s| s[:timestamp]}\n end",
"def block_slots\n slots = []\n\n unless block_delivery_end_time.blank? || block_delivery_start_time.blank?\n\n available_hours = block_delivery_end_time - block_delivery_start_time\n\n number_of_slots = available_hours / 60.minutes\n\n number_of_slots.to_i.times do |i|\n slots << {\n from: block_delivery_start_time + i.hours,\n to: block_delivery_start_time + (i + 1).hours,\n type: :daytime\n }\n end\n end\n\n slots\n end",
"def events_now\n\n # Open empty array\n events = []\n\n # Loop over all the calendars\n CALENDARS.each do |name, id|\n\n # Get the events\n cal_events = calendar(id).find_events_in_range(Time.now, Time.now + 60)\n\n # Loop over each one and add it to the array\n cal_events.each do |e|\n events << {event: e, cal: name} unless e.nil?\n end\n\n end\n\n # Return the final list\n return events\n\nend",
"def time_entries(options = {})\n entries = []\n time_invested(options).groups.each { |g| entries << g[\"time_entries\"] }\n\n process_list_response( entries.flatten , Unfuddled::TimeEntry )\n end",
"def each_with_time(&block)\n arr = @v.map.with_index{|v, i| TimeAndValue.new(@start_time+i.hours, v)}\n arr.each(&block)\n end",
"def times\n\t\t\tprogram = pop\n\t\t\tn = pop\n\t\t\traise ArgumentError, \"TIMEs: second element is not an Array.\" unless program.is_a? Array\n\t\t\tn.times { ~program.dup }\n\t\tend",
"def to_a\n [time.sec, time.min, time.hour, time.day, time.mon, time.year, time.wday, time.yday, dst?, zone]\n end",
"def get_acceptable_call_times\n AvailableTime.all.map{|m|\n if m.pharmacy_id == self.id #should be interger already but casting just in case\n {\"start\" => m.start_time.strftime(\"%H:%M:%S\"), \"stop\" => m.end_time.strftime(\"%H:%M:%S\")}\n else\n nil\n end\n }.compact\n end",
"def next_events\n self.around_events.select{|event|\n event.location.present? && event.start_time > self.end_time\n }.sort{|a,b| a.start_time <=> b.start_time}\n end",
"def execute(&block)\n v = @v.map &block\n TimeArray.new(@start_time, v, zone: Time.zone.name)\n end",
"def build_event_templates\n @event_templates = events.map do |e|\n EventTemplate.new(e).tap { |et| add_instruments_to_template(et) }\n end\n end",
"def timeslots\n unless @timeslots.present?\n timeslots = Timeslot\n .timeslots_for(@schedule_range, @form)\n .select { |ts| ts.blocks >= @blocks_needed }\n timeslots = @schedule_range.all_timeslots if timeslots.empty?\n @timeslots = timeslots.sort_by { |ts| [ts.day_id, ts.start_minute] }\n end\n\n @timeslots\n end",
"def intervals(from = nil, to = nil)\n return [] unless intervals_beginning\n \n from ||= intervals_beginning\n to ||= Time.now.beginning_of_next_day\n intervals = []\n \n @intervals.each do |start, stop|\n if from > start\n if stop > from\n stop = to if to < stop\n intervals.push [from, stop]\n end\n next\n elsif stop > to\n intervals.push [start, to] if start < to\n break\n end\n intervals.push([start, stop])\n end\n \n if @started_at && @started_at < to && to == Time.now.beginning_of_next_day\n intervals.push([@started_at, Time.now])\n end\n \n intervals\n end",
"def transmogrify\n returning Array.new do |events|\n parse.map(&its.components(Vpim::Icalendar::Vevent)).flatten.each do |event|\n events << Event.new(\n :summary => event.summary,\n :description => event.description,\n :uri => event.url,\n :location => event.location,\n :starts_at => event.dtstart,\n :ends_at => event.dtend\n )\n end\n end\n end",
"def chart_times\n access_times = self.daily_requests.limit(10)\n access_times.map(&:times)\n end",
"def compute_timestamps(begin_time, end_time)\n @timevec = value_hash[:bartime]\n if model == DailyBar\n begin\n @time_map = TimeMap.new(begin_time, end_time, timevec, :missing_bar_error => options[:missing_bar_error])\n rescue TimeseriesException => e\n raise TimeseriesException, \"#{e.message} for #{symbol}\"\n end\n else\n timevec.each_with_index { |time, idx| @time_map[time.to_i] = idx }\n end\n end",
"def forthcoming_events(time = 3600)\n events({:from => Time.now.strftime(\"%Y-%m-%dT%k:%M:%S\").concat(Calendar.timezone).gsub(/ /,\"0\"),\n :to => (Time.now + time).strftime(\"%Y-%m-%dT%k:%M:%S\").concat(Calendar.timezone).gsub(/ /,\"0\")})\n end",
"def create_time_periods(time_period_length = MSecPerHour)\n days = []\n time_periods = nil\n prev_start = @raw_data[0][0] + 1 # cross over into first day\n \n for data in @raw_data\n # Has data crossed over to next day?\n if prev_start > data[0] # Time increases throughout the day...\n days << time_periods if time_periods != nil\n \n cur_time_period = 0\n time_periods = [[]]\n \n puts \"New day: data=#{data[0]}\" if Verbose\n \n # Has data crossed over to next time period?\n elsif data[0] > ((cur_time_period + 1) * time_period_length)\n # Handle cases where the count is 0 for a time period\n while data[0] > ((cur_time_period + 1) * time_period_length)\n cur_time_period += 1\n time_periods[cur_time_period] = []\n end\n \n puts \"New time period: data=#{data[0]}\" if Verbose\n end\n \n time_periods[cur_time_period] << data\n prev_start = data[0]\n end\n \n # Add last time period\n days << time_periods\n days\n end",
"def parse_srt_times(times)\n times =~ /^([0-9:,]+) --> ([0-9:,]+)/ # May have trailing data.\n [$1, $2].map {|t| parse_srt_time(t) }\n end",
"def load_time_ranges\n @time_ranges = ActiveSupport::HashWithIndifferentAccess.new\n time_ranges = @config['time']\n time_ranges.each do |t,r|\n time_range = ActiveSupport::HashWithIndifferentAccess.new\n src_ranges ||= r\n src_ranges.map { |k,v| time_range[k.to_sym] = rangify_time_boundaries(v) }\n @time_ranges[t.to_sym] = time_range\n end\n\n end"
] | [
"0.77758896",
"0.6993386",
"0.6827037",
"0.6825186",
"0.67938447",
"0.6713517",
"0.65722907",
"0.65666837",
"0.655617",
"0.6547934",
"0.6458089",
"0.6405242",
"0.6352919",
"0.63423306",
"0.63409716",
"0.6257865",
"0.6253482",
"0.62533295",
"0.62227345",
"0.6215372",
"0.6182929",
"0.6181528",
"0.6161263",
"0.6114853",
"0.60663056",
"0.6054754",
"0.6052627",
"0.602038",
"0.60009503",
"0.5996994",
"0.59601015",
"0.5929047",
"0.591261",
"0.5903709",
"0.5900654",
"0.5900543",
"0.58793",
"0.587886",
"0.5859997",
"0.5850298",
"0.5836783",
"0.582449",
"0.58207834",
"0.5819639",
"0.5811371",
"0.5806443",
"0.580318",
"0.58006483",
"0.57989043",
"0.5791976",
"0.57906127",
"0.57834506",
"0.5776296",
"0.5765403",
"0.57474726",
"0.574073",
"0.57363623",
"0.5732888",
"0.5713641",
"0.5704388",
"0.5693763",
"0.568682",
"0.56836444",
"0.5681379",
"0.567918",
"0.567437",
"0.5670728",
"0.5657793",
"0.56569964",
"0.5646314",
"0.56432784",
"0.5637517",
"0.5636091",
"0.5635753",
"0.5634645",
"0.5602696",
"0.55982363",
"0.55725086",
"0.55725086",
"0.5569826",
"0.5565643",
"0.5545438",
"0.5545382",
"0.5543336",
"0.5536966",
"0.5527483",
"0.5521876",
"0.5512479",
"0.55011165",
"0.5498231",
"0.5497439",
"0.5495226",
"0.5492964",
"0.54891133",
"0.5481049",
"0.5478481",
"0.54713124",
"0.54697996",
"0.5465384",
"0.5455842"
] | 0.75218064 | 1 |
Method to combine :start_at and :end_at to make hash for each event and put them in an array. | def create_event_array(start_at_array, end_at_array, event_name, activity_id)
events_array = Array.new
start_at_array.each_index do |index|
event_hash = Hash.new
event_hash[:start_at] = start_at_array[index]
event_hash[:end_at] = end_at_array[index]
event_hash[:name] = event_name
event_hash[:activity_id] = activity_id
events_array[index]= event_hash
end
return events_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_events\n mapped_timeline = Timeline.new\n self.each do |time,events|\n mapped_timeline[time] = events.map{|event| yield event }\n end\n mapped_timeline\n end",
"def index\n @events = Event.where('event_start >= ?', Date.today).order(:event_start, :time_begin)\n @date_events_hash = @events.group_by(&:event_start)\n end",
"def make_event_times_array(dates_array, hour, min)\n\t\tevent_times = Array.new\n\n\t\tdates_array.each_index do |index|\n\t\t\n\t\t\tevent_times[index] = create_event_time(dates_array[index],hour, min)\n\t\tend\n\n\t\treturn event_times\n\tend",
"def events_between(date_start, date_end, start = event_start)\n\n events = []\n current_date = date_start\n\n while current_date <= date_end\n current_date = next_event_after(current_date, start)\n if current_date <= date_end\n event = {start_date: current_date, end_date: current_date + duration}\n yield(event) if block_given?\n events << event\n end\n # add one day so it doesn't return the same day\n # probably shouldn't need to do this\n current_date += 1\n end\n\n events\n end",
"def calc_event_rows\n @events_start = [{},{},{},{},{},{},{}]\n @events_end = [{},{},{},{},{},{},{}]\n @event_span = [{},{},{},{},{},{},{}]\n (0..(num_days-1)).each do |day|\n if !events[day].nil?\n events[day].each do |event|\n if !event.all_day\n if event.start_time < (date + day.days)\n start_row = 0\n else\n start_row = (event.start_time.seconds_since_midnight / (60*30)).to_i\n end\n if @events_start[day].member?(start_row)\n @events_start[day][start_row] << event\n else\n @events_start[day][start_row] = [event]\n end\n if event.end_time >= (date + (day+1).days)\n end_row = NUM_HALF_HOURS-1\n else\n end_row = ((event.end_time.seconds_since_midnight-1) / (60*30)).to_i\n end\n if @events_end[day].member?(end_row)\n @events_end[day][end_row] << event\n else\n @events_end[day][end_row] = [event]\n end\n @event_span[day][event] = end_row - start_row + 1\n end\n end\n end\n end\n end",
"def events_in_range(start_date_time, end_date_time, home_time_zone = \"UTC\")\n # fetch not repeating events first\n event_instances = events.where(date: start_date_time...end_date_time, repeat: nil).to_a\n\n # then repeating events\n events.includes(:repeat_exceptions, category: :repeat_exceptions).where.not(repeat: nil).each do |rep_event| # get all repeating events\n event_instances.concat(rep_event.events_in_range(start_date_time, end_date_time, home_time_zone)) # and add them to the event array\n end\n\n event_instances = event_instances.sort_by(&:date) # and of course sort by date\n\n event_instances # and return\n end",
"def split(range = nil)\n if self.record_category and self.activity?\n entry_end = self.end_timestamp || Time.now\n time = range ? [self.timestamp, range.begin.midnight.in_time_zone].max : self.timestamp\n end_time = range ? [entry_end, range.end.midnight.in_time_zone].min : entry_end\n list = Array.new\n while time < end_time\n new_end = [entry_end, (time + 1.day).midnight.in_time_zone].min\n list << [time, new_end, self]\n time = new_end\n end\n else\n return [self.timestamp, nil, self]\n end\n list\n end",
"def map_events!\n each do |time,events|\n self[time] = events.map{|event| yield event }\n end\n end",
"def get_times_array(padding = true)\n @times = (padding) ? [@start_dt - 1.hour] : [@start_dt]\n \n # and including every 1/2 hour until one hour after the selected end time\n while true do\n tmp = @times.last + 30.minutes\n (padding) ? (tmp == (@end_dt + 1.hour)) ? break : '' : (tmp == @end_dt) ? break : ''\n @times.push(tmp)\n end\n end",
"def index\n @events = Event.between(range: @range, field: 'start_time').order(:start_time)\n end",
"def key_dates\n events = Array.new\n events << birth_event if !birth_event.nil?\n events << death_event if !death_event.nil?\n events.concat(marriage_events) if (!marriage_events.nil? and marriage_events.count > 0)\n events\n end",
"def events(range_begin = nil, range_end = nil, time_filters_in_secs = [])\n #\n # If range_begin is nil, use from_time attribute from the model.\n #\n range_begin = range_begin || self.from_time\n range_begin = Event.convert_to_datetime(range_begin).beginning_of_day.to_i\n\n #\n # If range_end is nil, use recurrence_end attribute from the model.\n # note: range_end may still be nil if no recurrence_end is specified\n # note: range_end is exclusive. substract with DAY_IN_SECONDS to\n # become inclusive (see arshaw fullcalendar docs)\n #\n range_end = Event.convert_to_datetime(range_end).end_of_day.to_i - DAY_IN_SECONDS if range_end\n range_end = [range_end, self.recurrence_end.try(:end_of_day).try(:to_i)].compact.min\n\n arr = []\n self.fetch_events_time(range_begin, range_end).each do |e|\n event_from_time_in_secs = e +\n (self.from_time.hour * HOUR_IN_SECONDS) +\n (self.from_time.min * MINUTE_IN_SECONDS)\n event_thru_time_in_secs = event_from_time_in_secs + self.duration\n\n unless time_filters_in_secs.include? event_from_time_in_secs\n arr << Event.new(self, event_from_time_in_secs, event_thru_time_in_secs)\n end\n end\n\n arr\n end",
"def events_in_time_range(start_date_string, end_date_string)\n return self.events if self.events.nil?\n\n if(start_date_string.is_a?(String))\n # I was told there would be no timezones :/\n start_time = DateTime.parse(start_date_string).to_time.utc\n end_time = DateTime.parse(end_date_string).to_time.utc\n else\n start_time = start_date_string\n end_time = end_date_string\n end\n\n self.events.select do |e| \n created_at_time = DateTime.parse(e.created_at).to_time.utc\n created_at_time >= start_time && created_at_time < end_time\n end\n end",
"def to_a\n (@start_date..@end_date).to_a\n end",
"def commit_time_line events\n events.map(&:date).uniq.sort.each_cons(2).map {|before,after| [before, (after.to_i - before.to_i) / (60 * 60 * 24)] }\nend",
"def json_event_builder(start_date, end_date = nil)\n\t\tsetup = {}\n\t\tshifts_array = {}\n\t\tcurr_date = start_date - start_date.wday\n\t\tnext_week = curr_date.next_day(13)\n\t\tdays_array = (curr_date..next_week).to_a\n\t\tEvent.where(:start_datetime => (curr_date.to_datetime.to_s)..(next_week.next.to_datetime.to_s)).each do |e|\n\t\t\tcurr_date = Date.rfc3339(e.start_datetime).to_s\n\t\t\t# If the current event's date isn't an element in the shifts array, we create and populate it\n\t\t\t(shifts_array[curr_date].nil? ? shifts_array[curr_date] = [] : shifts_array[curr_date]) << {\n\t\t\t\tshift_id: e.id,\n\t\t\t\tstart_date: e.start_datetime,\n\t\t\t\tend_date: e.end_datetime,\n\t\t\t\tdate_taken: e.taken_datetime,\n\t\t\t\tdate_posted: e.created_at,\n\t\t\t\tposter: e.poster.nil? ? nil : e.poster.name,\n\t\t\t\ttaker: e.taker.nil? ? nil : e.taker.name\n\t\t\t}\n\t\tend\n\t\tsetup[:shifts] = shifts_array\n\t\tsetup[:calendar_days] = days_array\n\t\tsetup[:user_data] = {\n\t\t\tname: current_user.name,\n\t\t\temail: current_user.email\n\t\t}\n\t\tsetup.to_json.html_safe\n\tend",
"def transmogrify\n returning Array.new do |events|\n parse.map(&its.components(Vpim::Icalendar::Vevent)).flatten.each do |event|\n events << Event.new(\n :summary => event.summary,\n :description => event.description,\n :uri => event.url,\n :location => event.location,\n :starts_at => event.dtstart,\n :ends_at => event.dtend\n )\n end\n end\n end",
"def events_in_period\n t0 = start.midnight\n tf = finish.end_of_day\n\n events = []\n while t0 < tf\n t1 = [t0.advance(days: 21), tf].min\n events.concat(dog.stream(t0, t1, tags: @job_tags)[1]['events'])\n t0 = t1\n end\n events\n end",
"def events\n events = super\n types = self.class.events\n Hash[types.zip(events.values_at(*types))]\n end",
"def get_events\n # conditions = \"starttime >= '#{Time.at(params['start'].to_i).to_formatted_s(:db)}' AND endtime <= '#{Time.at(params['end'].to_i).to_formatted_s(:db)}'\"\n conditions = \"starttime >= '#{params['start'].to_time}' AND endtime <= '#{(params['end']+\" 23:59:59\").to_time}'\"\n if @profile\n @events = @profile.events.where conditions\n else\n conditions += \" AND profile_type = '#{event_params[:profile_type]}'\"\n @events = Event.where conditions\n end\n\n events = []\n @events.each do |event|\n events << {:id => event.id, :title => event.title, :description => event.description || \"Some cool description here...\", :start => \"#{event.starttime.iso8601}\", :end => \"#{event.endtime.iso8601}\", :allDay => event.all_day, :recurring => (event.event_series_id) ? true : false}\n end\n set_profile\n render :text => events.to_json\n end",
"def event_range events\n [events.map(&:date).min.to_date, events.map(&:date).max.to_date]\nend",
"def format_event_date(start_date, end_date)\n d1 = Date.parse(start_date) rescue nil\n d2 = Date.parse(end_date) rescue nil\n (d1 && d2) ? (d1..d2) : [d1, d2].compact\n end",
"def all_dates\n return (@start_date...@end_date).to_a\n end",
"def events_now\n\n # Open empty array\n events = []\n\n # Loop over all the calendars\n CALENDARS.each do |name, id|\n\n # Get the events\n cal_events = calendar(id).find_events_in_range(Time.now, Time.now + 60)\n\n # Loop over each one and add it to the array\n cal_events.each do |e|\n events << {event: e, cal: name} unless e.nil?\n end\n\n end\n\n # Return the final list\n return events\n\nend",
"def fullcalendar_events_json\n events.map do |event|\n {\n id: event.id.to_s,\n title: event.name,\n start: event.starts_at.strftime('%Y-%m-%d %H:%M:%S'),\n end: event.ends_at.strftime('%Y-%m-%d %H:%M:%S'),\n allDay: event.all_day,\n url: event_path(event)\n }\n end\n end",
"def between(start_dt, end_date)\n wrap(\n @inner.select do |event|\n stamp = Time.parse(event['created_at'])\n stamp >= start_dt && stamp <= end_date\n end,\n )\n end",
"def index\n if(params.has_key?(:from) && params.has_key?(:to))\n @from = DateTime.iso8601(params[:from])\n @to = DateTime.iso8601(params[:to])\n @events = Event.where(:date => @from..@to)\n else\n @events = Event.all\n end\n\n events_json\n\n render json: @events_json_data\n end",
"def get_start_times\n times = []\n self.start_time.split('%').each do |t|\n times.push(DateTime.strptime(t, '%m-%d-%Y %H:%M'))\n end\n times\n end",
"def events(from, to)\n results = applescript EVENT_SCRIPT,\n as_ruby: true,\n args: [from.strftime('%d/%m/%Y %H:%M'), to.strftime('%d/%m/%Y %H:%M')]\n\n results.map do |result|\n Waddup::Event.new do |e|\n e.label = result[:summary]\n e.at = Time.parse(result[:start_date])\n e.until = Time.parse(result[:end_date])\n e.source = self\n end\n end\n end",
"def get_events\t\t\t\n @task = UserEvent.where(\"user_id\"=>current_user.id)\n events = []\n @task.each do |task|\n events << {:id => task.id, :title => task.title, :start => DateTime.parse(task.start.to_s).strftime(\"%Y-%m-%d\"), :end => DateTime.parse(task.end.to_s).strftime(\"%Y-%m-%d\") }\n end\n render :text => events.to_json \n end",
"def segments_for_timestamps(start_timestamp, end_timestamp, granularity)\n start_ts = time_segment_for_timestamp(start_timestamp, granularity)\n end_ts = time_segment_for_timestamp(end_timestamp, granularity)\n\n segments = [start_ts]\n ts = start_ts\n while ts < end_ts\n ts += granularity\n segments << ts\n end\n\n segments\n end",
"def get_events()\n\t\tevents = []\n\n\t\t@DB[:events].order(:date).each do |event|\n\t\t\tnewTimeslots = []\n\t\t\t@DB[:timeslots].where(parent_table: 'events', parent_id: event[:'id']).each do |timeslot|\n\t\t\t\tnewTimeslots.push(DateTime.parse(timeslot[:'time']))\n\t\t\tend\n\n\t\t\tnewAttendees = []\n\t\t\t@DB[:attendees].where(parent_id: event[:'id']).each do |attendee|\n\t\t\t\tattendeeTimeslots = []\n\t\t\t\t@DB[:timeslots].where(parent_table: 'attendees', parent_id: attendee[:'id']).each do |timeslot|\n\t\t\t\t\tattendeeTimeslots.push(DateTime.parse(timeslot[:'time']))\n\t\t\t\tend\n\n\t\t\t\tnewAttendee = Attendee.new(attendee[:'name'], attendeeTimeslots)\n\t\t\t\tnewAttendees.push(newAttendee)\n\t\t\tend\n\n\t\t\tnewEvent = Event.new(event[:'name'], event[:'description'], newTimeslots, newAttendees, event[:'id'])\n\t\t\tif newEvent.get_date >= @epoch\n\t\t\t\tevents.push(newEvent)\n\t\t\tend\n\t\tend\n\n\t\treturn events\n\tend",
"def started_at\n [contact_date_date, contact_start_time]\n end",
"def parse_params\n # Find the offset so we store times in UTC\n offset = Time.zone.now.time_zone.utc_offset\n # Make sure and check if our timezone currently has daylight savings time\n if Time.zone.now.dst?\n offset = offset + 60*60\n end\n begin\n if @event.all_day\n start_t = params[:event][:start_date]\n @event.start_time = DateTime.strptime(start_t, \"%m/%d/%Y\")\n @event.start_time = @event.start_time + 12*60*60\n else\n start_t = params[:event][:start_date] + ' ' + params[:event][:start_time]\n @event.start_time = DateTime.strptime(start_t, \"%m/%d/%Y %H:%M %p\")\n @event.start_time = @event.start_time - offset\n end\n rescue\n @event.start_time = nil\n end\n begin\n if @event.all_day\n end_t = params[:event][:end_date]\n @event.end_time = DateTime.strptime(end_t, \"%m/%d/%Y\")\n @event.end_time = @event.end_time + 12*60*60\n else\n end_t = params[:event][:end_date] + ' ' + params[:event][:end_time]\n @event.end_time = DateTime.strptime(end_t, \"%m/%d/%Y %H:%M %p\")\n @event.end_time = @event.end_time - offset\n end\n rescue\n @event.end_time = nil\n end\n begin \n @event.start_date = @event.start_time.to_date\n rescue\n @event.start_date = nil\n end\n begin \n @event.end_date = @event.end_time.to_date\n rescue\n @event.end_date = nil\n end\n @event.calendar_id = params[:event][:calendar_id]\n end",
"def events_between(start_date, end_date)\n # 1. The range is exclusive; and we look ahead 2 days in order to find\n # all-day events that end on the second day (UTC, at least).\n # 2. We convert .to_time before .to_date in order to convert the event's\n # start time from UTC to local before truncating it to the date.\n # 3. We finally return only the events we care about.\n @events.items_between(start_date, end_date + 2).map do |event|\n name = event.subject\n start = event.start\n Event.new(name, start.to_time)\n end.select do |event|\n event.date >= start_date && event.date <= end_date\n end\n end",
"def multi_day_start_event_for(assignment)\n attribs = event_attribs(assignment)\n attribs[:name] = \"#{attribs[:name]} (Start)\"\n attribs[:ends_at] = attribs[:starts_at] + 1.day - 1.second\n events.build(attribs)\n end",
"def next_events\n self.around_events.select{|event|\n event.location.present? && event.start_time > self.end_time\n }.sort{|a,b| a.start_time <=> b.start_time}\n end",
"def build_event_hash\n\t\t@event_hash = {}\n\t\t\n\t\teach_event { |event| @event_hash[event.id] = event }\n\tend",
"def fetch_events_time(range_begin_in_secs, range_end_in_secs)\n #\n # collect from_time beginning of day (in seconds)\n #\n frt = self.from_time.beginning_of_day.to_i\n\n case self.recurrence_type\n when \"NO_RECURRENCE\"\n self.no_recurrence_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_DAYS\"\n self.recur_every_n_days_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_WEEKS\"\n self.recur_every_n_weeks_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_MONTHS\"\n self.recur_every_n_months_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_YEARS\"\n self.recur_every_n_years_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_DAYS_OF_WEEK\"\n self.recur_every_days_of_week_dates(range_begin_in_secs, range_end_in_secs, frt)\n else\n []\n end\n end",
"def get_runtime_timestamps\n all_events = events.to_a\n start_time = DateTime.parse(all_events.first['timestamp'])\n completion_time = DateTime.parse(all_events.last['timestamp'])\n [start_time, completion_time]\n end",
"def event_associations_between(period)\n Hash[event_associations.map do |type, association|\n [type, association.between(created_at: period)]\n end]\n end",
"def prepare_spans\n unless defined?(@prepared_spans)\n start_spans = Hash.new{|h,k| h[k] = [] }\n end_spans = Hash.new{|h,k| h[k] = [] }\n spans.each {|span|\n start_spans[span.start] << span\n end_spans[span.end] << span\n }\n @start_spans = start_spans\n @end_spans = end_spans\n end\n [@start_spans, @end_spans]\n end",
"def events(args = nil)\n events = if args.nil? || args.eql?(:all)\n events = decode_response connection.get \"/calendar/feeds/#{id}/private/full\"\n events = events[\"feed\"][\"entry\"]\n events.map{ |event| Event.build_event(event, self)}\n elsif args.is_a?(String)\n Event.new({:id => args, :calendar => self}).fetch\n elsif args.is_a?(Hash)\n if args.is_a?(Hash) && args.has_key?(:id)\n Event.new({:id => args[:id], :calendar => self}).fetch\n else\n params = { \"start-min\" => args[:from],\n \"start-max\" => args[:to]}\n events = decode_response connection.get \"/calendar/feeds/#{id}/private/full\", params\n events = events[\"feed\"][\"entry\"]\n events = events.nil? ? [] : events.map{ |event| Event.build_event(event, self)}\n end\n else\n raise ArgumentError.new \"Invalid argument type #{args.class}\"\n end\n\n end",
"def time_entries(start_date, end_date)\n opts = {\n params: {\n start_date: start_date.to_datetime.iso8601,\n end_date: end_date.to_datetime.iso8601\n }\n }\n\n begin\n response = toggl_resource['time_entries'].get(opts)\n rescue => e\n raise 'Error getting Toggl data: ' + e.response\n end\n data = JSON.parse response\n\n data.map do |entry|\n duration = entry['duration'].to_f\n\n # Negative duration means the task is currently running.\n # In this case, we'll set duration to how long it's been running\n if duration < 0\n duration = Time.now - Time.at(duration.abs)\n end\n\n {\n description: entry['description'],\n start: Date.parse(entry['start']),\n duration: duration\n }\n end\n end",
"def appointments_on(date)\n appointments.starts_on(date).to_a\n end",
"def events\n event.user.events.where(:timestamp => beginning...ending)\n end",
"def recalc_times(starting_at=0, list=@events)\n t = (starting_at == 0) ? 0 : list[starting_at - 1].time_from_start\n list[starting_at .. -1].each do |e|\n t += e.delta_time\n e.time_from_start = t\n end\n end",
"def index\n @events = Event.where(start: params[:start]..params[:end])\n render json: @events\n end",
"def get_start_and_end_dates(n)\n description = Nokogiri::HTML(@description_xpath[n].text).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[1]\n if description.include?(\"When\" && \"Tickets\")\n description = description.split(\"When\")[1].split(\"Tickets\")[0]\n datetimes = description.gsub(\";\", \",\").split(\",\")\n @additional_datetimes = datetimes[1..-1].join(\",\") if datetimes.size > 1\n get_event_datetimes(datetimes[0])\n else\n [nil, nil]\n end\n else\n [nil, nil]\n end\n end",
"def stats_by_date from_date, to_date\n events_by_date = campaign_finance_transactions.group(:sub_type)\n .select(:sub_type)\n .group(:transaction_date)\n .select(:transaction_date)\n .sum(:amount)\n\n types = campaign_finance_transactions.select(:sub_type).uniq.pluck(:sub_type)\n\n (from_date..to_date).map{ |date|\n {\n date: date,\n }.merge(\n types.reduce(Hash.new) {|hash, type|\n hash[type.to_sym] = events_by_date[[type, date]]\n hash\n }\n )\n }\n end",
"def aggregate_attendees_list(duration=1.day)\n\t\tstart_time = Time.now - duration\n\t\tself.attendees_events.select { |c| c.created_at >= start_time }\n\tend",
"def combine_all_events(url_array)\n events_array = []\n locations_array = []\n\n url_array.each do |event_url|\n parsed_event, parsed_location = pull_emilys_event_data(event_url)\n events_array << parsed_event\n locations_array << parsed_location\n end\n\n #this may be changing the JSON objects into strings, need to investigate more\n {events_array: events_array, locations_array: locations_array}\nend",
"def forthcoming_events(time = 3600)\n events({:from => Time.now.strftime(\"%Y-%m-%dT%k:%M:%S\").concat(Calendar.timezone).gsub(/ /,\"0\"),\n :to => (Time.now + time).strftime(\"%Y-%m-%dT%k:%M:%S\").concat(Calendar.timezone).gsub(/ /,\"0\")})\n end",
"def create_events!(opts={})\n cutoff = Time.now.yesterday # All events before this date will be skipped\n events = []\n transaction do\n for event in self.to_events(opts)\n if opts[:skip_old]\n next if event.title.blank? && event.description.blank? && event.url.blank?\n next if event.old?\n end\n \n # Skip invalid events that start after they end\n next if event.end_time && event.end_time < event.start_time\n \n # convert to local time, because time zone is simply discarded when event is saved\n event.start_time.localtime\n event.end_time.localtime if event.end_time\n \n # clear duplicate_of_id field in case to_events picked up orphaned duplicate\n # TODO clear the duplicate_of_id at the point where the object is created, not down here\n event.duplicate_of_id = nil if event.duplicate_of_id\n event.save!\n if event.venue\n event.venue.duplicate_of_id = nil if event.venue.duplicate_of_id\n event.venue.save! if event.venue\n end\n events << event\n end\n self.save!\n end\n return events\n end",
"def events(query)\n ret = Array.new\n \n feed = Feedjira::Feed.parse jira_query(query)\n \n feed.entries.each do |feed_evt|\n event = event_from_feed(feed_evt)\n event.person = query.person\n \n if (event.time < query.to && event.time > query.from)\n ret << event\n end\n end\n \n ret\n end",
"def index\n @agenda = HTTParty.get('http://fake-co-calendar.herokuapp.com/api/v1/events?offset=-730')['events']['list']\n @agenda.each do |meeting|\n meeting['start_time'] = DateTime.strptime(meeting['start_time'] + Time.now.getlocal.zone, \"%Y-%m-%d %H:%M:%S %z\")\n meeting['end_time'] = DateTime.strptime(meeting['end_time'] + Time.now.getlocal.zone, \"%Y-%m-%d %H:%M:%S %z\")\n end\n end",
"def build_ics_time(booking)\n times = Hash.new\n start_date = booking.startdate\n end_date = booking.enddate\n start_time = booking.starttime\n end_time = booking.endtime\n\n dtstart = Time.new start_date.year,start_date.month,start_date.day,start_time.hour,start_time.min,start_time.sec\n dtend = Time.new start_date.year,start_date.month,start_date.day,end_time.hour,end_time.min,end_time.sec\n dtstamp = Time.now\n last_modified = Time.now\n\n times.store :dtstart,dtstart.getutc\n times.store :dtend,dtend.getutc\n times.store :dtstamp, dtstamp.getutc\n times.store :last_modified, last_modified.getutc\n\n return times\n\n end",
"def add_and_return_array(data)\n # Create new array\n days = []\n # Loop through dates\n (1.week.ago.to_date..Date.today).each do |date|\n # Set datetime to beginning of day\n date = date.midnight\n # Push to hash into array\n days << { m: date, a: data[date] }\n end\n # return days as array\n days\n end",
"def index\n \n @events = Event.where(\"for_student = true\").pluck(:id,:name)\n $students = Student.all.order(:UIN)\n $students.each do |x|\n @arr = Hash.new([])\n @tslots = x.timeslots\n @events.each do |ev|\n @check = FALSE\n @tslots.each do |t|\n if(t.event_id == ev[0])\n @arr[ev[1]] = (t.start_time.strftime(\"%I:%M%p\") + \"-\" + t.end_time.strftime(\"%I:%M%p\"))\n @check = TRUE\n break\n end\n end\n if(@check == FALSE)\n @arr[ev[1]] = (\"Not Attend\")\n end\n end\n $stu_slot[x.id] = @arr\n end\n end",
"def get_keys(start_date, end_date = nil)\n keys = []\n keys << get_key_for(start_date)\n unless end_date.nil?\n while start_date <= end_date\n start_date += 60*60\n keys << get_key_for(start_date) unless start_date > end_date\n end\n keys << get_key_for(end_date)\n end\n keys.uniq\n end",
"def recalc_times(starting_at=0, list=@events)\n\tt = (starting_at == 0) ? 0 : list[starting_at - 1].time_from_start\n\tlist[starting_at .. -1].each { | e |\n\t t += e.delta_time\n\t e.time_from_start = t\n\t}\n end",
"def index\n @events_grid = initialize_grid(Event, include: [:customer, :therapist, :location, :room, :service], order: 'events.starts_at')\n @events = Event.all\n @events = Event.between(params['start'], params['end']) if (params['start'] && params['end'])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def mapOfAllEvents\n events = self.getAllEvents\n result = Hash.new\n\n events.each do |sport, evs|\n evs.each do |eventID, event|\n result[eventID] = event\n end\n end\n result\n end",
"def data_for_start_event\n {\n event: :start,\n query: query,\n search_id: search_id,\n expiration_date: expiration_date\n }.merge pseudo_graph_pattern.data_for_start_event\n end",
"def start_times\n relevant_events_scope.\n interval_starts.\n unscope(:order).\n order(:video_time).\n pluck(:video_time)\n end",
"def make_date_range from, to, keys = { sent: 0, received: 0 }\n\t\t\trange = Hash.new\n\t\t\treturn range if Time.at(to) < Time.at(from)\n\t\t\tfrom = Time.at(from).to_date\n\t\t\tto = Time.at(to).to_date\n\t\t\t(to - from).to_i.times { |i|\n\t\t\t\tindex = from + i.day\n\t\t\t\trange[index.to_s] = OpenStruct.new(keys.merge(date: index.to_time.to_i))\n\t\t\t}\n\t\t\trange\n\t\tend",
"def events_on(day)\n ((@ending_events_by_days[day] || []) + (@starting_events_by_days[day] || [])).uniq\n end",
"def generate from, upto\n events = []\n from.upto(upto).map { |date|\n wdays.each { |day| day.generate date, events }\n }\n events\n end",
"def groupByDate(bridges)\n datehash = Hash.new\n\n bridges.each do |ips|\n ips.values.each do |measurements|\n measurements.each do |m|\n time = Date.strptime(m[\"start_time\"].to_s, '%s')\n \n datehash[time] ? datehash[time].push(m) : datehash[time] = [m]\n end\n end\n end\n\n return datehash\n end",
"def intervals(from = nil, to = nil)\n return [] unless intervals_beginning\n \n from ||= intervals_beginning\n to ||= Time.now.beginning_of_next_day\n intervals = []\n \n @intervals.each do |start, stop|\n if from > start\n if stop > from\n stop = to if to < stop\n intervals.push [from, stop]\n end\n next\n elsif stop > to\n intervals.push [start, to] if start < to\n break\n end\n intervals.push([start, stop])\n end\n \n if @started_at && @started_at < to && to == Time.now.beginning_of_next_day\n intervals.push([@started_at, Time.now])\n end\n \n intervals\n end",
"def build_import_events(data)\n \t\tbegin\n \t\t\tTime.zone = ENV['DEFAULT_TIME_ZONE']\n \t\t\tstart_date = Date.parse(data[:event]['start_date'])\n \t\t\tstart_time = Time.zone.parse(data[:event]['start_time'])\n\t \t\t{\n\t calendar_id: ENV['PRIMARY_NATION_CALENDAR_ID'].to_i,\n\t status: data[:event]['status'],\n\t # Optionally restrict which tags are imported\n\t tags: build_import_event_tags(data[:event]['tags']),\n\t name: data[:event]['name'],\n\t headline: data[:event]['headline'],\n\t # Optionally use the excerpt field to store a URL if you wish to redirect\n\t # users to an external event page directly from your calendar. Make sure\n\t # to also change {{ event.url }} to {{ event.excerpt }} in your theme's\n\t # calendar template.\n\t excerpt: data[:event]['excerpt'],\n\t intro: data[:event]['intro'],\n\t # The build_event_contact method only adds the contact if name and email exist:\n\t # this is a restriction imposed by the NationBuilder API\n\t contact: build_event_contact(data),\n\t start_time: get_start_time(start_date, start_time),\n\t end_time: get_end_time(start_date, start_time, data[:event]['duration']),\n\t venue: {\n\t name: data[:event]['venue_name'],\n\t address: {\n\t address1: data[:event]['address1'],\n\t city: data[:event]['city'],\n\t state: data[:event]['state'],\n\t zip: data[:event]['zip']\n\t }\n\t },\n\t # A capacity value of 0 creates the event with an unlimited capacity\n\t capacity: 0,\n\t # Choose appropriate rsvp_form settings below\n\t rsvp_form: {\n\t phone: \"hidden\",\n\t address: \"hidden\",\n\t allow_guests: true,\n\t accept_rsvps: true,\n\t gather_volunteers: false\n\t },\n\t # Optionally set values for the `autoresponse` and `shifts` attributes\n\t show_guests: true\n\t \t}\n \t\trescue ArgumentError, TypeError => error\n \t\t\terror = error.message\n \t\t\tif error == 'no implicit conversion of nil into String'\n \t\t\t\terror = \"Start date/time can't be blank\"\n \t\t\telsif error == 'invalid date'\n \t\t\t\terror = \"Start date is invalid format\"\n \t\t\tend\n\t\t\t\t{\n\t\t\t\t\tmessage: \"#{error}\",\n\t\t\t\t\tstatus: 500\n\t\t\t\t}\n\t\t\tend\n\t end",
"def extractDateList(start_date, end_date)\n obj_start=Date.new(start_date[0..3].to_i, start_date[4..5].to_i, start_date[6..7].to_i)\n obj_end=Date.new(end_date[0..3].to_i, end_date[4..5].to_i, end_date[6..7].to_i)\n date_num=(obj_end-obj_start+1).to_i\n date_array=Array.new\n date_num.times do |i|\n date_now=obj_start+i\n date_array << date_now.strftime(\"%Y%m%d\")\n end\n date_array\nend",
"def events\n events = {}\n @db.each do |key, _|\n timestamp, object = parse_event(key)\n events[object] ||= []\n events[object].push(timestamp)\n end\n events\n end",
"def index\n\t\t@allevents = Event.all #not needed but spec refuses to work because html response looks for events with strange dates\n @events = Event.where([\"startDate >= :start AND endDate <= :end\", {:start=>Time.at(params[:start].to_i).to_formatted_s(:db), :end=>Time.at(params[:end].to_i).to_s(format = :db) }])\n \n\t\teventsArray = [] \n @events.each do |event|\n if current_user\n eventsArray << {:id => event.id,:allDay => event.all_day, :editable => true, :title => \"#{event.supporter.name}\", :start => \"#{event.startDate.to_s + \" \" + event.startTime.to_s[11..18]}\", :end => \"#{event.endDate.to_s + \" \" + event.endTime.to_s[11..18]}\", :className => \"#{event.supporter.role}\"}\n else\n eventsArray << {:id => event.id,:allDay => event.all_day, :title => \"#{event.supporter.name}\", :start => \"#{event.startDate.to_s + \" \" + event.startTime.to_s[11..18]}\", :end => \"#{event.endDate.to_s + \" \" + event.endTime.to_s[11..18]}\", :className => \"#{event.supporter.role}\"}\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n\t\t\tformat.json { render :json => eventsArray }\n end\n end",
"def checkin_organize_bookings_by_dates(bookings)\n by_dates = OrderedHash.new\n sorted_by_date_start = bookings.sort_by {|b| b.date_start}\n sorted_by_date_start.each do |booking|\n key = booking.date_start\n if by_dates.has_key?(key)\n by_dates[key] << booking\n else\n arr = Array.new\n arr << booking\n by_dates[key] = arr\n end\n end\n by_dates\n end",
"def time_slots\n collection=[]\n start_time=Time.now.beginning_of_hour\n end_time=Time.now.tomorrow.midnight-1.hour\n time=start_time\n\n while time < end_time\n collection<<[time.beginning_of_hour.hour, time.beginning_of_hour]\n time=time+1.hour\n end\n\n collection\n end",
"def align_times\n # if booking the same day, then starts_at is in one minute from now.\n earliest_possible_starts_at = ( self.starts_at.to_date == Date.today ) ? ( DateTime.now + 1.minute ) : self.starts_at.beginning_of_day\n self.attributes = {\n starts_at: earliest_possible_starts_at,\n ends_at: self.ends_at.end_of_day\n }\n end",
"def get_times\n @start_time = case params[:start]\n when Hash\n DateTime.civil(params[:start][:year].to_i, params[:start][:month].to_i, params[:start][:day].to_i, params[:start][:hour].to_i, params[:start][:minute].to_i, 0)\n when String\n DateTime.strptime(params[:start], \"%Y:%m:%d %h:%m:%s\")\n else nil\n end\n @end_time = case params[:end]\n when Hash\n DateTime.civil(params[:end][:year].to_i, params[:end][:month].to_i, params[:end][:day].to_i, params[:end][:hour].to_i, params[:end][:minute].to_i, 0)\n when String\n DateTime.strptime(params[:end], \"%Y:%m:%d %h:%m:%s\")\n else DateTime.now\n end\n logger.debug \"#{@start_time} to #{@end_time}\"\n end",
"def hour_events(selected_day, hour, events)\n h = hour.split(\":\")\n hour_end = \"#{h[0]}:59\"\n events.select { |e| e.start_time.to_date == selected_day && (e.start_time.to_time.strftime(\"%H:%M\") >= hour) && (e.start_time.to_time.strftime(\"%H:%M\") < hour_end) }\n end",
"def events(query)\n ret = Array.new\n imap_query(query).each do |env|\n event = event_from_envelope(env)\n event.person = query.person\n ret.push event\n end\n \n ret\n end",
"def day_events(date, events)\n events.select { |e| e.start_time.to_date == date }.sort_by { |e| e.start_time }\n end",
"def tracker_events\n @tracker_events ||= [].tap do |tracker_events|\n options.slice(*TRACKER_EVENTS.keys).each do |key, value|\n if option_value = value.respond_to?(:call) ? value.call(env) : value\n tracker_events << Event.new(:event => \"#{key}\".camelize(:lower), TRACKER_EVENTS[key] => \"#{option_value}\")\n end\n end\n end\n end",
"def schedule(startAt,endAt,opts={})\n ## Caching ##\n @schedules ||= {}\n if @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]\n return @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]\n end\n ## End Caching ##\n\n # TODO Handle events starting within the range but ending outside of it?\n\n # TODO Offload this selection to the database; okay for testing though\n # NOTE This is actually faster thanks to the query cache for small numbers of operating times, but not very scalable\n #all_regular_operating_times = OperatingTime.find(:all, :conditions => {:place_id => self.id, :override => 0}).select{|t| (t.startDate - 1) <= endAt.to_date and startAt.to_date <= (t.endDate + 1)}\n #all_special_operating_times = OperatingTime.find(:all, :conditions => {:place_id => self.id, :override => 1}).select{|t| (t.startDate - 1) <= endAt.to_date and startAt.to_date <= (t.endDate + 1)}\n # Select all relevant times (1 day buffer on each end)\n # NOTE Make sure to use generous date comparisons to allow for midnight rollovers\n all_regular_operating_times = OperatingTime.regular.by_place_id(self.id).in_range(startAt..endAt).find(:all)\n all_special_operating_times = OperatingTime.special.by_place_id(self.id).in_range(startAt..endAt).find(:all)\n\n puts \"\\nRegular OperatingTimes: #{all_regular_operating_times.inspect}\" if DEBUG\n puts \"\\nSpecial OperatingTimes: #{all_special_operating_times.inspect}\" if DEBUG\n\n regular_times = []\n special_times = []\n special_ranges = []\n\n all_special_operating_times.each do |ot|\n puts \"\\nSpecial Scheduling for: #{ot.inspect}\" if DEBUG\n\n # Special Case: Overriding with NO times (e.g. closed all day)\n if ot.start == 0 and ot.length == 0 and startAt.to_date <= ot.startDate\n # Block out the range, but don't add the \"null Times\"\n special_ranges << Range.new(ot.startDate,ot.endDate)\n next\n end\n\n # Start a day early if possible\n earlyStart = startAt-1.day < ot.startDate.midnight ? startAt.midnight : startAt - 1.day\n puts \"EarlyStart: #{earlyStart.inspect}\" if DEBUG\n\n # Calculate the next set up open/close times\n open,close = ot.next_times(earlyStart)\n next if open.nil? # No valid occurrences in the future\n\n while not open.nil? and open <= endAt do\n if DEBUG\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n puts \"Start Date: #{ot.startDate} (#{ot.startDate.class})\"\n puts \"End Date: #{ot.endDate} (#{ot.endDate.class})\"\n end\n\n if close < startAt # Skip forward to the first occurrance in our time range\n puts \"Seeking: #{close} < #{startAt}\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n special_times << [open,close]\n special_ranges << Range.new(ot.startDate,ot.endDate)\n open,close = ot.next_times(close)\n end\n\n end\n\n puts \"\\nSpecial Times: #{special_times.inspect}\" if DEBUG\n puts \"\\nSpecial Ranges: #{special_ranges.inspect}\" if DEBUG\n\n all_regular_operating_times.each do |ot|\n puts \"\\nRegular Scheduling for: #{ot.inspect}\" if DEBUG\n\n # Start a day early if possible\n earlyStart = startAt-1.day < ot.startDate.midnight ? startAt : startAt - 1.day\n puts \"EarlyStart: #{earlyStart.inspect}\" if DEBUG\n\n # Calculate the next set up open/close times\n open,close = ot.next_times(earlyStart)\n if DEBUG\n puts \"\"\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n end\n\n if open.nil? # No valid occurrences in the future\n puts \"Skipping: No valid occurrences in the future.\" if DEBUG\n next\n end\n\n while not open.nil? and open <= endAt do\n if DEBUG\n puts \"\"\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n end\n\n if close < startAt # Skip forward to the first occurrance in our time range\n puts \"Seeking: #{close} < #{startAt}\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n overridden = false\n special_ranges.each do |sr|\n overridden ||= sr.member?(open.to_date)\n end\n if overridden\n puts \"Overridden\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n # FIXME Causing an infinite loop; would be nice if this worked\n #open = startAt if open < startAt\n #close = endAt if close > endAt\n\n regular_times << [open,close]\n open,close = ot.next_times(close)\n end\n\n end\n\n puts \"\\nRegular Times: #{regular_times.inspect}\" if DEBUG\n\n # TODO Handle schedule overrides\n # TODO Handle combinations (i.e. part special, part regular)\n\n final_schedule = (regular_times+special_times).sort{|a,b|a[0] <=> b[0]}\n\n ## Truncate times larger than range ##\n if opts[:truncate]\n final_schedule.each_index do |i|\n final_schedule[i][0] = startAt.dup if final_schedule[i][0] < startAt\n final_schedule[i][1] = endAt.dup if final_schedule[i][1] > endAt\n end\n end\n ## End truncating ##\n\n ## Caching ##\n @schedules ||= {}\n @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash] = final_schedule\n ## End caching ##\n\n final_schedule\n end",
"def returnTimeHash(startTime,endTime)\r\n dataHash = {:idle=>0,:away=>0,:answered=>0,:incoming=>0,:outgoing=>0,:wrapup=>0, :avail=>0}\r\n objectsinrange = self.availabilities.find_all_by_event_date(startTime..endTime, :select=>'event_type,event_duration')\r\n for hit in objectsinrange\r\n sET = hit.event_type\r\n sED = hit.event_duration\r\n if (sET.include?(\"Click\") or sET.include?(\"OUTBOUND\")) then dataHash[:outgoing] += sED end\r\n if (sET.include?(\"Available\")) then dataHash[:idle] += sED end\r\n if (sET.include?(\"Wrap\")) then dataHash[:wrapup] += sED end\r\n if (sET.include?(\"Answered\")) \r\n dataHash[:incoming] += sED\r\n dataHash[:answered] += 1\r\n end\r\n if (sET.include?(\"Away\")) then dataHash[:away] += sED unless (sET.include?(\"Click\") or sET.include?(\"OUTBOUND\")) end \r\n end\r\n dataHash[:avail] = dataHash[:idle] + dataHash[:incoming] + dataHash[:outgoing] + dataHash[:wrapup]\r\n return dataHash\r\n end",
"def find_events_in_range(start_min, start_max, options = {})\n formatted_start_min = encode_time(start_min)\n formatted_start_max = encode_time(start_max)\n query = \"?timeMin=#{formatted_start_min}&timeMax=#{formatted_start_max}#{parse_options(options)}\"\n event_lookup(query)\n end",
"def hash\n @events.hash\n end",
"def event_list\n events_list\n end",
"def extract_events(calendar)\n events = []\n rep_until = Date.today >> MONTHS_ADVANCE_FOR_REPATING\n\n calendar.events.each do |event_entry|\n # for performance reasons, create event once and then clone per occurrence\n event = Event.build_from(Adapter.new(event_entry))\n occurences = event_entry.occurrences(:before => rep_until) \n # again, for performance and api limit reasons, get geo coordinates for repeating\n # events only once\n event.get_geo_coordinates #if occurences.size > 1\n \n occurences.each do |ical_event|\n adapter = Adapter.new(ical_event)\n occurrence = event.clone\n occurrence.starts_at = adapter.starts_at\n occurrence.ends_at = adapter.ends_at\n events << occurrence\n end\n end\n \n @log.info \"got #{events.size} events\"\n events\n end",
"def dates\n\t\t@times = { \n\t\t\t:haiti=>{\n\t\t\t\t:one_week_before=>\tTime.new(2010,01,5),\n\t\t\t\t:event\t\t\t=>\tTime.new(2010,01,12),\n\t\t\t\t:one_week_after\t=>\tTime.new(2010,01,19),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2010,02,12)\n\t\t\t},\n\n\t\t\t:philippines=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t},\n\t\t\t:phil=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t}\n\t\t}\n\tend",
"def formatDates\n dates = @dates.split('-')\n return {start_date: Date.parse(dates[0]), end_date: Date.parse(dates[1])}\n end",
"def events_jsonify(events)\n\t\t\tevents.collect do |event|\n\t\t\t\t{ id: event.id,\n\t\t\t\t\tname: event.name,\n\t\t\t\t\tsummary: event.summary,\n\t\t\t\t\tstart_era: event.start_era,\n\t\t\t\t\tstart_date: \"#{event.start_date or 0}/#{event.start_month or 0}/#{event.start_year}\",\n\t\t\t\t\tend_date: \"#{event.end_date or 0}/#{event.end_month or 0}/#{event.end_year or event.start_year}\",\n\t\t\t\t\tarcs: event.arcs,\n\t\t\t\t\tentities: event.entities }\n\t\t\tend.to_json\n\t\tend",
"def scheduled_appointments_start_dates(strftime)\n scheduled_appointments.map do |a|\n a.start_date.strftime(strftime)\n end\n end",
"def eventsInMonth\n # if start and end time sent\n if params[ :start ] and params[ :end ]\n render json: NationalEvent.where( date: params[:start]..params[:end] ).order( \"date\" ).all , status: 302\n else\n render json: { error: \"پارامتر ها را کامل پاس دهید\" } , status: :not_found\n end\n end",
"def dates_ranges\n (1..8).to_a.collect do |i|\n {\n start_date: i.days.ago,\n end_date: DateTime.now,\n num_of_days: i + 1\n }\n end\n end",
"def starts(starts_at)\n merge(starts: starts_at)\n end",
"def intervals\n parts = {}\n [:minute, :hour, :day, :month, :day_of_week].each do |granularity|\n if times = times_for(granularity)\n parts[granularity] = times\n end\n end\n\n merged_product parts\n # interval_list.concat times.map {|t| {granularity => t} }\n # m = expression[:minute]\n # m.split(\",\").each do |part|\n # time, divisor = part.split(\"/\")\n # start_time, end_time = time.split \"-\"\n\n # interval_list << {:minute => start_time.to_i}\n # end\n end",
"def get_agenda\n courses = get_courses_info\n agenda = [[], [], [], [], [], [], []]\n courses.each do |c|\n\t c['groups'].each do |g|\n\t next if not g['selected']\n\t g['hours'].each do |h|\n\t\t d = h['date_start'].to_time;\n\t\t j = {}\n\t\t j['course'] = c['name']\n\t\t j['group'] = g\n\t\t j['hour'] = h\n\t\t # Insert in sorted way\n\t\t at = 0\n\t\t agenda[d.wday].each do |a|\n\t\t if a['hour']['date_start'].to_time > d\n\t\t\t break\n\t\t end\n\t\t at = at +1\n\t\t end\n\t\t agenda[d.wday].insert(at, j)\n\t end\n\t end\n end\n agenda\n end",
"def create_stat_for(start_at, end_at)\n info \"#{start_at}..#{end_at}\"\n se =StatExtractor.new\n (Date.parse(start_at)..Date.parse(end_at)).each do |basedate|\n #puts \"\\n== [create_stat_for] #{basedate.to_s} ==\"\n Rule.stat_rules('day').each{|r|se.extract_stat(basedate.to_s, \"day\", r.rtype , r )}\n Rule.stat_rules('week').each{|r|se.extract_stat(basedate.to_s, \"week\", r.rtype , r )} if basedate.wday == 1\n Rule.stat_rules('month').each{|r|se.extract_stat(basedate.to_s, \"month\", r.rtype , r )} if basedate.day == 1\n end \nend",
"def to_hash\n {\n :time => @time,\n :event => @event\n }\n end",
"def calculated_dates\n [period1_from_date,period1_end_date,\n period2_from_date, period2_end_date] \n end"
] | [
"0.63486975",
"0.6328946",
"0.6306188",
"0.6238378",
"0.62371016",
"0.61670715",
"0.6133689",
"0.6112115",
"0.6023875",
"0.5979033",
"0.5974558",
"0.5967543",
"0.5954405",
"0.59527653",
"0.5941525",
"0.58745205",
"0.5859826",
"0.58438385",
"0.584312",
"0.58239293",
"0.58144516",
"0.5796112",
"0.5780691",
"0.5773229",
"0.5770267",
"0.5753357",
"0.57331365",
"0.57132816",
"0.5712516",
"0.57112235",
"0.57080454",
"0.57013756",
"0.5697841",
"0.566671",
"0.5646517",
"0.5640089",
"0.56106555",
"0.56058466",
"0.55944014",
"0.55917376",
"0.5572119",
"0.5546854",
"0.5539379",
"0.55323946",
"0.5529414",
"0.5518431",
"0.55085874",
"0.55064327",
"0.5495556",
"0.5492809",
"0.5489048",
"0.547837",
"0.5473606",
"0.54622054",
"0.54444534",
"0.54398924",
"0.5439111",
"0.5438033",
"0.54167384",
"0.5400025",
"0.539731",
"0.5394608",
"0.5392272",
"0.53865236",
"0.5377518",
"0.5376216",
"0.53724617",
"0.5372214",
"0.5370294",
"0.5369167",
"0.5368845",
"0.5357956",
"0.53549564",
"0.53454775",
"0.5341578",
"0.53397447",
"0.5334343",
"0.5333869",
"0.5329961",
"0.53287476",
"0.5317748",
"0.5310165",
"0.53091836",
"0.53036976",
"0.5301275",
"0.5300611",
"0.52999437",
"0.5296673",
"0.52946645",
"0.5284539",
"0.528204",
"0.52750504",
"0.52693874",
"0.5267951",
"0.52641934",
"0.52628106",
"0.52608204",
"0.5259934",
"0.52507323",
"0.52498144"
] | 0.74076563 | 0 |
GET /microposts GET /microposts.json | def index
@microposts = Micropost.paginate(page: params[:page])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @microposts = Micropost.all\n end",
"def index\n @microposts = Micropost.all\n end",
"def index\n @mymicroposts = Mymicropost.all\n end",
"def index\n\t\t@microposts = Micropost.paginate(page: params[:page])\n\tend",
"def index\n # @microposts = Micropost.all\n @microposts = Micropost.paginate(page: params[:page], per_page: 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microposts }\n end\n end",
"def index\n @microposts = Micropost.all.page params[:page]\n end",
"def show\n @micropost = Micropost.find(params[:id])\n\t\t respond_to do |format|\n\t\t format.html # show.html.erb\n\t\t format.json { render json: @micropost }\n\t\t end\n\n end",
"def show\n @user = User.find(params[:id])\n @microposts = @user.microposts.paginate(page: params[:page])\n end",
"def show\n @user = User.find(params[:id])\n @microposts = @user.microposts.paginate(page: params[:page])\n end",
"def show\n @micrropost = Micrropost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micrropost }\n end\n end",
"def show\n @usuario = Usuario.find(params[:id])\n @microposts = @usuario.microposts.paginate(page: params[:page])\n end",
"def show\n @app = App.find(params[:id])\n @microposts = @app.microposts.paginate(page: params[:page])\n end",
"def new\n @micropost = Micropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost }\n end\n end",
"def show\n @user = User.find(params[:id])\n @micropostsList = @user.microposts.paginate(page: params[:page])\n end",
"def microposts \n @microposts = Micropost.where(user_id: current_user.followed_ids).order('created_at desc').all\n end",
"def show\n @micsropost = Micsropost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micsropost }\n end\n end",
"def show\n @microposts = @user.microposts.order(created_at: :desc)\n end",
"def show\n @user = User.find(params[:id])\n # @micropost = @user.microposts.build\n @microposts = @user.microposts.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n @user = User.find(params[:id])\n @microposts = @user.microposts.order(created_at: :desc)\n end",
"def new\n \t@micropost = Micropost.new \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost }\n end\n end",
"def new\n @micrropost = Micrropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micrropost }\n end\n end",
"def show\n @user = User.find(params[:id])#finds user by the id parameter; creates an instance of the user \n @microposts = @user.microposts.paginate(page: params[:page])\n end",
"def show\n @micropost2 = Micropost2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micropost2 }\n end\n end",
"def mine\n @user = current_user\n # @micropost = @user.microposts.build\n @microposts = @user.feed.paginate(page: params[:page], per_page: 20)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def read\n user = User.find(params[:id])\n microposts_json = microposts_as_json(user.microposts.paginate(page: params[:page]))\n next_page = user.microposts.paginate(page: params[:page]).next_page\n @package = { microposts: microposts_json, next_page: next_page }\n render json: @package\n end",
"def index\n @micropost_toys = MicropostToy.all\n end",
"def index\n @admin_microposts = Admin::Micropost.all\n end",
"def new\n @micsropost = Micsropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micsropost }\n end\n end",
"def new\n @micropost2 = Micropost2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost2 }\n end\n end",
"def show\n puts \"Show()\"\n @user = User.find(params[:id]) \n @microposts = @user.microposts\n end",
"def show\n \t@user = User.find(params[:id]) # p281.\n @microposts = @user.microposts.paginate(page: params[:page]) # p449. \n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def show\n @microposts = @user.microposts.with_attached_image.page(params[:page])\n end",
"def set_micropost\n @micropost = current_user.microposts.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n @microposts = @user.microposts.not_messages.paginate(:page=>params[:page], :per_page => 5)\n @title = \"Show '#{@user.name}'\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show \n @user = User.find(params[:id])\n @micropost = Micropost.new\n @title = @user.name\n @microposts = @user.microposts.paginate(:page => params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def index\n @macroposts = Macropost.all\n end",
"def index\n ## Adding a @microposts instance variable to the micropost index action. \n @microposts = @user.microposts.paginate(:page => params[:page])\n @title = CGI.escapeHTML(@user.name)\n end",
"def set_mymicropost\n @mymicropost = Mymicropost.find(params[:id])\n end",
"def index\n @q = Micropost.ransack(params[:q])\n @microposts = @q.result(distinct: true).page(params[:page]).order('created_at DESC')\n @page_title = t('page_title', name: 'Micropost')\n end",
"def show\n @title = 'Microposts'\n @user = User.find(current_user.id)\n feed = @user.feed\n @microposts = feed.page(params[:current_page]).per(5)\n @new_post = Micropost.new if @new_post.nil?\n # Realization of the endless page via ajax.\n respond_to do |format|\n format.js\n format.html\n format.xml { render :xml => @micropost }\n end\n end",
"def set_micropost\n @micropost = Micropost.find_by_id(params[:micropost_id])\n end",
"def show\n @macropost = Macropost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @macropost }\n end\n end",
"def show\n # ブラウザから指定された:idに関するインスタンスを作成し、\n # UsersControllerのインスタンス変数に代入\n @user = User.find(params[:id])\n # ユーザに紐ついたmicropostsテーブルを作成日時が新しい順に並び替え\n # select \"microposts\".* from \"microposts\" order by created_at DESC\n # userControllerのインスタンス変数に代入\n @microposts = @user.microposts.order(created_at: :desc)\n end",
"def create\n @micropost = current_user.microposts.new(micropost_params)\n respond_to do |format|\n if @micropost.save\n format.html do\n redirect_to @micropost, notice: t('created', name: 'Micropost')\n end\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json do\n render json: @micropost.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def new\n @micropost = Micropost.new\n\n end",
"def reply\n @title = \"Reply\"\n @user=User.find(params[:id])\n @micropost=Micropost.new\n respond_to do |format|\n format.html\n format.json { render json: @micropost }\n end\n\n end",
"def feed\n # This is preliminary. See \"Following users\" for the full implementation.\n Micropost.where(\"story_id = ?\", id)\n end",
"def show\r\n @user = User.find(params[:id])\r\n @microposts = @user.microposts.page(params[:page]).per(20)\r\n @title = @user.name \r\n respond_to do |format|\r\n \t format.html # show.html.erb\r\n \t format.json {render json: @user }\r\n \r\n end \r\n end",
"def create\n @title = 'Microposts'\n @new_post = current_user.microposts.build(params[:micropost])\n if @new_post.save\n @user = User.find(current_user.id)\n feed = @user.feed\n @microposts = feed.page(params[:current_page]).per(5)\n end\n respond_to do |format|\n format.html { redirect_to '/wall' }\n format.js\n end\n end",
"def feed\n # escape the id to avoid security holes\n Micropost.where(\"user_id = ?\", id)\n end",
"def new\n @macropost = Macropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @macropost }\n end\n end",
"def create\n @micropost = current_user.microposts.build(micropost_params)\n\n\n respond_to do |format|\n if @micropost.save\n format.html { redirect_to root_url(:anchor => \"ideas\"), notice: 'Micropost was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@micropost = current_user.microposts.build(micropost_params)\n\t\tif @micropost.save\n\t\t\tflash[:success] = \"Micropost created!\"\n\t\t\tredirect_to root_url\n\t\telse\n\t\t\t@feed_items = []\n\t\t\trender 'static_pages/home'\n\t\tend\n\tend",
"def new\n @loc_name=params[:q]\n @micropost=current_user.microposts.build(params[:micropost])\n #@tags=Tag.pluck(:label)\n #respond_with(@tags)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id) # id u ovom context isto sto i self.id\n # isto sto i: microposts (isto sto i self.microposts)\n end",
"def show\n @micrrapost = Micrrapost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micrrapost }\n end\n end",
"def create\n @micropost = current_user.microposts.build(params[:micropost])\n if @micropost.save\n flash[:success] = \"Mikeropost created!\"\n redirect_to root_path\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def micropost_params\n params.require(:micropost).permit(:content, :user_id)\n end",
"def feed\n # This is preliminary. See \"Following users\" for the full implementation\n Micropost.where( \"user_id = ?\", id ) \n # using ? ensures that id is properly escaped before submitting the SQL query\n end",
"def index\n @miscroposts = Miscropost.all\n end",
"def create\n @mymicropost = Mymicropost.new(mymicropost_params)\n\n respond_to do |format|\n if @mymicropost.save\n format.html { redirect_to @mymicropost, notice: 'Mymicropost was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mymicropost }\n else\n format.html { render action: 'new' }\n format.json { render json: @mymicropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n \tend",
"def micropost_params\n params.require(:micropost).permit(:content)\n end",
"def micropost_params\n params.require(:micropost).permit(:content)\n end",
"def show\n \t@user = User.find(params[:id])\n # Make microposts available for users show-action\n @feed_items = @user.microposts.paginate(page: params[:page])\n end",
"def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n\tend",
"def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n\tend",
"def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n\tend",
"def feed\n # This is preliminary. See \"Following users\" for the full implementation.\n #The question mark ensures that id is properly escaped before being included in the underlying SQL query, \n #thereby avoiding a serious security hole called SQL injection. The id attribute here is just an integer, \n #so there is no danger in this case, but always escaping variables injected into SQL statements is a good habit to cultivate. \n Micropost.where(\"user_id = ?\", id)\n end",
"def show_other_user\n @title = 'Microposts'\n @user = User.find(params[:id])\n @microposts = @user.feed.page(params[:current_page]).per(5)\n @new_post = Micropost.new if @new_post.nil?\n render 'microposts/show'\n end",
"def create\n @micrropost = Micrropost.new(params[:micrropost])\n\n respond_to do |format|\n if @micrropost.save\n format.html { redirect_to @micrropost, notice: 'Micrropost was successfully created.' }\n format.json { render json: @micrropost, status: :created, location: @micrropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micrropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n if @user\n #fresh_when last_modified: @user.updated_at\n #expires_in 2.minutes\n #response.headers[\"Expires\"] = 1.minutes.from_now.httpdate\n puts \"\\e[31minside action\\e[0m\"\n @microposts = @user.microposts.newest.paginate page: params[:page],\n per_page: Settings.app.models.micropost.microposts_per_page\n else\n flash[:danger] = t \"controllers.users_controller.user_not_found\"\n redirect_to :root\n end\n end",
"def create\n @micropost = current_user.microposts.build(params[:micropost])\n if @micropost.save\n flash[:success] = \"Post created!\"\n redirect_to root_path\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def micropost_params\n params.require(:micropost).permit(:content, :picture)\n end",
"def create\n @micropost = current_user.microposts.build(micropost_params)\n\n if @micropost.save\n redirect_to @micropost, notice: 'Micropost was successfully created.'\n else\n render :new\n end\n end",
"def set_micropost_toy\n @micropost_toy = MicropostToy.find(params[:id])\n end",
"def feed\n user = User.find(params[:id])\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n microposts = Micropost.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: params[:id])\n microposts_json = microposts_as_json(microposts.paginate(page: params[:page]))\n next_page = microposts.paginate(page: params[:page]).next_page\n @package = { next_page: next_page,\n microposts: microposts_json,\n is_current_user: (user == current_user) }\n render json: @package\n end",
"def mymicropost_params\n params.require(:mymicropost).permit(:content, :user_id)\n end",
"def feed\n # Preliminary implementation\n # The \"?\" ensures that the 'id' is properly escaped before being included in the underlying SQL query. This is more secure than inserting the 'id' into the SQL query directly because SQL injection would be possible otherwise\n \n #Micropost.where(\"user_id = ?\", id)\n\n # Display a feed of microposts for only the users that the user is following\n Micropost.from_users_followed_by(self)\n end",
"def create\n \t# Create a new micropsot object\n @micropost = current_user.microposts.build(micropost_params)\n # Save the micropsot to the database\n if @micropost.save\n flash[:success] = \"Micropost created!\"\n redirect_to root_url\n else\n # When there is an error in submitting a micropost, we still need this\n # variable\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def show\n session[:current_robot_id] = nil\n @micropost = Micropost.new\n @robot = Robot.find(params[:id])\n session[:current_robot_id] = @robot.id\n @microposts = @robot.microposts.paginate(:page => params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @robot }\n end\n end",
"def show\n @microopost = Microopost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @microopost }\n end\n end",
"def create\n @micsropost = Micsropost.new(params[:micsropost])\n\n respond_to do |format|\n if @micsropost.save\n format.html { redirect_to @micsropost, notice: 'Micsropost was successfully created.' }\n format.json { render json: @micsropost, status: :created, location: @micsropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micsropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @micropost = Micropost.find(params[:id])\n @micropost.destroy\n\n respond_to do |format|\n format.html { redirect_to microposts_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7812569",
"0.7812569",
"0.7795536",
"0.7666757",
"0.7602911",
"0.7551813",
"0.7445781",
"0.72913843",
"0.72909546",
"0.7278202",
"0.7275811",
"0.7269476",
"0.7181516",
"0.7176857",
"0.7170947",
"0.7094121",
"0.7088447",
"0.7085954",
"0.70824647",
"0.7075361",
"0.7058888",
"0.7032534",
"0.70025367",
"0.69999886",
"0.69929636",
"0.69858414",
"0.6913359",
"0.6889057",
"0.6867768",
"0.6826176",
"0.68093735",
"0.6798819",
"0.6798819",
"0.67564046",
"0.67564046",
"0.67564046",
"0.67564046",
"0.67564046",
"0.6755693",
"0.6746549",
"0.67404515",
"0.6732006",
"0.6704545",
"0.66665506",
"0.6628356",
"0.661947",
"0.65678227",
"0.6559658",
"0.654191",
"0.6519397",
"0.6509319",
"0.64357185",
"0.64295554",
"0.64295554",
"0.64295554",
"0.64295554",
"0.64295554",
"0.64295554",
"0.64295554",
"0.64295554",
"0.64003605",
"0.63924783",
"0.6388191",
"0.63867337",
"0.63685584",
"0.6339488",
"0.6326928",
"0.63022363",
"0.63012075",
"0.62796503",
"0.6209676",
"0.61914104",
"0.61892575",
"0.6177182",
"0.61727554",
"0.61672014",
"0.615602",
"0.6134638",
"0.613012",
"0.613012",
"0.61276555",
"0.6125106",
"0.6125106",
"0.6125106",
"0.6116784",
"0.61155003",
"0.6108452",
"0.610819",
"0.60776466",
"0.6071019",
"0.6069771",
"0.6054991",
"0.60325015",
"0.6012982",
"0.6003614",
"0.5993847",
"0.5990569",
"0.5985989",
"0.59819776",
"0.59819025"
] | 0.74457556 | 7 |
GET /microposts/1 GET /microposts/1.json GET /microposts/new | def new
@micropost = Micropost.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @micropost = Micropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost }\n end\n end",
"def new\n \t@micropost = Micropost.new \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost }\n end\n end",
"def new\n @micrropost = Micrropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micrropost }\n end\n end",
"def new\n @micropost2 = Micropost2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost2 }\n end\n end",
"def new\n @micsropost = Micsropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micsropost }\n end\n end",
"def create\n @micropost = current_user.microposts.new(micropost_params)\n respond_to do |format|\n if @micropost.save\n format.html do\n redirect_to @micropost, notice: t('created', name: 'Micropost')\n end\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json do\n render json: @micropost.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @micropost = current_user.microposts.build(micropost_params)\n\n\n respond_to do |format|\n if @micropost.save\n format.html { redirect_to root_url(:anchor => \"ideas\"), notice: 'Micropost was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = 'Microposts'\n @new_post = current_user.microposts.build(params[:micropost])\n if @new_post.save\n @user = User.find(current_user.id)\n feed = @user.feed\n @microposts = feed.page(params[:current_page]).per(5)\n end\n respond_to do |format|\n format.html { redirect_to '/wall' }\n format.js\n end\n end",
"def create\n\t\t@micropost = current_user.microposts.build(micropost_params)\n\t\tif @micropost.save\n\t\t\tflash[:success] = \"Micropost created!\"\n\t\t\tredirect_to root_url\n\t\telse\n\t\t\t@feed_items = []\n\t\t\trender 'static_pages/home'\n\t\tend\n\tend",
"def new\n @macropost = Macropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @macropost }\n end\n end",
"def create\n @micrropost = Micrropost.new(params[:micrropost])\n\n respond_to do |format|\n if @micrropost.save\n format.html { redirect_to @micrropost, notice: 'Micrropost was successfully created.' }\n format.json { render json: @micrropost, status: :created, location: @micrropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micrropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mymicropost = Mymicropost.new(mymicropost_params)\n\n respond_to do |format|\n if @mymicropost.save\n format.html { redirect_to @mymicropost, notice: 'Mymicropost was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mymicropost }\n else\n format.html { render action: 'new' }\n format.json { render json: @mymicropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @micropost = Micropost.find(params[:id])\n\t\t respond_to do |format|\n\t\t format.html # show.html.erb\n\t\t format.json { render json: @micropost }\n\t\t end\n\n end",
"def create\n @micropost = current_user.microposts.build(params[:micropost])\n if @micropost.save\n flash[:success] = \"Mikeropost created!\"\n redirect_to root_path\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def create\n @micropost = current_user.microposts.build(micropost_params)\n\n if @micropost.save\n redirect_to @micropost, notice: 'Micropost was successfully created.'\n else\n render :new\n end\n end",
"def create\n @micropost = current_user.microposts.build(params[:micropost])\n if @micropost.save\n flash[:success] = \"Post created!\"\n redirect_to root_path\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def index\n @microposts = Micropost.all\n end",
"def index\n @microposts = Micropost.all\n end",
"def create\n @micsropost = Micsropost.new(params[:micsropost])\n\n respond_to do |format|\n if @micsropost.save\n format.html { redirect_to @micsropost, notice: 'Micsropost was successfully created.' }\n format.json { render json: @micsropost, status: :created, location: @micsropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micsropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @mymicroposts = Mymicropost.all\n end",
"def show\n @micrropost = Micrropost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micrropost }\n end\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def new\n @micrrapost = Micrrapost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micrrapost }\n end\n end",
"def new\n #1st you retrieve the post thanks to params[:micropost_id]\n micropost = micropost.find(params[:micropost_id])\n #2nd you build a new one\n @comment = micropost.comments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def create\n \t# Create a new micropsot object\n @micropost = current_user.microposts.build(micropost_params)\n # Save the micropsot to the database\n if @micropost.save\n flash[:success] = \"Micropost created!\"\n redirect_to root_url\n else\n # When there is an error in submitting a micropost, we still need this\n # variable\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def new\n @loc_name=params[:q]\n @micropost=current_user.microposts.build(params[:micropost])\n #@tags=Tag.pluck(:label)\n #respond_with(@tags)\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def show\n @micropost2 = Micropost2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micropost2 }\n end\n end",
"def create\n @micropost = Micropost.new(params[:micropost])\n\t\t@micropost.user_id = current_user.id\n\t\t@micropost.username = current_user.username\n\t\t@micropost.post_time = Time.now\n respond_to do |format|\n if @micropost.save\n format.html { redirect_to dashboard_path, notice: 'Successfully posted !' }\n format.json { render json: @micropost, status: :created, location: @micropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_micropost = Admin::Micropost.new(admin_micropost_params)\n\n respond_to do |format|\n if @admin_micropost.save\n format.html { redirect_to @admin_micropost, notice: 'Micropost was successfully created.' }\n format.json { render :show, status: :created, location: @admin_micropost }\n else\n format.html { render :new }\n format.json { render json: @admin_micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micropost2 = Micropost2.new(params[:micropost2])\n\n respond_to do |format|\n if @micropost2.save\n format.html { redirect_to @micropost2, notice: 'Micropost2 was successfully created.' }\n format.json { render json: @micropost2, status: :created, location: @micropost2 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micropost2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micropost = Micropost.new(micropost_params)\n @micropost.created = Time.now\n \n respond_to do |format|\n if @micropost.save\n format.html { redirect_to @micropost, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mine\n @user = current_user\n # @micropost = @user.microposts.build\n @microposts = @user.feed.paginate(page: params[:page], per_page: 20)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n @user = User.find(params[:id])#finds user by the id parameter; creates an instance of the user \n @microposts = @user.microposts.paginate(page: params[:page])\n end",
"def set_mymicropost\n @mymicropost = Mymicropost.find(params[:id])\n end",
"def show\n @micsropost = Micsropost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micsropost }\n end\n end",
"def set_micropost\n @micropost = current_user.microposts.find(params[:id])\n end",
"def new\n @micorpost = Micorpost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micorpost }\n end\n end",
"def create\n if not logged_in?\n redirect_to '/'\n end\n \n datecode = to_datecode now \n user = current_user\n item = micropost_params;\n \n if item[:content].nil?\n return\n end\n \n if item[:mood].nil?\n return\n end\n\n item[:datecode] = datecode\n item[:user_id] = user.id\n target_item = user.microposts.find_by(datecode: datecode)\n if target_item.nil?\n @micropost = Micropost.new(item)\n else\n target_item.update(content: item[:content], mood: item[:mood], is_onechance: item[:is_onechance])\n @micropost = target_item\n end\n\n respond_to do |format|\n if @micropost.save\n format.html { redirect_to @micropost, notice: 'Micropost was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\t\t@microposts = Micropost.paginate(page: params[:page])\n\tend",
"def create\n @micropost = current_user.microposts.build(micropost_params)\n if @micropost.save\n # sucessful\n flash[:success] = \"Post created!\"\n redirect_to root_url\n else\n # not sucessful put error message and take to home page\n @feed_items = []\n render \"static_pages/home\"\n end\n end",
"def create\n@micropost = current_user.microposts.build(params[:micropost])\nif @micropost.save\nflash[:success] = \"Micropost created!\"\nredirect_to root_path\nelse\n@feed_items = []\n render 'static_pages/home'\nend\nend",
"def index\n @microposts = Micropost.all.page params[:page]\n end",
"def set_micropost\n @micropost = Micropost.find_by_id(params[:micropost_id])\n end",
"def new\n @miccropost = Miccropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @miccropost }\n end\n end",
"def new\n @microopost = Microopost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @microopost }\n end\n end",
"def index\n # @microposts = Micropost.all\n @microposts = Micropost.paginate(page: params[:page], per_page: 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microposts }\n end\n end",
"def show\n @microposts = @user.microposts.order(created_at: :desc)\n end",
"def show\n @user = User.find(params[:id])\n # @micropost = @user.microposts.build\n @microposts = @user.microposts.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n @app = App.find(params[:id])\n @microposts = @app.microposts.paginate(page: params[:page])\n end",
"def new\n @newspost = Newspost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspost }\n end\n end",
"def show\n @user = User.find(params[:id])\n @microposts = @user.microposts.order(created_at: :desc)\n end",
"def create\n @micropost = current_user.microposts.build(micropost_params)\n @micropost.image.attach(params[:micropost][:image])\n\n unless @micropost.save\n @feed_items = current_user.feed.paginate(page: params[:page])\n render 'static_pages/home'\n end\n\n unless params[:micropost][:tags_list].blank?\n tags = params[:micropost][:tags_list].split(\",\").map { |item| item.strip }\n tag_list = []\n tags.each do |tag|\n tagAux = Tag.find_or_create_by(content: tag)\n tag_list << tagAux\n end\n \n @micropost.addTag(tag_list)\n \n end\n\n flash[:success] = \"Micropost created!\"\n redirect_to root_url\n end",
"def show\n @title = 'Microposts'\n @user = User.find(current_user.id)\n feed = @user.feed\n @microposts = feed.page(params[:current_page]).per(5)\n @new_post = Micropost.new if @new_post.nil?\n # Realization of the endless page via ajax.\n respond_to do |format|\n format.js\n format.html\n format.xml { render :xml => @micropost }\n end\n end",
"def reply\n @title = \"Reply\"\n @user=User.find(params[:id])\n @micropost=Micropost.new\n respond_to do |format|\n format.html\n format.json { render json: @micropost }\n end\n\n end",
"def show\n @user = User.find(params[:id])\n @microposts = @user.microposts.paginate(page: params[:page])\n end",
"def show\n @user = User.find(params[:id])\n @microposts = @user.microposts.paginate(page: params[:page])\n end",
"def show\n puts \"Show()\"\n @user = User.find(params[:id]) \n @microposts = @user.microposts\n end",
"def new\n @twitter_list = TwitterList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @twitter_list }\n end\n end",
"def create\n @micropost_toy = MicropostToy.new(micropost_toy_params)\n\n respond_to do |format|\n if @micropost_toy.save\n format.html { redirect_to @micropost_toy, notice: 'Micropost toy was successfully created.' }\n format.json { render :show, status: :created, location: @micropost_toy }\n else\n format.html { render :new }\n format.json { render json: @micropost_toy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\n @microposts = Micropost.paginate(page: params[:page])\n \n \n \n end",
"def show\n # ブラウザから指定された:idに関するインスタンスを作成し、\n # UsersControllerのインスタンス変数に代入\n @user = User.find(params[:id])\n # ユーザに紐ついたmicropostsテーブルを作成日時が新しい順に並び替え\n # select \"microposts\".* from \"microposts\" order by created_at DESC\n # userControllerのインスタンス変数に代入\n @microposts = @user.microposts.order(created_at: :desc)\n end",
"def show\n @macropost = Macropost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @macropost }\n end\n end",
"def microposts \n @microposts = Micropost.where(user_id: current_user.followed_ids).order('created_at desc').all\n end",
"def set_micropost_toy\n @micropost_toy = MicropostToy.find(params[:id])\n end",
"def show\n @usuario = Usuario.find(params[:id])\n @microposts = @usuario.microposts.paginate(page: params[:page])\n end",
"def show\n @user = User.find(params[:id])\n @micropostsList = @user.microposts.paginate(page: params[:page])\n end",
"def new\n @screencast = Screencast.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screencast }\n end\n end",
"def create\n @macropost = Macropost.new(params[:macropost])\n\n respond_to do |format|\n if @macropost.save\n format.html { redirect_to @macropost, notice: 'Macropost was successfully created.' }\n format.json { render json: @macropost, status: :created, location: @macropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @macropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tweet }\n end\n end",
"def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tweet }\n end\n end",
"def create\n logger.error \"=-=-=-=-=-=-=-=-=--=-=-=-=-==-=-=-=-=-=-=-\"\n logger.error params[:micropost_id]\n @post_like = PostLike.create(:micropost_id => params[:micropost_id])\n logger.error \"=-=-=-=-=-=-=-=-=--=-=-=-=-==-=-=-=-=-=-=-\"\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js\n end\n end",
"def edit\n\t\t@micropost = Micropost.find(params[:id])\n\tend",
"def edit\n\t@micropost = Micropost.find(params[:id])\n end",
"def new\n @music_like = MusicLike.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @music_like }\n end\n end",
"def new\n @twitter_user = TwitterUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @twitter_user }\n end\n end",
"def show\n @microposts = @user.microposts.with_attached_image.page(params[:page])\n end",
"def show \n @user = User.find(params[:id])\n @micropost = Micropost.new\n @title = @user.name\n @microposts = @user.microposts.paginate(:page => params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n \t@user = User.find(params[:id]) # p281.\n @microposts = @user.microposts.paginate(page: params[:page]) # p449. \n end",
"def index\n @admin_microposts = Admin::Micropost.all\n end",
"def create\n @macropost = Macropost.new(macropost_params)\n\n respond_to do |format|\n if @macropost.save\n format.html { redirect_to @macropost, notice: 'Macropost was successfully created.' }\n format.json { render action: 'show', status: :created, location: @macropost }\n else\n format.html { render action: 'new' }\n format.json { render json: @macropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_admin_micropost\n @admin_micropost = Admin::Micropost.find(params[:id])\n end",
"def create\n\trespond_to do |format|\n\t\tif @created\n\t\t\tformat.html { redirect_to detail_micropost_path(@micropost.id) }\n\t\t\tformat.mobile do\n\t\t\t\tjson_response = {status: \"success\", feed: current_user.mobile_feed, pool: current_user.mobile_pool, created: @micropost.to_mobile}\n\t\t\t\n\t\t\t\trender json: json_response\n\t\t\tend\n\t\telse\n\t\t\tformat.html do\n\t\t\t\t@feed_items = current_user.feed\n\t\t\t\t@pool_items = @feed_items\n\t\t\n\t\t\t\trender 'static_pages/home'\n\t\t\tend\n\t\tend\n\tend\n end",
"def new\n @photo = Photo.new\n\t@albums = Album.find_all_by_twit_id(params[:view_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @post_like = PostLike.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post_like }\n end\n end",
"def index\n @micropost_toys = MicropostToy.all\n end",
"def create\n @microopost = Microopost.new(params[:microopost])\n\n respond_to do |format|\n if @microopost.save\n format.html { redirect_to @microopost, :notice => 'Microopost was successfully created.' }\n format.json { render :json => @microopost, :status => :created, :location => @microopost }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @microopost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def read\n user = User.find(params[:id])\n microposts_json = microposts_as_json(user.microposts.paginate(page: params[:page]))\n next_page = user.microposts.paginate(page: params[:page]).next_page\n @package = { microposts: microposts_json, next_page: next_page }\n render json: @package\n end",
"def create\n @miscropost = Miscropost.new(miscropost_params)\n\n respond_to do |format|\n if @miscropost.save\n format.html { redirect_to @miscropost, notice: 'Miscropost was successfully created.' }\n format.json { render :show, status: :created, location: @miscropost }\n else\n format.html { render :new }\n format.json { render json: @miscropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micrrapost = Micrrapost.new(params[:micrrapost])\n\n respond_to do |format|\n if @micrrapost.save\n format.html { redirect_to @micrrapost, notice: 'Micrrapost was successfully created.' }\n format.json { render json: @micrrapost, status: :created, location: @micrrapost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micrrapost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_other_user\n @title = 'Microposts'\n @user = User.find(params[:id])\n @microposts = @user.feed.page(params[:current_page]).per(5)\n @new_post = Micropost.new if @new_post.nil?\n render 'microposts/show'\n end",
"def destroy\n @micropost = Micropost.find(params[:id])\n @micropost.destroy\n\n respond_to do |format|\n format.html { redirect_to microposts_url }\n format.json { head :no_content }\n end\n end",
"def new\n @watched_movie = WatchedMovie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @watched_movie }\n end\n end",
"def new\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n @post = Mist::Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n @micrrapost = Micrrapost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micrrapost }\n end\n end"
] | [
"0.8062003",
"0.8042192",
"0.7933891",
"0.78684115",
"0.77133733",
"0.7521373",
"0.7361078",
"0.7349607",
"0.7314839",
"0.7298307",
"0.7269954",
"0.72609794",
"0.7194115",
"0.7168874",
"0.71598667",
"0.7147803",
"0.7127726",
"0.7127726",
"0.71215975",
"0.71042645",
"0.70832485",
"0.70506805",
"0.70506805",
"0.7012089",
"0.7010871",
"0.6993638",
"0.6973213",
"0.6967764",
"0.6967764",
"0.6967764",
"0.6967764",
"0.6967764",
"0.69496846",
"0.6919557",
"0.6906382",
"0.6886448",
"0.687295",
"0.6842658",
"0.68321496",
"0.68252546",
"0.6821225",
"0.6815463",
"0.6806383",
"0.6804427",
"0.67988354",
"0.67903507",
"0.67857754",
"0.6783778",
"0.67518145",
"0.6744063",
"0.6740683",
"0.67282057",
"0.67194855",
"0.6700717",
"0.6654149",
"0.6639461",
"0.6620748",
"0.6619551",
"0.66105527",
"0.6590203",
"0.6578793",
"0.65786535",
"0.65710276",
"0.65576005",
"0.65483665",
"0.65396994",
"0.65369856",
"0.6465665",
"0.6457487",
"0.64501995",
"0.6441851",
"0.64381546",
"0.6414707",
"0.63905185",
"0.63200396",
"0.63200396",
"0.63119125",
"0.63095194",
"0.6306382",
"0.6293831",
"0.6274364",
"0.6258407",
"0.6254257",
"0.6248725",
"0.6244865",
"0.62351286",
"0.6227843",
"0.6227312",
"0.6224326",
"0.62228996",
"0.62142086",
"0.62113917",
"0.6191663",
"0.61846125",
"0.6177248",
"0.6167199",
"0.6161204",
"0.6159707",
"0.615718",
"0.6124286"
] | 0.75707436 | 5 |
POST /microposts POST /microposts.json | def create
@micropost = current_user.microposts.build(micropost_params)
respond_to do |format|
if @micropost.save
format.html { redirect_to root_url(:anchor => "ideas"), notice: 'Micropost was successfully created.' }
format.json { render :show, status: :created, location: @micropost }
else
format.html { render :new }
format.json { render json: @micropost.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @micropost = current_user.microposts.new(micropost_params)\n respond_to do |format|\n if @micropost.save\n format.html do\n redirect_to @micropost, notice: t('created', name: 'Micropost')\n end\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json do\n render json: @micropost.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @title = 'Microposts'\n @new_post = current_user.microposts.build(params[:micropost])\n if @new_post.save\n @user = User.find(current_user.id)\n feed = @user.feed\n @microposts = feed.page(params[:current_page]).per(5)\n end\n respond_to do |format|\n format.html { redirect_to '/wall' }\n format.js\n end\n end",
"def create\n @micrropost = Micrropost.new(params[:micrropost])\n\n respond_to do |format|\n if @micrropost.save\n format.html { redirect_to @micrropost, notice: 'Micrropost was successfully created.' }\n format.json { render json: @micrropost, status: :created, location: @micrropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micrropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mymicropost = Mymicropost.new(mymicropost_params)\n\n respond_to do |format|\n if @mymicropost.save\n format.html { redirect_to @mymicropost, notice: 'Mymicropost was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mymicropost }\n else\n format.html { render action: 'new' }\n format.json { render json: @mymicropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micsropost = Micsropost.new(params[:micsropost])\n\n respond_to do |format|\n if @micsropost.save\n format.html { redirect_to @micsropost, notice: 'Micsropost was successfully created.' }\n format.json { render json: @micsropost, status: :created, location: @micsropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micsropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @micropost = Micropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost }\n end\n end",
"def create\n @micropost = current_user.microposts.build(micropost_params)\n\n if @micropost.save\n redirect_to @micropost, notice: 'Micropost was successfully created.'\n else\n render :new\n end\n end",
"def create\n @micropost = current_user.microposts.build(params[:micropost])\n if @micropost.save\n flash[:success] = \"Mikeropost created!\"\n redirect_to root_path\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def create\n\t\t@micropost = current_user.microposts.build(micropost_params)\n\t\tif @micropost.save\n\t\t\tflash[:success] = \"Micropost created!\"\n\t\t\tredirect_to root_url\n\t\telse\n\t\t\t@feed_items = []\n\t\t\trender 'static_pages/home'\n\t\tend\n\tend",
"def create\n @admin_micropost = Admin::Micropost.new(admin_micropost_params)\n\n respond_to do |format|\n if @admin_micropost.save\n format.html { redirect_to @admin_micropost, notice: 'Micropost was successfully created.' }\n format.json { render :show, status: :created, location: @admin_micropost }\n else\n format.html { render :new }\n format.json { render json: @admin_micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micropost = Micropost.new(params[:micropost])\n\t\t@micropost.user_id = current_user.id\n\t\t@micropost.username = current_user.username\n\t\t@micropost.post_time = Time.now\n respond_to do |format|\n if @micropost.save\n format.html { redirect_to dashboard_path, notice: 'Successfully posted !' }\n format.json { render json: @micropost, status: :created, location: @micropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @micrropost = Micrropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micrropost }\n end\n end",
"def create\n @micropost = current_user.microposts.build(params[:micropost])\n if @micropost.save\n flash[:success] = \"Post created!\"\n redirect_to root_path\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def micropost_params\n params.require(:micropost).permit(:content, :user_id)\n end",
"def new\n \t@micropost = Micropost.new \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost }\n end\n end",
"def create\n @micropost = current_user.microposts.build(micropost_params)\n @micropost.image.attach(params[:micropost][:image])\n\n unless @micropost.save\n @feed_items = current_user.feed.paginate(page: params[:page])\n render 'static_pages/home'\n end\n\n unless params[:micropost][:tags_list].blank?\n tags = params[:micropost][:tags_list].split(\",\").map { |item| item.strip }\n tag_list = []\n tags.each do |tag|\n tagAux = Tag.find_or_create_by(content: tag)\n tag_list << tagAux\n end\n \n @micropost.addTag(tag_list)\n \n end\n\n flash[:success] = \"Micropost created!\"\n redirect_to root_url\n end",
"def create\n if not logged_in?\n redirect_to '/'\n end\n \n datecode = to_datecode now \n user = current_user\n item = micropost_params;\n \n if item[:content].nil?\n return\n end\n \n if item[:mood].nil?\n return\n end\n\n item[:datecode] = datecode\n item[:user_id] = user.id\n target_item = user.microposts.find_by(datecode: datecode)\n if target_item.nil?\n @micropost = Micropost.new(item)\n else\n target_item.update(content: item[:content], mood: item[:mood], is_onechance: item[:is_onechance])\n @micropost = target_item\n end\n\n respond_to do |format|\n if @micropost.save\n format.html { redirect_to @micropost, notice: 'Micropost was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @microposts = Micropost.all\n end",
"def index\n @microposts = Micropost.all\n end",
"def micropost_params\n params.require(:micropost).permit(:content, :image)\n end",
"def index\n @mymicroposts = Mymicropost.all\n end",
"def micropost_params\n params.require(:micropost).permit(:title, :content, :category_ids => [])\n end",
"def micropost_params\n params.require(:micropost).permit(:content)\n end",
"def micropost_params\n params.require(:micropost).permit(:content)\n end",
"def create\n \t# Create a new micropsot object\n @micropost = current_user.microposts.build(micropost_params)\n # Save the micropsot to the database\n if @micropost.save\n flash[:success] = \"Micropost created!\"\n redirect_to root_url\n else\n # When there is an error in submitting a micropost, we still need this\n # variable\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def micropost_params\n params.require(:micropost).permit(:content, :picture)\n end",
"def micropost_params\n params.require(:micropost).permit(:datecode, :user_id, :content, :mood, :is_onechance)\n end",
"def micropost_params\n params.require(:micropost).permit(:content, :image)\n end",
"def new\n @micropost2 = Micropost2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost2 }\n end\n end",
"def create\n @micropost_toy = MicropostToy.new(micropost_toy_params)\n\n respond_to do |format|\n if @micropost_toy.save\n format.html { redirect_to @micropost_toy, notice: 'Micropost toy was successfully created.' }\n format.json { render :show, status: :created, location: @micropost_toy }\n else\n format.html { render :new }\n format.json { render json: @micropost_toy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def micropost_params\n params.require(:micropost).permit(:title, :description, :user_id, :kind, :priority, :status, :upload)\n end",
"def mymicropost_params\n params.require(:mymicropost).permit(:content, :user_id)\n end",
"def create\n @micropost = Micropost.new(micropost_params)\n @micropost.created = Time.now\n \n respond_to do |format|\n if @micropost.save\n format.html { redirect_to @micropost, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def create\n @micropost = current_user.microposts.build(micropost_params)\n if @micropost.save\n # sucessful\n flash[:success] = \"Post created!\"\n redirect_to root_url\n else\n # not sucessful put error message and take to home page\n @feed_items = []\n render \"static_pages/home\"\n end\n end",
"def microposts \n @microposts = Micropost.where(user_id: current_user.followed_ids).order('created_at desc').all\n end",
"def index\n\t\t@microposts = Micropost.paginate(page: params[:page])\n\tend",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def new\n @micsropost = Micsropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micsropost }\n end\n end",
"def index\n # @microposts = Micropost.all\n @microposts = Micropost.paginate(page: params[:page], per_page: 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microposts }\n end\n end",
"def create\n @micropost2 = Micropost2.new(params[:micropost2])\n\n respond_to do |format|\n if @micropost2.save\n format.html { redirect_to @micropost2, notice: 'Micropost2 was successfully created.' }\n format.json { render json: @micropost2, status: :created, location: @micropost2 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micropost2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @micropost = Micropost.new\n\n end",
"def set_micropost\n @micropost = current_user.microposts.find(params[:id])\n end",
"def create\n@micropost = current_user.microposts.build(params[:micropost])\nif @micropost.save\nflash[:success] = \"Micropost created!\"\nredirect_to root_path\nelse\n@feed_items = []\n render 'static_pages/home'\nend\nend",
"def index\n\n @microposts = Micropost.paginate(page: params[:page])\n \n \n \n end",
"def micropost_params\n params.require(:micropost).permit(:content, :image, category_ids: [])\n end",
"def micropost_params\n\t\tparams.require(:micropost).permit(:content, :picture, :eventDate, :location)\n\tend",
"def set_micropost\n @micropost = Micropost.find_by_id(params[:micropost_id])\n end",
"def mine\n @user = current_user\n # @micropost = @user.microposts.build\n @microposts = @user.feed.paginate(page: params[:page], per_page: 20)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def index\n @microposts = Micropost.all.page params[:page]\n end",
"def set_mymicropost\n @mymicropost = Mymicropost.find(params[:id])\n end",
"def micropost_params\n #params.require(:micropost).permit(:content)\n params.require(:micropost).permit(:content, :picture)\n end",
"def create\n @micropost = spree_current_user.microposts.build(micropost_params)\n @micropost.handbag_id = params[:micropost][:handbag_id]\n if @micropost.save\n flash[:success] = \"Post added!\"\n redirect_to :back\n else\n flash[:error] = \"Make sure text is added.\"\n redirect_to :back\n end\n end",
"def new\n @macropost = Macropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @macropost }\n end\n end",
"def create\n @macropost = Macropost.new(params[:macropost])\n\n respond_to do |format|\n if @macropost.save\n format.html { redirect_to @macropost, notice: 'Macropost was successfully created.' }\n format.json { render json: @macropost, status: :created, location: @macropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @macropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reply\n @title = \"Reply\"\n @user=User.find(params[:id])\n @micropost=Micropost.new\n respond_to do |format|\n format.html\n format.json { render json: @micropost }\n end\n\n end",
"def create\n logger.error \"=-=-=-=-=-=-=-=-=--=-=-=-=-==-=-=-=-=-=-=-\"\n logger.error params[:micropost_id]\n @post_like = PostLike.create(:micropost_id => params[:micropost_id])\n logger.error \"=-=-=-=-=-=-=-=-=--=-=-=-=-==-=-=-=-=-=-=-\"\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js\n end\n end",
"def create\n @micrrapost = Micrrapost.new(params[:micrrapost])\n\n respond_to do |format|\n if @micrrapost.save\n format.html { redirect_to @micrrapost, notice: 'Micrrapost was successfully created.' }\n format.json { render json: @micrrapost, status: :created, location: @micrrapost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micrrapost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @loc_name=params[:q]\n @micropost=current_user.microposts.build(params[:micropost])\n #@tags=Tag.pluck(:label)\n #respond_with(@tags)\n end",
"def create\n @macropost = Macropost.new(macropost_params)\n\n respond_to do |format|\n if @macropost.save\n format.html { redirect_to @macropost, notice: 'Macropost was successfully created.' }\n format.json { render action: 'show', status: :created, location: @macropost }\n else\n format.html { render action: 'new' }\n format.json { render json: @macropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @micropost_toys = MicropostToy.all\n end",
"def micropost_params\n params.require(:micropost).permit(:content,:picture)\nend",
"def micropost_toy_params\n params.require(:micropost_toy).permit(:content, :user_id)\n end",
"def admin_micropost_params\n params.require(:admin_micropost).permit(:content, :user_id)\n end",
"def create\n @microopost = Microopost.new(params[:microopost])\n\n respond_to do |format|\n if @microopost.save\n format.html { redirect_to @microopost, :notice => 'Microopost was successfully created.' }\n format.json { render :json => @microopost, :status => :created, :location => @microopost }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @microopost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @micropost = Micropost.new(micropost_params)\n if @micropost.content != nil && @micropost.content != ''\n if @micropost.save \n flash[:success] = \"Posted Succesfully!\"\n else\n flash[:failure] = \"Unable to post. Please try again!\"\n end\n else\n flash[:failure] = \"Please share what's in your mind !!!\"\n end\n redirect_to user_path(@micropost.user_id)\n end",
"def show\n @micropost = Micropost.find(params[:id])\n\t\t respond_to do |format|\n\t\t format.html # show.html.erb\n\t\t format.json { render json: @micropost }\n\t\t end\n\n end",
"def create\n @product = Product.find(session[:product_id])\n @micropost = @product.microposts.build(micropost_params)\n @micropost.content = current_user.name + \": \" + @micropost.content\n if @micropost.save\n flash[:success] = \"Success\"\n redirect_to @product\n else\n flash[:fail] = \"fail\"\n end\n end",
"def set_micropost_toy\n @micropost_toy = MicropostToy.find(params[:id])\n end",
"def make_microposts\n # Generate 50 posts for 6 users. Use Faker to generate some content for the Microposts.\n 50.times do\n User.all(:limit => 6).each do |user|\n user.microposts.create!(:content => Faker::Lorem.sentence(5))\n end\n end\nend",
"def destroy\n\t@micropost.destroy\n \n\trespond_to do |format|\n\t\tformat.html { redirect_to root_url }\n\t\tformat.mobile { render json: {status: \"success\"} }\n\tend\n end",
"def show\n @micrropost = Micrropost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micrropost }\n end\n end",
"def read\n user = User.find(params[:id])\n microposts_json = microposts_as_json(user.microposts.paginate(page: params[:page]))\n next_page = user.microposts.paginate(page: params[:page]).next_page\n @package = { microposts: microposts_json, next_page: next_page }\n render json: @package\n end",
"def index\n @macroposts = Macropost.all\n end",
"def create\n \t@micropost = current_user.microposts.build(params[:micropost])\n\n if @micropost.save\n \t\n # Here on success. Already saved in the DB. \n flash[:success] = \"New post accepted\"\n \n # Now, redirect back to the root page to allow more new posts...\n redirect_to root_url\n else\n # Bad data values. Back to home page with null feeds list\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def show\n @user = User.find(params[:id])\n # @micropost = @user.microposts.build\n @microposts = @user.microposts.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @micrrapost = Micrrapost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micrrapost }\n end\n end",
"def create\n @micropost = current_user.microposts.build(micropost_params)\n @micropost.image.attach(params[:micropost][:image])\n @micropost.parent_id = params[:parent_id]\n if @micropost.save\n flash[:succes] = I18n.t \"comment.success\"\n respond_to do |format|\n format.html\n format.js\n end\n else\n flash[:danger] = I18n.t \"comment.failed\"\n redirect_to request.referer || root_url\n end\n end",
"def create\n @group = nil\n @group = current_user.microgroups.find(params[:microgroup_id]).group unless params[:microgroup_id].nil?\n # @micropost = Micropost.new(params[:micropost])\n @micropost = current_user.microposts.build(params[:micropost])\n if @group\n @micropost.group = @group\n else\n @micropost.group_id = 0\n end\n\n respond_to do |format|\n if @micropost.save\n if @group\n format.html { redirect_to @group.microgroup, notice: 'Micropost was successfully created.' }\n format.js { @microposts = @group.microposts.paginate(page: params[:page], per_page: 10) }\n format.json { render json: @group.microgroup, status: :created, location: @microgroup }\n else\n format.html { redirect_to users_mine_path, notice: 'Micropost was successfully created.' }\n format.js { @microposts = current_user.feed.paginate(page: params[:page], per_page: 20) }\n format.json { render json: @micropost, status: :created, location: @micropost }\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_microposts\r\n users = User.all(limit: 6)\r\n 50.times do\r\n content = Faker::Lorem.sentence(5)\r\n users.each { |user| user.microposts.create!(content: content) }\r\n end\r\nend",
"def create\n @micorpost = Micorpost.new(params[:micorpost])\n\n respond_to do |format|\n if @micorpost.save\n format.html { redirect_to @micorpost, notice: 'Micorpost was successfully created.' }\n format.json { render json: @micorpost, status: :created, location: @micorpost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micorpost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @usuario = Usuario.find(params[:id])\n @microposts = @usuario.microposts.paginate(page: params[:page])\n end",
"def index\n @admin_microposts = Admin::Micropost.all\n end",
"def show\n @microposts = @user.microposts.order(created_at: :desc)\n end",
"def macropost_params\n params.require(:macropost).permit(:content, :user_id)\n end",
"def destroy\n @mymicropost.destroy\n respond_to do |format|\n format.html { redirect_to mymicroposts_url }\n format.json { head :no_content }\n end\n end",
"def create\n @miscropost = Miscropost.new(miscropost_params)\n\n respond_to do |format|\n if @miscropost.save\n format.html { redirect_to @miscropost, notice: 'Miscropost was successfully created.' }\n format.json { render :show, status: :created, location: @miscropost }\n else\n format.html { render :new }\n format.json { render json: @miscropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = @micropost.comments.new (comment_params)\n @comment.user = current_user\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @micropost, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n if @micropost == set_micropost\n Comment.where(micropost_id: @micropost.id).destroy_all\n @micropost.destroy\n end\n respond_to do |format|\n format.html do\n redirect_to microposts_url, notice: t('destroyed', name: 'Micropost')\n end\n format.json { head :no_content }\n end\n end",
"def show\n @user = User.find(params[:id])\n @microposts = @user.microposts.paginate(page: params[:page])\n end",
"def show\n @user = User.find(params[:id])\n @microposts = @user.microposts.paginate(page: params[:page])\n end",
"def destroy\n @micropost = Micropost.find(params[:id])\n @micropost.destroy\n\n respond_to do |format|\n format.html { redirect_to microposts_url }\n format.json { head :no_content }\n end\n end",
"def new\n #1st you retrieve the post thanks to params[:micropost_id]\n micropost = micropost.find(params[:micropost_id])\n #2nd you build a new one\n @comment = micropost.comments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def show\n @user = User.find(params[:id])\n @microposts = @user.microposts.order(created_at: :desc)\n end",
"def create\n\trespond_to do |format|\n\t\tif @created\n\t\t\tformat.html { redirect_to detail_micropost_path(@micropost.id) }\n\t\t\tformat.mobile do\n\t\t\t\tjson_response = {status: \"success\", feed: current_user.mobile_feed, pool: current_user.mobile_pool, created: @micropost.to_mobile}\n\t\t\t\n\t\t\t\trender json: json_response\n\t\t\tend\n\t\telse\n\t\t\tformat.html do\n\t\t\t\t@feed_items = current_user.feed\n\t\t\t\t@pool_items = @feed_items\n\t\t\n\t\t\t\trender 'static_pages/home'\n\t\t\tend\n\t\tend\n\tend\n end"
] | [
"0.74312764",
"0.7217986",
"0.71826017",
"0.7145193",
"0.6962739",
"0.6956072",
"0.69354075",
"0.69113517",
"0.6891886",
"0.6889804",
"0.68856466",
"0.686241",
"0.68548185",
"0.684824",
"0.6820386",
"0.68123066",
"0.6808733",
"0.6805246",
"0.6805246",
"0.6800926",
"0.68007153",
"0.67973244",
"0.67964053",
"0.67964053",
"0.6790861",
"0.673383",
"0.67322457",
"0.6679493",
"0.6676324",
"0.666562",
"0.66580707",
"0.6657096",
"0.66441846",
"0.66438526",
"0.66438526",
"0.664271",
"0.6628932",
"0.6614202",
"0.6610176",
"0.6610176",
"0.6610176",
"0.6610176",
"0.6610176",
"0.6600123",
"0.6591025",
"0.65771455",
"0.65576035",
"0.6535422",
"0.65215224",
"0.6520247",
"0.65140855",
"0.65004784",
"0.64915484",
"0.64796686",
"0.6466915",
"0.6460449",
"0.6437155",
"0.6418279",
"0.6367196",
"0.63593733",
"0.63389367",
"0.6324828",
"0.6315815",
"0.6268941",
"0.62439317",
"0.62157536",
"0.6200136",
"0.61745715",
"0.6167849",
"0.615394",
"0.61497396",
"0.6136056",
"0.61268336",
"0.6121083",
"0.6116939",
"0.60832465",
"0.6077334",
"0.6069716",
"0.6067808",
"0.6052422",
"0.60474503",
"0.6043404",
"0.602877",
"0.6020107",
"0.601123",
"0.6007705",
"0.60018593",
"0.5983806",
"0.5958785",
"0.5936144",
"0.59254724",
"0.5925271",
"0.59234935",
"0.59052205",
"0.5890525",
"0.58900654",
"0.588303",
"0.58775383",
"0.5873188",
"0.587088"
] | 0.7220905 | 1 |
PATCH/PUT /microposts/1 PATCH/PUT /microposts/1.json | def update
@micropost = Micropost.friendly.find(params[:id])
respond_to do |format|
if @micropost.update(micropost_params)
format.html { redirect_to @micropost, notice: 'Micropost was successfully updated.' }
format.json { render :show, status: :ok, location: @micropost }
else
format.html { render :edit }
format.json { render json: @micropost.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @micropost.update(micropost_params)\n format.html do\n redirect_to @micropost, notice: t('updated', name: 'Micropost')\n end\n format.json { render :show, status: :ok, location: @micropost }\n else\n format.html { render :edit }\n format.json do\n render json: @micropost.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @micropost.update(micropost_params)\n format.html { redirect_to @micropost, notice: \"Micropost was successfully updated.\" }\n format.json { render :show, status: :ok, location: @micropost }\n else\n format.html { render :edit }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @micrropost = Micrropost.find(params[:id])\n\n respond_to do |format|\n if @micrropost.update_attributes(params[:micrropost])\n format.html { redirect_to @micrropost, notice: 'Micrropost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @micrropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @micropost = Micropost.find(params[:id])\n\n respond_to do |format|\n if @micropost.update_attributes(params[:micropost])\n format.html { redirect_to dashboard_path, notice: 'The post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mymicropost.update(mymicropost_params)\n format.html { redirect_to @mymicropost, notice: 'Mymicropost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mymicropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_micropost.update(admin_micropost_params)\n format.html { redirect_to @admin_micropost, notice: 'Micropost was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_micropost }\n else\n format.html { render :edit }\n format.json { render json: @admin_micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t@updated = @micropost.update_attributes(params[:micropost])\n \n if @updated\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to detail_micropost_path(@micropost) }\n\t\t\tformat.mobile { render json: {status: \"success\"} }\n\t\t\tformat.js { }\n\t\tend\n else\n\t\trespond_to do |format|\n\t\t\tformat.html { render 'edit' }\n\t\t\tformat.mobile { mobile_micropost_errors(@micropost) }\n\t\t\tformat.js { }\n\t\tend\n end\n end",
"def update\n @micsropost = Micsropost.find(params[:id])\n\n respond_to do |format|\n if @micsropost.update_attributes(params[:micsropost])\n format.html { redirect_to @micsropost, notice: 'Micsropost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @micsropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @micropost2 = Micropost2.find(params[:id])\n\n respond_to do |format|\n if @micropost2.update_attributes(params[:micropost2])\n format.html { redirect_to @micropost2, notice: 'Micropost2 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @micropost2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @micropost_toy.update(micropost_toy_params)\n format.html { redirect_to @micropost_toy, notice: 'Micropost toy was successfully updated.' }\n format.json { render :show, status: :ok, location: @micropost_toy }\n else\n format.html { render :edit }\n format.json { render json: @micropost_toy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @microopost = Microopost.find(params[:id])\n\n respond_to do |format|\n if @microopost.update_attributes(params[:microopost])\n format.html { redirect_to @microopost, :notice => 'Microopost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @microopost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@micropost = Micropost.find(params[:id])\n\t\tif @micropost.update_attributes(micropost_params)\n\t\t\tredirect_back_or root_url\n\t\telse\n\t\t\trender 'edit'\n\t\tend\n\tend",
"def update\n @micrrapost = Micrrapost.find(params[:id])\n\n respond_to do |format|\n if @micrrapost.update_attributes(params[:micrrapost])\n format.html { redirect_to @micrrapost, notice: 'Micrrapost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @micrrapost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @macropost = Macropost.find(params[:id])\n\n respond_to do |format|\n if @macropost.update_attributes(params[:macropost])\n format.html { redirect_to @macropost, notice: 'Macropost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @macropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def update\n if @micropost.update(micropost_params)\n flash[:success] = \"Post Updated\"\n else\n flash[:failure] = \"Unable to update post. Please try again!\"\n end\n redirect_to user_path(@micropost.user_id)\n end",
"def update\n respond_to do |format|\n if @macropost.update(macropost_params)\n format.html { redirect_to @macropost, notice: 'Macropost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @macropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_micropost\n @micropost = current_user.microposts.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find(params[:id])\n end",
"def set_micropost\n @micropost = Micropost.find_by_id(params[:micropost_id])\n end",
"def update\n @micorpost = Micorpost.find(params[:id])\n\n respond_to do |format|\n if @micorpost.update_attributes(params[:micorpost])\n format.html { redirect_to @micorpost, notice: 'Micorpost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @micorpost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @minipost.update(minipost_params)\n format.html { redirect_to @minipost, notice: 'Minipost was successfully updated.' }\n format.json { render :show, status: :ok, location: @minipost }\n else\n format.html { render :edit }\n format.json { render json: @minipost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\t\t@micropost = Micropost.find(params[:id])\n\tend",
"def edit\n\t@micropost = Micropost.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @miscropost.update(miscropost_params)\n format.html { redirect_to @miscropost, notice: 'Miscropost was successfully updated.' }\n format.json { render :show, status: :ok, location: @miscropost }\n else\n format.html { render :edit }\n format.json { render json: @miscropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @micropot.update(micropot_params)\n format.html { redirect_to @micropot, notice: 'Micropot was successfully updated.' }\n format.json { render :show, status: :ok, location: @micropot }\n else\n format.html { render :edit }\n format.json { render json: @micropot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @miccropost = Miccropost.find(params[:id])\n\n respond_to do |format|\n if @miccropost.update_attributes(params[:miccropost])\n format.html { redirect_to @miccropost, notice: 'Miccropost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @miccropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def micropost_params\n params.require(:micropost).permit(:title, :description, :user_id, :kind, :priority, :status, :upload)\n end",
"def update\n @micropost = Micropost.find(params[:micropost_id])\n current_user.retweet(@micropost)\n respond_to do |format|\n format.html { redirect_to \"/static_pages/home\"}\n format.js\n end\n end",
"def set_mymicropost\n @mymicropost = Mymicropost.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @audiopost.update(audiopost_params)\n format.html { redirect_to @audiopost, notice: 'Audiopost was successfully updated.' }\n format.json { render :show, status: :ok, location: @audiopost }\n else\n format.html { render :edit }\n format.json { render json: @audiopost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_micropost_toy\n @micropost_toy = MicropostToy.find(params[:id])\n end",
"def update\n @screencast = Screencast.find(params[:id])\n\n respond_to do |format|\n if @screencast.update_attributes(params[:screencast])\n format.html { redirect_to @screencast, notice: 'Screencast was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @screencast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def micropost_params\n params.require(:micropost).permit(:content, :user_id)\n end",
"def update\n @mood = Mood.find(params[:id])\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n if @mood.update_attributes(params[:mood])\n format.json { head :ok }\n else\n format.json { render :xml => @mood.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #1st you retrieve the post thanks to params[:post_id]\n micropost = micropost.find(params[:micropost_id])\n #2nd you retrieve the comment thanks to params[:id]\n @comment = micropost.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n #1st argument of redirect_to is an array, in order to build the correct route to the nested resource comment\n format.html { redirect_to([@comment.micropost, @comment], :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @micropost = current_user.microposts.new(micropost_params)\n respond_to do |format|\n if @micropost.save\n format.html do\n redirect_to @micropost, notice: t('created', name: 'Micropost')\n end\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json do\n render json: @micropost.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @micropst.update(micropst_params)\n format.html { redirect_to @micropst, notice: \"Micropst was successfully updated.\" }\n format.json { render :show, status: :ok, location: @micropst }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @micropst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def destroy\n @micropost = Micropost.find(params[:id])\n @micropost.destroy\n\n respond_to do |format|\n format.html { redirect_to microposts_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n @description = @micropost.description\n @title = @micropost.title \n @priority = @micropost.priority\n @kind = @micropost.kind \n @status = @micropost.status \n if @micropost.update(micropost_params)\n if(@title.to_s != @micropost.title.to_s)\n @comment = @micropost.comments.new\n @comment.body = \"Changed title to \" + @micropost.title.to_s\n @comment.user = User.new\n @comment.save\n end\n if(@priority.to_s != @micropost.priority.to_s)\n @comment = @micropost.comments.new\n @comment.body = \"Priority changed from \"+ @priority.to_s + \" to \" + @micropost.priority.to_s\n @comment.user = User.new\n @comment.save\n end\n if(@kind.to_s != @micropost.kind.to_s)\n @comment = @micropost.comments.new\n @comment.body = \"Kind changed from \"+ @kind.to_s + \" to \" + @micropost.kind.to_s\n @comment.user = User.new\n @comment.save\n end\n if(@status.to_s != @micropost.status.to_s)\n @comment = @micropost.comments.new\n @comment.body = \"Status changed from \"+ @status.to_s + \" to \" + @micropost.status.to_s\n @comment.user = User.new\n @comment.save\n end\n if(@description.to_s != @micropost.description.to_s)\n @comment = @micropost.comments.new\n @comment.body = \"Description changed to \" + @micropost.description.to_s\n @comment.user = User.new\n @comment.save\n end\n format.html { redirect_to @micropost, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @micropost }\n else\n format.html { render :edit }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Like.update(params[\"id\"], params[\"like\"])\n end",
"def put!\n request! :put\n end",
"def update_attr\n #sanity checks \n @persona = current_persona\n @mediaset = @persona.mediasets.find(params[:id])\n \n respond_to do |format|\n @mediaset.update_attributes( params[:mediaset] )\n format.json{ respond_with_bip(@mediaset) }\n end\n end",
"def set_admin_micropost\n @admin_micropost = Admin::Micropost.find(params[:id])\n end",
"def micropost_params\n params.require(:micropost).permit(:content, :picture)\n end",
"def update\n # Add in this #MDM\n @tweet = Tweet.find(params[:id]) \n \n respond_to do |format|\n if @tweet.update(tweet_params)\n format.html { redirect_to @tweet, notice: 'Tweet was successfully updated.' }\n format.json { render :show, status: :ok, location: @tweet }\n else\n format.html { render :edit }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def destroy\n @micrropost = Micrropost.find(params[:id])\n @micrropost.destroy\n\n respond_to do |format|\n format.html { redirect_to micrroposts_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @musictrack.update(musictrack_params)\n format.html { redirect_to @musictrack, notice: 'Musictrack was successfully updated.' }\n format.json { render :show, status: :ok, location: @musictrack }\n else\n format.html { render :edit }\n format.json { render json: @musictrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def micropost_params\n params.require(:micropost).permit(:content, :image)\n end",
"def micropost_params\n params.require(:micropost).permit(:datecode, :user_id, :content, :mood, :is_onechance)\n end",
"def destroy\n if @micropost == set_micropost\n Comment.where(micropost_id: @micropost.id).destroy_all\n @micropost.destroy\n end\n respond_to do |format|\n format.html do\n redirect_to microposts_url, notice: t('destroyed', name: 'Micropost')\n end\n format.json { head :no_content }\n end\n end",
"def micropost_params\n params.require(:micropost).permit(:content)\n end",
"def micropost_params\n params.require(:micropost).permit(:content)\n end",
"def micropost_params\n params.require(:micropost).permit(:title, :content, :category_ids => [])\n end",
"def create\n @micropost = current_user.microposts.build(micropost_params)\n\n\n respond_to do |format|\n if @micropost.save\n format.html { redirect_to root_url(:anchor => \"ideas\"), notice: 'Micropost was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def micropost_params\n params.require(:micropost).permit(:content, :image)\n end",
"def new\n @micropost = Micropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost }\n end\n end",
"def update\n\t\t# find our post\n\t\tid = params[:id]\n\t\t@post = Post.find(id)\n\n\t\t# increment the number of votes\n\t\tif params[:tweet] == \"true\"\n\t\t\t@post.votes = @post.votes + 1\n\t\t\t@post.save\n\t\telsif params[:flagged] == \"true\"\n\t\t\t@post.flagged = @post.flagged + 1\n\t\t\t@post.save\n\t\tend\n\t\t\n\t\t# TODO: ask Tom what this does again\n\t\trender :json => @post\n\tend",
"def update\n respond_to do |format|\n if @moviepost.update(moviepost_params)\n format.html { redirect_to @moviepost, notice: 'Moviepost was successfully updated.' }\n format.json { render :show, status: :ok, location: @moviepost }\n else\n format.html { render :edit }\n format.json { render json: @moviepost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @screencast = Screencast.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @screencast.update_attributes(params[:screencast])\n format.html { redirect_to(@screencast, :notice => 'Screencast was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @screencast.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @micropst = Micropst.find(params[:id])\n\n respond_to do |format|\n if @micropst.update_attributes(params[:micropst])\n format.html { redirect_to(@micropst, :notice => 'Micropst was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @micropst.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \n unless current_user == @post.user\n return\n end\n \n unless params[:post][:public].nil?\n @post.public = params[:post][:public]\n end\n \n unless params[:post][:random_token].nil?\n @post.random_token = params[:post][:random_token]\n end\n \n set_burn_date\n \n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => get_json, :callback => params[:callback] }\n else\n format.json { render :json => @post.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @newspost = Newspost.find(params[:id])\n\n respond_to do |format|\n if @newspost.update_attributes(params[:newspost])\n format.html { redirect_to @newspost, notice: 'Newspost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @newspost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_macropost\n @macropost = Macropost.find(params[:id])\n end",
"def mymicropost_params\n params.require(:mymicropost).permit(:content, :user_id)\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end",
"def update\n @mobile = Story.find(params[:id])\n @mobile.update(mobile_params)\n\n redirect_to mobile_path(@mobile)\n end",
"def create\n @micropost = Micropost.new(micropost_params)\n @micropost.created = Time.now\n \n respond_to do |format|\n if @micropost.save\n format.html { redirect_to @micropost, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @micropost2 = Micropost2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost2 }\n end\n end",
"def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end",
"def micropost_params\n #params.require(:micropost).permit(:content)\n params.require(:micropost).permit(:content, :picture)\n end",
"def update\n if params.has_key? :like\n @client.put(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unlike\n @client.delete(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :repost\n @client.put(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unpost\n @client.delete(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n head :bad_request\n end",
"def destroy\n @mymicropost.destroy\n respond_to do |format|\n format.html { redirect_to mymicroposts_url }\n format.json { head :no_content }\n end\n end",
"def new\n \t@micropost = Micropost.new \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micropost }\n end\n end",
"def update\n respond_to do |format|\n if @mood.update_attributes(mood_params)\n format.html { redirect_to moods_path, notice: 'Mood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @post\n\n if @post.save\n render json: @post\n else\n render json: @post.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def destroy\n\t@micropost.destroy\n \n\trespond_to do |format|\n\t\tformat.html { redirect_to root_url }\n\t\tformat.mobile { render json: {status: \"success\"} }\n\tend\n end",
"def update\n put :update\n end",
"def micropost_params\n\t\tparams.require(:micropost).permit(:content, :picture, :eventDate, :location)\n\tend",
"def update\n @mugshot = Mugshot.find(params[:id])\n\n respond_to do |format|\n if @mugshot.update_attributes(params[:mugshot])\n format.html { redirect_to @mugshot, notice: 'Mugshot was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mugshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @micgropost = Micgropost.find(params[:id])\n\n respond_to do |format|\n if @micgropost.update_attributes(params[:micgropost])\n format.html { redirect_to(@micgropost, :notice => 'Micgropost was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @micgropost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @micrropost = Micrropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micrropost }\n end\n end",
"def update\n respond_to do |format|\n if @answer.post.update(embedded_post_params)\n format.js { head :no_content }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @micsropost = Micsropost.find(params[:id])\n @micsropost.destroy\n\n respond_to do |format|\n format.html { redirect_to micsroposts_url }\n format.json { head :no_content }\n end\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update\n @music_like = MusicLike.find(params[:id])\n\n respond_to do |format|\n if @music_like.update_attributes(params[:music_like])\n format.html { redirect_to @music_like, :notice => 'Music like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @music_like.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end"
] | [
"0.71863025",
"0.71819925",
"0.71427673",
"0.711474",
"0.7065061",
"0.70081484",
"0.68871725",
"0.68864113",
"0.6832735",
"0.67563313",
"0.67409426",
"0.66877484",
"0.6571116",
"0.6467749",
"0.6337864",
"0.6337864",
"0.6337864",
"0.6337864",
"0.6337864",
"0.633658",
"0.63175917",
"0.6274947",
"0.6274417",
"0.6274417",
"0.6266952",
"0.6170444",
"0.614475",
"0.6140817",
"0.6103726",
"0.60810524",
"0.60534567",
"0.60300344",
"0.5977784",
"0.5974931",
"0.5957161",
"0.5896909",
"0.5886048",
"0.5872272",
"0.58627784",
"0.58617765",
"0.5834319",
"0.5826549",
"0.5825911",
"0.57991433",
"0.57776004",
"0.5755522",
"0.5753582",
"0.5748633",
"0.5737865",
"0.5727368",
"0.5723221",
"0.57229793",
"0.5710423",
"0.569403",
"0.5685869",
"0.568573",
"0.56835455",
"0.56800616",
"0.5679327",
"0.56787413",
"0.56679255",
"0.56597644",
"0.56525564",
"0.56525564",
"0.56395227",
"0.56366044",
"0.56329614",
"0.5626632",
"0.56239015",
"0.5621971",
"0.5619338",
"0.56165487",
"0.56053543",
"0.559809",
"0.5595798",
"0.5586233",
"0.558554",
"0.5584007",
"0.55834883",
"0.5568021",
"0.55679935",
"0.555891",
"0.5555426",
"0.55553305",
"0.5552156",
"0.5547678",
"0.5547634",
"0.5540035",
"0.5530106",
"0.5525271",
"0.55220455",
"0.55192256",
"0.5516387",
"0.5515336",
"0.5513098",
"0.55106115",
"0.55082893",
"0.55077577",
"0.54933274",
"0.5487468"
] | 0.7089813 | 4 |
DELETE /microposts/1 DELETE /microposts/1.json | def destroy
@micropost = Micropost.friendly.find(params[:id])
@micropost.destroy
flash[:success] = "Micropost deleted"
redirect_to request.referrer || root_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @micropost = Micropost.find(params[:id])\n @micropost.destroy\n\n respond_to do |format|\n format.html { redirect_to microposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micrropost = Micrropost.find(params[:id])\n @micrropost.destroy\n\n respond_to do |format|\n format.html { redirect_to micrroposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mymicropost.destroy\n respond_to do |format|\n format.html { redirect_to mymicroposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micsropost = Micsropost.find(params[:id])\n @micsropost.destroy\n\n respond_to do |format|\n format.html { redirect_to micsroposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t@micropost.destroy\n \n\trespond_to do |format|\n\t\tformat.html { redirect_to root_url }\n\t\tformat.mobile { render json: {status: \"success\"} }\n\tend\n end",
"def destroy\n @micropost.destroy\n respond_to do |format|\n format.html { redirect_to microposts_url, notice: 'Micropost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micropost.destroy\n respond_to do |format|\n format.html { redirect_to microposts_url, notice: 'Micropost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @micropost == set_micropost\n Comment.where(micropost_id: @micropost.id).destroy_all\n @micropost.destroy\n end\n respond_to do |format|\n format.html do\n redirect_to microposts_url, notice: t('destroyed', name: 'Micropost')\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @micropost2 = Micropost2.find(params[:id])\n @micropost2.destroy\n\n respond_to do |format|\n format.html { redirect_to micropost2s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_micropost.destroy\n respond_to do |format|\n format.html { redirect_to admin_microposts_url, notice: 'Micropost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micropost.destroy\n redirect_to root_url\n end",
"def destroy\n @micropost.destroy\n redirect_back_or root_path\n end",
"def destroy\n @micropost = Micropost.find(params[:id])\n @micropost.destroy\n flash[:success] = \"Micropost deleted\"\n redirect_to request.referrer || root_url\n end",
"def destroy\n @macropost = Macropost.find(params[:id])\n @macropost.destroy\n\n respond_to do |format|\n format.html { redirect_to macroposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micrrapost = Micrrapost.find(params[:id])\n @micrrapost.destroy\n\n respond_to do |format|\n format.html { redirect_to micrraposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@micropost.destroy\n redirect_back_or root_path\n end",
"def destroy\n @macropost.destroy\n respond_to do |format|\n format.html { redirect_to macroposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @microopost = Microopost.find(params[:id])\n @microopost.destroy\n\n respond_to do |format|\n format.html { redirect_to microoposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micropost_toy.destroy\n respond_to do |format|\n format.html { redirect_to micropost_toys_url, notice: 'Micropost toy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@micropost.destroy\n\t\tflash[:success] = \"Micropost deleted\"\n\t\tredirect_to request.referrer || root_url\n\tend",
"def destroy\n @title = 'Microposts'\n @micropost = Micropost.find_by_id(params[:id])\n @micropost.destroy\n @user = User.find(current_user.id)\n feed = @user.feed\n @microposts = feed.page(params[:current_page]).per(5)\n respond_to do |format|\n format.html { redirect_to '/wall' }\n format.js\n end\n end",
"def destroy\n @miscropost.destroy\n respond_to do |format|\n format.html { redirect_to miscroposts_url, notice: 'Miscropost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Micropost.find_by(id: params[:id]).destroy\n flash[:succes] = \"Micropost was succesfully deleted\"\n if request.referer.nil? || request.referer == microposts_url\n redirect_to root_url\n else\n redirect_to request.referer\n end\n end",
"def destroy\n @micorpost = Micorpost.find(params[:id])\n @micorpost.destroy\n\n respond_to do |format|\n format.html { redirect_to micorposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #if params.has_key?(:class)\n # @user = User.find(params[:id])\n # @user.destroy\n # respond_to do |format|\n # format.html { redirect_to admin_path }\n # format.json { head :no_content }\n # end\n #else\n @micropost = Micropost.find(params[:id])\n @micropost.destroy\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n #end\n end",
"def destroy\n @miccropost = Miccropost.find(params[:id])\n @miccropost.destroy\n\n respond_to do |format|\n format.html { redirect_to miccroposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @micropost.destroy\n flash[:success] = \"Post Removed\"\n else\n flash[:failure] = \"Unable to remove post. Please try again!\"\n end\n redirect_to user_path(@micropost.user_id)\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n respond_to do |format|\n @micropost = Micropost.find_by_id(@comment.micropost_id)\n format.html { redirect_to @micropost, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = @comment.micropost_id\n likes = Like.find_by_sql(['SELECT \"likes\".* FROM \"likes\" WHERE \"likes\".\"comment_id\" = ?', @comment.id])\n likes.each do |like|\n like_id = ActiveRecord::Base.sanitize(like.id)\n execute_statement(\"DELETE FROM likes WHERE id = #{like_id}\")\n end\n comment_id = ActiveRecord::Base.sanitize(@comment.id)\n execute_statement(\"DELETE FROM comments WHERE id = #{comment_id}\")\n redirect_to micropost_path(id)\n end",
"def destroy\n @minipost.destroy\n respond_to do |format|\n format.html { redirect_to miniposts_url, notice: 'Minipost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n\n head :no_content\n end",
"def destroy\n @audiopost.destroy\n respond_to do |format|\n format.html { redirect_to audioposts_url, notice: 'Audiopost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micropot.destroy\n respond_to do |format|\n format.html { redirect_to micropots_url, notice: 'Micropot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socialmediasite.destroy\n respond_to do |format|\n format.html { redirect_to socialmediasites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micgropost = Micgropost.find(params[:id])\n @micgropost.destroy\n\n respond_to do |format|\n format.html { redirect_to(micgroposts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @screencast = Screencast.find(params[:id])\n @screencast.destroy\n\n respond_to do |format|\n format.html { redirect_to screencasts_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def destroy\n #1st you retrieve the post thanks to params[:post_id]\n micropost = micropost.find(params[:micropost_id])\n #2nd you retrieve the comment thanks to params[:id]\n @comment = micropost.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n #1st argument reference the path /posts/:post_id/comments/\n format.html { redirect_to(micropost_comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post = Post.friendly.find(params[:id])\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Story deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metum.destroy\n respond_to do |format|\n format.html { redirect_to meta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micropst.destroy\n respond_to do |format|\n format.html { redirect_to micropsts_url, notice: \"Micropst was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n end",
"def destroy\n @metum = Metum.find(params[:id])\n @metum.destroy\n\n respond_to do |format|\n format.html { redirect_to meta_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @medio = Medio.find(params[:id])\n @medio.destroy\n\n respond_to do |format|\n format.html { redirect_to medios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n json_response(@post)\n end",
"def destroy\n @mypost = Mypost.find(params[:id])\n @mypost.destroy\n\t\n\n respond_to do |format|\n format.html { redirect_to myfeed_path }\n format.json { head :no_content }\n end\n\t\t end",
"def destroy\n @mood.destroy\n\n respond_to do |format|\n format.html { redirect_to moods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @mood.destroy\n respond_to do |format|\n format.html { redirect_to moods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_mood.destroy\n respond_to do |format|\n format.html { redirect_to dish_moods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mural_post.destroy\n respond_to do |format|\n format.html { redirect_to mural_posts_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @mwod_post = MwodPost.find(params[:id])\n @mwod_post.destroy\n\n respond_to do |format|\n format.html { redirect_to mwod_posts_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @group = current_user.microgroups.find(params[:microgroup_id]).group unless params[:microgroup_id].nil?\n # @micropost = Micropost.find(params[:id])\n @micropost = current_user.microposts.find(params[:id])\n @micropost.destroy unless @micropost.nil?\n\n respond_to do |format|\n if @group\n format.html { redirect_to @group.microgroup }\n format.js { @microposts = @group.microposts.paginate(page: params[:page], per_page: 10) }\n format.json { head :no_content }\n else\n format.html { redirect_to microposts_url }\n format.js { @microposts = current_user.feed.paginate(page: params[:page], per_page: 20) }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @screencast = Screencast.find_by_permalink(params[:id])\n @screencast.destroy\n\n respond_to do |format|\n format.html { redirect_to(screencasts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @loveinstagram.destroy\n respond_to do |format|\n format.html { redirect_to loveinstagrams_url, notice: 'Loveinstagram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_cleanup\n\tadd_to_deleted(@micropost)\n end",
"def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n render json: {}, status: :ok\n end",
"def destroy\n @mediaset = Mediaset.find(params[:id])\n @mediaset.destroy\n\n respond_to do |format|\n format.html { redirect_to mediasets_url }\n format.json { head :no_content }\n end\n end",
"def destroy_prepare\n\t@micropost = Micropost.find_by_id(params[:id])\n\t\n\tcheck_valid_micropost(@micropost)\n end",
"def destroy\n @test_metum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @interesting_tweet.destroy\n respond_to do |format|\n format.html { redirect_to interesting_tweets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mobile = Story.find(params[:id])\n @mobile.destroy\n\n redirect_to mobiles_path\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @myblog = Myblog.find(params[:id])\n @myblog.destroy\n\n respond_to do |format|\n format.html { redirect_to myblogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @myblog = Myblog.find(params[:id])\n @myblog.destroy\n\n respond_to do |format|\n format.html { redirect_to myblogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moviepost.destroy\n respond_to do |format|\n format.html { redirect_to movieposts_url, notice: 'Moviepost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @media_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to media_interests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micropst = Micropst.find(params[:id])\n @micropst.destroy\n\n respond_to do |format|\n format.html { redirect_to(micropsts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @twitter_id = TwitterId.find(params[:id])\n @twitter_id.destroy\n\n respond_to do |format|\n format.html { redirect_to twitter_ids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @microsite.destroy\n respond_to do |format|\n format.html { redirect_to microsites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n redirect_to posts_path and return unless Mist.authorized?(:destroy_post, self)\n @post = Mist::Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n user = user_from_token\n user.tweets.destroy(params[:id])\n head :no_content\n end",
"def destroy\n @music_like = MusicLike.find(params[:id])\n @music_like.destroy\n\n respond_to do |format|\n format.html { redirect_to music_likes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @newspost = Newspost.find(params[:id])\n @newspost.destroy\n\n respond_to do |format|\n format.html { redirect_to newsposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end",
"def destroy\n @shared_url = SharedUrl.find(params[:id])\n @shared_url.destroy\n\n respond_to do |format|\n format.html { redirect_to shared_urls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n @post = @reply.post\n\n respond_to do |format|\n format.html { redirect_to @post }\n format.json { head :ok }\n end\n end",
"def destroy\n @mircopost.destroy\n respond_to do |format|\n format.html { redirect_to mircoposts_url, notice: 'Mircopost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @post.destroy\n render json: {\n post: @post\n }, status: :ok\n else\n render status: :bad_request\n end\n end",
"def destroy\n @questionset = Questionset.find(params[:id])\n @questionset.destroy\n\n respond_to do |format|\n format.html { redirect_to questionsets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socialmedium = Socialmedium.find(params[:id])\n @socialmedium.destroy\n\n respond_to do |format|\n format.html { redirect_to socialmedia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json do\n render :json => { :notice => \"Snippet deleted\" }\n end\n end\n end",
"def destroy\n @interview = Interview.find_by_slug(params[:id])\n @interview.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shorturl.destroy\n respond_to do |format|\n format.html { redirect_to shorturls_url, notice: 'Shorturl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metodo = Metodo.find(params[:id])\n @metodo.destroy\n\n respond_to do |format|\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @music = Music.find_by_sql(\"SELECT * FROM Musics M Where M.id = \" + params[:id]).first()\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/musics\" }\n format.json { head :no_content }\n end\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @post_like = PostLike.find(params[:id])\n @post_like.destroy\n\n respond_to do |format|\n format.html { redirect_to post_likes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @yourstory = Yourstory.find(params[:id])\n @yourstory.destroy\n\n respond_to do |format|\n format.html { redirect_to yourstories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mention.destroy\n respond_to do |format|\n format.html { redirect_to mentions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micropost.destroy\n flash[:success] = \"Micropost deleted\"\n redirect_to request.referrer || root_url\n #same as redirect_back(fallback_location: root_url)\n #request.referrer is the previous page\n end",
"def destroy\n @tweet.destroy\n\n respond_to do |format|\n format.html { redirect_to tweets_url }\n format.json { head :no_content }\n end\n end",
"def delete(url)\n raise Error, \"Missing URL\" unless url\n get('posts/delete?uri=' << u(url))\n nil\n end",
"def destroy\n @microtask = Microtask.find(params[:id])\n @microtask.destroy\n\n respond_to do |format|\n format.html { redirect_to microtasks_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.8095181",
"0.8050301",
"0.7961507",
"0.7866971",
"0.7772134",
"0.7753939",
"0.7753939",
"0.77040315",
"0.7667724",
"0.7625753",
"0.7614404",
"0.7515454",
"0.75125194",
"0.7483781",
"0.7454637",
"0.74388146",
"0.7401005",
"0.73189944",
"0.73029476",
"0.7197533",
"0.7157698",
"0.713167",
"0.71005094",
"0.70887184",
"0.70646185",
"0.69605726",
"0.69344205",
"0.6846743",
"0.67844915",
"0.6778731",
"0.67312324",
"0.67231834",
"0.66954243",
"0.66596454",
"0.66450083",
"0.66401595",
"0.6626023",
"0.6615384",
"0.65885645",
"0.654994",
"0.6543218",
"0.65423876",
"0.6538964",
"0.65186083",
"0.6517479",
"0.65169114",
"0.6516611",
"0.65085447",
"0.650745",
"0.6502911",
"0.64943004",
"0.64928657",
"0.64896154",
"0.648465",
"0.6474829",
"0.6473034",
"0.6469403",
"0.64592105",
"0.6457749",
"0.64555216",
"0.64449435",
"0.6436654",
"0.64365166",
"0.6421707",
"0.6412889",
"0.64108026",
"0.6406891",
"0.6402853",
"0.63953274",
"0.63953274",
"0.6390547",
"0.63833535",
"0.6375486",
"0.63704103",
"0.63700044",
"0.63603455",
"0.6359555",
"0.6358279",
"0.63393146",
"0.63382363",
"0.6334926",
"0.632052",
"0.6319302",
"0.6310979",
"0.62945044",
"0.6293218",
"0.6292866",
"0.6283326",
"0.62801075",
"0.6272817",
"0.62665206",
"0.62605035",
"0.625834",
"0.625796",
"0.625215",
"0.6246487",
"0.6245964",
"0.6245594",
"0.6244909",
"0.6236013"
] | 0.7403803 | 16 |
Confirms an admin user. | def admin_user
unless current_user && current_user.admin?
redirect_to login_url, notice: "admin can only do this action."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_admin\n \tunless session[:admin]\n \t\tflash[:notice] = \"You are not an admin.\"\n \t\tredirect_to(user_path( :id => session[:user_id]))\n \tend\n end",
"def admin_user\n\t\t\tflash_text = \"Administrative privilege required to perform this action.\"\n\t\t\tflash[:danger] = flash_text unless current_user.admin?\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_user\n if user_signed_in? && current_user.adminrole?\n flash.now[:success] = \"Admin Access Granted\"\n else\n redirect_to root_path\n end\n end",
"def admin_user\n if(!current_user.admin?)\n flash[:danger] = \"Access Denied. Admin required\"\n redirect_to root_url\n end\n end",
"def admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to(root_url) and flash[:danger] = \"Only admins can do that!\" unless current_user.admin?\n\n end",
"def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end",
"def admin\n unless current_user.admin?\n flash[:danger] = \"Sorry, you must be an admin to do that.\"\n redirect_to user_path(current_user)\n end\n end",
"def confirm_admin\n @confirm_admin = true if session[:role_name] == 'Administrator'\n end",
"def confirm_admin\n redirect_to root_path unless current_user.admin?\n end",
"def admin_user\n unless current_user.admin?\n flash[:danger] = \"You do not have the permission to do that.\"\n redirect_to home_path\n end\n end",
"def admin_user\n\t unless current_user.admin?\n flash[:danger] = \"Log in as Admin.\"\n redirect_to(root_url)\n\t end \n\t end",
"def admin_user\n unless current_user && current_user.admin?\n store_location\n flash[:danger] = \"Please log in as admin.\"\n redirect_to users_url\n end\n end",
"def be_admin\n if current_user.switch_to(\"admin\")\n flash[:notice] = \"You have now an 'admin' role\"\n else\n flash[:error] = \"You are not authorized to have a 'admin' role\"\n end\n redirect_to( request.env[\"HTTP_REFERER\"])\n end",
"def admin_user\n\t\tunless admin? \n\t\t\tflash[:danger] = \"Only administrators have access to this page\"\n\t\t\tredirect_back_or(root_url) \n\t\tend\n\tend",
"def admin_user!\n unless signed_in? and current_user.admin?\n\t flash[:notice]=\"Por favor inicie sesión como administrador\".encode('UTF-8')\n\t redirect_back(fallback_location: root_path) \n end\n end",
"def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end",
"def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to(root_path) unless current_user.try(:admin?) || current_user?(@user)\n end",
"def verify_admin\n if !current_user.present? || current_user.email != I18n.t('general.admin_email')\n redirect_to concerts_path\n flash[:notice] = I18n.t('general.log_as_admin')\n end\n end",
"def admin_user\n redirect_to(root_path) unless (current_user != nil && current_user.admin == true)\n end",
"def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end",
"def admin_user\n redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless !current_user?(@user) && current_user.admin?\n end",
"def admin_user\n \n unless current_user.admin?\n \tflash[:danger] = \"Please log in with the correct user name.\"\n \tredirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to(root_path) unless is_admin?\n end",
"def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend",
"def admin\n unless current_user.admin?\n redirect_to root_url\n flash[:danger] = \"You have no access here\"\n end\n end",
"def admin_user\n if logged_in?\n redirect_to(root_url) unless current_user.admin?\n else\n flash[:danger] = \"You reached an invalid url and have been redirected to the home page.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n @user = current_user\n redirect_to @user unless @user.admin?\n end",
"def admin_user\n if (!current_user || current_user.username != 'admin')\n redirect_to(root_url)\n end\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end",
"def correct_user\n @userAdmin = UserAdmin.find(params[:id])\n unless current_user?(@userAdmin)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin\n\t\tauthenticate_user!\n\t if current_user.admin\n\t\t return\n\t else\n\t\t redirect_to root_url\n\t end\n\tend",
"def check_admin_user\n unless current_user && current_user.privilege_admin?\n flash[:danger] = \"You do not have permission to perform this operation\"\n redirect_to root_path\n end\n end",
"def verify_admin_of_user\n redirect_to admins_path,\n flash: { alert: I18n.t(\"administrator.flash.unauthorized\") } unless current_user.admin_of?(@user, \"can_manage_users\")\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n unless admin_user?\n redirect_to login_url\n end\n end",
"def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end",
"def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end",
"def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(current_user) unless current_user.admin?\n end",
"def admin!\n redirect_to root_path, alert: \"Not authorized\" and return unless is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin? # se current_user.admin for falso redireciona para pagina principal\n end",
"def authenticate_admin\n\t\tauthenticate_user!\n\t\tunless current_user.approved == 1\n\t\t\tsign_out\n\t\t\tflash[:error] = \"User is not admin! Try again using another username!\"\n\t\t\tredirect_to new_user_session_path\n\t\t\t# redirect_to new_user_session_path\n\t\tend\n\tend",
"def correct_admin\n @admin_admin = Admin::Admin.find(params[:id])\n redirect_to(admin_admins_path) unless current_user?(@admin_admin)\n end",
"def admin_user\n unless logged_in? && current_user.admin?\n redirect_to root_url\n end\n end",
"def req_admin\n unless curr_user.admin\n flash[:danger] = \"You must be admin to go there!\"\n redirect_to root_url\n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end"
] | [
"0.79044944",
"0.767215",
"0.76483077",
"0.76210374",
"0.7605678",
"0.7605678",
"0.75945777",
"0.7588445",
"0.7588445",
"0.7503662",
"0.74675834",
"0.7451482",
"0.7424005",
"0.7411313",
"0.74107665",
"0.7402138",
"0.73993605",
"0.7358812",
"0.7329228",
"0.73179626",
"0.7312765",
"0.72796166",
"0.7269636",
"0.7246544",
"0.72386354",
"0.7231975",
"0.72179013",
"0.71720684",
"0.7166012",
"0.71593285",
"0.71537924",
"0.7137113",
"0.7124807",
"0.71221524",
"0.71221524",
"0.7120586",
"0.7120586",
"0.7120474",
"0.7118341",
"0.7118341",
"0.7118329",
"0.7113378",
"0.710956",
"0.710956",
"0.71021533",
"0.71021533",
"0.7098989",
"0.709487",
"0.7092022",
"0.70904475",
"0.70904475",
"0.70904475",
"0.70904475",
"0.7076285",
"0.7067073",
"0.7067073",
"0.7066295",
"0.70532054",
"0.7049086",
"0.7041013",
"0.703546",
"0.70188206",
"0.701779",
"0.70146185",
"0.70101637",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686",
"0.70089686"
] | 0.7173976 | 27 |
Use callbacks to share common setup or constraints between actions. | def set_landing
@landing = Landing.friendly.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def landing_params
params.require(:landing).permit(:slug, :name, :item_id, :code, :css_file, :js_file, :is_published)
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
this is making a call to get the location of the user | def geolocation
response = HTTParty.post("https://www.googleapis.com/geolocation/v1/geolocate?key=#{ENV['GEO_API_KEY']}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_location\n\n end",
"def user_location_info\n if current_user.present? && current_user.current_sign_in_ip != \"127.0.0.1\"\n @user_info = Geocoder.search(current_user.current_sign_in_ip).first\n elsif request.remote_ip != \"127.0.0.1\"\n @user_info = Geocoder.search(request.remote_ip).first \n # else #static ip for unit testing \n # @user_info= Geocoder.search(\"213.180.204.26\").first\n end \n return @user_info\n end",
"def get_location(user_location)\n\tclient=Weatherman::Client.new\n\tclient.lookup_by_location(user_location)\nend",
"def getlocation\r\n @myip = remote_ip()\r\n # based off freegeoip.net is really terrible\r\n result = Geocoder.search(@myip)\r\n @mylat = result.latitude\r\n @mylong = result.longitude\r\n @mycity = result.address\r\n #51.243048, -0.588458\r\n end",
"def location\n fetch('hey_arnold.locations')\n end",
"def user_location\n return JSON.parse open(\"http://freegeoip.net/json\").read\nend",
"def getLocation\n loc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => \"160+Folsom,+San+Francisco,+CA\",\n :sensor => \"false\"}).to_s\n\n location_request = RestClient.get(loc)\n parsed_location_request = JSON.parse(location_request)\n\n lat = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n lng = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\n [lat,lng]\nend",
"def location\n response[\"location\"]\n end",
"def location\n\t\tfireeagle_user.best_guess.name\n\tend",
"def location\n fetch('harry_potter.locations')\n end",
"def location\n @client.get(\"#{path}/location\")\n end",
"def location\n \n # Try to the device with its id or uid\n @device = get_device params[:device_id]\n \n if @device\n # Render Location to json, if user is allowed\n if @device.get_read_access(current_user)\n @location = @device.location\n \n else\n render json: {:message => \"Not authorized to read device location\", :code => 401} , :status => :unauthorized \n end\n \n end\n \n end",
"def get_location\n @lat, @lng = request.location.try(:latitude), request.location.try(:longitude) \n end",
"def location\n fetch('rick_and_morty.locations')\n end",
"def my_location\n freegeoip.get '/json/'\nend",
"def get_location\n as_json(get_results('/locations.json'))\n end",
"def location\n return Location.find_by_LOCATION_PROFILE_ID(self.LOCATION_PROFILE_ID)\n end",
"def getLocation\r\n\t\t\t\t\treturn @location\r\n\t\t\t\tend",
"def location\n fetch('simpsons.locations')\n end",
"def get_location(ip)\n\t\t\tresponse_data = LocationApi.new.call(ip)\n\t\t\tLocationJsonParser.new.parse(response_data)\n\t\tend",
"def get_location\n @street = request.location.street\n @city = request.location.city\n @state = request.location.state\n @country = request.location.country\n end",
"def location\n ensure_full_data!\n @gapi[\"location\"]\n end",
"def location\n @gapi[\"location\"]\n end",
"def user_location(user)\n geo = user.geolocation\n geo.latitude = 32.7157\n geo.longitude = -117.1611\n geo.fetch_address\n geo.save\n end",
"def geo_location\n begin\n # Get Comma seperated coordinates and return as hash\n coordinates = @result[\"ipLocation\"][\"pointProperty\"][\"Point\"][\"coordinates\"].split(',')\n return { long: coordinates[0], lat: coordinates[1] }\n rescue \n raise \"geo location unknown\"\n end\n end",
"def show\n @user = User.find(params[:id]) if params[:id].present? && params[:id] != \"show\"\n unless @user\n @user = current_user\n end\n\n client = YahooWeather::Client.new\n @location = 'New York'\n if @user.locations.any?\n @location = @user.locations.first.address\n end\n\n\n end",
"def location\n result_hash['loc']\n end",
"def get_location\n location_request = Geocoder.search(gets)\n if location_request.count != 1\n \"Whoops, we couldn't pinpoint your exact location with that address. Please try again.\"\n get_location\n else\n location_lat = location_request[0].data[\"geometry\"][\"location\"][\"lat\"]\n location_lon = location_request[0].data[\"geometry\"][\"location\"][\"lng\"]\n {lat: location_lat, lon: location_lon}\n end\nend",
"def location\n fetch('doraemon.locations')\n end",
"def location\n fetch('sword_art_online.location')\n end",
"def coordinates(user_address)\n geocoding_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => user_address,\n :sensor => false}\n ).to_s\n\n response = JSON.parse(RestClient.get(geocoding_url))\n location = response[\"results\"][0][\"geometry\"][\"location\"]\n location_string = \"#{location[\"lat\"]},#{location[\"lng\"]}\"\nend",
"def location\n fetch('games.super_mario.locations')\n end",
"def current_location\n ip = request.remote_ip\n results = Geocoder.search(ip)\n results.first.address\n end",
"def origin\n coord, address = Map.locate_user(params[:address], locate_by_ip)\n #address may not be the same as params, if params.blank?\n return coord, address\n end",
"def get_location(photo_id)\n # begin\n rsp = @flickr.send_request('flickr.photos.geo.getLocation', {:photo_id => photo_id})\n Flickr::Photos::Location.new(:latitude => rsp.photo.location[:latitude].to_f,\n :longitude => rsp.photo.location[:longitude].to_f, :accuracy => rsp.photo.location[:accuracy].to_i)\n end",
"def location\n if [latitude, longitude].all?(&:present?)\n [latitude, longitude]\n end\n end",
"def location\n\t\t@location\n\tend",
"def retrieve_location_from_cookie_or_service\n # return GeoLoc.new(YAML.load(cookies[:geo_location])) if cookies[:geo_location]\n return GeoLoc.new(JSON.parse(cookies[:geo_location])) if cookies[:geo_location]\n location = Geocoders::MultiGeocoder.geocode(get_ip_address)\n return location.success ? location : nil\n end",
"def location\n fetch('how_to_train_your_dragon.locations')\n end",
"def get_location\n\n if (cookies[:location] != nil)\n @location = Location.from_cookie(cookies[:location])\n elsif (logged_in? == true)\n @location = current_user.location\n else\n @location = nil\n end\n\n return @location\n end",
"def location\n @location\n end",
"def location\n # TODO Check this\n # return poi.location unless poi.nil?\n # return place.location unless place.nil?\n return get_location\n end",
"def get_location(location)\n client = Weatherman::Client.new\n client.lookup_by_location(location)\nend",
"def my_location\n\t\t\"#{address}, #{city}, GA\"\n\tend",
"def location\n Location.get(@entity['location_id'], client: @client)\n end",
"def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end",
"def location\n return nil if reference?\n ensure_full_data!\n @gapi_json[:location]\n end",
"def location\n self.well_info.location\n end",
"def get_name_and_location\n @top_ten.each do |user|\n user_details = self.class.get(\"/users/#{user[0]}\").parsed_response\n user << user_details[\"name\"]\n user << user_details[\"location\"]\n end\n end",
"def location\n peer.get_location\n end",
"def location\n @location\n end",
"def location\n @location\n end",
"def user_location(profile = nil)\n return '' unless profile\n\n locality = [profile.city.presence, profile.country.presence].compact.map(&:strip).join(', ')\n locality.present? ? 'from ' + locality : ''\n end",
"def get_lat_long_of_current(address)\n\n a = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/geocode/json\",\n :query_values => { :address => address,\n :sensor => \"false\"}\n )\n response = RestClient.get(a.to_s)\n\n response_json = JSON.parse(response)\n lat = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n long = response_json[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n [lat, long]\nend",
"def location\n @location\n end",
"def location\n return @location\n end",
"def location\n b = []\n b << latitude\n b << longitude\n Geocoder.coordinates(b)\n end",
"def get_location(place)\n\t\tsleep(1.5)\n\t\tlocation = Geocoder.search(place)\n\t\t#puts location.inspect\n\t\tif !location.empty?\n\t\t\tlocation_geometry = location.first.geometry\n\t\t\tlocation_bounds = location_geometry['bounds']\n\t\t\tif !location_bounds.nil?\n\t\t\t\tlat_range = Range.new(location_geometry['location']['lat'], location_geometry['bounds']['northeast']['lat'])\n\t\t\t\tlong_range = Range.new(location_geometry['location']['lng'], location_geometry['bounds']['northeast']['lng'])\n\t\t\telse\n\t\t\t\tlat_range = Range.new(location_geometry['location']['lat'], location_geometry['viewport']['northeast']['lat'])\n\t\t\t\tlong_range = Range.new(location_geometry['location']['lng'], location_geometry['viewport']['northeast']['lng'])\n\t\t\tend\n\t\t\tif !location.nil?\n\t\t\t\t@user_location_lat = rand(lat_range).round(7)\n\t\t\t\t@user_location_long = rand(long_range).round(7)\n\t\t\telse\n\t\t\t\t@user_location_lat = \"here\"\n\t\t\t\t@user_location_long = \"here\"\n\t\t\tend\n\t\telse\n\t\t\t@user_location_lat = \"no data\"\n\t\t\t@user_location_long = \"no data\"\n\t\tend\n\tend",
"def geo_location\n if loc = self.location\n res = GeoKit::GeoLoc.new(loc.geokit_attributes)\n res.success = !!(res.lat && res.lng)\n res\n end\n end",
"def user_coordinates\n self.user_located? ? LocationCoordinate.new(self.userLocation.location.coordinate) : nil\n end",
"def getLocation( location_id)\n params = Hash.new\n params['location_id'] = location_id\n return doCurl(\"get\",\"/location\",params)\n end",
"def get_location_info(zip)\n url_string = \"https://offer-demo.adcrws.com/v1/geolocation.json?access_token=#{ENV['ACCESS_DEVELOPMENT_TOKEN']}&search=#{zip}\"\n url_response = UrlRequest.send_request(url_string)\n json_data = JsonParser.decode(url_response)\n @lat = json_data['location'][0]['geometry']['location']['lat']\n @lon = json_data['location'][0]['geometry']['location']['lng']\n @city = json_data['location'][0]['formatted_address'].split(\",\").first\n end",
"def nearby\n\n params[:distance] ||= 20\n\n # Use the current user's IP address to retrieve the user coordinates\n @user_coordinates = Geocoder.coordinates(request.remote_ip)\n\n # Presume geolocation will fail\n @geocoder_success = false\n\n # If geolocation fails, use a default of downtown Columbus\n if @user_coordinates == [0.0, 0.0]\n\n # Default coordinates when can't geolocate the current user\n @user_coordinates = [39.961122, -83.000431]\n\n else\n\n @geocoder_success = true\n\n end\n\n @locations = Location.near(@user_coordinates, params[:distance]) #.paginate(:page => params[:page], :per_page => 10)\n\n end",
"def set_user_location\n return unless (search_params[:lat] && search_params[:long]) ||\n search_params[:zip_code]\n\n user_location_object(search_params[:lat], search_params[:long],\n search_params[:zip_code])\n end",
"def location(location,types=nil)\n handle_response(get(\"/content/location.json\", :query => {:location => location,:types=>types}))\n end",
"def query_location_lat_long\n loc = MultiGeocoder.geocode(location)\n [loc.lat, loc.lng]\n end",
"def getLocationContext( location_id, latitude, longitude, radius, resolution, country, num_results)\n params = Hash.new\n params['location_id'] = location_id\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['radius'] = radius\n params['resolution'] = resolution\n params['country'] = country\n params['num_results'] = num_results\n return doCurl(\"get\",\"/location/context\",params)\n end",
"def location\n [lat.to_f / 100_000, lng.to_f / 100_000]\n end",
"def getLookupLocation( string, language, country, latitude, longitude)\n params = Hash.new\n params['string'] = string\n params['language'] = language\n params['country'] = country\n params['latitude'] = latitude\n params['longitude'] = longitude\n return doCurl(\"get\",\"/lookup/location\",params)\n end",
"def parse_location_info_and_create_user_account\n user = User.find_by_device_id(device_id)\n unless user\n user = User.create!(:device_id => device_id, \n :password => email, \n :user_name => user_name,\n :email => email, \n :status => status)\n end\n user.ensure_authentication_token!\n geo_location_response = ::Geolocation::Finder::Google.google_reverse_coding(user, latitude, longitude)\n location_status = geo_location_response.nil? ? \" Hurray!You have explored a new location.Please add the location to your credit.\" : \" Location tracked Successfully!\"\n return \"Hi #{user.user_name}, Welcome to CrowdClub.#{location_status}\", user.authentication_token\n end",
"def get_user\n\t\tif starting_location_dl.present?\n\t\t\tstarting_location_dl.user\n\t\telsif ending_location_dl.present?\n\t\t\tending_location_dl.user\n\t\telsif starting_location_meeting.present?\n\t\t\tstarting_location_meeting.user\n\t\telsif ending_location_meeting.present?\n\t\t\tending_location_meeting.user\n\t\tend\n\tend",
"def locate(latitude,longitude)\n get escape(\"lat=#{latitude}&lon=#{longitude}\")\n end",
"def get_user(uid)\n params = {\"pio_uid\" => uid}.merge(default_params)\n response = @connection.get(:users, uid, params).body\n if response[\"pio_latlng\"]\n latlng = response[\"pio_latlng\"]\n response[\"pio_latitude\"] = latlng[0]\n response[\"pio_longitude\"] = latlng[1]\n end\n response \n end",
"def get_address\n welcome_message\n puts \"What is your location?\"\n user_location = Geocoder.search(gets.chomp)[0]\n if user_location != nil\n adr = user_location\n @city = adr.city\n @lat = adr.latitude\n @lon = adr.longitude\n else\n no_match\n end\n end",
"def location\n { latLng: [lat, lng], name: name, status: name.downcase.to_s }\n end",
"def geo_params\n @geopoint = params[:geopoint]\n @user = User.find_by(login: @geopoint[:login])\n @user\n end",
"def location\n fetch('games.league_of_legends.location')\n end",
"def load_origin\n @locations = []\n if params[:id]\n @origin = GeoKit::Geocoders::MultiGeocoder.geocode(Location.unescape(params[:id]))\n else\n if logged_in?\n @origin = current_user.person.geo_location\n else\n @origin = GeoKit::Geocoders::MultiGeocoder.geocode(Utility.country_code)\n end\n end\n end",
"def get_location(response, persist = true)\n user = response.user\n query = nil\n if response.matches[0].is_a?(Array) and !response.matches[0].empty?\n query = response.matches[0][0]\n end\n\n Lita.logger.debug \"Performing geolookup for '#{user.name}' for '#{query}'\"\n\n if query.nil? or query.empty?\n Lita.logger.debug \"No query specified, pulling from redis #{REDIS_KEY}, #{user.name}\"\n serialized_geocoded = redis.hget(REDIS_KEY, user.name)\n unless serialized_geocoded == 'null' or serialized_geocoded.nil?\n geocoded = JSON.parse(serialized_geocoded)\n end\n Lita.logger.debug \"Cached location: #{geocoded.inspect}\"\n end\n\n query = (query.nil?)? 'Portland, OR' : query\n Lita.logger.debug \"q & g #{query.inspect} #{geocoded.inspect}\"\n\n unless geocoded\n uri = \"https://atlas.p3k.io/api/geocode?input=#{URI.escape query}\"\n Lita.logger.debug \"Redis hget failed, performing lookup for #{query} on #{uri}\"\n # geocoded = optimistic_geo_wrapper query, config.geocoder_key\n geocoded = JSON.parse RestClient.get(uri)\n Lita.logger.debug \"Geolocation found. '#{geocoded.inspect}' failed, performing lookup\"\n if persist\n redis.hset(REDIS_KEY, user, geocoded.to_json)\n end\n end\n\n Lita.logger.debug \"geocoded: '#{geocoded}'\"\n loc = {\n name: geocoded['best_name'],\n lat: geocoded['latitude'],\n lng: geocoded['longitude']\n }\n\n Lita.logger.debug \"loc: '#{loc}'\"\n\n loc\n end",
"def nearby\n if current_user.lat\n dist = 1.5\n minlat = current_user.lat - dist\n maxlat = current_user.lat + dist\n minlon = current_user.lon - dist\n maxlon = current_user.lon + dist\n @users = DrupalUsers.find(:all, :conditions => [\"lat != 0.0 AND lon != 0.0 AND lat > ? AND lat < ? AND lon > ? AND lon < ?\",minlat,maxlat,minlon,maxlon])\n end\n end",
"def location_info(location = locations.first)\n if location\n location.full_location\n else\n []\n end\n end",
"def locations\n get('locations')\n end",
"def user_located?\n self.shows_user_location? && self.userLocation.location ? true : false\n end",
"def locate(address)\n get :location => address\n end",
"def get_by_location\n \tlat = params[:lat]\n \tlng = params[:lng]\n \tnext_start = params[:next_start]\n \tshops = Hotpepper.search_location(lat, lng, next_start);\n \tset_to_results(shops);\n end",
"def store_current_location\n store_location_for(:user, request.url) if request.get? \n end",
"def get_lat_lng(search_term)\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=AIzaSyD1eA_mMwy_51cCkRHu06g2GeFw8rdJmgU&location=12.9923408,77.5947617&sensor=false&radius=50000&keyword=#{search_term}\"\n p URI::escape(url)\n response = JSON.parse(RestClient.get(URI::escape(url)), :symbolize_names => true )\n p response\n location_hash = response[:results][0][:geometry][:location]\n lat = location_hash[:lat]\n lng = location_hash[:lng]\n name = response[:results][0][:name]\n [name, lat, lng]\n\nend",
"def get_location(str)\n u=URI.encode(\"http://maps.google.com/maps/api/geocode/xml?sensor=false&address=#{str}\")\n loc=(Hpricot.XML(open(u)))/'//location'\n h={} \n h['lat']=(loc/:lat).inner_text\n h['lng']=(loc/:lng).inner_text\n h\n end",
"def locate_by_ip\n request.location\n end",
"def httpget_geo_callback\n if @params['body']['results'] && @params['body']['results'].length > 0\n address = @params['body']['results'][0]['formatted_address'] \n accuracy = @params['accuracy'].to_i.to_s\n WebView.execute_js('setFieldValue(\"location\",\"'+address+' \\n('+Localization::Request[:accuracy]+' = '+accuracy+' '+Localization::Request[:meter]+')\");')\n Alert.hide_popup \n elsif @params['body']['status']\n WebView.execute_js('setFieldValue(\"location\",\"'+@params['body']['status']+' accuracy = '+@params['accuracy']+'\");')\n Alert.hide_popup \n else\n WebView.execute_js('setFieldValue(\"location\",\"'+@params['body'].to_s+'\");')\n Alert.hide_popup \n end\n end",
"def event_get_location_details\n @loc = Apis::HereApi.new(\"\").get_location_details(params[:locationid])\n render json: @loc\n end",
"def location\n attributes.fetch(:location)\n end",
"def _geoloc\n {\n 'lat' => location.try(:latitude) || '0.0',\n 'lng' => location.try(:longitude) || '0.0'\n }\n end",
"def _geoloc\n {\n 'lat' => location.try(:latitude) || '0.0',\n 'lng' => location.try(:longitude) || '0.0'\n }\n end",
"def location\r\n infoxml = get_info\r\n return infoxml.at('location').inner_text\r\n end",
"def full_location; end",
"def geolocate(location)\n\t\tkey = \"f94d9fe40481b0a044edc8f729724335\"\n\t\tlocation = URI.escape(location, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n\t\t# location = CGI.escape(location)\n\t\t# location = URI.escape(location)\n\t\thost = \"ondemand.metacarta.com\"\n\t\tpath = \"/webservices/GeoTagger/JSON/basic?version=1.0.0\"\n\t\tpath = \"#{path}&doc=#{location}\"\n\t\tdata = {}\n\t\tbegin\n\t\t\treq = Net::HTTP::Get.new(path)\n\t\t\treq.basic_auth SITE_METACARTA_USERID, SITE_METACARTA_PASSWORD\n\t\t\thttp = Net::HTTP.start(host)\n\t\t\t#if response.is_a?(Net::HTTPSuccess)\n\t\t\t\tresponse = http.request(req)\n\t\t\t\tdata = JSON.parse(response.body)\n\t\t\t#end\n\t\trescue Timeout::Error\n\t\t\t# DO SOMETHING WISER\n\t\t\treturn 0,0\n\t\trescue\n\t\t\treturn 0,0\n\t\tend\n\t\tbegin\n\t\t\tlat = data[\"Locations\"][0][\"Centroid\"][\"Latitude\"]\n\t\t\tlon = data[\"Locations\"][0][\"Centroid\"][\"Longitude\"]\n\t\t\treturn lat,lon\n\t\trescue\n\t\tend\n\t\treturn 0,0\n\tend",
"def get_location(blob)\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_location] Entering\")\n\n location = {}\n\n if !blob[\"place\"].blank?\n\n loc = blob[\"place\"][\"location\"]\n\n location ={\n :lat => loc[\"latitude\"] ,\n :long => loc[\"longitude\"],\n :name => blob[\"place\"][\"name\"],\n :city => loc[\"city\"],\n :country => loc[\"country\"],\n :region => loc[\"region\"],\n :source_name => \"facebook\",\n :source_object_id => blob[\"place\"][\"id\"]\n }\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_location] Location Found\")\n else\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_location] Empty Location\")\n end\n location\n\n rescue => e\n Rails.logger.error(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_location] **** RESCUE **** => #{e.message} for #{blob.inspect}\")\n return {}\n end",
"def get_location(io, context)\n generate_location(io, context)\n end",
"def getCurrentLocation\n nil\n end"
] | [
"0.75264525",
"0.7472244",
"0.74630344",
"0.72805846",
"0.72765505",
"0.7267583",
"0.7236195",
"0.7168454",
"0.7167036",
"0.7105202",
"0.7100908",
"0.710027",
"0.7080792",
"0.7072434",
"0.70597965",
"0.70534915",
"0.6952847",
"0.6907835",
"0.69028264",
"0.687186",
"0.6865438",
"0.6850411",
"0.6843409",
"0.68181056",
"0.67759264",
"0.67752945",
"0.6767727",
"0.67519575",
"0.6728856",
"0.6725114",
"0.671794",
"0.6692122",
"0.6679814",
"0.6656803",
"0.66289216",
"0.66220415",
"0.66166085",
"0.6608262",
"0.65775424",
"0.65740424",
"0.6562902",
"0.6551253",
"0.655107",
"0.6550989",
"0.6548648",
"0.6531416",
"0.6528636",
"0.65281147",
"0.6494088",
"0.64936036",
"0.6486491",
"0.6486491",
"0.6486052",
"0.6479443",
"0.64794105",
"0.64734924",
"0.6457216",
"0.6455579",
"0.6431706",
"0.6422611",
"0.6421203",
"0.64116377",
"0.63906986",
"0.6385143",
"0.638288",
"0.63541573",
"0.63413656",
"0.63182193",
"0.63122165",
"0.6307775",
"0.6296176",
"0.6286815",
"0.6280983",
"0.6269799",
"0.6269507",
"0.6263174",
"0.62554777",
"0.62472814",
"0.6246699",
"0.62453425",
"0.62428874",
"0.62422484",
"0.62387556",
"0.623843",
"0.6234009",
"0.62238693",
"0.62174904",
"0.62079394",
"0.62045366",
"0.6202728",
"0.6200311",
"0.6199381",
"0.61968154",
"0.61968154",
"0.6177996",
"0.6156304",
"0.6153872",
"0.61496025",
"0.6148217",
"0.61472446"
] | 0.6375141 | 65 |
get the place object of the nearest open coffee shop to current location | def places(lat, lng)
response = HTTParty.post("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{lat},#{lng}&radius=500&type=cafe&key=#{ENV['PLACES_API_KEY']}")
return response['results'][1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locate(place)\n locations, = get :q => place\n return locations.first\n end",
"def find_closest\n find_target_coordinates\n location = build_query.geo_near(@target_cord).first\n\n return nil if location.nil?\n [(location.phone_numbers & customer_numbers).first, location.geo_name]\n end",
"def grab_nearest_by_location(distance, loc)\n\n end",
"def closest_planet\n finder = self.class.select(\"id, name, location, planets.location<->POINT('#{self.location}') as distance\")\n self.class.my_planets.each do |p|\n finder = finder.where(\"NOT location ~= POINT(?)\", p.location)\n end\n finder.order(\"distance ASC\").first\n end",
"def find_nearest_place_id(max_meters)\n Place.collection.find(\n {'geometry.geolocation':\n {'$near': @location.to_hash}\n }).limit(1).projection({:_id=>1}).first[:_id]\n end",
"def find_nearest_place_id max_dist\n\t#byebug\n\tphot=self.class.find(@id) #returns instance of photo\n\tphot_loc=phot.location #gets location from photo (point where photo was taken)\n\tphot_place=Place.near(phot_loc,max_dist).projection(:_id=>1).first #find closest place to point\n\tphot_place.nil? ? nil : phot_place[:_id] #return the id of the closest place to that point\nend",
"def place\n Place.find(@place) if !@place.nil?\n end",
"def near(max_meters=nil)\n\t#byebug\n\tif !max_meters.nil?\n\t\tresult=self.class.collection.find(\n\t\t\t\"geometry.geolocation\"=>{:$near=>{:$geometry=>@location.to_hash, :$maxDistance=>max_meters}}\n\t\t)\n\telse\n\t\tresult=self.class.collection.find(\n\t\t\t\"geometry.geolocation\"=>{:$near=>{:$geometry=>@location.to_hash}}\n\t\t)\n\tend\n\t#byebug\n\treturn result.nil? ? nil : self.class.to_places(result)\nend",
"def get_place\n @spot = ((GooglePlaces::Client.new(ENV['GOOGLE_CLIENT_ID'])).spots_by_query(\"Food near #{@user.location}\"))\n @place = @spot[rand(20)]\n @url = @place.photos[0].fetch_url(800)\n end",
"def location\n # TODO Check this\n # return poi.location unless poi.nil?\n # return place.location unless place.nil?\n return get_location\n end",
"def near(max_meters=nil)\n Place.to_places(self.class.near(@location, max_meters))\n end",
"def get_by_location\n \tlat = params[:lat]\n \tlng = params[:lng]\n \tnext_start = params[:next_start]\n \tshops = Hotpepper.search_location(lat, lng, next_start);\n \tset_to_results(shops);\n end",
"def near max_meters=nil\n documents = self.class.near(@location, max_meters)\n self.class.to_places(documents)\n end",
"def place\n if @place\n @place\n elsif !self[Incident.place_predicate].empty?\n @place = Place.find(self[Incident.place_predicate].first)\n else\n nil\n end\n end",
"def place\n if !@place.nil?\n \tPlace.find(@place.to_s)\n end\n end",
"def show\n @shops = Shop.near([@shop.latitude, @shop.longitude], 20, units: :km)\n end",
"def location\n @location ||= locations.hq.first\n end",
"def find_nearest_place_id(max_distance)\n near = Place.near(@location, max_distance)\n near = near.limit(1)\n near.projection({:_id=>1}).first[:_id]\n end",
"def locate!\n if foursquare_venue_id\n locate_via_foursquare!\n else\n locate_via_coords!\n end\n end",
"def near(max_meters=nil)\n result = self.class.near(@location, max_meters)\n self.class.to_places(result)\n end",
"def near(max_meters=nil)\n result = self.class.near(@location, max_meters)\n self.class.to_places(result)\n end",
"def find\n render json: format_places(closest(params[:latitude], params[:longitude]).take(3))\n end",
"def get_place( city, category, place_id )\n place = get_deep_value( @places, city, category, place_id )\n if not place\n place = get_place_from_site( city, category, place_id )\n return nil if not place\n set_deep_value( @places, place, city, category, place_id )\n end\n place\nend",
"def closest(num = 8)\n opts = {\n order: {\n _geo_distance: {\n 'location' => \"#{latitude},#{longitude}\",\n 'order' => 'asc',\n 'unit' => 'mi'\n }\n },\n limit: num,\n where: {\n id: { not: id }\n }\n }\n Location.search('*', opts).results\n end",
"def detect_closest_food\n @food_within_scope = []\n $food.each { |food|\n @food_within_scope << food if (distance_from(food.location) <= @scope and !food.exhausted)\n }\n if @food_within_scope.empty?\n xrand = rand(10) * (rand(2) == 0? -1 : 1)\n yrand = rand(10) * (rand(2) == 0? -1 : 1) \n return [@location[0] + xrand, @location[1] + yrand]\n else\n @food_within_scope.sort!{|x,y| distance_from(x.location) <=> distance_from(y.location)}\n return @food_within_scope.first.location\n end\n \n end",
"def places_near(location, distance = nil, limit = nil, snac = nil)\n query = places\n\n # this is a temporary fix while we address poorly performing geo_near queries\n if snac\n query = query.where(snac: snac)\n # currently the max number of places in a local authority is 70\n query = query.limit(70)\n query.order_by(name: 1)\n else\n query = query.limit(limit) if limit\n query = query.geo_near([location.longitude, location.latitude])\n query = query.max_distance(distance.in(:degrees)) if distance\n end\n query\n end",
"def cheapest_restaurant\n cheapest_price = menu_items.map {|item| item.price}.min\n restaurants.find do |restaurant| \n restaurant.menu_items.find {|item| item.price == cheapest_price}\n end\n end",
"def items_near_location(long, lat)\n long = long.to_f\n lat = lat.to_f\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 0.000025)\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 0.00006) if nearby_items.empty?\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 0.002) if nearby_items.empty?\n nearby_items = self.items.not_deleted.limit(64).with_long_lat_and_radius(long, lat, 10.0) if nearby_items.empty?\n return nearby_items\n end",
"def location_code\n # find the closest location\n location = area || city || province\n location.post_code\n end",
"def place \n \t!@place.nil? ? Place.find( @place.to_s) : nil\n \tend",
"def location_of_bay(bay)\n location = WAREHOUSE.select{ |item| item[:product_name] == bay }\n return location[0][:rack_bay_position]\nend",
"def find_nearest_place_id(max_dist)\n \tplace = Place.near(@location, max_dist).limit(1).projection(:_id => 1).first\n \tif place.nil?\n \t\treturn nil\n \telse\n \t\treturn place[:_id]\n \tend\n end",
"def find_place\n\t\t\tif params[:country_id] && params[:state_id] && params[:city_id] && params[:place_id] && params[:place_id].length > 0\n\t\t\t\t@place = Place.find(:first, :conditions => [\"url_part = ? OR uuid = ?\", params[:place_id], params[:place_id]])\n\t\t\tend\n\t\tend",
"def find_place\n\t\t\tif params[:country_id] && params[:state_id] && params[:city_id] && params[:place_id] && params[:place_id].length > 0\n\t\t\t\t@place = Place.find(:first, :conditions => [\"url_part = ? OR uuid = ?\", params[:place_id], params[:place_id]])\n\t\t\tend\n\t\tend",
"def neighborhood\n self.locations.first.neighborhood\n end",
"def nearby_location(dist)\n data = Location.all\n nearby_wifi = data.select { |spot| self.distance_to([spot.latitude,spot.longitude]) <= dist }\n sort_nearby_wifi = nearby_wifi.sort_by { |close| self.distance_to([close.latitude, close.longitude]) }\n end",
"def retrieve_nearest_places(options)\n response = client.get(NEAREST_PLACES_ENDPOINT, options)\n\n response.errors? && build_error_from(response.items.first) || build_places_from(response.items)\n end",
"def shortest_route_by_distance_to(place_or_object_place_was_built_from)\n routes = routes_for place_or_object_place_was_built_from\n select_ok_routes(routes).min_by(&:distance_in_meters)\n end",
"def get_place(name)\n place = @objects[@places[name]]\n place.nil? ? false : place\n end",
"def shortest_route_by_distance_to!(place_or_object_place_was_built_from)\n routes_for!(place_or_object_place_was_built_from).min_by(&:distance_in_meters)\n end",
"def place\n\t@place.nil? ? nil : Place.find(@place.to_s)\n\t\nend",
"def belongsToWhichPostcode lat, lon\n\tsmallestPostcode = Postcode\n\tsmallestDist = 9999999999999999999.0\n\t#we want to look at all post codes & find closest\n\tPosition.all.each do |pos|\n\t\tif pos.postcodes.last\n\t\t\tcurrentDist = Math.sqrt( ((pos.latitude.to_f - lat).abs)**2 + ((pos.longitude.to_f - lon).abs)**2 )\n\t\t\tif(currentDist < smallestDist)\n\t\t\t\tsmallestDist = currentDist\n\t\t\t\tsmallestPostcode = pos.postcodes\n\t\t\tend\n\t\tend\n\tend\n\t#return the last postcode that was made for that position\n\tsmallestPostcode.last\nend",
"def locate(place)\n check_api_key\n @location = Hamweather::Location.parse(place)\n end",
"def closest(object)\n\t\treturn nil if empty? # edgecase\n\t\tfirst_index(object)[1]\n\tend",
"def nearest_weather_station(lat, lon, options = {})\n stations = options.fetch(:stations) { weather_stations }\n Services::FindNearestStation.find(lat, lon, stations)\n end",
"def getStationNearest\n coordinate_lat = params[:lattitude].to_f\n coordinate_lng = params[:longtitude].to_f\n distance_input = params[:distance].to_f\n end",
"def same_place\n\t\tStrike.where(lat: lat, lon:lon)\n\tend",
"def get_close_places(lat,lon)\n\n square = get_square(lat,lon)\n sqlat = square[0]\n sqlon = square[1]\n places = []\n places.concat $places[ [sqlat-1,sqlon+1 ] ] || []\n places.concat $places[ [sqlat ,sqlon+1 ] ] || []\n places.concat $places[ [sqlat+1,sqlon+1 ] ] || []\n places.concat $places[ [sqlat-1,sqlon ] ] || []\n places.concat $places[ [sqlat ,sqlon ] ] || []\n places.concat $places[ [sqlat+1,sqlon ] ] || []\n places.concat $places[ [sqlat-1,sqlon-1 ] ] || []\n places.concat $places[ [sqlat ,sqlon-1 ] ] || []\n places.concat $places[ [sqlat+1,sqlon-1 ] ] || []\n\n return places \nend",
"def find_place\n\t @place = Place.get(params[:place_id]) unless params[:place_id].nil?\n\tend",
"def find_place(id)\n places.find {|place| place.id == id}\n end",
"def nearestLocation _args\n \"nearestLocation _args;\" \n end",
"def lookup_business_location\n BusinessLocator.new(self).lookup\n end",
"def explore\n @center = Geocoder.coordinates(params[:city])\n @trips = Trip.nearest_with_index(@center) \n end",
"def find_place\n\t @place = Place.get(params[:id]) unless params[:id].nil?\n\tend",
"def location\n fetch('how_to_train_your_dragon.locations')\n end",
"def closest_point_to(target, min_distance=3)\n angle_rad = target.calculate_rad_angle_between(self)\n radius = target.radius + min_distance\n x = target.x + radius * Math.cos(angle_rad)\n y = target.y + radius * Math.sin(angle_rad)\n\n Position.new(x, y)\n end",
"def location_of(item)\r\n return @pack if @pack.has?(item)\r\n @rooms.each { |id, r|\r\n return r if r.has?(item)\r\n }\r\n return nil\r\n end",
"def nearest_mine\n src = @pos\n shortest_dst = 63\n nearest = [0,0]\n unowned_mines = @game.mines_locs.reject { |pos, hero_id| hero_id == @hero_id }\n unowned_mines.each do |pos, hero_id|\n build_branching_paths(src, pos)\n path = find_path(pos)\n if path.length < shortest_dst\n shortest_dst = path.length\n nearest = pos\n end\n end\n nearest\n end",
"def nearest\n page, per_page = pagination(params)\n miles = search_with_in_miles(params)\n parking_lots = ParkingLot.within(miles, origin:[params[:latitude], params[:longitude]])\n .available_lots.sort_with_higher_availabiltiy\n size = parking_lots.size\n parking_lots = parking_lots.limit(per_page).offset(per_page * page)\n json_response(parking_lots, size)\n end",
"def location\n @location ||= Station.get(@attrs['LocationCode'])\n end",
"def find_closest(env)\n # Grab the x and y coordinates of the agent's position.\n x, y = @position.values\n # A hash to store DIST=>GOAL pairs.\n hash = {}\n\n # Iterate over env, populating hash with pairs containing the\n # distance to a goal as keys and the goal itself as values.\n env.each do |o|\n hash[Params::distance_to(x, y, o.x, o.y)] = o if o.kind_of? Goal\n end\n # Take the goal corresponding to the minimum key (closest distance)\n # in the hash.\n @closest_goal = hash[hash.keys.min]\n\n # Return a vector to the closest goal if one exists.\n # (The only reason one wouldn't exist is if the environment had no\n # goals.)\n return @closest_goal.x - x, @closest_goal.y - y if @closest_goal\n return @closest_goal # Will be nil if it ever gets here.\n end",
"def locate\n session[:lat] = params[:coords][:lat]\n session[:lng] = params[:coords][:lng]\n session[:distance] = 10\n session[:sorting] = \"distance\"\n @holes = Pothole.near([session[:lat], session[:lng]], session[:distance], :order => session[:sorting]);\n build_markers\nend",
"def rclosest(object)\n\t\treturn nil if empty? # edgecase\n\t\tlast_index(object)[1]\n\tend",
"def location\n # If \"addresses\" was eager loaded; then search for the \"location\" address. Otherwise\n # do a scoped find.\n if addresses.length > 0\n addresses.select {|a| a.label == \"location\"}[0]\n else\n addresses[:location]\n end\n end",
"def find_place_by_name(name)\n _places = find_all_places_by_name(name)\n\n # the result shouldn't be ambiguous\n if _places.size > 1\n raise AmbiguousNetQueryResult.new(__method__, name, _places)\n end\n\n return _places.first\n end",
"def location\n self.well_info.location\n end",
"def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end",
"def restaurant\n location.restaurant\n end",
"def calculate_next_location(food)\n\n x = food[0] - @location[0]\n y = food[1] - @location[1] \n\n distance = (x**2 + y**2) ** 0.5\n next_location = [@location[0] + x*@speed/distance, @location[1] + y*@speed/distance]\n\n return next_location\n end",
"def ice_cream_places(location, radius)\n places_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/place/nearbysearch/json\",\n :query_values => {:key => \"AIzaSyC3od3aEKzgeEb8H3_6b29HX3qHXWIB248\",\n :location => location,\n :radius => radius,\n :sensor => false,\n :keyword => \"ice cream\"}\n ).to_s\n\n response = JSON.parse(RestClient.get(places_url))[\"results\"]\n all_locations = {}\n response.each do |place|\n name = place[\"name\"]\n location = place[\"geometry\"][\"location\"]\n location_string = \"#{location[\"lat\"]},#{location[\"lng\"]}\"\n all_locations[name] = location_string\n end\n all_locations\nend",
"def show\n if params[:distancia]\n distancia = params[:distancia]\n else\n distancia = 100\n end\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@place.latitude},#{@place.longitude}&radius=#{distancia}&type=#{params[:tipo]}&key=#{Rails.application.secrets.google_places_key}\"\n uri = URI(url)\n http_call = Net::HTTP.get(uri)\n response = JSON.parse(http_call, {:symbolize_names => true})\n @locations = response[:results]\n @hash = Gmaps4rails.build_markers(@place) do |place, marker|\n marker.lat place.latitude\n marker.lng place.longitude\n marker.infowindow place[:name]\n end\n end",
"def location\n fetch('hey_arnold.locations')\n end",
"def closest(obj)\n zombie = @zombies.first\n\n min_dist = 19000 ** 2 + 6000 ** 2\n\n @zombies.each do |z|\n dist = z.distance(obj)\n if dist < min_dist\n zombie = z\n min_dist = dist\n end\n end\n\n zombie\n end",
"def nearby\n\n #select * from ( select * from Location\n # WHERE Longitude > @lngA-(@dist/(cos( radians(@latA+(@dist/68.703)))*69.172))\n # AND Longitude < @lngA+(@dist/(cos( radians(@latA+(@dist/68.703)))*69.172))\n # AND Latitude > @latA-(@dist/68.703)\n # AND Latitude < @latA+(@dist/68.703) ) AS `tmp` WHERE GEODISTANCE(@latA,@lngA ,Latitude,Longitude) < @dist\n\n #Calculate a bounding box we can use to quickly find nearby trucks\n lat = params[:lat].to_f\n lng = params[:lng].to_f\n dist = params[:radius].to_f\n latDelta = dist/68.703\n\n value = lat+(latDelta);\n rad = value/180 * Math::PI #Geocoder::Calculations.to_radians(value) #value.to_ra radians(value);\n\n lngDelta = dist/(Math.cos( rad)*69.172)\n minLng = lng-lngDelta\n maxLng = lng+lngDelta\n minLat = lat-latDelta\n maxLat = lat+latDelta\n\n\n #IFNULL( SQRT(((difX)(difX))+((difY)(difY))), 99999)\n trucks = Truck.find_by_sql \"SELECT trucks.* WHERE SQRT(((trucks.lng-#{lng})(trucks.lng-#{lng}))+((trucks.lat-#{lat})(trucks.lat-#{lat}))) < #{dist}\"\n\n render :json => trucks\n end",
"def places_around(zoom_level = MapHelper::NEIGHBORHOOD_LEVEL_ZOOM)\n Place.within(zoom_to_radius(zoom_level, lat), origin: self) - [self]\n end",
"def _places(url_part:, query: nil, location: nil, radius: nil, keyword: nil, language: nil,\n min_price: 0, max_price: 4, name: nil, open_now: false, rank_by: nil, type: nil,\n page_token: nil)\n params = {'minprice' => min_price, 'maxprice' => max_price }\n\n if query\n params['query'] = query\n end\n\n if location\n params['location'] = Convert.to_latlng(location)\n end\n\n if radius\n params['radius'] = radius\n end\n\n if keyword\n params['keyword'] = keyword\n end\n\n if language\n params['language'] = language\n end\n\n if name\n params['name'] = Convert.join_array(' ', name)\n end\n\n if open_now\n params['opennow'] = 'true'\n end\n\n if rank_by\n params['rankby'] = rank_by\n end\n\n if type\n params['type'] = type\n end\n\n if page_token\n params['pagetoken'] = page_token\n end\n\n self.client.request(url: \"/maps/api/place/#{url_part}search/#{self.client.response_format}\", params: params)\n end",
"def location\n fetch('games.super_mario.locations')\n end",
"def find_one_closest_point(reference_point, guess, geometric_resolution)\n do_find_one_closest_point(reference_point.to_a, guess, geometric_resolution)\n end",
"def suggested_sales_area\n if advert=self.advertiser\n # offer = self.offers.last\n if advert.address and zc = advert.address.zip_code_obj\n zc.sales_area\n end\n end\n end",
"def location\n fetch('books.the_kingkiller_chronicle.locations')\n end",
"def location\n fetch('sword_art_online.location')\n end",
"def get_target(map, loc)\n owned = nil\n owned_min = 1000\n GameMap::CARDINALS.each do |l|\n new_loc = map.find_location(loc, l)\n site = map.site(new_loc)\n if site.owner != $tag && site.strength < owned_min\n owned_min = site.strength\n owned = l\n end\n end\n owned\nend",
"def get_place(query)\n url = URI(\"https://rapidapi.p.rapidapi.com/apiservices/autosuggest/v1.0/US/USD/en-US/?query=#{query}\")\n\n response_hash = access_api(url)\n if response_hash == nil || response_hash[\"Places\"] == nil || response_hash[\"Places\"][0] == nil\n return nil\n end\n response_hash[\"Places\"][0][\"PlaceId\"]\nend",
"def location(id)\n @client.get(\"/BikePoint/#{id}\")\n end",
"def current_location\n @current_location ||= locations.order(\"created_at DESC\").first\n end",
"def find_nearby_place_tag\n @nearby_places = NearbyPlaceTag.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n resource_not_found\n end",
"def nearest(lat, long, limit)\n spatial_store.nearestk(lat, long, limit)\n end",
"def estimated_price\n grocery_store = grocery.grocery_store\n groceries_items = GroceriesItems.where(item: item).where.not(price_cents: 0)\n\n # Calculate the price by looking at the price at each of the closest stores with that name\n if grocery_store\n stores = GroceryStore.by_distance(origin: [grocery_store.lat.to_f, grocery_store.lng.to_f])\n .limit(CLOSEST_STORE_THRESHOLD)\n .where(name: grocery_store.name)\n\n stores.each do |store|\n store_groceries_items = groceries_items.where(grocery: store.groceries)\n return most_common_price(store_groceries_items) if store_groceries_items.length.nonzero?\n end\n end\n\n # Fallback on the overall most common price of all stores\n most_common_price(groceries_items)\n end",
"def location\n ans = location_answers.first\n ans ? ans.location : nil\n end",
"def get_location(location)\n client = Weatherman::Client.new\n client.lookup_by_location(location)\nend",
"def find_min_locator\n return nil if empty?\n use_min\n mode_call(:find_min_loc)\n end",
"def last_workout_with_km_calories\n set_sport_by_user.last.try(:distance) || 0\n end",
"def get_best_warehouse(order)\n results = Array.new(@warehouses.count).fill(0)\n\n @warehouses.each_with_index do |warehouse, index|\n warehouse_products = warehouse.products.clone\n order.products.each do |product|\n if warehouse_products[product] > 0\n results[index] += 1 #@products[product]\n warehouse_products[product] -= 1\n end\n end\n end\n\n best_warehouse = nil\n best_distance = nil\n @warehouses.each do |warehouse|\n next if results[warehouse.index] != results.max\n distance = order.get_distance(warehouse)\n if best_distance.nil? || distance < best_distance\n best_distance = distance\n best_warehouse = warehouse\n end\n end\n\n best_warehouse\n end",
"def show\n\n @location = Location.friendly.find(params[:id])\n\n # Retrieve all locations within 20 miles of this location\n @nearby_locations = Location.near([@location.latitude, @location.longitude], 20).where.not(id: @location.id)\n\n end",
"def location\n @location_cache || self.locations[0]\n end",
"def current_city\n return City.find(1)\n end",
"def place_object\n if @places_window.nil?\n hide_object\n return\n end\n place = @places_window.item\n if place.type == 0\n hide_object\n return\n end\n visible_before = @location.opacity == 255\n @location.opacity = 255\n if visible_before\n @location.smooth_move(adx(place.map_x), ady(place.map_y))\n else\n @location.x = adx(place.map_x)\n @location.y = ady(place.map_y)\n end\n @circlel.x = adx(place.map_x)\n @circlel.y = ady(place.map_y)\n end",
"def nearby(fuel_types, distance, limit)\n raw_stations = @search_service.get_url(\"/api/alt-fuel-stations/v1/nearest.json?location=#{@zip}&fuel_type=#{fuel_types[0]},#{fuel_types[1]}&limit=#{limit}&radius=#{distance}&api_key=#{ENV['NREL_API_KEY']}\")\n stations = raw_stations[:fuel_stations].map do |station|\n Station.new(station[:station_name],station[:street_address],station[:fuel_type_code],station[:distance],station[:access_days_time])\n end\n stations.sort_by(&:distance)\n end",
"def get_location(user_location)\n\tclient=Weatherman::Client.new\n\tclient.lookup_by_location(user_location)\nend",
"def favorite_place_coords\n res = []\n stories.includes(:places => [{:place_categories => :parent}, :location]).each do |s|\n s.places.each do |p|\n next unless p.name.present?\n base_cat = p.get_parent_categories.first ? p.get_parent_categories.first.name : 'other'\n res << {name: p.name, base_category: base_cat, place_url: '/places/' + p.id.to_s, lat: p.location.lat, lng: p.location.lng}\n # binding.pry\n end\n end\n res\n end"
] | [
"0.66048163",
"0.6569624",
"0.6480491",
"0.63710266",
"0.63396525",
"0.6246378",
"0.62188107",
"0.6194003",
"0.6173839",
"0.6153958",
"0.61313677",
"0.61065006",
"0.6084064",
"0.60752493",
"0.6071899",
"0.60263085",
"0.6021436",
"0.59754795",
"0.5966822",
"0.5964702",
"0.5964702",
"0.59366244",
"0.59208536",
"0.59003854",
"0.5899863",
"0.5875499",
"0.58547413",
"0.58460724",
"0.58448803",
"0.58202684",
"0.5814569",
"0.58077914",
"0.5801824",
"0.5801824",
"0.57894355",
"0.5755269",
"0.57338464",
"0.5732627",
"0.5732231",
"0.57294947",
"0.57236373",
"0.5722016",
"0.5714884",
"0.5705183",
"0.56406635",
"0.56053716",
"0.5603767",
"0.5598451",
"0.559363",
"0.5591851",
"0.5584283",
"0.55806357",
"0.55791914",
"0.55573976",
"0.5549638",
"0.55447745",
"0.5527948",
"0.55228543",
"0.5515291",
"0.5506574",
"0.5497658",
"0.5492879",
"0.5491265",
"0.548493",
"0.54762805",
"0.54715455",
"0.5460475",
"0.5445405",
"0.5432907",
"0.5408509",
"0.5406088",
"0.54039043",
"0.5400626",
"0.5399393",
"0.53989893",
"0.5397728",
"0.53881943",
"0.5379132",
"0.53772056",
"0.5369095",
"0.53626657",
"0.53589803",
"0.53534585",
"0.5342233",
"0.533292",
"0.53271824",
"0.5321382",
"0.5317877",
"0.53111076",
"0.5303502",
"0.5288691",
"0.52872324",
"0.52862084",
"0.5285881",
"0.52844185",
"0.5282402",
"0.5279972",
"0.527978",
"0.52612084",
"0.52599806"
] | 0.5638887 | 45 |
work method receives message payload in raw format in our case it is JSON encoded string which we can pass to RecentPosts service without changes | def work(raw_post)
RecentPosts.push(raw_post)
ack! # we need to let queue know that message was received
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payload; message[:payload]; end",
"def message_content\n JSON.parse(body).with_indifferent_access\n end",
"def work(raw_post)\n email_params = JSON.parse(raw_post).with_indifferent_access\n send_simple_message(params)\n ack! # we need to let queue know that message was received\n end",
"def payload\n @payload ||= JSON.parse(@message.value)\n end",
"def message(message)\n # message can be also accessed via instance method\n message == self.payload # true\n # store_message(message['text'])\n end",
"def process\n {\n \"type\": \"message\",\n \"channel\": channel,\n \"text\": message\n }.to_json\n end",
"def publish(channel, message)\n super(channel, MultiJson.encode(message))\n end",
"def generate_message(payload)\n if payload.is_a? Fixnum\n payload.to_json\n else\n if payload.nil?\n nil\n elsif payload.respond_to?(:empty?) && payload.empty?\n nil\n elsif payload.respond_to? :to_edible\n payload.to_edible\n elsif payload.is_a? String\n payload\n else\n # Not sure that this is the appropriate implementation, perhaps to_s is better\n payload.to_json\n end\n end\n end",
"def construct_activity_payload( work )\n h = {}\n\n h['update_code'] = work.orcid_put_code if work.orcid_put_code.present?\n\n metadata = 'work'\n h[metadata] = {}\n h[metadata]['title'] = work.title.join( ' ' ) if work.title.present?\n h[metadata]['abstract'] = work.abstract if work.abstract.present?\n yyyymmdd = ServiceClient.extract_yyyymmdd_from_datestring( work.published_date )\n yyyymmdd = ServiceClient.extract_yyyymmdd_from_datestring( work.date_created ) if yyyymmdd.nil?\n h[metadata]['publication_date'] = yyyymmdd if yyyymmdd.present?\n h[metadata]['url'] = work.doi_url if work.doi_url.present?\n h[metadata]['authors'] = author_cleanup( work.authors ) if work.authors.present?\n h[metadata]['resource_type'] = map_to_orcid_type( work.resource_type ) if work.resource_type.present?\n\n #puts \"==> #{h.to_json}\"\n return h.to_json\n end",
"def format_for_publish\n obj = {poster_name: poster.name, message: self.message}\n obj.to_json\n end",
"def parse_content\n parse_result = Postal::MessageParser.new(self)\n if parse_result.actioned?\n # Somethign was changed, update the raw message\n @database.update(self.raw_table, {:data => parse_result.new_body}, :where => {:id => self.raw_body_id})\n @raw = parse_result.new_body\n @raw_message = nil\n end\n update('parsed' => 1, 'tracked_links' => parse_result.tracked_links, 'tracked_images' => parse_result.tracked_images)\n end",
"def render\n payload.to_json\n end",
"def call payload={}\n return payload unless payload[:text] # noope if there is no message to work on\n\n # not efficient, but it's an example :)\n options[:pairs].each do |from, to|\n payload[:text] = payload[:text].gsub from, to\n end\n\n payload # always return the payload from your middleware\n end",
"def payload; end",
"def payload; end",
"def payload\n @payload ||= JSON.parse(fields[\"payload\"])\n end",
"def process\n data = JSON.parse(@message)\n Log.info data.ai\n end",
"def feed_message(activity, recent = false)\n owner = activity.owner\n case activity_type(activity)\n when \"StatusUpdate\"\n status = activity.item\n text = status.text\n time = status.created_at\n if recent\n %(#{owner.short_name}:\n #{sanitize(highlight(text, text))}。)\n else\n %(#{user_link_with_image(owner)}:\n #{sanitize(highlight(text, text))}。)\n end\n when \"BlogPost\"\n post = activity.item\n blog = post.blog\n view_blog = blog_link(\"#{h owner.name} 的日記\", blog)\n if recent\n if owner.class.to_s == \"User\"\n %(#{owner.short_name} 張貼了一篇日記 #{link_to post.title, blog_post_path(blog, post)}。)\n elsif owner.class.to_s == \"Group\"\n %(#{user_link(post.user)} 張貼了一篇日記 #{link_to post.title, blog_post_path(blog, post)}。)\n end\n else\n if owner.class.to_s == \"User\"\n %(#{user_link_with_image(owner)} 張貼了一篇日記\n #{post_link(blog, post)}。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p><p>\n #{post_link(\"繼續閱讀\", blog, post)}</p>)\n elsif owner.class.to_s == \"Group\"\n %(#{user_link(post.user)} 張貼了一篇日記\n #{post_link(blog, post)}。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p><p>\n #{post_link(\"繼續閱讀\", blog, post)}</p>)\n end\n end\n when \"Entry\"\n entry = activity.item\n view_entry = entries_link(\"#{h owner.name} 的所有文章\", owner)\n if recent\n %(#{owner.short_name} 分享了一篇美食評論 #{entry_link(owner, entry)}。)\n else\n %(#{user_link_with_image(owner)} 分享了一篇美食評論\n #{entry_link(owner, entry)} — #{view_entry}。<p>\n #{entry_link(\"繼續閱讀\", owner, entry)}</p>)\n end\n when \"Photo\"\n photo = activity.item\n view_gallery = gallery_link(\"#{h photo.gallery.title}\", photo.gallery)\n if recent\n if owner.class.to_s == \"User\"\n %(#{owner.short_name} 在相簿 #{view_gallery} 新增了相片\n #{photo_link(owner, photo)}。)\n elsif owner.class.to_s == \"Group\"\n %(#{user_link(photo.creator)} 在相簿 #{view_gallery} 新增了相片 \n #{photo_link(owner, photo)}。)\n end\n else\n if owner.class.to_s == \"User\"\n %(#{user_link_with_image(owner)} 在相簿 #{view_gallery} 新增了相片。<p>\n #{photo_image_link(photo)}</p><p class=\"meta\">\n #{gallery_link(photo.gallery)}</p>)\n elsif owner.class.to_s == \"Group\"\n %(#{user_link_with_image(photo.creator)} 在相簿 #{view_gallery} 新增了相片。<p>\n #{photo_image_link(photo)}</p><p class=\"meta\">\n #{gallery_link(photo.gallery)}</p>)\n end\n end\n when \"Comment\"\n entry = activity.item.entry\n user = entry.user\n if recent\n %(#{owner.short_name} 對 #{someones(entry.user, user)} 分享的美食文章\n #{entry_link(\"#{entry.title}\", user, entry)} 發表回應。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{user_link_with_image(owner)} 對\n #{someones(entry.user, user)} 分享的美食文章\n #{entry_link(\"#{entry.title}\", user, entry)} 發表回應。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n when \"WallComment\"\n parent = activity.item.commentable\n parent_type = parent.class.to_s\n case parent_type\n when \"BlogPost\"\n post = activity.item.commentable\n blog = post.blog\n if recent\n %(#{owner.short_name} 在 #{someones(blog.owner, owner)} 的日記\n #{link_to post.title, blog_post_path(blog, post)} 留言:<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{user_link_with_image(owner)} 在\n #{someones(blog.owner, owner)} 的日記\n #{link_to post.title, blog_post_path(blog, post)} 留言:<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n when \"Photo\"\n photo = activity.item.commentable\n user = photo.owner\n if recent\n %(#{owner.short_name} 對 #{someones(photo.owner, owner)} 的相片\n #{photo_link(user, photo)} 做了評論。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{user_link_with_image(owner)} 對\n #{someones(photo.owner, owner)} 的相片\n #{photo_link(user, photo)} 做了評論。<p>\n #{photo_image_link(photo)}</p><p class=\"meta\">\n #{gallery_link(photo.gallery)}</p><p class=\"meta\">\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 80))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n when \"User\"\n if recent\n %(#{owner.short_name} 在 #{wall(activity)} 的塗鴉牆留言。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{user_link_with_image(activity.item.commenter)}\n 在 #{wall(activity)} 的塗鴉牆留言。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n when \"Group\"\n if recent\n %(#{owner.short_name} 在群組 #{wall(activity)} 的留言板留言。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{user_link_with_image(activity.item.commenter)} 在群組\n #{wall(activity)} 的留言板留言。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n when \"Event\"\n event = activity.item.commentable\n commenter = activity.item.commenter\n if event.eventable.class.to_s == \"Group\"\n if recent\n %(#{owner.short_name} 在群組 \n #{group_link(event.eventable)} 的活動\n #{event_link(event.title, event)} 頁面上留言。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{user_link_with_image(commenter)} 在群組 \n #{group_link(event.eventable)} 的活動\n #{event_link(event.title, event)} 頁面上留言。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n else\n if recent\n %(#{owner.short_name} 在 \n #{someones(event.user, commenter)} 建立的活動\n #{event_link(event.title, event)} 頁面上留言。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{user_link_with_image(commenter)} 在 \n #{someones(event.user, commenter)} 建立的活動\n #{event_link(event.title, event)} 頁面上留言。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n end\n when \"NewsItem\"\n news = activity.item.commentable\n commenter = activity.item.commenter\n if news.newsable.class.to_s == \"User\"\n if recent\n %(#{owner.short_name} 回覆了 \n #{someones(news.creator, commenter)} 的網誌文章\n #{note_link(news.newsable, news)}:<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{user_link_with_image(commenter)} 回覆了 \n #{someones(news.creator, commenter)} 的網誌文章\n #{note_link(news.newsable, news)}:<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n elsif news.newsable.class.to_s == \"Group\"\n if recent\n %(#{owner.short_name} 在群組 \n #{someones(news.newsable, commenter)} 的新聞訊息\n #{news_link(news.newsable, news)} 回應。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{user_link_with_image(commenter)} 在群組 \n #{someones(news.newsable, commenter)} 的新聞訊息\n #{news_link(news.newsable, news)} 回應。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n elsif news.newsable.class.to_s == \"Widget\"\n if recent\n %(#{owner.short_name} 在 \n #{someones(news.creator, commenter)} 張貼的新聞訊息\n #{story_link(news)} 回應。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{user_link_with_image(commenter)} 在 \n #{someones(news.creator, commenter)} 張貼的新聞訊息\n #{story_link(news)} 回應。<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(activity.item.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n end\n end\n when \"Friendship\"\n user = activity.item.user\n friend = activity.item.friend\n if activity.item.friend.admin?\n if recent\n %(#{owner.short_name} 加入了 #{app_name}。)\n else\n %(#{user_link_with_image(activity.item.user)}\n 加入了 Cateplaces。)\n end\n else\n if recent\n %(#{owner.short_name} 和 #{user_link_with_image(activity.item.friend)} 成為了朋友。)\n else\n %(#{someones(user, friend)} 和\n #{someones(friend, user)} 現在已經成為朋友。)\n end\n end\n when \"ForumPost\"\n post = activity.item\n group = post.forum.forumable\n if recent\n if owner.class.to_s == \"Group\"\n %(#{user_link_with_image(post.user)} 貼文回覆了討論串 \n #{topic_link(post.topic)}:<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(post.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{owner.short_name} 貼文回覆討論串 \n #{topic_link(post.topic)}:<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(post.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n else\n if owner.class.to_s == \"Group\"\n %(#{user_link_with_image(post.user)} 貼文回覆了群組\n #{group_link(group)} 的討論串\n #{topic_link(post.topic)}:<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(post.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n else\n %(#{user_link_with_image(owner)} 貼文回覆討論串\n #{topic_link(post.topic)}:<p>\n #{image_tag(\"start_quote.gif\")} \n #{sanitize(truncate(post.body, 120))} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n end\n when \"Topic\"\n topic = activity.item\n group = topic.forum.forumable\n if recent\n if owner.class.to_s == \"Group\"\n %(#{user_link_with_image(topic.user)} 在討論區新增了話題: \n #{topic_link(activity.item)}。)\n else\n %(#{owner.short_name} 在討論區 \n #{site_forum_link(activity.item.forum)} 新增了話題: \n #{topic_link(activity.item)}。)\n end\n else\n if owner.class.to_s == \"Group\"\n %(#{user_link_with_image(topic.user)} 在群組\n #{group_link(group)} 的討論區新增了話題:\n #{topic_link(activity.item)}。)\n else\n %(#{user_link_with_image(owner)} 在討論區 \n #{site_forum_link(activity.item.forum)} 新增了話題:\n #{topic_link(activity.item)}。)\n end\n end\n when \"User\"\n if recent\n %(#{owner.short_name} 修改了個人帳號資料。)\n else\n %(#{user_link_with_image(owner)} 修改了他的帳號資料。)\n end\n when \"Gallery\"\n if recent\n %(#{owner.short_name} 新增了一本相簿\n #{gallery_link(activity.item)}。)\n else\n %(#{user_link_with_image(owner)} 新增了一本相簿\n #{gallery_link(activity.item)}。)\n end\n when \"Photo\"\n if recent\n %(#{owner.short_name} \n #{to_gallery_link(activity.item.gallery)} 新增了相片\n #{photo_link(activity.item)}。)\n else\n %(#{user_link_with_image(owner)}\n #{to_gallery_link(activity.item.gallery)} 新增了相片\n #{photo_link(activity.item)}。)\n end\n when \"Event\"\n event = activity.item\n time = event.start_time\n if event.eventable_type == \"Group\"\n if recent\n %(#{owner.short_name} 在群組\n #{group_link(event.eventable)} 建立了一項活動\n #{event_link(event.title, event)}。時間於 \n #{time.strftime('%m月%d日 %H:%M')}。)\n else\n %(#{user_link_with_image(owner)} 在群組\n #{group_link(event.eventable)} 建立了一項活動\n #{event_link(event.title, event)}。時間於 \n #{time.strftime('%y年%m月%d日 %H:%M')}。)\n end\n else\n if recent\n %(#{owner.short_name} 建立了一項活動\n #{event_link(event.title, event)}。時間於 \n #{time.strftime('%m月%d日 %H:%M')}。)\n else\n %(#{user_link_with_image(owner)} 建立了一項活動\n #{event_link(event.title, event)}。時間於 \n #{time.strftime('%y年%m月%d日 %H:%M')}。)\n end\n end\n when \"EventAttendee\"\n event = activity.item.event\n if event.eventable_type == \"Group\"\n if recent\n %(#{owner.short_name} 將出席群組\n #{group_link(event.eventable)} 召集的活動 \n #{event_link(event.title, event)}。) \n else\n %(#{user_link_with_image(owner)} 將出席群組\n #{group_link(event.eventable)} 召集的活動 \n #{event_link(event.title, event)}。) \n end\n else\n if recent\n %(#{owner.short_name} 將出席 \n #{someones(event.user, owner)} 召集的活動 \n #{event_link(event.title, event)}。) \n else\n %(#{user_link_with_image(owner)} 將出席\n #{someones(event.user, owner)} 召集的活動 \n #{event_link(event.title, event)}。) \n end\n end\n when \"Group\"\n if owner.class.to_s == \"Group\"\n if recent\n %(管理員變更了群組頁面的內容。)\n else\n %(#{group_link(activity.item)} 的管理員變更了群組頁面的內容。)\n end\n else\n if recent\n %(#{owner.short_name} 建立了一個群組 \n #{group_link(Group.find(activity.item))}。)\n else\n %(#{user_link_with_image(owner)} 建立了一個群組 \n #{group_link(Group.find(activity.item))}。)\n end\n end\n when \"Membership\"\n if owner.class.to_s == \"Group\"\n if recent\n %(#{user_link_with_image(User.find(activity.item.user))} 現在是群組的成員。)\n else\n %(#{user_link_with_image(User.find(activity.item.user))} 現在是群組 \n #{group_link(Group.find(activity.item.group))} 的成員。)\n end\n else\n if recent\n %(#{owner.short_name} 加入了 #{group_link(Group.find(activity.item.group))} 群組。)\n else\n %(#{user_link_with_image(owner)} 加入了 \n #{group_link(Group.find(activity.item.group))} 群組。)\n end\n end\n when \"NewsItem\"\n news = activity.item\n if owner.class.to_s == \"User\"\n if recent\n %(#{owner.short_name} 發表了一篇網誌文章 \n #{note_link(news.newsable, news)}。)\n else\n %(#{user_link_with_image(news.creator)} 發表了一篇網誌文章 \n #{note_link(news.newsable, news)}:<p>\n #{image_tag(\"start_quote.gif\")} \n #{summarize(news.body, 120)} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n elsif owner.class.to_s == \"Group\"\n group = news.newsable\n if recent\n %(#{user_link(news.creator)} 張貼了一篇新聞訊息 \n #{news_link(group, news)}。)\n else\n %(#{user_link_with_image(news.creator)} 在群組 #{group_link(news.newsable)} 張貼了一篇新聞訊息 \n #{news_link(group, news)}:<p>\n #{image_tag(\"start_quote.gif\")} \n #{summarize(news.body, 120)} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n elsif owner.class.to_s == \"Widget\"\n if recent\n %(#{owner.short_name} 張貼了一篇新聞文章 \n #{story_link(news)}。)\n else\n %(#{user_link_with_image(news.creator)} 張貼了一篇新聞文章 \n #{story_link(news)}。<p>\n #{image_tag(\"start_quote.gif\")} \n #{summarize(news.body, 120)} \n #{image_tag(\"end_quote.gif\")}</p>)\n end\n end\n \n else\n raise \"不合法的活動類型 '#{activity_type(activity).inspect}'\"\n end\n end",
"def to_message\n Message.new(\n stream: 'github_jobs',\n payload: self.to_h\n )\n end",
"def raw_post; end",
"def process_message(message)\n end",
"def set_payload(data)\n @payload = { \n 'caption' => data['caption']['text'], \n 'photo_url' => data['images']['standard_resolution']['url'],\n 'title' => \"#{data['user']['username']}_#{data['created_time']}\"\n }\n @log.debug(\"Payload is #{@payload}\")\n end",
"def parse_message(payload)\n @parsers.inject(payload) do |memo, parser|\n parser.call(memo)\n end\n end",
"def transform(msg, extended: false)\n case msg\n when LookupService::Data, Lookup::Crossref::Api::Message\n # OK as is.\n else\n msg = Lookup::Crossref::Message::Work.new(msg)\n end\n super(msg, extended: extended)\n end",
"def message; opt('message') || encode_workitem; end",
"def payload\n {:id => id, :body => body, :origin => origin, :original_id => original_id}\n end",
"def payload\n deserialize_json(body)\n end",
"def decode_workitem( msg )\n ldebug { \"decoding workitem from: #{msg}\" }\n\n # YAML?\n if msg.index('ruby/object:OpenWFE::InFlowWorkItem')\n YAML.load( msg )\n # XML?\n elsif msg =~ /^<.*>$/m\n OpenWFE::Xml.workitem_from_xml( msg )\n # Assume JSON encoded Hash\n else\n hash = OpenWFE::Json.decode(msg)\n OpenWFE.workitem_from_h( hash )\n end\n end",
"def post_message(token, channel, text, username)\n uri = URI.parse(URL[\"post_msg\"])\n params = { :token => token,\n :channel => channel,\n :text => text,\n :username => username,\n :as_user => true }\n uri.query = URI.encode_www_form( params )\n return JSON.parse( uri.open.read )\n end",
"def json_payload\n self.as_json\n end",
"def encode_workitem( wi )\n wi.attributes['reply_queue'] = AMQPListener.queue\n OpenWFE::Json.encode( wi.to_h )\n end",
"def parse_payload(json)\n JSON.parse(json)\n end",
"def notify! message_obj = OpenStruct.new, to = nil\n slack_hash = Hash.new\n channel = get_channel config.adapters[:slack], to\n slack_hash['channel'] = channel\n optional_parameters = [:username, :icon_url, :icon_emoji]\n optional_parameters.each do |op|\n if config.adapters[:slack][op]\n slack_hash[op] = config.adapters[:slack][op]\n end\n end\n\n slack_hash['text'] = get_message_body(binding)\n\n @logger.debug \"slack parameters: #{slack_hash.inspect}\"\n \n if config.test? then\n @logger.info \"Not sending message in test mode\"\n return true\n end\n\n begin\n @logger.debug \"Posting to slack webhook: #{@webhook_url}\"\n reply = HTTParty.post(@webhook_url, :body => JSON.dump(slack_hash))\n reply.response.value # this raises an error if the response said it was unsuccessful\n true\n rescue CollinsNotify::CollinsNotifyException => e\n @logger.error \"error sending slack notification - #{e}\"\n raise e\n rescue Exception => e\n @logger.error \"#{e.class.to_s} - error sending slack notification - #{e}\"\n raise CollinsNotify::CollinsNotifyException.new e\n end\n end",
"def update_message(data); end",
"def update_message(data); end",
"def handle_input(patch, json_message, &callback)\n message_hash = JSON.parse(json_message, :symbolize_names => true)\n message = Message.new(message_hash)\n @log.puts(\"Recieved message: #{message_hash.to_json}\") if @log\n yield(message) if block_given?\n message\n end",
"def send_message(payload) \n to_user_id = payload['to_user_id']\n body = payload['body']\n message = Message.create!(\n from_user_id: current_user.id,\n to_user_id: to_user_id,\n body: body\n )\n\n MessageBroadcastJob.perform_later(message)\n end",
"def transform(params)\n case @http_post_format\n when 'parsed', '', nil\n # Mail changes `self`.\n headers = self.class.multimap(JSON.load(params['message-headers']))\n this = self\n\n message = Message::Mailgun.new do\n headers headers\n\n # The following are redundant with `body-mime` in raw MIME format\n # and with `message-headers` in fully parsed format.\n #\n # from params['from']\n # sender params['sender']\n # to params['recipient']\n # subject params['subject']\n #\n # Mailgun POSTs all MIME headers both individually and in\n # `message-headers`.\n\n text_part do\n body params['body-plain']\n end\n\n if params.key?('body-html')\n html_part do\n content_type 'text/html; charset=UTF-8'\n body params['body-html']\n end\n end\n\n if params.key?('attachment-count')\n 1.upto(params['attachment-count'].to_i) do |n|\n attachment = params[\"attachment-#{n}\"]\n add_file(this.class.add_file_arguments(attachment))\n end\n end\n end\n\n # Extra Mailgun parameters.\n if params.key?('stripped-text') && !params['stripped-text'].empty?\n message.stripped_text = params['stripped-text']\n end\n if params.key?('stripped-signature') && !params['stripped-signature'].empty?\n message.stripped_signature = params['stripped-signature']\n end\n if params.key?('stripped-html') && !params['stripped-html'].empty?\n message.stripped_html = params['stripped-html']\n end\n if params.key?('content-id-map') && !params['content-id-map'].empty?\n message.content_id_map = params['content-id-map']\n end\n\n # @todo Store non-plain, non-HTML body parts.\n # params.keys.select do |key|\n # key[/\\Abody-(?!html|plain)/]\n # end\n\n [message]\n when 'raw'\n message = self.class.condense(Message::Mailgun.new(Mail.new(params['body-mime'])))\n [message]\n else\n raise ArgumentError, \"Can't handle Mailgun #{@http_post_format} HTTP POST format\"\n end\n end",
"def publish(work, publish_url)\n response = post(work, publish_url)\n { response: response, work: JSON.parse(response.body) }\n end",
"def respond_message message\n content_type :json\n {:text => message}.to_json\nend",
"def process_message(msg)\n write_thread_var :wi, wi = WorkItem.new(msg) # Save workitem object for later\n turn_off_thinking_sphinx\n \n log_info \"Processing incoming workitem: #{workitem.to_s}\"\n begin\n run_backup_job(wi) do |job|\n # Start backup job & pass info in BackupSourceJob\n if backup(job) \n save_success_data\n end\n end\n rescue BackupSourceExecutionFlood => e\n # Too many jobs should not be an error\n save_success_data e.to_s\n log_info \"*** BackupSourceExecutionFlood error\"\n rescue BackupWorker::Base::BackupIncomplete => e\n workitem.reprocess!\n log_info \"*** Backup job requires reprocessing\"\n rescue Exception => e\n save_error \"#{e.to_s}\\n#{e.backtrace}\"\n log_info \"*** Unexpected error #{e.message}\"\n # Always set job finish flag\n if j = thread_job\n job_finished(j)\n end\n end\n log_info \"Done processing workitem\"\n\n workitem\n end",
"def payload\n @payload\n end",
"def inbound_payload\n JSON.parse(data)['inbound']['payload']\n end",
"def on_stream_receive(item)\n parsed = JSON.parse(item)\n\n tw = Tweet.new({\n :tweet_id => parsed['id_str'],\n :text => parsed['text'],\n :twitter_id => parsed['user']['id'],\n :screen_name => parsed['user']['screen_name'],\n :profile_image_url => parsed['user']['profile_image_url'],\n :location => parsed['user']['location']\n })\n tw.save!\n\n # Delete old tweets\n oldest_tweet_saved = Tweet.order('created_at desc').limit(1).offset(50).first\n if oldest_tweet_saved\n Tweet.where(\"created_at < ?\", oldest_tweet_saved.created_at).each { |tw| tw.destroy }\n end\n\n ::PubSub.channel(\"ws_server\").publish tw.to_json\n end",
"def handle_item(msg)\n return nil unless @options['outgoing_token'].include? msg[:token] # ensure messages are for us from slack\n return nil if msg[:user_name] == 'slackbot' # do not reply to self\n return nil unless msg[:text].is_a?(String) # skip empty messages\n\n ## loop things to look for and collect immediate responses\n ## rescue everything here so the bot keeps running even with a broken script\n responses = @regexes.map do |regex, proc|\n if mdata = msg[:text].strip.match(regex)\n begin\n Slackbotsy::Message.new(self, msg).instance_exec(mdata, &proc)\n rescue => err\n err\n end\n end\n end\n\n ## format any replies for http response\n if responses\n { text: responses.compact.join(\"\\n\") }.to_json\n end\n end",
"def unpack(message)\n payload = super\n if(self.is_a?(Jackal::Cfn::Resource))\n begin\n if(payload['Message'])\n payload = MultiJson.load(payload['Message']).to_smash\n payload = transform_parameters(payload)\n payload[:origin_type] = message[:message].get('Body', 'Type')\n payload[:origin_subject] = message[:message].get('Body', 'Subject')\n payload[:request_type] = snakecase(payload[:request_type])\n payload\n else\n payload.to_smash.fetch('Attributes', 'Body', payload.to_smash.fetch('Body', payload.to_smash))\n end\n rescue MultiJson::ParseError\n # Not our expected format so return empty payload\n Smash.new\n end\n else\n payload.to_smash.fetch('Attributes', 'Body', payload.to_smash.fetch('Body', payload.to_smash))\n end\n end",
"def message\n data.message\n end",
"def call_mattermost (data = {}, url = [Config['Mattermost']['url'], 'hooks', Config['Mattermost']['webhook_code']].join('/'), header = {content_type: :json, accept: :json})\n\tif !data.has_key?(:login_id)\n\t\tpayload = data.merge(Config['DefaultPayload'])\n\telse\n\t\tpayload = data\n\tend\n\n\t# Just in case, though we may not need text\n\tunless payload.has_key?(:text) or payload.has_key?(:attachments)\n\t\tpayload['text'] = 'This was triggered on: ' + Time.now.strftime(\"%d/%m/%Y %H:%M\") #Feel free to change this\n\tend\n\n\tresponse = RestClient.post url, payload.to_json, {content_type: :json, accept: :json}\n\n\treturn response\nend",
"def payload=(payload)\n @message[:payload] = payload\n end",
"def raw_push(path='/', data=nil)\n handle self.class.post(path, data.nil? ? {} : {body: JSON.dump({data: data})})\n end",
"def hash_to_message(data)\n klass = Hastur::Message.symbol_to_class(data[:type])\n\n # if no UUID is provided, set one in the message payload\n data[:uuid] ||= @uuid\n\n payload = MultiJson.dump(data)\n klass.new :from => @uuid, :payload => payload\n end",
"def payload=(_arg0); end",
"def receive_push\n return if data['user'] == nil\n return if data['pass'] == nil\n return if data['url'] == nil\n return if data['title'] == nil\n # The line we add looks like: <msg> <commit URL>\n line_add = \"\\n* #{summary_message}: #{summary_url}\"\n # Log in to the install.\n mw = MediaWiki::Gateway.new(data['url'])\n mw.login(data['user'], data['pass'])\n # Good. Fetch page if it exists somehow.\n page_text = mw.get(data['title'])\n if page_text == nil\n mw.create(data['title'], '<!-- autocreated -->', :summary => 'Creating page -- did not exist during push')\n page_text = \"\"\n end\n # Append our line to the end of the page_text\n page_text << line_add\n # Save the page\n mw.edit(data['title'], page_text, :summary => 'Updated commits upon push')\n end",
"def to_body\n \"payload=\" + URI.encode(to_json_string)\n end",
"def create_message(data); end",
"def create_message(data); end",
"def handle_request\n payload = @req.POST[\"payload\"]\n\n return rude_comment if payload.nil?\n\n puts payload unless $DEPLOYED # remove me!\n\n payload = JSON.parse(payload)\n# render_payload_to_hipchat(payload)\n @res.write THANK_YOU_COMMENT\n end",
"def post_messages!(hash)\n Net::HTTP.post_form(URI.parse(@target), {'data'=>hash.to_json})\n end",
"def pull_json( opts = {} )\n messages = store.pull( opts )\n if messages.empty?\n \"[]\"\n else\n messages_to_json( messages )\n end\n end",
"def message\n response.to_json\n end",
"def message\n @data['message']\n end",
"def raw_message\n @raw_message\n end",
"def post(title, target, message, color)\n a_message_note = {\n 'color' => color,\n 'fields' => [\n {\n 'title' => 'Message',\n 'value' => message,\n 'short' => false\n },\n {\n 'title' => 'Archive Name',\n 'value' => target,\n 'short' => true\n },\n {\n 'title' => 'Status',\n 'value' => color,\n 'short' => false\n }\n ]\n }\n\n notify_user = ENV['SLACK_USER'] || 'notifier'\n notifier = Slack::Notifier.new ENV['SLACK_WEBHOOK'], :username => notify_user\n notifier.ping title, 'icon_emoji' => ENV['SLACK_ICON_EMOJI'], 'attachments' => [a_message_note]\nend",
"def receive\n begin\n message = save_message\n rescue => err\n render :text => err.message, :status => 400\n return\n end\n \n begin\n message.process! params\n rescue => err\n message.reply = err.message\n ensure\n if (message.reply != \"Invalid command\")\n collection_id = get_collection_id(params[:body])\n if collection_id and collection_id >0\n message[:collection_id] = collection_id\n end\n end\n message.save\n render :text => message.reply, :content_type => \"text/plain\"\n end\n end",
"def send_json label, obj\n # parse before send in case of issues\n message = obj.to_json\n @publisher.send_string label, ZMQ::SNDMORE\n @publisher.send_string message\n end",
"def handle_message(data)\n if @encoding == :etf\n handle_etf_message(data)\n else\n handle_json_message(data)\n end\n end",
"def event_body(event)\n # TODO: Create an HTTP post data codec, use that here\n if @format == \"json\"\n documents = []\n document = event.to_hash()\n documents.push(document)\n LogStash::Json.dump(documents)\n elsif @format == \"message\"\n event.sprintf(@message)\n else\n encode(map_event(event))\n end\n end",
"def messages_payload\n messages.order(created_at: :desc).includes(:user).map do |message|\n {\n message_id: message.id,\n username: message.user.username,\n channel_name: message.channel.name,\n content: message.content,\n created_at: message.created_at\n }\n end\n end",
"def recentMessages\n render json: last_30_days_limit_100\n end",
"def messages_to_json(messages)\n messages.map{|msg|{\n \"user_fb_id\" => msg.user_fb_id,\n \"message_class\" => msg.html_class,\n \"sent_at\" => msg.created_at.to_formatted_s(:short), \n \"sent_at_long\" => msg.created_at.strftime(\"%b %e, %Y %I:%M %p\"),\n \"message\" => msg.message,\n \"id\" => msg.id,\n \"url\" => rental_unit_inquiries_url(msg.booking.rental_unit),\n \"booking_id\" => msg.booking_id\n }}.to_json\n end",
"def message_params\n m = params.require(:message)\n js = JSON.parse(m).with_indifferent_access\n res = js.slice(:context, :topic, :body, :begun_at, :success_at, :failed_at)\n res\n end",
"def work(raw_post)\n puts \"Msg received: \" + raw_post\n ack! # we need to let queue know that message was received\n end",
"def format_payload(payload, as: JSON_CONTENT_TYPE)\n # Non-Hash payloads are passed through as-is.\n return payload unless payload.is_a? Hash\n\n # Massage Hash-like payloads into a suitable format.\n case as\n when JSON_CONTENT_TYPE\n JSON.generate(payload.as_json)\n when FORM_CONTENT_TYPE\n payload.to_query\n else\n payload.to_s\n end\n end",
"def payload\n msg = {\n data: {\n alert: alert,\n badge: badge || \"Increment\",\n },\n }\n msg[:data][:sound] = sound if sound.present?\n msg[:data][:title] = title if title.present?\n msg[:data].merge! @data if @data.is_a?(Hash)\n\n if @expiration_time.present?\n msg[:expiration_time] = @expiration_time.respond_to?(:iso8601) ? @expiration_time.iso8601(3) : @expiration_time\n end\n if @push_time.present?\n msg[:push_time] = @push_time.respond_to?(:iso8601) ? @push_time.iso8601(3) : @push_time\n end\n\n if @expiration_interval.is_a?(Numeric)\n msg[:expiration_interval] = @expiration_interval.to_i\n end\n\n if query.where.present?\n q = @query.dup\n if @channels.is_a?(Array) && @channels.empty? == false\n q.where :channels.in => @channels\n end\n msg[:where] = q.compile_where unless q.where.empty?\n elsif @channels.is_a?(Array) && @channels.empty? == false\n msg[:channels] = @channels\n end\n msg\n end",
"def speak(data)\n Message.create(body: data['message']['body'], author_id: data['message']['author_id'], messageable_id: data['message']['messageable_id'], messageable_type: data['message']['messageable_type']);\n end",
"def format_request(payload); end",
"def format_request(payload); end",
"def display_message(message_id, message_body)\n message = JSON.parse(message_body)\n\n container = message['container']\n payload = message['payload']\n timestamp = format_date(message['timestamp'])\n\n puts \"Received: #{message_id}\"\n puts \"Container #{container} said '#{payload}' at #{timestamp}\"\n end",
"def payload\n @payload.fetch('payload')\n end",
"def payload\n self.update(:payload)\n @payload\n end",
"def push_live_with_http_info(object_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlogPostsApi.push_live ...'\n end\n # verify the required parameter 'object_id' is set\n if @api_client.config.client_side_validation && object_id.nil?\n fail ArgumentError, \"Missing the required parameter 'object_id' when calling BlogPostsApi.push_live\"\n end\n # resource path\n local_var_path = '/cms/v3/blogs/posts/{objectId}/draft/push-live'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2']\n\n new_options = opts.merge(\n :operation => :\"BlogPostsApi.push_live\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BlogPostsApi#push_live\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def on_message data\n begin\n data = JSON.parse data\n rescue Exception => e\n puts e\n response << {event: :error, message: \"Unknown Error\"}.to_json\n response.close\n return false\n end\n broadcast :_send_message, {event: :chat, from: params[:name], message: data['message'], at: Time.now}.to_json\n end",
"def work(raw_path)\n image = ::MiniMagick::Image::open(raw_path)\n image.resize \"100x100\"\n image.write raw_path\n\n # RecentPosts.push(image, raw_path)\n ack! # we need to let queue know that message was received\n end",
"def process(message)\n end",
"def notify msg, channel \n if @slack_url == '' \n puts \"No slack webhook url specified\"\n return\n end\n \n hash = {:text => msg, :channel => channel}\n json = JSON.generate(hash)\n payload = \"payload=#{json}\"\n\n `curl -X POST --data-urlencode '#{payload}' #{@slack_url}`\n end",
"def dispatch(message_payload)\n debug_me{[ :message_payload ]}\n raise ::SmartMessage::Errors::NotImplemented\n end",
"def format(payload)\n if(payload.get(:data, :nellie, :result))\n payload.set(:data, :github_kit, :commit_comment,\n Smash.new(\n :repository => [\n payload.get(:data, :code_fetcher, :info, :owner),\n payload.get(:data, :code_fetcher, :info, :name)\n ].join('/'),\n :reference => payload.get(:data, :code_fetcher, :info, :commit_sha)\n )\n )\n if(payload.get(:data, :nellie, :result, :complete))\n payload.set(:data, :github_kit, :commit_comment, :message, success_message(payload))\n else\n payload.set(:data, :github_kit, :commit_comment, :message, failure_message(payload))\n end\n end\n end",
"def event_body(event)\n # TODO: Create an HTTP post data codec, use that here\n if @format == \"json\"\n LogStash::Json.dump(map_event(event))\n elsif @format == \"message\"\n event.sprintf(@message)\n elsif @format == \"json_batch\"\n LogStash::Json.dump(event.map {|e| map_event(e) })\n else\n encode(map_event(event))\n end\n end",
"def pipe_message_body(opts = {})\n {\n stream_name: zfind(opts[:stream_name]) || zfind('status_stream'),\n data: opts[:data] || update_message_body(opts),\n partition_key: opts[:partition_key] || @instance_id || 'unk'\n }\n end",
"def message\n if not @message then\n [HTTPLogMessage, TCPLogMessage, StringLogMessage].each do |klass|\n @message = klass.parse(raw_message)\n break if @message\n end\n end\n return @message\n end",
"def create\n\t\tparams[:message_post][:message_thread_id] = params[\"message_thread_id\"]\n @message_post = MessagePost.new(params[:message_post])\n\t\t@message_post.author_id = current_user.id\n\t\t\n\t\t@message_thread = @message_post.message_thread\n\t\t\n\t\tRails.logger.info(\"Message Thread Length: #{@message_thread.message_posts.length}\")\n\t\tRails.logger.info(\"Messages: #{@message_thread.message_posts}\")\n\t\tRails.logger.info(\"Last Message: #{params['last_message_post']}\")\n\t\trange = Range.new(Integer(params[\"last_message_post\"])+1, -1)\n\t\t@new_message_posts = @message_thread.message_posts[range]\n\n respond_to do |format|\n if @message_post.save\n\t\t\t\t@new_message_posts.push(@message_post)\n format.html { redirect_to @message_post.message_thread, notice: 'Message post was successfully created.' }\n\t\t\t\tformat.js {}\n format.json { render json: @message_post, status: :created, location: @message_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def porkify(message, dictionary)\n # write code here \nend",
"def api_call(payload); end",
"def scan(mhead, mbody)\n return nil unless mhead['x-amz-sns-message-id']\n return nil if mhead['x-amz-sns-message-id'].empty?\n\n hasdivided = mbody.split(\"\\n\")\n jsonstring = ''\n jsonthings = nil\n foldedline = false\n\n while e = hasdivided.shift do\n # Find JSON string from the message body\n next if e.empty?\n break if e == '--'\n break if e == '__END_OF_EMAIL_MESSAGE__'\n\n # The line starts with \" \", continued from !\\n.\n e = e.lstrip if foldedline\n foldedline = false\n\n if e.end_with?('!')\n # ... long long line ...![\\n]\n e = e.chomp('!')\n foldedline = true\n end\n jsonstring << e\n end\n\n begin\n if RUBY_PLATFORM.start_with?('java')\n # java-based ruby environment like JRuby.\n require 'jrjackson'\n jsonobject = JrJackson::Json.load(jsonstring)\n\n # 'Message' => '{\"notificationType\":\"Bounce\",...\n jsonthings = JrJackson::Json.load(jsonobject['Message']) if jsonobject['Message']\n else\n # Matz' Ruby Implementation\n require 'oj'\n jsonobject = Oj.load(jsonstring)\n\n # 'Message' => '{\"notificationType\":\"Bounce\",...\n jsonthings = Oj.load(jsonobject['Message']) if jsonobject['Message']\n end\n jsonthings ||= jsonobject\n\n rescue StandardError => ce\n # Something wrong in decoding JSON\n warn ' ***warning: Failed to decode JSON: ' << ce.to_s\n return nil\n end\n\n return adapt(jsonthings)\n end",
"def to_message_with_quick_replies\n {\n text: self.message,\n quick_replies: self.get_quick_replies\n }\n end",
"def process_message(message)\n # TODO: May want to ignore some messages (say, if the community string is wrong)\n message.respond(dispatch(message))\n end",
"def append_info_to_payload(payload); end",
"def body\n self['body']\n end",
"def send_incoming_webhook(key, feature, channel_id)\n payload = $redis.get(\"payload:#{key}\")\n if payload.nil?\n payload = {\n :text => \"\"\n }\n attachments = []\n attachments << build_attachment(key, feature)\n payload[:attachments] = attachments\n $redis.setex(\"payload:#{key}\", 60*60*24, payload.to_json)\n else\n payload = JSON.parse(payload)\n end\n payload[:channel] = channel_id\n HTTParty.post(ENV[\"INCOMING_WEBHOOK_URL\"], :body => payload.to_json)\nend",
"def do_raw_dispatch(participant, msg)\n\n workitem = Ruote::Workitem.new(msg['workitem'])\n\n workitem.fields['dispatched_at'] = Ruote.now_to_utc_s\n\n Ruote.participant_send(\n participant, [ :on_workitem, :consume ], 'workitem' => workitem)\n\n @context.storage.put_msg(\n 'dispatched',\n 'fei' => msg['fei'],\n 'participant_name' => workitem.participant_name,\n 'workitem' => msg['workitem'])\n # once the consume is done, asynchronously flag the\n # participant expression as 'dispatched'\n end"
] | [
"0.62695724",
"0.6134371",
"0.61125296",
"0.5968066",
"0.5938257",
"0.5886663",
"0.5837624",
"0.57817066",
"0.57671666",
"0.57564956",
"0.5671648",
"0.5660459",
"0.56560004",
"0.56298965",
"0.56298965",
"0.5619777",
"0.56071836",
"0.5584202",
"0.55171144",
"0.5515163",
"0.5493341",
"0.54756063",
"0.5465624",
"0.54605925",
"0.54590154",
"0.5421192",
"0.5421134",
"0.5372243",
"0.5354172",
"0.5350694",
"0.53479886",
"0.53256774",
"0.53025025",
"0.5272996",
"0.5272996",
"0.52711236",
"0.5247601",
"0.5239865",
"0.5237091",
"0.523248",
"0.5230846",
"0.52225757",
"0.5217254",
"0.5206938",
"0.52034837",
"0.5203397",
"0.5196099",
"0.5189575",
"0.5182184",
"0.51785666",
"0.5176576",
"0.51683736",
"0.51588506",
"0.5153978",
"0.5151672",
"0.5151672",
"0.5142217",
"0.5139499",
"0.51296455",
"0.51064897",
"0.51016825",
"0.5101623",
"0.5095632",
"0.50943494",
"0.50934786",
"0.50723153",
"0.5068383",
"0.50521743",
"0.5050508",
"0.50482875",
"0.5044817",
"0.50416195",
"0.50378597",
"0.50317353",
"0.5030961",
"0.502299",
"0.502299",
"0.50224644",
"0.50107104",
"0.50093746",
"0.49924204",
"0.49915627",
"0.4989836",
"0.49882886",
"0.4984806",
"0.4981643",
"0.4980386",
"0.498035",
"0.49790093",
"0.49782407",
"0.49771458",
"0.49754524",
"0.4970136",
"0.49674156",
"0.49602455",
"0.49582893",
"0.49568292",
"0.4952957",
"0.49491143",
"0.49447"
] | 0.59386694 | 4 |
=begin General command to create Guide in all pages =end | def create_guide(title, description)
result = ""
result << "<div class='explanation-unit'>"
result << "<h1>#{title}</h1>"
result << "<p>#{description}</p>"
result << "</div>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_guide\n @title = \"Template Guide\"\n end",
"def help\n\tusage\n\tputs \"This tool is oriented to separate web pages into segments called blocks, based on the structural and visual properties\"\nend",
"def create\n @guide = Guide.new(guide_params)\n\n respond_to do |format|\n action_message_for('new')\n if create_guide\n format.html { redirect_to redirect_target(@guide), flash: @feedback_flash }\n format.json { render :show, status: :created, location: @guide }\n else\n 1.times { @guide.sections.new }\n 1.times { @guide.sections.new } if @guide.subtype == 'detailed_guide' && @guide.sections.size < 2\n format.html { render :new }\n format.json { render json: @guide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @guides = Guide.all\n end",
"def index\n @guides = Guide.all\n end",
"def what_it_does() \"Generate javadoc to '#{@name}' folder\" end",
"def new\n @guide = Guide.new\n end",
"def pages; end",
"def generate\n add_intro\n add_blood_pressure_intro\n add_blood_pressure_list\n add_blood_pressure_outro\n add_medications_intro\n add_medications_list\n add_about\n\n @pdf\n end",
"def newauthor\n require 'Pashua'\n include Pashua\n\n config = <<EOS\n *.title = Add a new author page\n cb.type = textfield\n cb.label = Name of author page to create\n cb.width = 220\n db.type = cancelbutton\n db.label = Cancel\n db.tooltip = Closes this window without taking action\nEOS\n\n pagetmp = pashua_run config\n exit if pagetmp[\"cancel\"] == 1\n page = pagetmp[\"cb\"]\n pname = \"/wiki/data/pages/a/#{clean_pagename(page)}.txt\"\n\n File.open(pname,\"w\") {|f| f<<\"h1. #{page}\\n\\nh2. Research\\n\\nh2. Links\\n * [[ |Homepage]]\n \\n{{page>abib:#{page}}}\"}\n\n `chmod a+rw \"#{pname}\"`\n\n `open \"http://localhost/wiki/a:#{page}?do=edit\"`\nend\n\n# removes current page and all related pages (ref, skimg etc) after confirmation\ndef delete\n require 'pashua'\n include Pashua\n config = <<EOS\n *.title = Delete this page?\n cb.type = text\n cb.text = This action will delete this page, and all related pages (ref:, notes:, skimg:, kindle:, etc). Are you sure?\n cb.width = 220\n db.type = cancelbutton\n db.label = Cancel\nEOS\n pagetmp = pashua_run config\n exit if pagetmp['db'] == \"1\"\n\n pname = cururl.split(\"/\").last.downcase\n page = pname.split(\":\").last\n ns = pname.split(\":\").first\n\n directories = %w[ref notes skimg kindle clip]\n\n if directories.index(ns)\n paths = directories.map {|f| \"#{Wiki_path}/data/pages/#{f}/#{page}.txt\"}\n\n else\n paths = [\"#{Wiki_path}/data/pages/#{clean_pagename(pname).gsub(\":\", \"/\")}.txt\"]\n end\n\n c = 0\n paths.each do |f|\n c += 1 if try { File.delete(f) }\n end\n\n growl \"#{c ? c : 0} pages deleted\"\nend\n\n#### Running the right function, depending on command line input ####\n\n@chrome = Appscript.app('Google Chrome')\nsend *ARGV unless ARGV == []\n",
"def start_new_chapter chapter\n start_new_page unless at_page_top?\n if @ppbook && verso_page? && !(chapter.option? 'nonfacing')\n update_colors # prevents Ghostscript from reporting a warning when running content is written to blank page\n start_new_page\n end\n end",
"def create\n @breadcrumb = 'create'\n @guide = Guide.new(params[:guide])\n @guide.created_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @guide.save\n format.html { redirect_to @guide, notice: crud_notice('created', @guide) }\n format.json { render json: @guide, status: :created, location: @guide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @guide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pages\n end",
"def set_guide\n @guide = Guide.find(params[:id])\n end",
"def set_guide\n @guide = Guide.find(params[:id])\n end",
"def set_guide\n @guide = Guide.find(params[:id])\n end",
"def guides\n self.pages.select {|p| p.full_url =~ GUIDE_PAGE_RE}\n end",
"def pages=(_arg0); end",
"def process_pages\n bindings = {\n :name => @definition.get_name,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:view)\n @definition.resources.each do |methods|\n methods[1].each do |resource|\n bindings.merge!(:resource => resource)\n filename = \"#{resource.slug}.html\"\n page.save_template(filename, bindings)\n end\n end\n end",
"def set_guide\n @guide = Guide.find(params[:id])\n end",
"def load_manpages\n all_pages = `apropos .`.split \"\\n\"\n all_pages.each do |line|\n matches = APROPOS_REGEX.match line\n command = matches[1]\n description = matches[2]\n manpage = `man #{command}`\n\n client.index index: INDEX_NAME,\n type: client.info['version']['number'].to_i <= 6 ? :document : '_doc',\n body: {\n command: command,\n description: description,\n manpage: manpage\n }\n end\nend",
"def my_aide(_args)\n system(\"less #{__dir__}/../docs/aide_admin\")\n end",
"def setup\n @page = pages(:homepage)\n end",
"def create\n @guide = Guide.new(params[:guide])\n @guide.user = current_user\n\n respond_to do |format|\n if @guide.save\n create_default_guide_taxa\n format.html { redirect_to @guide, notice: 'Guide was successfully created.' }\n format.json { render json: @guide.as_json(:root => true), status: :created, location: @guide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @guide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_pages!; end",
"def new\n @breadcrumb = 'create'\n @guide = Guide.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guide }\n end\n end",
"def add_template_pages; end",
"def generate_html\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n write_extra_pages if defined? write_extra_pages\n end",
"def create\n @guide = Guide.new(guide_params)\n\n respond_to do |format|\n if @guide.save\n format.html { redirect_to @guide, notice: 'Guide was successfully created.' }\n format.json { render :show, status: :created, location: @guide }\n else\n format.html { render :new }\n format.json { render json: @guide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @guide = Guide.new(guide_params)\n\n respond_to do |format|\n if @guide.save\n format.html { redirect_to @guide, notice: 'Guide was successfully created.' }\n format.json { render :show, status: :created, location: @guide }\n else\n format.html { render :new }\n format.json { render json: @guide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n @guide = Guide.new(params[:guide])\n respond_to do |format|\n if @guide.save\n format.html { redirect_to guide_url(@guide), notice: 'Guide was successfully created.' }\n format.json { render json: @guide, status: :created, location: @guide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @guide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_page\n end",
"def index\t\n # select help page to display\n if params[:ctrl] and @help_config['pages'][params[:ctrl]]\n if params[:page] and @help_config['pages'][params[:ctrl]][params[:page]]\n template = @help_config['pages'][params[:ctrl]][params[:page]]\n else\n template = @help_config['pages'][params[:ctrl]]['index']\n end\n end\n # choose language according to available help translations\n lang = (@help_config['langs'].include? current_language.to_s) ? current_language.to_s : @help_config['langs'].first\n\t\n url = \"/manual/#{lang}/\" + (template || \"index.html\")\n redirect_to(request.relative_url_root + url)\n end",
"def index\n @guidelines = Guideline.all\n end",
"def index\n @guidelines = Guideline.all\n end",
"def new_page_info\n args = Webby.site.args\n\n # TODO: maybe even get rid of this method altogether\n raise \"Usage: webby #{args.rake.first} 'path'\" if args.raw.empty?\n\n [args.page, args.title, args.dir]\n end",
"def examples_page\n Format.usage('This is my examples page, I\\'ll show you a few examples of how to get me to do what you want.')\n Format.usage('Running me with a file: whitewidow.rb -f <path/to/file> keep the file inside of one of my directories.')\n Format.usage('Running me default, if you don\\'t want to use a file, because you don\\'t think I can handle it, or for whatever reason, you can run me default by passing the Default flag: whitewidow.rb -d this will allow me to scrape Google for some SQL vuln sites, no guarentees though!')\n Format.usage('Running me with my Help flag will show you all options an explanation of what they do and how to use them')\n Format.usage('Running me without a flag will show you the usage page. Not descriptive at all but gets the point across')\nend",
"def generate_html\n @main_url = main_url\n @sorted_files = @files.sort\n @sorted_classes = @classes.sort\n @sorted_methods = RDoc::Generator::Method.all_methods.sort\n\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n values = {\n :title_suffix => CGI.escapeHTML(\"[#{@options.title}]\"),\n :charset => @options.charset,\n :style_url => style_url('', @options.css),\n }\n\n @template.write_extra_pages(values) if\n @template.respond_to?(:write_extra_pages)\n end",
"def introduction\r\n\r\n end",
"def help\n print <<END\n Usage:\n convert.rb [options] <html-directory>\n\n -c, --per-chapter\n file-per-chapter mode -- generates one HTML file chapxxx.htm for each\n chapter sections are level 2 headings and anchors chapxxx.htm#SECTxxx.\n This is intended for local browsing, especially under MS-DOS\n \n -s, --silent silent running. Conversational messages are suppressed.\n\n <html-directory> defaults to the current directory\nEND\nend",
"def create_docs\n directory 'templates/docs', 'docs'\nend",
"def webSiteBuildLinkPages\n title = \"C/C++ Coding Guides\"\n webSiteBuildCategoryLinkPage([CPP, GUIDE], \"cpp/guides/\", title)\n \n title = \"C/C++ Tutorials\"\n webSiteBuildCategoryLinkPage([CPP,TUTORIAL], \"cpp/tutorials/\", title)\n \n title = \"C/C++ Examples\"\n webSiteBuildCategoryLinkPage([CPP,EXAMPLE], \"cpp/examples/\", title)\n \n title = \"JavaScript Coding Guides\"\n webSiteBuildCategoryLinkPage([JS,GUIDE], \"js/guides/\", title)\n \n title = \"JavaScript Tutorials\"\n webSiteBuildCategoryLinkPage([JS,TUTORIAL], \"js/tutorials/\", title)\n \n title = \"JavaScript Examples\"\n webSiteBuildCategoryLinkPage([JS,EXAMPLE], \"js/examples/\", title)\n \n title = \"All Examples\"\n webSiteBuildCategoryLinkPage([CPP,JS,EXAMPLE], \"overviews/examples/\", title)\nend",
"def link_documentation; end",
"def guides_newpages_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"sort-options\").a(\"/New Pages/\"), __method__)\n end",
"def set_guide\n @guide = Guide.where(:id => params[:id]).first\n end",
"def open_pages\n make_calendars\n make_topics\n end",
"def submission_guidelines\n @title = PageTitle.new I18n.t('page_titles.about.submission_guidelines')\n\n render \"#{Current.theme}/pages/submission_guidelines\"\n end",
"def help\n\t puts \"\"\n\t puts Rainbow(\":doc\").color(\"#D65200\")+\" Open documentation online\"\n\t puts Rainbow(\":open\").color(\"#D65200\")+\" Open file or folder\"\n\t puts Rainbow(\":new\").color(\"#D65200\")+\" Create file or directory\"\n\t puts Rainbow(\":destroy\").color(\"#D65200\")+\" Destroy Params file or current directory\"\n\t puts Rainbow(\":clean\").color(\"#D65200\")+\" Clean the trash\"\n\t puts Rainbow(\":calendar\").color(\"#D65200\")+\" Show current month\"\n\t puts Rainbow(\":today\").color(\"#D65200\")+\" Show date of day\"\n\t puts \"\"\n\t end",
"def guide_params\n params.require(:guide).permit(:title, :description, :steps, :source)\n end",
"def intro()\n show do\n title \"Introduction - RNA Quality Control\"\n separator\n note \"In this protocol you will prepare <a href=https://www.labviva.com/pub/static/frontend/Ueg/new/en_US/images/docs/HB-2326-001_1105695_IAS_QX_RNA_Quality_Control_0117_WW.pdf>RNA samples for analysis on the QIAxcel Bioanalyzer</a>.\"\n note \"1. Gather materials and reagents\"\n note \"2. Mix and place samples on thermocycler\"\n note \"3. Dilute\"\n end\n end",
"def create_empty_page(p)\n cli.say 'Creating project page'\n FileUtils.mkdir_p(browse_file(p, '.'))\n %w[favicon-32.png style.css].each do |i|\n FileUtils.cp(template_file(i), browse_file(p, i))\n end\n write_file(p, 'about.html') do\n build_from_template('about.html', citation: MiGA::MiGA.CITATION)\n end\n end",
"def create\n @guide = Guide.new(params[:guide])\n @guide.secret_code = Guide.secret_code\n\n respond_to do |format|\n if @guide.save\n flash[:notice] = 'Guide was successfully created.'\n format.html { redirect_to(guides_path) }\n format.xml { render :xml => @guide, :status => :created, :location => @guide }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @guide.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @guidebooks = Guidebook.all\n end",
"def intro()\n show do\n title \"Introduction - Illumina RNA Seq Library Prep\"\n separator\n note \"This is the first step in the: <a href=https://support.illumina.com/downloads/truseq_stranded_total_rna_sample_preparation_guide_15031048.html>Illumina TruSeq Stranded Total RNA with RiboZero Guide</a>\"\n note \"In this protocol, you will be depleting the abundant ribosomal RNA from your sample.\"\n note \"Then, you will be chemically fragmenting the depleted RNA, since the Illumina platform is optimized for short reads.\"\n note \"<b>1.</b> Deplete riboRNA\"\n note \"<b>2.</b> Isolate & Wash Depleted RNA\"\n note \"<b>3.</b> Chemically Fragment RNA\"\n end\n end",
"def show_manual\n print self.name\n print ' ' unless self.arguments.empty?\n self.arguments.each_with_index do |arg,i| \n print arg.manual_description\n print ' ' if i != self.arguments.length - 1\n end\n println '\\h'\n println '\\t' + self.manual_description\n unless self.subcommands.empty?\n println _INTL('\\hSubcommands:')\n self.subcommands.each { |subcmd| println subcmd.manual_description }\n end\n unless self.options.empty?\n println _INTL('\\hOptions:')\n self.options.each { |opt| println opt.manual_description }\n end\n end",
"def index\n @guides = Guide.page(1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {:guides => @guides.as_json} }\n end\n end",
"def my_aide(_args)\n system(\"less #{__dir__}/../docs/aide\")\n end",
"def guide_params\n params.require(:guide).permit(:id, :preamble_id, :text, :postscript_id)\n end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def setup_override\n spec = Gem::Specification.find_by_name 'yard'\n erb = File.join(spec.gem_dir,\"templates\",\"default\",\"fulldoc\",\"html\",ERB)\n # Create the subdirectory structure\n subdir = File.join(tmpdir,\"default\",\"fulldoc\",\"html\")\n FileUtils.mkdir_p subdir\n # Copy the erb\n target_file = File.join(subdir,ERB)\n FileUtils.cp(erb,target_file)\n # Open the file and add the anchors\n open(target_file,'a') do |file|\n file.write \"<% do_dash %>\\n\"\n end\n end",
"def help_text\n build_html do\n p <<P1\nThis page is a simple presentation of the paths that match the file\nthat was searched for an the fileset that the file was shipped in.\nP1\n end\n end",
"def intro()\n show do\n title \"Fragment analyzing info\"\n note \"In this protocol, you will do the following:\"\n note \"- gather stripwells of fragments\"\n note \"- organize them in the fragment analyzer machine\"\n note \"- set up and run the analyzer\"\n note \"- upload the analysis results to Aquarium\"\n end\n end",
"def guides\n @guides ||= Guides::GuidesRetriever.get_guides(action).input\n end",
"def home_lessons\n para \"You have no lessons.\", :margin_left => 12, :font => \"Lacuna Regular\"\n end",
"def generate_doc\n\n end",
"def docs; end",
"def new_doc\n @doc_content = \"\"\n @doc_start_page = nil\n @pages_in_doc = 0\n end",
"def help; end",
"def help; end",
"def help; end",
"def tutorial\n end",
"def make_pages\n Dir.glob(concepts_glob).each do |concept_file_path|\n Jekyll.logger.debug(\"Geolexica:\",\n \"processing concept data #{concept_file_path}\")\n concept_hash = read_concept_file(concept_file_path)\n preprocess_concept_hash(concept_hash)\n add_page ConceptPage::HTML.new(site, concept_hash)\n add_page ConceptPage::JSON.new(site, concept_hash)\n add_page ConceptPage::JSONLD.new(site, concept_hash)\n add_page ConceptPage::Turtle.new(site, concept_hash)\n end\n end",
"def set_guidebook\n @guidebook = Guidebook.find(params[:id])\n end",
"def generate_javadoc\n classpath = \"tools/jambidoc\"\n system \"javadoc -classpath #{classpath} -doclet jambidoc.JambiDoclet \" + \n \"-header \\\"#{@header}\\\" -J-Xmx500m -sourcepath #{@BASE_PATH} com.trolltech.qt com.trolltech.qt.core \" + \n \"com.trolltech.qt.gui com.trolltech.qt.opengl com.trolltech.qt.sql com.trolltech.qt.opengl \"+\n \"com.trolltech.qt.svg com.trolltech.qt.network com.trolltech.qt.xml \" +\n \"com.trolltech.qt.designer com.trolltech.qt.webkit com.trolltech.qt.phonon\"\n if $?.exitstatus != 0\n puts \"Failed to run javadoc\"\n exit 1\n end\n\n system 'find . -name \"qt jambi.dcf\" -exec rm {} \\;'\n system 'find . -name \"qt jambi.index\" -exec rm {} \\;'\n system 'find . -name \"*.jdoc\" -exec rm {} \\;'\n\n system \"jar -cf #{@OUTPUT_DIRECTORY}/qtjambi-javadoc-#{@qtjambi_version}.jar doc/html/*\"\n if $?.exitstatus != 0\n puts \"Failed to run jar -cf doc/*\"\n exit 1\n end\n\n #FileUtils.cp \"doc/html/qtjambi-javadoc-$QTJAMBI_VERSION.jar\", @OUTPUT_DIRECTORY\n end",
"def add\n if page.url && !Ink.config['docs_mode']\n Ink.site.pages << page unless Helpers::Path.find_page(page)\n end\n end",
"def repage\n with_command \"+repage\"\n end",
"def index\n @guides = Guide.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guides }\n end\n end",
"def generate_panacea_document\n template \"templates/PANACEA.tt\", \"PANACEA.md\"\n end",
"def book_pages\n\t\t@book = {\n\t\t\t\t\"sketch\" =>\n\t\t\t\t\"\t\t\t\t------------------------------------------\n\t\t\t\t| |\n\t\t\t\t| ----- |\n\t\t\t\t| / _ \\\\ |\n\t\t\t\t| / | | \\\\ |\n\t\t\t\t| --------- |\n\t\t\t\t| |\n\t\t\t\t| ____ _____ |\n\t\t\t\t| / \\\\____ /| \\\\__ |\n\t\t\t\t| / \\\\_____/ | \\\\_______ |\n\t\t\t\t| _____ |____ |\n\t\t\t\t| / \\\\____ /* \\\\__ |\n\t\t\t\t| / \\\\_____/ \\\\_______ |\n\t\t\t\t| |\n\t\t\t\t| |\n\t\t\t\t| _ |\n\t\t\t\t| / \\\\__ ___ |\n\t\t\t\t| /__/ \\\\/ \\\\ |\n\t\t\t\t| /____\\\\____\\\\ |\n\t\t\t\t| |\n\t\t\t\t| |\n\t\t\t\t ------------------------------------------\",\n\n\t\t\t\t \"page1\" =>\n\t\t\t \t\"\t\t\t\t------------------------------------------\n\t\t\t\t| |\n\t\t\t\t| |\n\t\t\t\t| -oday-- met a ------------- loca- |\n\t\t\t\t| trib----- confirme------uspicions. |\n\t\t\t\t| Now I kn---how---------tr--sur-----. |\n\t\t\t\t| |\n\t\t\t\t| ---gh- |\n\t\t\t\t| m---? |\n\t\t\t\t| |\n\t\t\t\t| R----R--Y----B- |\n\t\t\t\t ------------------------------------------\",\n\n\t\t\t}\n\tend",
"def generate(site)\n\n # page_gen_dirs determines whether we want to generate index pages\n # (name/index.html) or standard files (name.html). This information\n # is passed to the DataPage constructor, which sets the @dir variable\n # as required by this directive\n\n index_files = site.config['page_gen-dirs'] == true\n\n # data contains the specification of the data for which we want to generate\n # the pages (look at the README file for its specification)\n data = site.config['page_gen']\n types = site.config['data_types']\n if data\n data.each do |data_spec|\n # template = data_spec['template'] || data_spec['data']\n name = data_spec['name']\n # dir = data_spec['dir'] || data_spec['data']\n # Added 2 lines: Set context and type for JSON-LD \n context = data_spec['context'] || \"http://schema.org/\"\n # type = data_spec['type'] || \"Thing\"\n extension = data_spec['extension'] || \"html\"\n\n # records is the list of records defined in _data.yml\n # for which we want to generate different pages\n records = nil\n data_spec['data'].split('.').each do |level|\n if records.nil?\n records = site.data[level]\n else\n records = records[level]\n end\n end\n records.each do |record|\n # Added 3 lines: Add context and type for JSON-LD to each record\n collection = record[\"collection\"]\n dir = types[collection][\"dir\"] || collection\n template = types[collection][\"template\"]\n type = types[collection][\"type\"]\n record[\"@context\"] = context\n record[\"data\"][\"@type\"] = type\n record[\"data\"][\"name\"] = record[\"name\"]\n site.pages << DataPage.new(site, site.source, index_files, dir, record, name, template, extension)\n end\n end\n end\n end",
"def index\n @guide_items = Guide::Item.order(:ordinal)\n end",
"def guides_allpages_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"sort-options\").a(\"/All Pages/\"), __method__)\n end",
"def help\n \n end",
"def guides\n @guides ||= Guides::GuidesRetriever.get_guides(action)\n end",
"def user_guides_label\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"tabs\").innerText(\"/guides/\"), __method__)\n end",
"def generate_codepage_table(cp)\n puts \"Generating codepage table for #{cp}\"\n ranges = codepage_table(cp)\n open(cp.downcase+\".go\", \"w\") do |f|\n f.puts \"package codepage\", \"\"\n f.puts \"var #{cp.gsub('-', '_')} = Codepage{\"\n ranges.each do |range|\n f.puts \"\\t{0x%04X, 0x%04X, %d, %d},\" % [range.first, range.first + range.count - 1, range.count, range.delta]\n end\n f.puts \"}\"\n end\nend",
"def create_md tool\n \n original = tool[1].split(\"\\n\")\n new = []\n note = false\n\n # Cambia las rutas y < y > por código HTML\n def diple l\n return l.gsub('de +++YAML+++ en <http://pecas.cliteratu.re>', 'de [+++YAML+++](yaml.html)')\n .gsub('de JavaScript en <http://pecas.cliteratu.re>', 'de [JavaScript](js.html)')\n .gsub('Lista de acrónimos: <https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc#languages>', '[Lista de acrónimos](https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc#languages)')\n .gsub('<','<').gsub('>','>')\n end\n\n # Agrega versalitas\n def smallcaps l\n return l.gsub(/([A-Z]{3,})/, '+++\\1+++')\n end\n\n # Cambia comillas por sintaxis para línea de código\n def to_code l\n return l.gsub(/«(.+?)»/, '`\\1`')\n end\n\n # Añade líneas de código en las opciones\n def to_code_option l\n return l.gsub(/^(\\S+)/, '`\\1`')\n end\n\n new.push('# ' + $l_g_pc_docs_creation + '`' + tool[0] + '`')\n\n original.each_with_index do |l, i|\n\n l = to_code(diple(smallcaps(l)))\n\n if l =~ /^\\S/\n # Encabezados 2\n if l !~ /^Nota/ && i != 1\n new.push('## ' + l + \"\\n\\n\")\n # Párrafos\n else\n # Notas\n if l =~ /^Nota/\n if !note\n new.push(\"--- {.espacio-arriba3}\\n\\n\")\n note = true\n new.push(l + ' {.espacio-arriba3}')\n else\n new.push(l + ' {.espacio-arriba1 .sin-sangria}')\n end \n # Descripción\n else\n # Esto servirá para crear «herramientas.md»\n $tools_md[\"#{tool[0]}\"] = [tool[0], l.gsub(/^\\S+\\s+/, '')]\n new.push(l)\n end\n end\n else\n if l.strip != ''\n l = l.strip\n\n # Opciones de Pecas\n if l =~ /^-/\n new.push('* ' + to_code_option(l))\n # Comandos de Pecas\n elsif l =~ /^pc-/\n new.push('```')\n new.push(l)\n new.push('```')\n # Explicaciones\n elsif l =~ /^[A-Z]/\n new.push(\"\\n\" + l)\n # Dependencias / Tipos\n else\n # Evita que se quede como línea de código el tipo y su descripción\n l_final = []\n l.split(/\\s+/).each_with_index do |ll, i|\n # Solo la primera palabra se va como código\n if i == 0\n l_final.push('* `' + ll + '`')\n # El resto de las palabras se quedan como texto\n else\n l_final.push(ll)\n end\n end\n new.push(l_final.join(' '))\n end\n # Líneas en blanco\n else\n new.push(l)\n end\n end\n end\n\n\tarchivo = File.new(Dir.pwd + '/md/' + tool[0] + '.md', 'w:UTF-8')\n\tarchivo.puts new\n\tarchivo.close\nend"
] | [
"0.6416863",
"0.6237102",
"0.61921793",
"0.6040167",
"0.6040167",
"0.60146636",
"0.6002858",
"0.5998762",
"0.59902966",
"0.59401906",
"0.5919527",
"0.590134",
"0.5863649",
"0.57965535",
"0.57965535",
"0.57965535",
"0.57774985",
"0.5767953",
"0.5760136",
"0.57329845",
"0.5721977",
"0.5709854",
"0.5691996",
"0.5673352",
"0.56619716",
"0.5645985",
"0.5644537",
"0.5633094",
"0.5590793",
"0.5590793",
"0.5584334",
"0.5582535",
"0.5574806",
"0.5569196",
"0.5569196",
"0.55590457",
"0.5533162",
"0.552406",
"0.5520528",
"0.5511764",
"0.55077887",
"0.55054283",
"0.54813707",
"0.5474654",
"0.54675114",
"0.5457233",
"0.54507536",
"0.54477286",
"0.5441067",
"0.5438457",
"0.5415009",
"0.54119885",
"0.54118204",
"0.5411446",
"0.5406417",
"0.5404502",
"0.5402166",
"0.54018223",
"0.53853065",
"0.53853065",
"0.53853065",
"0.53853065",
"0.53853065",
"0.53853065",
"0.53853065",
"0.53853065",
"0.53853065",
"0.53853065",
"0.53853065",
"0.53853065",
"0.5382551",
"0.5360593",
"0.53600746",
"0.5354549",
"0.5348239",
"0.5338733",
"0.5333947",
"0.5330304",
"0.5323531",
"0.5323531",
"0.5323531",
"0.53224987",
"0.53183025",
"0.53115886",
"0.5294492",
"0.52863854",
"0.5282617",
"0.5282088",
"0.5279531",
"0.52719283",
"0.5264412",
"0.5255215",
"0.52392673",
"0.5231454",
"0.5231223",
"0.52284384",
"0.5224005",
"0.5221649"
] | 0.61946714 | 4 |
GET /members/1 GET /members/1.json | def show
@member = Member.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @member }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end",
"def members\n raw_response = get_request('users/members')\n parse_response(raw_response, :users)\n end",
"def index\n @members = Member.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n @members = Member.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n @members = Member.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def list_members\n HTTP.headers(:accept => @@accept, \"content-type\" => @@content_type).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/members\").parse[\"members\"]\n end",
"def get_member_of_list(user, list, member_id)\n get(\"/#{user}/#{list}/members/#{member_id}.json\")\n end",
"def list_members(user, list)\n get(\"/#{user}/#{list}/members.json\")\n end",
"def members\n return @members if @members\n @members = Client.get(\"/organizations/#{id}/members/all\").json_into(Member)\n end",
"def members\n response = service.get_members\n response.map do |member_data|\n Member.new(member_data)\n end\n end",
"def members_list\n @members = Member.active.ordered.all\n @user = current_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @members }\n end\n end",
"def show\n @member = Member.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @member }\n end\n end",
"def show\n @member = Member.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @member }\n end\n end",
"def index\n @member = Member.find(params[:member_id])\n end",
"def show\n @member = Member.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @member }\n end\n end",
"def get\r\n\t\t#binding.pry\r\n\t\ttemplateFile = 'api/v1/users/members/get'\r\n\t\tunless (params[:id].to_i != 0 ) #will get the current user id if its nil or 0\r\n\t\t\tparams[:id] = session[:user].id\r\n\t\t\ttemplateFile = 'api/v1/users/members/getFull'\r\n\t\tend\r\n @responseObject = OpenStruct.new({\r\n status: true,\r\n errors: [],\r\n code: API_CODE_ERRORS['Services']['Global']['success'],\r\n objectData: OpenStruct.new(User.getFullUserData(params[:id])),\r\n timestamp: (Date.new).to_time.to_i.abs\r\n })\r\n \trender :template => templateFile ,:handlers => [:rabl], :formats => [:json]\r\n\tend",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @member }\n end\n end",
"def index\n @members = Member.find(:all)\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def team_members(id)\n get \"/teams/#{id}/members\"\n end",
"def org_members\n @members = @github.orgs.members.list APP_CONF['org']\n render json: @members\n end",
"def get_members()\n @client.make_request(:get, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members\"))[0].map do |i|\n member = ConferenceMember.new(i, @client)\n member.conference_id = id\n member\n end\n end",
"def index\n @members = User::Member.all\n end",
"def member(member_id, &block)\n get \"/member/#{member_id}/\", nil, &block\n end",
"def show\n @member = Member.find(params[:id])\n @title = \"#{@member.last_name} #{@member.given_names}\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @member }\n end\n end",
"def index\n @members = Member.members\n @participants = Member.participants\n @invited_count = Member.count\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def members *args\n page, per_page, options = TibbrResource.extract_params(args, 2)\n cache_lookup(MEMBERS, true, page, per_page) do\n TibbrResource.paginate_collection(get(:members, :params => {:include_group_members => options[:include_group_members], :page => page, :per_page => per_page}), User)\n end\n end",
"def members\n users\n end",
"def members\n users\n end",
"def members(options = { :filter => :all })\n return @members if @members\n @members = Client.get(\"/boards/#{id}/members\", options).json_into(Member)\n end",
"def show\n if user\n render json: user,serializer: Api::V1::MembersSerializer, :status => 201\n else\n render json: \"errors\", :status => 422\n end \n end",
"def index\n @members = @project.memebers\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @membership }\n end\n end",
"def member(token, server_id, user_id)\n request(\n __method__,\n :get,\n \"#{api_base}/guilds/#{server_id}/members/#{user_id}\",\n Authorization: token\n )\n end",
"def index\n if params[:data]\n @members = Member.get_members(params[:data][:kind].to_i, params[:data][:search])\n else\n @members = Member.all\n end\n\n @members = @members.paginate(:page => params[:page], :per_page => 25)\n end",
"def account\n @member = current_user.member\n @user = current_user\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @member }\n end\n end",
"def show\n team = Team.find(params[:id])\n image_url = team.image.url\n members = team.members.select(:name, :surname)\n member_names = []\n members.each do |m|\n member_names.push(m.name + \" \" + m.surname)\n end\n team = team.attributes\n\n team[:members] = member_names\n team[:image] = image_url\n render json: team\n end",
"def index\n @search = Member.search(params[:search])\n @members = @search.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def group_members(id)\n get(\"/groups/#{id}/members\")\n end",
"def members\n fetch if @members.nil? || @members[0].nil?\n @members\n end",
"def index\n @restmembers = Restmember.all\n end",
"def show\n @membership = Membership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @membership }\n end\n end",
"def show\n @group_member = GroupMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group_member }\n end\n end",
"def show\n @group_member = GroupMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group_member }\n end\n end",
"def show\n @member = Member.find(params[:id])\n raise CanCan::AccessDenied if cannot? :show, @member\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @member }\n end\n end",
"def index\n\t\tmembers = Member.where(team_id: params[:team_id]).all\n\t\trespond_with members\n\tend",
"def members(options = {})\n KlaviyoAPI::ListMember.all_members params: { list_id: id, **options }\n end",
"def show_members\n @members.each do |member, amt|\n puts member\n end\n @members\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def get_profile\n self.class.get '/members/private', @options\n end",
"def show_member\n @member = Member.find(params[:id])\n end",
"def show\n @member_type = MemberType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @member_type }\n end\n end",
"def members_get_info(members:, trace: false)\n members_json = []\n members.each do |m|\n if m['team_member_id'] != nil\n members_json << \"{\\\".tag\\\":\\\"team_member_id\\\",\\\"team_member_id\\\":\\\"#{m['team_member_id']}\\\"}\"\n elsif m['external_id'] != nil\n members_json << \"{\\\".tag\\\":\\\"external_id\\\",\\\"external_id\\\":\\\"#{m['external_id']}\\\"}\"\n elsif m['email'] != nil\n members_json << \"{\\\".tag\\\":\\\"email\\\",\\\"email\\\":\\\"#{m['email']}\\\"}\"\n end\n end\n dropbox_query(query: '2/team/members/get_info', query_data: \"{\\\"members\\\":[#{members_json.join(',')}]}\", trace: trace)\n end",
"def get_mailing_members(id)\n get(\"/mailings/#{id}/members\")\n end",
"def get_members_by_id\n return filter_by_id(get_members) \n end",
"def show\n @aiit_member = AiitMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aiit_member }\n end\n end",
"def conference_list_members(params)\n path = @version + '/Conference/Member/List/'\n method = 'POST'\n return request(path, method, params)\n end",
"def user_team_members(id, user_id = nil)\n user_id.to_i.zero? ? get(\"/user_teams/#{id}/members\") : get(\"/user_teams/#{id}/members/#{user_id}\")\n end",
"def show\n \t@member= Member.find(params[:member_id])\n\tend",
"def members\n @group = Group.find(params[:group_id])\n @members = @group.users\n end",
"def vault_members(vault_id)\n request_get(\"/vault/#{vault_id}/members\")\n end",
"def show\n @clnmember = Clnmember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clnmember }\n end\n end",
"def show\n #@member= Member.find(params[:member_id])\n end",
"def show\n #@member= Member.find(params[:member_id])\n end",
"def show\n #@member= Member.find(params[:member_id])\n end",
"def index\n if params[:group_id]\n @members = Group.find(params[:group_id]).members\n else\n @members = Member.all\n end\n end",
"def index\n @members = Defer { ::Member.all }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @members }\n end\n end",
"def index\n @announcements = Announcement.all\n render json: @announcements, include: [:member => {only: [:first_name, :last_name, :id]}]\n end",
"def show\n @membership = Adhocracy::Membership.find(params[:id])\n\n render json: @membership\n end",
"def show\n\t\t@member = Member.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml\t{ render :xml => @member }\n\t\tend\n\tend",
"def index\n @oc_members = OcMember.find(:all, :order => \"created_at ASC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @oc_members }\n end\n end",
"def index\n @member = Member.find(params[:member_id])\n\n @maritalinfos = @member.maritalinfo\n end",
"def member\n Member.find(@member.name)\n end",
"def show\n # GET /gym_members/:id\n @gym_member = GymMember.find(params[:id])\n render :show\n end",
"def group_members(id, params = {})\n get(\"/groups/#{id}/members\", params)\n end",
"def index\n @member = Member.find(params[:member_id])\n\n @personalinfos = @member.personalinfo\n end",
"def get_member(_user_id)\n user_participants.where(id: _user_id).take\n end",
"def show\n @member = Member.find(params[:id])\n #@members = Member.paginate(:page => params[:page])\n @title = @member.last_name\n #respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @member }\n #end\n end",
"def members\n # Include the join model, because we want the serializer to set\n # the ready flag on the user.\n @room = Room.includes(:room_users).find(params.require(:room_id))\n if @room && current_user.member_of_room?(@room)\n success(body: @room.members, scope: { room: @room })\n else\n not_found\n end\n end",
"def all_members\n @dvd_club = DvdClub.find(params[:id])\n @users = @dvd_club.users\n end",
"def test_get_member_basic_success\n\n client = create_mock_client\n refute_nil client, \"Client object couldn't be created.\"\n\n stub_request(:get, mock_uri('Groups', '17', 'Members', '15'))\n .to_return(status: 200, body: { 'Success' => true,\n 'Message' => \"Operation succeeded\",\n 'ApiId' => API_ID,\n 'Member' => { 'Id' => 15,\n 'Name' => 'someone',\n 'Number' => '91XXXXXXXXXX' } }.to_json)\n\n status, member = client.group.get_member(17, 15)\n refute_nil status, \"No status object returned.\"\n assert status.success, \"Status did not indicate success: \" + status.message.to_s\n refute_nil member, \"No member item returned.\"\n assert_equal 15, member.id, \"ID is not correct.\"\n assert_equal 'someone', member.name, \"Name is not correct.\"\n assert_equal '91XXXXXXXXXX', member.number, \"Number is not correct.\"\n\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end"
] | [
"0.802443",
"0.7435711",
"0.7342297",
"0.7342297",
"0.7342297",
"0.7323629",
"0.72980005",
"0.7221314",
"0.72195596",
"0.7147893",
"0.7134981",
"0.70929253",
"0.70929253",
"0.7075791",
"0.70524216",
"0.7036332",
"0.70284396",
"0.6977145",
"0.69389415",
"0.69389415",
"0.69389415",
"0.69389415",
"0.69389415",
"0.69389415",
"0.69389415",
"0.69389415",
"0.69389415",
"0.69389415",
"0.69347686",
"0.69347537",
"0.69296443",
"0.6885753",
"0.68777215",
"0.6863854",
"0.6859711",
"0.685433",
"0.68334657",
"0.68334657",
"0.680877",
"0.6773256",
"0.66960555",
"0.6641634",
"0.6639911",
"0.66298634",
"0.66210407",
"0.6609499",
"0.6601128",
"0.65923595",
"0.658597",
"0.6579893",
"0.65482765",
"0.65292853",
"0.65292853",
"0.6505198",
"0.65027875",
"0.64953595",
"0.6489964",
"0.64804924",
"0.6469708",
"0.64562744",
"0.64470357",
"0.64432603",
"0.6441124",
"0.64133036",
"0.6409377",
"0.6391099",
"0.638784",
"0.63710123",
"0.63688684",
"0.6362788",
"0.6361041",
"0.63423866",
"0.63423866",
"0.63423866",
"0.6338499",
"0.633418",
"0.6310246",
"0.6302688",
"0.62857413",
"0.62771183",
"0.6272466",
"0.62691516",
"0.62672085",
"0.626276",
"0.6256716",
"0.62555885",
"0.62512285",
"0.6232866",
"0.62326515",
"0.62297714",
"0.6226551",
"0.6226551"
] | 0.71454585 | 16 |
GET /members/new GET /members/new.json | def new
@member = Member.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @member }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @member = Member.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def new\n @member = Member.new\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n\tif !checkadmin? then return end #\n\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n user = @member.build_user\n @roles = Role.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def new\n @member = Member.new\n user = @member.build_user\n @roles = Role.find(:all)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end",
"def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @membership }\n end\n end",
"def new\n @title = \"New Member\"\n @member = Member.new\n @member.phone = \"+375\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member_type = MemberType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member_type }\n end\n end",
"def new\n new_url = \"#{ENV['KPASS_ENDPOINT']}/members/new?app_id=#{ENV['KPASS_APP_ID']}\"\n redirect_to new_url\n end",
"def new\n @member = Member.new\n @title = \"New member\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end",
"def new_members\n @members = User.all\n end",
"def new\n\t\t@member = Member.new(:membership_id => params[:membership_id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @member }\n\t\tend\n\tend",
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end",
"def new\n @group_member = GroupMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_member }\n end\n end",
"def new\n\t\t@membership = Membership.new\n\t\t@membership.members.build\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @membership }\n\t\tend\n\tend",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end",
"def new\n @clnmember = Clnmember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clnmember }\n end\n end",
"def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end",
"def new\n @title = \"Заявка на вступление\"\n @member = Member.new\n @member.card_number = Member.last_card_number + 1\n @member.join_date = Date.today\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n if current_member.can_admin_members?\n @member = Member.new\n \n @available_portable_numbers = Member.get_available_portable_numbers(1..60)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n else\n render_forbidden\n end\n end",
"def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end",
"def new\n @dotsmember = Dotsmember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dotsmember }\n end\n end",
"def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @member_time = MemberTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member_time }\n end\n end",
"def new\n @pe_classmember = PeClassmember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pe_classmember }\n end\n end",
"def new\n if params[:institute_id]\n @institute = Member.find(params[:institute_id])\n @member.address = @institute.address\n @member.status = 'N'\n @member.bulletin = 'yes'\n @member.comment = \"added #{Date.today}.\"\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def create\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end",
"def new\n @member = Member.new\n end",
"def new\n @member = Member.new\n end",
"def new\n @member = Member.new\n end",
"def new\n @member = Member.new\n end",
"def new\n @aiit_member = AiitMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aiit_member }\n end\n end",
"def new\n @member = Member.new\n \n end",
"def new\n p 'new called'\n @user = User.new\n\n p \"#{@user}\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @leader = Leader.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @leader }\n end\n end",
"def new\n @who_member = WhoMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @who_member }\n end\n end",
"def new\n @meeting_member = MeetingMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @meeting_member }\n end\n end",
"def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end",
"def create\n @member = Member.new(params[:member])\n @member.new = false\n\n respond_to do |format|\n if @member.save\n flash[:notice] = 'Member was successfully created.'\n format.html { redirect_to members_url(@member) }\n format.xml { head :created, :location => member_url(@member) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @member.errors.to_xml }\n end\n end\n end",
"def create\n # type = \"member\"\n\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render action: 'show', status: :created, location: @member }\n else\n format.html { render action: 'new' }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def newent\n @user = User.new\n respond_to do |format|\n format.html # newent.html.erb\n format.json { render :json => @user }\n end\n end",
"def create\n @member = Member.new(params[:member])\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(params[:member])\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(params[:member])\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @person = Person.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @member_info = MemberInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member_info }\n end\n end",
"def new\n @member = Member.new\n @member.email = @search_string ||= \"\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member}\n end\n end",
"def new\n @dc_member = DcMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dc_member }\n end\n end",
"def new\n @friend = Friend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friend }\n end\n end",
"def new\n @owner = Owner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @member_category = MemberCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member_category }\n end\n end",
"def new\n @name = Name.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @name }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end",
"def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end",
"def new\n @name = Name.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @name }\n end\n end",
"def new\n @u = U.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end"
] | [
"0.79043746",
"0.7789812",
"0.76272595",
"0.75811505",
"0.7581038",
"0.7546918",
"0.7513603",
"0.7477062",
"0.7446343",
"0.74113417",
"0.7382035",
"0.72367895",
"0.72031033",
"0.71898484",
"0.7185999",
"0.7159002",
"0.7158302",
"0.7136005",
"0.7136005",
"0.7136005",
"0.7134698",
"0.70931256",
"0.70917",
"0.70917",
"0.70810914",
"0.7071884",
"0.7065268",
"0.7011008",
"0.70011973",
"0.6985645",
"0.6965314",
"0.6937723",
"0.6926452",
"0.6897984",
"0.68955183",
"0.6888852",
"0.6888852",
"0.6888852",
"0.6888852",
"0.6886684",
"0.68863034",
"0.6883267",
"0.6874535",
"0.6831571",
"0.68305755",
"0.68224096",
"0.6813753",
"0.68037367",
"0.6795405",
"0.67891955",
"0.67891955",
"0.67891955",
"0.67831266",
"0.6775112",
"0.67660046",
"0.67660046",
"0.6761632",
"0.6736622",
"0.6735673",
"0.6732612",
"0.67306614",
"0.6723704",
"0.6723704",
"0.6723704",
"0.6716907",
"0.67168427",
"0.67165935",
"0.67165935",
"0.67165935",
"0.6715237",
"0.6715237",
"0.6715237",
"0.6712259",
"0.6704916",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732",
"0.6702732"
] | 0.78913903 | 6 |
POST /members POST /members.json | def create
@member = Member.new(params[:member])
respond_to do |format|
if @member.save
format.html { redirect_to @member, notice: 'Member was successfully created.' }
format.json { render json: @member, status: :created, location: @member }
else
format.html { render action: "new" }
format.json { render json: @member.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_member_to_list(user, list, member_id, options={})\n post(\"/#{user}/#{list}/members.json\", options.merge(:id => member_id))\n end",
"def create_member(data)\n headers = @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members\"), data)[1]\n id = Client.get_id_from_location_header(headers[:location])\n get_member(id)\n end",
"def create\n @member = @space.members.new(member_params)\n @member.user = current_user\n\n respond_to do |format| \n if @member.save\n @space.members << @member\n\n format.html { redirect_to space_member_url(@space, @member), notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: [@space, @member] }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = @current_enterprise.members.build(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_members\n @members = User.all\n end",
"def create_members\n project = Project.find(params[:id])\n\n params[:members].each do |member_id|\n user = User.find(member_id)\n project.users << user unless project.users.include?(user) \n end\n \n respond_to do |format|\n format.html { redirect_to project_path(@project), notice: 'members were successfully added.' }\n format.json { render json: @project, status: :created, location: @project }\n end\n end",
"def create\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n flash[:notice] = 'Member Created' if @project.members << @member\n respond_with @project, @member\n end",
"def create\n # type = \"member\"\n\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render action: 'show', status: :created, location: @member }\n else\n format.html { render action: 'new' }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to admin_member_path(@member), notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.json { render :show, status: :created, location: @member }\n else\n return api_error(status: :unprocessable_entity, message: @member.errors)\n end\n end\n end",
"def create\n @member = @organization.members.build(member_params)\n\n respond_to do |format|\n if @member.save\n logger.info(\"User #{current_user.email} created Member '#{@member.first_name} #{@member.last_name}' on #{@member.updated_at}\")\n format.html { redirect_to organization_path(@organization), notice: 'Member was successfully created.' }\n #format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end",
"def create\n\tif !checkadmin? then return end\n @member = Member.new(params[:member])\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #sanity checks, can only modify memberships that you own\n if params[:user_id].to_i != current_user.id then\n render json: {message:'You do not own the membership list'}, :status => :unprocessable_entity\n return\n end\n\n #ensure the membership params is there\n unless params.has_key? :memberships then\n #render json: {message:'memberships list not found'}, :status => :unprocessable_entity\n #return\n #this could me no membership at all\n params[:memberships] = {}\n end\n\n #set the new memberships state\n current_user.set_memberships params[:memberships]\n\n render json: {\n message:'message received from server',\n memberships:User.find(params[:user_id]).memberships.map{ |x| x.attributes.merge({club_name: x.club_name})}\n }\n end",
"def create\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save!\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = User.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save \n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @membership = @member.memberships.build(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership.member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_member.can_admin_members?\n @member = Member.new(params[:member])\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n # raise YAML::dump(@member)\n # raise @member.errors[0].to_s\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n else\n render_forbidden\n end\n end",
"def members\n raw_response = get_request('users/members')\n parse_response(raw_response, :users)\n end",
"def conference_list_members(params)\n path = @version + '/Conference/Member/List/'\n method = 'POST'\n return request(path, method, params)\n end",
"def add_member(id, user)\n client.post(\"#{path}/#{id}/members\", user)\n end",
"def members\n response = service.get_members\n response.map do |member_data|\n Member.new(member_data)\n end\n end",
"def post(member, request_opts={})\n unless member.is_a?(User)\n raise DataTypeError.new(\"User object is expected, but got [#{member.inspect}]\")\n end\n member = GroupMember.new(:group_id => self.id, :member_id => member.id)\n http(request_opts).post(resolved_path, member.as_hash)\n end",
"def create\n @member = Member.new(member_params)\n unless @member.set_region_admin == \"1\"\n @member.region_id = current_member.region_id\n end\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n @uplines = Member.order(\"fullname\")\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group_member = @client.group_members.new(group_member_params)\n respond_to do |format|\n if @group_member.save\n format.html { redirect_to client_group_member_path(@client,@group_member), notice: 'Group member was successfully created.' }\n format.json { render :show, status: :created, location: @group_member }\n else\n format.html { render :new }\n format.json { render json: @group_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @membership = Membership.new(params[:membership])\n @membership.member = current_member\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to sub_clubs_path, :notice => 'You requested membership.' }\n format.json { render :json => @membership, :status => :created, :location => @membership }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(create_params)\n respond_to do |format|\n if @member.save\n session[:member_id] = @member.id\n format.html { redirect_to @member }\n format.json { render action: 'show', status: :created, location: @member }\n else\n format.html { render action: 'new' }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n r = params[:member]\n @member = Member.where(:email => r[:email], :group_name => r[:group_name], :admin_uuid => session[:user_uuid]).first\n r = @member.attributes.merge(r) unless @member.nil?\n @member = Member.new(r) if @member.nil?\n @member.update_attributes(r) unless @member.nil?\n\n unless @member.err\n @member.get_member_uuid\n end\n respond_to do |format|\n unless @member.nil?\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n \n\n respond_to do |format|\n if @member.save\n format.html { redirect_to groups_path, notice: \"Member was successfully created.\" }\n format.json { render :show, status: :created, location: @member }\n format.js\n else\n format.html { redirect_back fallback_location: root_path, status: :unprocessable_entity }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: '出欠情報を保存しました' }\n format.json { render action: 'show', status: :created, location: @member }\n else\n format.html { render action: 'new' }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n r = params[:member]\n @member = Member.where(:email => r[:email], :group_name => r[:group_name], :admin_uuid => session[:user_uuid]).first\n r = @member.attributes.merge(r) unless @member.nil?\n @member = Member.new(r) if @member.nil?\n @member.update_attributes(r) unless @member.nil?\n unless @member.err\n @member.get_member_uuid\n end\n respond_to do |format|\n unless @member.nil?\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to controller: :login, action: :index, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new, layout: 'member_new' }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = GroupMember.new(params[:member])\n if @current_member.group.add_member @member\n render :json=>{success:true, new_id:@member.id}\n UserMailer.invite_email(@member.email).deliver\n else\n render :json=>{success:false, errors:@member.errors}\n end\n end",
"def create_team_member\n clinics = params[:clinics].split(\", \")\n\n team_member = TeamMember.create(\n email: params[:email],\n first_name: params[:first_name],\n last_name: params[:last_name],\n user: params[:user],\n status: \"Active\",\n role: params[:role]\n )\n\n clinics.each do |clinic|\n Clinic.find(clinic).team_members << team_member\n end\n\n render json: team_member, include: ['clinics']\n end",
"def sign_up\n\t\tif params[:uuid].present?\n\t\t\t@existing_member = Com::Nbos::User.where(uuid: params[:uuid])\n\t\t\tif @existing_member.present?\n\t\t\t\trender :json => @existing_member.first\n\t\t\telse\n\t\t\t\t@member = build_user(params)\n\t\t\t\tif @member && @member.save\n\t\t\t\t\trender :json => @member\n\t\t\t\telse\n\t\t\t\t\trender :json => {status: 500, message: @member.errors.messages}, status: 500\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\trender :json => {status: 400, message: \"Bad Request\"}, status: 400\n\t\tend\t\n\tend",
"def create\n\t\t@member = Member.new(params[:member])\n\n\t\trespond_to do |format|\n\t\t\tif @member.save\n\t\t\t\tformat.html { redirect_to(@member.membership, :notice => 'Member was successfully created.') }\n\t\t\t\tformat.xml\t{ render :xml => @member, :status => :created, :location => @member }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml\t{ render :xml => @member.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @member = Member.new(params[:member])\n @member.house = current_member.house\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to root_url, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_members\n members_ids = params[:contest][:members].reject(&:empty?)\n @contest.members.destroy_all if params[:action] == \"update\"\n members_ids.each do |members_id|\n member = Member.create(:user_id => members_id.to_i, :invitable => @contest)\n #send notification\n reciver = User.find(members_id)\n notifications = reciver.notifications.unread \n if reciver.notification_setting.try(:new_update)\n Notification.create(recepient_id: members_id, user: current_user, body: \"#{current_user.screen_name } has invited you to join a contest #{@contest.topic} \", notificable: @contest, :accept => false, :is_acceptable=>true)\n PrivatePub.publish_to \"/profiles/new_#{members_id}\", \"jQuery('#all-notifications').html('#{notifications.count}'); jQuery('#all-notifications').addClass('push-notification');\"\n\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n @creating_member = true\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'El miembro ha sido creado' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def member_params\n params.require(:member).permit(:first_name, :last_name, :email)\n end",
"def create\n @member = Member.new(member_params)\n @member.save\n if @member.save\n redirect_to members_path\n else render :new\n end\n end",
"def create\n @member = Member.new(params[:member])\n\n respond_to do |format|\n if @member.save\n add_plan_to_user_if_specified!\n \n format.html { redirect_to(@member, :notice => 'Member was successfully created.') }\n format.json { render :json => @member, :status => :created, :location => @member }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n if check_if_field_empty(member_params)\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n else\n @member = User.new(member_params)\n @member.tenant_id = current_tenant.id\n respond_to do |format|\n if @member.save\n add_roles(params[:roles])\n format.html { redirect_to member_path(@member), notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def index\n @members = Member.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n @members = Member.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n @members = Member.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def members_list\n @members = Member.active.ordered.all\n @user = current_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @members }\n end\n end",
"def create\n puts \"Is it here!?!?!\"\n @member = Member.new(params[:member])\n respond_to do |format|\n if @member.save \n format.html { redirect_to(@member, :notice => 'Member was successfully created.') }\n format.xml { render :xml => @member, :status => :created, :location => @member }\n format.json {render :json => @member, :status => :created, :location => @member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @member = Member.new\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def list_members(user, list)\n get(\"/#{user}/#{list}/members.json\")\n end",
"def create\n @membership = Adhocracy::Membership.new(membership_params)\n\n if @membership.save\n render json: @membership, status: :created, location: api_v1_membership_path(@membership)\n else\n render_validation_errors @membership.errors\n end\n end",
"def CreateMembership params = {}\n \n APICall(path: 'group_memberships.json',method: 'POST',payload: params.to_json)\n \n end",
"def index\n @members = Member.members\n @participants = Member.participants\n @invited_count = Member.count\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def create\n @members_client = MembersClient.new(members_client_params)\n\n respond_to do |format|\n if @members_client.save\n format.html { redirect_to @members_client, notice: 'Members client was successfully created.' }\n format.json { render :show, status: :created, location: @members_client }\n else\n format.html { render :new }\n format.json { render json: @members_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Profile created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @member = Member.find(params[:member_id])\n respond_with do |format|\n if @member.update_attributes(:registered => true)\n Log.make(session[:mem_id], {:member => @member.id, :action => :register})\n format.html { redirect_to member_register_path(@member.id, 1) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@room_member = RoomLinkMember.new(room_member_params)\n\t\t@room_member.room = @room\n\n\t\trespond_to do |format|\n\t\t\tif @room_member.save\n\t\t\t\tback_page = room_members_url\n\t\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\t\tback_page = params[:room_member][:redirect] unless params[:room_member][:redirect].empty?\n\t\t\t\tformat.html { redirect_to back_page, notice: 'Member was successfully created.' }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @room_member.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @membership = Membership.new(params[:membership])\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render json: @membership, status: :created, location: @membership }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @member = Member.new\n user = @member.build_user\n @roles = Role.find(:all)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def member_params\n params.require(:member).permit(:name, :email, :location_id, :plan_id, :status)\n end",
"def member_params\n params.require(:member).permit(:name, :address, :phone)\n end",
"def add_members(_members)\n _members.each do |_user_id|\n user_relationships.where(user_id: _user_id).first_or_create!(accepted_at: Time.current)\n end\n end",
"def member_params\n params.require(:member).permit(:name, :email, :password, :password_confirmation)\n end",
"def member_params\n params.require(:member).permit(:email, :name, :password, :admin)\n end",
"def member_params\n params.require(:member).permit(:first_name, :last_name, :email, :phone_number)\n end",
"def new\n @member = Member.new\n user = @member.build_user\n @roles = Role.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def create\n @member = Member.new(member_params)\n #@member.card_id = SecureRandom.uuid\n @member.magma_coins = 0\n add_abo_types_to_member(@member)\n respond_to do |format|\n if @member.save\n format.html { redirect_to current_user.present? ? @member : members_path, notice: t('flash.notice.creating_member') }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new, alert: t('flash.alert.creating_member') }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(params[:member])\n\n respond_to do |format|\n if @member.save\n flash[:notice] = 'Member was successfully created.'\n format.html { redirect_to(@member) }\n format.xml { render :xml => @member, :status => :created, :location => @member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to groups_path, notice: 'User was successfully added to group.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(params[:member])\n @member.new = false\n\n respond_to do |format|\n if @member.save\n flash[:notice] = 'Member was successfully created.'\n format.html { redirect_to members_url(@member) }\n format.xml { head :created, :location => member_url(@member) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @member.errors.to_xml }\n end\n end\n end",
"def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: \"Membership was successfully created.\" }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bulk_create_team_members(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/team-members/bulk-create',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def create\n @member = Member.new(params[:member])\n\n if @member.save\n flash[:notice] = 'Member was successfully created.'\n redirect_to about_path(@member.url)\n else\n render :action => \"new\"\n end\n end",
"def create\n @team_member = TeamMember.new(team_member_params)\n\n respond_to do |format|\n if @team_member.save\n format.html { redirect_to @team_member, notice: 'Team member was successfully created.' }\n format.json { render :show, status: :created, location: @team_member }\n else\n format.html { render :new }\n format.json { render json: @team_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_members\n HTTP.headers(:accept => @@accept, \"content-type\" => @@content_type).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/members\").parse[\"members\"]\n end",
"def create\n @team_member = TeamMember.new(team_member_params)\n\n respond_to do |format|\n if @team_member.save\n format.html { redirect_to @team_member, notice: \"Team member was successfully created.\" }\n format.json { render :show, status: :created, location: @team_member }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @team_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def member_params\n params.require(:member).permit(:user_name, :rank_id, :activity_status_id)\n end",
"def create\n @group_member = GroupMember.new(group_member_params(params)) \n if(@group_member.save)\n render json { head :no_content }\n else\n render json: { errors: @group_member.errors.full_messages, status: :unprocessable_entity }\n end\n end",
"def members\n return @members if @members\n @members = Client.get(\"/organizations/#{id}/members/all\").json_into(Member)\n end",
"def create\n @member = Member.new(params[:member])\n respond_to do |format|\n if @member.save\n flash[:notice] = 'El socio se guardo con exito.'\n format.html { redirect_to(members_path) }\n format.xml { render :xml => @member, :status => :created, :location => @member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @beneficiaire = Beneficiaire.find(params[:beneficiaire_id])\n @member = Member.new(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @beneficiaire, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html {redirect_to @beneficiaire, error: 'Member was not successfully created!' }\n format.json { render json: @beneficiaire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @elder_member = ElderMember.new(elder_member_params)\n\n respond_to do |format|\n if @elder_member.save\n format.html { redirect_to @elder_member, notice: 'Elder member was successfully created.' }\n format.json { render action: 'show', status: :created, location: @elder_member }\n else\n format.html { render action: 'new' }\n format.json { render json: @elder_member.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6734318",
"0.6707801",
"0.6686722",
"0.66615456",
"0.66511947",
"0.6612481",
"0.6595865",
"0.6569636",
"0.65571123",
"0.65534073",
"0.6552213",
"0.6539384",
"0.6535769",
"0.6534659",
"0.6526704",
"0.6526704",
"0.6526704",
"0.6526704",
"0.6507443",
"0.6491895",
"0.64855516",
"0.6444056",
"0.6438115",
"0.6432237",
"0.6381778",
"0.63506615",
"0.633389",
"0.6320233",
"0.63125044",
"0.6296577",
"0.6285939",
"0.6260866",
"0.6243256",
"0.62419695",
"0.6235628",
"0.6230964",
"0.6221535",
"0.6206678",
"0.61989975",
"0.6198766",
"0.6195274",
"0.61692333",
"0.61499345",
"0.61461765",
"0.61322707",
"0.6128204",
"0.61243147",
"0.610482",
"0.60986006",
"0.60858136",
"0.6081078",
"0.60711473",
"0.60711473",
"0.60711473",
"0.606397",
"0.60610056",
"0.60574186",
"0.6048943",
"0.6048343",
"0.60453993",
"0.6034205",
"0.6029672",
"0.6001707",
"0.5979131",
"0.5978772",
"0.597445",
"0.5967211",
"0.59661597",
"0.5964004",
"0.5942135",
"0.59390485",
"0.593679",
"0.5936454",
"0.59359664",
"0.59253806",
"0.59253806",
"0.59253806",
"0.59253806",
"0.59253806",
"0.59253806",
"0.59253806",
"0.5922752",
"0.59159386",
"0.59106994",
"0.5899083",
"0.58947736",
"0.58701307",
"0.5845734",
"0.5842589",
"0.5832748",
"0.58321124",
"0.58289725",
"0.5827997",
"0.581858",
"0.580515",
"0.57962",
"0.57887846",
"0.57838494"
] | 0.6571146 | 8 |
PUT /members/1 PUT /members/1.json | def update
@member = Member.find(params[:id])
respond_to do |format|
if @member.update_attributes(params[:member])
format.html { redirect_to @member, notice: 'Member was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @member.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n params.require(:member).permit(:name)\n if @member.update(member_params)\n format.html { redirect_to @member, notice: '更新しました' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # byebug \n respond_to do |format|\n if self.current_member && self.current_member.id == params[:id].to_i\n if @member.update(member_params)\n format.json { render :show, status: :ok, location: @member }\n else\n return api_error(status: :unprocessable_entity, message: @member.errors)\n end\n else\n return api_error(status: 401, message: '没有操作权限')\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n format.html { redirect_to @member, notice: \"Member was successfully updated.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update_attributes(params[:member])\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update!(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n unless @member.err\n @member.get_member_uuid\n end\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n unless @member.err\n @member.get_member_uuid\n end\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\tif !checkme? then return end\n\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to admin_member_path(@member), notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to space_member_url(@space, @member), notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: [@space, @member] }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_member\n member_id = params[:id]\n @member = Member.find(member_id)\n end",
"def update\n respond_to do |format|\n if @member.update(update_params)\n format.html { redirect_to @member }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @creating_member = false\n\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'El miembro ha sido actualizado' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_members\n unless self.list_members.blank?\n #create new members\n self.list_members.each do |api_member|\n member_params = {}\n api_member.each_pair do |key, value|\n unless key == \"id\"\n if Member.attribute_names.include? key\n member_params[key] = value\n end\n end\n end\n #member already exists\n temp = Member.find_by guid: member_params[\"guid\"]\n if !!temp\n temp.attributes = member_params\n if temp.valid? \n temp.save\n else\n return \"problem updating existing member\"\n end\n else\n member = Member.new(member_params)\n if member.valid?\n member.save\n else\n return \"problem with member params\"\n end\n end\n #delete denied members\n if api_member[\"connection_status\"] != \"CONNECTED\"\n Member.find_by(guid: member_params[\"guid\"]).delete\n Member.delete_member(self.guid, member_params[\"guid\"])\n end\n end\n end\n end",
"def update!(**args)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def set_member\n @member = User.find(params[:id])\n end",
"def set_member\n @member = @account.members.find(params[:id])\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n flash[:notice] = 'Member was successfully updated.'\n format.html { redirect_to '/members/myindex' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_member\n @member = Member.find(params[:member_id])\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n format.html { redirect_to(@member, :notice => 'Member was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n format.html { redirect_to(@member, :notice => 'Member was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @members = args[:members] if args.key?(:members)\n @resource = args[:resource] if args.key?(:resource)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n @role = args[:role] if args.key?(:role)\n end",
"def update\n\t\t@member = Member.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @member.update_attributes(params[:member])\n\t\t\t\tformat.html { redirect_to(@member, :notice => 'Member was successfully updated.') }\n\t\t\t\tformat.xml\t{ head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml\t{ render :xml => @member.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def set_member\n @member = @current_enterprise.members.find(params[:id])\n end",
"def set_member\n @member = User.find(params[:id])\n end",
"def update\n @member = Member.find(params[:id])\n respond_to do |format|\n if @member.update_attributes(params[:member])\n flash[:notice] = 'Member was successfully updated.'\n format.html { redirect_to member_url(@member) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors.to_xml }\n end\n end\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def set_member\n @member = Member.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @member == current_member && @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n @uplines = Member.where.not(id: @member.self_and_descendants.collect(&:id)).order(\"fullname\")\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @member_type = args[:member_type] if args.key?(:member_type)\n @person_id = args[:person_id] if args.key?(:person_id)\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to beneficiaire_member_path, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to({ action: :show, challenge_id: params[:challenge_id], id: @member.id}, notice: 'Member was successfully updated.' )}\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oc_member = OcMember.find(params[:id])\n\n respond_to do |format|\n if @oc_member.update_attributes(params[:oc_member])\n format.html { redirect_to @oc_member, notice: 'Oc member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oc_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n respond_to do |format|\n if @member.update_attributes(params[:member])\n flash[:notice] = \"Los datos del socio #{@member.name} #{@member.last_name} se actualizaron satisfactoriamente\"\n format.html { redirect_to(members_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_member_to_list(user, list, member_id, options={})\n post(\"/#{user}/#{list}/members.json\", options.merge(:id => member_id))\n end",
"def edit_vault_member(vault_id, user_id, status)\n request_put(\"/vault/#{vault_id}/member/#{user_id}\", status: status)\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n \n add_plan_to_user_if_specified!\n format.html { redirect_to(@member, :notice => 'Member was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n @member.new = false\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n flash[:notice] = 'Member was successfully updated.'\n format.html { redirect_to members_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member == current_member && @member.update(member_params)\n format.html { redirect_to @member, notice: 'Profile updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update!(**args)\n @role = args[:role] unless args[:role].nil?\n @members = args[:members] unless args[:members].nil?\n end",
"def set_member\n @member = @space.members.friendly.find(params[:id])\n end",
"def update\n addMembers\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n flash[:notice] = 'Member Successfully updated' if @member.update_attributes! params[:member]\n respond_with @project, @member\n end",
"def test_should_update_group_user_via_API_JSON\r\n # lookup user's membership\r\n get \"memberships/find.json?api_key=testapikey&user_id=4&group_id=1\"\r\n membership = JSON.parse(response.body)\r\n membership_id = membership['id']\r\n assert membership_id == 3, 'Incorrect membership id'\r\n assert membership['role_id'] == Role.find_by_rolename('user').id, 'Incorrect role id'\r\n \r\n # promote user to group admin\r\n put \"/memberships/#{membership_id}.xml\", :api_key => 'testapikey',\r\n :membership => {:user_id => 4,\r\n :group_id => 1,\r\n :role_id => Role.find_by_rolename('group_admin') }\r\n assert_response :success\r\n end",
"def update!(**args)\n @role = args[:role] if args.key?(:role)\n @members = args[:members] if args.key?(:members)\n end",
"def update\n @aiit_member = AiitMember.find(params[:id])\n\n respond_to do |format|\n if @aiit_member.update_attributes(params[:aiit_member])\n format.html { redirect_to @aiit_member, notice: 'Aiit member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aiit_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_user_member\n @user_member = User::Member.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n logger.info(\"User #{current_user.email} updated Member '#{@member.first_name} #{@member.last_name}' in properties \n '#{@member.audits.last.audited_changes}' on #{@member.updated_at}\")\n format.html { redirect_to organization_path(@organization), notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @attend, notice: 'Attend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6593529",
"0.64914197",
"0.64502794",
"0.6438251",
"0.6406436",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6333237",
"0.6329286",
"0.6317044",
"0.6317044",
"0.6271256",
"0.6264795",
"0.625334",
"0.6247124",
"0.6241427",
"0.62300926",
"0.61891276",
"0.6146912",
"0.6142657",
"0.6116533",
"0.61133075",
"0.61054933",
"0.61054933",
"0.61054933",
"0.61054933",
"0.61054933",
"0.6090762",
"0.6090276",
"0.6071333",
"0.6071333",
"0.6052475",
"0.6048699",
"0.60455555",
"0.6043108",
"0.60342574",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.6014334",
"0.60133636",
"0.5937189",
"0.5936435",
"0.59253603",
"0.59168965",
"0.5903101",
"0.5902096",
"0.58876044",
"0.5884985",
"0.5880149",
"0.58720237",
"0.58705354",
"0.5862272",
"0.58523023",
"0.58437926",
"0.58419234",
"0.5838252",
"0.5820515",
"0.5818514",
"0.58134925",
"0.5808162",
"0.5802292",
"0.57899725",
"0.5767241"
] | 0.640992 | 8 |
DELETE /members/1 DELETE /members/1.json | def destroy
@member = Member.find(params[:id])
@member.destroy
respond_to do |format|
format.html { redirect_to members_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n \n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n\tif !checkadmin? then return end\n\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to admin_member_members_path, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy!\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'El miembro ha sido eliminado' }\n format.json { head :no_content }\n end\n end",
"def destroy \n @oc_member = OcMember.find(params[:id])\n @oc_member.destroy\n\n respond_to do |format|\n format.html { redirect_to oc_members_url }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n arguments(args, required: [:org_name, :user])\n\n delete_request(\"/orgs/#{arguments.org_name}/members/#{arguments.user}\",\n arguments.params)\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n \n \n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: '削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html do\n redirect_to members_url,\n notice: 'Profile was successfully deleted.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html do\n redirect_to members_url,\n notice: 'Member was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n session[:member_id] = nil\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aiit_member = AiitMember.find(params[:id])\n @aiit_member.destroy\n\n respond_to do |format|\n format.html { redirect_to aiit_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n\n respond_to do |format|\n flash[:notice] = \"Destroyed user\"\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member.destroy\n\n respond_to do |format|\n flash[:notice] = \"Destroyed user\"\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n raise CanCan::AccessDenied if cannot? :delete, @member\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @who_member = WhoMember.find(params[:id])\n @who_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(who_members_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.deleted = true\n @member.save\n\n respond_to do |format|\n format.html { redirect_to members_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @elder_member.destroy\n respond_to do |format|\n format.html { redirect_to elder_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@room.members.destroy(params[:id])\n\t\trespond_to do |format|\n\t\t\tback_page = room_members_url\n\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\tback_page = params[:redirect] if params[:redirect]\n\t\t\tformat.html { redirect_to back_page, notice: 'Member was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @members_client.destroy\n respond_to do |format|\n format.html { redirect_to members_clients_url, notice: 'Members client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_member\n\n #@member = Member.find\n #@member.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n logger.info(\"#{Time.now} Se elimina el miembro ##{@member.id}!\")\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\t@member = Member.find(params[:id])\n\t\t@member.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(members_url) }\n\t\t\tformat.xml\t{ head :ok }\n\t\tend\n\tend",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to space_members_url(@space), notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to @user }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member = Member.find_by_url_or_id(params[:id])\n @member.destroy\n\n redirect_to(members_url)\n end",
"def destroy\n @dotsmember = Dotsmember.find(params[:id])\n @dotsmember.destroy\n\n respond_to do |format|\n format.html { redirect_to dotsmembers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hack_member.destroy\n respond_to do |format|\n format.html { redirect_to hack_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to attends_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership ||= Membership.find(params[:id])\n @membership.destroy\n\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to member_url(@membership.member), notice: 'Membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clnmember = Clnmember.find(params[:id])\n @clnmember.destroy\n\n respond_to do |format|\n format.html { redirect_to clnmembers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_member = GroupMember.find(params[:id])\n @group_member.destroy\n\n respond_to do |format|\n format.html { redirect_to group_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dc_member = DcMember.find(params[:id])\n @dc_member.destroy\n\n respond_to do |format|\n format.html { redirect_to dc_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member_type = MemberType.find(params[:id])\n @member_type.destroy\n\n respond_to do |format|\n format.html { redirect_to member_types_url }\n format.json { head :no_content }\n end\n end",
"def delete\n sql = 'DELETE FROM members WHERE id = $1'\n values = [@id]\n SqlRunner.run(sql, values)\nend",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/members?is_approved=0\" }\n format.json { head :no_content }\n end\n \n end",
"def \n \n\n # ADMIN ONLY:\n # Deleting a Member\n # delete /members/:id\n def destroy\n # Maybe this shouldn't be allowed if member has transactions?\n # Since calculations are based on all transactions from the\n # beginning of time, deleting a member's transactions would\n # impact the other members' debts...\n Member.find(params[:id]).destroy\n flash[:success] = \"Deleted\"\n redirect_to members_path\n end",
"def destroy\n organization = @member.organization \n\n @member.destroy\n logger.info(\"User #{current_user.email} destroyed Member '#{@member.first_name} #{@member.last_name}' on #{@member.updated_at}\")\n respond_to do |format|\n format.html { redirect_to organization, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_member path\n rewrite_members member_paths.delete(path)\n end",
"def destroy\n @member_info = MemberInfo.find(params[:id])\n @member_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(member_infos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url, notice: \"Membership was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url, notice: 'Membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if !current_member.the_admin?\n redirect_to \"/\", notice: \"Access denied\"\n return\n end\n\n @member.destroy unless @member.core_member?\n respond_to do |format|\n format.html { redirect_to members_url, notice: \"Member was#{@member.core_member? ? ' not' : ''} successfully destroyed.\"}\n format.json { head :no_content }\n end\n end",
"def destroy\n @crewmember.destroy\n respond_to do |format|\n format.html { redirect_to crewmembers_url, notice: 'Crewmember was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member = Member.find(params[:member_id])\n @sign = Sign.find(params[:id])\n @sign.destroy\n respond_to do |format|\n format.html { redirect_to member_signs_url( @member ) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.abo_types.delete_all\n respond_to do |format|\n if @member.destroy\n format.html { redirect_to members_url, notice: t('flash.notice.deleting_member') }\n format.json { head :no_content }\n else\n format.html { render :show, alert: t('flash.alert.deleting_member') }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @project_member.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: \"Member was successfully destroyed.\" }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n #@member = Member.find(params[:id])\n @member.destroy\n\n redirect_back_or_default(root_path)\n end",
"def remove_member_from_list(user, list, member_id)\n delete(\"/#{user}/#{list}/members.json?id=#{member_id}\")\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to family_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to family_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @member.email == \"admin@admin.com\"\n redirect_to logged_in_user, notice: \"Cannot Delete SuperUser.\"\n else\n Booking.where(member_id: @member.id).destroy_all\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def remove_member(id, user)\n client.delete(\"#{path}/#{id}/members\", user)\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n @group_member.destroy\n respond_to do |format|\n format.html { redirect_to client_group_members_url, notice: 'Group member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member_status.destroy\n respond_to do |format|\n format.html { redirect_to member_statuses_url, notice: 'Member status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meeting_member = MeetingMember.find(params[:id])\n @meeting_member.destroy\n\n respond_to do |format|\n format.html { redirect_to meeting_members_url }\n format.json { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n User.destroy(params[:id])\n flash[:notice] = \"Deleted member!\"\n redirect_to :action => :index\n end",
"def destroy\n User.destroy(params[:id])\n flash[:notice] = \"Deleted member!\"\n redirect_to :action => :index\n end",
"def destroy\n @image_member = ImageMember.find(params[:id])\n @image_member.destroy\n\n respond_to do |format|\n format.html { redirect_to image_members_url }\n format.json { head :no_content }\n end\n end",
"def del_member(_user_id)\n update!(del_members: [_user_id])\n end",
"def destroy\n if current_member.can_admin_admins?\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :ok }\n end\n else\n render_forbidden\n end\n end",
"def destroy\n @family_member = User.find(params[:id])\n @family_member.destroy\n respond_to do |format|\n format.html { redirect_to familymembers_path, notice: 'Family member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member_class.destroy\n respond_to do |format|\n format.html { redirect_to member_classes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end"
] | [
"0.7680797",
"0.76410586",
"0.76410586",
"0.76106364",
"0.76106364",
"0.75673884",
"0.75673884",
"0.7557034",
"0.7353036",
"0.7305875",
"0.7305875",
"0.7305875",
"0.7305875",
"0.7305875",
"0.7305875",
"0.7305875",
"0.7305875",
"0.7305875",
"0.7305875",
"0.72848064",
"0.7273386",
"0.72671366",
"0.7265493",
"0.7253187",
"0.724225",
"0.7229281",
"0.7225564",
"0.7217894",
"0.7197213",
"0.7194965",
"0.71765804",
"0.71765804",
"0.71765804",
"0.71765804",
"0.7148439",
"0.7142397",
"0.7142397",
"0.7120144",
"0.7075848",
"0.70693624",
"0.705393",
"0.7033648",
"0.70208454",
"0.70208454",
"0.69938093",
"0.6974766",
"0.69745874",
"0.6973859",
"0.69715935",
"0.6967548",
"0.69635016",
"0.6954537",
"0.69534117",
"0.6945183",
"0.6929608",
"0.6922908",
"0.6894308",
"0.68804514",
"0.68773127",
"0.6865603",
"0.6842234",
"0.6827479",
"0.68241465",
"0.6812918",
"0.6785065",
"0.6783764",
"0.6780989",
"0.6780864",
"0.67620784",
"0.67608225",
"0.6752186",
"0.67521626",
"0.6748349",
"0.6740476",
"0.6735861",
"0.6717466",
"0.66859317",
"0.66859317",
"0.6684628",
"0.66828644",
"0.6679252",
"0.6677192",
"0.6656303",
"0.66429937",
"0.66404754",
"0.6637595",
"0.66173697",
"0.66173697",
"0.6605784",
"0.65961117",
"0.65930736",
"0.65877295",
"0.6587657",
"0.65795857"
] | 0.75450885 | 12 |
Updates the lesson at which a student left off | def update_left_off(lesson_id)
update_attribute(:left_off, lesson_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubmit_students\n # self.lesson.students - self.students\n self.grades_course.students - self.students\n end",
"def kick_out\n @students = students.shift\n end",
"def update_scheduledlessons\n starts_on = Time.now\n course.lessons.all(order: :position).each do |lesson|\n unless scheduled_course.scheduled_lessons.where('lesson_id= ? and enrolment_id = ?',lesson.id, id ).first\n ScheduledLesson.create(student_user_id: self.student_user_id, enrolment_id: self.id, scheduled_course_id: scheduled_course.id, lesson_id: lesson.id )\n end\n end\n end",
"def update\n @current_lesson = @progress.lesson\n next_lesson = @current_lesson.next(@current_lesson)\n @progress.lesson = next_lesson\n respond_to do |format|\n if @progress.update(progress_params)\n format.html { redirect_to \"/students/#{@progress.student.id}\", notice: 'Progress was successfully updated.' }\n format.json { render :show, status: :ok, location: @progress }\n else\n format.html { render :edit }\n format.json { render json: @progress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@lesson = Lesson.find(params[:id])\n @lesson = @course.lessons.find(params[:id])\n\n respond_to do |format|\n if @lesson.update_attributes(params[:lesson])\n format.html { redirect_to [@course,@lesson], :notice => 'Lesson was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lesson.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_w_ans!(answer)\n\t\t# answer.points = points_for(answer.correct)\n\t\t\n\t\tanswer.points = points_for(answer, self.quiz_instance.quiz.quiz_type)\n\t\tanswer.save\n\n\t\tself.problem_stat = stat.update_w_ans!(answer)\n\t\t\n\t\tself.remaining = remaining - 1\n\t\tchange_problem\n\t\tsave\n\tend",
"def update\n @course = current_user.courses.find(params[:course_id])\n @course_lesson = @course.course_lessons.find(params[:id])\n respond_to do |format|\n if @course_lesson.update_attributes(params[:course_lesson])\n format.html { redirect_to @course, notice: 'Course lesson was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course_lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reindex!\n Student.update_recent_student_assessments!\n end",
"def update_if_next_lesson\n if self.lesson_id.changed? || self.part_id.changed?\n avaliable_lessons.each_with_index do |lesson, index|\n next_lesson = lesson[i+1]\n if next_lesson_in_list\n self.save\n else\n #Error ActiveRecord::RecordNotSaved: Failed to save the record\n end\n end\n end\n end",
"def update(time_passed)\n @invincibility -= time_passed\n end",
"def update_student_campus_involvement\n # TODO: this has been refactored into CampusInvolvement#update_student_campus_involvement. \n # However, in the intereste of not breaking things, I'll leave it how it is here until I\n # have time to move it and test it thoroughly. -AR June 24, 2010\n #\n logger.warn \"WARNING: CampusInvolvementsController#update_student_campus_involvement is deprecated, call CampusInvolvement#update_student_campus_involvement instead\"\n \n @student = true\n @campus_ministry_involvement = @campus_involvement.find_or_create_ministry_involvement\n \n # restrict students to making ministry involvements of their role or less\n if ministry_role_being_updated = (params[:ministry_involvement] && mr_id = params[:ministry_involvement][:ministry_role_id])\n \n requested_role = MinistryRole.find params[:ministry_involvement][:ministry_role_id]\n requested_role ||= MinistryRole.default_student_role\n \n # note that get_my_role sets @ministry_involvement as a side effect\n if !(get_my_role.is_a?(StaffRole) && requested_role.is_a?(StudentRole)) && requested_role.position < get_my_role.position\n \n flash[:notice] = \"You can only set ministry roles of less than or equal to your current role\"\n ministry_role_being_updated = false\n params[:ministry_involvement][:ministry_role_id] = @campus_ministry_involvement.ministry_role_id.to_s\n end\n end\n\n\n # record history\n record_history = !@campus_involvement.new_record? && \n (@campus_involvement.school_year_id.to_s != params[:campus_involvement][:school_year_id] || \n @campus_ministry_involvement.ministry_role_id.to_s != params[:ministry_involvement][:ministry_role_id] || \n @campus_involvement.campus_id.to_s != params[:campus_involvement][:campus_id])\n if record_history\n @history = @campus_involvement.new_student_history\n @history.ministry_role_id = @campus_ministry_involvement.ministry_role_id\n end\n\n \n # update the records\n \n graduated_school_year = SchoolYear.first(:conditions => [\"#{SchoolYear._(:name)} = 'Graduated'\"])\n if params[:campus_involvement][:school_year_id].to_i == graduated_school_year.id\n # they are graduating\n # instead of updating the campus involvement directly we'll update their ministry involvement\n # this will in turn set all of their campus involvements to 'Graduated'\n \n ministry_role_being_updated = false # don't update it again later\n \n alumni_ministry_role = MinistryRole.first(:conditions => {:name => \"Alumni\"})\n @campus_ministry_involvement.ministry_role = alumni_ministry_role\n @campus_ministry_involvement.save!\n else\n @campus_involvement.update_attributes :school_year_id => params[:campus_involvement][:school_year_id]\n end\n @campus_involvement.update_attributes :campus_id => params[:campus_involvement][:campus_id]\n\n if ministry_role_being_updated\n @campus_ministry_involvement.ministry_role = requested_role\n @campus_ministry_involvement.save!\n end\n \n if record_history && @campus_involvement.errors.empty? && @campus_ministry_involvement.errors.empty?\n @history.save!\n @campus_involvement.update_attributes :last_history_update_date => Date.today\n end\n \n unless @campus_involvement.errors.empty?\n set_roles\n end\n end",
"def admit_student(student, house)\n raise \"You're too young\" if false #(Date.today - Date.new(*student.bday.split('-').map{|e| e.to_i})).year < 10\n student.year = 1\n student.house = house.name\n student.admit_date = Time.now\n house.add_student(student)\n end",
"def update\n @student = Student.find(params[:student_id])\n @lunchdetention = @student.lunchdetentions.find(params[:id])\n\n respond_to do |format|\n if @lunchdetention.update_attributes(params[:lunchdetention])\n format.html { redirect_to :back, notice: 'lunchdetention was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lunchdetention.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lesson = current_user.organization.lessons.find(params[:id])\n\n respond_to do |format|\n if @lesson.update_attributes(params[:lesson])\n flash[:notice] = 'Lesson was successfully updated.'\n format.html { redirect_to(@lesson) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lesson.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_standings\n system(\"clear\")\n puts \"#{previous_player} spelled #{fragment}.\"\n puts \"#{previous_player} gets a letter!\"\n\n losses[previous_player] += 1\n\n if losses[previous_player] == MAX_LOSS_COUNT\n puts \"#{previous_player} has been eliminated!\"\n end\n\n display_standings\n\n sleep(2)\n end",
"def update\n if (@lesson.completed && params[:lesson][:completed] == 'false') || !@lesson.completed\n @lesson.completed = !@lesson.completed\n @lesson.save\n end\n respond_to do |format|\n format.html { redirect_to lessons_url, notice: 'Lesson was successfully updated.' }\n format.json { render :show, status: :ok }\n end\n end",
"def update\n @course = Course.find(params[:course_id])\n @lesson = Lesson.find(params[:id])\n respond_to do |format|\n if @lesson.update(lesson_params)\n format.html { redirect_to course_lesson_path(@course, @lesson), notice: 'lesson was successfully updated.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@student_orig = Student.find(params[:id])\n\t\t@student = Student.find(params[:id])\n\t\tanalyze_update_params(params, 'student')\t# TODO-PER: debugging code\n#\t\tredirect_to(@student, :notice => \"NOTICE: During initial testing, the modification of students has been turned off.\")\n#\t\treturn\n\t\tp = params[:student]\n\t\timage_id = nil\n\t\tif p[:main_image] && p[:main_image].length > 0\n\t\t\tarr = p[:main_image].split('/')\n\t\t\tif arr.length > 1\n\t\t\t\timage_id = arr[1].to_i\n\t\t\t\tif image_id == 0\n\t\t\t\t\timage_id = nil\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tok = AttendedYear.validate_attended(p[:attended_lls], p[:years_lls], @student)\n\t\tok = AttendedYear.validate_attended(p[:attended_lfa], p[:years_lfa], @student) if ok\n\t\tif ok\n\t\t\thash = { :original_name => p['original_name'], :sort_name => Student.make_sort_name(p['original_name']), :other_name => p['other_name'], :gender => p['gender'] == 'Male' ? 'M' : 'F',\n\t\t\t\t:room_and_board => p['room_and_board'], :home_town => p['home_town']['town'], :home_state => p['home_town']['state'], :home_country => p['home_town']['country'],\n\t\t\t\t:born => VagueDate.factory(p['born']).to_s, :died => VagueDate.factory(p['died']).to_s,\n\t\t\t\t:other_education => p['other_education'], :admitted_to_bar => p['admitted_to_bar'], :training_with_other_lawyers => p['training_with_other_lawyers'],\n\t\t\t\t:federal_committees => p['federal_committees'], :state_committees => p['state_committees'], :biographical_notes => p['biographical_notes'], :quotes => p['quotes'],\n\t\t\t\t:citation_of_attendance => p['citation_of_attendance'], :secondary_sources => p['secondary_sources'], :additional_notes => p['additional_notes'],\n\t\t\t\t:benevolent_and_charitable_organizations => p['benevolent_and_charitable_organizations'], :is_stub => 0, :image_id => image_id,\n\t\t\t\t:private_notes => p['private_notes']\n\t\t\t}\n\t\t\t@student.original_name = p['original_name']\n\t\t\t@student.generate_unique_name()\n\t\t\tok = @student.update_attributes(hash)\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tif ok\n\t\t\t\tformat.html {\n\t\t\t\t\tStudentProfession.remove_student(@student.id)\n\t\t\t\t\tprofessions = parse_array(p['professions'])\n\t\t\t\t\tprofessions.each {|profession|\n\t\t\t\t\t\tif profession['name'].to_i > 0\n\t\t\t\t\t\t\tStudentProfession.add_connection(@student.id, profession['name'].to_i)\n\t\t\t\t\t\telsif profession['writein'] && profession['writein'].length > 0\n\t\t\t\t\t\t\tStudentProfession.add(@student.id, profession['writein'])\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\tStudentPoliticalParty.remove_student(@student.id)\n\t\t\t\t\tparties = parse_array(p['political_parties'])\n\t\t\t\t\tparties.each {|party|\n\t\t\t\t\t\tif party['name'].to_i > 0\n\t\t\t\t\t\t\tStudentPoliticalParty.add_connection(@student.id, party['name'].to_i)\n\t\t\t\t\t\telsif party['writein'] && party['writein'].length > 0\n\t\t\t\t\t\t\tStudentPoliticalParty.add(@student.id, party['writein'])\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\t# First convert all the govt_post references to names.\n\t\t\t\t\tfed_posts = parse_array(p['Federal'])\n\t\t\t\t\tfed_posts.each {|post|\n\t\t\t\t\t\tif post['name'].to_i > 0\n\t\t\t\t\t\t\tpost['writein'] = GovernmentPost.find(post['name'].to_i).title\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\tstate_posts = parse_array(p['State'])\n\t\t\t\t\tstate_posts.each {|post|\n\t\t\t\t\t\tif post['name'].to_i > 0\n\t\t\t\t\t\t\tpost['writein'] = GovernmentPost.find(post['name'].to_i).title\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\tlocal_posts = parse_array(p['Local'])\n\t\t\t\t\tlocal_posts.each {|post|\n\t\t\t\t\t\tif post['name'].to_i > 0\n\t\t\t\t\t\t\tpost['writein'] = GovernmentPost.find(post['name'].to_i).title\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\t# rewrite all the govt posts\n\t\t\t\t\tGovernmentPost.remove_student(@student.id)\n\t\t\t\t\tfed_posts.each {|post|\n\t\t\t\t\t\tif post['writein'] && post['writein'].length > 0\n\t\t\t\t\t\t\tGovernmentPost.create({ :student_id => @student.id, :which => 'Federal', :title => post['writein'], :modifier => post['modifier'],\n\t\t\t\t\t\t\t\t:location => post['location'], :time_span => post['time_span']})\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\tstate_posts.each {|post|\n\t\t\t\t\t\tif post['writein'] && post['writein'].length > 0\n\t\t\t\t\t\t\tGovernmentPost.create({ :student_id => @student.id, :which => 'State', :title => post['writein'], :modifier => post['modifier'],\n\t\t\t\t\t\t\t\t:location => post['location'], :time_span => post['time_span']})\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\tlocal_posts.each {|post|\n\t\t\t\t\t\tif post['writein'] && post['writein'].length > 0\n\t\t\t\t\t\t\tGovernmentPost.create({ :student_id => @student.id, :which => 'Local', :title => post['writein'], :modifier => post['modifier'],\n\t\t\t\t\t\t\t\t:location => post['location'], :time_span => post['time_span']})\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\n\t\t\t\t\tresidences = parse_array(p['residence'])\n\t\t\t\t\tStudentResidence.remove_student(@student.id)\n\t\t\t\t\tresidences.each {|residence|\n\t\t\t\t\t\tif residence['town'].strip().length > 0 || residence['state'].strip().length > 0 || residence['country'].strip().length > 0\n\t\t\t\t\t\t\tStudentResidence.create_residence(@student, residence)\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\n\t\t\t\t\tOffsiteMaterial.remove_student(@student.id)\n\t\t\t\t\toffsite_materials = parse_array(p['offsite_material'])\n\t\t\t\t\toffsite_materials.each {|offsite_material|\n\t\t\t\t\t\tif offsite_material['name'] && offsite_material['url'] && offsite_material['name'].length > 0 && offsite_material['url'].length > 0\n\t\t\t\t\t\t\tOffsiteMaterial.create({ :student_id => @student.id, :name => offsite_material['name'], :url => offsite_material['url'] })\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\n\t\t\t\t\tMarriage.remove_student(@student.id)\n\t\t\t\t\tRelation.remove_student(@student.id)\n\t\t\t\t\tmarriages = parse_array(p['marriage'])\n\t\t\t\t\tmarriages.each {|marriage|\n\t\t\t\t\t\tif marriage['name'] && marriage['name'].length > 0\n\t\t\t\t\t\t\tMarriage.create_marriage(@student, { :name => marriage['name'] }, marriage['date'])\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\n\t\t\t\t\trelations = parse_array(p['relationship'])\n\t\t\t\t\trelation_data = { 'Brother' => 'M',\n\t\t\t\t\t\t'Sister' => 'F',\n\t\t\t\t\t\t'Daughter' => 'F',\n\t\t\t\t\t\t'Son' => 'M',\n\t\t\t\t\t\t'Husband' => 'M',\n\t\t\t\t\t\t'Wife' => 'F',\n\t\t\t\t\t\t'Father' => 'M',\n\t\t\t\t\t\t'Mother' => 'F'\n\t\t\t\t\t}\n\t\t\t\t\trelations.each {|relation|\n\t\t\t\t\t\tif relation['type'] != '' && relation['name'].strip().length > 0\n\t\t\t\t\t\t\tRelation.create_relationship(relation['type'], { :name => relation['name'], :gender => relation_data[relation['type']] }, @student)\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\n\t\t\t\t\tmats = parse_array(p['material'])\n\t\t\t\t\tStudentMaterial.remove_student(@student.id)\n\t\t\t\t\tmats.each {|material|\n\t\t\t\t\t\tif material[:name]\n\t\t\t\t\t\t\tm = Material.find_by_name(material[:name])\n\t\t\t\t\t\t\tmaterial[:idd] = m.id if m\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif material[:idd]\n\t\t\t\t\t\t\tStudentMaterial.create({ :student_id => @student.id, :material_id => material[:idd], :relationship => material[:relationship], :material_comment => material[:material_comment]})\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\n\t\t\t\t\tAttendedYear.remove_student(@student.id)\n\t\t\t\t\tAttendedYear.add(@student.id, 'LLS', p['years_lls']) if p['attended_lls']\n\t\t\t\t\tAttendedYear.add(@student.id, 'LFA', p['years_lfa']) if p['attended_lfa']\n\n\t\t\t\t\t# Now that all the other data has been set, recreate the unique name\n\t\t\t\t\t@student.generate_unique_name()\n\t\t\t\t\t@student.save!\n\n\t\t\t\t\t# Now let everyone who is interested know about the changed record.\n\t\t\t\t\tBrowse.student_changed(@student, @student_orig)\n\t\t\t\t\tsolr().remove_object(@student_orig.to_solr())\n\t\t\t\t\tsolr().add_object(@student.to_solr())\n\t\t\t\t\tredirect_to(@student, :notice => 'The student was successfully updated.')\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tformat.html {\n\t\t\t\t\t@page_title = 'Student'\n\t\t\t\t\tedit_setup('')\n\t\t\t\t\trender :action => \"edit\"\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tend",
"def terminate_now\n current_assignment = self.student.student_teams.current.first\n if current_assignment.nil?\n return true \n else\n current_assignment.end_date = Date.current\n current_assignment.update_attribute(:end_date, Date.current)\n end\n end",
"def student_change(student_id)\n logger.debug \"student_change called\"\n # put everything in a hash for use in the view.\n @studentchanges = Hash.new\n @studentchanges[\"student\"] = Student.find(student_id)\n startdate = Date.today - (Integer(current_user.history_back) rescue 100)\n enddate = Date.today + (Integer(current_user.history_forward) rescue 7)\n # override for testing only\n #startdate = Date.parse('4-4-2018')\n #enddate = Date.parse('5-4-2018')\n @studentchanges[\"startdate\"] = startdate\n @studentchanges[\"enddate\"] = enddate\n\n # provide ability to display userids ( = email address)\n @users = User\n .select(:id, :email)\n .all\n @user_names = {}\n @users.each do |o|\n @user_names[o.id] = o.email\n end\n # now collate the changes\n # slotes o interest - in the date range\n myslots = Slot.select(:id).where(timeslot: startdate..enddate)\n # all lessons in those slots\n mylessons = Lesson.select(:id).where(slot_id: myslots)\n # all roles for this student in these lessons\n myroles = Role.select(:id, :lesson_id).where(student_id: student_id, lesson_id: mylessons)\n myroleslessonsids = myroles.map {|o| o.lesson_id} # for code efficiency later\n # now reduce to only lessons that have this student\n mylessons = mylessons.select { |o| myroleslessonsids.include?(o.id) ? true : false }\n #now get full details on these relevant lessons - slot info required in display \n mylessons = Lesson\n .joins(:slot)\n .where(id: mylessons.map {|o| o.id})\n .includes(:slot)\n # lookup table into lessons to reduce db activity.\n mylessonsindex = {} # key = session id , value is index in lessons object array \n mylessons.each_with_index do |v, i|\n mylessonsindex[v.id] = i\n end\n # ditto lookup table for tutroles\n myrolesindex = {} # key = session id , value is index in lessons object array \n myroles.each_with_index { |v, i| myrolesindex[v.id] = i }\n # go and get the relevent changes from the change table \n changelessons = Change.where(table: 'Lesson', rid: mylessons.map {|o| o.id})\n changeroles = Change.where(table: 'Role', rid: myroles.map {|o| o.id})\n changestudent = Change.where(table: 'Student', rid: student_id)\n # generate the data for display - go through each category\n #byebug\n makeDsp = lambda{|h, o| \n h['user'] = @user_names[o.user]\n h['modified'] = o.modified\n h['table'] = o.table\n h['field'] = o.field\n h['id'] = o.id\n h['value'] = o.value\n h\n }\n @dsp = Array.new\n changelessons.each do |o|\n h = makeDsp.call(Hash.new(), o)\n h['timeslot'] = mylessons[mylessonsindex[o.rid]].slot.timeslot\n h['location'] = mylessons[mylessonsindex[o.rid]].slot.location\n @dsp.push(h)\n end\n changeroles.each do |o| \n h = makeDsp.call(Hash.new(), o)\n h['timeslot'] = mylessons[mylessonsindex[myroles[myrolesindex[o.rid]].lesson_id]].slot.timeslot\n h['location'] = mylessons[mylessonsindex[myroles[myrolesindex[o.rid]].lesson_id]].slot.location\n @dsp.push(h)\n end\n # only dealing with a single student\n #byebug\n if changestudent.length > 0\n changestudent.each do |this|\n h = makeDsp.call(Hash.new(), this)\n h['timeslot'] = ''\n h['location'] = ''\n @dsp.push(h)\n end\n end\n # sort in modified date order\n @dsp = @dsp.sort_by{ |q| q['modified']}.reverse\n # now store all these changes in passed display data\n @studentchanges[\"data\"] = @dsp\n @studentchanges\n end",
"def update\n # @topic = current_user.topics.find(params[:lesson][:topic_id])\n # @course = @topic.courses.first\n\n # @lesson.title = 'New Lesson (rename)' if params[:title] = ''\n respond_to do |format|\n if @lesson.update(lesson_update)\n format.html { redirect_to course_topic_lesson_path(@lesson.topic.course, @lesson.topic, @lesson), notice: 'Lesson was updated created.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def runremovelessonfromslot(lesson)\n this_error = \"\"\n # Processing the chain.\n #--------------------- role (actually lesson)-----------------------------\n this_error = get_role_chain_and_block(lesson, {'all' => true})\n return this_error if this_error.length > 0\n #person_type = role.is_a?(Role) ? 'student' : 'tutor'\n #--------------------- check all lessons are empty ----------------------\n (0..@block_roles.length-1).each do |i|\n if @block_roles[i].tutroles.count > 0\n this_error += \" Tutors in this lesson\"\n end\n if @block_roles[i].roles.count > 0\n this_error += \" Students in this lesson\"\n end\n if this_error.length > 0\n return \"You cannot remove lessons as \" + this_error\n end\n end\n #--------------------------- update db ------------------------------\n begin\n Role.transaction do\n (0..@block_roles.length-1).each do |i|\n #@block_roles[i].update!(lesson_id: block_lessons[i].id) # change to the database\n @block_roles[i].destroy! # change to the database\n # all saved safely, now need to update the browser display (using calendar messages)\n # the object_id will now change (for both move and copy as the inbuild\n # lesson number will change.\n end\n if @role_breakchainlast # break the chain.\n @role_breakchainlast.update!(next: nil)\n end\n end\n rescue ActiveRecord::RecordInvalid => exception\n logger.debug \"rollback exception: \" + exception.inspect\n #this_exception = exception\n logger.debug \"Transaction failed!!!\"\n this_error = \"Transaction failed!!! \" + exception.inspect\n end\n if this_error.length > 0\n logger.debug \"unprocessable entity(line 117): \" + this_error \n return this_error\n end\n #--------------------------- update dom ------------------------------\n @domchangerun = Array.new\n @block_roles.each_with_index do |o, i|\n logger.debug \"block_role (\" + i.to_s + \"): \" + o.inspect\n @domchangerun[i] = Hash.new\n @domchangerun[i]['action'] = 'removeLesson'\n @domchangerun[i]['object_type'] = 'lesson'\n @domchangerun[i]['new_slot_domid'] = o.slot.location[0,3] +\n o.slot.timeslot.strftime(\"%Y%m%d%H%M\") +\n 'l' + o.slot.id.to_s\n @domchangerun[i]['object_id'] = @domchangerun[i]['new_slot_domid'] + \n 'n' + o.id.to_s\n end\n # No breakchainlast updates necessary for display. \n ############ now need to add processing for screen update #################\n # Now do the breakchainlast\n if @role_breakchainlast # break the chain.\n # Need to display the linkage change on the display\n # @role_breakchainlast is the role\n # display is an update (not a removal) so must rerender\n # build using the role\n o = @role_breakchainlast # lesson object\n @domchangebreakchainlast = Hash.new\n @domchangebreakchainlast['action'] = 'replace' \n @domchangebreakchainlast['object_type'] = 'lesson'\n @domchangebreakchainlast['new_slot_id'] = o.slot.location[0,3] +\n o.slot.timeslot.strftime(\"%Y%m%d%H%M\") +\n 'l' + o.slot_id.to_s\n @domchangebreakchainlast['object_id'] = @domchangebreakchainlast['new_slot_id'] +\n 'n' + o.id.to_s\n # This is rendering a lesson\n @domchangebreakchainlast['html_partial'] = \n render_to_string(\"calendar/_schedule_lesson_ajax.html\",\n :formats => [:html], :layout => false,\n :locals => {:slot => @domchangebreakchainlast['new_slot_id'],\n :lesson => o,\n :thistutroles => o.tutroles,\n :thisroles => o.roles\n })\n end\n #--------------------------- update screens ------------------------------\n # saved safely, now need to update the browser display (using calendar messages)\n # collect the set of screen updates and send through Ably as single message\n domchanges = Array.new\n (0..@block_roles.length-1).each do |i|\n domchanges.push(@domchangerun[i])\n end\n domchanges.push(@domchangebreakchainlast)\n ably_rest.channels.get('calendar').publish('json', domchanges)\n #(0..@block_roles.length-1).each do |i|\n # ably_rest.channels.get('calendar').publish('json', @domchangerun[i])\n #end\n # Now send out the updates to the stats screen\n # collect the set of stat updates and send through Ably as single message\n statschanges = Array.new\n (0..@block_roles.length-1).each do |i|\n statschanges.push(get_slot_stats(@domchangerun[i]['new_slot_domid']))\n end\n ably_rest.channels.get('stats').publish('json', statschanges)\n #(0..@block_roles.length-1).each do |i|\n # get_slot_stats(@domchangerun[i]['new_slot_domid'])\n #end\n # everything is completed successfully.\n respond_to do |format|\n format.json { render json: @domchange, status: :ok }\n end\n return \"\"\n end",
"def do_course\n\n # set a couple of variables with the params object\n @course = Course.find_by_id(params[:course_id])\n @lectures = Lecture.find_by_course_id(params[:course_id])\n @course_id = params[:course_id]\n @lesson_id = params[:lesson_id]\n\n # -------check if course is over\n first_id_in_course = Lecture.select(:id).where(course_id: @course_id).first\n last_id_in_course = Lecture.select(:id).where(course_id: @course_id).last\n\n # -------check if lesson is over\n # get first and last lecture of this lesson for traversing the quiz\n first_id_in_lesson = Lecture.select(:id).where(course_id: @course_id, lesson_id: @lesson_id).first\n last_id_in_lesson = Lecture.select(:id).where(course_id: @course_id, lesson_id: @lesson_id).last\n\n\n # this is the id of the current lecture\n #@lecture_id = first_id_in_lesson.id.to_i + params[:lecture_id].to_i - 1\n @lecture_id = params[:lecture_id].to_i\n\n # is the course over? => set the flag accordingly\n if @lecture_id == last_id_in_course.id.to_i\n @course_over = true\n else\n @course_over = false\n end\n\n # is the lesson over? => set the flag accordingly\n if @lecture_id == last_id_in_lesson.id.to_i\n @lesson_over = true\n else\n @lesson_over = false\n end\n\n # retrieve the lesson and the quiz content\n @lesson = Lesson.where(course_id: params[:course_id]).first\n @lecture = Lecture.find(@lecture_id)\n @answer = @lecture.quizAnswers\n @options = @lecture.quizOptions.split(\"-\")\n\n # percentage of the lesson the user has already taken\n @progress = 100.*(@lecture_id.to_f - first_id_in_lesson.id.to_f)/(last_id_in_lesson.id.to_f - first_id_in_lesson.id.to_f)\n\n # these are the course, lesson and lecture ids for the next question\n if @course_over\n @params = {user_id: current_user,\n course_id: @course_id, lesson_id: @lesson_id, lecture_id: @lecture_id, save: 'true'}\n elsif @lesson_over\n course_id_next = params[:course_id]\n lesson_id_next = params[:lesson_id].to_i + 1\n lecture_id_next = params[:lecture_id].to_i + 1\n @params = {course_id: course_id_next, lesson_id: lesson_id_next, lecture_id: lecture_id_next}\n else\n course_id_next = params[:course_id]\n lesson_id_next = params[:lesson_id]\n lecture_id_next = params[:lecture_id].to_i + 1\n @params = {course_id: course_id_next, lesson_id: lesson_id_next, lecture_id: lecture_id_next}\n end\n\n end",
"def update\n respond_to do |format|\n if @lesson.update(lesson_params)\n format.html { redirect_to course_lesson_path(@lesson, course_id: @lesson.course.id), notice: 'Lesson was successfully updated.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def lose_a_point\n\n self.score -= 1\n\n end",
"def update_student_progress\n @student = Student.find(params[:id])\n if !@student.progress.nil?\n @progress = @student.progress\n redirect_to edit_progress_path(@progress)\n else\n redirect_to \"/new_progress/#{@student.id}\"\n end\n end",
"def initialize_learnt_words(student)\n words = Word.where(\"grade < ?\", student.grade)\n \n words.each do |w|\n student.student_learnt_words.create(\n current_strength: 0.0,\n strength_history: \"\",\n test_interval: 0,\n test_date_array: \"\",\n word_id: w.id\n )\n end\n \n student.student_learnt_words\n end",
"def decline\n @join_team_request.status = 'D'\n @join_team_request.save\n redirect_to view_student_teams_path student_id: params[:teams_user_id]\n end",
"def update\n @student = @user.student\n @subject_competency_array = params[:student][:subjects_of_interest]\n #remove subjects in dB before update\n @student[:subjects_of_interest].delete_if do |s|\n s != nil\n end\n @student.save\n @subject_competency_array.each do |s|\n @student.subjects_of_interest.push({\n \"subject\" => s[:subject],\n \"competency\" => s[:competency]\n })\n end\n @student.save\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to user_profile_url, notice: 'Profile was successfully updated.' }\n else\n render :action => 'new'\n end\n end\n end",
"def fail_student (student_name,test_name)\n test_to_change = BoatingTest.all.select {|test|\n test.name == test_name &&\n test.student.first_name == student_name &&\n test.instructor == self\n }\n\n if test_to_change[0] == nil\n test_to_change << BoatingTest.new(Student.find_student(student_name),test_name, \"failed\", self)\n else\n test_to_change[0].status = \"failed\"\n end\n test_to_change\n end",
"def set_lesson\n @lesson = Lesson.find(params[:id])\n @course = @lesson.course\n end",
"def update\n respond_to do |format|\n if @lesson.update(lesson_params)\n format.html { redirect_to @course, notice: 'Lesson was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lesson = Lesson.find(params[:id])\n\n respond_to do |format|\n if @lesson.update_attributes(params[:lesson])\n format.html { redirect_to @lesson, notice: 'Lesson was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Identify current level before being saved\n @old_level = @student.current_level\n \n respond_to do |format|\n\n if @student.update(student_params)\n\n #When saved, if current_level is different to the new current level\n if params[:current_level] != @old_level\n @skills = Skill.where(level_id: @student.current_level).all\n @student_skills = StudentSkill.where(student_id: @student).all\n #Delete all student_skills\n @student_skills.destroy_all\n #Add all skills for new level\n @skills.each do |skill|\n @student_skill = StudentSkill.new(\n student_id: @student.id,\n skill_id: skill.id,\n level_id: skill.level_id,\n competency_level_id: 1)\n @student_skill.save\n @student.update_attributes(competent_but_waiting: true)\n end\n\n @new_level = Level.find(@student.current_level)\n #Add certificate post to timeline\n @certificate = Post.new(\n student_id: @student.id,\n user_id: current_user.id,\n body: \"you graduated to #{@new_level.title}!\",\n certificate: true,\n level_id: @new_level.id\n )\n @certificate.save!\n end\n\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_student\n name = ask_for(\"name of the student you want to change\")\n selected_student = find_student(name)\n print_names(selected_student)\n confirmation = ask_for(\" Y/N to modify\")\n if confirmation.downcase == \"y\"\n selected_student.first[:name] = ask_for(\"New name\")\n selected_student.first[:cohort] = ask_for(\"New cohort\")\n selected_student.first[:hobbies] = ask_for(\"New hobbies\")\n @students.map! {|student| (student[:name] == selected_student.first[:name]) ? selected_student.first : student }\n end\nend",
"def changeTA\n\t@courseToUpd = TeachingAssistant.where(\"course_number LIKE \" + \tparams[:course] + \" AND section_number LIKE \" + params[:section])\n\n\tif (@courseToUpd.length > 0) \n\t\n\t\t@courseToUpd[0].update(:user_id => params[:userID])\n\telse \n\t\t@newRelation = TeachingAssistant.create(:user_id => \t\tparams[:userID], :course_number => \t\t\t \tparams[:course], :section_number => params[:section])\n\t\t@newRelation.save\n\t\t\n\tend\n\tredirect_to \"/teaching_assistants\"\nend",
"def move_student_on\n changed_and_notify_observers(:end_problem => @problem)\n reset_hints\n @sequence = Sequence.find params[:sequence_id] unless params[:sequence_id].nil?\n\n @next_problem = @problem.next\n\n if @next_problem.nil?\n # We don't have a next problem, so fetch the next Assistment\n\n if @sequence.nil?\n # We were actually previewing an Assistment, so finish the assistment\n # (but don't show a next assistment link)\n @next_assistment = nil\n render_tutor :file => \"finish_assistment\"\n else\n\n # Complete this Assistment\n @sequence.completeAssistment(session[:assignment_id], current_user)\n\n # Move on to next Assistment\n @next_up = @sequence.next_assistment(session[:assignment_id], current_user)\n @next_assistment = unless @next_up.nil? then Assistment.find_by_id(@next_up.first) end\n\n if @next_assistment.nil?\n # No Assistment, so we are done with sequence! Congratulate and show results.\n @assignment = ClassAssignment.find_by_id(session[:assignment_id])\n changed_and_notify_observers(:end_assignment => nil)\n render_tutor :file => \"results\"\n else\n # Prompt to move to next assistment\n render_tutor :file => \"finish_assistment\"\n end\n\n end\n\n else\n # Go to the next problem\n changed_and_notify_observers(:begin_problem => @next_problem)\n render_tutor :file => \"next_problem\"\n end\n end",
"def set_student\n @student = Student.find(current_student.id)\n end",
"def update\n @lesson = Lesson.find(params[:id])\n\n respond_to do |format|\n if @lesson.update_attributes(params[:lesson])\n flash[:notice] = 'Lesson was successfully updated.'\n format.html { redirect_to(@lesson) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lesson.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n current_student.update_attributes!(student_params)\n redirect_to student_path, notice: 'Update was successful!'\n end",
"def update\n if @student.update(student_params)\n flash[:success] = \"Aluno atualizado com sucesso\"\n redirect_to student_path(@student)\n else\n flash[:error] = \"Não foi possível atualizar o aluno\"\n redirect_to students_path\n end\n end",
"def set_student\n @student = Student.find(current_student.id)\n end",
"def update\n if @lesson.update(lesson_params)\n render :show, status: :ok, location: @lesson\n else\n render json: @lesson.errors, status: :unprocessable_entity\n end\n end",
"def switch_study!(date = Date.today)\n if study_id == 1\n update_attribute('study_id', 2)\n else\n update_attribute('study_id', 1)\n end\n update_attribute(:study_form_changed_on, date)\n end",
"def lose_pts\n self.score -= 1\n end",
"def put_online\n @question.online = true\n @question.save\n @section = @question.chapter.section\n @section.max_score = @section.max_score + @question.value\n @section.save\n redirect_to chapter_path(@chapter, :type => 5, :which => @question.id)\n end",
"def update\n if @user\n @lesson = Lesson.find(@user.login, params[:id])\n pub = false\n if params[:public] == \"1\"\n pub = true\n end\n\n @lesson = Lesson.save(@user.login, params[:lesson], pub)\n else\n @lesson = nil\n end\n \n respond_to do |format|\n flash[:notice] = 'lesson was successfully updated.'\n format.html { redirect_to lesson_url(@lesson.attributes[\"_id\"]) }\n format.xml { head :ok }\n end\n end",
"def update_grade_entry_students\n if params[:students].blank?\n flash_message(:warning, I18n.t('grade_entry_forms.grades.select_a_student'))\n else\n grade_entry_form = record\n release = params[:release_results] == 'true'\n GradeEntryStudent.transaction do\n data = record.course\n .students\n .joins(:grade_entry_students)\n .where('grade_entry_students.assessment_id': grade_entry_form.id,\n 'grade_entry_students.id': params[:students])\n .pluck('grade_entry_students.id', 'roles.id')\n .map { |ges_id, r_id| { id: ges_id, role_id: r_id, released_to_student: release } }\n GradeEntryStudent.upsert_all(data)\n num_changed = data.length\n flash_message(:success, I18n.t('grade_entry_forms.grades.successfully_changed',\n numGradeEntryStudentsChanged: num_changed))\n action = release ? 'released' : 'unreleased'\n log_message = \"#{action} #{num_changed} for marks spreadsheet '#{grade_entry_form.short_identifier}'.\"\n MarkusLogger.instance.log(log_message)\n rescue StandardError => e\n flash_message(:error, e.message)\n raise ActiveRecord::Rollback\n end\n GradeEntryStudent.where(id: params[:students]).includes(:role).each do |current_student|\n if current_student.role.receives_results_emails?\n NotificationMailer.with(student: current_student, form: grade_entry_form, course: current_course)\n .release_spreadsheet_email.deliver_later\n end\n end\n end\n end",
"def update\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.find(params[:id])\n\n respond_to do |format|\n if @inschool.update_attributes(params[:inschool])\n format.html { redirect_to :back, notice: 'Inschool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_lesson_word_sentence\n begin\n @course = Course.find(params[:course_id])\n @lesson = Lesson.find(params[:lesson_id])\n @lesson_word_sentence = LessonWordSentence.find_by!(sentence_id: params[:sentence_id], lesson_word_id: params[:lesson_word_id])\n end\n end",
"def update\n discipline if !@last_measure ||\n @clock.time - @last_measure.local_time > @discipline_interval\n end",
"def update\n @step = params[:step].to_i\n content = FetchContentService.new.(current_student.os, @step)\n current_student.steps << {title: content[:title] }\n current_student.save!\n\n redirect_to edit_students_path\n end",
"def update\n set_student\n if @student.update_attributes(edit_params)\n redirect_to @student\n else\n render 'edit'\n end\n end",
"def set_lesson_word\n @lesson_word = LessonWord.find(params[:id])\n @course = Course.find(params[:course_id])\n @lesson = Lesson.find(params[:lesson_id])\n end",
"def incement_score\r\n\t\t \t @score += 2000\r\n\t\t end",
"def edit\n @student = current_student\n end",
"def do_lecture\n #set the parameters\n @course_id = params[:course_id]\n @lesson_id = params[:lesson_id]\n @lecture_id = params[:lecture_id]\n\n\n @course = Course.find_by_id(params[:course_id])\n @lesson = Lesson.find_by_id(params[:lesson_id])\n\n @fixed_lesson_id = @lesson.lesson_id_fix.to_s\n\n puts @fixed_lesson_id.to_s\n\n @lectures = Lecture.find_by_course_id(params[:course_id])\n\n\n #for progress bar\n @counter = params[:counter].to_i\n #@totalLectures = Lecture.where(course_id: @course_id, lesson_id: @lesson_id).count\n #this is a bandaid for an error in creating the seed file\n @totalLectures = Lecture.where(course_id: @course_id, lesson_id: @fixed_lesson_id).count\n #@lecture_id = params[:lecture_id]\n #@lesson = Lesson.where(course_id: params[:course_id]).first\n # @lecture = Lecture.where(course_id: @course_id, lesson_id: @lesson_id).select(:id)\n\n #check first and increment lecture\n if(@lecture_id == nil)\n @lecture_id = nil\n else\n @lecture_id = params[:lecture_id].to_i + 1\n end\n\n #set lecture to be shown\n if(@lecture_id == nil) #first lecture\n @lecture = Lecture.where(course_id: @course_id, lesson_id: @fixed_lesson_id).first\n @counter = 0\n #elsif(Lecture.find_by_id_and_course_id_and_lesson_id(@lecture_id, @course_id, @lesson_id).blank?) #last lecture\n elsif(Lecture.find_by_id_and_course_id_and_lesson_id(@lecture_id, @course_id, @fixed_lesson_id).blank?) #last lecture\n flash[:notice] = 'Lesson: '+@lesson.name+' was successfully read, please take the quiz to test your knowledge.'\n redirect_to :controller=> 'users', :action => 'overview'\n return\n else #middle lecture\n @counter += 1\n #@lecture = Lecture.find_by_id_and_course_id_and_lesson_id(@lecture_id, @course_id, @lesson_id)\n @lecture = Lecture.find_by_id_and_course_id_and_lesson_id(@lecture_id, @course_id, @fixed_lesson_id)\n end\n\n #set quizzes once right lecture found\n #@answer = @lecture.quizAnswers\n #@options = @lecture.quizOptions.split(\"-\")\n end",
"def update\n if(current_user.role == \"guest\")\n redirect_to login_url and return\n end\n if(!current_user.role?(:admin) && current_user.coach.organization.id != @team.organization.id)\n redirect_to home_path and return\n end\n @coaches = Coach.all\n @divisions = Division.all\n @organizations = Organization.all\n @students = Student.all\n\n # We will remove any students that are no longer on the team. To find these\n # students, we subtract OLD - NEW. We then need to use that to remove them \n # from the original array.\n @team_ps = [] #team params\n @team_ss = [] #team students\n @students_to_add = []\n @students_to_remove = []\n @team_c = nil\n @team_a = true\n\n team_params.each{|p|\n if( p[0] == \"student_teams_attributes\")\n p[1].to_a.each do |e|\n @team_ps << e[1][:student_id].to_i unless e[1][:student_id] == \"\" || @team_ps.include?(e[1][:student_id].to_i)\n end\n\n elsif( p[0] == \"team_coaches_attributes\")\n @team_c = p[1][\"0\"][:coach_id].to_i unless p[1][\"0\"][:coach_id] == \"\"\n elsif(p[0] == \"active\")\n @team_a = (p[1] == \"1\") # 1 for active, 0 for inactive\n end\n }\n\n unless @team.student_teams.nil?\n @team.student_teams.present.pluck(:student_id).each do |id|\n @team_ss << id\n end\n end\n @students_to_remove = @team_ss - @team_ps\n\n StudentTeam.all.active.where(team_id: @team.id).each do |st|\n @students_to_remove.each do |r|\n if(st.student_id == r)\n st.make_inactive\n st.end_date = Date.today\n st.save!\n end\n end\n end\n\n # To make sure we don't wind up with the same team member twice, we need to\n # add them ourselves.\n @students_to_add = @team_ps - @team_ss\n\n # respond_to do |format|\n # if @team.update(team_params)\n # format.html { redirect_to @team, \n # notice: 'Team was successfully updated.'}\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @team.errors, status: :unprocessable_entity }\n # end\n\n\n @students_to_add.each do |s|\n StudentTeam.create(student_id: s, team_id: @team.id) unless s == \"\"\n end\n\n @coach_changed = @team.team_coaches.where(end_date: nil).count == 0\n @cur_coach_id = @team_c\n TeamCoach.all.where(team_id: @team.id, end_date: nil).each do |tc|\n @cur_coach_id = tc.coach_id\n # Set the end date for the old coach & create the new one\n if(@cur_coach_id != @team_c)\n tc.end_date = Date.today\n tc.save\n @coach_changed = true\n end\n end\n if(!@team.active)\n @team.active = true\n @team.save!\n end\n if(@coach_changed)\n @team.team_coaches.create!(team_id: @team.id, coach_id: @team_c)\n end\n\n if(!@team_a)\n @team.student_teams.active.each do |st|\n st.end_date = Date.today\n st.make_inactive\n end\n end\n\n @team.active = @team_a\n @team.save!\n\n respond_to do |format| \n format.html { redirect_to @team, notice: 'Team was successfully updated.'}\n end\n end",
"def update\n @lesson = Lesson.find(params[:id])\n \n score = Question.score_answers(params)\n video_watched = true\n complete = true\n \n respond_to do |format|\n if @lesson.update_attributes(:score => score, :video_watched => video_watched, :complete => complete )\n LessonResult.file_answers(params, @lesson)\n format.html { redirect_to(student_dashboard_path, :notice => 'Lesson was successfully completed.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lesson.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lesson.update(lesson_params)\n format.html { redirect_to @lesson, notice: 'Lesson was successfully updated.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lesson.update(lesson_params)\n format.html { redirect_to @lesson, notice: 'Lesson was successfully updated.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lesson.update(lesson_params)\n format.html { redirect_to @lesson, notice: 'Lesson was successfully updated.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n redirect_to @event, notice: 'lesson was successfully updated.'\n else\n render action: 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @user_lesson.update(user_lesson_params)\n format.html { redirect_to @user_lesson, notice: 'User lesson was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_lesson }\n else\n format.html { render :edit }\n format.json { render json: @user_lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_course_unread\n @course.update_attributes(unread: find_unread_from_course(@course))\n end",
"def checkpoint\n @remaining -= (now - @started_at)\n end",
"def update\n hasError = 0 \n @subject = Subject.find(params[:id]) \n if params[:teachers_id] == nil\n session[:error] =\"You have to select one or more teachers.\" \n hasError = 1\n else\n if @subject.update_attributes(params[:subject]) \n @subject.teachers.delete_all\n adding_teachers \n CustomLogger.debug(\"Subject updated\")\n CustomLogger.debug(\"--------------\") \n to_log(@subject) \n @subject = Subject.new\n end \n end \n restore_lists\n end",
"def update_exam_score\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam_group.batch\n grades = @exam.exam_group.batch.grading_levels.order(min_score: :asc)\n @temps = params[:exams][:exam]\n @exam.score_exam(@temps, @batch, @exam, @exam_group, grades)\n exam\n end",
"def change_score\n @lives = @lives - 1\n end",
"def update\n @suggested_lessons = params[:lesson][:suggested_lessons]\n @suggested_lessons.each do |sug_lesson|\n SuggestedLesson.create(lesson_id: @lesson.id, suggested_lesson_id: sug_lesson.to_i)\n end\n respond_to do |format|\n if @lesson.update(lesson_params)\n format.html { redirect_to @lesson, notice: 'Lesson was successfully updated.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_grade_entry_students\n if params[:students].blank?\n flash_message(:warning, I18n.t('grade_entry_forms.grades.select_a_student'))\n else\n grade_entry_form = GradeEntryForm.find_by_id(params[:id])\n release = params[:release_results] == 'true'\n GradeEntryStudent.transaction do\n GradeEntryStudent.upsert_all(params[:students].map { |id| { id: id, released_to_student: release } })\n num_changed = params[:students].length\n flash_message(:success, I18n.t('grade_entry_forms.grades.successfully_changed',\n numGradeEntryStudentsChanged: num_changed))\n action = release ? 'released' : 'unreleased'\n log_message = \"#{action} #{num_changed} for marks spreadsheet '#{grade_entry_form.short_identifier}'.\"\n MarkusLogger.instance.log(log_message)\n rescue StandardError => e\n flash_message(:error, e.message)\n raise ActiveRecord::Rollback\n end\n GradeEntryStudent.where(id: params[:students]).includes(:user).each do |current_student|\n if current_student.user.receives_results_emails?\n NotificationMailer.with(student: current_student, form: grade_entry_form)\n .release_spreadsheet_email.deliver_later\n end\n end\n end\n end",
"def wrong \n @lives -= 1\n end",
"def lent_out\n\tupdate_attributes(status: 'Lent Out')\nend",
"def update\n @enrollment.student = @student_for_enrollment\n respond_to do |format|\n if @enrollment.update(enrollment_params)\n format.html { redirect_to '/students', notice: 'La Cursada se actualizó exitosamente.' }\n format.json { render :show, status: :ok, location: @enrollment }\n else\n format.html { render :edit }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = @students_record.student\n respond_to do |format|\n if @students_record.valid? and ActiveRecord::Base.transaction_user(@current_user) {\n if @students_record.grade\n if params[:students_record][:status] == \"finished\" and @students_record.status != \"finished\"\n if @students_record.grade.passed?\n @students_record.update(students_record_params)\n flash[:success] = 'Students record was successfully updated. Schedule was deleted.'\n else\n flash[:alert] = %[Error: this student's grade does not qualify.]\n end\n elsif params[:students_record][:status] == \"abandoned\" and @students_record.status != \"abandoned\"\n flash[:alert] = \"Error: this student has taken the exam for this subject.\"\n # params[:students_record].delete(:finished_on)\n # params[:students_record].delete(:status)\n else\n @students_record.update(students_record_params)\n if request.format.html?\n flash[:success] = 'Students record was successfully updated.'\n end\n end\n else\n @students_record.update(students_record_params)\n if request.format.html?\n flash[:success] = 'Students record was successfully updated.'\n end\n end\n }\n format.html {\n redirect_to students_record_url(@student)\n }\n format.json { render :show, status: :ok, location: @students_record }\n else\n set_grouped_pkg_options\n format.html { render :edit }\n format.json { render json: @students_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def next_unfinished_lesson\n # checkins\n unfinished_lessons[unfinished_lessons.keys.first]\n end",
"def update\n if params[:course_id]\n @course = Course.find(params[:course_id])\n @lesson = Lesson.find(params[:id])\n else\n @lesson = Lesson.find(params[:id])\n end\n\n attributes = params[:lesson]\n attributes = extract_values if params[:content]\n\n respond_to do |format|\n if @lesson.update_attributes(attributes)\n format.html { redirect_to show_enrolled_course_path(@course), :notice => 'Lesson was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lesson.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_lesson_status\n @lesson_status = LessonStatus.find(params[:id])\n end",
"def not_present\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.add_to_set(:absences, today_absence)\n format.html { redirect_to students_url, notice: 'Student absences were successfully updated.' }\n format.json { render :json => { value: bullets(@student.absences) }.to_json }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fail_student(student, test_name)\n BoatingTest.all.select{|bt| bt.instructor == self }.select{|bt| bt.student == student && bt.test_name == test_name}.each{|bt| bt.test_status = 'failed'}\n end",
"def update_shift\n @user.ten_hour_shift = !@user.ten_hour_shift\n @user.save\n\n redirect_to show_user_path(@user)\n end",
"def update\n respond_to do |format|\n if @private_lesson.update(private_lesson_params)\n format.html { redirect_to @private_lesson, notice: 'Private lesson was successfully updated.' }\n format.json { render :show, status: :ok, location: @private_lesson }\n else\n format.html { render :edit }\n format.json { render json: @private_lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wrong\n self.lives -= 1\n end",
"def update_rent(roll)\n raise \"Unimplemented Method: update_rent(roll)\"\n end",
"def set_lesson_completed\n @lesson_completed = LessonCompleted.find(params[:id])\n end",
"def scratch\n @idea = Idea.find(params[:id])\n \n @idea.update_attribute(:scratched, !@idea.scratched)\n redirect_back_or ideas_path\n end",
"def stand\n @stand = 1\n end",
"def pass_student (student_name, test_name)\n test_to_change = BoatingTest.all.select {|test|\n test.name == test_name &&\n test.student.first_name == student_name &&\n test.instructor == self\n }\n\n if test_to_change[0] == nil\n test_to_change << BoatingTest.new(Student.find_student(student_name),test_name, \"passed\", self)\n else\n test_to_change[0].status = \"passed\"\n end\n test_to_change\n end",
"def update_state!(section, user, looping_identifier=nil)\n status = section.questions_answered_status(user, looping_identifier)\n self.section_state = status\n self.save!\n status\n end",
"def update_grade(student)\n # Set homeroom grade level to be first student's grade level, since\n # we don't have any crosswalk between homerooms and grades in\n # Somerville's Student Information System\n\n return if self.grade.present?\n return if student.grade.blank?\n\n update_attribute(:grade, student.grade)\n end",
"def wrong_answer\n @score -= 1\n end",
"def update_user\n @user = @user || student.user || student.build_user\n @user.update_attribute(:login, loginname)\n @user.roles << Role.find_by_name('student') unless @user.has_role?(\"student\")\n self.update_attribute(:status, 'S')\n end",
"def fail_student(test_name, student)\n fail_test = BoatingTest.all.find {|test| student == test.student && test_name == test.name}\n\n if fail_test == nil\n student.add_boating_test(test_name, \"failed\", self)\n else\n fail_test.status=\"failed\"\n end\n\n end",
"def add_students\n @paper = Paper.find(params[:id])\n @old_students = Array.new(@paper.students)\n @paper.student_ids = params[:student_ids]\n @paper.save!\n # student rows to be updated with changes in subjects\n @students = (@old_students | @paper.students) - (@old_students & @paper.students)\n end",
"def fail_student(student_name, test_name)\n boating_tests.map do |test|\n test.boating_test_status = \"Failed\"\n end\n end",
"def set_lesson\n @lesson = Lesson.find(params[:id])\n end",
"def set_lesson\n @lesson = Lesson.find(params[:id])\n end",
"def set_lesson\n @lesson = Lesson.find(params[:id])\n end",
"def set_lesson\n @lesson = Lesson.find(params[:id])\n end",
"def set_lesson\n @lesson = Lesson.find(params[:id])\n end"
] | [
"0.60317314",
"0.5915387",
"0.5874263",
"0.58734745",
"0.5734091",
"0.5722048",
"0.5700454",
"0.56862485",
"0.5613513",
"0.5599763",
"0.5597632",
"0.55835813",
"0.55756336",
"0.55720216",
"0.5566742",
"0.5560592",
"0.55529946",
"0.5512913",
"0.5481752",
"0.5480805",
"0.54805785",
"0.54798317",
"0.54512405",
"0.5444265",
"0.5409957",
"0.5397199",
"0.53902113",
"0.5364369",
"0.5360018",
"0.53556",
"0.5343084",
"0.5342458",
"0.53287405",
"0.5327842",
"0.53188074",
"0.5318317",
"0.5313804",
"0.5304697",
"0.5299857",
"0.52967274",
"0.52905995",
"0.52839404",
"0.52737194",
"0.5267883",
"0.52662885",
"0.5262012",
"0.5261919",
"0.525423",
"0.52507555",
"0.52394086",
"0.522964",
"0.5228556",
"0.52259225",
"0.52175045",
"0.5210683",
"0.5209307",
"0.5207501",
"0.5207479",
"0.51975006",
"0.51965636",
"0.51965636",
"0.51965636",
"0.5195197",
"0.5192604",
"0.51913625",
"0.5183762",
"0.518341",
"0.51831055",
"0.5182411",
"0.5177451",
"0.5176053",
"0.5172003",
"0.51536554",
"0.5144042",
"0.51328486",
"0.5130606",
"0.5129978",
"0.51234317",
"0.5120104",
"0.51025105",
"0.51018596",
"0.51016927",
"0.50954986",
"0.5093681",
"0.5074848",
"0.5073938",
"0.5072828",
"0.50717485",
"0.5071485",
"0.50712526",
"0.50710636",
"0.5061474",
"0.505396",
"0.5051243",
"0.50483155",
"0.5045432",
"0.5045432",
"0.5045432",
"0.5045432",
"0.5045432"
] | 0.69948167 | 0 |
funcionalidad: accesible_by(current_ability)) 1) rails g cancan:ability | def save_ctacte_pdf_to(filename,entity)
require 'prawn'
pdf = Prawn::Document.new(:left_margin => 35, :top_margin => 35,:page_size => "LETTER",
:page_layout => :portrait)
offset = 0
pdf.repeat(:all, :dynamic => true) do
pdf.draw_text ("Cuenta corriente de " + entity.first.try(:cliente).razonsocial + " impreso el " + Date.today.strftime("%d/%m/%Y")) , :at => [5,745],:style => :bold, :size => 10
pdf.draw_text "Hoja Nro.: " + pdf.page_number.to_s.rjust(4,"0"), :at => [300, 745],:style => :bold, :size => 8
end
data = [["Fecha","Tipo Cp","Numero","Importe","Fecha Vto","impreso"],[] ]
saldo = 0
entity.each do |r|
data << [r.fecha.blank? ? '' : r.fecha.strftime("%d/%m/%Y"),
r.type,
r.numero,
r.total_comprobante,
r.fechavto.blank? ? '' : r.fechavto.strftime("%d/%m/%Y"),
r.printed_at.blank? ? '' : r.printed_at.strftime("%d/%m/%Y")]
saldo += r.total_comprobante
end
data << ["" ,"Totales","",saldo.to_s,"","" ]
pdf.table(data, :column_widths => [65, 100, 60, 65, 65, 65],
:cell_style => { :font => "Times-Roman",
:size => 10,:padding => [2,3,4,2],
:align => :left,
:valign => :center },
:header => true ,
:row_colors => ["F0F0F0", "FFFFCC"]
) do
column(2...3).align = :right
row(0).column(0..6).align = :center
end
pdf.render_file(filename)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_ability\n current_user.ability\n end",
"def current_ability\n \t\t@current_ability ||= Ability.new(current_usuario)\n\tend",
"def current_ability\n \t\t@current_ability ||= Ability.new(current_usuario)\n\tend",
"def current_ability\n @current_ability ||= ::Ability.new(current_usuario)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_usuario)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_usuario)\n end",
"def current_ability\n \t@current_ability ||= Ability.new(current_user, params)\n end",
"def current_ability\n current_admin.ability\n end",
"def current_ability\n @current_ability ||= Ability.new(current_admin || current_user) \n end",
"def current_ability\n @current_ability ||= ::Ability.new(current_admin_user)\n end",
"def current_ability\n # @current_ability ||= AdminAbility.new(admin: current_admin)\n end",
"def current_ability\n\t\t\t@current_ability ||= Ability.new(current_user, roles: session[\"cul.roles\"], remote_ip: request.remote_ip)\n\t\tend",
"def current_ability\n @current_ability ||= Ability.new(current_user, roles: session[\"cul.roles\"], remote_ip:request.remote_ip)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_user)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_user)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_admin_user)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_admin_user)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_admin)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_user, current_company)\n end",
"def current_ability\n ::Ability.new(current_user, current_facility, UsersController.new)\n end",
"def current_ability\n @current_ability ||= Ability.new(view_context.current_or_guest_user)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_or_guest_user)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_or_guest_user)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_user, request)\n end",
"def ability\n @ability ||= Ability.new(current_user)\n end",
"def current_ability\n @current_ability ||= ::Abilities::Ability.new(current_user)\n end",
"def current_ability\n @current_ability ||= ::Ability.new(current_user)\n end",
"def ability\n return @ability_current\n end",
"def current_ability\n # Always refresh ability\n @current_ability ||= Ability.new(current_user)\n end",
"def authorizer\n current_ability\n end",
"def current_ability\n @current_ability ||= Ability.new(current_user_efi, :efi)\n end",
"def current_ability\n @current_ability ||= UserAbility.new( current_user )\n end",
"def current_ability\n # Redefined here to namespace Ability in the correct module\n @current_ability ||= Kaui::Ability.new(current_user)\n end",
"def current_ability\n @current_ability ||= Mokio::Ability.new(current_user)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_employee)\n end",
"def current_ability\n @current_ability ||= Ability.new(User.current)\n end",
"def current_ability\n if user_signed_in?\n @current_ability ||= Ability.new(current_user)\n end\n end",
"def current_ability\n @current_ability ||= Ability.new(current_profile)\n end",
"def ability\n\t\t@ability ||= Admin::SystemAdminAbility.new(self)\n\tend",
"def current_ability\n if volunteer_signed_in?\n @current_ability ||= Ability.new(current_volunteer)\n elsif organization_signed_in?\n @current_ability ||= Ability.new(current_organization)\n end\n end",
"def current_ability\n if patient_signed_in?\n @current_ability ||= Ability.new(current_patient)\n else\n @current_ability ||= Ability.new(current_user)\n end\n end",
"def current_ability\n @current_ability ||= Gesmew::Ability.new(try_gesmew_current_user)\n end",
"def current_ability\n view_context.try(:current_ability)\n end",
"def current_ability\n @current_ability ||= Ability.new(current_player)\n end",
"def ability\n @ability ||= ::Ability.new(self)\n end",
"def set_ability\n @ability = Ability.friendly.find(params[:id].titleize)\n end",
"def ability?\n self.__ability.present?\n end",
"def ability\n @ability ||= Ability.new(self)\n end",
"def ability\n @ability ||= Ability.new(self)\n end",
"def ability\n @ability ||= Ability.new(self)\n end",
"def ability\n @ability ||= Ability.new(self)\n end",
"def ability\n @ability ||= Ability.new(self)\n end",
"def set_ability\n @ability = Ability.find(params[:id])\n end",
"def current_ability\n @current_ability ||= Spree::Ability.new(try_spree_current_user)\n end",
"def current_ability\n if user_signed_in?\n @current_ability ||= Ability.new(current_user)\n elsif center_signed_in?\n @current_ability ||= CenterAbility.new(current_center)\n elsif rhagent_signed_in?\n @current_ability ||= RhagentAbility.new(current_rhagent)\n end\n end",
"def current_ability\n user= current_user || Spree::User.find_by_authentication_token(params[:authentication_token])\n @current_ability ||= Ability.new(user)\n end",
"def current_ability\n method = Rails.configuration.blog.current_user_method\n if respond_to?(method)\n user = send(method)\n else\n raise \"You must define #{method} on Blog::ApplicationController, as described in README.md\"\n end\n Blog::Ability.new(user)\n end",
"def current_ability\n user= current_user || Spree::User.find_by_authentication_token(params[:authentication_token])\n @current_ability ||= Spree::Ability.new(user)\n end",
"def set_ability\n @current_ability ||= Ability.new(User.new)\n end",
"def custom_permissions\n if current_user.admin?\n can :manage, :all\n end\n end",
"def can_access?\n allows_current_user_access_to? :access\n end",
"def can?\n current_user\n end",
"def can?(name)\n\t\t\tabilities.include? name\n\t\tend",
"def ability\n\t\t@ability ||= Operation::OperatorAbility.new(self)\n\tend",
"def can_do_member_scoped_actions\n can :show, :all\n can :edit, :all\n can :destroy, :all\n can :history, :all\n can :show_in_app, :all\n can :clone, :all\n # can :nested_set, :all\n can :nestable, :all\n can :change_state, :all\n end",
"def initialize ability\n @ability = ability\n end",
"def display_resource(ability)\n ability.name\n end",
"def meta_abilities\n User.roles.each do |(k, v)|\n if user.has_role? k\n can \"do_#{k}\".to_sym, :all\n end\n end\n end",
"def current_ability_class(object)\n ability_class(get_current_platform_name(object))\n end",
"def initialize ability\n @ability = ability\n end",
"def create?\n @current_user.permission('Bid', :clerk)\n end",
"def show?\n @current_user.permission('Bid', :guest)\n end",
"def index\n @requests = Request.accessible_by(current_ability)\n\n \n\n end",
"def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end",
"def ability(id)\n get(\"/ability/#{id}\")\n end",
"def authorize!\n Ability.allowed?(context[:current_user], :read_milestone, parent) || raise_resource_not_available_error!\n end",
"def can_authorize?(user, a)\n user != self and may_authorize and\n (abilities | ADMIN_TASKS).include?(a)\n end",
"def can?(thing)\n return true if admin?\n # Check if user is granted the function\n return true if granted?(thing)\n # Check if user is denied the function\n return false if denied?(thing)\n # Ignore \"System Admin\" function from CSUM/CSEM users\n return false if thing.include?(\"System Admin\")\n roles.include?(thing)\n end",
"def accessible\n accessible_for(Aurita.user)\n end",
"def index\n @abilities = Ability.all\n end",
"def administrator\n can :manage, :all\n end",
"def has_permission?\n return true if administrator?\n \n # Load the Model based on the controller name\n klass = self.controller_name.classify.constantize\n \n # Load the possible parent requested\n @parents = (klass.has_parent?) ? get_parents_from_request_params(klass, params) : nil\n \n # Load the resource requested\n if params[:id]\n if [\"index\", \"destroy\", \"update\"].include?(params[:action]) && klass.respond_to?(:in_set)\n @resource = klass.in_set(params[:id])\n @resource = @resource.first if @resource.size == 1\n else\n @resource = klass.find(params[:id])\n end\n end\n \n # Let's let the Model decide what is acceptable\n # NOTE: It is still the concrete controller's job to filter inaccessible resources (accessed via the index)!\n # This presumably happens in the with_parent named scope\n \n authorized = case params[:action]\n when \"edit\", \"update\"\n if !@resource.is_a?(Array)\n return @resource.updatable_by?(current_user, @parents) # this is 'returned' to authorized\n end\n \n verify_set_accessablility(@resource, :updatable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for update.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"destroy\" \n if !@resource.is_a?(Array)\n return @resource.deletable_by?(current_user, @parents)\n end\n \n verify_set_accessablility(@resource, :deletable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for deletion.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"index\" then klass.indexable_by?(current_user, @parents)\n when \"new\", \"create\" then klass.creatable_by?(current_user, @parents)\n when \"show\" then @resource.readable_by?(current_user, @parents)\n else check_non_restful_route(current_user, klass, @resource, @parents)\n end\n \n permission_denied unless authorized\n \n #rescue NoMethodError => e\n # Misconfiguration: A RESTful_ACL specific method is missing.\n #raise_error(klass, e)\n #rescue\n # Failsafe: If any funny business is going on, log and redirect\n #routing_error\n #end\n end",
"def admin_permissions\n can [:manage], :all\n end",
"def admin_permissions\n can [:manage], :all\n end",
"def authorize (permission_name)\n self.allowances.detect {|a| a.permission.name == permission_name.to_s}\n end",
"def can_access?(user)\n user == self.user\n end",
"def initialize_cancan_ability\n ability_class_name = resource.namespace.cancan_ability_class\n\n if ability_class_name.is_a?(String)\n ability_class = ActiveSupport::Dependencies.constantize(ability_class_name)\n else\n ability_class = ability_class_name\n end\n\n ability_class.new(user)\n end",
"def load_permissions\n authorize! :manage, :all\n end",
"def can_site_admin\n can :manage, :all\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def ability_modifier(_ability)\n\t\tmodifier = nil\n\t\tmodifier = @abilities.find { |ability| ability.name == _ability }.modifier if @abilities.find { |ability| ability.name == _ability }\n\tend",
"def admin\n\t\tcan :manage, :all\n\tend",
"def can?(ability, new_subject = :_self)\n return allowed?(ability) if new_subject == :_self\n\n policy_for(new_subject).allowed?(ability)\n end",
"def update_ability\n if @ability_index\n @ability_current = @ability = get_data.abilities[@ability_index.to_i]\n else\n @ability_current = @ability\n end\n end",
"def allowable\n return @allowable if @allowable\n\n @allowable = parent_allowables\n end",
"def can_look\n if @user.can( :read , @board ||= Board.find_from( params ) )\n return true\n else\n redirect_to login_url \n end# if\n end",
"def can?(*args)\n permissions.can?(*args)\n end",
"def authorize?(person)\n person.is_admin?\n end",
"def can_access?(space = object)\n space.accessible_by_user?(current_user)\n end",
"def can_admin?(resource)\n scope_name = resource.class.to_s.downcase.pluralize\n self.send(\"adminable_#{scope_name}\").where(\"`permissions`.resource_type = ? AND `permissions`.resource_id = ?\", resource.class.to_s, resource.id).exists?\n end",
"def update?\n @current_user.permission('Bid', :clerk)\n end"
] | [
"0.8099499",
"0.7991816",
"0.7991816",
"0.79580015",
"0.7881289",
"0.78747946",
"0.7872564",
"0.78693116",
"0.7868123",
"0.778758",
"0.7787095",
"0.77726537",
"0.77496505",
"0.77385414",
"0.77385414",
"0.77225846",
"0.77225846",
"0.7721969",
"0.77085435",
"0.76616055",
"0.76519233",
"0.76442814",
"0.76442814",
"0.7637387",
"0.76093805",
"0.7604391",
"0.7602223",
"0.759723",
"0.7569137",
"0.75617886",
"0.7501718",
"0.74946237",
"0.745957",
"0.7450439",
"0.74114406",
"0.7408155",
"0.73643416",
"0.7330348",
"0.73099905",
"0.7301759",
"0.72991014",
"0.72889966",
"0.72806203",
"0.7240787",
"0.72286546",
"0.72269845",
"0.7163444",
"0.71607155",
"0.71607155",
"0.71607155",
"0.71607155",
"0.71607155",
"0.7121139",
"0.7008635",
"0.7000084",
"0.6916706",
"0.6915669",
"0.6899443",
"0.689654",
"0.6861054",
"0.6838197",
"0.6802155",
"0.67886513",
"0.6773433",
"0.67469305",
"0.66101605",
"0.65993613",
"0.6592834",
"0.6556897",
"0.65156335",
"0.64732033",
"0.6469512",
"0.64676714",
"0.64552456",
"0.6449665",
"0.6433389",
"0.64321005",
"0.64058656",
"0.64041066",
"0.6389458",
"0.6374912",
"0.6369867",
"0.6352199",
"0.6352199",
"0.63474745",
"0.6303251",
"0.63012826",
"0.6294168",
"0.62596476",
"0.62559855",
"0.6255773",
"0.62444097",
"0.62375474",
"0.62332183",
"0.6227316",
"0.6208664",
"0.6202464",
"0.6201171",
"0.61919886",
"0.6181585",
"0.61808425"
] | 0.0 | -1 |
returns an array of possible moves from position parameter (an array with 2 elements) (e.g. [0,0] means piece is at position 0,0) | def possible_moves(position, board, color)
out_array = []
x = position[0]-1
y = position[1]-1
(x..x+2).each do |row|
break if row > 7
(y..y+2).each do |column|
break if column > 7
if !board[row][column] || board[row][column].color != color
out_array.push([row, column])
end
end
end
out_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y-1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y-1]\n positions_array << next_position if position_check(next_position)\n positions_array\n end",
"def possibleMoves(position)\n moves = []\n for x in 0..2\n for y in 0..2\n if position[x][y]==0\n moves << 3*x + y + 1 #board labeled 1 - 9\n end\n end\n end\n return moves\n end",
"def get_possible_moves_for(position)\n possible = []\n x = position.square[0]\n y = position.square[1]\n moves = [\n Placement.new([x-1,y-2], position), \n Placement.new([x-1,y+2], position), \n Placement.new([x-2,y-1], position), \n Placement.new([x-2,y+1], position), \n Placement.new([x+1,y+2], position), \n Placement.new([x+1,y-2], position), \n Placement.new([x+2,y-1], position), \n Placement.new([x+2,y+1], position)\n ]\n moves.each do |move|\n possible << move unless Chess.not_on_board?(move)\n end\n possible\n end",
"def get_possible_moves\n moves = \n\t @@offsets.collect do |move| \n\t row = @position[:row] + move[0]\n\t col = @position[:col] + move[1]\n\t\t[row, col] if row.between?(0, 7) && col.between?(0, 7)\n\t end\n\tmoves.compact\n end",
"def possible_moves(position, board, color)\n out_array = []\n\n x = position[0]\n y = position[1]\n\n add_to_move_array(x - 1, y - 2, board, color, out_array)\n add_to_move_array(x - 2, y - 1, board, color, out_array)\n add_to_move_array(x - 2, y + 1, board, color, out_array)\n add_to_move_array(x - 1, y + 2, board, color, out_array)\n add_to_move_array(x + 1, y + 2, board, color, out_array)\n add_to_move_array(x + 2, y + 1, board, color, out_array)\n add_to_move_array(x + 2, y - 1, board, color, out_array)\n add_to_move_array(x + 1, y - 2, board, color, out_array)\n\n out_array\n end",
"def moves\n output = []\n move_one = false\n @directions = @directions.take(3) if position != @initial_position\n directions.each_index do |index|\n possible_position = [position[0] + directions[index][0],position[1] + directions[index][1]]\n if index.even?\n if board.in_bounds?(possible_position) && occupied?(possible_position)\n output << possible_position unless board[possible_position].color == board[position].color\n end\n elsif index == 1\n if board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position\n move_one = true\n end\n elsif board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position if move_one\n end\n end\n output\n end",
"def possible_moves(pos)\n\tchanges = [[-2,-1],[-2,1],[-1,-2],[-1,2],[2,-1],[2,1],[1,-2],[1,2]]\n\tmoves = []\n\tchanges.each { |change| moves << [pos[0]+change[0], pos[1]+change[1]] }\n\tmoves.select { |move| is_valid_position?(move) }\nend",
"def getPossibleFrom move\n possibleFrom = []\n move.board.pieces[move.piece.colour][move.piece.class.to_s.to_sym].each do |coord, piece|\n possibleFrom << coord\n end\n possibleFrom\n end",
"def possible_moves\n all_moves = []\n x, y = @position\n moves = [[x, y-1], [x-1, y-1], [x-1, y], [x-1, y+1], [x, y+1], [x+1, y+1], [x+1, y], [x+1, y-1]]\n moves.each do |position|\n all_moves << [position] if position.all? { |number| number.between?(0,7) }\n end\n all_moves\n end",
"def possible_moves\n possible_moves = []\n\n # move up\n up_right = [start[X] + 1, start[Y] + 2]\n possible_moves << up_right\n\n up_left = [start[X] - 1, start[Y] + 2]\n possible_moves << up_left\n\n # move right\n right_up = [start[X] + 2, start[Y] + 1]\n possible_moves << right_up\n\n right_down = [start[X] + 2, start[Y] - 1]\n possible_moves << right_down\n\n # move down\n down_right = [start[X] + 1, start[Y] - 2]\n possible_moves << down_right\n\n down_left = [start[X] - 1, start[Y] - 2]\n possible_moves << down_left\n\n # move left\n left_up = [start[X] - 2, start[Y] + 1]\n possible_moves << left_up\n\n left_down = [start[X] - 2, start[Y] - 1]\n possible_moves << left_down\n\n possible_moves.select { |move| @board.valid_position?(move) }\n\n end",
"def possible_moves(x, y)\n @moves = [[x+1,y+2], [x+1,y-2],\n [x-1,y+2], [x-1,y-2],\n [x+2,y+1], [x+2,y-1],\n [x-2,y+1], [x-2,y-1]]\n\n end",
"def get_poss_moves\n x = @location[0] #x is row\n y = @location[1] #y is column\n\n move_list = [] #quarter circle forward punch\n\n if @colour == \"white\"\n move_list = white_pawn_moves(x,y)\n else\n move_list = black_pawn_moves(x,y)\n end\n\n possible_moves = move_list.select { |e|\n (e[0] >= 0) && (e[0] <= 7) && (e[1] >= 0) && (e[1] <= 7)\n }\n possible_moves\n end",
"def moves\n poss_moves = []\n determine_moves.each do |diff| #array of directions\n poss_moves += grow_unblocked_moves_in_dir(diff[0],diff[1])\n end\n poss_moves\n end",
"def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end",
"def possible_moves(board)\n poss_move_array = []\n current_square = @history.last\n current_coords = parse_coord(current_square)\n\n poss_move_array.push(single_march(current_coords, board)) if single_march(current_coords, board)\n\n poss_move_array.push(double_march(current_coords, board)) if first_move? && double_march(current_coords, board)\n\n valid_diagonals(current_coords, board).each { |move| poss_move_array.push(move) }\n\n # en passant only allowed opportunity first created\n poss_move_array.push(en_passant?(current_coords, board)) if en_passant?(current_coords, board)\n\n poss_move_array\n end",
"def possible_moves(position, board, color)\n out_array = []\n\n x = position[0]\n y = position[1]\n\n #going right\n while y < 7\n y += 1\n if board[x][y] && board[x][y].color != color\n out_array.push([x, y])\n break\n elsif board[x][y] && board[x][y].color == color\n break\n end\n out_array.push([x, y])\n end\n\n y = position[1]\n while y > 0\n y -= 1\n if board[x][y] && board[x][y].color != color\n out_array.push([x, y])\n break\n elsif board[x][y] && board[x][y].color == color\n break\n end\n out_array.push([x, y])\n end\n\n y = position[1]\n while x > 0\n x -= 1\n if board[x][y] && board[x][y].color != color\n out_array.push([x, y])\n break\n elsif board[x][y] && board[x][y].color == color\n break\n end\n out_array.push([x, y])\n end\n\n x = position[0]\n while x < 7\n x += 1\n if board[x][y] && board[x][y].color != color\n out_array.push([x, y])\n break\n elsif board[x][y] && board[x][y].color == color\n break\n end\n out_array.push([x, y])\n end\n\n\n out_array\n end",
"def moves\n # All pieces can stay in place\n [[0,0]]\n end",
"def get_moves(pieces)\n\t\tarrPos = [] \n\t\tif team == 1\n\t\t\tarrPos << [@xCord, @yCord + 1] if square_is_open?(pieces, [@xCord, @yCord + 1])\n\t\t\tarrPos << [@xCord, @yCord + 2] if @yCord == 1 && square_is_open?(pieces, [@xCord, @yCord + 2])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord, @yCord - 1] if square_is_open?(pieces, [@xCord, @yCord - 1])\n\t\t\tarrPos << [@xCord, @yCord - 2] if @yCord == 6 && square_is_open?(pieces, [@xCord, @yCord - 2])\n\t\tend\n\t\tarrPos\n\tend",
"def possible_moves(x, y, dx, dy)\n return [[x - 1, y], [x, y + 1], [x, y - 1]] if dx > 0\n return [[x + 1, y], [x, y + 1], [x, y - 1]] if dx < 0\n return [[x + 1, y], [x, y + 1], [x - 1, y]] if dy > 0\n [[x + 1, y], [x, y - 1], [x - 1, y]]\n end",
"def moves\n return [] if @position.empty?\n possible_moves = []\n move_dirs.each do |dir| #[-1,-1]\n test_pos = @position #[1,3] - current position\n valid = true\n while valid\n x = dir.first + test_pos.first\n y = dir.last + test_pos.last\n test_pos = [x,y]\n valid = valid_move?([x,y])\n possible_moves << [x,y] if valid\n valid = false if valid == :attack\n end\n end\n possible_moves\n end",
"def possible_moves\n return []\n end",
"def possible_moves(from)\n\tpositions = []\n\tpair = { 1 => [2, -2], 2 => [1, -1] }\n row_change = [-2, -1, 1, 2]\n row_change.each do |change|\n \tpositions << add_positions(from, [change, pair[change.abs][0]])\n \tpositions << add_positions(from, [change, pair[change.abs][1]])\n end\n\tpositions\nend",
"def regular_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n \n # looks at the two forward diagonal positions and adds them to moves array if there are no pieces there\n pos1 = [@x_pos + 1, @y_pos + dir]\n moves << pos1 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 1, @y_pos + dir]\n moves << pos2 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves \n end",
"def possible_moves(from)\r\n\tpositions = []\r\n\tpair = { 1 => [2, -2], 2 => [1, -1] }\r\n row_change = [-2, -1, 1, 2]\r\n row_change.each do |change|\r\n \tpositions << add_positions(from, [change, pair[change.abs][0]])\r\n \tpositions << add_positions(from, [change, pair[change.abs][1]])\r\n end\r\n\tpositions\r\nend",
"def moves\n # create array to collect moves\n final_array = []\n\n\n\n pos = self.move_dirs\n\n pos.each do |optional_pos|\n\n end\n\n # Note do these logics for all the optional positions \n spec_dx = pos[0]\n spec_dy = pos[1]\n\n possible_movements = grow_unblocked_moves_in_dir(spec_dx, spec_dy)\n possible_movements\n # ending\n\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"def possible_moves(side)\n possible_moves = []\n # initialize an 8x8 array of coordinates 1-8\n coords = Array.new(8) { [*1..8] }\n coords.each_with_index do |i, j|\n i.each do |t|\n # t is the x, i[j] is the y\n side.each do |test_piece|\n # Run move validation tests on every piece\n next unless test_piece.move_tests(to_x: t, to_y: i[j])\n # if a move passes validations, push the pieces ID and the\n # coordinates of a successful move to the possible_moves array\n possible_moves << [test_piece.id, t, i[j]]\n end\n end\n end\n possible_moves\n end",
"def take_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend",
"def next_positions(pos)\n\tresult = []\n\tmoves = [[1, 2], [-1, 2], [1, -2], [-1, -2], [2, 1], [2, -1], [-2, 1], [-2, -1]]\n\tmoves.each do |move|\n\t\tpossibility = [pos[0] + move[0], pos[1] + move[1]]\n\t\tif possibility[0].between?(0, 7) && possibility[1].between?(0, 7)\n\t\t\tresult << possibility\n\t\tend\n\tend\n\treturn result\nend",
"def possible_moves(pos, board)\n moves = @moves.reduce([]) { |all_moves, move| all_moves.push(move.valid_moves(pos, board, @owner)) }\n moves.flatten(1)\n end",
"def moves\n possible_moves = []\n dir do |dir|\n possible_moves += MyDirections(pos, dir)\n end\n possible_moves\n end",
"def moves; [] end",
"def get_possible_moves(piece, position, end_cell = nil)\n position = board.chess_notation_to_coordinates(position)\n\n if piece.type == :pawn && (contains_enemy_piece?(end_cell) || (move_is_en_passant?(end_cell) && !end_cell.nil?))\n possible_moves = piece.capture_moves[0..-1] #duplicate piece move list\n else\n possible_moves = piece.moves[0..-1] #duplicate piece move list\n add_extra_pawn_move!(possible_moves, piece.color, position) if piece.type == :pawn\n end\n \n possible_moves.map! { |y,x| [y+position[0], x+position[1]] }\n possible_moves.select! { |coordinates| valid_move?(coordinates) }\n\n possible_moves.map { |coordinates| board.coordinates_to_chess_notation(coordinates) }\n end",
"def get_possible_pawn_capture_moves(piece, position)\n position = board.chess_notation_to_coordinates(position)\n\n possible_moves = piece.capture_moves[0..-1] #duplicate piece move list\n possible_moves.map! { |y,x| [y+position[0], x+position[1]] }\n possible_moves.select! { |coordinates| valid_move?(coordinates) }\n\n possible_moves.map { |coordinates| board.coordinates_to_chess_notation(coordinates) }\n end",
"def possible_moves\n possibles = []\n @state.each_with_index do |column, i|\n possibles << i if column[5] == :e\n end\n possibles\n end",
"def getPossibleMoves(move)\n board = move.board\n possibleMoves = []\n if move.from.nil?\n possibleFrom = getPossibleFrom(move)\n possibleFrom.each do |from|\n possibleMove = Move.new(board, move.board.getSquare(from).occupancy, move.to, from)\n possibleMoves << possibleMove\n end\n else\n # Make sure the piece trying to be moved exists\n if(board.getSquare(move.from).occupied? &&\n board.getSquare(move.from).occupancy.class == move.piece.class &&\n board.getSquare(move.from).occupancy.colour == move.piece.colour)\n move.piece = move.board.getSquare(move.from).occupancy\n possibleMoves << move\n end\n end\n possibleMoves\n end",
"def moves\n moves = []\n\n x, y = self.position\n sign = self.color == :white ? 1 : -1\n init_row = self.color == :white ? 1 : 6\n\n one_up = [x + (1 * sign), y]\n two_up = [x + (2 * sign), y]\n\n moves << one_up if self.board[one_up].nil?\n\n if (self.board[one_up].nil? && self.board[two_up].nil? && self.position.first == init_row)\n moves << two_up\n end\n\n diag_left = [x + (1 * sign), y + 1]\n diag_right = [x + (1 * sign), y - 1]\n\n if self.board[diag_left] && self.board[diag_left].color != self.color\n moves << diag_left\n end\n\n if self.board[diag_right] && self.board[diag_right].color != self.color\n moves << diag_right\n end\n\n moves.select { |move| on_board?(move) }\n end",
"def jump_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n\n # looks at the two forward far diagonal positions and adds them to moves array if there are no pieces there and an opponent piece in between\n pos1 = [@x_pos + 2, @y_pos + 2*dir]\n moves << pos1 if Piece.all.find{|p| p.x_pos == @x_pos + 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 2, @y_pos + 2*dir]\n moves << pos2 if Piece.all.find{|p| p.x_pos == @x_pos - 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n\n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves\n end",
"def castling_moves(pos, board)\n return [] if @owner.check || pos[1] != 4 || !@owner.can_castle\n\n home_rank = (0..7).map { |index| board.locate_piece([pos[0], index]) }\n [castle_queenside(home_rank[0..3], pos, board), castle_kingside(home_rank[5..7], pos, board)].compact\n end",
"def possible_moves_in_board(position)\n POSSIBLE_MOVES.select do |move|\n x = position[0] + move[0]\n y = position[1] + move[1]\n\n within_board?(x, y)\n end\n end",
"def move board\n free_pieces = board.free_pieces\n piece = free_pieces.random\n moves = board.possible_moves(piece)\n return [piece.x, piece.y], moves.random \n end",
"def possibleMoves(arr,visited)\n moves = []\n VALID_MOVES.each do |x,y|\n if valid?([arr[0]+x,arr[1]+y],visited)\n moves.push([arr[0]+x,arr[1]+y])\n end\n end\n return moves\n end",
"def moves\n res = []\n move_dirs.each do |pos| # [0, 1]\n dx, dy = pos # 0, 1\n temp = grow_unblocked_moves_in_dir(dx, dy) # 0, 1 => [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6]]\n res += temp \n end\n res \n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"def moves\n pos = self.current_position\n moves = []\n move_dirs.each do |arr|\n @current_position = pos\n loop do\n @current_position = [@current_position[0] + arr[0], @current_position[1] + arr[1]]\n break if [@current_position[0], @current_position[1]].any? { |val| val < 0 || val > 7 }\n if board.pos_occupied?(@current_position)\n if @board[@current_position].color == self.color\n break\n else\n moves << @current_position\n break\n end\n moves << @current_position\n end\n moves << @current_position\n end\n end\n moves\n end",
"def possible_moves\n\t\t@board.map.with_index { |piece, idx| piece == \"-\" ? idx : nil }.compact\n\tend",
"def moves\n all_moves = []\n self.move_dirs.each do |move| \n if ((0..7).include?(self.pos[0] + move[0]) && (0..7).include?(self.pos[1] + move[1])) && !(@board[(self.pos[0] + move[0]), (self.pos[1] + move[1])].is_a?(Piece)) #|| self.color == \n all_moves << [(self.pos[0] + move[0]), (self.pos[1] + move[1])]\n end \n end\n all_moves\n end",
"def find_possible_moves(board)\n possible_moves = []\n move_mechanics.each do |move|\n rank = @location[0] + move[0]\n file = @location[1] + move[1]\n next unless valid_location?(rank, file)\n\n possible_moves << [rank, file] unless board.data[rank][file]\n end\n possible_moves\n end",
"def find_possible_moves\n @possible_moves = []\n\n @moveset.each do |move, value|\n x = @x + value[0]\n y = @y + value[1]\n\n next unless ChessBoard.check_boundaries(x, y) && !visited_coordinates.include?([x, y])\n\n @possible_moves << move\n end\n end",
"def moves\n possible_moves = []\n\n self.move_dirs.each do |dir|\n num_steps = 1\n blocked = false\n\n until blocked\n next_step = [dir[0]*num_steps, dir[1]*num_steps]\n next_pos = [self.pos[0] + next_step[0], self.pos[1] + next_step[1]]\n\n break unless next_pos.all? { |i| i.between?(0,7) }\n\n if self.board[next_pos]\n blocked = true\n possible_moves << next_pos unless self.color == self.board[next_pos].color\n else\n possible_moves << next_pos\n num_steps += 1\n end\n end\n end\n\n possible_moves\n end",
"def all_moves_array(initial_x, initial_y)\n\t\tfinal = []\n\t\tx = initial_x + 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\tx = initial_x - 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\ty = initial_y + 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\ty = initial_y - 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\tfinal\n\tend",
"def moves\n directions = MOVE_DIRECTIONS[self.piece_type]\n directions.map do |(dx, dy)|\n x, y = self.position\n [x + dx, y + dy]\n end.select { |coord| on_board?(coord) && not_blocked?(coord) }\n\n # cond = board[[coord]].nil? || board[[coord]].color != self.color\n # opp_cond = !(board[coord].color == self.color)\n # coord = [2,4]\n # [[2,3], nil, [3,4]]\n #(self.board[coord].color != self.color)\n end",
"def protecting_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend",
"def get_valid_moves(pos)\n piece = self[pos]\n color = piece.color\n potential_moves = piece.potential_moves\n valid_moves = []\n potential_moves.each do |to_pos|\n if self.valid_move?(pos, to_pos, color)\n valid_moves << to_pos\n end\n end\n valid_moves\n end",
"def possible_moves(starting_position, actual_piece, turn = @turn, board = @board)\n row = starting_position[0]\n column = starting_position[1]\n potential_moves = []\n\n active_pieces = []\n enemy_pieces = []\n\n if turn == 1\n active_pieces = @w_pieces\n enemy_pieces = @b_pieces\n else\n active_pieces = @b_pieces\n enemy_pieces = @w_pieces\n end\n\n # moves available for white pawns\n if actual_piece == $w_pawn\n # if the white pawn is in its original spot, then it can move two spots or one spot\n return if row == 7\n\n if row == 1\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n potential_moves << [row+2, column] if board[row+2][column] == ' '\n else\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n end\n\n # can take black pieces, but only if they are available diagonally\n potential_moves << [row+1, column+1] if @b_pieces.include?(board[row+1][column+1])\n potential_moves << [row+1, column-1] if @b_pieces.include?(board[row+1][column-1])\n\n # can take black pawns under special en-passant rule\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n # it must be empty in order for us to do en-passant (otherwise the pawn can just take)\n if @board[passant_row+1][passant_col] = ' '\n potential_moves << [passant_row+1, passant_col]\n end\n end\n end\n end \n\n # moves available for black pawns\n if actual_piece == $b_pawn\n # if the black pawn is in its original spot, then it can move two spots or one spot\n return if row == 0\n\n if row == 6\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n potential_moves << [row-2, column] if board[row-2][column] == ' '\n else\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n end\n\n # can take white pieces\n potential_moves << [row-1, column+1] if @b_pieces.include?(board[row-1][column+1])\n potential_moves << [row-1, column-1] if @b_pieces.include?(board[row-1][column-1])\n\n # can take white pawns under special en-passant rule\n\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n if @board[passant_row-1][passant_col] = ' '\n potential_moves << [passant_row-1, passant_col]\n end\n end\n end\n end\n\n # moves available for rooks\n if actual_piece == $w_rook || actual_piece == $b_rook\n\n i_row = row\n i_col = column\n\n # returns all potential moves north of the starting position\n until i_row+1 == 8 || active_pieces.include?(board[i_row+1][i_col])\n if enemy_pieces.include?(board[i_row+1][i_col])\n potential_moves << [i_row+1,i_col]\n break\n else\n potential_moves << [i_row+1,i_col]\n end\n i_row += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moves south of the starting position\n until active_pieces.include?(board[i_row-1][i_col]) || i_row-1 == -1\n if enemy_pieces.include?(board[i_row-1][i_col])\n potential_moves << [i_row-1,i_col]\n break\n else\n potential_moves << [i_row-1,i_col]\n end\n i_row -= 1\n end\n\n i_row = row\n i_col = column\n \n\n # returns all potential moves right of the starting position\n until active_pieces.include?(board[i_row][i_col+1]) || i_col+1 == 8\n if enemy_pieces.include?(board[i_row][i_col+1])\n potential_moves << [i_row,i_col+1]\n break\n else\n potential_moves << [i_row,i_col+1]\n end\n i_col += 1\n end\n\n i_row = row\n i_col = column\n \n # returns all potential moves left of the starting position\n until active_pieces.include?(board[i_row][i_col-1]) || i_col-1 == -1\n if enemy_pieces.include?(board[i_row][i_col-1])\n potential_moves << [i_row,i_col-1]\n break\n else\n potential_moves << [i_row,i_col-1]\n end\n i_col -= 1\n end\n\n i_row = row\n i_col = column\n\n end\n\n # moves available for knights\n if actual_piece == $w_knig || actual_piece == $b_knig\n\n # returns all potential moves\n potential_moves << [row+2, column+1]\n potential_moves << [row+1, column+2]\n potential_moves << [row-1, column+2]\n potential_moves << [row-2, column+1]\n potential_moves << [row-2, column-1]\n potential_moves << [row-1, column-2]\n potential_moves << [row+1, column-2]\n potential_moves << [row+2, column-1]\n\n end\n\n # moves available for bishops\n if actual_piece == $w_bish || actual_piece == $b_bish\n\n i_row = row\n i_col = column\n\n # returns all potential moving north-east of the starting position\n\n until i_row+1 == 8 || i_col+1 == 8 || active_pieces.include?(board[i_row+1][i_col+1])\n if enemy_pieces.include?(board[i_row+1][i_col+1])\n potential_moves << [i_row+1,i_col+1]\n break\n else\n potential_moves << [i_row+1,i_col+1]\n end\n i_row += 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-east of the starting position\n until i_row-1 == -1 || i_col+1 ==8 || active_pieces.include?(board[i_row-1][i_col+1])\n if enemy_pieces.include?(board[i_row-1][i_col+1])\n potential_moves << [i_row-1,i_col+1]\n break\n else\n potential_moves << [i_row-1,i_col+1]\n end\n i_row -= 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-west of the starting position\n until i_row-1 == -1 || i_col-1 == -1 || active_pieces.include?(board[i_row-1][i_col-1])\n if enemy_pieces.include?(board[i_row-1][i_col-1])\n potential_moves << [i_row-1,i_col-1]\n break\n else\n potential_moves << [i_row-1,i_col-1]\n end\n i_row -= 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n \n # returns all potential moving north-east of the starting position\n until i_row+1 == 8 || i_col-1 == -1 || active_pieces.include?(board[i_row+1][i_col-1])\n if enemy_pieces.include?(board[i_row+1][i_col-1])\n potential_moves << [i_row+1,i_col-1]\n break\n else\n potential_moves << [i_row+1,i_col-1]\n end\n i_row += 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n\n end\n\n # moves available for queens\n if actual_piece == $w_quee || actual_piece == $b_quee\n if actual_piece == $w_quee\n potential_moves.concat(possible_moves(starting_position, $w_rook, turn = 1))\n potential_moves.concat(possible_moves(starting_position, $w_bish, turn = 1))\n end\n if actual_piece == $b_quee\n potential_moves.concat(possible_moves(starting_position, $b_rook, turn = 2))\n potential_moves.concat(possible_moves(starting_position, $b_bish, turn = 2))\n end\n end\n\n # moves available for kings\n if actual_piece == $w_king || actual_piece == $b_king\n i_row = row\n i_col = column\n\n potential_moves << [i_row+1, i_col]\n potential_moves << [i_row+1, i_col+1]\n potential_moves << [i_row, i_col+1]\n potential_moves << [i_row-1, i_col-1]\n potential_moves << [i_row-1, i_col]\n potential_moves << [i_row-1, i_col+1]\n potential_moves << [i_row, i_col-1]\n potential_moves << [i_row+1, i_col-1]\n\n # castling conditions\n # The king does not move over a square that is attacked by an enemy piece during the castling move, i.e., when castling, there may not be an enemy piece that can move (in case of pawns: by diagonal movement) to a square that is moved over by the king.\n\n # The king cannot be in check if they are trying to castle\n if !@check_condition\n if actual_piece == $w_king\n # checks for left rook potential\n if board[0][1] == ' ' && board[0][2] == ' ' && board[0][3] == ' '\n binding.pry\n if @w_king_move == \"not moved\" && @w_rook_left == \"not moved\"\n if !enemy_positions.include?([0, 3])\n potential_moves << [0, 2]\n end\n end\n #checks for right rook potential\n elsif board[0][5] == ' ' && board[0][6] == ' '\n if @w_king_move == \"not moved\" && @w_rook_right == \"not moved\"\n if !enemy_positions.include?([0, 5])\n potential_moves << [0, 6]\n end\n end\n end\n end\n if actual_piece == $b_king\n # checks for left rook potential\n if board[7][1] == ' ' && board[7][2] == ' ' && board[7][3] == ' '\n if @b_king_move == \"not moved\" && @b_rook_left == \"not moved\"\n if !enemy_positions.include?([7, 3])\n potential_moves << [7, 2]\n end \n end\n #checks for right rook potential\n elsif board[7][5] == ' ' && board[7][6] == ' '\n if @b_king_move == \"not moved\" && @b_rook_right == \"not moved\"\n if !enemy_positions.include?([7, 5])\n potential_moves << [7, 6] \n end\n end\n end\n end\n end\n\n end\n\n potential_moves = potential_moves.select { |pos| valid_move?(pos, turn)}\n\n potential_moves\n\n end",
"def select_moves(position, posibles)\n moves = []\n posibles.each { |move| moves << [position[0] + move[0], position[1] + move[1]] }\n moves = moves.select { |move| move[0].between?(1,8) && move[1].between?(1,8) }\nend",
"def possible_moves(y_pos, x_pos, moves_list=[[y_pos,x_pos]])\n\t\t\n\t\treturn moves_list if moves_list.length > 64\n\n\t\tmove_square = y_pos+2, x_pos+1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1]) \n\n\t\tmove_square = y_pos+2, x_pos-1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-2, x_pos+1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-2, x_pos-1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos+1, x_pos+2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos+1, x_pos-2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-1, x_pos+2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-1, x_pos-2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmoves_list.each { |move| possible_moves(move[0], move[1], moves_list) }\n\t\treturn moves_list\n\tend",
"def moves\n # create array to collect moves\n possible_moves = []\n move_dirs.each do |dir|\n possible_moves += grow_unblocked_moves_in_dir(dir[0],dir[1])\n end\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n possible_moves\n end",
"def find_possible_moves(board)\n possibilities = []\n move_set.each do |move|\n rank = @location[0] + move[0]\n file = @location[1] + move[1]\n next unless valid_location?(rank, file)\n\n possibilities << [rank, file] unless board.data[rank][file]\n end\n possibilities\n end",
"def moves\n moves = []\n\n # call move_dirs and generate moves\n move_dirs.each do |x,y|\n moves += valid_positions(x,y)\n end\n moves\n end",
"def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless on_board?(next_move)\n break unless empty_square?(next_move)\n available_moves << next_move\n end\n\n available_moves + capture_moves\n end",
"def moves\n result = []\n\n color_setter = (color == :black ? 0 : 1)\n\n ## handles single moves\n d_pos = DELTA[color_setter]\n new_move = calc_new_move(d_pos)\n result << new_move if in_bounds?(new_move) && !occupied?(new_move)\n\n ## handles double move\n d_pos = DOUBLE_MOVE[color_setter]\n new_move = calc_new_move(d_pos)\n result << new_move if in_bounds?(new_move) && !moved? && !result.empty? && !occupied?(new_move)\n\n ## handles capture moves\n CAPTURE_MOVES[color_setter].each do |c_pos|\n new_move = calc_new_move(c_pos)\n result << new_move if in_bounds?(new_move) && capturable?(new_move)\n end\n\n result\n end",
"def legal_moves\n moves = []\n\n # FOR SIMPLICITY require move to be within outer bounds\n # Calculate range of space to check\n\n row_min = [@outer_bounds[:top] - 1, 0].max\n row_max = [@outer_bounds[:bottom] + 1, 18].min\n\n column_min = [@outer_bounds[:left] - 1, 0].max\n column_max = [@outer_bounds[:right] + 1, 18].min\n (row_min..row_max).each do |i|\n (column_min..column_max).each do |j|\n if position[i][j] == \".\" # && !moves.index([i, j])\n moves << [i, j]\n end\n end\n end\n\n moves\n end",
"def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless empty_square?(next_move)\n if on_board?(next_move)\n available_moves << next_move\n end\n end\n\n available_moves + capture_moves\n end",
"def valid_moves(position)\n moves = []\n MOVES.each do |move|\n new_pos1 = move[0] + position[0]\n new_pos2 = move[1] + position[1]\n pos = [new_pos1, new_pos2]\n if pos.min >= 0 && pos.max < 9\n moves << pos\n end\n end\n moves\n end",
"def moves\r\n # pos = [0,0]\r\n # row, col = pos\r\n all_h = []\r\n all_d = []\r\n HORIZONTAL_DIRS.each do |h_pos|\r\n h_row, h_col = h_pos\r\n all_h += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in h_pos\r\n end\r\n DIAGONAL_DIRS.each do |d_pos|\r\n h_row, h_col = d_pos\r\n all_d += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in d_pos\r\n end\r\n if self.class == Queen\r\n return all_h + all_d\r\n elsif self.class == Bishop\r\n return all_d\r\n elsif self.class == Rook\r\n return all_h\r\n end\r\n end",
"def new_move_positions(pos)\n moves_arr = []\n\n #Generate all possible moves from current pos\n moves_arr << [pos[0] + 2, pos[1] - 1]\n moves_arr << [pos[0] + 1, pos[1] + 2]\n moves_arr << [pos[0] + 2, pos[1] + 1]\n moves_arr << [pos[0] + 1, pos[1] - 2]\n moves_arr << [pos[0] - 2, pos[1] + 1]\n moves_arr << [pos[0] - 1, pos[1] + 2]\n moves_arr << [pos[0] - 2, pos[1] - 1]\n moves_arr << [pos[0] - 1, pos[1] + 2]\n\n #use valid moves to remove already visited pos\n\n moves_arr.map! do |move|\n range = (0..7)\n\n debugger\n\n if !range.include?(move[0]) || !range.include?(move[1])\n next\n elsif visited_positions.include?(move)\n next\n end\n\n end\n\n\n #push new moves into visited_positions\n @visited_positions += moves_arr\n end",
"def valid_moves(pos)\n valid_moves = []\n long = [-2,2]\n short = [1,-1]\n valid_moves += valid_moves_helper(pos, long, short)\n valid_moves += valid_moves_helper(pos, short, long)\n end",
"def moves\n\t\tm = []\n\t\t@@moves.each do |move|\n\t\t\tfrom, to = move\n\n\t\t\tp1 = @value & MASKS[from]\n\t\t\tp2 = @value & MASKS[to]\n\n\t\t\tshift = (to - from) * 3\n\t\t\tp1 = p1 >> shift\n\t\t\tp2 = p2 << shift\n\n\t\t\tnum = (@value & INV_MASKS[from]) | p2\n\t\t\tnum = (num & INV_MASKS[to]) | p1\n\n\t\t\tm << State.new(num, @n_moves + 1)\n\t\tend\n\t\tm\n\tend",
"def new_move_positions(pos)\n candidates = KnightPathFinder.valid_moves(pos)\n candidates = candidates.select { |e| !@considered_positions.include?(e) }\n @considered_positions.concat(candidates)\n return candidates\n #@considered_positions = (@considered_positions.concat(candidates)).uniq\n end",
"def generate_possible_moves(start_board)\n possible_moves = []\n\n # possible row moves\n start_board.row_count.times { |x|\n (start_board.col_count-1).times { |y|\n possible_moves << [x, y+1]\n }\n }\n\n # possible column moves\n start_board.col_count.times { |x|\n (start_board.row_count-1).times { |y|\n possible_moves << [start_board.row_count+x, y+1]\n }\n }\n\n return possible_moves\n end",
"def get_moves(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?.\n if board[[3, valid_col]] == ?.\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[3, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n end\n end\n end\n # If not in its column (can never stand in hallway anf column at same time)\n elsif (piece.col == valid_col && piece.row == 2 && board[[piece.row + 1, piece.col]] != piece.name) || (piece.col != valid_col && piece.row == 2)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n elsif piece.row == 3 && piece.col != valid_col && board[[2, piece.col]] == ?.\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 2\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n moves\nend",
"def find_winning_moves(board)\n winning_moves = []\n winning_moves.concat(winning_rows(board))\n winning_moves.concat(winning_cols(board))\n winning_moves.concat(winning_diags(board))\n return winning_moves\n end",
"def possible_moves(spaces)\n possible_moves = []\n if ((@position + 1) % 8 == 0)\n @moves = [8,7,-1,-9,-8]\n elsif (@position % 8 == 0)\n @moves = [-8,-7,1,9,8]\n end\n @moves.each do |move|\n possible_moves << (@position + move)\n end\n possible_moves.select! { |move| (0..63).include?(move) }\n possible_moves.select! do |move| \n spaces[move].class == Fixnum or spaces[move].side_id != @side_id ? true : false\n end\n possible_moves\n end",
"def moves\n\n #\n all_moves = sigma_deltas().map {|delta| transform(delta)}\n # all_moves.select { |move| board.on_board?(move)}\n end",
"def possible_pawn_moves(start_arr)\n\t\tx = start_arr[1]\n\t\ty = start_arr[0]\n\t\tcandidates = []\n\t\tcandidates << [y+1, x]\n\t\t# If pawn has not moved before, it can take a double step straight forward.\n\t\tif y == 1\n\t\t\tcandidates << [y+2, x]\n\t\tend\n\t\tchoices = []\n\t\t# Not a candidate if player's own pieces in the way\n\t\tcandidates.delete_if do |pos|\n\t\t\tif !(@board[pos] == \"*\") && (@board[pos].color == @board[start_arr].color)\n\t\t\t\ttrue\n\t\t\tend\n\t\tend\n\t\t# Can only move up 2 pieces if no pieces in the way.\n\t\tif (candidates.include? [y+2, x]) && !(candidates.include? [y+1,x])\n\t\t\tcandidates = []\n\t\tend\n\t\t# Make sure possible move is on the board\n\t\tchildren = candidates.select { |pos| pos[0] >= 0 && pos[1] >= 0 && pos[0] <= 7 && pos[1] <= 7}\n\tend",
"def new_move_positions(pos)\n possible_moves = KnightPathFinder.valid_moves(pos)\n possible_moves.reject! {|a_pos| @considered_position.include?(a_pos)}\n possible_moves.each {|a_pos| @considered_position << a_pos }\n possible_moves\n end",
"def move_origins(moves = nil)\n moves ||= MOVES[move.piece.downcase]\n possibilities = []\n file, rank = destination_coords\n\n moves.each do |i, j|\n f = file + i\n r = rank + j\n\n possibilities << [f, r] if valid_square?(f, r) && board.at(f, r) == move.piece\n end\n\n possibilities\n end",
"def get_moves_2(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?. && board[[3, valid_col]] == piece.name && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == piece.name\n moves << [[4, valid_col], (cols.count + 3) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == ?.\n moves << [[5, valid_col], (cols.count + 4) * piece.cost]\n end\n end\n # If right column and something is underneath and nothing above\n # If in wrong column completely and nothing above\n elsif piece.row >= 2\n below = (piece.row+1..5).to_a\n above = (2..piece.row-1).to_a\n if ((piece.col == valid_col && below.count{|c| board[[c, piece.col]] != piece.name} != 0 && below.length != 0) || (piece.col != valid_col)) && (above.count{|c| board[[c, piece.col]] == ?.} == above.length)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1 + above.length\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n end\n moves\nend",
"def available_moves(board)\n\t\tmoves = []\n\t\tboard.each_with_index{|cell, index| moves << index.to_s if cell == \" \"}\n\t\tmoves\n\tend",
"def direction_origins\n directions = DIRECTIONS[move.piece.downcase]\n possibilities = []\n\n directions.each do |dir|\n piece, square = first_piece(destination_coords, dir)\n possibilities << square if piece == move.piece\n end\n\n possibilities\n end",
"def moves\n possible_moves = []\n\n move_dirs.each do |dir|\n possible_moves.concat(grow_unblocked_moves_in_dir(dir[0], dir[1])) \n end\n\n possible_moves \n end",
"def movement(row1, col1, board)\n\n possible_moves=Array.new\n if @color==\"white\"\n # checking square in front\n if row1+1<8 && board.get_square(row1+1,col1).occupied==false\n possible_moves <<[row1+1,col1]\n\n #checking 2 squares forward\n if @position==\"initial\" && !board.get_square(row1+2,col1).occupied\n possible_moves <<[row1+2,col1]\n end\n end\n\n # checking attacking squares\n if row1+1<8 && col1-1>=0\n atk_sq1 = board.get_square(row1+1,col1-1)\n\n if atk_sq1.occupied && atk_sq1.piece.color != @color || !atk_sq1.occupied && atk_sq1.en_passanted\n possible_moves <<[row1+1,col1-1]\n end\n end\n if row1+1<8 && col1+1<8\n atk_sq2 = board.get_square(row1+1,col1+1)\n if atk_sq2.occupied && atk_sq2.piece.color != @color || !atk_sq2.occupied && atk_sq2.en_passanted\n possible_moves <<[row1+1,col1+1]\n end\n end\n\n elsif @color==\"black\"\n # checking square in front\n if row1-1>=0 && board.get_square(row1-1,col1).occupied==false\n possible_moves <<[row1-1,col1]\n\n # checking for 2 squares forward\n if @position==\"initial\" && board.get_square(row1-2,col1).occupied==false\n possible_moves <<[row1-2,col1]\n end\n end\n\n # checking attacking squares\n if row1-1>=0 && col1-1>=0\n atk_sq1 = board.get_square(row1-1,col1-1)\n if (atk_sq1.occupied && atk_sq1.piece.color != @color) || (!atk_sq1.occupied && atk_sq1.en_passanted)\n possible_moves <<[row1-1,col1-1]\n end\n end\n if row1-1>=0 && col1+1<8\n atk_sq2 = board.get_square(row1-1,col1+1)\n if (atk_sq2.occupied && atk_sq2.piece.color != @color) || (!atk_sq2.occupied && atk_sq2.en_passanted)\n possible_moves <<[row1-1,col1+1]\n end\n end\n end\n\n #removing moves that go off the board\n possible_moves = possible_moves.select do |a|\n a[0]>=0 && a[0]<8 && a[1]>=0 && a[1]<8\n end\n\n return possible_moves\n\n end",
"def generate_slide_moves(current_pos, board, owner)\n return if out_of_bounds?(current_pos)\n\n next_piece = board.locate_piece(current_pos)\n return if next_piece&.owner == owner\n\n return [current_pos] if next_piece\n\n next_pos = [current_pos[0] + @move[0], current_pos[1] + @move[1]]\n next_moves = generate_slide_moves(next_pos, board, owner)\n return [current_pos] unless next_moves\n\n next_moves.reduce([current_pos]) { |current_moves, deep_moves| current_moves.push(deep_moves) }\n end",
"def generate_possible_moves(state)\n end",
"def group_possible_moves_rook(pm)\n result = []\n\n result << pm.select do |p|\n p[0] == position[0] && p[1] < position[1]\n end\n\n result << pm.select do |p|\n p[0] == position[0] && p[1] > position[1]\n end\n\n result << pm.select do |p|\n p[1] == position[1] && p[0] < position[0]\n end\n\n result << pm.select do |p|\n p[1] == position[1] && p[0] > position[0]\n end\n result[0].reverse!\n result[2].reverse!\n result\n end",
"def listLegalMoveAll\n result = [] ;\n for x in 0..3\n for y in 0..3\n from = Pos.new(x,y) ;\n r = self.listLegalMoveFrom(from) ;\n r.shift ;\n result += r ;\n end\n end\n return result ;\n end",
"def calculate_moves(piece, location)\n @x = location[0].to_i\n @y = location[1].to_i\n @possible_moves = []\n\n def add_straight_line_moves(index)\n move = \"#{@x + (index + 1)}#{@y}\" # Right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y + (index + 1)}\" # Up\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y}\" # Left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y - (index + 1)}\" # Down\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n def add_diagonal_moves(index)\n move = \"#{@x + (index + 1)}#{@y + (index + 1)}\" # Up right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y - (index + 1)}\" # Down left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x + (index + 1)}#{@y - (index + 1)}\" # Down right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y + (index + 1)}\" # Up left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n case piece\n\n when \"WhitePawn\"\n # 1 step forward\n move = \"#{@x}#{@y + 1}\"\n @possible_moves << move unless @board[move] != nil \n # Attack forward right\n move = \"#{@x + 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # Attack forward left\n move = \"#{@x - 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # 2 steps forward if its in the starting point\n move = \"#{@x}#{@y + 2}\"\n @possible_moves << move unless @y != 2 || path_blocked?(move) ||\n @board[move] != nil\n\n when \"BlackPawn\"\n # Same moves of the WhitePawn but reversed\n move = \"#{@x}#{@y - 1}\"\n @possible_moves << move unless @board[move] != nil \n \n move = \"#{@x + 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move \n end\n \n move = \"#{@x - 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move\n end\n \n move = \"#{@x}#{@y - 2}\"\n @possible_moves << move unless @y != 7 || path_blocked?(move) || @board[move]\n\n when \"Rook\"\n # 7 is the max distance between squares\n # The method is called 7 times to have a list of all possible targets ready\n 7.times { |index| add_straight_line_moves(index) }\n\n when \"Knight\"\n knight_moves = [[@x + 1, @y + 2], [@x + 2, @y + 1], \n [@x + 2, @y - 1], [@x + 1, @y - 2], \n [@x - 1, @y - 2], [@x - 2, @y - 1], \n [@x - 2, @y + 1], [@x - 1, @y + 2]]\n \n knight_moves.each do |move|\n move = \"#{move[0]}#{move[1]}\" \n @possible_moves << move unless out_of_bounds?(move) || friendly_piece?(move)\n end\n\n when \"Bishop\"\n 7.times { |index| add_diagonal_moves(index) }\n \n when \"Queen\"\n 7.times do |index|\n add_straight_line_moves(index)\n add_diagonal_moves(index)\n end\n \n when \"King\"\n # The King can move only 1 square away so the methods are called just once\n add_straight_line_moves(0)\n add_diagonal_moves(0)\n else\n\n end\n end",
"def get_valid_moves\n # delta = color == :white ? 1 : -1\n pos = [position[0] + direction, position[1]]\n validated_moves = capture_spaces\n validated_moves << pos if valid_move?(pos)\n unless @moved || !validated_moves.include?(pos)\n\n pos = [position[0] + (2*direction), position[1]]\n validated_moves += valid_move?(pos) ? [pos] : []\n end\n\n validated_moves\n end",
"def find_possible_moves diffs\n [].tap do |possible_moves|\n diffs.each do |row|\n possible_moves << [self.pos[0] + row[1], self.pos[1] + row[0]]\n end\n end \n end",
"def valid_moves(pos)\n valids = []\n MOVE_DIFFERENTIALS.each do |move_diff|\n valids << [(pos[0] + move_diff[0]), (pos[1] + move_diff[1])]\n end\n valids.select { |move| on_board?(move) }\n end",
"def valid_moves_array(game_id, id)\n piece = Game.find(game_id).pieces.find_by(id: id)\n valid_moves_array = []\n if piece.present? && piece.color == Game.find(game_id).turn\n valid_moves_array = [[piece.x_coordinate, piece.y_coordinate]]\n (0..7).each do |y_target|\n (0..7).each do |x_target|\n valid_moves_array << [x_target, y_target] if piece.valid_move?(x_target, y_target)\n end\n end\n valid_moves_array\n end\n end",
"def get_all_possible_moves\n possible_moves = []\n @MOVES.each do |arr|\n possible_moves += get_possible_moves(arr)\n end\n possible_moves\n end",
"def capture_moves\n direction = get_direction\n moves = []\n x, y = @pos\n x += direction\n y += 1\n if @board[ [x, y] ] && @board[ [x,y] ].color == opponent_color\n moves << [x, y]\n end \n y -= 2\n if @board[ [x, y] ] && @board[ [x,y] ].color == opponent_color\n moves << [x, y]\n end\n moves\n end",
"def gen_rook_moves(color, piece=:rook)\n moves = []\n if color == :white\n position = @position.white \n comrades = @position.white_pieces\n enemy = @position.black_pieces\n else\n position = @position.black\n comrades = @position.black_pieces\n enemy = @position.white_pieces\n end\n\n # no work to do when there are no pieces\n return moves if position[piece].nil?\n \n # for each piece\n position[piece].set_bits.each do |from| \n # [i,j] = current position\n i = from / 8\n j = from % 8\n\n #dirs flags which directions the piece is blocked\n dirs = 0\n for k in 1..7\n break if dirs == 0xf\n \n # try moving north\n if (dirs & 0x1) != 0x1\n to = from+k*8\n if i+k>7 || comrades.set?(to)\n # no further north moves possible\n dirs = dirs | 0x1\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x1 if enemy.set?(to) \n end\n end\n \n # try moving south\n if (dirs & 0x2) != 0x2\n to = from-k*8\n if i<k || comrades.set?(to)\n # no further south moves possible\n dirs = dirs | 0x2\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x2 if enemy.set?(to) \n end\n end\n \n # try moving east\n if (dirs & 0x4) != 0x4\n to = from+k\n if j+k>7 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x4\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further east moves possible\n dirs = dirs | 0x4 if enemy.set?(to) \n end\n end\n \n # try moving west\n if (dirs & 0x8) != 0x8\n to = from-k\n if j-k<0 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x8\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further west moves possible\n dirs = dirs | 0x8 if enemy.set?(to) \n end\n end \n end\n end \n moves\n end",
"def legal_moves(index)\n legal_moves = []\n legal_moves << index - 1 if index % 3 != 0 #left\n legal_moves << index + 1 if index % 3 != 2 #right\n legal_moves << index + 3 if index + 3 < 9 #up\n legal_moves << index - 3 if index - 3 > -1 #down\n return legal_moves\n end",
"def moves\n [player_one_move, player_two_move].compact\n end",
"def get_moves(start)\n x = start.x\n y = start.y\n moves = []\n moves << Node.new(x+2, y+1)\n moves << Node.new(x+2, y-1)\n moves << Node.new(x+1, y+2)\n moves << Node.new(x+1, y-2)\n moves << Node.new(x-1, y+2)\n moves << Node.new(x-1, y-2)\n moves << Node.new(x-2, y+1)\n moves << Node.new(x-2, y-1)\n moves = moves.reject do |node|\n node.x < 0 || node.x > 8\n end\n moves = moves.reject do |node|\n node.y < 0 || node.y > 8\n end\n moves.each { |move| move.next_node = start }\nend",
"def generate_moves\n @delta.each do |step|\n (1..7).each do |i|\n new_pos = [@pos[0] + step[0] * i, @pos[1] + step[1] * i]\n if valid_coord?(new_pos)\n @move_list << new_pos\n break if @board[new_pos]\n else\n break\n end\n end\n end\n end",
"def possible_king_moves(start_arr)\n\t\tx = start_arr[0]\n\t\ty = start_arr[1]\n\t\tcandidates = []\n\t\tcandidates << [x+1,y]\n\t\tcandidates << [x-1,y]\t\t\n\t\tcandidates << [x,y+1]\t\t\t\t\n\t\tcandidates << [x,y-1]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\tcandidates << [x+1,y+1]\n\t\tcandidates << [x-1,y-1]\t\n\t\tcandidates << [x-1,y+1]\t\t\t\t\n\t\tcandidates << [x+1,y-1]\t\t\t\t\n\t\tchildren = candidates.select { |pos| pos[0] >= 0 && pos[1] >= 0 && pos[0] <= 7 && pos[1] <= 7}\n\t\tchildren.delete_if do |child|\n\t\t\tif !(@board[child] == \"*\")\n\t\t\t\t# If pieces not same color\n\t\t\t\tif @board[child].color == @board[start_arr].color\n\t\t\t\t\tif occupied(child)\n\t\t\t\t\t\tcan_do = true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tchildren\n\tend",
"def moves_for(player_color)\n moves = Array.new\n board.each_with_keys do |x, y, value|\n if value.eql?(player_color)\n moves.concat generate_for(x,y)\n end\n end\n moves\n end",
"def available_moves\n @available_moves = []\n first_row = [35, 36, 37, 38, 39, 40, 41]\n first_row.each do |position|\n until UI.game.board.cells[position].empty? || position < 0\n position -= 7\n end\n @available_moves << position unless position < 0\n end\n return @available_moves\n end"
] | [
"0.83037543",
"0.81232154",
"0.8114779",
"0.79245496",
"0.7867993",
"0.78561664",
"0.7849601",
"0.781421",
"0.77758414",
"0.77155554",
"0.7640597",
"0.76276886",
"0.7614111",
"0.75958157",
"0.7573149",
"0.7551012",
"0.75299513",
"0.75269735",
"0.75191516",
"0.75015783",
"0.75009",
"0.74900925",
"0.7472794",
"0.7456176",
"0.74451613",
"0.7391867",
"0.7355333",
"0.73091984",
"0.7301136",
"0.72912467",
"0.7276856",
"0.72628003",
"0.7250167",
"0.72403026",
"0.7240049",
"0.7239055",
"0.7228428",
"0.71843976",
"0.7173361",
"0.7155205",
"0.71383905",
"0.7114442",
"0.71106374",
"0.7110566",
"0.707273",
"0.70673037",
"0.7061204",
"0.7032545",
"0.70309436",
"0.7025638",
"0.7024984",
"0.70184034",
"0.70142436",
"0.70103955",
"0.7009882",
"0.7006489",
"0.7004341",
"0.69828284",
"0.697847",
"0.6965947",
"0.6959573",
"0.69520056",
"0.69511473",
"0.6931062",
"0.69282365",
"0.6927359",
"0.69221413",
"0.6919313",
"0.6877863",
"0.6873573",
"0.6865036",
"0.6862248",
"0.68272114",
"0.68230027",
"0.6811503",
"0.6803007",
"0.67973053",
"0.67924297",
"0.6789117",
"0.6787425",
"0.6774803",
"0.67643106",
"0.6746411",
"0.6745741",
"0.67434204",
"0.6724962",
"0.67194813",
"0.6715441",
"0.6714482",
"0.6705396",
"0.66945016",
"0.66925144",
"0.6678243",
"0.6675091",
"0.6671551",
"0.66501176",
"0.66415894",
"0.66392285",
"0.66373706",
"0.66336536"
] | 0.7763802 | 9 |
GET /efemerides GET /efemerides.json | def index
@efemerides = Efemeride.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end",
"def index\n @ideas = Idea.all\n\n render json: @ideas\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def list_ideas\n json_out(Idea.all)\n end",
"def list_ideas\n json_out(Idea.all)\n end",
"def list_ideas\n json_out(Idea.all)\n end",
"def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end",
"def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eicons }\n end\n end",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end",
"def index\n @ideas = Idea.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def index\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def show\n @etape = Etape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etape }\n end\n end",
"def index\n @ephems = Ephem.page(params[:page])\n end",
"def index\n @ejes = Eje.all\n end",
"def show\n render json: @elector\n end",
"def show\n @etsy = Etsy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etsy }\n end\n end",
"def show\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @eou }\n end\n end",
"def show\n @edge = Edge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @edge }\n end\n end",
"def show\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etnia }\n end\n end",
"def index\n @ideas = current_user.ideas.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def show\n @eicon = Eicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eicon }\n end\n end",
"def set_efemeride\n @efemeride = Efemeride.find(params[:id])\n end",
"def show\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @especy }\n end\n end",
"def show\n @embody = Embody.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @embody }\n end\n end",
"def show\n @deed = Deed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deed }\n end\n end",
"def show\n @estate = Estate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estate }\n end\n end",
"def index\n @epiphanies = Epiphany.all\n end",
"def show\n @exalt = Exalt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exalt }\n end\n end",
"def show\n @clientepedido = Clientepedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientepedido }\n end\n end",
"def show\n @evclient = Evclient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evclient }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def index\n @edesalfacts = Edesalfact.all\n end",
"def show\n @e = Encription.find(params[:id])\n\n respond_to do |format|\n format.html \n format.json { render @e }\n \n end\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def index\n @empskeds = Empsked.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empskeds }\n end\n end",
"def show\n @leye = Leye.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leye }\n end\n end",
"def show\n @idea_event = IdeaEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea_event }\n end\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def index\n @escenario_ideals = EscenarioIdeal.all\n end",
"def index\n if params[:admin]==\"1\"\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end\n end",
"def index\n @episodes = Episode.all\n\n render json: @episodes\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @economia4 = Economia4.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @economia4 }\n end\n end",
"def show\n @estoque = Estoque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estoque }\n end\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def show\n @ef_pare = EfPare.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ef_pare }\n end\n end",
"def show\n @attendee = Attendees.find(params[:id])\n render json: @attendee\n end",
"def show\n @expediente = Expediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expediente }\n end\n end",
"def show\n @eatvent = Eatvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eatvent }\n end\n end",
"def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end",
"def index\n @edrives = Edrive.all\n end",
"def index\n @eobs = Eob.assigned\n @title = \"Posted EOBs\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eobs }\n end\n end",
"def show\n @escala = Escala.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @escala }\n end\n end",
"def index\n @eyepieces = Eyepiece.all\n end",
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def show\n @ejercicio = Ejercicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ejercicio }\n end\n end",
"def index\n ends = End.find_each\n render json: ends\n end",
"def show\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea }\n end\n end",
"def show\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea }\n end\n end",
"def show\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea }\n end\n end",
"def show\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea }\n end\n end",
"def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end",
"def index\n @attendees = Attendee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attendees }\n end\n end",
"def show\n @edge_type = EdgeType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @edge_type }\n end\n end",
"def index\n @enderecos = Endereco.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enderecos }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end",
"def show\n @ebook = Ebook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ebook }\n end\n end",
"def show\n @nominee = Nominee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nominee }\n end\n end",
"def show\n @employe = Employe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employe }\n end\n end",
"def show\n @empsked = Empsked.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @empsked }\n end\n end",
"def index\n @eita = Eitum.all\n end",
"def get_elder_data\n @user_id = JSON.parse(request.body.read)\n @elder_data = Elder.find_by_userId(@user_id[\"userId\"])\n if @elder_data == nil\n render json: \"No elder with this Id in the DB\".to_json\n else\n render json: @elder_data.to_json\n end\n end",
"def index\n @edge_types = EdgeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @edge_types }\n end\n end",
"def index\n @attendees = Attendees.all\n render json: @attendees\n end",
"def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end",
"def index\n @emilies = Emily.all\n end",
"def show\n @dayoff = Dayoff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dayoff }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end",
"def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end",
"def show\n @estabelecimento = Estabelecimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estabelecimento }\n end\n end",
"def show\n @idea = Idea.find(params[:id])\n respond_with(@idea) do |format|\n format.json { render json: @idea }\n end\n end",
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def index\n @eds = Ed.all\n end",
"def show\n @etudiant = Etudiant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etudiant }\n end\n end",
"def index\n @esselines = Esseline.all\n end",
"def show\n @coordenador_estagio = CoordenadorEstagio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coordenador_estagio }\n end\n end",
"def create\n @efemeride = Efemeride.new(efemeride_params)\n\n respond_to do |format|\n if @efemeride.save\n format.html { redirect_to @efemeride, notice: 'Efemeride ha sido creada.' }\n format.json { render :show, status: :created, location: @efemeride }\n else\n format.html { render :new }\n format.json { render json: @efemeride.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @endorsements = Endorsement.all\n\n render json: @endorsements\n end",
"def show\n @excercise = Excercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @excercise }\n end\n end",
"def show\n @estabelecimento = Estabelecimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @estabelecimento }\n end\n end",
"def show\n @antecedente = Antecedente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @antecedente }\n end\n end",
"def getIdea(idea_id)\n url_base = getURIBase + \"/api/v1/ideas/#{idea_id}\"\n makeGetCall(url_base, nil, nil)\n end",
"def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"def index\n @epicrises = Epicrisis.all\n @epicrises = @epicrises.page(params[:page])\n end",
"def index\n @evas = Eva.all\n end",
"def index\n @efectivos = Efectivo.all\n end",
"def set_edrife\n @edrife = Edrive.find(params[:id])\n end"
] | [
"0.6595957",
"0.64276004",
"0.637383",
"0.63241476",
"0.63241476",
"0.63241476",
"0.6243483",
"0.62248427",
"0.6222056",
"0.62212324",
"0.6218299",
"0.6201375",
"0.6197122",
"0.61910653",
"0.6160749",
"0.61554456",
"0.61273766",
"0.60763806",
"0.6061175",
"0.6049678",
"0.6048604",
"0.60446346",
"0.60238504",
"0.6019897",
"0.59827006",
"0.5965005",
"0.59611845",
"0.59386176",
"0.5918825",
"0.5913441",
"0.58942264",
"0.5880856",
"0.5879212",
"0.58756053",
"0.5875352",
"0.5870959",
"0.587008",
"0.58590215",
"0.5857387",
"0.58521974",
"0.5848557",
"0.58460355",
"0.5841965",
"0.5835095",
"0.58306926",
"0.58304894",
"0.582545",
"0.5795083",
"0.57719094",
"0.5770741",
"0.57704324",
"0.57646835",
"0.57641983",
"0.5763807",
"0.57586694",
"0.5754189",
"0.57506907",
"0.5749989",
"0.5746133",
"0.5746133",
"0.5746133",
"0.5746133",
"0.5737107",
"0.5720602",
"0.57129925",
"0.57033885",
"0.57017106",
"0.57017106",
"0.56979376",
"0.56964797",
"0.56915027",
"0.56862736",
"0.5675362",
"0.5671425",
"0.56684434",
"0.5666952",
"0.5666769",
"0.5665089",
"0.565515",
"0.56544524",
"0.5645689",
"0.5642433",
"0.564135",
"0.56392974",
"0.56346935",
"0.5630604",
"0.5624927",
"0.56229573",
"0.56228507",
"0.56221414",
"0.56195194",
"0.56189376",
"0.5612015",
"0.5610521",
"0.5606672",
"0.5601341",
"0.55890375",
"0.5586514",
"0.5584001",
"0.55816966"
] | 0.72936547 | 0 |
GET /efemerides/1 GET /efemerides/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @efemerides = Efemeride.all\n end",
"def show\n @etape = Etape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etape }\n end\n end",
"def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end",
"def show\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etnia }\n end\n end",
"def show\n @eicon = Eicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eicon }\n end\n end",
"def show\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @eou }\n end\n end",
"def show\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @especy }\n end\n end",
"def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eicons }\n end\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def show\n @clientepedido = Clientepedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientepedido }\n end\n end",
"def show\n @edge = Edge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @edge }\n end\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end",
"def show\n @economia4 = Economia4.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @economia4 }\n end\n end",
"def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def show\n @expediente = Expediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expediente }\n end\n end",
"def show\n @evclient = Evclient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evclient }\n end\n end",
"def show\n @exalt = Exalt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exalt }\n end\n end",
"def show\n @nominee = Nominee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nominee }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @ejercicio = Ejercicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ejercicio }\n end\n end",
"def index\n @ideas = Idea.all\n\n render json: @ideas\n end",
"def show\n @embody = Embody.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @embody }\n end\n end",
"def show\n render json: @elector\n end",
"def index\n @ejes = Eje.all\n end",
"def show\n @etsy = Etsy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etsy }\n end\n end",
"def show\n @leye = Leye.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leye }\n end\n end",
"def show\n @e = Encription.find(params[:id])\n\n respond_to do |format|\n format.html \n format.json { render @e }\n \n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @ef_pare = EfPare.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ef_pare }\n end\n end",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def show\n @estoque = Estoque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estoque }\n end\n end",
"def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end",
"def show\n @estabelecimento = Estabelecimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estabelecimento }\n end\n end",
"def show\n @estabelecimento = Estabelecimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @estabelecimento }\n end\n end",
"def show\n @estate = Estate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estate }\n end\n end",
"def index\n @ideas = Idea.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def show\n @edge_type = EdgeType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @edge_type }\n end\n end",
"def index\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def show\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referee }\n end\n end",
"def show\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specie }\n end\n end",
"def show\n @escala = Escala.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @escala }\n end\n end",
"def show\n @etudiant = Etudiant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etudiant }\n end\n end",
"def show\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @oferta }\n end\n end",
"def show\n @deed = Deed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deed }\n end\n end",
"def show\n @coordenador_estagio = CoordenadorEstagio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coordenador_estagio }\n end\n end",
"def show\n @depoevento = Depoevento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @depoevento }\n end\n end",
"def show\n @fornecedore = Fornecedore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fornecedore }\n end\n end",
"def index\n @ephems = Ephem.page(params[:page])\n end",
"def show\n @energy = Energy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @energy }\n end\n end",
"def set_efemeride\n @efemeride = Efemeride.find(params[:id])\n end",
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def show\n @detalle = Detalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @detalle }\n end\n end",
"def show\n @idea_event = IdeaEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea_event }\n end\n end",
"def show\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @escola }\n end\n end",
"def show\n @eatvent = Eatvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eatvent }\n end\n end",
"def show\n @employe = Employe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employe }\n end\n end",
"def show\n @antecedente = Antecedente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @antecedente }\n end\n end",
"def show\n @energy_datum = EnergyDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @energy_datum }\n end\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end",
"def show\n @lede = Lede.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lede }\n end\n end",
"def show\n @exercise = Exercise.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def show\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fulcliente }\n end\n end",
"def show\n @attendee = Attendees.find(params[:id])\n render json: @attendee\n end",
"def show\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea }\n end\n end",
"def show\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea }\n end\n end",
"def show\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea }\n end\n end",
"def show\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea }\n end\n end",
"def show\n @ebook = Ebook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ebook }\n end\n end",
"def show\n @diemtrentuyen = Diemtrentuyen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diemtrentuyen }\n end\n end",
"def index\n @episodes = Episode.all\n\n render json: @episodes\n end",
"def show\n @exura = Exura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @exura }\n end\n end",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def index\n @enderecos = Endereco.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enderecos }\n end\n end",
"def show\n @soiree = Soiree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @soiree }\n end\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @exercise }\n end\n end",
"def show\n @cegonha = Cegonha.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cegonha }\n end\n end",
"def show\n @edetail = Edetail.find_by(id: params[:id])\n end",
"def new\n @etape = Etape.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @etape }\n end\n end",
"def show\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exprience }\n end\n end",
"def show\n @informe = Informe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @informe }\n end\n end",
"def show\n @ideium = Ideium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ideium }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def show\n @dayoff = Dayoff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dayoff }\n end\n end",
"def show\n @arcone = Arcone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arcone }\n end\n end",
"def show\n @idea = Idea.find(params[:id])\n respond_with(@idea) do |format|\n format.json { render json: @idea }\n end\n end",
"def index\n @eobs = Eob.assigned\n @title = \"Posted EOBs\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eobs }\n end\n end",
"def index\n @ideas = current_user.ideas.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def show\n @cervejaria = Cervejaria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cervejaria }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @excepcion_entrega = ExcepcionEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @excepcion_entrega }\n end\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n \n @erp = Erp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @erp }\n end\n end",
"def show\n @equipamento = Equipamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @equipamento }\n end\n end"
] | [
"0.7028929",
"0.66010743",
"0.6528467",
"0.6506149",
"0.6490034",
"0.6457086",
"0.6443732",
"0.6412965",
"0.6411595",
"0.63869244",
"0.6370031",
"0.6360404",
"0.6359589",
"0.6352082",
"0.6347313",
"0.63429946",
"0.6333767",
"0.63324493",
"0.63312924",
"0.632442",
"0.6313106",
"0.6303785",
"0.6303448",
"0.62849087",
"0.6281221",
"0.6267236",
"0.6251254",
"0.6243682",
"0.62412286",
"0.6239033",
"0.62386507",
"0.6231696",
"0.62240124",
"0.62191534",
"0.6187682",
"0.61596566",
"0.61429447",
"0.61401117",
"0.6138749",
"0.6138428",
"0.6138343",
"0.61216915",
"0.6117864",
"0.6117735",
"0.61152655",
"0.6109018",
"0.610542",
"0.61041015",
"0.60951835",
"0.60874146",
"0.6071183",
"0.606959",
"0.6064148",
"0.60437495",
"0.6043607",
"0.60393775",
"0.6035448",
"0.6032941",
"0.6030535",
"0.60153973",
"0.59986436",
"0.59986436",
"0.5996488",
"0.59963924",
"0.59918004",
"0.5990392",
"0.59882605",
"0.59816444",
"0.59816444",
"0.59816444",
"0.59816444",
"0.59807956",
"0.5976353",
"0.5969467",
"0.5964011",
"0.59555143",
"0.59539384",
"0.59447217",
"0.59401804",
"0.5929489",
"0.59292644",
"0.5927368",
"0.59198207",
"0.59108067",
"0.58984864",
"0.58930445",
"0.58930445",
"0.5885751",
"0.58824265",
"0.5880446",
"0.58766526",
"0.587514",
"0.5874155",
"0.58730495",
"0.58730495",
"0.58730495",
"0.5872593",
"0.586581",
"0.586581",
"0.5864964",
"0.5856415"
] | 0.0 | -1 |
POST /efemerides POST /efemerides.json | def create
@efemeride = Efemeride.new(efemeride_params)
respond_to do |format|
if @efemeride.save
format.html { redirect_to @efemeride, notice: 'Efemeride ha sido creada.' }
format.json { render :show, status: :created, location: @efemeride }
else
format.html { render :new }
format.json { render json: @efemeride.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @edrife = Edrive.new(edrife_params)\n\n respond_to do |format|\n if @edrife.save\n format.html { redirect_to @edrife, notice: 'Edrive was successfully created.' }\n format.json { render :show, status: :created, location: @edrife }\n else\n format.html { render :new }\n format.json { render json: @edrife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ephem = Ephem.new(ephem_params)\n\n respond_to do |format|\n if @ephem.save\n format.html { redirect_to @ephem, notice: 'Ephem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ephem }\n else\n format.html { render action: 'new' }\n format.json { render json: @ephem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def efemeride_params\n params.require(:efemeride).permit(:numero, :descripcion)\n end",
"def create\n @idea = current_member.ideas.new(idea_params) \n respond_to do |format|\n sectors_params.delete(\"\")\n if @idea.save\n sectors_params.each do |k|\n @idea.sectors << Sector.find_by(id:k)\n end\n format.json { head :no_content }\n format.js\n else\n\n format.json { render :json => { :error => @idea.errors.full_messages }, :status => 422 }\n end\n \n end\n end",
"def create\n @eje = Eje.new(eje_params)\n\n respond_to do |format|\n if @eje.save\n format.html { redirect_to @eje, notice: 'Eje was successfully created.' }\n format.json { render :show, status: :created, location: @eje }\n else\n format.html { render :new }\n format.json { render json: @eje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @deed = Deed.create(deed_params)\n\n if @deed.save\n render json: @deed, status: :created, location: @deed\n else\n render json: @deed.errors, status: :unprocessable_entity\n end\n end",
"def create\n @donee = Donee.new(donee_params)\n\n respond_to do |format|\n if @donee.save\n format.html { redirect_to @donee, notice: 'Donee was successfully created.' }\n format.json { render :show, status: :created, location: @donee }\n else\n format.html { render :new }\n format.json { render json: @donee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etape = Etape.new(params[:etape])\n\n respond_to do |format|\n if @etape.save\n format.html { redirect_to @etape, notice: 'Etape was successfully created.' }\n format.json { render json: @etape, status: :created, location: @etape }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etude = Etude.new(etude_params)\n\n respond_to do |format|\n if @etude.save\n format.html { redirect_to @etude, notice: 'Etude was successfully created.' }\n format.json { render :show, status: :created, location: @etude }\n else\n format.html { render :new }\n format.json { render json: @etude.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @edge = Edge.new(params[:edge])\n\n respond_to do |format|\n if @edge.save\n format.html { redirect_to @edge, notice: 'Edge was successfully created.' }\n format.json { render json: @edge, status: :created, location: @edge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @edge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @edesalfact = Edesalfact.new(edesalfact_params)\n\n respond_to do |format|\n if @edesalfact.save\n format.html { redirect_to @edesalfact, notice: 'Edesalfact was successfully created.' }\n format.json { render :show, status: :created, location: @edesalfact }\n else\n format.html { render :new }\n format.json { render json: @edesalfact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @especy = Especie.new(params[:especy])\n\n respond_to do |format|\n if @especy.save\n format.html { redirect_to @especy, notice: 'Especie was successfully created.' }\n format.json { render json: @especy, status: :created, location: @especy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @demande_eg = DemandeEg.new(demande_eg_params)\n\n respond_to do |format|\n if @demande_eg.save\n format.html { redirect_to @demande_eg, notice: 'Demande eg was successfully created.' }\n format.json { render :show, status: :created, location: @demande_eg }\n else\n format.html { render :\"new\" }\n end\n end\n end",
"def create\n @ed = Ed.new(ed_params)\n\n respond_to do |format|\n if @ed.save\n format.html { redirect_to @ed, notice: 'Ed was successfully created.' }\n format.json { render :show, status: :created, location: @ed }\n else\n format.html { render :new }\n format.json { render json: @ed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etnia = Etnia.new(params[:etnia])\n\n respond_to do |format|\n if @etnia.save\n format.html { redirect_to @etnia, notice: 'Etnia was successfully created.' }\n format.json { render json: @etnia, status: :created, location: @etnia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etnia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @elector = Elector.new(elector_params)\n\n if @elector.save\n render json: @elector, status: :created, location: @elector\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end",
"def create\n @escenario_ideal = EscenarioIdeal.new(escenario_ideal_params)\n\n respond_to do |format|\n if @escenario_ideal.save\n flash[:success] = \"El escenario se ha creado con éxito.\"\n format.html { redirect_to @escenario_ideal, notice: 'Escenario ideal was successfully created.' }\n format.json { render :show, status: :created, location: @escenario_ideal }\n else\n flash[:danger] = \"El escenario no se ha podido crear.\"\n format.html { render :new }\n format.json { render json: @escenario_ideal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eou = Eou.new(params[:eou])\n\n respond_to do |format|\n if @eou.save\n format.html { redirect_to @eou, :notice => 'Eou was successfully created.' }\n format.json { render :json => @eou, :status => :created, :location => @eou }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @eou.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @set_aside = SetAside.new(set_aside_params)\n\n respond_to do |format|\n if @set_aside.save\n format.html { redirect_to @set_aside, notice: 'Set aside was successfully created.' }\n format.json { render action: 'show', status: :created, location: @set_aside }\n else\n format.html { render action: 'new' }\n format.json { render json: @set_aside.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @elder = Elder.new(elder_params)\n\n respond_to do |format|\n if @elder.save\n format.html { redirect_to @elder, notice: 'Se añadió correctamente la información.' }\n format.json { render :show, status: :created, location: @elder }\n else\n format.html { render :new }\n format.json { render json: @elder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eye = Eye.new(eye_params)\n\n respond_to do |format|\n if @eye.save\n format.html { redirect_to @eye, notice: 'Eye was successfully created.' }\n format.json { render :show, status: :created, location: @eye }\n else\n format.html { render :new }\n format.json { render json: @eye.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @etape = Etape.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @etape }\n end\n end",
"def create\n @esseline = Esseline.new(esseline_params)\n\n respond_to do |format|\n if @esseline.save\n format.html { redirect_to @esseline, notice: 'Esseline was successfully created.' }\n format.json { render :show, status: :created, location: @esseline }\n else\n format.html { render :new }\n format.json { render json: @esseline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @emily = Emily.new(emily_params)\n\n respond_to do |format|\n if @emily.save\n format.html { redirect_to @emily, notice: 'Emily was successfully created.' }\n format.json { render :show, status: :created, location: @emily }\n else\n format.html { render :new }\n format.json { render json: @emily.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @idea = current_user.ideas.new(idea_params)\n\n respond_to do |format|\n if @idea.save\n format.html { redirect_to @idea, notice: 'Idea was successfully created.' }\n format.json { render :show, status: :created, location: @idea }\n else\n format.html { render :new }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_efemeride\n @efemeride = Efemeride.find(params[:id])\n end",
"def create\n @epiphany = Epiphany.new(epiphany_params)\n\n respond_to do |format|\n if @epiphany.save\n format.html { redirect_to @epiphany, notice: 'Epiphany was successfully created.' }\n format.json { render :show, status: :created, location: @epiphany }\n else\n format.html { render :new }\n format.json { render json: @epiphany.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @efemerides = Efemeride.all\n end",
"def create\n @ess = Esse.new(ess_params)\n\n respond_to do |format|\n if @ess.save\n format.html { redirect_to esses_url, notice: 'Esse was successfully created.' }\n format.json { render :show, status: :created, location: @ess }\n else\n format.html { render :new }\n format.json { render json: @ess.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n @idea = @agenda.ideas.create(params[:idea])\t\n respond_to do |format|\n if @idea.save\n format.html { redirect_to agenda_path(@agenda), notice: 'Bingo!!! Your idea has been accepted.' }\n format.json { render json: agenda_path(@agenda), status: :created, location: agenda_path(@agenda) }\n else\n format.html { \n flash[:error] = 'Idea description can not be left blank.'\n redirect_to agenda_path(@agenda)\n }\n format.json { render json: agenda_path(@agenda).errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eitum = Eitum.new(eitum_params)\n\n respond_to do |format|\n if @eitum.save\n format.html { redirect_to @eitum, notice: 'Eitum was successfully created.' }\n format.json { render :show, status: :created, location: @eitum }\n else\n format.html { render :new }\n format.json { render json: @eitum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @epreuve = Epreuve.new(epreuve_params)\n\n respond_to do |format|\n if @epreuve.save\n session[:current_epreuve_id] = @epreuve.id\n format.html { redirect_to epreuves_path }\n format.json { render :show, status: :created, location: @epreuve }\n else\n format.html { render :new }\n format.json { render json: @epreuve.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eaten = Eaten.new(eaten_params)\n\n respond_to do |format|\n if @eaten.save\n format.html { redirect_to @eaten, notice: 'Eaten was successfully created.' }\n format.json { render :show, status: :created, location: @eaten }\n else\n format.html { render :new }\n format.json { render json: @eaten.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dispute = Dispute.new(dispute_params)\n\n respond_to do |format|\n if @dispute.save\n format.html { redirect_to @dispute, notice: 'Dispute was successfully created.' }\n format.json { render :show, status: :created, location: @dispute }\n else\n format.html { render :new }\n format.json { render json: @dispute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etf = Etf.new(etf_params)\n @etf.user = current_user\n\n respond_to do |format|\n if @etf.save\n format.html { redirect_to @etf, notice: \"Etf was successfully created.\" }\n format.json { render :show, status: :created, location: @etf }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @etf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @esjiaoben = Esjiaoben.new(esjiaoben_params)\n\n respond_to do |format|\n if @esjiaoben.save\n format.html { redirect_to @esjiaoben, notice: 'Esjiaoben was successfully created.' }\n format.json { render :show, status: :created, location: @esjiaoben }\n else\n format.html { render :new }\n format.json { render json: @esjiaoben.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etapa = Etapa.new(etapa_params)\n\n respond_to do |format|\n if @etapa.save\n format.html { redirect_to @etapa, notice: 'Etapa fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @etapa }\n else\n format.html { render :new }\n format.json { render json: @etapa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @questionfife = Questionfive.new(questionfife_params)\n\n respond_to do |format|\n if @questionfife.save\n format.html { redirect_to @questionfife, notice: 'Questionfive was successfully created.' }\n format.json { render :show, status: :created, location: @questionfife }\n else\n format.html { render :new }\n format.json { render json: @questionfife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @idea_event = IdeaEvent.new(params[:idea_event])\n\n respond_to do |format|\n if @idea_event.save\n format.html { redirect_to @idea_event, notice: 'Idea event was successfully created.' }\n format.json { render json: @idea_event, status: :created, location: @idea_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @idea_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @efemeride.destroy\n respond_to do |format|\n format.html { redirect_to efemerides_url, notice: 'Efemeride ha sido eliminada.' }\n format.json { head :no_content }\n end\n end",
"def create\n @desafio = Desafio.new(desafio_params)\n\n respond_to do |format|\n if @desafio.save\n format.html { redirect_to @desafio, notice: 'Desafio was successfully created.' }\n format.json { render :show, status: :created, location: @desafio }\n else\n format.html { render :new }\n format.json { render json: @desafio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estrada = Estrada.new(estrada_params)\n\n respond_to do |format|\n if @estrada.save\n format.html { redirect_to estradas_url, notice: 'Estrada criada com sucesso.' }\n format.json { render :show, status: :created, location: @estrada }\n else\n format.html { render :new }\n format.json { render json: @estrada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @odeme_akademist = Odeme::Akademist.new(params[:odeme_akademist])\n\n respond_to do |format|\n if @odeme_akademist.save\n format.html { redirect_to @odeme_akademist, notice: 'Akademist was successfully created.' }\n format.json { render json: @odeme_akademist, status: :created, location: @odeme_akademist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @odeme_akademist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @idea = @agenda.ideas.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea }\n end\n end",
"def create \n examenes = params[:examenes]\n byebug \n\n if !params[:perfil][:nombre].nil? || !params[:perfil][:nombre].blank?\n @perfil = Perfil.new(perfil_params) \n @perfil.save\n \n respond_to do |format|\n if @perfil.save\n \n examenes.each do |examen|\n @perfil_examenes = PerfilExamene.new\n @perfil_examenes.perfil_id = @perfil.id\n @perfil_examenes.tipo_examen_id = examen\n @perfil_examenes.save\n end \n \n byebug\n\n format.html { redirect_to perfils_path, notice: 'El Perfil fue creado exitosamente' }\n format.json { render json: { :examenes => examen } }\n else\n \n format.html { render :new }\n format.json { render json: { :examenes => examen } }\n end\n end\n else\n \n respond_to do |format| \n format.html { redirect_to perfils_path, notice: 'El Perfil no fue creado correctamente vuelva a intentarlo' }\n format.json { render json: { :examenes => examen } } \n end\n end \n\n end",
"def create\n @enfermedade = Enfermedade.new(enfermedade_params)\n\n respond_to do |format|\n if @enfermedade.save\n format.html { redirect_to new_padecimiento_path, notice: 'Ahora, por favor dinos a qué eres alérgico' }\n\n else\n format.html { render action: 'new' }\n format.json { render json: @enfermedade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @episode = Episode.new(episode_params)\n\n if @episode.save\n render json: @episode, status: :created, location: @episode\n else\n render json: @episode.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ev = Ev.new(ev_params)\n\n respond_to do |format|\n if @ev.save\n format.html { redirect_to @ev, notice: 'Ev was successfully created.' }\n format.json { render :show, status: :created, location: @ev }\n else\n format.html { render :new }\n format.json { render json: @ev.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @effleurage_option = EffleurageOption.new(effleurage_option_params)\n\n respond_to do |format|\n if @effleurage_option.save\n format.html { redirect_to @effleurage_option, notice: 'Effleurage option was successfully created.' }\n format.json { render :show, status: :created, location: @effleurage_option }\n else\n format.html { render :new }\n format.json { render json: @effleurage_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam = Exam.new(exam_params)\n @exam.patient = @patient\n\n if @exam.save\n render json: @exam, include: [:point_po, :point_or, :point_n, :point_a], methods: :maxillary_depth_angle, status: :created\n else\n render json: @exam.errors, status: :unprocessable_entity\n end\n end",
"def create\n @eat = Eat.new(eat_params)\n\n respond_to do |format|\n if @eat.save\n format.html { redirect_to @eat, notice: 'Eat was successfully created.' }\n format.json { render :show, status: :created, location: @eat }\n else\n format.html { render :new }\n format.json { render json: @eat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etsy = Etsy.new(params[:etsy])\n\n respond_to do |format|\n if @etsy.save\n format.html { redirect_to @etsy, notice: 'Etsy was successfully created.' }\n format.json { render json: @etsy, status: :created, location: @etsy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etsy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @deporte = Deporte.new(deporte_params)\n\n if @deporte.save\n render :show, status: :created, location: @deporte\n else\n render json: @deporte.errors, status: :unprocessable_entity\n end\n end",
"def create\n @bye = Bye.new(bye_params)\n\n respond_to do |format|\n if @bye.save\n format.html { redirect_to @bye, notice: 'Bye was successfully created.' }\n format.json { render :show, status: :created, location: @bye }\n else\n format.html { render :new }\n format.json { render json: @bye.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @deed = Deed.new(params[:deed])\n\n respond_to do |format|\n if @deed.save\n format.html { redirect_to @deed, notice: 'Deed was successfully created.' }\n format.json { render json: @deed, status: :created, location: @deed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @efemeride.update(efemeride_params)\n format.html { redirect_to @efemeride, notice: 'Efemeride ha sido actualizada.' }\n format.json { render :show, status: :ok, location: @efemeride }\n else\n format.html { render :edit }\n format.json { render json: @efemeride.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @efectivo = Efectivo.new(efectivo_params)\n\n respond_to do |format|\n if @efectivo.save\n format.html { redirect_to @efectivo, notice: 'Efectivo was successfully created.' }\n format.json { render :show, status: :created, location: @efectivo }\n else\n format.html { render :new }\n format.json { render json: @efectivo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exalt = Exalt.new(params[:exalt])\n\n respond_to do |format|\n if @exalt.save\n format.html { redirect_to @exalt, notice: 'Exalt was successfully created.' }\n format.json { render json: @exalt, status: :created, location: @exalt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exalt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eva = Eva.new(eva_params)\n\n respond_to do |format|\n if @eva.save\n format.html { redirect_to :back, notice: '✔ 評価が送信されました' }\n format.json { render :show, status: :created, location: @eva }\n else\n format.html { render :new }\n format.json { render json: @eva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eintrag = Eintrag.new(eintrag_params)\n\n respond_to do |format|\n if @eintrag.save\n format.html { redirect_to @eintrag, notice: 'Eintrag was successfully created.' }\n format.json { render :show, status: :created, location: @eintrag }\n else\n format.html { render :new }\n format.json { render json: @eintrag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @enemigo = Enemigo.new(enemigo_params)\n\n respond_to do |format|\n if @enemigo.save\n format.html { redirect_to @enemigo, notice: 'Enemigo was successfully created.' }\n format.json { render :show, status: :created, location: @enemigo }\n else\n format.html { render :new }\n format.json { render json: @enemigo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def eaten_params\n params.require(:eaten).permit(:food_id, :portion_factor, :date)\n end",
"def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def create\n @estate = Estate.new(estate_params)\n\n respond_to do |format|\n if @estate.save\n format.html { redirect_to estates_url, notice: 'Propiedad creada exitosamente.' }\n format.json { render :show, status: :created, location: @estate }\n else\n format.html { render :new }\n format.json { render json: @estate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @three_dee = ThreeDee.new(three_dee_params)\n\n respond_to do |format|\n if @three_dee.save\n format.html { redirect_to @three_dee, notice: 'Three dee was successfully created.' }\n format.json { render :show, status: :created, location: @three_dee }\n else\n format.html { render :new }\n format.json { render json: @three_dee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cheep = Cheep.new(cheep_params)\n\n respond_to do |format|\n if @cheep.save\n format.html { redirect_to @cheep, notice: 'Cheep was successfully created.' }\n format.json { render :show, status: :created, location: @cheep }\n else\n format.html { render :new }\n format.json { render json: @cheep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estoque = Estoque.new(params[:estoque])\n\n respond_to do |format|\n if @estoque.save\n format.html { redirect_to @estoque, notice: 'Estoque was successfully created.' }\n format.json { render json: @estoque, status: :created, location: @estoque }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mae = Mae.new(mae_params)\n\n respond_to do |format|\n if @mae.save\n format.html { redirect_to @mae, notice: 'Mae was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mae }\n else\n format.html { render action: 'new' }\n format.json { render json: @mae.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n inc_id = 1\n unless @event.attendees.blank?\n inc_id = @event.attendees.last.attendee_id.gsub(@event.token_for_id, \"\").to_i + 1\n end\n params[:attendee][:attendee_id] = @event.token_for_id + \"%04d\" % inc_id\n params[:attendee][:a_platform] = params[:attendee][:a_platform].join(\";\") unless params[:attendee][:a_platform].nil?\n params[:attendee][:a_market_segment] = params[:attendee][:a_market_segment].join(\";\") unless params[:attendee][:a_market_segment].nil?\n params[:attendee][:confirmation_token] = Array.new(10) {[*'0'..'9', *'a'..'z'].sample}.join\n params[:attendee][:a_sector] = \"N/A\"\n params[:attendee][:e_ext_number] = 0\n params[:attendee][:e_lada] = 0\n params[:attendee][:e_zip_code] = \"N/A\"\n @attendee = Attendee.new(params[:attendee])\n \n respond_to do |format|\n if @attendee.save\n #AttendeeMailer.welcome_email(@attendee).deliver!\n format.html { redirect_to @attendee, notice: t(:successfully_created) }\n format.json { render json: @attendee, status: :created, location: @attendee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parte_emergencium = ParteEmergencium.new(parte_emergencium_params)\n\n respond_to do |format|\n if @parte_emergencium.save\n format.html {redirect_to @parte_emergencium, notice: 'Parte emergencia creado correctamente.'}\n format.json {render :show, status: :created, location: @parte_emergencium}\n else\n format.html {render :new}\n format.json {render json: @parte_emergencium.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @estate = Estate.new(params[:estate])\n\n respond_to do |format|\n if @estate.save\n format.html { redirect_to @estate, notice: 'Estate was successfully created.' }\n format.json { render json: @estate, status: :created, location: @estate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @artikelgroep = Artikelgroep.new(artikelgroep_params)\n\n respond_to do |format|\n if @artikelgroep.save\n format.html { redirect_to @artikelgroep, notice: 'Artikelgroep was successfully created.' }\n format.json { render action: 'show', status: :created, location: @artikelgroep }\n else\n format.html { render action: 'new' }\n format.json { render json: @artikelgroep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def eje_params\n params.require(:eje).permit(:name)\n end",
"def create\n @resumee = Resumee.new(resumee_params)\n\n respond_to do |format|\n if @resumee.save\n format.html { redirect_to @resumee, notice: 'Resumee was successfully created.' }\n format.json { render :show, status: :created, location: @resumee }\n else\n format.html { render :new }\n format.json { render json: @resumee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eleitore = Eleitore.new(eleitore_params)\n\n respond_to do |format|\n if @eleitore.save\n format.html { redirect_to @eleitore, notice: 'Eleitore was successfully created.' }\n format.json { render :show, status: :created, location: @eleitore }\n else\n format.html { render :new }\n format.json { render json: @eleitore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @edge_type = EdgeType.new(params[:edge_type])\n\n respond_to do |format|\n if @edge_type.save\n format.html { redirect_to @edge_type, notice: 'Edge type was successfully created.' }\n format.json { render json: @edge_type, status: :created, location: @edge_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @edge_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @detalhe = Detalhe.new(detalhe_params)\n\n respond_to do |format|\n if @detalhe.save\n format.html { redirect_to @detalhe, notice: 'Detalhe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @detalhe }\n else\n format.html { render action: 'new' }\n format.json { render json: @detalhe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @idea = Idea.new(params[:idea])\n\n respond_to do |format|\n if @idea.save\n format.html { redirect_to @idea, notice: 'Idea was successfully created.' }\n format.json { render json: @idea, status: :created, location: @idea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @em = Em.new(em_params)\n\n respond_to do |format|\n if @em.save\n format.html { redirect_to @em, notice: 'Em was successfully created.' }\n format.json { render :show, status: :created, location: @em }\n else\n format.html { render :new }\n format.json { render json: @em.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ess_params\n params.require(:esse).permit(:code, :name, :essetype, esselines_attributes: [:code,:name,:esselinetype,:remarks])\n end",
"def create\n @mye = Mye.new(mye_params)\n\n respond_to do |format|\n if @mye.save\n format.html { redirect_to @mye, notice: 'Mye was successfully created.' }\n format.json { render :show, status: :created, location: @mye }\n else\n format.html { render :new }\n format.json { render json: @mye.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @embody = Embody.new(params[:embody])\n\n respond_to do |format|\n if @embody.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.embody'))\n format.html { redirect_to(@embody) }\n format.json { render :json => @embody, :status => :created, :location => @embody }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @embody.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # @ideia = Ideia.new(params[:ideia])\n @ideia = current_usuario.ideias.new(params[:ideia])\n\n respond_to do |format|\n if @ideia.save\n format.html { redirect_to(@ideia, :notice => 'Ideia criada com sucesso.') }\n format.xml { render :xml => @ideia, :status => :created, :location => @ideia }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ideia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @card_edge = CardEdge.new(card_edge_params)\n\n respond_to do |format|\n if @card_edge.save\n format.html { redirect_to @card_edge, notice: 'Card edge was successfully created.' }\n format.json { render :show, status: :created, location: @card_edge }\n else\n format.html { render :new }\n format.json { render json: @card_edge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etapa = Etapa.new(etapa_params)\n\n respond_to do |format|\n if @etapa.save\n format.html { redirect_to board_url(@etapa.board), notice: 'Etapa was successfully created.' }\n format.json { render :show, status: :created, location: @etapa }\n else\n format.html { render :new }\n format.json { render json: @etapa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @edge = Edge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @edge }\n end\n end",
"def new\n @estoque = Estoque.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estoque }\n end\n end",
"def create\n @especie_region = EspecieRegion.new(especie_region_params)\n\n respond_to do |format|\n if @especie_region.save\n format.html { redirect_to @especie_region, notice: 'Especie region was successfully created.' }\n format.json { render action: 'show', status: :created, location: @especie_region }\n else\n format.html { render action: 'new' }\n format.json { render json: @especie_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @epargne_type = EpargneType.new(epargne_type_params)\n\n respond_to do |format|\n if @epargne_type.save\n format.html { redirect_to @epargne_type, notice: 'Epargne type was successfully created.' }\n format.json { render :show, status: :created, location: @epargne_type }\n else\n format.html { render :new }\n format.json { render json: @epargne_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def aide_params\n params.require(:aide).permit(:result_no, :generate_no, :e_no, :aide_no, :name, :enemy_id, :cost_sp, :bonds, :mhp, :msp, :mep, :range, :fuka_texts, :skill_texts)\n end",
"def create\n @desease = Desease.new(desease_params)\n\n if @desease.save\n render json: @desease, status: :ok\n else\n render json: @desease.errors, status: :unprocessable_entity\n end\n end",
"def create\n @empolyee = Empolyee.new(empolyee_params)\n\n respond_to do |format|\n if @empolyee.save\n format.html { redirect_to @empolyee, notice: 'Empolyee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @empolyee }\n else\n format.html { render action: 'new' }\n format.json { render json: @empolyee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def donee_params\n params.require(:donee).permit(:name, :blurb, :id)\n end",
"def create\n @emmision = Emmision.new(emmision_params)\n\n respond_to do |format|\n if @emmision.save\n format.html { redirect_to @emmision, notice: \"Emmision was successfully created.\" }\n format.json { render :show, status: :created, location: @emmision }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @emmision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @idea_event = IdeaEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea_event }\n end\n end",
"def create\n @lakeside = Lakeside.new(lakeside_params)\n\n respond_to do |format|\n if @lakeside.save\n format.html { redirect_to @lakeside, notice: 'Lakeside was successfully created.' }\n format.json { render :show, status: :created, location: @lakeside }\n else\n format.html { render :new }\n format.json { render json: @lakeside.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:idea][:tags] = params[:idea][:tags].collect { |tag| Tag.find(tag) }\n\n @idea = @current_user.ideas.create(params[:idea])\n\n respond_to do |format|\n if @idea.save\n format.html { redirect_to(@idea, :notice => 'Idea was successfully created.') }\n format.xml { render :xml => @idea, :status => :created, :location => @idea }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @embody = Embody.new\n @embody.expression = @expression\n @embody.manifestation = @manifestation\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @embody }\n end\n end",
"def create\n @detalle = Detalle.new(params[:detalle])\n\n respond_to do |format|\n if @detalle.save\n format.html { redirect_to @detalle, notice: 'Detalle was successfully created.' }\n format.json { render json: @detalle, status: :created, location: @detalle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @detalle.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6362536",
"0.6338888",
"0.6289659",
"0.62379044",
"0.6176653",
"0.6022605",
"0.6013906",
"0.5988079",
"0.5895292",
"0.5869615",
"0.5860972",
"0.5858056",
"0.58465064",
"0.58321863",
"0.5808621",
"0.58060694",
"0.57956755",
"0.5773347",
"0.5754637",
"0.57378435",
"0.5728085",
"0.5715019",
"0.57110816",
"0.5663396",
"0.5658012",
"0.56498617",
"0.56483096",
"0.5645887",
"0.56398994",
"0.5634452",
"0.5611218",
"0.560778",
"0.55960125",
"0.55900615",
"0.55832326",
"0.55676407",
"0.55640525",
"0.5561207",
"0.5560699",
"0.556062",
"0.55605495",
"0.55571574",
"0.5549812",
"0.5543948",
"0.55422086",
"0.5531954",
"0.5530415",
"0.5526465",
"0.55260295",
"0.55230933",
"0.55152816",
"0.55150944",
"0.55111456",
"0.5510514",
"0.55076563",
"0.5494285",
"0.54883915",
"0.54870385",
"0.54853",
"0.54844534",
"0.5484244",
"0.54842174",
"0.54817754",
"0.54812276",
"0.5477419",
"0.5474674",
"0.5472933",
"0.5471101",
"0.5470668",
"0.54644513",
"0.5461516",
"0.54535866",
"0.5452809",
"0.5446233",
"0.5445143",
"0.54434556",
"0.5435421",
"0.5428673",
"0.54219514",
"0.5417581",
"0.5416632",
"0.5411353",
"0.5407796",
"0.5404057",
"0.5391034",
"0.5385669",
"0.5384035",
"0.5383436",
"0.5382948",
"0.5382616",
"0.5380169",
"0.5379862",
"0.53784734",
"0.5367824",
"0.5367506",
"0.5365647",
"0.53615445",
"0.5361243",
"0.53601617",
"0.5359355"
] | 0.70247984 | 0 |
PATCH/PUT /efemerides/1 PATCH/PUT /efemerides/1.json | def update
respond_to do |format|
if @efemeride.update(efemeride_params)
format.html { redirect_to @efemeride, notice: 'Efemeride ha sido actualizada.' }
format.json { render :show, status: :ok, location: @efemeride }
else
format.html { render :edit }
format.json { render json: @efemeride.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @ephem.update(ephem_params)\n format.html { redirect_to @ephem, notice: 'Ephem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ephem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n if @especy.update_attributes(params[:especy])\n format.html { redirect_to @especy, notice: 'Especie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @edrife.update(edrife_params)\n format.html { redirect_to @edrife, notice: 'Edrive was successfully updated.' }\n format.json { render :show, status: :ok, location: @edrife }\n else\n format.html { render :edit }\n format.json { render json: @edrife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eje.update(eje_params)\n format.html { redirect_to @eje, notice: 'Eje was successfully updated.' }\n format.json { render :show, status: :ok, location: @eje }\n else\n format.html { render :edit }\n format.json { render json: @eje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @etape = Etape.find(params[:id])\n\n respond_to do |format|\n if @etape.update_attributes(params[:etape])\n format.html { redirect_to @etape, notice: 'Etape was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @etape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n if @referee.update_attributes(params[:referee])\n format.html { redirect_to @referee, notice: 'Referee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @referee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @set_aside.update(set_aside_params)\n format.html { redirect_to @set_aside, notice: 'Set aside was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @set_aside.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @emily.update(emily_params)\n format.html { redirect_to @emily, notice: 'Emily was successfully updated.' }\n format.json { render :show, status: :ok, location: @emily }\n else\n format.html { render :edit }\n format.json { render json: @emily.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @nominee = Nominee.find(params[:id])\n\n respond_to do |format|\n if @nominee.update_attributes(params[:nominee])\n format.html { redirect_to @nominee, notice: 'Nominee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nominee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ecole.update(ecole_params)\n format.html { redirect_to ecoles_url, notice: 'Ecole was successfully updated.' }\n format.json { render :show, status: :ok, location: @ecole }\n else\n format.html { render :edit }\n format.json { render json: @ecole.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n if @etnia.update_attributes(params[:etnia])\n format.html { redirect_to @etnia, notice: 'Etnia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @etnia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n if @eou.update_attributes(params[:eou])\n format.html { redirect_to @eou, :notice => 'Eou was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @eou.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @enfermedade.update(enfermedade_params)\n format.html { redirect_to root_path, notice: 'Enfermedade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @enfermedade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @esseline.update(esseline_params)\n format.html { redirect_to @esseline, notice: 'Esseline was successfully updated.' }\n format.json { render :show, status: :ok, location: @esseline }\n else\n format.html { render :edit }\n format.json { render json: @esseline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exalt = Exalt.find(params[:id])\n\n respond_to do |format|\n if @exalt.update_attributes(params[:exalt])\n format.html { redirect_to @exalt, notice: 'Exalt was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exalt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @empolyee.update(empolyee_params)\n format.html { redirect_to @empolyee, notice: 'Empolyee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @empolyee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n respond_with(@idea) do |format|\n if @idea.update_attributes(params[:idea])\n format.json { render json: @idea, status: :created, location: @idea }\n else\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fornecedore = Fornecedore.find(params[:id])\n\n respond_to do |format|\n if @fornecedore.update_attributes(params[:fornecedore])\n format.html { redirect_to @fornecedore, notice: 'Fornecedore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fornecedore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n respond_to do |format|\n if @referee.update(referee_params)\n format.html { redirect_to [:admin, @referee], notice: 'Referee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @referee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @refugee.update(refugee_params)\n format.html { redirect_to @refugee, notice: 'Refugee was successfully updated.' }\n format.json { render :show, status: :ok, location: @refugee }\n else\n format.html { render :edit }\n format.json { render json: @refugee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @donee.update(donee_params)\n format.html { redirect_to @donee, notice: 'Donee was successfully updated.' }\n format.json { render :show, status: :ok, location: @donee }\n else\n format.html { render :edit }\n format.json { render json: @donee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n if @estatuto.update_attributes(params[:estatuto])\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @etf.update(etf_params)\n format.html { redirect_to @etf, notice: \"Etf was successfully updated.\" }\n format.json { render :show, status: :ok, location: @etf }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @etf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @efectivo.update(efectivo_params)\n format.html { redirect_to @efectivo, notice: 'Efectivo was successfully updated.' }\n format.json { render :show, status: :ok, location: @efectivo }\n else\n format.html { render :edit }\n format.json { render json: @efectivo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employe = Employe.find(params[:id])\n\n respond_to do |format|\n if @employe.update_attributes(params[:employe])\n format.html { redirect_to @employe, notice: 'Employe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @hearted.update(hearted_params)\n format.html { redirect_to @hearted, notice: 'Hearted was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hearted.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eye.update(eye_params)\n format.html { redirect_to @eye, notice: 'Eye was successfully updated.' }\n format.json { render :show, status: :ok, location: @eye }\n else\n format.html { render :edit }\n format.json { render json: @eye.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n if @fulcliente.update_attributes(params[:fulcliente])\n format.html { redirect_to @fulcliente, notice: 'Fulcliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fulcliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @soiree = Soiree.find(params[:id])\n\n respond_to do |format|\n if @soiree.update_attributes(params[:soiree])\n format.html { redirect_to @soiree, notice: 'Soiree was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @soiree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estoque = Estoque.find(params[:id])\n\n respond_to do |format|\n if @estoque.update_attributes(params[:estoque])\n format.html { redirect_to @estoque, notice: 'Estoque was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evangelism.update(evangelism_params)\n format.html { redirect_to @evangelism, notice: 'Evangelism was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @evangelism.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @elector = Elector.find(params[:id])\n\n if @elector.update(elector_params)\n head :no_content\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @elder.update(elder_params)\n format.html { redirect_to @elder, notice: 'Se editó correctamente la información.' }\n format.json { render :show, status: :ok, location: @elder }\n else\n format.html { render :edit }\n format.json { render json: @elder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @resumee.update(resumee_params)\n format.html { redirect_to @resumee, notice: 'Resumee was successfully updated.' }\n format.json { render :show, status: :ok, location: @resumee }\n else\n format.html { render :edit }\n format.json { render json: @resumee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aneart.update(aneart_params)\n format.html { redirect_to anearts_path, notice: 'Aneart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @aneart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n if @agente.update_attributes(params[:agente])\n format.html { redirect_to @agente, notice: 'Agente se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clientepedido = Clientepedido.find(params[:id])\n\n respond_to do |format|\n if @clientepedido.update_attributes(params[:clientepedido])\n format.html { redirect_to @clientepedido, notice: 'EL pedido fue actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientepedido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @edge = Edge.find(params[:id])\n\n respond_to do |format|\n if @edge.update_attributes(params[:edge])\n format.html { redirect_to @edge, notice: 'Edge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @edge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sheep.update(sheep_params)\n format.html { redirect_to @sheep, notice: 'Sau ble oppdatert.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sheep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @epreuve.update(epreuve_params)\n format.html { redirect_to epreuves_path, alert: 'Vos modifications ont bien été prises en compte.' }\n format.json { render :show, status: :ok, location: epreuves_path }\n else\n format.html { render :index }\n format.json { render json: @epreuve.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @idea.update(idea_params)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @mae.update(mae_params)\n format.html { redirect_to @mae, notice: 'Mae was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mae.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @edesalfact.update(edesalfact_params)\n format.html { redirect_to @edesalfact, notice: 'Edesalfact was successfully updated.' }\n format.json { render :show, status: :ok, location: @edesalfact }\n else\n format.html { render :edit }\n format.json { render json: @edesalfact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @etude.update(etude_params)\n format.html { redirect_to @etude, notice: 'Etude was successfully updated.' }\n format.json { render :show, status: :ok, location: @etude }\n else\n format.html { render :edit }\n format.json { render json: @etude.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @especie_region.update(especie_region_params)\n format.html { redirect_to @especie_region, notice: 'Especie region was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @especie_region.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @referee.update(referee_params)\n format.html { redirect_to root_path, notice: 'Referee was successfully updated.' }\n format.json { render :show, status: :ok, location: @referee }\n else\n format.html { render :edit }\n format.json { render json: @referee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evclient = Evclient.find(params[:id])\n\n respond_to do |format|\n if @evclient.update_attributes(params[:evclient])\n format.html { redirect_to @evclient, notice: 'Evclient was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evclient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eva.update(eva_params)\n format.html { redirect_to :back, notice: '評価を更新しました' }\n format.json { render :show, status: :ok, location: @eva }\n else\n format.html { render :edit }\n format.json { render json: @eva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @detalhe.update(detalhe_params)\n format.html { redirect_to @detalhe, notice: 'Detalhe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @detalhe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @odeme_akademist = Odeme::Akademist.find(params[:id])\n\n respond_to do |format|\n if @odeme_akademist.update_attributes(params[:odeme_akademist])\n format.html { redirect_to @odeme_akademist, notice: 'Akademist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @odeme_akademist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @questionfife.update(questionfife_params)\n format.html { redirect_to @questionfife, notice: 'Questionfive was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionfife }\n else\n format.html { render :edit }\n format.json { render json: @questionfife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estabelecimento = Estabelecimento.find(params[:id])\n\n respond_to do |format|\n if @estabelecimento.update_attributes(params[:estabelecimento])\n format.html { redirect_to @estabelecimento, :notice => 'Estabelecimento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @estabelecimento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eitum.update(eitum_params)\n format.html { redirect_to @eitum, notice: 'Eitum was successfully updated.' }\n format.json { render :show, status: :ok, location: @eitum }\n else\n format.html { render :edit }\n format.json { render json: @eitum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eaten.update(eaten_params)\n format.html { redirect_to @eaten, notice: 'Eaten was successfully updated.' }\n format.json { render :show, status: :ok, location: @eaten }\n else\n format.html { render :edit }\n format.json { render json: @eaten.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cheep.update(cheep_params)\n format.html { redirect_to @cheep, notice: 'Cheep was successfully updated.' }\n format.json { render :show, status: :ok, location: @cheep }\n else\n format.html { render :edit }\n format.json { render json: @cheep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kela.update(kela_params)\n format.html { redirect_to @kela, notice: 'Kela was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @earth.update(earth_params)\n format.html { redirect_to earths_path, notice: 'Earth was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @earth.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n if @metodo.update_attributes(params[:metodo])\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expediente = Expediente.find(params[:id])\n\n respond_to do |format|\n if @expediente.update_attributes(params[:expediente])\n format.html { redirect_to @expediente, notice: 'Expediente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expediente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eat.update(eat_params)\n format.html { redirect_to @eat, notice: 'Eat was successfully updated.' }\n format.json { render :show, status: :ok, location: @eat }\n else\n format.html { render :edit }\n format.json { render json: @eat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea_event = IdeaEvent.find(params[:id])\n\n respond_to do |format|\n if @idea_event.update_attributes(params[:idea_event])\n format.html { redirect_to @idea_event, notice: 'Idea event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idea_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @informe = Informe.find(params[:id])\n\n respond_to do |format|\n if @informe.update_attributes(params[:informe])\n format.html { redirect_to @informe, notice: 'Informe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @informe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @referee.update(referee_params)\n format.html { redirect_to @referee, notice: \"Referee was successfully updated.\" }\n format.json { render :show, status: :ok, location: @referee }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @referee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @etsy = Etsy.find(params[:id])\n\n respond_to do |format|\n if @etsy.update_attributes(params[:etsy])\n format.html { redirect_to @etsy, notice: 'Etsy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @etsy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end",
"def update\n @detalle = Detalle.find(params[:id])\n\n respond_to do |format|\n if @detalle.update_attributes(params[:detalle])\n format.html { redirect_to @detalle, notice: 'Detalle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eintrag.update(eintrag_params)\n format.html { redirect_to @eintrag, notice: 'Eintrag was successfully updated.' }\n format.json { render :show, status: :ok, location: @eintrag }\n else\n format.html { render :edit }\n format.json { render json: @eintrag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n if @foam.update_attributes(params[:foam])\n format.html { redirect_to @foam, notice: 'Foam was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estate = Estate.find(params[:id])\n\n respond_to do |format|\n if @estate.update_attributes(params[:estate])\n format.html { redirect_to @estate, notice: 'Estate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to @food, notice: \"Piatto aggiornato correttamente.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @embody = Embody.find(params[:id])\n\n respond_to do |format|\n if @embody.update_attributes(params[:embody])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.embody'))\n format.html { redirect_to(@embody) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @embody.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aprov_estabelecimento.update(aprov_estabelecimento_params)\n format.html { redirect_to @aprov_estabelecimento, notice: 'Aprov estabelecimento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @aprov_estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estabelecimento = Estabelecimento.find(params[:id])\n\n respond_to do |format|\n if @estabelecimento.update_attributes(params[:estabelecimento])\n format.html { redirect_to @estabelecimento, notice: 'Estabelecimento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @depoevento = Depoevento.find(params[:id])\n\n respond_to do |format|\n if @depoevento.update_attributes(params[:depoevento])\n format.html { redirect_to @depoevento, notice: 'Depoevento was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @depoevento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.657859",
"0.6500946",
"0.6267927",
"0.6232415",
"0.6207815",
"0.62031585",
"0.61929935",
"0.619094",
"0.6172974",
"0.61641216",
"0.61198616",
"0.60809433",
"0.60808015",
"0.6070673",
"0.60662687",
"0.6058941",
"0.6054351",
"0.60444343",
"0.6042393",
"0.6036405",
"0.60329217",
"0.6031788",
"0.6031116",
"0.60280955",
"0.60280955",
"0.60232407",
"0.602176",
"0.6015372",
"0.60116285",
"0.6011042",
"0.60036266",
"0.60032004",
"0.5998282",
"0.59956074",
"0.5977179",
"0.59762836",
"0.5973893",
"0.5970383",
"0.5968925",
"0.5964386",
"0.5959034",
"0.5957329",
"0.5947328",
"0.5940826",
"0.5930163",
"0.59246695",
"0.5923618",
"0.59231305",
"0.59198",
"0.5919328",
"0.59158194",
"0.5914433",
"0.5910569",
"0.5905677",
"0.5901617",
"0.58962274",
"0.5895992",
"0.5889012",
"0.5882776",
"0.5877801",
"0.58763844",
"0.5874148",
"0.5873135",
"0.5871444",
"0.58656377",
"0.5860277",
"0.58579767",
"0.58579767",
"0.58579767",
"0.5853384",
"0.58440006",
"0.5843532",
"0.5842368",
"0.5842368",
"0.58398575",
"0.5839605",
"0.5838828",
"0.5838584",
"0.5832948",
"0.5831777",
"0.58298147",
"0.5828694",
"0.582783",
"0.5816315",
"0.5815543",
"0.5811754",
"0.58108366",
"0.580412",
"0.5803702",
"0.58024114",
"0.58018017",
"0.57999706",
"0.57994914",
"0.5798468",
"0.57974225",
"0.5796547",
"0.57945615",
"0.5794246",
"0.57932466",
"0.5788715"
] | 0.65653116 | 1 |
DELETE /efemerides/1 DELETE /efemerides/1.json | def destroy
@efemeride.destroy
respond_to do |format|
format.html { redirect_to efemerides_url, notice: 'Efemeride ha sido eliminada.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @ephem.destroy\n respond_to do |format|\n format.html { redirect_to ephems_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @clientepedido = Clientepedido.find(params[:id])\n @clientepedido.destroy\n\n respond_to do |format|\n format.html { redirect_to clientepedidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etape = Etape.find(params[:id])\n @etape.destroy\n\n respond_to do |format|\n format.html { redirect_to etapes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eod.destroy\n respond_to do |format|\n format.html { redirect_to eods_url, notice: 'Eod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @edetail = Edetail.find_by(id: params[:id])\n @edetail.destroy\n respond_to do |format|\n format.html { redirect_to edetails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etnia = Etnia.find(params[:id])\n @etnia.destroy\n\n respond_to do |format|\n format.html { redirect_to etnias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @elefe.destroy\n respond_to do |format|\n format.html { redirect_to eleves_url, notice: 'La fiche élève a bien été effacée.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle = Detalle.find(params[:id])\n @detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to detalles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @esseline.destroy\n respond_to do |format|\n format.html { redirect_to esselines_url, notice: 'Esseline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @economia4 = Economia4.find(params[:id])\n @economia4.destroy\n\n respond_to do |format|\n format.html { redirect_to economia4s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eje.destroy\n respond_to do |format|\n format.html { redirect_to ejes_url, notice: 'Eje was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eou = Eou.find(params[:id])\n @eou.destroy\n\n respond_to do |format|\n format.html { redirect_to eous_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @referee = Referee.find(params[:id])\n @referee.destroy\n\n respond_to do |format|\n format.html { redirect_to referees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @edrife.destroy\n respond_to do |format|\n format.html { redirect_to edrives_url, notice: 'Edrive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ecole.destroy\n respond_to do |format|\n format.html { redirect_to ecoles_url, notice: 'Ecole was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @evangelism.destroy\n respond_to do |format|\n format.html { redirect_to evangelisms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @refugee.destroy\n respond_to do |format|\n format.html { redirect_to refugees_url, notice: 'Refugee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ideium = Ideium.find(params[:id])\n @ideium.destroy\n\n respond_to do |format|\n format.html { redirect_to ideia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exalt = Exalt.find(params[:id])\n @exalt.destroy\n\n respond_to do |format|\n format.html { redirect_to exalts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @edesalfact.destroy\n respond_to do |format|\n format.html { redirect_to edesalfacts_url, notice: 'Edesalfact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nominee.destroy\n respond_to do |format|\n format.html { redirect_to nominees_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @odeme_akademist = Odeme::Akademist.find(params[:id])\n @odeme_akademist.destroy\n\n respond_to do |format|\n format.html { redirect_to odeme_akademists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @referee.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Referee was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evclient = Evclient.find(params[:id])\n @evclient.destroy\n\n respond_to do |format|\n format.html { redirect_to evclients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @diemtrentuyen = Diemtrentuyen.find(params[:id])\n @diemtrentuyen.destroy\n\n respond_to do |format|\n format.html { redirect_to diemtrentuyens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @elder.destroy\n respond_to do |format|\n format.html { redirect_to elders_url, notice: 'Se eliminó correctamente la información.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @especy = Especie.find(params[:id])\n @especy.destroy\n\n respond_to do |format|\n format.html { redirect_to especies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fornecedore = Fornecedore.find(params[:id])\n @fornecedore.destroy\n\n respond_to do |format|\n format.html { redirect_to fornecedores_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @etudiant = Etudiant.find(params[:id])\n @etudiant.destroy\n\n respond_to do |format|\n format.html { redirect_to etudiants_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @enfermedade.destroy\n respond_to do |format|\n format.html { redirect_to enfermedades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @efimerida.destroy\n respond_to do |format|\n format.html { redirect_to efimeridas_url, notice: 'Efimerida was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @edge = Edge.find(params[:id])\n @edge.destroy\n\n respond_to do |format|\n format.html { redirect_to edges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @soiree = Soiree.find(params[:id])\n @soiree.destroy\n\n respond_to do |format|\n format.html { redirect_to soirees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @escola = Escola.find(params[:id])\n @escola.destroy\n\n respond_to do |format|\n format.html { redirect_to escolas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @esjiaoben.destroy\n respond_to do |format|\n format.html { redirect_to esjiaobens_url, notice: 'Esjiaoben was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @energy = Energy.find(params[:id])\n @energy.destroy\n\n respond_to do |format|\n format.html { redirect_to energies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eitum.destroy\n respond_to do |format|\n format.html { redirect_to eita_url, notice: 'Eitum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estagio = Estagio.find(params[:id])\n @estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(estagios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @three_dee.destroy\n respond_to do |format|\n format.html { redirect_to three_dees_url, notice: 'Three dee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estadia.destroy\n respond_to do |format|\n format.html { redirect_to estadia_url, notice: 'Estadia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @efac.destroy\n respond_to do |format|\n format.html { redirect_to efacs_url, notice: 'El Evento formativo se ha eliminado con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expediente = Expediente.find(params[:id])\n @expediente.destroy\n\n respond_to do |format|\n format.html { redirect_to expedientes_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @etiquetum.destroy\n respond_to do |format|\n format.html { redirect_to etiqueta_url, notice: 'Etiqueta borrada!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @efectivo.destroy\n respond_to do |format|\n format.html { redirect_to efectivos_url, notice: 'Efectivo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @idea = Idea.find(params[:id])\n @idea.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_ideas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estate.destroy\n respond_to do |format|\n format.html { redirect_to estates_url, notice: 'Propiedad eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eva.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: '評価を削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estoque = Estoque.find(params[:id])\n @estoque.destroy\n\n respond_to do |format|\n format.html { redirect_to estoques_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @antecedente = Antecedente.find(params[:id])\n @antecedente.destroy\n\n respond_to do |format|\n format.html { redirect_to antecedentes_url }\n format.json { head :no_content }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @emily.destroy\n respond_to do |format|\n format.html { redirect_to emilies_url, notice: 'Emily was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fourteen.destroy\n respond_to do |format|\n format.html { redirect_to fourteens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @jednani.destroy\n respond_to do |format|\n format.html { redirect_to jednanis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @depoevento = Depoevento.find(params[:id])\n @depoevento.destroy\n\n respond_to do |format|\n format.html { redirect_to depoeventos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @desafio.destroy\n respond_to do |format|\n format.html { redirect_to desafios_url, notice: 'Desafio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @demande_eg.destroy\n respond_to do |format|\n format.html { redirect_to demande_egs_url, notice: 'Demande eg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etf.destroy\n respond_to do |format|\n format.html { redirect_to etfs_url, notice: \"Etf was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examan.destroy\n respond_to do |format|\n format.html { redirect_to examen_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mye.destroy\n respond_to do |format|\n format.html { redirect_to myes_url, notice: 'Mye was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy \n @idea = @agenda.ideas.find(params[:id])\n @idea.destroy\n\t respond_to do |format|\n format.html { redirect_to agenda_path(@agenda), notice: 'Idea deleted successfully.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coordenador_estagio = CoordenadorEstagio.find(params[:id])\n @coordenador_estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to coordenador_estagios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @extrainfo.destroy\n respond_to do |format|\n format.html { redirect_to extrainfos_url, notice: 'Extrainfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arcone = Arcone.find(params[:id])\n @arcone.destroy\n\n respond_to do |format|\n format.html { redirect_to arcones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eleitore.destroy\n respond_to do |format|\n format.html { redirect_to eleitores_url, notice: 'Eleitore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @four.destroy\n respond_to do |format|\n format.html { redirect_to fours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donee.destroy\n respond_to do |format|\n format.html { redirect_to donees_url, notice: 'Donee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalhe.destroy\n respond_to do |format|\n format.html { redirect_to detalhes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @specie = Specie.find(params[:id])\n @specie.destroy\n\n respond_to do |format|\n format.html { redirect_to species_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @ejercicio = Ejercicio.find(params[:id])\n @ejercicio.destroy\n\n respond_to do |format|\n format.html { redirect_to ejercicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cegonha = Cegonha.find(params[:id])\n @cegonha.destroy\n\n respond_to do |format|\n format.html { redirect_to cegonhas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etude.destroy\n respond_to do |format|\n format.html { redirect_to etudes_url, notice: 'Etude was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eatvent = Eatvent.find(params[:id])\n @eatvent.destroy\n\n respond_to do |format|\n format.html { redirect_to eatvents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @estabelecimento = Estabelecimento.find(params[:id])\n @estabelecimento.destroy\n\n respond_to do |format|\n format.html { redirect_to estabelecimentos_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.72305256",
"0.7032952",
"0.6986585",
"0.69046986",
"0.6896647",
"0.6895572",
"0.68844205",
"0.6877227",
"0.6868776",
"0.6852742",
"0.6849682",
"0.68482864",
"0.6842759",
"0.68418604",
"0.6829235",
"0.68260795",
"0.68242365",
"0.6818047",
"0.68178713",
"0.6808849",
"0.6793821",
"0.6791583",
"0.6784735",
"0.67773914",
"0.6774688",
"0.6773971",
"0.67737055",
"0.67697537",
"0.67587507",
"0.6754237",
"0.6753989",
"0.67534053",
"0.6752922",
"0.6746387",
"0.67463785",
"0.6741308",
"0.67353326",
"0.67350596",
"0.67283934",
"0.67274487",
"0.6721145",
"0.6718877",
"0.67148453",
"0.6714639",
"0.6711193",
"0.67107075",
"0.66937673",
"0.6685305",
"0.6682748",
"0.66815645",
"0.66793543",
"0.66793543",
"0.66793543",
"0.6678903",
"0.66787887",
"0.6678253",
"0.66766024",
"0.66763407",
"0.6672966",
"0.6668722",
"0.6664131",
"0.6661619",
"0.66605943",
"0.6660025",
"0.66545486",
"0.66533387",
"0.6651439",
"0.66510415",
"0.66479754",
"0.66459644",
"0.66458356",
"0.6645518",
"0.66426194",
"0.664238",
"0.66395754",
"0.66388535",
"0.6637846",
"0.6632183",
"0.6631549",
"0.6630711",
"0.663043",
"0.662352",
"0.66234374",
"0.66228914",
"0.66194844",
"0.6615844",
"0.6615369",
"0.661215",
"0.661178",
"0.66102487",
"0.6607066",
"0.6601593",
"0.6601207",
"0.6601103",
"0.6600124",
"0.6599111",
"0.65982676",
"0.65961885",
"0.65844244",
"0.6581407"
] | 0.7296594 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_efemeride
@efemeride = Efemeride.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def efemeride_params
params.require(:efemeride).permit(:numero, :descripcion)
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
GET /empresas_grandes GET /empresas_grandes.json | def index
@empresas_grandes = EmpresasGrande.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_grades\r\n grade_nodes = BankNodestructure.grade_gather(params[:subject])\r\n render json: grade_nodes.to_json\r\n end",
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def index\n @degres = Degre.all\n end",
"def show\n render json: @grupoassunto\n end",
"def index\n @grants =\n if @company\n @company.grants(params[:filter_by], params[:sort_by], params[:desc])\n else\n Grant.kept.order(name: :asc)\n end\n\n headers[\"Total\"] = @grants.count\n headers[\"Per-Page\"] = params[:per_page]\n\n render json: (params[:page] == 'all' ? @grants : paginator(@grants)), has_type: false\n end",
"def index\n @grades = Grade.all\n render json: {data: @grades, status: \"SUCCESS\"}, :status => 200\n end",
"def index\n respond_to :html, :json\n @organismes = Organisme.all\n end",
"def show\n render json: @grade\n end",
"def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end",
"def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end",
"def show\n @partecipanti_gruppo = PartecipantiGruppo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipanti_gruppo }\n end\n end",
"def index\n @demande_egs = DemandeEg.all\n end",
"def show\n @emp_month = EmpMonth.find(params[:id])\n @employees = Employee.where(\"grade IN (1,2)\").order(:name)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_month }\n end\n end",
"def show\n @grupa = current_user.grupy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grupa }\n end\n end",
"def index\n @grupos = Grupo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grupos }\n end\n end",
"def index\n rol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @achievments = Achievment.all\n else\n @achievments = Achievment.where(:sede_id=>current_user.sede)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @achievments }\n end\n end",
"def sondagesParAdmin\n sondages = SondageService.instance.listeDesSondagesParAdmin(params[:id])\n render json: sondages, status: :ok\n end",
"def index\n periods = current_user.school.periods.all\n\n render json: periods\n end",
"def set_empresas_grande\n @empresas_grande = EmpresasGrande.find(params[:id])\n end",
"def index\n @gruppi = Gruppo.all :order => 'GRP_NAME asc'\n respond_with(@gruppi)\n end",
"def index\n @grade_horarios = GradeHorario.all\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def index\n @empskeds = Empsked.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empskeds }\n end\n end",
"def show\n @empresa = Empresa.find(params[:id])\n @vagas = @empresa.vagas\n @funcionarios = nil\n if current_usuario.isCoordenador? or current_usuario.isAdmin?\n @funcionarios = @empresa.gestor\n @funcionarios << @empresa.admin_empresa\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @empresa }\n end\n end",
"def overview_json\n safe_params = params.permit(:force_querying_on_demand)\n force_querying_on_demand = safe_params.has_key?(:force_querying_on_demand)\n query = SchoolOverviewQueries.new(force_querying_on_demand: force_querying_on_demand)\n overview_json = query.json_for_overview(current_educator, @school)\n\n render json: overview_json\n end",
"def show\n @grm = Grm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm }\n end\n end",
"def show\n @gruppo = Gruppo.find(params[:id])\n respond_with(@gruppo)\n end",
"def index\n @level_progrations = LevelProgration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @level_progrations }\n end\n end",
"def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end",
"def index\n @gentres = Gentre.all\n end",
"def show\n @ultimo_grado_de_estudio = UltimoGradoDeEstudio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ultimo_grado_de_estudio }\n end\n end",
"def show\n @grm_grappt = GrmGrappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_grappt }\n end\n end",
"def show\n @grade = Grade.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render :json => @grade.as_json(:include => :assignment) }\n end\n end",
"def index\n @profesor_grados = ProfesorGrado.all\n end",
"def index\n @deseases = Desease.order(:id)\n\n render json: @deseases\n end",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end",
"def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end",
"def available_grade_levels_json\n params.require(:workspace_id)\n\n # schools\n school_ids = queries.supported_schools.map(&:id).select do |school_id|\n queries.is_authorized_for_school_id?(school_id)\n end\n schools_json = School.find(school_ids).as_json(only: [:id, :name])\n\n # grade levels (include if any of their schools would allow it)\n grade_levels_next_year = queries.supported_grade_levels_next_year.select do |grade_level_next_year|\n grade_level_now = GradeLevels.new.previous(grade_level_next_year)\n school_ids.any? {|school_id| queries.is_authorized_for_grade_level_now?(school_id, grade_level_now) }\n end\n\n render json: {\n schools: schools_json,\n grade_levels_next_year: grade_levels_next_year\n }\n end",
"def semList\n @semesters = Semester.all\n authorize @semester\n end",
"def index\n @organisms = Organism.find(:all, :conditions => {:has_proteins => true})\n @dataset = params[:dataset]\n proteins = Protein.find(:all, :conditions => {:has_hits_public => true})\n @h_proteins = {}\n proteins.map{|p| @h_proteins[p.id]=p}\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organisms }\n end\n end",
"def index\n @aggrupations = Aggrupation.all\n end",
"def show\n @agendamento = Agendamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agendamento }\n end\n end",
"def index\n @deportes = Deporte.all\n render json: @deportes, status: :ok \n @deportes = Deporte.paginate(:page => params[:page])\n end",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def index\n @title = \"Возрастные группы\"\n @age_groups = AgeGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @age_groups }\n end\n end",
"def index\n @ordens = Orden.all\n render json: @ordens\n end",
"def show\n @grupo = Grupo.find(params[:id])\n @profesor = @grupo.profesor\n @alumnos = @grupo.alumnos\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @grupo }\n end\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def index\n order = sortable_column_order, \"gage_number desc\"\n @gages = Gage.paginate page: params[:page], order: order, per_page: 50\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gages }\n end\n end",
"def show\n @messege = Messege.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @messege }\n end\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end",
"def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end",
"def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end",
"def index\n @endorsements = Endorsement.all\n\n render json: @endorsements\n end",
"def index\n\tperfilId = session[:perfilLogado]\n\n\tif(perfilId)\n\t\tperfil = Perfil.find(perfilId)\n\n\t\trender :json => perfil.grupos.to_json(), :callback => params['callback']\n\tend\n end",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def show\n @projeto = Projeto.find(params[:id])\n @enrollments = Enroll.find_all_by_projeto_id params[:id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projeto }\n end\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def show\n @subgrupo = Subgrupo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subgrupo }\n end\n end",
"def show\n @grade = Grade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grade }\n end\n end",
"def index\n if current_user.district_id and !current_user.admin?\n district = District.find(current_user.district_id)\n @hes = district.hes\n else\n @hes = He.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hes }\n end\n end",
"def index\n @educations = Education.all\n render json: @educations\n end",
"def findreg\n @detalles = Detalle.find(params[:id])\n render json: @detalles\n end",
"def index\n @sesions = Sesion.where(entidad_paraestatal_id: @entidad_paraestatal.id).all\n @suplente = Suplente.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sesions }\n end\n end",
"def index\n @groupsIds = GroupsProssumer.where(prossumer_id: params[:prossumer_id]).pluck(:group_id)\n @groups = Group.where(id: @groups)\n render json: @groups\n end",
"def destroy\n @empresas_grande.destroy\n respond_to do |format|\n format.html { redirect_to empresas_grandes_url, notice: 'Empresas grande was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @grantees = Grantee.all.order(:name)\n end",
"def index\n @factura = Factura.find(params[:factura_id])\n @renglon_facturas = @factura.renglon_facturas\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @renglon_facturas }\n end\n end",
"def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end",
"def index\n @german_go_leagues = GermanGoLeague.all\n\t\t@title = \"Bundesliga Spiele\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @german_go_leagues }\n end\n end",
"def index\n @deptgroups = Deptgroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deptgroups }\n end\n end",
"def index\n @relatorio_gerals = RelatorioGeral.all.page(params[:page]).per(15)\n authorize @relatorio_gerals\n end",
"def index\n @galinhas = Galinha.all\n end",
"def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end",
"def index\n @groomsmen = Groomsman.all\n end",
"def show\n @grm_vetappt = GrmVetappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_vetappt }\n end\n end",
"def index\n @granted_scopes = GrantedScope.paginate(:page => params[:page], :per_page => 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @granted_scopes }\n end\n end",
"def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\n end\n end",
"def new\n @grupa = Grupa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grupa }\n end\n end",
"def show\n @statuspagamento = Statuspagamentoe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @statuspagamento }\n end\n end",
"def index\n @gravities = Gravity.all\n end",
"def list_pengaduan_proses\n pengaduan = Pengaduan.all.where(status: 'proses').where(user_id: @user.id).order(created_at: :desc)\n render json: {status: true, total: pengaduan.count, data: pengaduan}\n end",
"def show\n @grupo = Grupo.find(params[:id])\n authorize! :show, @grupo\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grupo }\n end\n end",
"def show\n @gage = Gage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gage }\n end\n end",
"def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs for #{entities} because of #{e.message}\")\n end\n \n respond_to do |format|\n format.json { render json: entities }\n end\n end",
"def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def index\n @plants = Plant.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @plants }\n end\n end",
"def index\n @distributions = current_user.distributions\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distributions }\n end\n end",
"def index\n if (!current_groupee.nil? && current_groupee.admin?)\n @groupees = Groupee.order(\"created_at desc\")\n respond_with @groupees\n else\n render \"shared/403\"\n end\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end",
"def index\n @galleta = Galletum.all\n end",
"def index\n @ped_strategies = PedStrategy.order(\"hierarchy\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_strategies }\n end\n end",
"def index\n @education_levels = EducationLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @education_levels }\n end\n end",
"def index\n @empresas = Empresa.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empresas }\n end\n end",
"def set_gran_unidad\n @gran_unidad = GranUnidad.find(params[:id])\n end",
"def show\n @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palestrante }\n end\n end",
"def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def facture\n # Block execution if there is no current user\n if(current_user.blank?)\n return render json:{\n errors: \"true\",\n message: \"User not connected\"\n }, status: 401\n end\n\n user = current_user\n logement = Logement.find(params[:logement_id])\n factures = nil\n\n janvier = []\n fevrier = []\n mars = []\n avril = []\n mai = []\n juin = []\n juillet = []\n aout = []\n septembre = []\n octobre = []\n novembre = []\n decembre = []\n year = nil\n\n if params[:year]\n year = params[:year].to_i\n else \n year = Date.today.year\n end\n if logement.facture_versements\n logement.facture_versements.each do |fact|\n if fact.created_at.year == year && fact.statut == \"Terminé\"\n case fact.created_at.month \n when 1\n janvier << fact\n when 2\n fevrier << fact\n when 3\n mars << fact\n when 4\n avril << fact\n when 5\n mai << fact\n when 6\n juin << fact\n when 7\n juillet << fact\n when 8\n aout << fact\n when 9\n septembre << fact\n when 10\n octobre << fact\n when 11\n novembre << fact\n when 12\n decembre << fact\n end\n end\n \n end\n end\n\n render json:{\n janvier:janvier,\n fevrier:fevrier,\n mars:mars,\n avril:avril,\n mai:mai,\n juin:juin,\n juillet:juillet,\n aout:aout,\n septembre:septembre,\n octobre:octobre,\n novembre:novembre,\n decembre:decembre,\n }\n end",
"def show\n @empsked = Empsked.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @empsked }\n end\n end"
] | [
"0.6267364",
"0.6222571",
"0.60442704",
"0.589569",
"0.58901346",
"0.58424026",
"0.58141",
"0.5804504",
"0.57948494",
"0.5785185",
"0.5765662",
"0.5742184",
"0.5738538",
"0.5729949",
"0.56681836",
"0.5662469",
"0.56457037",
"0.5637877",
"0.56318474",
"0.56205976",
"0.5607145",
"0.56032056",
"0.5594422",
"0.55887973",
"0.55866677",
"0.55720454",
"0.55661714",
"0.5557485",
"0.55543995",
"0.5553296",
"0.554855",
"0.55429506",
"0.5528979",
"0.55208766",
"0.5509817",
"0.5503691",
"0.5502726",
"0.5501047",
"0.54940206",
"0.54936785",
"0.54887635",
"0.54773116",
"0.54708666",
"0.5458263",
"0.5445252",
"0.54451245",
"0.5434542",
"0.54315495",
"0.5431437",
"0.54220325",
"0.5420304",
"0.5418059",
"0.54154813",
"0.5414567",
"0.5411578",
"0.5410772",
"0.54074395",
"0.5406417",
"0.5400754",
"0.53994983",
"0.5399131",
"0.53978413",
"0.5396632",
"0.53807354",
"0.53786606",
"0.5375691",
"0.5374416",
"0.5370379",
"0.5367662",
"0.53659075",
"0.5360972",
"0.53577083",
"0.535413",
"0.53533816",
"0.53530926",
"0.5351759",
"0.53469205",
"0.5336781",
"0.5336317",
"0.5335572",
"0.53276944",
"0.53190356",
"0.5317626",
"0.5317313",
"0.5315552",
"0.5311116",
"0.53081226",
"0.53059036",
"0.53047067",
"0.53027004",
"0.5286755",
"0.5283962",
"0.52833396",
"0.5280696",
"0.52799416",
"0.5279204",
"0.5271597",
"0.526856",
"0.52616876",
"0.52611756"
] | 0.72416115 | 0 |
GET /empresas_grandes/1 GET /empresas_grandes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @empresas_grandes = EmpresasGrande.all\n end",
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def show\n @partecipanti_gruppo = PartecipantiGruppo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipanti_gruppo }\n end\n end",
"def show\n render json: @grupoassunto\n end",
"def show\n @grupa = current_user.grupy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grupa }\n end\n end",
"def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end",
"def show\n @ultimo_grado_de_estudio = UltimoGradoDeEstudio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ultimo_grado_de_estudio }\n end\n end",
"def show\n @emp_month = EmpMonth.find(params[:id])\n @employees = Employee.where(\"grade IN (1,2)\").order(:name)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_month }\n end\n end",
"def index\n respond_to :html, :json\n @organismes = Organisme.all\n end",
"def show\n @agendamento = Agendamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agendamento }\n end\n end",
"def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end",
"def get_grades\r\n grade_nodes = BankNodestructure.grade_gather(params[:subject])\r\n render json: grade_nodes.to_json\r\n end",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def show\n render json: @grade\n end",
"def show\n @subgrupo = Subgrupo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subgrupo }\n end\n end",
"def show\n @empresa = Empresa.find(params[:id])\n @vagas = @empresa.vagas\n @funcionarios = nil\n if current_usuario.isCoordenador? or current_usuario.isAdmin?\n @funcionarios = @empresa.gestor\n @funcionarios << @empresa.admin_empresa\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @empresa }\n end\n end",
"def set_empresas_grande\n @empresas_grande = EmpresasGrande.find(params[:id])\n end",
"def sondagesParAdmin\n sondages = SondageService.instance.listeDesSondagesParAdmin(params[:id])\n render json: sondages, status: :ok\n end",
"def show\n @grm = Grm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm }\n end\n end",
"def findreg\n @detalles = Detalle.find(params[:id])\n render json: @detalles\n end",
"def show\n @gruppo = Gruppo.find(params[:id])\n respond_with(@gruppo)\n end",
"def show\n @statuspagamento = Statuspagamentoe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @statuspagamento }\n end\n end",
"def index\n @grades = Grade.all\n render json: {data: @grades, status: \"SUCCESS\"}, :status => 200\n end",
"def index\n @grupos = Grupo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grupos }\n end\n end",
"def index\n @degres = Degre.all\n end",
"def show\n @grm_grappt = GrmGrappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_grappt }\n end\n end",
"def show\n @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palestrante }\n end\n end",
"def show\n @grade = Grade.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render :json => @grade.as_json(:include => :assignment) }\n end\n end",
"def index\n rol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @achievments = Achievment.all\n else\n @achievments = Achievment.where(:sede_id=>current_user.sede)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @achievments }\n end\n end",
"def index\n @gruppi = Gruppo.all :order => 'GRP_NAME asc'\n respond_with(@gruppi)\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end",
"def show\n @planificacion_semanal = PlanificacionSemanal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planificacion_semanal }\n end\n end",
"def show\n @projeto = Projeto.find(params[:id])\n @enrollments = Enroll.find_all_by_projeto_id params[:id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projeto }\n end\n end",
"def show\n @grm_vetappt = GrmVetappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_vetappt }\n end\n end",
"def new\n @grupa = Grupa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grupa }\n end\n end",
"def overview_json\n safe_params = params.permit(:force_querying_on_demand)\n force_querying_on_demand = safe_params.has_key?(:force_querying_on_demand)\n query = SchoolOverviewQueries.new(force_querying_on_demand: force_querying_on_demand)\n overview_json = query.json_for_overview(current_educator, @school)\n\n render json: overview_json\n end",
"def index\n @factura = Factura.find(params[:factura_id])\n @renglon_facturas = @factura.renglon_facturas\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @renglon_facturas }\n end\n end",
"def index\n @sesions = Sesion.where(entidad_paraestatal_id: @entidad_paraestatal.id).all\n @suplente = Suplente.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sesions }\n end\n end",
"def show\n @messege = Messege.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @messege }\n end\n end",
"def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end",
"def show\n @grade = Grade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grade }\n end\n end",
"def show\n @vehicule_perso = VehiculePerso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vehicule_perso }\n end\n end",
"def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end",
"def index\n periods = current_user.school.periods.all\n\n render json: periods\n end",
"def show\n @seguidore = Seguidore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end",
"def index\n @empskeds = Empsked.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empskeds }\n end\n end",
"def show\n @expediente = Expediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expediente }\n end\n end",
"def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end",
"def index\n @demande_egs = DemandeEg.all\n end",
"def show\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estacionamiento }\n end\n end",
"def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end",
"def index\n @grants =\n if @company\n @company.grants(params[:filter_by], params[:sort_by], params[:desc])\n else\n Grant.kept.order(name: :asc)\n end\n\n headers[\"Total\"] = @grants.count\n headers[\"Per-Page\"] = params[:per_page]\n\n render json: (params[:page] == 'all' ? @grants : paginator(@grants)), has_type: false\n end",
"def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end",
"def index\n @empresas = Empresa.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empresas }\n end\n end",
"def show\n @grupo = Grupo.find(params[:id])\n @profesor = @grupo.profesor\n @alumnos = @grupo.alumnos\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @grupo }\n end\n end",
"def show\n @grupo = Grupo.find(params[:id])\n authorize! :show, @grupo\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grupo }\n end\n end",
"def index\n @organisms = Organism.find(:all, :conditions => {:has_proteins => true})\n @dataset = params[:dataset]\n proteins = Protein.find(:all, :conditions => {:has_hits_public => true})\n @h_proteins = {}\n proteins.map{|p| @h_proteins[p.id]=p}\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organisms }\n end\n end",
"def show\n @emprendedor = Emprendedor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emprendedor }\n end\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def show\n @organismo = Organismo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organismo }\n end\n end",
"def show\n @receita_medica = ReceitaMedica.find(params[:id])\n @item_receitas = @receita_medica.item_receitas.all\n respond_to do |format|\n format.html # show.html.erb \n format.json { render json: {\n :receita => @receita_medica, \n :medicamentos => @receita_medica.item_receitas.collect {|t| [t.medicamento.nome, t.posologia, t.quantidade]} } }\n end\n end",
"def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end",
"def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end",
"def show\n @empsked = Empsked.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @empsked }\n end\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @humanidades2 = Humanidades2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades2 }\n end\n end",
"def index\n @level_progrations = LevelProgration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @level_progrations }\n end\n end",
"def show\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesor_pertenece_asignatura }\n end\n end",
"def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def index\n @grade_horarios = GradeHorario.all\n end",
"def index\n @title = \"Возрастные группы\"\n @age_groups = AgeGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @age_groups }\n end\n end",
"def index\n @ordens = Orden.all\n render json: @ordens\n end",
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def show\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sugerencia }\n end\n end",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def index\n @deportes = Deporte.all\n render json: @deportes, status: :ok \n @deportes = Deporte.paginate(:page => params[:page])\n end",
"def show\n @gage = Gage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gage }\n end\n end",
"def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end",
"def show\n @espacio_deportivo = EspacioDeportivo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @espacio_deportivo }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end",
"def show\n @orgtab = Orgtab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orgtab }\n end\n end",
"def show\n @factura = Factura.find(params[:factura_id])\n @renglon_factura = @factura.renglon_facturas.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @renglon_factura }\n end\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end",
"def index\n @deseases = Desease.order(:id)\n\n render json: @deseases\n end",
"def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def show\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @juzgado }\n end\n end",
"def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end",
"def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end",
"def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\n end\n end",
"def show\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mapeamento }\n end\n end",
"def show\r\n render json: @registro_medicion.to_json, status: :ok\r\n end",
"def show\n @anrede = Anrede.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @anrede }\n end\n end",
"def get_symptoms\n begin\n @desease = Desease.find(params[:id])\n\n @symptoms = @desease.symptoms\n render json: @symptoms\n rescue ActiveRecord::RecordNotFound => e\n render json: e, status: :unprocessable_entity\n end\n \n \n end"
] | [
"0.710647",
"0.6306237",
"0.620093",
"0.6176882",
"0.60206455",
"0.6013953",
"0.59929407",
"0.599071",
"0.5975804",
"0.59522134",
"0.5949048",
"0.5939722",
"0.5928647",
"0.59245807",
"0.5911114",
"0.58957636",
"0.5878798",
"0.5870293",
"0.58664495",
"0.58569115",
"0.584997",
"0.5847565",
"0.58460903",
"0.58230233",
"0.5816062",
"0.5801892",
"0.57996845",
"0.5741618",
"0.5735219",
"0.57345504",
"0.57323134",
"0.5727392",
"0.57267165",
"0.57251734",
"0.5724812",
"0.5724576",
"0.5713404",
"0.57014376",
"0.5699169",
"0.5696392",
"0.56930363",
"0.5683228",
"0.56806225",
"0.5677563",
"0.5676266",
"0.5673119",
"0.56723815",
"0.56711614",
"0.5669465",
"0.5666511",
"0.5658531",
"0.5654066",
"0.56498426",
"0.5646042",
"0.56433636",
"0.56390864",
"0.562776",
"0.5625058",
"0.56228495",
"0.561444",
"0.56113625",
"0.56067365",
"0.5601916",
"0.559771",
"0.5595763",
"0.55939996",
"0.5591444",
"0.5589239",
"0.5583192",
"0.5579973",
"0.5572671",
"0.55725896",
"0.5569273",
"0.55621",
"0.5561834",
"0.5561362",
"0.555749",
"0.5555739",
"0.55547994",
"0.5550425",
"0.5550184",
"0.5544763",
"0.55444103",
"0.5543407",
"0.55429435",
"0.55414754",
"0.55414754",
"0.5536671",
"0.5533965",
"0.5524754",
"0.5520553",
"0.552001",
"0.5516595",
"0.55117667",
"0.55113906",
"0.55106777",
"0.55097926",
"0.5507699",
"0.55051273",
"0.5503636",
"0.550281"
] | 0.0 | -1 |
POST /empresas_grandes POST /empresas_grandes.json | def create
@empresas_grande = EmpresasGrande.new(empresas_grande_params)
respond_to do |format|
if @empresas_grande.save
format.html { redirect_to @empresas_grande, notice: 'Empresas grande was successfully created.' }
format.json { render :show, status: :created, location: @empresas_grande }
else
format.html { render :new }
format.json { render json: @empresas_grande.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @gran_unidad = GranUnidad.new(gran_unidad_params)\n\n respond_to do |format|\n if @gran_unidad.save\n format.html { redirect_to @gran_unidad, notice: 'Gran unidad was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gran_unidad }\n else\n format.html { render action: 'new' }\n format.json { render json: @gran_unidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grantee = Grantee.new(grantee_params)\n\n respond_to do |format|\n if @grantee.save\n format.html { redirect_to @grantee, notice: 'Grantee was successfully created.' }\n format.json { render :show, status: :created, location: @grantee }\n else\n format.html { render :new }\n format.json { render json: @grantee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @empresas_grandes = EmpresasGrande.all\n end",
"def empresas_grande_params\n params.require(:empresas_grande).permit(:nombre, :representante_legal_rut, :dv, :aux1, :aux2, :aux3, :image)\n end",
"def create\n @aggrupation = Aggrupation.new(aggrupation_params)\n\n respond_to do |format|\n if @aggrupation.save\n format.html { redirect_to @aggrupation, notice: 'Aggrupation was successfully created.' }\n format.json { render :show, status: :created, location: @aggrupation }\n else\n format.html { render :new }\n format.json { render json: @aggrupation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organisme = Organisme.new(organisme_params)\n params[:departements] ||= []\n @organisme.departements.delete_all\n @dep_table = params[:departements]\n logger.debug \"Departements table sent : #@dep_table\"\n @dep_table.each do |depid|\n @organisme.departements << Departement.find(depid)\n end\n respond_to do |format|\n if @organisme.save\n format.html { redirect_to action: \"index\", notice: 'Organisme was successfully created.' }\n format.json { render :index, status: :created, location: @organisme }\n else\n format.html { render :new }\n format.json { render json: @organisme.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grupoassunto = Grupoassunto.new(grupoassunto_params)\n\n if @grupoassunto.save\n render json: @grupoassunto, status: :created, location: @grupoassunto\n else\n render json: @grupoassunto.errors, status: :unprocessable_entity\n end\n end",
"def gran_unidad_params\n params.require(:gran_unidad).permit(:nombre, :descripcion, :himno, :lema, :region_militar_id)\n end",
"def create\n @grade_horario = GradeHorario.new(grade_horario_params)\n\n respond_to do |format|\n if @grade_horario.save\n format.html { redirect_to @grade_horario, notice: 'Grade horario was successfully created.' }\n format.json { render :show, status: :created, location: @grade_horario }\n else\n format.html { render :new }\n format.json { render json: @grade_horario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subgrupo = Subgrupo.new(params[:subgrupo])\n @subgrupo.empresa = session[:usuario].empresa\n respond_to do |format|\n if @subgrupo.save\n format.html { redirect_to @subgrupo, notice: 'Subgrupo was successfully created.' }\n format.json { render json: @subgrupo, status: :created, location: @subgrupo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subgrupo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if !@current_user || (@current_user.admin != 1 && @current_user.admin != 2)\n return head :forbidden\n end\n @repasgcc = Repasgcc.new(repasgcc_params)\n\n respond_to do |format|\n if @repasgcc.save\n format.html { redirect_to @repasgcc, notice: 'Le formulaire pour le repas du grupo a bien été créé.' }\n format.json { render :show, status: :created, location: @repasgcc }\n else\n format.html { render :new }\n format.json { render json: @repasgcc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @groep = Groep.new(params[:groep])\n @lesgevers = Lesgever.order('name').all\n @dags = Dag.all\n @niveaus = Niveau.order('position').all\n respond_to do |format|\n if @groep.save\n format.html { redirect_to @groep, notice: 'Groep werd succesvol aangemaakt.' }\n format.json { render json: @groep, status: :created, location: @groep }\n else\n format.html { render action: \"new\" }\n format.json { render json: @groep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @galletum = Galletum.new(galletum_params)\n\n respond_to do |format|\n if @galletum.save\n format.html { redirect_to @galletum, notice: 'Galletum was successfully created.' }\n format.json { render :show, status: :created, location: @galletum }\n else\n format.html { render :new }\n format.json { render json: @galletum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def grade_horario_params\n params.require(:grade_horario).permit(:dia, :hora, :conteudo)\n end",
"def create\n @grua = Grua.new(grua_params)\n @grua.dicc_mantenciones = @grua.set_dicc_mantenciones(@grua.tipo, @grua.horometro)\n\n if @grua.tipo == \"Eléctrica\"\n @grua.mantenciones = [6000, 2000, 1000, 250]\n elsif @grua.tipo == \"Gas\"\n @grua.mantenciones = [2800, 1400, 700, 350]\n elsif @grua.tipo == \"Apilador\"\n @grua.mantenciones = [2000, 1000, 500]\n else @grua.mantenciones = []\n end\n\n respond_to do |format|\n if @grua.save\n format.html { redirect_to @grua, notice: 'Grua creada exitosamente.' }\n format.json { render :show, status: :created, location: @grua }\n else\n format.html { render :new }\n format.json { render json: @grua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profesor_grado = ProfesorGrado.new(profesor_grado_params)\n\n respond_to do |format|\n if @profesor_grado.save\n format.html { redirect_to @profesor_grado, notice: 'Profesor grado was successfully created.' }\n format.json { render :show, status: :created, location: @profesor_grado }\n else\n format.html { render :new }\n format.json { render json: @profesor_grado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def topes_legale_params\n params.require(:topes_legale).permit(:topeMaximo, :valor_uf, :cantidad_uf,:detalle)\n end",
"def galletum_params\n params.require(:galletum).permit(:nombre, :tamaño, :tipo, :precio, :peso, :porciones)\n end",
"def create\n @demande_eg = DemandeEg.new(demande_eg_params)\n\n respond_to do |format|\n if @demande_eg.save\n format.html { redirect_to @demande_eg, notice: 'Demande eg was successfully created.' }\n format.json { render :show, status: :created, location: @demande_eg }\n else\n format.html { render :\"new\" }\n end\n end\n end",
"def create\n @grupo_analise = GrupoAnalise.new(grupo_analise_params)\n\n respond_to do |format|\n if @grupo_analise.save\n format.html { redirect_to @grupo_analise, notice: 'Grupo analise was successfully created.' }\n format.json { render :show, status: :created, location: @grupo_analise }\n else\n format.html { render :new }\n format.json { render json: @grupo_analise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grupos_diplomado = GruposDiplomado.new(grupos_diplomado_params)\n\n respond_to do |format|\n if @grupos_diplomado.save\n format.html { redirect_to @grupos_diplomado, notice: 'El grupo se creó correctamente.' }\n format.json { render :show, status: :created, location: @grupos_diplomado }\n else\n format.html { render :new }\n format.json { render json: @grupos_diplomado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create_almacen,Sigesp::Solicitud \n unidad = session['unidad'] \n return render json: { unidad: \"Esta Unidad Administrativa no tiene Numero de Control \" }, status: :unprocessable_entity if Sigesp::CtrlRequisicion.control_compra(unidad).nil?\n\n @solicitudes = Sigesp::Solicitud.crear_solicitudes_almacen(sigesp_solicitud_alamcen_params)\n @grupoSolicitud = SolicitudGrupo.new\n @solicitudes.each do |solicitud|\n @grupoSolicitud.solicitudes << solicitud \n end\n if @grupoSolicitud.valid? \n @grupoSolicitud.guardar(unidad,current_usuario)\n return render json: { url: sigesp_solicitudsalmacen_path(@grupoSolicitud.solicitudes[0])} \n else\n return render json:@grupoSolicitud.errors ,status: :unprocessable_entity\n end \n end",
"def create\n if Grant.active_grant_id==-1\n @grant = Grant.new(grant_params)\n respond_to do |format|\n if @grant.save\n grant_id=@grant.id\n sectors=Sector.all.order(:id)\n sectors.each do |sector|\n @grant_sector=GrantSector.new\n @grant_sector.grant_id=grant_id\n @grant_sector.sector_id=sector.id\n @grant_sector.percentage=sector.percentage\n @grant_sector.save\n end \n format.html { redirect_to @grant, notice: 'تمّ إضافة منحة جديدة بنجاح' }\n format.json { render :show, status: :created, location: @grant }\n else\n format.html { render :new }\n format.json { render json: @grant.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to grants_path, alert: 'توجد منحة فعالة!! .. لا يمكن إضافة منحة جديدة'\n end \n end",
"def create\n \n @empresa = Empresa.find(:first, :conditions => [\"prefijo = ?\", params[:empresa_id]]) # para la validacion del formulario\n\n params[:gln][:gln] = Gln.generar(params[:empresa_id])\n params[:gln][:fecha_asignacion] = Time.now\n estatus = Estatus.find(:first, :conditions => [\"descripcion = ? and alcance = ?\", 'Activo', 'GLN'])\n params[:gln][:id_estatus] = estatus.id\n params[:gln][:codigo_localizacion] = params[:gln][:gln][7..11]\n @gln = Gln.new(params[:gln])\n\n respond_to do |format|\n if @gln.save\n format.html { redirect_to empresa_glns_path, notice: \"GLN #{@gln.gln} fue generado.\"}\n format.json { render json: @gln, status: :created, location: @gln }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gln.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reemper_valoration = ReemperValoration.create(user_id: params[:user_id], reemper_id: params[:reemper_id], valoration: params[:valoration], description: params[:description])\n\n respond_to do |format|\n if @reemper_valoration.save\n format.js\n format.json { render :show, status: :created, location: @reemper_valoration }\n else\n format.html { render :new }\n format.json { render json: @reemper_valoration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payrolls = Payroll.all \n @employees = Employee.where(:planilla=> \"1\").order(:lastname)\n \n @horas_me = HorasMe.new(horas_me_params)\n @horas_me[:tot] = @horas_me[:dt]+ @horas_me[:fal]+@horas_me[:sub]+@horas_me[:dm]+@horas_me[:pat] +@horas_me[:vac] \n \n\n respond_to do |format|\n if @horas_me.save\n format.html { redirect_to @horas_me, notice: 'Horas me was successfully created.' }\n format.json { render :show, status: :created, location: @horas_me }\n else\n format.html { render :new }\n format.json { render json: @horas_me.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grade = Grade.new(grade_params)\n\n if @grade.save\n render json: @grade, status: :created, location: @grade\n else\n render json: @grade.errors, status: :unprocessable_entity\n end\n end",
"def new\n @grupa = Grupa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grupa }\n end\n end",
"def set_empresas_grande\n @empresas_grande = EmpresasGrande.find(params[:id])\n end",
"def gentre_params\n params.require(:gentre).permit(:name)\n end",
"def create\n @gentre = Gentre.new(gentre_params)\n\n respond_to do |format|\n if @gentre.save\n format.json { render :show, status: :created, location: @gentre }\n else\n format.json { render json: @gentre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def gestacao_params\n params.require(:gestacao).permit(:mes, :estado_nutricional, :pre_natal, :visita_acs)\n end",
"def create\n @grupa = Grupa.new(params[:grupa])\n @grupa.user_id = current_user.id\n respond_to do |format|\n if @grupa.save\n format.html { redirect_to @grupa, notice: 'Grupa została dodana.' }\n format.json { render json: @grupa, status: :created, location: @grupa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @grupa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @empleado_especialidad = EmpleadoEspecialidad.new(empleado_especialidad_params)\n\n respond_to do |format|\n if @empleado_especialidad.save\n format.html { redirect_to @empleado_especialidad, notice: 'Empleado especialidad was successfully created.' }\n format.json { render :show, status: :created, location: @empleado_especialidad }\n else\n format.html { render :new }\n format.json { render json: @empleado_especialidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @partecipanti_gruppo = PartecipantiGruppo.new()\n @partecipanti_gruppo.gruppo_id = params[:gruppo_id]\n @partecipanti_gruppo.user_id = current_user.id\n\n respond_to do |format|\n if @partecipanti_gruppo.save\n format.html { redirect_to @partecipanti_gruppo, notice: 'Partecipanti gruppo was successfully created.' }\n format.json { render json: @partecipanti_gruppo, status: :created, location: @partecipanti_gruppo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partecipanti_gruppo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @final_grade = FinalGrade.new(final_grade_params)\n\n respond_to do |format|\n if @final_grade.save\n format.html { redirect_to @final_grade, notice: 'Final grade was successfully created.' }\n format.json { render :show, status: :created, location: @final_grade }\n else\n format.html { render :new }\n format.json { render json: @final_grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @groomsman = Groomsman.new(groomsman_params)\n\n respond_to do |format|\n if @groomsman.save\n format.html { redirect_to @groomsman, notice: 'Groomsman was successfully created.' }\n format.json { render :show, status: :created, location: @groomsman }\n else\n format.html { render :new }\n format.json { render json: @groomsman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @desem_laboral = DesemLaboral.new(desem_laboral_params)\n\n respond_to do |format|\n if @desem_laboral.save\n format.html { redirect_to new_expectativas_egresado_path, notice: 'Desem laboral was successfully created.' }\n format.json { render :show, status: :created, location: @desem_laboral }\n else\n format.html { render :new }\n format.json { render json: @desem_laboral.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pergunta_subgrupo = PerguntaSubgrupo.new(pergunta_subgrupo_params)\n\n respond_to do |format|\n if @pergunta_subgrupo.save\n format.html { redirect_to @pergunta_subgrupo, notice: 'Pergunta subgrupo was successfully created.' }\n format.json { render :show, status: :created, location: @pergunta_subgrupo }\n else\n format.html { render :new }\n format.json { render json: @pergunta_subgrupo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coordenador_estagio = CoordenadorEstagio.new(params[:coordenador_estagio])\n grupo_admin = Grupo.where(internal_id: Grupo::COORDERNADOR).first\n @coordenador_estagio.grupo = grupo_admin\n\n respond_to do |format|\n if @coordenador_estagio.save\n format.html { redirect_success(\"Coordenador adicionado com sucesso!\",:coordenador_estagio, :index)}\n format.json { render json: @coordenador_estagio, status: :created, location: @coordenador_estagio }\n else\n puts \"----------- #{@coordenador_estagio.errors.full_messages}\"\n format.html { redirect_error(\"Erro ao adicionar coordenador!\" + @coordenador_estagio.errors.to_s,:coordenador_estagio, :index)}\n format.json { render json: @coordenador_estagio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @empresas_grande.destroy\n respond_to do |format|\n format.html { redirect_to empresas_grandes_url, notice: 'Empresas grande was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @degre = Degre.new(degre_params)\n\n respond_to do |format|\n if @degre.save\n format.html { redirect_to @degre, notice: 'Degre was successfully created.' }\n format.json { render :show, status: :created, location: @degre }\n else\n format.html { render :new }\n format.json { render json: @degre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dm_especialidade = DmEspecialidade.new(dm_especialidade_params)\n\n respond_to do |format|\n if @dm_especialidade.save\n format.html { redirect_to @dm_especialidade, notice: 'Dm especialidade was successfully created.' }\n format.json { render :show, status: :created, location: @dm_especialidade }\n else\n format.html { render :new }\n format.json { render json: @dm_especialidade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uasg = Uasg.new(uasg_params)\n\n respond_to do |format|\n if @uasg.save\n format.html { redirect_to @uasg, notice: 'Uasg was successfully created.' }\n format.json { render :show, status: :created, location: @uasg }\n else\n format.html { render :new }\n format.json { render json: @uasg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grass_allocation = GrassAllocation.new(grass_allocation_params)\n\n respond_to do |format|\n if @grass_allocation.save\n format.html { redirect_to @grass_allocation, notice: 'Grass allocation was successfully created.' }\n format.json { render :show, status: :created, location: @grass_allocation }\n else\n format.html { render :new }\n format.json { render json: @grass_allocation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @genere = Genere.new(genere_params)\n\n respond_to do |format|\n if @genere.save\n format.html { redirect_to @genere, notice: 'Genere was successfully created.' }\n format.json { render :show, status: :created, location: @genere }\n else\n format.html { render :new }\n format.json { render json: @genere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_grades\r\n grade_nodes = BankNodestructure.grade_gather(params[:subject])\r\n render json: grade_nodes.to_json\r\n end",
"def create\n @tipo_despesa = TipoDespesa.new(tipo_despesa_params)\n\n respond_to do |format|\n if @tipo_despesa.save\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_despesa }\n else\n format.html { render :new }\n format.json { render json: @tipo_despesa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dias_semanas_vaga = DiasSemanasVaga.new(dias_semanas_vaga_params)\n\n respond_to do |format|\n if @dias_semanas_vaga.save\n format.html { redirect_to @dias_semanas_vaga, notice: 'Dias semanas vaga was successfully created.' }\n format.json { render :show, status: :created, location: @dias_semanas_vaga }\n else\n format.html { render :new }\n format.json { render json: @dias_semanas_vaga.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gudang = Gudang.new(gudang_params)\n\n respond_to do |format|\n if @gudang.save\n format.html { redirect_to @gudang, notice: 'Gudang was successfully created.' }\n format.json { render :show, status: :created, location: @gudang }\n else\n format.html { render :new }\n format.json { render json: @gudang.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sugestao = Sugestao.new(sugestao_params)\n\n respond_to do |format|\n if @sugestao.save\n format.html { redirect_to @sugestao, notice: 'Sugestão salva com sucesso.' }\n format.json { render :show, status: :created, location: @sugestao }\n else\n format.html { render :new }\n format.json { render json: @sugestao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to ['admin', @generation], notice: 'Generación Creada' }\n format.json { render :show, status: :created, location: @generation }\n else\n format.html { render :new }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def egreso_params\n params.require(:egreso).permit(:estado, :monto, :fecha, :concepto)\n end",
"def create\n @tablero = Tablero.new(tablero_params)\n m= params.require(:tablero).permit(:idusuario, :grupo, :descripcion, :e1, :e2, :e3, :puntaje)\n\n params[idusuario.each] do |i|\n miembros=[params[:idusuario[i]]:grupo[i], :descripcion[i], :e1[i], :e2[i], :e3[i], :puntaje[i]]\n end\n\n respond_to do |format|\n if @tablero.save\n format.html { redirect_to @tablero, notice: \"El tablero se creó correctamente\" }\n format.json { render :show, status: :created, location: @tablero }\n else\n format.html { render :new }\n format.json { render json: @tablero.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @relatorio_gerals = RelatorioGeral.all\n authorize @relatorio_gerals\n\n @relatorio_geral = RelatorioGeral.new(relatorio_geral_params)\n\n respond_to do |format|\n if @relatorio_geral.save\n format.html { redirect_to @relatorio_geral, notice: 'Relatório geral criado com sucesso!' }\n format.json { render :show, status: :created, location: @relatorio_geral }\n else\n format.html { render :new }\n format.json { render json: @relatorio_geral.errors, status: :unprocessable_entity }\n end\n end\n end",
"def degre_params\n params.require(:degre).permit(:name, :drege_type)\n end",
"def set_gran_unidad\n @gran_unidad = GranUnidad.find(params[:id])\n end",
"def create\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::Grade\n @portal_grade = Portal::Grade.new(params[:portal_grade])\n\n respond_to do |format|\n if @portal_grade.save\n flash[:notice] = 'Grade was successfully created.'\n format.html { redirect_to(@portal_grade) }\n format.xml { render :xml => @portal_grade, :status => :created, :location => @portal_grade }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @portal_grade.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @deporte = Deporte.new(deporte_params)\n\n if @deporte.save\n render :show, status: :created, location: @deporte\n else\n render json: @deporte.errors, status: :unprocessable_entity\n end\n end",
"def create\n @desease = Desease.new(desease_params)\n\n if @desease.save\n render json: @desease, status: :ok\n else\n render json: @desease.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tauthorize! :create, DetalleGasto\n @detalle_gasto = @informe_gastos.detalle_gastos.new(detalle_gasto_params)\n @detalle_gasto.voluntario_id = current_usuario.id\n respond_to do |format|\n if @detalle_gasto.save\n sesion = Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n Transaccion.create!(descripcion: \"Creación del detalle gasto #{@detalle_gasto.titulo}, descripcion: #{@detalle_gasto.descripcion}, con monto #{@detalle_gasto.monto}, concepto_gasto: #{@detalle_gasto.concepto_gasto.titulo}, voluntario: #{@detalle_gasto.voluntario.nombre}, comprobante: #{@detalle_gasto.comprobante.numero}\",\n sesion_id: sesion.id, \n proyecto_id: @detalle_gasto.informe_gasto.proyecto.id)\n #format.html { redirect_to gestionar_informe_gastos_path(@detalle_gasto.informe_gasto)} #@detalle_gasto, notice: 'Detalle gasto fue creado satisfactoriamente.' }\n format.html { redirect_to new_comprobante_path(:detalle_gasto_id => @detalle_gasto.id)}\n #format.json { render :show, status: :created, location: @detalle_gasto }\n else\n format.html { render :new }\n format.json { render json: @detalle_gasto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grades_tournament = GradesTournament.new(grades_tournament_params)\n\n respond_to do |format|\n if @grades_tournament.save\n format.html { redirect_to @grades_tournament, notice: 'Grades tournament was successfully created.' }\n format.json { render :show, status: :created, location: @grades_tournament }\n else\n format.html { render :new }\n format.json { render json: @grades_tournament.errors, status: :unprocessable_entity }\n end\n end\n end",
"def percentual_gordura_params\n params.require(:percentual_gordura).permit(:triceps, :supra_f, :supra_m, :abdomen, :coxa, :subescapular, :aluno_id)\n end",
"def create\r\n @egresso = Egresso.new(egresso_params)\r\n\r\n respond_to do |format|\r\n if @egresso.save\r\n format.html { redirect_to @egresso, notice: 'Egresso criado com sucesso.' }\r\n format.json { render :show, status: :created, location: @egresso }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @egresso.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @puesto_salud = PuestoSalud.new(puesto_salud_params)\n\n respond_to do |format|\n if @puesto_salud.save\n format.html { redirect_to @puesto_salud, notice: 'Puesto salud was successfully created.' }\n format.json { render :show, status: :created, location: @puesto_salud }\n else\n format.html { render :new }\n format.json { render json: @puesto_salud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grupo = Grupo.new(grupo_params)\n\n respond_to do |format|\n if @grupo.save\n format.html { redirect_to @grupo, notice: 'Grupo was successfully created.' }\n format.json { render :show, status: :created, location: @grupo }\n else\n format.html { render :new }\n format.json { render json: @grupo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @encuesta_preguntum = EncuestaPreguntum.new(encuesta_preguntum_params)\n\n respond_to do |format|\n if @encuesta_preguntum.save\n format.html { redirect_to @encuesta_preguntum, notice: 'Encuesta preguntum was successfully created.' }\n format.json { render :show, status: :created, location: @encuesta_preguntum }\n else\n format.html { render :new }\n format.json { render json: @encuesta_preguntum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @enfermedade = Enfermedade.new(enfermedade_params)\n\n respond_to do |format|\n if @enfermedade.save\n format.html { redirect_to new_padecimiento_path, notice: 'Ahora, por favor dinos a qué eres alérgico' }\n\n else\n format.html { render action: 'new' }\n format.json { render json: @enfermedade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kecamatan = Kecamatan.new(kecamatan_params)\n @kabupatens = Kabupaten.all\n @admins = Admin.all\n respond_to do |format|\n if @kecamatan.save\n format.html { redirect_to @kecamatan, notice: 'Kecamatan was successfully created.' }\n format.json { render :show, status: :created, location: @kecamatan }\n else\n format.html { render :new }\n format.json { render json: @kecamatan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @village = Village.new(village_params)\n\n @village.status = Status::Active\n\n @village.trainer.role = Role::Block_Trainer\n @village.trainer.status = Status::Active\n\n @village.villageinfo.status = Status::Active\n\n @village.teacher_elem.role = Role::Teacher\n @village.teacher_elem.status = Status::Active\n @village.teacher_elem.grade = 1 # Elem\n \n @village.teacher_mid.role = Role::Teacher\n @village.teacher_mid.status = Status::Active\n @village.teacher_mid.grade = 2 # Mid\n\n @village.teacher_high.role = Role::Teacher\n @village.teacher_high.status = Status::Active\n @village.teacher_high.grade = 3 # High\n\n respond_to do |format|\n if @village.save\n format.html { redirect_to villages_path, notice: 'Village was successfully created.' }\n format.js { render :js => \"close_modal();refresh_page();\" }\n format.json { render action: 'show', status: :created, location: @village }\n else\n format.html { render action: 'new' }\n format.json { render json: @village.errors, status: :unprocessable_entity }\n format.js\n end\n \n end\n end",
"def create\n @engagement = current_user.engagements.new(engagement_params_with_school)\n if @engagement.save\n render :show, status: :created, location: api_v2_engagement_url(@engagement)\n else\n puts @engagement.errors.full_messages\n render json: @engagement.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ultimo_grado_de_estudio = UltimoGradoDeEstudio.new(params[:ultimo_grado_de_estudio])\n\n respond_to do |format|\n if @ultimo_grado_de_estudio.save\n format.html { redirect_to @ultimo_grado_de_estudio, notice: 'Ultimo grado de estudio was successfully created.' }\n format.json { render json: @ultimo_grado_de_estudio, status: :created, location: @ultimo_grado_de_estudio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ultimo_grado_de_estudio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @orden_examan = OrdenExaman.new(orden_examan_params)\n\n respond_to do |format|\n if @orden_examan.save\n format.html { redirect_to @orden_examan, notice: 'Orden examan was successfully created.' }\n format.json { render :show, status: :created, location: @orden_examan }\n else\n format.html { render :new }\n format.json { render json: @orden_examan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def grado_params\n params.require(:grado).permit(:nombre, :descripcion)\n end",
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def create\n @topes_legale = TopesLegale.new(topes_legale_params)\n\n respond_to do |format|\n if @topes_legale.save\n format.html { redirect_to @topes_legale, notice: 'Tope legal creado exitosamente.' }\n format.json { render :show, status: :created, location: @topes_legale }\n else\n format.html { render :new }\n format.json { render json: @topes_legale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grua = Grua.new(grua_params)\n\n respond_to do |format|\n if @grua.save\n format.html { redirect_to gruas_url, notice: 'Grua Se creó correctamente.' }\n format.json { render :index, status: :created, location: @grua }\n else\n format.html { render :new }\n format.json { render json: @grua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @percentual_gordura = PercentualGordura.new(percentual_gordura_params)\n\n respond_to do |format|\n if @percentual_gordura.save\n format.html { redirect_to @percentual_gordura, notice: 'Percentual gordura was successfully created.' }\n format.json { render action: 'show', status: :created, location: @percentual_gordura }\n else\n format.html { render action: 'new' }\n format.json { render json: @percentual_gordura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ganho_params\n params.require(:ganho).permit(:nome, :valor_ganho, :status)\n end",
"def create\n @anrede = Anrede.new(params[:anrede])\n\n respond_to do |format|\n if @anrede.save\n format.html { redirect_to @anrede, notice: 'Anrede was successfully created.' }\n format.json { render json: @anrede, status: :created, location: @anrede }\n else\n format.html { render action: \"new\" }\n format.json { render json: @anrede.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\t\n\t\t@user_ids = Array.new \n\t\t@gnumber = params[:grade][:number].to_i\n\t\t@ggrade = params[:grade][:grade]\n \n\t\tif @gnumber < 51\tand @gnumber > 0\n\t\t\t@gnumber.times do |number|\n\t\t\t\tnumber+=1\n\t\t\t\tnumber= \"%.2i\" %number\n\t\t\t\t@password= SecureRandom.hex(8)\n\t\t\t\t@user_params = { \"name\" => \"#{@ggrade}_#{number}_2014\", \"first_name\" => \"-\", \"second_name\" => \"-\", \"last_name\" => \"-\", \"grade\" => \"#{@ggrade}\", \"number\" => \"#{number}\", \"password\" => \"#{@password}\" }\n\t\t\t\t@user = User.new(@user_params)\n\t\t\t\t@user.save\t\n\t\t\n\t\t\t\t@user_ids << @user.id \n\t\t\tend\n\t\tend\n\t\t@grade_params = { \"grade\" => \"#{@ggrade}\", \"number\" => \"#{@gnumber}\", \"user_ids\" => \"#{@user_ids}\"}\n\t\t@grade = Grade.new(@grade_params)\n\t\trespond_to do |format|\n if @grade.save\n format.html { redirect_to @grade, notice: \"#{@grade.grade} was successfully created.\" }\n format.json { render action: 'show', status: :created, location: @grade }\n else\n format.html { render action: 'new' }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\t\t\t\n\t\t\t\n end",
"def grades_tournament_params\n params.require(:grades_tournament).permit(:grades_id, :tournament_id)\n end",
"def germination_params\n params.require(:germination).permit(:seed_id, :week, :numGerminations,:codeCross, :codeCrossNumRepeat, :totalNumRepeat, :totalCode, :missingSeed)\n end",
"def create\n @dm_planosaude = DmPlanosaude.new(dm_planosaude_params)\n\n respond_to do |format|\n if @dm_planosaude.save\n format.html { redirect_to @dm_planosaude, notice: 'Dm planosaude was successfully created.' }\n format.json { render :show, status: :created, location: @dm_planosaude }\n else\n format.html { render :new }\n format.json { render json: @dm_planosaude.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grupo_permissao = GrupoPermissao.new(grupo_permissao_params)\n\n respond_to do |format|\n if @grupo_permissao.save\n format.html { redirect_to @grupo_permissao, notice: 'Grupo permissao was successfully created.' }\n format.json { render :show, status: :created, location: @grupo_permissao }\n else\n format.html { render :new }\n format.json { render json: @grupo_permissao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comentario_egresado = ComentarioEgresado.new(comentario_egresado_params)\n\n respond_to do |format|\n if @comentario_egresado.save\n format.html { redirect_to @comentario_egresado, notice: 'Comentario egresado was successfully created.' }\n format.json { render :show, status: :created, location: @comentario_egresado }\n else\n format.html { render :new }\n format.json { render json: @comentario_egresado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stu_reg_semester = StuRegSemester.new(stu_reg_semester_params)\n\n respond_to do |format|\n if @stu_reg_semester.save\n format.html { redirect_to @stu_reg_semester, notice: 'Stu reg semester was successfully created.' }\n format.json { render :show, status: :created, location: @stu_reg_semester }\n else\n format.html { render :new }\n format.json { render json: @stu_reg_semester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @partecipanti_gruppo = PartecipantiGruppo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partecipanti_gruppo }\n end\n end",
"def create\n @teste_anamnese = TesteAnamnese.new(teste_anamnese_params)\n\n respond_to do |format|\n if @teste_anamnese.save\n format.html { redirect_to @teste_anamnese, notice: 'Teste anamnese was successfully created.' }\n format.json { render action: 'show', status: :created, location: @teste_anamnese }\n else\n format.html { render action: 'new' }\n format.json { render json: @teste_anamnese.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_granule(current_user)\n if current_user.nil?\n current_user = User.find_by(email: 'abaker@element84.com')\n end\n\n granules_components = []\n granules_count = 1\n native_format = self.records[0].format\n\n\n #only selecting granules for certain formats per business rules\n if Collection::INCLUDE_GRANULE_FORMATS.include? native_format\n #creating all the Granule related objects\n granules_components = Granule.assemble_granule_components(concept_id, granules_count, self, current_user)\n end\n\n #saving all the related collection and granule data in a combined transaction\n granules_components.flatten.each {|savable_object|\n if savable_object.is_a?(Array)\n savable_object.each do |savable_item|\n savable_item.save!\n end\n else\n savable_object.save!\n end\n }\n\n #In production there is an egress issue with certain link types given in metadata\n #AWS hangs requests that break ingress/egress rules. Added this timeout to catch those\n Timeout::timeout(90) {\n #getting list of records for script\n granule_records = granules_components.flatten.select {|savable_object| savable_object.is_a?(Record)}\n granule_records.each do |record|\n record.create_script\n end\n }\n end",
"def grass_allocation_params\n params.require(:grass_allocation).permit(:grass_allocation_id, :grass_id, :plotsubplot_id, :year_observation, :percentage_100_dm_gm1, :percentage_100_dm_gm2, :percentage_100_dm_gm3, :percentage_100_dm_gm4, :percentage_100_dm_gm5, :percentage_100_dm_gm6, :percentage_100_dm_silage1, :percentage_100_dm_silage2, :d_value_1, :d_value_2, :me_1, :me_2, :lugd, :percentage_prg_a, :percentage_tim_a, :percentage_wc_a, :percentage_tug_a, :percentage_tw_a, :ph, :p, :k, :mg, :om, :replication, :rotation)\n end",
"def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end",
"def create\n @member_grade = MemberGrade.new(member_grade_params)\n\n respond_to do |format|\n if @member_grade.save\n format.html { redirect_to @member_grade, notice: 'Member grade was successfully created.' }\n format.json { render :show, status: :created, location: @member_grade }\n else\n format.html { render :new }\n format.json { render json: @member_grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plan_quirurgico = PlanQuirurgico.new(plan_quirurgico_params)\n @plan_quirurgico.servicios = params[:servicios]\n @plan_quirurgico.estatus = \"En Proceso\"\n puts params\n puts @plan_quirurgico.examen \n respond_to do |format|\n if @plan_quirurgico.save\n format.html { redirect_to @plan_quirurgico, notice: 'El plan quirurgico fue registrado exitosamente.' }\n format.json { render :show, status: :created, location: @plan_quirurgico }\n else\n format.html { render :new }\n format.json { render json: @plan_quirurgico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tauthorize! :create, DetalleRestriccion\n @detalle_restriccion = @restriccion.detalle_restricciones.new(detalle_restriccion_params)\n @concepto_gastos = ConceptoGasto.all\n respond_to do |format|\n if @detalle_restriccion.save\n format.html { redirect_to gestionar_restricciones_path}\n #format.html { redirect_to @detalle_restriccion, notice: 'Detalle restriccion fue creado satisfactoriamente.' }\n #format.json { render :show, status: :created, location: @detalle_restriccion }\n else\n format.html { render :new }\n format.json { render json: @detalle_restriccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @especialidade = Especialidade.new(especialidade_params)\n\n respond_to do |format|\n if @especialidade.save\n format.html { redirect_to @especialidade, notice: 'Especialidade was successfully created.' }\n format.json { render :show, status: :created, location: @especialidade }\n else\n format.html { render :new }\n format.json { render json: @especialidade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @perfil_egresado = PerfilEgresado.new(perfil_egresado_params)\n\n respond_to do |format|\n if @perfil_egresado.save\n format.html { redirect_to @perfil_egresado, notice: 'Perfil egresado was successfully created.' }\n format.json { render :show, status: :created, location: @perfil_egresado }\n else\n format.html { render :new }\n format.json { render json: @perfil_egresado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grupocliente = Grupocliente.new(grupocliente_params)\n\n respond_to do |format|\n if @grupocliente.save\n format.html { redirect_to @grupocliente, notice: 'Grupocliente was successfully created.' }\n format.json { render action: 'show', status: :created, location: @grupocliente }\n else\n format.html { render action: 'new' }\n format.json { render json: @grupocliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @semestre = current_user.semestres.new(semestre_params)\n\n respond_to do |format|\n if @semestre.save\n format.html { redirect_to semestres_url, notice: 'Semestre was successfully created.' }\n format.json { render :show, status: :created, location: @semestre }\n else\n format.html { render :new }\n format.json { render json: @semestre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estacionamiento = Estacionamiento.new(estacionamiento_params)\n @lista_departamentos = Ubigeo.find_by_sql(\"select distinct idDepartamento, Departamento from ubigeos\")\n @lista_provincias = Ubigeo.find_by_sql(\"select distinct idProvincia, Provincia from ubigeos\")\n @lista_distritos = Ubigeo.find_by_sql(\"select distinct idDistrito, Distrito from ubigeos\")\n @serv_adicinales = ServAdicinale.all\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render :show, status: :created, location: @estacionamiento }\n else\n format.html { render :new }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6418323",
"0.59974456",
"0.5931636",
"0.58654153",
"0.5831695",
"0.582175",
"0.5781392",
"0.57767004",
"0.5761897",
"0.5749735",
"0.57318324",
"0.56716955",
"0.5668795",
"0.5646195",
"0.5613132",
"0.560302",
"0.5595234",
"0.55907357",
"0.55776787",
"0.5546996",
"0.5543814",
"0.55326277",
"0.5513208",
"0.54926115",
"0.5489754",
"0.5475765",
"0.5475145",
"0.54450804",
"0.54326946",
"0.5431661",
"0.5429567",
"0.54280823",
"0.5425575",
"0.541884",
"0.5416309",
"0.5411628",
"0.54079175",
"0.5400025",
"0.5392263",
"0.5382873",
"0.5377515",
"0.5376209",
"0.5363034",
"0.53568625",
"0.53535557",
"0.53527063",
"0.534832",
"0.5338781",
"0.5337099",
"0.5336097",
"0.5327218",
"0.53166044",
"0.5316603",
"0.5315671",
"0.53019387",
"0.5299951",
"0.5298149",
"0.52954483",
"0.5290942",
"0.52875364",
"0.52859026",
"0.5284785",
"0.5278392",
"0.52762413",
"0.5274958",
"0.5271415",
"0.526823",
"0.5266206",
"0.52656406",
"0.5259648",
"0.5258525",
"0.52538735",
"0.5251947",
"0.5251343",
"0.5248999",
"0.5248284",
"0.52454525",
"0.5236937",
"0.5227447",
"0.522448",
"0.52236855",
"0.52232695",
"0.5216679",
"0.52140754",
"0.5213332",
"0.52119064",
"0.521036",
"0.52084255",
"0.52083004",
"0.5207844",
"0.52035534",
"0.52034867",
"0.52017325",
"0.5201288",
"0.5200669",
"0.5200492",
"0.52004236",
"0.51937586",
"0.5185602",
"0.5184968"
] | 0.6476368 | 0 |
PATCH/PUT /empresas_grandes/1 PATCH/PUT /empresas_grandes/1.json | def update
respond_to do |format|
if @empresas_grande.update(empresas_grande_params)
format.html { redirect_to @empresas_grande, notice: 'Empresas grande was successfully updated.' }
format.json { render :show, status: :ok, location: @empresas_grande }
else
format.html { render :edit }
format.json { render json: @empresas_grande.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @gran_unidad.update(gran_unidad_params)\n format.html { redirect_to @gran_unidad, notice: 'Gran unidad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gran_unidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @emprego.update(emprego_params)\n format.html { redirect_to @emprego, notice: 'Emprego was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @emprego.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @emprestimo.update(emprestimo_params)\n format.html { redirect_to @emprestimo, notice: 'Reserva/Empréstimo foi Atualizado.' }\n format.json { render :show, status: :ok, location: @emprestimo }\n else\n format.html { render :edit }\n format.json { render json: @emprestimo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if !@current_user || (@current_user.admin != 1 && @current_user.admin != 2)\n return head :forbidden\n end\n respond_to do |format|\n if @repasgcc.update(repasgcc_params)\n format.html { redirect_to @repasgcc, notice: 'Le formulaire pour le repas du grupo a bien été modifié.' }\n format.json { render :show, status: :ok, location: @repasgcc }\n else\n format.html { render :edit }\n format.json { render json: @repasgcc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @alumno.update(alumno_params)\n format.html { redirect_to grupos_path, notice: '#datos actualizados' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @alumno.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n @egresso.skip_fields_validation = false\r\n if @egresso.update(egresso_params)\r\n if current_admin.try(:adm?)\r\n format.html { redirect_to egressos_path, notice: 'Egresso atualizado com sucesso.' }\r\n format.json { render :show, status: :ok, location: egressos_path }\r\n else\r\n format.html { redirect_to :back, notice: 'Dados atualizados com sucesso.' }\r\n format.json { render :show, status: :ok, location: :back }\r\n end\r\n\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @egresso.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @empregador.update(empregador_params)\n format.html { redirect_to empregadors_path, notice: 'O Empregador foi atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @empregador }\n else\n format.html { render :edit }\n format.json { render json: @empregador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end",
"def update\n respond_to do |format|\n if @empleado_especialidad.update(empleado_especialidad_params)\n format.html { redirect_to @empleado_especialidad, notice: 'Empleado especialidad was successfully updated.' }\n format.json { render :show, status: :ok, location: @empleado_especialidad }\n else\n format.html { render :edit }\n format.json { render json: @empleado_especialidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @horario_entrega.update(horario_entrega_params)\n format.html { redirect_to @horario_entrega, notice: 'Horario entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @horario_entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @formasdepago.empresa = current_user.empresa\n if @formasdepago.update(formasdepago_params)\n format.html { redirect_to @formasdepago, notice: 'Formasdepago was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @formasdepago.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @grade_horario.update(grade_horario_params)\n format.html { redirect_to @grade_horario, notice: 'Grade horario was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade_horario }\n else\n format.html { render :edit }\n format.json { render json: @grade_horario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aprov_estabelecimento.update(aprov_estabelecimento_params)\n format.html { redirect_to @aprov_estabelecimento, notice: 'Aprov estabelecimento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @aprov_estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gestacao.update(gestacao_params)\n format.html { redirect_to @gestacao, notice: 'Gestacao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gestacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tauthorize! :update, DetalleRestriccion\n respond_to do |format|\n @concepto_gastos = ConceptoGasto.all\n if @detalle_restriccion.update(detalle_restriccion_params)\n format.html { redirect_to gestionar_restricciones_path, notice: 'Actualizado correctamente'}\n #format.html { redirect_to @detalle_restriccion, notice: 'Detalle restriccion fue actualizado satisfactoriamente.' }\n #format.json { render :show, status: :ok, location: @detalle_restriccion }\n else\n format.html { redirect_to gestionar_restricciones_path, alert: 'No pueden guardarse'}\n #format.html { render :edit }\n #format.json { render json: @detalle_restriccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @empleado.update(empleado_params)\n format.html { redirect_to @empleado, notice: 'Empleado was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @empresario.update(empresario_params) and @empresario.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @empresario, notice: 'Empresario was successfully updated.' }\n format.json { render :show, status: :ok, location: @empresario }\n else\n format.html { render :edit }\n format.json { render json: @empresario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @galeria_prep_mate = @producto.galeria_prep_mates.find(params[:id])\n respond_to do |format|\n if @galeria_prep_mate.update(galeria_prep_mate_params)\n format.html { redirect_to empresa_producto_galeria_prep_mates_path, notice: 'Galeria prep mate was successfully updated.' }\n format.json { render :show, status: :ok, location: @galeria_prep_mate }\n else\n format.html { render :edit }\n format.json { render json: @galeria_prep_mate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @compra_venta_normal.update(compra_venta_normal_params)\n format.html { redirect_to @compra_venta_normal, notice: 'Compra venta normal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @compra_venta_normal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @detalhe.update(detalhe_params)\n format.html { redirect_to @detalhe, notice: 'Detalhe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @detalhe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @grupoassunto = Grupoassunto.find(params[:id])\n\n if @grupoassunto.update(grupoassunto_params)\n head :no_content\n else\n render json: @grupoassunto.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @enfermeras_paciente.update(enfermeras_paciente_params)\n format.html { redirect_to @enfermeras_paciente, notice: 'Enfermeras paciente was successfully updated.' }\n format.json { render :show, status: :ok, location: @enfermeras_paciente }\n else\n format.html { render :edit }\n format.json { render json: @enfermeras_paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n if @sugerencia.update_attributes(params[:sugerencia])\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @demande_eg.update(demande_eg_params)\n format.html { redirect_to @demande_eg, notice: 'Demande eg was successfully updated.' }\n format.json { render :show, status: :ok, location: @demande_eg }\n else\n format.html { render :\"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teste_anamnese.update(teste_anamnese_params)\n format.html { redirect_to @teste_anamnese, notice: 'Teste anamnese was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @teste_anamnese.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @especialidade.update(especialidade_params)\n format.html { redirect_to @especialidade, notice: 'Especialidade was successfully updated.' }\n format.json { render :show, status: :ok, location: @especialidade }\n else\n format.html { render :edit }\n format.json { render json: @especialidade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @palabra = Palabra.find(params[:id])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.update_attributes(params[:palabra])\n format.html { redirect_to @palabra, notice: 'La Palabra fue actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @demanda = Demanda.find(params[:id])\n\n respond_to do |format|\n if @demanda.update_attributes(params[:demanda])\n if @demanda.tipo_demanda == '1' || @demanda.tipo_demanda == 1\n format.html { redirect_to \"/consultas/list/1\", :notice => 'Consulta atualizada com sucesso.'}\n format.json { head :no_content }\n elsif @demanda.tipo_demanda == '2' || @demanda.tipo_demanda == 2\n format.html { redirect_to \"/consultas/list/2\", :notice => 'Levantamento atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { redirect_to \"/consultas/list/3\", :notice => 'Flagrante atualizado com sucesso.' }\n format.json { head :no_content }\n end\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @demanda.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entrega.update(entrega_params)\n format.html { redirect_to @entrega, notice: 'Entrega editada con éxito.' }\n format.json { render :show, status: :ok, location: @entrega }\n else\n format.html { render :edit }\n format.json { render json: @entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @frais_hebergement = FraisHebergement.find(params[:id])\n\n respond_to do |format|\n if @frais_hebergement.update_attributes(params[:frais_hebergement])\n format.html { redirect_to @frais_hebergement, :notice => 'Le frais d\\'hébergement a bien été modifié' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @frais_hebergement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @suplente = Suplente.find(params[:id])\n\n respond_to do |format|\n if @suplente.update_attributes(params[:suplente])\n format.html { redirect_to @suplente, notice: 'Lista acuerdo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @suplente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @orgao_equipamento.update(orgao_equipamento_params)\n format.html { redirect_to @orgao_equipamento, notice: 'Órgão equipamento atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @orgao_equipamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_participantecelula.update(sivic_participantecelula_params)\r\n format.html { redirect_to @sivic_participantecelula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_participantecelula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n if @peso.update_attributes(params[:peso])\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_despesa.update(tipo_despesa_params)\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_despesa }\n else\n format.html { render :edit }\n format.json { render json: @tipo_despesa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @paciente = Paciente.find(params[:id])\n\n @upersona = @paciente.personas.last\n @paciente_edit = @upersona.perstable\n respond_to do |format|\n if @paciente_edit.update(params[:paciente].permit(:domicilio, :civil, :nss, :edad, :peso, :talla, :imc, :t_sangre, :persona))\n format.html { redirect_to pacientes_path , notice: 'Paciente was successfully updated.' }\n format.json { render :show, status: :ok, location: pacientes_path }\n else\n format.html { render :edit }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @consulta = Consulta.find(params[:id])\n\n if @consulta.update(params[:consulta])\n head :no_content\n else\n render json: @consulta.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @growth.update(growth_params)\n format.html { redirect_to @growth, notice: 'Growth was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @growth.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @genere.update(genere_params)\n format.html { redirect_to @genere, notice: 'Genere was successfully updated.' }\n format.json { render :show, status: :ok, location: @genere }\n else\n format.html { render :edit }\n format.json { render json: @genere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aramis_entity.update(aramis_entity_params)\n format.html { redirect_to @aramis_entity, notice: \"L'Entité Aramis #{@aramis_entity.name} a été modifiée avec succès\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @aramis_entity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @perfil_egresado.update(perfil_egresado_params)\n format.html { redirect_to @perfil_egresado, notice: 'Perfil egresado was successfully updated.' }\n format.json { render :show, status: :ok, location: @perfil_egresado }\n else\n format.html { render :edit }\n format.json { render json: @perfil_egresado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proceso_examan.update(proceso_examan_params)\n format.html { redirect_to @proceso_examan, notice: 'Proceso examan was successfully updated.' }\n format.json { render :show, status: :ok, location: @proceso_examan }\n else\n format.html { render :edit }\n format.json { render json: @proceso_examan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @empresa.update(empresa_params) and @empresa.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @empresa, notice: 'Empresa was successfully updated.' }\n format.json { render :show, status: :ok, location: @empresa }\n else\n format.html { render :edit }\n format.json { render json: @empresa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @frais_repa = FraisRepa.find(params[:id])\n\n respond_to do |format|\n if @frais_repa.update_attributes(params[:frais_repa])\n format.html { redirect_to @frais_repa, :notice => 'Le frais de repas a bien été modifé' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @frais_repa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topes_legale.update(topes_legale_params)\n format.html { redirect_to @topes_legale, notice: 'Tope legal actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @topes_legale }\n else\n format.html { render :edit }\n format.json { render json: @topes_legale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #parametros_autocomplete!(params[:estudiante][:persona])\n @estudiante = Estudiante.find(params[:id])\n \n begin\n @estudiante.persona_id = params[:persona][:id]\n rescue\n end\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n format.html { redirect_to @estudiante, notice: 'Estudiante actualizado' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @relatorio_pedagogicos = RelatorioPedagogico.all\n authorize @relatorio_pedagogicos\n\n respond_to do |format|\n if @relatorio_pedagogico.update(relatorio_pedagogico_params)\n format.html { redirect_to @relatorio_pedagogico, notice: 'Relatório pedagógico atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @relatorio_pedagogico }\n else\n format.html { render :edit }\n format.json { render json: @relatorio_pedagogico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @seguidore = Seguidore.find(params[:id])\n\n respond_to do |format|\n if @seguidore.update_attributes(params[:seguidore])\n format.html { redirect_to @seguidore, notice: 'Seguidore was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seguidore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @demanda.update(demanda_params)\n format.html { redirect_to @demanda, notice: 'Demanda was successfully updated.' }\n format.json { render :show, status: :ok, location: @demanda }\n else\n format.html { render :edit }\n format.json { render json: @demanda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n if @estatuto.update_attributes(params[:estatuto])\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @periodo_para_ingresar = PeriodoParaIngresar.find(params[:id])\n\n respond_to do |format|\n if @periodo_para_ingresar.update_attributes(params[:periodo_para_ingresar])\n format.html { redirect_to @periodo_para_ingresar, notice: 'Periodo para ingresar was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @periodo_para_ingresar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tselect_calculation\n\t\tselect_city\n\t\tselect_rotation\n\t\tselect_role\n\t\tselect_company\n\t\tselect_calculation\n\t\tselected_role\n\t\tselected_service\n\t\tselect_service\n @proposal_hour_extra.user_update=current_admin.nome\n\n\t\trespond_to do |format|\n\t\t\tif @proposal_hour_extra.update(proposal_hour_extra_params)\n\t\t\t\tformat.html { redirect_to \"/services/#{@proposal_hour_extra.hour_extra_roles[0].role.service_id}/proposal_hour_extras/#{@proposal_hour_extra.id}\", notice: 'Proposal was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @proposal_hour_extra }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @proposal_hour_extra.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @ejemplo.update(ejemplo_params)\n format.html { redirect_to @ejemplo, notice: 'Ejemplo was successfully updated.' }\n format.json { render :show, status: :ok, location: @ejemplo }\n else\n format.html { render :edit }\n format.json { render json: @ejemplo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n if params[:id]==\"edit_familias_propiedades\"\n edit_familias_propiedades\n return\n end\n \n #if params[:familia][\"articulos_grupopropiedades_attributes\"]\n# componer_articulo\n# return\n #end \n \n respond_to do |format|\n if @familia.update(familia_params) \n \n format.html { redirect_to familias_path(:id => @familia.padre_id), notice: 'Familia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @familia.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def update\n respond_to do |format|\n if @grupocliente.update(grupocliente_params)\n format.html { redirect_to @grupocliente, notice: 'Grupocliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @grupocliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @forma_entrega = FormaEntrega.find(params[:id])\n\n respond_to do |format|\n if @forma_entrega.update_attributes(params[:forma_entrega])\n format.html { redirect_to @forma_entrega, notice: 'Forma entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forma_entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exemplaresproduto.update(exemplaresproduto_params)\n format.html { redirect_to @exemplaresproduto, notice: 'Exemplaresproduto was successfully updated.' }\n format.json { render :show, status: :ok, location: @exemplaresproduto }\n else\n format.html { render :edit }\n format.json { render json: @exemplaresproduto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comentario_egresado.update(comentario_egresado_params)\n format.html { redirect_to @comentario_egresado, notice: 'Comentario egresado was successfully updated.' }\n format.json { render :show, status: :ok, location: @comentario_egresado }\n else\n format.html { render :edit }\n format.json { render json: @comentario_egresado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compra_detalle = CompraDetalle.find(params[:id])\n\n respond_to do |format|\n if @compra_detalle.update_attributes(params[:compra_detalle])\n format.html { redirect_to @compra_detalle, notice: 'Compra detalle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compra_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @abastecimento.update(abastecimento_params)\n format.html { redirect_to abastecimentos_url, notice: 'Abastecimento editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @abastecimento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @empleado.update(empleado_params)\n format.html { redirect_to empleados_path, notice: 'se ha actualizado el Registro.' }\n format.json { render :show, status: :ok, location: @empleado }\n else\n format.html { render :edit }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @factura = Factura.find(params[:factura_id])\n @renglon_factura = @factura.renglon_facturas.find(params[:id])\n\n respond_to do |format|\n if @renglon_factura.update_attributes(params[:renglon_factura])\n format.html { redirect_to @factura, :notice => 'Renglon factura was successfully updated.' }\n format.json { render json: @renglon_factura }\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @renglon_factura.errors }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gabinete_object.update(gabinete_object_params)\n format.html { redirect_to creation_gabinete_objects_path, notice: 'Gabinete object was successfully updated.' }\n format.json { render :show, status: :ok, location: @gabinete_object }\n else\n format.html { render :edit }\n format.json { render json: @gabinete_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @angelitopro.update(angelitopro_params)\n format.html { redirect_to @angelitopro, notice: \"Angelitopro was successfully updated.\" }\n format.json { render :show, status: :ok, location: @angelitopro }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @angelitopro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @painel.update(painel_params)\n format.html { redirect_to @painel, notice: 'Painel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @painel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @refugee.update(refugee_params)\n format.html { redirect_to @refugee, notice: 'Refugee was successfully updated.' }\n format.json { render :show, status: :ok, location: @refugee }\n else\n format.html { render :edit }\n format.json { render json: @refugee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicule_perso = VehiculePerso.find(params[:id])\n\n respond_to do |format|\n if @vehicule_perso.update_attributes(params[:vehicule_perso])\n format.html { redirect_to @vehicule_perso, :notice => 'Le véhicule personnel a bien été modifié' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @vehicule_perso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\traise CanCan::AccessDenied if !DetalleGasto.accessible_by(current_ability, :update).include?(@detalle_gasto)\n respond_to do |format|\n if @detalle_gasto.update(detalle_gasto_params)\n sesion = Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n Transaccion.create!(descripcion: \"Actualización del detalle gasto #{@detalle_gasto.titulo}, descripcion: #{@detalle_gasto.descripcion}, con monto #{@detalle_gasto.monto}, concepto_gasto: #{@detalle_gasto.concepto_gasto.titulo}, voluntario: #{@detalle_gasto.voluntario.nombre}, comprobante: #{@detalle_gasto.comprobante.numero}\",\n sesion_id: sesion.id, \n proyecto_id: @detalle_gasto.informe_gasto.proyecto.id)\n format.html { redirect_to gestionar_informe_gastos_path(@detalle_gasto.informe_gasto)} #@detalle_gasto, notice: 'Detalle gasto fue actualizado satisfactoriamente.' }\n #format.json { render :show, status: :ok, location: @detalle_gasto }\n else\n format.html { render :edit }\n format.json { render json: @detalle_gasto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @unidad.empresa = current_user.empresa\n if @unidad.update(unidad_params)\n format.html { redirect_to @unidad, notice: 'Unidad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @unidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @relatorio_gerals = RelatorioGeral.all\n authorize @relatorio_gerals\n\n respond_to do |format|\n if @relatorio_geral.update(relatorio_geral_params)\n format.html { redirect_to @relatorio_geral, notice: 'Relatório geral atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @relatorio_geral }\n else\n format.html { render :edit }\n format.json { render json: @relatorio_geral.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n puts \"HACE ALGOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO\"\n if !params[:reserva][:tipo_reserva].blank?\n @tipo_reserva = TipoReserva.find(params[:reserva][:tipo_reserva])\n @reserva.tipo_reserva = @tipo_reserva\n end\n\n if !params[:reserva][:habitacion].blank?\n @habitacion = Habitacion.find(params[:reserva][:habitacion])\n @reserva.habitacion = @habitacion\n end\n\n if !params[:reserva][:cliente].blank?\n @cliente = Cliente.find(params[:reserva][:cliente])\n @reserva.cliente = @cliente\n end\n if !params[:reserva][:confirmada].blank?\n @reserva.confirmada = params[:reserva][:confirmada]\n end\n if @reserva.update(reserva_params)\n format.html { redirect_to reservas_url, notice: 'Reserva modificada con exito.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @questionario_egresso.update(questionario_egresso_params)\n format.html { redirect_to home_path, notice: 'Questionario preenchido com sucesso.' }\n format.json { render :show, status: :ok, location: questionario_egressos_path }\n else\n format.html { render :edit }\n format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @peso.update(peso_params)\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { render :show, status: :ok, location: @peso }\n else\n format.html { render :edit }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @partecipanti_gruppo = PartecipantiGruppo.find(params[:id])\n\n respond_to do |format|\n if @partecipanti_gruppo.update_attributes(params[:partecipanti_gruppo])\n format.html { redirect_to @partecipanti_gruppo, notice: 'Partecipanti gruppo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @partecipanti_gruppo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @orden_entrega.update(orden_entrega_params)\n format.html { redirect_to @orden_entrega, notice: 'Orden entrega was successfully updated.' }\n format.json { render :show, status: :ok, location: @orden_entrega }\n else\n format.html { render :edit }\n format.json { render json: @orden_entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_employee.update(admin_employee_params)\n format.html { redirect_to admin_employees_path, notice: 'Funcionário foi editado com sucesso.' }\n else\n format.html { render :edit }\n format.json { render json: @admin_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @residencia.update(residencia_params)\n format.html { redirect_to [@programa, @residencia], notice: 'residencia was successfully updated.' }\n format.json { render :show, status: :ok, location: [@programa, @residencia] }\n else\n format.html { render :edit }\n format.json { render json: @residencia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @empleados_empresa.update(empleados_empresa_params)\n format.html { redirect_to @empleados_empresa, notice: 'Empleados empresa was successfully updated.' }\n format.json { render :show, status: :ok, location: @empleados_empresa }\n else\n format.html { render :edit }\n format.json { render json: @empleados_empresa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @problema.update(problema_params)\n format.html { redirect_to consulta_problema_path(@consulta), notice: 'Problema Actualizado' }\n format.json { render :show, status: :ok, location: @problema }\n else\n format.html { render :edit }\n format.json { render json: @problema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @emprendedor = Emprendedor.find(params[:id])\n\n respond_to do |format|\n if @emprendedor.update_attributes(params[:emprendedor])\n format.html { redirect_to @emprendedor, notice: 'La actualizacion fue exitosa.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @emprendedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gentre.update(gentre_params)\n format.json { render :show, status: :ok, location: @gentre }\n else\n format.json { render json: @gentre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @planificacion_semanal = PlanificacionSemanal.find(params[:id])\n\n respond_to do |format|\n if @planificacion_semanal.update_attributes(params[:planificacion_semanal])\n format.html { redirect_to planificaciones_semanales_path, notice: 'Planificacion semanal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @planificacion_semanal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @anteproyecto_estudiante.update(anteproyecto_estudiante_params)\n format.html { redirect_to @anteproyecto_estudiante, notice: 'Anteproyecto estudiante was successfully updated.' }\n format.json { render :show, status: :ok, location: @anteproyecto_estudiante }\n else\n format.html { render :edit }\n format.json { render json: @anteproyecto_estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @formaspagamento.update(formaspagamento_params)\n format.html { redirect_to formaspagamentos_url, notice: 'Forma de Pagamento editada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @formaspagamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n if @estacionamiento.update_attributes(params[:estacionamiento])\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize!(:edit, Heb412Gen::Plantillahcm)\n @vista = @plantillahcm.vista\n respond_to do |format|\n if @plantillahcm.update(plantillahcm_params)\n ordena_plantillahcm\n format.html do\n redirect_to(\n @plantillahcm,\n notice: \"Plantilla para hoja de cálculo con múltiples registros actualizada.\",\n )\n end\n format.json do\n render(\n :show,\n status: :ok,\n location: @plantillahcm,\n )\n end\n else\n format.html { render(:edit) }\n format.json do\n render(json: @plantillahcm.errors, status: :unprocessable_entity)\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @ocs_generada.update(ocs_generada_params)\n format.html { redirect_to @ocs_generada, notice: 'Ocs generada was successfully updated.' }\n format.json { render :show, status: :ok, location: @ocs_generada }\n else\n format.html { render :edit }\n format.json { render json: @ocs_generada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @junior_enterprise.update(junior_enterprise_params)\n format.html { redirect_to @junior_enterprise, notice: 'Empresa Junior atualizada.' }\n format.json { render :show, status: :ok, location: @junior_enterprise }\n else\n format.html { render :edit }\n format.json { render json: @junior_enterprise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @coordenador_estagio = CoordenadorEstagio.find(params[:id])\n\n respond_to do |format|\n if @coordenador_estagio.update_attributes(params[:coordenador_estagio])\n format.html { redirect_success(\"Coordenador alterado com sucesso!\",:coordenador_estagio, :index)}\n format.json { head :no_content }\n else\n format.html { redirect_error(\"Erro ao alterar coordenador!\",:coordenador_estagio, :index)}\n format.json { render json: @coordenador_estagio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mecanico_especialidad.update(mecanico_especialidad_params)\n format.html { redirect_to @mecanico_especialidad, notice: 'Mecanico especialidad was successfully updated.' }\n format.json { render :show, status: :ok, location: @mecanico_especialidad }\n else\n format.html { render :edit }\n format.json { render json: @mecanico_especialidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gatha.update(gatha_params)\n format.html { redirect_to @gatha, notice: 'Gatha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gatha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dm_especialidade.update(dm_especialidade_params)\n format.html { redirect_to @dm_especialidade, notice: 'Dm especialidade was successfully updated.' }\n format.json { render :show, status: :ok, location: @dm_especialidade }\n else\n format.html { render :edit }\n format.json { render json: @dm_especialidade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ventas_agrupador_cliente.update(ventas_agrupador_cliente_params)\n format.html { redirect_to @ventas_agrupador_cliente, notice: 'Agrupador cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @ventas_agrupador_cliente }\n else\n format.html { render :edit }\n format.json { render json: @ventas_agrupador_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ventas_agrupador_cliente.update(ventas_agrupador_cliente_params)\n format.html { redirect_to @ventas_agrupador_cliente, notice: 'Agrupador cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @ventas_agrupador_cliente }\n else\n format.html { render :edit }\n format.json { render json: @ventas_agrupador_cliente.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6492887",
"0.64774734",
"0.6374838",
"0.62955874",
"0.6279331",
"0.62629515",
"0.62590384",
"0.62122184",
"0.62020576",
"0.6188772",
"0.6187928",
"0.61781293",
"0.61756694",
"0.61731726",
"0.6166238",
"0.61631745",
"0.6154509",
"0.6141572",
"0.6134362",
"0.6133993",
"0.61209345",
"0.6114753",
"0.6108999",
"0.610221",
"0.6101579",
"0.6095495",
"0.60837495",
"0.6071346",
"0.60667825",
"0.6060908",
"0.60517544",
"0.60515785",
"0.6043098",
"0.60426325",
"0.6041911",
"0.6041826",
"0.6041766",
"0.6041605",
"0.6030929",
"0.6029005",
"0.6024457",
"0.60195065",
"0.6018692",
"0.60162526",
"0.601476",
"0.60087085",
"0.6008183",
"0.6008135",
"0.6007799",
"0.6006989",
"0.6005904",
"0.60045767",
"0.6003199",
"0.5999881",
"0.59997255",
"0.5999416",
"0.59985316",
"0.59966046",
"0.59950364",
"0.599418",
"0.59940976",
"0.5986001",
"0.5977041",
"0.5975905",
"0.59749854",
"0.5974699",
"0.5973172",
"0.59725934",
"0.5971246",
"0.59710115",
"0.59686565",
"0.5966575",
"0.5966227",
"0.5965924",
"0.59648347",
"0.59645575",
"0.5963637",
"0.595997",
"0.5957041",
"0.5955963",
"0.59530795",
"0.5951506",
"0.59511197",
"0.5949615",
"0.5947995",
"0.5945375",
"0.59444195",
"0.5944111",
"0.5939803",
"0.59392375",
"0.59361774",
"0.592976",
"0.5929539",
"0.5928649",
"0.59272075",
"0.59264314",
"0.5925963",
"0.5925853",
"0.59235877",
"0.59235877"
] | 0.66714966 | 0 |
DELETE /empresas_grandes/1 DELETE /empresas_grandes/1.json | def destroy
@empresas_grande.destroy
respond_to do |format|
format.html { redirect_to empresas_grandes_url, notice: 'Empresas grande was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @empleado_especialidad.destroy\n respond_to do |format|\n format.html { redirect_to empleado_especialidads_url, notice: 'Empleado especialidad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @emprego.destroy\n respond_to do |format|\n format.html { redirect_to empregos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize!(:edit, Heb412Gen::Plantillahcm)\n @plantillahcm.destroy\n respond_to do |format|\n format.html do\n redirect_to(\n Rails.configuration.relative_url_root,\n notice: \"Plantillahcm eliminado.\",\n )\n end\n format.json { head(:no_content) }\n end\n end",
"def destroy\n @teste_anamnese.destroy\n respond_to do |format|\n format.html { redirect_to teste_anamneses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @especialidad.destroy\n respond_to do |format|\n format.html { redirect_to especialidads_url, notice: 'Servicio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orden_examan.destroy\n respond_to do |format|\n format.html { redirect_to orden_examen_url, notice: 'Orden examan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteEntityEmployee( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/employee\",params)\n end",
"def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle = Detalle.find(params[:id])\n @detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to detalles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @percentual_gordura.destroy\n respond_to do |format|\n format.html { redirect_to percentual_gorduras_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @expediente = Expediente.find(params[:id])\n @expediente.destroy\n\n respond_to do |format|\n format.html { redirect_to expedientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estacionamiento = Estacionamiento.find(params[:id])\n @estacionamiento.destroy\n\n respond_to do |format|\n format.html { redirect_to estacionamientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @datos_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to datos_estudiantes_url, notice: 'Datos estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examan.destroy\n respond_to do |format|\n format.html { redirect_to examen_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anteproyecto_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to anteproyecto_estudiantes_url, notice: 'Anteproyecto estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employe.destroy\n respond_to do |format|\n format.html { redirect_to employes_path(api_id: @employe.organisme_id), notice: 'Employe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sugerencia = Sugerencia.find(params[:id])\n @sugerencia.destroy\n\n respond_to do |format|\n format.html { redirect_to sugerencias_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @estado_despacho.destroy\n respond_to do |format|\n format.html { redirect_to estado_despachos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @empleado.destroy\n respond_to do |format|\n format.html { redirect_to empleados_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odeme_akademist = Odeme::Akademist.find(params[:id])\n @odeme_akademist.destroy\n\n respond_to do |format|\n format.html { redirect_to odeme_akademists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @habitant.destroy\n respond_to do |format|\n format.html { redirect_to habitants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dm_especialidade.destroy\n respond_to do |format|\n format.html { redirect_to dm_especialidades_url, notice: 'Dm especialidade was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @empregador.destroy\n respond_to do |format|\n format.html { redirect_to empregadors_url, notice: 'O Empregador foi excluído com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consultum = Consultum.find(params[:id])\n @consultum.destroy\n\n respond_to do |format|\n format.html { redirect_to consulta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apoio_educacioanl.destroy\n respond_to do |format|\n format.html { redirect_to apoio_educacioanls_url, notice: 'Apoio educacioanal foi excluído com Sucesso !' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grade_horario.destroy\n respond_to do |format|\n format.html { redirect_to grade_horarios_url, notice: 'Grade horario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @emprestimo.destroy\n respond_to do |format|\n format.html { redirect_to emprestimos_url, notice: 'Reserva/Empréstimo foi Removido.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aprov_estabelecimento.destroy\n respond_to do |format|\n format.html { redirect_to aprov_estabelecimentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resa.destroy\n respond_to do |format|\n format.html { redirect_to resas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @antecedente = Antecedente.find(params[:id])\n @antecedente.destroy\n\n respond_to do |format|\n format.html { redirect_to antecedentes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anrede = Anrede.find(params[:id])\n @anrede.destroy\n\n respond_to do |format|\n format.html { redirect_to anredes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @factura = Factura.find(params[:factura_id])\n @renglon_factura = @factura.renglon_facturas.find(params[:id]).destroy\n\n respond_to do |format|\n format.html { head :ok }\n #format.json { head :ok }\n end\n end",
"def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @demande_eg.destroy\n respond_to do |format|\n format.html { redirect_to demande_egs_url, notice: 'Demande eg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visitante.destroy\n respond_to do |format|\n format.html { redirect_to visitantes_url, notice: 'Visitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades2 = Humanidades2.find(params[:id])\n @humanidades2.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades2s_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trabajador_seccion.destroy\n respond_to do |format|\n format.html { redirect_to trabajador_seccions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitio_entrega = SitioEntrega.find(params[:id])\n @sitio_entrega.destroy\n\n respond_to do |format|\n format.html { redirect_to sitio_entregas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_despesa.destroy\n respond_to do |format|\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @habito.destroy\n respond_to do |format|\n format.html { redirect_to index_habito_path(params[:paciente_id]), notice: 'Se elimino el registro' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grupa = Grupa.find(params[:id])\n @grupa.destroy\n\n respond_to do |format|\n format.html { redirect_to grupy_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addre = Addre.find(params[:id])\n @addre.destroy\n\n respond_to do |format|\n format.html { redirect_to addres_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @egreso.destroy\n respond_to do |format|\n format.html { redirect_to egresos_url, notice: 'Egreso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gentre.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @sesh.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @Empresa.destroy\n respond_to do |format|\n format.html { redirect_to Empresas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @Empresa.destroy\n respond_to do |format|\n format.html { redirect_to Empresas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @demanda.destroy\n respond_to do |format|\n format.html { redirect_to demandas_url, notice: 'Demanda was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_plan.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end",
"def destroy\n @estado_remate.destroy\n respond_to do |format|\n format.html { redirect_to estado_remates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n padre=@familia.padre_id\n @familia.destroy\n respond_to do |format|\n format.html { redirect_to familias_url(:id => padre) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @suplente = Suplente.find(params[:id])\n @suplente.destroy\n\n respond_to do |format|\n format.html { redirect_to suplentes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @especialidade.destroy\n respond_to do |format|\n format.html { redirect_to especialidades_url, notice: 'Especialidade was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estadia.destroy\n respond_to do |format|\n format.html { redirect_to estadia_url, notice: 'Estadia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @escola = Escola.find(params[:id])\n @escola.destroy\n\n respond_to do |format|\n format.html { redirect_to escolas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @planificacion_semanal = PlanificacionSemanal.find(params[:id])\n @planificacion_semanal.destroy\n\n respond_to do |format|\n format.html { redirect_to planificaciones_semanales_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tipo_agressor.destroy\n respond_to do |format|\n format.html { redirect_to tipo_agressores_url, notice: @@msgs }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @reentrada.destroy\n respond_to do |format|\n format.html { redirect_to reentradas_url, notice: 'Reentrada was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuestum.destroy\n respond_to do |format|\n format.html { redirect_to comentarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proceso_examan.destroy\n respond_to do |format|\n format.html { redirect_to proceso_examen_url, notice: 'Proceso examan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orden_entrega.destroy\n respond_to do |format|\n format.html { redirect_to orden_entregas_url, notice: 'Orden entrega was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anamnese.destroy\n respond_to do |format|\n format.html { redirect_to anamneses_url, notice: 'Anamnese deletada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fornecedor.destroy\n addlog(\"Fornecedor apagado\")\n respond_to do |format|\n format.html { redirect_to fornecedores_url, notice: 'Fornecedor apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @excepcion_entrega = ExcepcionEntrega.find(params[:id])\n @excepcion_entrega.destroy\n\n respond_to do |format|\n format.html { redirect_to excepcion_entregas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_orden_trabajo.destroy\n respond_to do |format|\n format.html { redirect_to @orden_trabajo, notice: 'Detalle fue eliminado con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_de_despesa.destroy\n addlog(\"Item de despesa apagado\")\n respond_to do |format|\n format.html { redirect_to itens_de_despesa_url, notice: 'Item de despesa apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @substancia.destroy\n respond_to do |format|\n format.html { redirect_to substancias_url, notice: 'Substancia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visitante_credenciado = VisitanteCredenciado.find(params[:id])\n @visitante_credenciado.destroy\n\n respond_to do |format|\n format.html { redirect_to visitante_credenciados_url }\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @desire.destroy\n\n respond_to do |format|\n format.html { redirect_to desires_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @gestacao.destroy\n respond_to do |format|\n format.html { redirect_to gestacaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @horario_entrega.destroy\n respond_to do |format|\n format.html { redirect_to horario_entregas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @gatha.destroy\n respond_to do |format|\n format.html { redirect_to gathas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_heal.destroy\n respond_to do |format|\n format.html { redirect_to manage_heals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consulta.destroy\n respond_to do |format|\n format.html { redirect_to paciente_consultas_path, notice: 'Consulta foi deletada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle.destroy\n respond_to do |format|\n format.html { redirect_to detalles_url, notice: 'Detalle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @compra_detalle = CompraDetalle.find(params[:id])\n @compra_detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to compra_detalles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @empresa_registrada = EmpresaRegistrada.find(params[:id])\n @empresa_registrada.destroy\n\n respond_to do |format|\n format.html { redirect_to empresa_registradas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fornecedore = Fornecedore.find(params[:id])\n @fornecedore.destroy\n\n respond_to do |format|\n format.html { redirect_to fornecedores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estabelecimento = Estabelecimento.find(params[:id])\n @estabelecimento.destroy\n\n respond_to do |format|\n format.html { redirect_to estabelecimentos_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7241906",
"0.71171665",
"0.7002369",
"0.69909877",
"0.69902223",
"0.69559526",
"0.69471467",
"0.69358104",
"0.69334406",
"0.69239676",
"0.6916203",
"0.69143885",
"0.68470216",
"0.6842328",
"0.6841625",
"0.6840756",
"0.6837575",
"0.6836073",
"0.68325824",
"0.68270934",
"0.68204296",
"0.68182236",
"0.68139917",
"0.68128335",
"0.6812641",
"0.68068355",
"0.680681",
"0.6804509",
"0.6804509",
"0.68016404",
"0.679441",
"0.6794071",
"0.679354",
"0.67932665",
"0.6788577",
"0.67884535",
"0.67876184",
"0.6785516",
"0.67843384",
"0.6783209",
"0.67823976",
"0.6781435",
"0.67805696",
"0.6776535",
"0.6774878",
"0.6774656",
"0.6768024",
"0.6767529",
"0.6761529",
"0.6761364",
"0.6760538",
"0.6757936",
"0.6756112",
"0.67525786",
"0.6751882",
"0.6751539",
"0.6748213",
"0.6745285",
"0.674469",
"0.67436856",
"0.67423666",
"0.67398846",
"0.6736591",
"0.67356807",
"0.67356807",
"0.6734788",
"0.6731819",
"0.6731248",
"0.67311484",
"0.6730734",
"0.6730678",
"0.67285174",
"0.6726937",
"0.6725162",
"0.6724567",
"0.6722864",
"0.67204404",
"0.6718143",
"0.6716276",
"0.6715799",
"0.6715574",
"0.6714825",
"0.6712781",
"0.67076755",
"0.6706751",
"0.6706449",
"0.6705375",
"0.67044014",
"0.67029005",
"0.67019284",
"0.670157",
"0.670057",
"0.6698053",
"0.669724",
"0.6696815",
"0.66952854",
"0.6694734",
"0.66933924",
"0.6692925",
"0.6689192"
] | 0.72367156 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_empresas_grande
@empresas_grande = EmpresasGrande.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def around_hooks; end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] | [
"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.53314966",
"0.53114754",
"0.52984965",
"0.52977055",
"0.5296272",
"0.5260649",
"0.5245076",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.5235081",
"0.52321917",
"0.5228592",
"0.5220735",
"0.52198535",
"0.52139324",
"0.5208539",
"0.5206585",
"0.5178542",
"0.5175199",
"0.5173538",
"0.5167041",
"0.51614195",
"0.51577675",
"0.5153909",
"0.51528823",
"0.5152225",
"0.51429904",
"0.5141399",
"0.51345575",
"0.51145",
"0.5114052",
"0.5114052",
"0.5110216",
"0.5108656",
"0.50935394",
"0.5089196",
"0.5081936",
"0.5079627",
"0.50675833",
"0.5056105",
"0.5053687",
"0.5050475",
"0.5050475",
"0.503471",
"0.5028311",
"0.501982",
"0.50157547",
"0.5013552",
"0.50014806",
"0.50011593",
"0.49976763",
"0.4990292",
"0.4990292",
"0.49882022",
"0.4981269",
"0.49792367",
"0.49766538",
"0.4967978",
"0.49667212",
"0.4958987",
"0.49572337",
"0.49550423",
"0.4954479",
"0.4952353",
"0.494726",
"0.4944055",
"0.4935437",
"0.4931248",
"0.49283475",
"0.49281213",
"0.49268973",
"0.4921738",
"0.49204507",
"0.4918924",
"0.49182287",
"0.4916538",
"0.49158585",
"0.49156788"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def empresas_grande_params
params.require(:empresas_grande).permit(:nombre, :representante_legal_rut, :dv, :aux1, :aux2, :aux3, :image)
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
initializer to start process | def initialize
TYPES.each do |type|
transform_files!(Files.type_files(type), type)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start!\n process.start\n end",
"def start\n @process = ChildProcess.build(*parameters)\n process.start\n end",
"def initialize(process); end",
"def initialize(process)\n self.process = process\n end",
"def initialize(process)\n\t\t\t\tsuper(IO.popen(process, Writeable))\n\t\t\tend",
"def initialize(pid) \r\n @pid = pid\r\n @h = Ragweed::Wrap32::open_process(pid)\r\n @a = arena()\r\n end",
"def initialize(*args)\n @env, @argv, options = extract_process_spawn_arguments(*args)\n @options = options.dup\n @input = @options.delete(:input)\n @timeout = @options.delete(:timeout)\n @max = @options.delete(:max)\n if @options.delete(:pgroup_kill)\n @pgroup_kill = true\n @options[:pgroup] = true\n end\n @options.delete(:chdir) if @options[:chdir].nil?\n exec! if !@options.delete(:noexec)\n end",
"def initialize(*args)\n @env, @argv, options = extract_process_spawn_arguments(*args)\n @options = options.dup\n @input = @options.delete(:input)\n @timeout = @options.delete(:timeout)\n @max = @options.delete(:max)\n @prepend_stdout = @options.delete(:prepend_stdout) || \"\"\n @prepend_stderr = @options.delete(:prepend_stderr) || \"\"\n @options.delete(:chdir) if @options[:chdir].nil?\n\n exec!\n end",
"def start\n parse_options\n\n if @daemon\n require \"facets/daemonize\"\n\n daemonize()\n\n # Save a process sentinel file.\n FileUtils.touch(File.join(\".temp\",\"d#{Process.pid}.pid\"))\n end\n setup_drb()\n end",
"def start(name, &block)\n\t\t\t\tProcess.fork(name: name, &block)\n\t\t\tend",
"def start\r\n @proc.call\r\n end",
"def spawn_process(args = nil)\n #Used for printing debug-stuff.\n @main = true\n\n if args && args[:exec]\n cmd = \"#{args[:exec]}\"\n else\n if RbConfig::CONFIG[\"bindir\"]\n cmd = \"#{RbConfig::CONFIG[\"bindir\"]}/ruby\"\n else\n cmd = \"ruby\"\n end\n end\n\n cmd << \" \\\"#{File.realpath(File.dirname(__FILE__))}/../scripts/ruby_process_script.rb\\\" --pid=#{@my_pid}\"\n cmd << \" --debug\" if @args[:debug]\n cmd << \" \\\"--title=#{@args[:title]}\\\"\" unless @args[:title].to_s.strip.empty?\n\n #Start process and set IO variables.\n require \"open3\"\n @io_out, @io_in, @io_err = Open3.popen3(cmd)\n @io_out = Tsafe::Proxy.new(obj: @io_out)\n @io_out.sync = true\n @io_in.sync = true\n @io_err.sync = true\n\n started = false\n @io_in.each_line do |str|\n if str == \"ruby_process_started\\n\"\n started = true\n break\n end\n\n debug \"Ruby-process-debug from stdout before started: '#{str}'\\n\" if @debug\n end\n\n raise \"Ruby-sub-process couldnt start: '#{@io_err.read}'.\" unless started\n self.listen\n\n #Start by getting the PID of the process.\n begin\n @pid = self.static(:Process, :pid).__rp_marshal\n raise \"Unexpected PID: '#{@pid}'.\" if !@pid.is_a?(Fixnum) && !@pid.is_a?(Integer)\n rescue => e\n self.destroy\n raise e\n end\n\n if block_given?\n begin\n yield(self)\n ensure\n self.destroy\n end\n\n return self\n else\n return self\n end\n end",
"def start\n handle_old_pid_file\n start_control_loop\n end",
"def start!(&block)\n if running?\n fail InsidiousError.new(\"Process is already running with PID #{pid}\")\n exit 2\n else\n if @pid_file.nil? && daemon?\n fail InsidiousError.new('No PID file is set but daemonize is set to true')\n exit 1\n end\n\n run_daemon!(&block)\n end\n end",
"def start\n logger.debug \"Starting felix with these values: \"\n logger.debug \"felix_home: #{@felix_home}\"\n logger.debug \"felix_command: #{felix_command.join(' ')}\"\n \n # Check to see if we can start.\n # 1. If there is a pid, check to see if it is really running\n # 2. Check to see if anything is blocking the port we want to use \n if pid\n if Felixwrapper.is_pid_running?(pid)\n raise(\"Server is already running with PID #{pid}\")\n else\n logger.warn \"Removing stale PID file at #{pid_path}\"\n File.delete(pid_path)\n end\n end\n\n if Felixwrapper.is_port_in_use?(self.port)\n raise(\"Port #{self.port} is already in use.\")\n end\n\n Dir.chdir(@felix_home) do\n process.start\n end\n FileUtils.makedirs(pid_dir) unless File.directory?(pid_dir)\n begin\n f = File.new(pid_path, \"w\")\n rescue Errno::ENOENT, Errno::EACCES\n f = File.new(File.join(@base_path,'tmp',pid_file),\"w\")\n end\n f.puts \"#{process.pid}\"\n f.close\n logger.debug \"Wrote pid file to #{pid_path} with value #{process.pid}\"\n startup_wait!\n end",
"def start\n yield self if block_given?\n classpath = self.classpath.is_a?(Array) ? self.classpath : []\n start_process(classpath)\n end",
"def start *args\n return self if attached? or running?\n @pid = ::Process.spawn Nutcracker.executable, *command\n Process.detach(@pid)\n sleep 2\n raise \"Nutcracker failed to start\" unless running?\n Kernel.at_exit { kill if running? }\n self\n end",
"def start_run; end",
"def start!\n @pid_lock.synchronize do\n raise AlreadyStarted if running?\n\n @event_received = false\n\n start_listening_events\n start_process\n start_watchdog\n end\n end",
"def start\n register_signal_handlers\n startup\n spawn_processes\n watch_for_output\n sleep 0.1\n wait_for_shutdown_or_child_termination\n shutdown\n exit(@exitstatus) if @exitstatus\n end",
"def _start_monitor(analyzer_id, port)\n $logger.debug \"_START MONITOR\"\n opts={\n :ARGV => ['restart',analyzer_id.to_s,port.to_s],\n :multiple => true,\n :monitor => true,\n :backtrace => true,\n :mode => :exec,\n :log_output => File.join(File.dirname(__FILE__) ,'../../log/monitor.out')\n }\n script = File.join(File.dirname(__FILE__),\"monitor.rb\")\n #Child process execs\n #ObjectSpace.each_object(IO) {|io| io.close rescue nil }\n app = Daemons.run(script ,opts)\n $logger.debug \"------------------------------------------->\"\n $logger.debug app.inspect()\n $logger.debug \"<-------------------------------------------\"\n #parent process continues\n end",
"def start\n return if @status == :runned\n \n @pid = fork do\n Process::setsid\n STDIN.reopen('/dev/null', 'r')\n STDOUT.reopen('/dev/null', 'w')\n STDERR.reopen('/dev/null', 'w')\n exec @cmd\n end\n @status = :runned\n end",
"def start\n logfile.say(\"Starting #{name}\")\n\n if @@system.windows\n # Windows\n say \"Starting [[#{cmd}]] in window\"\n @cmd = \"start cmd /C #{cmd}\"\n run(true)\n else\n say \"Starting [[#{name}]] in background, output to #{logfile}\"\n pid = fork { run(true) }\n PidFile.new(name, @logdir).pid = pid\n ::Process.detach(pid)\n end\n end",
"def start\n execute_prlctl('start', @uuid)\n end",
"def initialize(process)\n @process = process\n @credentials = credentials_from_process(@process)\n @async_refresh = false\n\n super\n end",
"def run\n assign_process_name!\n\n wrap_chain(:start) do\n STDOUT.sync = true\n\n logger.info(\"Engine \\##{id} Running\")\n \n switch_to_effective_user! if (self.class.user)\n\n @state = :running\n end\n end",
"def start_manager\n if !Invoker::CONFIG.processes || Invoker::CONFIG.processes.empty?\n raise Invoker::Errors::InvalidConfig.new(\"No processes configured in config file\")\n end\n install_interrupt_handler()\n unix_server_thread = Thread.new { Invoker::CommandListener::Server.new() }\n thread_group.add(unix_server_thread)\n run_power_server()\n Invoker::CONFIG.processes.each { |process_info| add_command(process_info) }\n at_exit { kill_workers }\n start_event_loop()\n end",
"def start\n activate\n @process_should_stop_mutex.synchronize do\n @process_should_stop = false\n end\n process_worker_thread\n process_monitor_thread\n end",
"def default_start_program\n _init_command('start')\n end",
"def on_begin_process()\n # subclasses may override this method \n end",
"def start\n\t\tinit\n\t end",
"def start\n validate!\n start_messages\n create_workers\n Process.wait\n end",
"def start\n validate!\n start_messages\n create_workers\n Process.wait\n end",
"def start_proc()\n\tprint_good(\"Starting Notepad.exe to house Meterpreter Session.\")\n\tproc = client.sys.process.execute('notepad.exe', nil, {'Hidden' => true })\n\tprint_good(\"Process created with pid #{proc.pid}\")\n\treturn proc.pid\nend",
"def start\n pid = Process.spawn(\n executable_path, \"-daemon\",\n :out => '/dev/null', :err => '/dev/null')\n\n # Detach the spawned process\n Process.detach pid\n end",
"def initialize\n @processes = []\n end",
"def start\n Command::Installer::Start.new(\n *command_params\n ).execute\n rescue => e\n catch_errors(e)\n end",
"def start\n configure\n run\n end",
"def initialize(arg)\n super(arg)\n if(!@@has_setup)\n path = File.expand_path('../../../mockcourse/mockcourse', __FILE__)\n port = get_open_port\n path = \"#{path} #{port} > /dev/null 2>&1 &\"\n @@pid = Process.spawn(path, :pgroup => true)\n tries = 5\n while tries > 0 and @@client.nil?\n tries -= 1\n sleep(1) # wait for Mockcourse to start\n begin\n @@client = Concourse.connect(port:port)\n rescue Exception => ex\n if tries == 0\n raise ex\n else\n next\n end\n end\n end\n @@pid = get_mockcourse_pid\n ObjectSpace.define_finalizer(self, self.class.finalize(@@pid))\n @@has_setup = true\n end\n end",
"def create_process(*args, start: true, wait: true, attach: true, cwd: nil, environment: {})\n process = ChildProcess.build(*args)\n process.io.inherit! if attach\n\n # Set the working directory\n process.cwd = cwd unless cwd.nil?\n\n # Set any passed environment variables\n environment.each do |env, value|\n process.environment[env.to_s] = value\n end\n\n # Start the process if requested\n if start\n process.start\n process.wait if wait\n end\n\n process\nend",
"def initialize(options = {})\n @daemonize = options[:daemonize].nil? ? true : options[:daemonize]\n @pid_file = options[:pid_file].nil? ? nil : File.absolute_path(options[:pid_file])\n end",
"def _start_monitor(analyzer_id, port)\n $logger.debug \"_START MONITOR\"\n opts={\n :ARGV => ['restart', analyzer_id.to_s, port.to_s],\n :multiple => true,\n :monitor => true,\n :backtrace => true,\n :mode => :exec,\n :log_output => File.join(File.dirname(__FILE__), '../../log/monitor.out'+($is_debug ? \".dug\" :\"\"))\n }\n script = File.join(File.dirname(__FILE__), \"monitor.rb\")\n #Child process execs\n #ObjectSpace.each_object(IO) {|io| io.close rescue nil }\n app = Daemons.run(script, opts)\n $logger.debug \"------------------------------------------->\"\n $logger.debug app.inspect()\n $logger.debug \"<-------------------------------------------\"\n #parent process continues\n end",
"def initialize(pid_file, log = Logger.new(STDOUT), name = \"\", loop_process = false, &handler)\n # Interrupt flag\n @flag_int = false\n # logger object\n @log = log\n # Daemon handler\n @execute_handler = handler\n # Daemon name\n @name = name\n\n # pid file path\n @pid_file_path = pid_file\n\n # if include loop process\n @loop_process = loop_process\n\n end",
"def start\n Result.new(call(CMD_START))\n end",
"def start\n system(\"ruby #{DAEMON} &\")\n end",
"def method_missing(method, *args)\n args = [:process, method.to_s] + args\n self.class.start(args)\n end",
"def start_proc(proc_name)\n print_good(\"Starting Notepad.exe to house Meterpreter Session.\")\n proc = client.sys.process.execute(proc_name, nil, {'Hidden' => true })\n print_good(\"Process created with pid #{proc.pid}\")\n return proc.pid\n end",
"def initialize(path, opts = {})\n assert_executable path\n\n @path = path\n @port = Integer(opts[:port] || 8080)\n @timeout = Integer(opts[:timeout] || 10)\n @log = !!opts[:log]\n\n @process = create_process\n end",
"def start \n `killall gammu-smsd` && puts(\"Killing Daemons!\")\n puts \"Loading Daemons......\"\n @phones.values.each do |provider|\n fork do\n exec \"gammu-smsd -c #{@datafolder+provider} &\"\n end\n end\n end",
"def start(*)\n self\n end",
"def spawn\n Process.spawn(*spawn_args)\n end",
"def start\n prepare\n loop { fork_one_job }\n end",
"def exec()\r\n\t\t#set up the ULikes LogHelper\r\n\t\tif @daemonize\r\n\t\t\tLogHelper.logger = Logger.new('../log/email_processor.log', 'daily')\r\n\t\telse\r\n\t\t\tLogHelper.logger = Logger.new(STDOUT)\r\n\t\tend\r\n\t\t@pop = PopHelper.new\r\n\t\t@msg_proc = MessageProcessor.new\r\n\r\n\t\tif @db_env == 'development'\r\n\t\t\tActiveRecord::Base.logger = LogHelper.logger\r\n\t\tend\r\n\r\n\t\tlog.info(\"Starting up!\")\r\n\t\tif @daemonize \r\n\t\t\t# spawn a new daemon process\r\n\t\t\tpid = fork do\r\n\t\t\t\trun()\r\n\t\t\tend\r\n\t\t\tProcess.detach(pid)\r\n\t\telse\r\n\t\t\t#just run the script and retain the console\r\n\t\t\trun()\r\n\t\tend\r\n\tend",
"def start\n start_message\n setup_options\n validate!\n setup_jobs\n boot_manager\n end",
"def process(process_name, &block)\n process_proxy = ProcessMethods.new(process_name.to_s, self)\n \n # Assigns all attributes from application scope and assigns to process\n assign_global_attributes(process_proxy)\n \n Blockenspiel.invoke(block, process_proxy)\n # Takes everything which we set in the DSL and loads it into @attributes\n process_proxy.assign_process_attributes!\n \n process_proxy.create_child_process_template\n \n assign_default_pid_file(process_proxy, process_name.to_s)\n \n # Validate process\n process_proxy.validate!\n \n # Assign group to process\n process = process_proxy.to_process(process_name.to_s)\n \n self.app.add_process(process)\n end",
"def initialize(index, master_pid)\n @index = index\n @master_pid = master_pid\n @times_run = 0\n\n ProcessManager.set_program_name(description)\n end",
"def start\n extract_and_configure\n if config.managed?\n @pid = spawn(config.env, *process_arguments)\n\n # Wait for fcrepo to start\n while !status\n sleep 1\n end\n end\n end",
"def start(boxname=\"mmsbox\", method=\"simple_fork\")\n raise \"Box with #{boxname} is already running\" unless @proc[boxname].nil?\n if method == \"simple_fork\"\n @proc[boxname] = MbuniProc.new(nil,nil,nil,\n fork { exec \"#{@path}/bin/#{boxname} #{@config}\" }\n )\n elsif method == \"custom_popen\"\n @proc[boxname] = MbuniProc.new(*custom_popen(\"#{@path}/bin/#{boxname} #{@config}\"))\n end\n\n puts \"Started #{boxname} with pid=#{@proc[boxname].pid} using method #{method}\"\n @proc[boxname].pid \n end",
"def start\n start_messages\n flush_spaces\n create_workers\n Process.wait\n end",
"def on_start\n rpth = File.dirname(File.dirname(__FILE__))\n spid = Process.pid\n wqport = config[:port]+1\n cdir = Dir.tmpdir\n system(\"python #{rpth}/lib/seqInit.py #{spid} #{wqport} #{cdir} &\")\n\n puts '** SequenceServer is ready.'\n puts \" Go to #{server_url} in your browser and start BLASTing!\"\n puts ' To share your setup, please try one of the following: '\n puts \" - http://#{ip_address}:#{config[:port]}\"\n puts \" - http://#{hostname}:#{config[:port]}\" if hostname\n puts ' Press CTRL+C to quit.'\n open_in_browser(server_url)\n end",
"def launch\n # To be overriden in subclass,\n # not implemented here.\n raise NotImplementedError\n end",
"def run\n if @initializer.nil?\n @initializer = new\n \n yield @initializer.configuration if block_given?\n @initializer.process\n \n start_app\n else\n yield @initializer.configuration if block_given?\n end\n end",
"def process(*args)\n init_srv\n super\n end",
"def startup\n return self unless not running?\n\n begin\n create_pid_file\n trap_signals\n run\n rescue Exception => e\n # if something is caught here, then we can only log it. at this point we are in an\n # unknown state and can only delete our pid file and #exit!. Attempting to call\n # our #term method could cause other problems here.\n Emissary.logger.error \"Server '#{$0}': #{e.class.name}: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n ensure\n delete_pid_file\n shutdown! :hard\n end\n \n return self\n end",
"def start()\n\t\tprintinfo \"start execute the usrpse wrapper now...\"\n\t\tprintinfo \"configure the system buffer size... \"\n\t\t#`sudo sysctl -w net.core.wmem_max=1048576`\n\t\t#`sudo sysctl -w net.core.rmem_max=50000000`\t\t\n\t\t \n\t\t# open a child process to execute the sensing binaries \n\t\tPTY.spawn @cmd do |r,w,p|\n\t\t\t# close the write pipe\n\t\t\tw.close\n\t\t\t# assign the process id to the global variable\n\t\t\t$pid_global=p\n\t\t\t# start the loop to read and process the output \n\t\t\tloop { \n\t\t\t\tline=r.gets\n\t\t\t\tputs line\n\t\t\t\tif @output_mode == 'OML'\t\n\t\t\t\t\tif line.split(',').length >= 3 \n\t\t \t\t\t\tif numeric?(line.split(',')[3])\n\t\t\t \t\t\t\teval(@oml_inject_str)\n\t\t\t \t\t\tend\n\t\t\t \t\tend\n\t\t\t \tend\n\t\t\t}\n\t\tend\n\tend",
"def start()\n\n\t\tend",
"def start\n _bootstrap!\n self.started = true\n end",
"def start_process\n process_pid = fork do\n $stdout.puts \"Worker process #{@type} will select on #{@to_processes}.\"\n\n # Tell worker to setup.\n #\n @worker.setup if @worker.respond_to? :setup\n\n post_process = @worker.respond_to? :post_process\n\n loop do\n begin\n # Wait for input from the child for a sub-second.\n #\n received = Cod.select 0.05, @to_processes\n\n #\n #\n process_channels received if received\n\n # Tell worker to post_process\n #\n @worker.post_process if post_process\n rescue StandardError => e\n # If anything goes wrong we print and ignore it.\n #\n $stderr.puts \"[Warning] #{e.inspect}, #{e.backtrace}\"\n end\n end\n end\n\n # On an INT, INT the forked process.\n #\n Signal.trap('INT') do\n Process.wait(process_pid)\n end\n rescue StandardError => e\n # Always return _something_.\n #\n $stderr.puts \"[Warning] Calling #{action} with #{message} failed: #{e.message}\"\n back_channel.put [] if back_channel\n end",
"def start *args\n return unless iterm?\n\n init\n\n unless @error_message\n _file = set_file @config.running_file, @config.running_url, @running_tmp\n _file ||= ''\n change_background _file\n end\n rescue => e\n @error_message = e.inspect\n end",
"def start_ffmpeg\n raise RecorderErrors::DependencyNotFound, 'ffmpeg binary not found.' unless ffmpeg_exists?\n\n FFMPEG.logger.debug \"Command: #{command}\"\n process = IO.popen(command, 'r+')\n sleep(1.5) # Takes ~1.5s on average to initialize\n process\n end",
"def initialise_process\n self.state = \"Initiated\"\n self.save!\n self.init_process\n end",
"def start\n if File.file?(trait[:pidfile])\n pid = File.read(trait[:pidfile], 20).strip\n abort(\"thoth already running? (pid=#{pid})\")\n end\n\n puts \"Starting thoth.\"\n\n fork do\n Process.setsid\n exit if fork\n\n File.open(trait[:pidfile], 'w') {|file| file << Process.pid}\n at_exit {FileUtils.rm(trait[:pidfile]) if File.exist?(trait[:pidfile])}\n\n Dir.chdir(HOME_DIR)\n File.umask(0000)\n\n STDIN.reopen('/dev/null')\n STDOUT.reopen('/dev/null', 'a')\n STDERR.reopen(STDOUT)\n\n run\n end\n end",
"def run\n prepare_process\n reporter.welcome_message\n exit(1) if print_config_errors\n\n # Set up our console input handling and history\n console = Console.new(config, reporter)\n\n # Start the server\n while console_run_loop(console)\n # just need to run the loop\n end\n\n console.store_history\n\n cleanup_process\n end",
"def start\n @config[:start]\n end",
"def start_monitor(analyzer_id, port)\n $logger.debug \"START MONITOR\"\n analyzer = Analyzer.find(analyzer_id)\n opts={\n :ARGV => ['start',analyzer_id.to_s,port.to_s]\n }\n script = File.join(File.dirname(__FILE__),\"monitor.rb\")\n child_process = Kernel.fork()\n if (child_process.nil?)\n # In Child process\n @sock.close if (!@sock.nil?)\n @server.close if (!@server.nil?)\n stdfname = File.join(File.dirname(__FILE__) ,\"../../log/monitorstd_#{analyzer_id}\")\n stdin = open '/dev/null','r'\n stdout = open stdfname+\".out\",'a'\n stderr = open stdfname+\".err\",'a'\n $0 = sprintf(\"%s_%s_%s\", $0, analyzer.ip, port)\n #STDIN.close\n #STDIN.reopen stdin\n STDOUT.reopen stdout\n STDERR.reopen stderr\n #STDIN.open('/dev/null')\n #STDOUT.open(stdfname,'a')\n #STDERR.open(stdfname,'a')\n Kernel.exec(script,analyzer_id.to_s,port.to_s)\n exit\n end\n #parent process continues\n Process.detach(child_process)\n $logger.debug \"Monitor Forked\"\n end",
"def start\n\t\t@log_reporter.start\n\t\t@proc_reporter.start\n\n\t\tsuper\n\tend",
"def start(&block) # :yields: options\n handle_errors do\n process_command_line\n block.call self if block\n end\n end",
"def start!\n start\n wait_until_terminated(nil)\n end",
"def start\n Daemons.run(file_path, options.merge(ARGV: ['start']))\n end",
"def start_new_process(process_type, event, correlation)\n process = @factory.create process_type\n process.correlations.add correlation\n\n @lock_manager.obtain_lock process.id\n\n begin\n notify_process process, event\n ensure\n begin\n @repository.add process\n ensure\n @lock_manager.release_lock process.id\n end\n end\n end",
"def execute_program\n @pc = @program_start\n \n end",
"def connect_to_process!\n Bullring.logger.debug{\"#{caller_name}: Connecting to process...\"}\n\n if !process_port_active?\n Bullring.logger.debug {\"#{caller_name}: Spawning process...\"}\n\n # Spawn the process in its own process group so it stays alive even if this process dies\n pid = Process.spawn([@options[:process][:command], @options[:process][:args]].flatten.join(\" \"), {:pgroup => true})\n Process.detach(pid)\n\n time_sleeping = 0\n while (!process_port_active?)\n sleep(0.2)\n if (time_sleeping += 0.2) > @options[:process][:max_bringup_time]\n Bullring.logger.error {\"#{caller_name}: Timed out waiting to bring up the process\"}\n raise StandardError, \"#{caller_name}: Timed out waiting to bring up the process\", caller\n end\n end\n end\n\n if !@local_service.nil?\n @local_service.stop_service\n Bullring.logger.debug {\"#{caller_name}: Stopped local service on #{@local_service.uri}\"}\n end\n \n @local_service = DRb.start_service \"druby://127.0.0.1:0\"\n Bullring.logger.debug {\"#{caller_name}: Started local service on #{@local_service.uri}\"}\n\n @process = DRbObject.new nil, \"druby://#{host}:#{port}\"\n \n @after_connect_block.call(@process) if !@after_connect_block.nil?\n end",
"def start\n return unless @state == :stopped\n @stop_requested = false\n @thread = Thread.new do\n process\n end\n\n @state = :started\n end",
"def start\n super\n end",
"def start\n super\n end",
"def start\n super\n end",
"def start\n super\n end",
"def start\n super\n end",
"def start(cwd: '.')\n @pid = spawn(\"vanilli --port #{@port} \\\n --logLevel=#{@log_level} \\\n --staticRoot=#{@static_root} \\\n --staticDefault=#{@static_default} \\\n --staticInclude='#{@static_include}' \\\n --staticExclude='#{@static_exclude}'\", chdir: cwd, pgroup: true)\n @pgid = Process.getpgid(@pid)\n\n Timeout.timeout(3) do\n begin\n RestClient.get \"http://localhost:#{@port}/_vanilli/ping\"\n rescue\n sleep 0.1\n retry\n end\n end\n\n self\n end",
"def run\n begin\n puts \" [*] Running #{self.class.config[:application_name]} with pid #{Process.pid}\"\n puts \" [*] Running in #{self.class.env} environment\"\n puts \" [*] To exit press CTRL+C or send a SIGINT\"\n self.start\n loop do\n sleep(1)\n end\n rescue SystemExit, Interrupt => _\n self.stop\n end\n end",
"def initialize(cmd, *args)\n @cmd = cmd\n @args = *args\n @process_status = nil\n @executed = false\n end",
"def start\n\n end",
"def start\n\t\tend",
"def ensure_start\n start\n sv_command('start') if supervised?\n end",
"def on_process(&block); end",
"def start\n ucommand(:start)\n end",
"def start\n\t\t@config_file = @config.write\n\n\t\t# Open the error log and seek to the end so we can check for startup\n\t\tself.open_errlog\n\t\tself.open_custom_logs\n\t\toffset = @errlog.pos\n\t\n\t\t# Fork and send the child off to become the server\t\t\n\t\tunless @pid = Kernel.fork\n\t\t\tbegin\n\t\t\t\tself.start_httpd( @config_file )\n\t\t\trescue Exception => e\n\t\t\t\traise RuntimeError, \"Child died before exec: %s:\\n\\t%s\" %\n\t\t\t\t\t[ e.message, e.backtrace.join(\"\\n\\t\") ]\n\t\t\tend\n\t\t\texit\n\t\tend\n\n\t\t# Wait for the error log to say \"resuming normal operations\"\n\t\twaiting = true\n\t\twhile waiting\n\t\t\t@errlog.seek( 0, IO::SEEK_CUR )\n\t\t\t\n\t\t\t# Stop waiting if the child dies for some reason\n\t\t\tdeadpid, stat = Process.waitpid2( @pid, Process::WNOHANG )\n\t\t\tif stat\n\t\t\t\t$stderr.puts \"waitpid returned non-nil: %d / %d, %s\" %\n\t\t\t\t\t[ @pid, deadpid, stat.inspect ]\n\t\t\t\tbreak if deadpid == @pid\n\t\t\tend\n\t\t\t\n\t\t\t# Read the error log until something like \"[Thu Apr 17 03:05:40\n\t\t\t# 2003] [notice] Apache/1.3.27 (Darwin) mod_ruby/1.1.1 configured --\n\t\t\t# resuming normal operations\" is seen\n\t\t\tbegin\n\t\t\t\twhile line = @errlog.readline\n\t\t\t\t\twaiting = false if /resuming normal operations/ =~ line\n\t\t\t\tend\n\t\t\trescue EOFError\n\t\t\t\tsleep 0.2\n\t\t\tend\n\t\tend\n\n\t\traise RuntimeError, \"Child server died during startup.\" unless\n\t\t\twaiting == false\n\n\t\t# Set the errorlog handle back to the place where the current server\n\t\t# started logging\n\t\t@errlog.seek( offset )\n\n\t\t# Set up a finalizer that will kill the child server/s if they are still\n\t\t# running.\n\t\tObjectSpace.define_finalizer( self ) {\n\t\t\tbegin\n\t\t\t\tProcess.kill( \"TERM\", @pid )\n\t\t\t\tProcess.wait\n\t\t\trescue SystemCallError\n\t\t\tend\n\t\t}\n\n\t\treturn @pid\n\tend",
"def start\n \n\tend",
"def start\n end",
"def start\n end",
"def start\n end"
] | [
"0.8170848",
"0.79551566",
"0.7647669",
"0.759407",
"0.7112839",
"0.7075482",
"0.7041341",
"0.7032578",
"0.6981403",
"0.69229776",
"0.68864155",
"0.6859371",
"0.67045236",
"0.668854",
"0.6649972",
"0.664344",
"0.6642851",
"0.65024316",
"0.65007013",
"0.6498543",
"0.6498041",
"0.64834124",
"0.64818597",
"0.6478563",
"0.6434174",
"0.6409951",
"0.6400626",
"0.6394146",
"0.63940364",
"0.6391257",
"0.63762563",
"0.63725215",
"0.63725215",
"0.6362754",
"0.6355251",
"0.6338722",
"0.63334703",
"0.63333005",
"0.6330141",
"0.632897",
"0.63242114",
"0.63221055",
"0.63174397",
"0.6312354",
"0.6308013",
"0.6286874",
"0.62616634",
"0.62485266",
"0.6247431",
"0.62047285",
"0.62029445",
"0.62026393",
"0.61994624",
"0.6186723",
"0.6183738",
"0.61816704",
"0.6180615",
"0.6158125",
"0.61249363",
"0.61215436",
"0.6104349",
"0.61040294",
"0.6098157",
"0.6097779",
"0.6088405",
"0.60798895",
"0.60795975",
"0.607943",
"0.60775036",
"0.60493666",
"0.6044466",
"0.60331506",
"0.6020786",
"0.6017269",
"0.6016826",
"0.60051477",
"0.6002812",
"0.599654",
"0.5995771",
"0.59926033",
"0.59913456",
"0.5988278",
"0.5987392",
"0.59773606",
"0.59773606",
"0.59773606",
"0.59773606",
"0.59773606",
"0.597479",
"0.597437",
"0.5973906",
"0.5969919",
"0.59599894",
"0.59561926",
"0.59552485",
"0.5954271",
"0.5944449",
"0.5940454",
"0.5929209",
"0.5929209",
"0.5929209"
] | 0.0 | -1 |
walks all files and converts them all to the new format | def transform_files!(files, type)
files.each do |file|
@file = file
@type = type
parsed = ""
@dirnames = Base.get_namespace(file,type) # directories after the app/type/ directory
namespaces = LANGUAGES.collect do |lang|
if type == 'views'
namespace = [lang] + @dirnames
else
namespace = [lang, type] + @dirnames
end
puts "Converting: " + file + " into namespace: "
puts namespace.map {|x| "[\"#{x}\"]"}.join("")
Namespace.new(namespace,lang)
end
contents = Base.get_file_as_string(file)
parsed << GettextI18nConvertor.string_to_i18n(contents, namespaces, type)
# write the app/type/file with new i18n format instead of gettext
File.open(file, 'w') { |file| file.write(parsed)}
namespaces.each do |ns|
new_file_handler(ns)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_files\n extract\n reorder_files\n transform @attendance_file, 'att' unless @attendance_file.blank?\n transform @enroll_file, 'enroll' unless @enroll_file.blank?\n transform @ili_file, 'ili' unless @ili_file.blank?\n end",
"def git_convert_all!\n Dir[\"#{@path}/**/*.erb\"].each do |file|\n haml_file = file.gsub(/\\.erb$/, '.haml')\n temp_file = file.gsub(/\\.erb$/, '.tmp')\n begin\n puts \"Copying #{file} to #{temp_file}\"\n File.copy_stream file, temp_file\n puts \"Renaming #{file} to #{haml_file}\"\n `git mv #{file} #{haml_file}`\n puts \"Converting #{File.basename(file)} to #{File.basename(haml_file)}\"\n `html2haml -rx #{temp_file} #{haml_file}`\n puts \"Removing #{temp_file}\"\n File.delete temp_file\n rescue\n File.rename(temp_file, file)\n File.delete(temp_file)\n end\n end\n end",
"def transform_files!(files, type) \n files.each do |file|\n parsed = \"\"\n namespace = [DEFAULT_LANGUAGE, 'txt', type] + Base.get_namespace(file, type)\n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n n = Namespace.new(namespace)\n \n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, n)\n \n #puts parsed\n # write the file\n \n File.open(file, 'w') { |file| file.write(parsed)}\n \n \n \n n.merge(@translations)\n end\n end",
"def scan_dir(from_dir, to_dir)\n Dir.foreach(from_dir) do |file|\n from_path = from_dir + File::SEPARATOR + file\n to_path = to_dir + File::SEPARATOR + file\n if file =~ /^\\./\n next\n elsif FileTest.directory?(from_path)\n scan_dir(from_path, to_path) \n elsif file =~ /\\.java$/\n File.makedirs(to_dir)\n output_file = to_path.sub(/\\.java$/, '.cs')\n print \"Translating #{from_path} to #{output_file}\\n\"\n transmogrify(from_path, output_file)\n else\n File.makedirs(to_dir)\n print \"Copying #{from_path} to #{to_path}\\n\"\n File.copy(from_path, to_path)\n end\n end\nend",
"def convert!\n puts \"Searching for ch*.html files from Atlas yeah\"\n Dir[\"ch*.html\"].each do |fn|\n out = html_to_ipynb(fn)\n # Compute the new filename, which is the original filename \n # with the \".html\" (last 5 chars) replaced with \".ipynb\". \n title_fn = self.string_to_filename(out['metadata']['name'])\n ipynb_fn = \"#{fn[0,fn.length-5]}_#{title_fn}.ipynb\"\n puts \"... Converting #{fn} to #{ipynb_fn}\"\n # Create the file\n f = File.open(ipynb_fn, 'w')\n f.write JSON.pretty_generate(out)\n f.close\n end\n puts \"Done!\"\n end",
"def execute!\n load_defaults unless @opts\n\n opts.s_files.each do |sname|\n Dir[sname].each { |fname| convert!(fname) }\n end\n end",
"def normalize!\n begin\n create_base_directories!\n\n # Ensure all files are properly formatted\n standardize!\n\n # normalize the files\n toc.normalize!\n guide.normalize!\n manifest.normalize!\n \n clean_empty_dirs!\n\n report\n\n rescue => ex\n log \"failed to normalize\\n #{ex.to_s}\"\n raise ex\n end\n end",
"def transform_pages(dir = '')\n base = File.join(self.source, dir)\n entries = Dir.entries(base)\n entries = entries.reject { |e| ['.', '_'].include?(e[0..0]) }\n \n entries.each do |f|\n if File.directory?(File.join(base, f))\n transform_pages(File.join(dir, f))\n else\n first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }\n \n if first3 == \"---\"\n page = Page.new(self.source, dir, f)\n page.add_layout(self.layouts, site_payload)\n page.write(self.dest)\n else\n FileUtils.mkdir_p(File.join(self.dest, dir))\n FileUtils.cp(File.join(self.source, dir, f), File.join(self.dest, dir, f))\n end\n end\n end\n end",
"def reformatFiles(theArgs)\n\n\t# Get the state we need\n\tpathConfig = getConfig(theArgs);\n\ttheFiles = getFiles( theArgs);\n\n\n\n\t# Reformat the files\n\ttheFiles.each do |theFile|\n\t\treformatFile(theArgs, theFile)\n\tend\n\t\n\tFileUtils.rm_rf(pathConfig);\n\nend",
"def rnformat\n\n\t# Get the state we need\n\tcheckTools();\n\t\n\ttheArgs = getArguments();\n\n\n\n\t# Reformat the files\n\treformatFiles(theArgs);\n\nend",
"def transform_pages(dir = '')\n base = File.join(self.source, dir)\n entries = Dir.entries(base)\n entries = entries.reject { |e| ['.', '_'].include?(e[0..0]) }\n\n entries.each do |f|\n if File.directory?(File.join(base, f))\n next if self.dest.sub(/\\/$/, '') == File.join(base, f)\n transform_pages(File.join(dir, f))\n else\n first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }\n \n # if the file appears to have a YAML header then process it as a page\n if first3 == \"---\"\n page = Page.new(self.source, dir, f)\n page.add_layout(self.layouts, site_payload)\n page.write(self.dest)\n # otherwise copy the file without transforming it\n else\n FileUtils.mkdir_p(File.join(self.dest, dir))\n FileUtils.cp(File.join(self.source, dir, f), File.join(self.dest, dir, f))\n end\n end\n end\n end",
"def transform_links_in_files files\n files.each do |filename|\n text = File.read filename\n content = transform_links_in_text text\n File.open(filename, \"w\") { |file| file << content }\n end\n end",
"def save\n all_files.each{ |file| parse_and_save(file) }\n end",
"def convert!\n merged_contents = []\n @files.each do |file|\n markup = Markup.new file, @remove_front_matter\n html = convert_image_urls markup.render, file.filename\n if @merge\n html = \"<div class=\\\"page-break\\\"></div>#{html}\" unless merged_contents.empty?\n merged_contents << html\n else\n output_pdf(html, file)\n end\n end\n\n unless merged_contents.empty?\n html = merged_contents.join\n output_pdf(html, nil)\n end\n end",
"def transform_and_import\n transform_files\n import\n end",
"def process_directory\n Dir.foreach(@source) do |f|\n next unless f.match(/[a-z]{2}[0-9]{3}[a-z]{2}[0-9]{4}\\.xml/)\n druid = get_druid_from_filename(f)\n mods_file = MODSFile.new(Nokogiri::XML(File.open(File.join(@source, f))), @template_xml, @namespace)\n process_mods_file(mods_file, druid)\n end\n write_output if @analysis_only == false\n report_data_loss\n end",
"def rename_files(format:)\n require 'pp'\n child_items.each_with_index do |child, index|\n new_name = sprintf(format, index+1)\n extname = child.path.extname\n dirname = child.path.dirname.to_s\n new_filename = dirname + \"/\" + new_name + extname\n FileManager.rename(from_file: child.path.to_s, to_file: new_filename)\n end\n end",
"def convert_files(file_paths)\n @ole.ConvertFiles(file_paths)\n end",
"def rearrange\n rootpath = \"#{$paths.restore_path}/Student_Records_D20130520/Student_Records\"\n Dir.entries(rootpath).each{|entry|\n if !entry.gsub(/\\.|rb/,\"\").empty?\n Dir.chdir(\"#{rootpath}/#{entry}/SY_2012-2013\")\n if !File.directory?(\"#{rootpath}/#{entry}/SY_2012-2013/Withdrawal\")\n Dir.mkdir(\"#{rootpath}/#{entry}/SY_2012-2013/Withdrawal\")\n end\n Dir.glob('WD_**') do |file|\n #puts File.expand_path(file)\n oldpath = File.expand_path(file)\n FileUtils.mv(\"#{oldpath}\",\"#{rootpath}/#{entry}/SY_2012-2013/Withdrawal\")\n end\n end\n }\n end",
"def transform(file, format:); end",
"def all_files\n parse!\n @all_files\n end",
"def convert\n puts \"\\n--------------------------------\"\n puts \"Transforming #{File.extname(@file)} file to .#{@type} format...\"\n \n runHardklor if @hardklor && @file.downcase.include?(\".mzxml\")\n \n if @type == \"mgf\" || @type == \"ms2\"\n Ms::Msrun.open(@file) do |ms|\n file = @file.chomp(File.extname(@file)) + \"_#{@run}.#{@type}\"\n File.open(file, 'w') do |f|\n f.puts eval(\"ms.to_#{@type}\")\n end\n end\n else\n # If ms-msrun can't do it, then this might. Do something here to include run number. Doesn't work with Refiner, so\n # this is probably pointless to even have.\n #\n # And why do we run our own code to transform mzML instead of TPP?\n # 1) Prince said so\n # 2) I hate the TPP. The people who put that together don't deserve to be called programmers. I mean, come on! Methods\n # should never be longer than 100 lines of code, yet they've got methods that are over 1000 lines of code! Ack! It\n # just makes my skin crawl!\n system(\"/usr/local/src/tpp-4.3.1/build/linux/MzXML2Search -#{@type} #{@file}\")\n end\n end",
"def execute\n settings = read_settings\n input, remove_regexp, output = get_in_out_removes(settings)\n create_output_dir(output)\n Dir.glob(input).each do |file|\n input_src = get_input(file)\n replaced = remove_head(input_src.encode('UTF-16BE', 'UTF-8', invalid: :replace, undef: :replace, replace: '?').encode('UTF-8'), remove_regexp)\n output_file(file, replaced, output)\n end\n end",
"def altered_files\n parse!\n @altered_files\n end",
"def transform_pages(dir = '', source = self.source)\n base = File.join(source, dir)\n entries = filter_entries(Dir.entries(base))\n directories = entries.select { |e| File.directory?(File.join(base, e)) }\n files = entries.reject { |e| File.directory?(File.join(base, e)) }\n\n [directories, files].each do |entries|\n # we need to make sure to process _posts *first* otherwise they \n # might not be available yet to other templates as {{ site.posts }}\n if entries.include?('_posts')\n entries.delete('_posts')\n read_posts(dir)\n end\n entries.each do |f|\n if File.symlink?(File.join(base, f))\n # preserve symlinks\n FileUtils.mkdir_p(File.join(self.dest, dir))\n File.symlink(File.readlink(File.join(base, f)),\n File.join(self.dest, dir, f))\n elsif File.directory?(File.join(base, f))\n next if self.dest.sub(/\\/$/, '') == File.join(base, f)\n transform_pages(File.join(dir, f), source)\n else\n first3 = File.open(File.join(source, dir, f)) { |fd| fd.read(3) }\n \n # if the file appears to have a YAML header then process it as a page\n if first3 == \"---\"\n # file appears to have a YAML header so process it as a page\n page = Page.new(source, dir, f)\n page.add_layout(self.layouts, site_payload)\n page.write(self.dest)\n else\n # otherwise copy the file without transforming it\n FileUtils.mkdir_p(File.join(self.dest, dir))\n FileUtils.cp(File.join(source, dir, f), File.join(self.dest, dir, f))\n end\n end\n end\n end\n end",
"def process_all_primary_files\n # NOTE: I investigated concurrent processing of files\n # to speed up this process, however I didn't pursue it\n # further: This process is highly CPU intensive, so the\n # only way to get a significant speedup is to use\n # multiple CPUs/Cores. In MRI this is only possible\n # with multiple processes. I didn't want to go through\n # the trouble of IPC to collect all files' operations.\n # It would be easier if we could use threads, however\n # that would require jruby or rbx. So I'm sticking with\n # sequential processing for now.\n Dir.glob(\n File.join(@repository.base_dir, '**/content/**/*.at')\n ).map { |absolute_file_path|\n next nil if !@file_list.any? { |e| absolute_file_path.index(e) }\n # Skip non content_at files\n unless absolute_file_path =~ /\\/content\\/.+\\d{4}\\.at\\z/\n raise \"shouldn't get here\"\n end\n\n # Note: @any_content_type may be the wrong one, however finding\n # corresponding STM CSV file will still work as it doesn't rely\n # on config but das regex replacements on file path only.\n content_at_file_to = Repositext::RFile::ContentAt.new(\n File.read(absolute_file_path),\n @language,\n absolute_file_path,\n @any_content_type\n )\n\n @logger.info(\" - process #{ content_at_file_to.repo_relative_path(true) }\")\n\n soff = SubtitleOperationsForFile.new(\n content_at_file_to,\n @repository.base_dir,\n {\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n prev_last_operation_id: @prev_last_operation_id,\n execution_context: @execution_context,\n }\n ).compute\n\n if soff.operations.any?\n @prev_last_operation_id = soff.last_operation_id\n soff\n else\n # Return nil if no subtitle operations exist for this file\n nil\n end\n }.compact\n end",
"def transform_pages(dir = '')\n base = File.join(self.source, dir)\n entries = Dir.entries(base)\n entries = entries.reject { |e| e[-1..-1] == '~' }\n entries = entries.reject do |e|\n (e != '_posts') and ['.', '_'].include?(e[0..0])\n end\n\n # we need to make sure to process _posts *first* otherwise they \n # might not be available yet to other templates as {{ site.posts }}\n if entries.include?('_posts')\n entries.delete('_posts')\n read_posts(dir)\n end\n\n entries.each do |f|\n if File.directory?(File.join(base, f))\n next if self.dest.sub(/\\/$/, '') == File.join(base, f)\n transform_pages(File.join(dir, f))\n else\n first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }\n\n if first3 == \"---\"\n # file appears to have a YAML header so process it as a page\n page = Page.new(self.source, dir, f)\n page.render(self.layouts, site_payload)\n page.write(self.dest)\n else\n # otherwise copy the file without transforming it\n FileUtils.mkdir_p(File.join(self.dest, dir))\n FileUtils.cp(File.join(self.source, dir, f), File.join(self.dest, dir, f))\n end\n end\n end\n end",
"def process_files files=[]\n files.each do |file|\n process_file file\n end\n end",
"def traverse path\n entries = Dir.glob(\"#{View.expand_path(path)}/*\", File::FNM_DOTMATCH).\n select {|i| i !~ /\\/\\.(\\.*|svn|git)$/}. # Exclude some dirs (exclude entensions here too?)\n sort\n\n # Process dirs\n entries.each{ |f|\n next unless File.directory?(f)\n cleaned = clean f\n @res += \"#{cleaned.sub(/(^ *)/, \"\\\\1- \")}/\\n\"\n traverse f\n }\n\n # Process files\n entries.each{ |f|\n next unless File.file?(f)\n cleaned = clean f\n @res += \"#{cleaned.sub(/(^ *)/, \"\\\\1+ \")}\\n\"\n }\n\n end",
"def getfiles path\n\nDir.foreach(path) do |f|\nname=File.basename f\npathn= @to_path + name\n\t\nfilepath =path +\"/\"+ f\n\nputs filepath\n if File.directory? filepath and name != '..' and name != '.' and name != 'new' \n\n Dir.chdir filepath\nstr = Dir.pwd\ngetfiles str\n\nDir.chdir('..')\nelsif File.file? f and name != 'app.rb' \n\tf1 = File.open(f, \"r:binary\")\nf2 = File.open(pathn, \"a:binary\")\n while (b = f1.getc)!= nil do\n \tf2.putc b\nend\n \nf2.close\n\n\nend\n\nend\nend",
"def each\n files.each do |f|\n content = File.read(path(f))\n content = compress(content) if @app.compress_bundles\n # Include a new line to prevent weirdness at file boundaries\n yield(\"#{content}\\n\")\n end\n end",
"def files_to_translate\n folders = [\n \"app\",\n \"lib\",\n \"config\",\n locale_path\n ].join(\",\")\n\n exts = [\n \"rb\",\n \"erb\",\n \"haml\",\n \"slim\",\n \"rhtml\",\n \"js\",\n \"jsx\",\n \"vue\",\n \"coffee\",\n \"handlebars\",\n \"hbs\",\n \"mustache\"\n ].join(\",\")\n\n Dir.glob(\n \"{#{folders}}/**/*.{#{exts}}\"\n )\n end",
"def reorder_files\n files = Dir.glob(File.join(@dir,\"*\"))\n files.each{|f|\n @enroll_file = f if f.downcase.index('enroll')\n @attendance_file = f if f.downcase.index('att')\n @ili_file = f if f.downcase.index('ili') || f.downcase.index('h1n1')\n }\n end",
"def get_files\n self.locales.each do |l|\n self.files[l] = Dir.glob(\"#{self.locale_dir}/*#{l}.#{self.source_format}\")\n\n next if l == self.default_locale\n\n self.files[self.default_locale].each do |original_file|\n locale_file = original_file.gsub(\"#{self.default_locale}.#{self.source_format}\", \"#{l}.#{self.source_format}\")\n\n next if self.files[l].include?(locale_file)\n\n create_locale_file(locale_file, original_file)\n\n self.files[l] << locale_file\n end\n end\n end",
"def transliterate_file_name\n\t\t\tfile_names = Array.new\n\t\t\t@attributes.keys.each { |a| file_names << a if a.match(/_file_name{1}$/) }\n\t\t\tfile_names.each do |local_file_name|\n\t\t\t\tif self.send(local_file_name).present? && self.send(local_file_name+'_changed?')\n\t\t\t\t\textension = File.extname(send(local_file_name)).gsub(/^\\.+/, '')\n\t\t\t\t\tfilename = send(local_file_name).gsub(/\\.#{extension}$/, '')\n\t\t\t\t\tself.send(local_file_name.gsub(/_file_name{1}$/, '')).instance_write(:file_name, \"#{transliterate(filename)}.#{transliterate(extension)}\")\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def change_file_names\n sorted_all_images_name.each do |f|\n File.rename(f, sterilize(f))\n end\n end",
"def transition_unified_files(file)\r\n\t\tfile.close\r\n\t\tbase_name, path_name, idx = File.basename(file.path, '.log'), File.dirname(file.path), 2\r\n\t\twhile(true)\r\n\t\t\tnew_filepath = path_name + \"/\" + base_name + \"_#{idx}.log\"\r\n\t\t\tif(!File.exists?(new_filepath))\r\n\t\t\t\tFileUtils.mv(file.path, new_filepath) # move our old file to an unused filename\r\n\t\t\t\tfile = File.open(path_name + \"/\" + base_name + \".log\", 'a+') # and re-open a new file with the same name as our old file\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t\tidx += 1\r\n\t\tend\r\n\t\tfile\r\n\tend",
"def convertAllUnits\n # Let the user know what we're doing\n puts \"Converting units.\"\n startTime = Time.now\n\n # Load allStruct and traverse it. This will create Unit and Unit_hier records for all units,\n # and delete any extraneous old ones.\n DB.transaction do\n allStructPath = \"/apps/eschol/erep/xtf/style/textIndexer/mapping/allStruct.xml\"\n open(allStructPath, \"r\") { |io|\n convertUnits(Nokogiri::XML(io, &:noblanks).root, {}, {}, Set.new)\n }\n end\nend",
"def update_files(&block)\n \n get_template_entries.each do |entry|\n \n next if entry.directory?\n \n entry.get_input_stream do |is|\n \n data = is.sysread\n \n if CONTENT_FILES.include?(entry.name)\n process_entry(data, &block)\n end\n \n @output_stream.put_next_entry(entry.name)\n @output_stream.write data\n \n end\n end\n end",
"def parse_files (path = '.', parent_id = 0)\n\n full_path = root_path().join(path)\n\n Dir.foreach(full_path) {|file_name|\n\n if file_name == '.' || file_name == '..'\n next\n end\n\n program_file = program_files.build()\n program_file.name = file_name\n program_file.path = Pathname.new(path).join(file_name).to_s\n program_file.parent_id = parent_id\n\n if File.ftype(full_path.join(file_name)) == 'directory'\n program_file.file_type = :dir\n program_file.save\n parse_files Pathname.new(path).join(file_name), program_file.id\n else\n program_file.file_type = :file\n program_file.save\n end\n }\n end",
"def convert_to_mp3\n\t\tputs \"\\n=> look for m4a files and convert it to mp3\\n\"\n\t\t\n\t\t# grab directory names.\n\t\tdir_names = Dir.entries @@dir_temp\n\t\t# remove .prefixes\n\t\tdir_names = self.remove_hidden_files dir_names\n\t\t\n\t\t# go thru each sub directories.\n\t\tdir_names.each do |current_dir|\n\t\t\tputs \"\\n=> at \" + @@dir_temp + current_dir + \"\\n\"\n\t\t\t\n\t\t\t# grabs the files in the directory\n\t\t\tcurrent_files = Dir.entries(@@dir_temp + \"/\" + current_dir)\n\t\t\t\n\t\t\t# remove the . prefixes.\n\t\t\tcurrent_files = self.remove_hidden_files current_files\n\t\t\t\n\t\t\t# cycle thru the file\n\t\t\tcurrent_files.each do |current_file|\n\t\t\t\t# file names\n\t\t\t\tsrc_file = \"\"\n\t\t\t\tdest_file = \"\"\n\t\t\t\n\t\t\t\t# checks if it has a m4a extension\n\t\t\t\tif self.is_m4a? current_file\t\t\n\t\t\t\t\tputs \"\\n=> encoding \" + current_file\n\t\t\t\t\t\n\t\t\t\t\t# creating src and dest files.\n\t\t\t\t\tsrc_file = @@dir_temp + current_dir + '/' + current_file\n\t\t\t\t\tdest_file = @@dir_temp + current_dir + '/' + self.ext_to_mp3(current_file)\n\t\t\t\t\t\n\t\t\t\t\t#src_file = \"'\" + src_file + \"'\" \n\t\t\t\t\t#dest_file = \"'\" + dest_file + \"'\" \n\t\t\t\t\t\n\t\t\t\t\t# escape the names.\n\t\t\t\t\tsrc_file = self.escaped_file_name(src_file)\n\t\t\t\t\tdest_file = self.escaped_file_name(dest_file)\n\t\t\t\t\t\n\t\t\t\t\tputs \"=> src \" + src_file \n\t\t\t\t\tputs \"=> dest \" + dest_file\n\t\t\t\t\t\n\t\t\t\t\t# lame encoding.\n\t\t\t\t\tself.lame_str(@@opt_lame, src_file, dest_file)\n\t\t\t\telse\n\t\t\t\t\tdest_file = @@dir_temp + current_dir + '/' + current_file\n\t\t\t\t\tdest_file = self.escaped_file_name(dest_file)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# split the mp3...\n\t\t\t\tself.mp3splt_str(@@opt_mp3splt, dest_file)\n\t\t\t\t\n\t\t\t\t# delete the source file.\n\t\t\t\t# only want the split files.\n\t\t\t\tself.rm_str(\"\", dest_file)\n\t\t\t\tif (src_file != \"\")\n\t\t\t\t\tself.rm_str(\"\", src_file)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def convert_files2(file_paths)\n @ole.ConvertFiles2(file_paths)\n end",
"def each_file(&bl)\n unpack do |dir|\n Pathname(dir).find do |path|\n next if path.to_s == dir.to_s\n pathstr = path.to_s.gsub(\"#{dir}/\", '')\n bl.call pathstr unless pathstr.blank?\n end\n end\n end",
"def each_file(&bl)\n unpack do |dir|\n Pathname.new(dir).find do |path|\n next if path.to_s == dir.to_s\n pathstr = path.to_s.gsub(\"#{dir}/\", '')\n bl.call pathstr unless pathstr.blank?\n end\n end\n end",
"def transform_pages(dir = '')\n base = File.join(self.source, dir)\n entries = filter_entries(Dir.entries(base))\n directories = entries.select { |e| File.directory?(File.join(base, e)) }\n files = entries.reject { |e| File.directory?(File.join(base, e)) }\n\n # we need to make sure to process _posts *first* otherwise they\n # might not be available yet to other templates as {{ site.posts }}\n if directories.include?('_posts')\n directories.delete('_posts')\n render_posts(dir)\n end\n [directories, files].each do |entries|\n entries.each do |f|\n if File.directory?(File.join(base, f))\n next if self.dest.sub(/\\/$/, '') == File.join(base, f)\n transform_pages(File.join(dir, f))\n else\n first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }\n\n if first3 == \"---\"\n # file appears to have a YAML header so process it as a page\n page = Page.new(self.source, dir, f)\n\n section = zone_section(dir)\n payload = site_payload.deep_merge({\"zonal\" => section[\"zonal\"]})\n\n page.render(self.layouts, payload)\n page.write(self.dest)\n else\n # otherwise copy the file without transforming it\n FileUtils.mkdir_p(File.join(self.dest, dir))\n FileUtils.cp(File.join(self.source, dir, f), File.join(self.dest, dir, f))\n end\n end\n end\n end\n end",
"def extract_all\n files.each do |file|\n extract file\n end\n end",
"def foreach\n find_files.each do |file|\n yield(@build_result_dir, file)\n end\n end",
"def convert\n # TODO: implementation\n output_file = choose_output\n return if output_file.nil?\n Converter.translate(@file, output_file)\n log(\"File conversion finished\")\n end",
"def process_dir( dir )\n #puts \"Scanning #{dir}\"\n Dir.foreach( dir ) do |entry|\n if entry.start_with?('.')\n next\n end\n path = \"#{dir}/#{entry}\"\n if Dir.exist?(path)\n process_dir(path)\n elsif entry.end_with?( '.rb' )\n process_file( path )\n end\n end\n end",
"def sort_files!; end",
"def regenerate_all_json\n courts = Dir.glob( File.join(File.dirname(__FILE__), 'courts', \"*.yaml\"))\n legislation = Dir.glob( File.join(File.dirname(__FILE__), 'legislation', \"*.yaml\"))\n regulation = Dir.glob( File.join(File.dirname(__FILE__), 'regulation', \"*.yaml\"))\n make_dirty_yamls_into_clean_jasons(courts)\n make_dirty_yamls_into_clean_jasons(legislation)\n make_dirty_yamls_into_clean_jasons(regulation)\n end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*.tex')))\n end",
"def rebuild_files\n @project.rebuild_files()\n end",
"def fix_asset_references\n asset_converter = Hash.new\n \n Dir.chdir(@docs_dir)\n file_list = Dir.glob(\"**/*.*\").reject {|fn| File.directory?(fn) }\n \n # generate the converter list\n file_list.each do |f|\n case File.extname(f)\n when \".js\"\n when \".css\"\n asset_converter[File.basename(f)] = f\n end\n end\n \n file_list.each do |f|\n absoluteFilePath = File.join(@plugin_directory, @docs_dir, f)\n \n if File.extname(f) == \".html\"\n doc = Nokogiri::HTML(File.open(absoluteFilePath))\n \n # remove javascript if desired\n if @strip_javascript\n doc.xpath(\"//script\").remove\n \n # when scraping this method wont be called\n # set to false for when we are not scraping so generate_structure can strip JS if needed\n @strip_javascript = false\n end\n \n # relink css\n doc.xpath(\"//link\").each do |link|\n originalLinkPath = File.basename(link[\"href\"])\n \n next if File.extname(originalLinkPath) != \".css\"\n next if not asset_converter.has_key? File.basename(originalLinkPath)\n \n # convert the link paths\n link[\"href\"] = (\"../\" * (f.count \"/\")) + asset_converter[File.basename(link[\"href\"])]\n end\n \n # relink images\n \n # write the converted file\n File.open(absoluteFilePath, \"w\") { |file| file.puts doc }\n end\n end\n end",
"def compile_files(files)\n files.each do |base_path|\n # We do this second glob in case the path provided in the tayfile\n # references a compiled version\n Dir[@base_dir.join('src', base_path + '*')].each do |path|\n path = Pathname.new(path).relative_path_from(@base_dir.join('src'))\n file_in_path = @base_dir.join('src', path)\n file_out_path = asset_output_filename(@output_dir.join(path), @sprockets.engines.keys)\n\n if @sprockets.extensions.include?(path.extname)\n content = @sprockets[file_in_path].to_s\n else\n content = File.read(file_in_path)\n end\n\n FileUtils.mkdir_p(file_out_path.dirname)\n File.open(file_out_path, 'w') do |f|\n f.write content\n end\n end\n end\n end",
"def files(rootDir)\n Dir.foreach(rootDir) do |dir|\n if dir != \".\" && dir != \"..\"\n puts \"Processing \" + dir\n Dir.foreach(rootDir + \"/\" + dir) do |file|\n if file != \".\" && file != \"..\"\n open(rootDir + \"/\" + dir + \"/\" + file) do |f|\n yield(f)\n end\n end\n end\n end\n end\nend",
"def tidy_up\n Dir[\"*nin\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nhr\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nsq\"].each do |file|\n File.delete(file)\n end\n Dir[\"*blast\"].each do |file|\n File.delete(file)\n end\n end",
"def walk(start)\n Dir.foreach(start) do |x|\n path = File.join(start, x)\n if x.match(/^(\\..*)$/)\n next\n elsif File.directory?(path)\n walk(path)\n else\n if m = x.match(/^([\\sA-Za-z\\-!',\\(\\)]*)\\s(\\d{2,3}).*\\.([A-Za-z0-9]*)$/)\n title = m[1]\n issue = m[2]\n ext = m[3]\n elsif\n title = x\n ext = File.extname(path)\n end\n size = File.size(path)\n path = path[7..-1] #cut off the \"public/\" part of the path\n if ext == \"cbr\" || ext == \"cbz\"\n title_id = Title.find_or_create_by!(name: title).id\n if !Comic.exists?(full_path: path)\n Comic.create(full_path: path, title_id: title_id, issue_number: issue, extension: ext, size: size)\n end\n end\n end\n end\nend",
"def copy_base_files\n\tbase_files = Dir[\"templates/Base/**/*\"].reject { |fn| \n\t\tFile.directory?(fn) \n\t}\n\n\tprint \"copying base base files .\"\n\n\tbase_files.each do |base_file|\n\t\tdestination = base_file.gsub(\"templates\", \"output\")\n\n\t\tcreate_folders_for_path destination\n\n\t\tFileUtils.cp(base_file, destination)\n\t\tprint \".\"\n\tend\n\tprint \"\\n\"\nend",
"def all_files; end",
"def all_files; end",
"def formatted_file_list(title, source_files); end",
"def process_other_source_files\n files = @options[:include_source_files].flatten\n files.each do |f|\n FileUtils.cp Dir[f], @working_dir\n end\n end",
"def convert_files_to_pdf(from_path, dest_path)\n #\n # Get access to all files to process (ensure we only work with <no>.[cover|document|code|image] etc...)\n #\n in_process_files = Dir.entries(from_path).select { | f | (f =~ /^\\d{3}\\.(cover|document|code|image)/) == 0 }\n if in_process_files.length < 1\n logger.error \"Cannot convert files to PDF: No files found in #{from_path}\"\n return nil\n end\n\n #\n # Map each process file to have extra info i.e.:\n #\n # file.idx = 0..n\n # file.path = actual file dir sitting in in_process directory\n # file.ext = file extension\n # file.type = cover/image/code/document\n # file.actualfile = actual file variable that can be used - File.open(path)\n #\n files = []\n in_process_files.each do | file |\n # file0.code.png\n idx = file.split('.').first.to_i\n type = file.split('.').second\n path = File.join(\"#{from_path}\", \"#{file}\")\n ext = File.extname(path).downcase\n actualfile = File.open(path)\n files << { :idx => idx, :type => type, :path => path, :ext => ext, :actualfile => actualfile }\n end\n\n # ensure the dest_path exists\n if not Dir.exists? dest_path\n FileUtils.mkdir_p(dest_path)\n end\n\n #\n # Begin processing...\n #\n pdf_paths = []\n files.each do | file |\n outpath = \"#{dest_path}/#{file[:idx]}.#{file[:type]}.pdf\"\n\n convert_to_pdf(file, outpath)\n\n pdf_paths[file[:idx]] = outpath\n begin\n file[:actualfile].close\n rescue\n end\n end\n\n pdf_paths\n end",
"def each\n files.each do |file|\n yield file\n end\n end",
"def characterize(save: true)\n [:original_file, :intermediate_file, :preservation_file].each do |type|\n target_file = @file_set.try(type)\n next unless target_file\n @file_object = Valkyrie::StorageAdapter.find_by(id: target_file.file_identifiers[0])\n new_file = target_file.new(file_characterization_attributes.to_h)\n @file_set.file_metadata = @file_set.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n end\n @file_set = persister.save(resource: @file_set) if save\n @file_set\n end",
"def parse_files\r\n ln_count = 0\r\n\r\n settings.file_order.each do |f|\r\n out = make_file(\"tmp.press\")\r\n\r\n ln_count += parse_lines(f, out)\r\n\r\n out.close\r\n tmp_files << out\r\n end\r\n\r\n ln_count\r\n end",
"def change_names(offset)\n puts \"Changing files...\"\n Dir.foreach('.') do |item|\n next if item == '.' or item == '..' or item == 'numberFix.rb'\n fullname = modify_item(item, offset)\n File.rename(item, fullname)\n end\n puts \"Done.\"\nend",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*').uniq.compact))\n end",
"def process_report(report)\n file_names = @dangerfile.git.modified_files.map { |file| File.expand_path(file) }\n file_names += @dangerfile.git.added_files.map { |file| File.expand_path(file) }\n report.targets.each do |target|\n target.files = target.files.select { |file| file_names.include?(file.location) }\n end\n\n report\n end",
"def each_file\n return unless block_given?\n\n loc_path = LokaliseRails.locales_path\n Dir[\"#{loc_path}/**/*\"].sort.each do |f|\n full_path = Pathname.new f\n\n next unless file_matches_criteria? full_path\n\n relative_path = full_path.relative_path_from Pathname.new(loc_path)\n\n yield full_path, relative_path\n end\n end",
"def each_file(markup)\n @files.each do |dest,file|\n if (formatted_like?(dest,markup) || !formatted?(dest))\n yield dest, file\n end\n end\n end",
"def process_files\n Dir[DATA_DIR + '/**/*.csv'].each do |file|\n process_file(file)\n end\n end",
"def scan!\n Dir.chdir(@path) do\n Find.find('.') do |file|\n next if file == '.'\n\n # ignore the ./\n file = file[2..-1]\n name = File.basename(file)\n\n # ignore certain files/directories\n Find.prune if IGNORE.include?(name)\n\n if File.directory?(file)\n @directories << file\n elsif File.file?(file)\n src = File.join(@path,file)\n\n case File.extname(name)\n when '.erb'\n # erb template\n if name.start_with?('_')\n # partial template\n template_dir = File.dirname(file)\n template_name = name[1..-1].chomp('.erb').to_sym\n\n @includes[template_dir][template_name] = src\n else\n dest = file.chomp('.erb')\n\n @templates[dest] = src\n end\n else\n # static file\n @files[file] = src\n end\n end\n end\n end\n end",
"def ingest(base_directory)\n Dir[\"#{base_directory}/*\"].sort.each do |entry|\n next unless File.directory?(entry)\n\n bib_id = File.basename(entry)\n\n ingest_directory(directory: entry, property_value: bib_id)\n end\n end",
"def convert_excel_to_csv\n\n Dir[\"data/#{@year}/*.xlsx\"].sort.each_with_index do |file_path, index|\n csv_filename = file_path.gsub('xlsx', 'csv')\n puts \"#{index+1}: #{file_path} > #{csv_filename}\"\n puts \"Converting to CSV...\"\n system(\"in2csv #{file_path} > #{csv_filename}\")\n puts\n end\n\nend",
"def walk(start)\n Dir.foreach(start) do |x|\n path = File.join(start, x)\n if x == \".\" or x == \"..\"\n next\n elsif File.directory?(path)\n walk(path)\n else\n if m = x.match(/^([\\sA-Za-z\\-!',\\(\\)]*)\\s(\\d{2,3}).*\\.([A-Za-z0-9]*)$/)\n title = m[1]\n issue = m[2]\n ext = m[3]\n elsif\n title = x\n ext = File.extname(path)\n end\n size = File.size(path)\n path = path[7..-1] #cut off the \"public/\" part of the path\n if ext == \"cbr\" || ext == \"cbz\"\n title_id = title_exist(title)\n if !Comic.exists?(full_path: path)\n Comic.create(full_path: path, title_id: title_id, issue_number: issue, extension: ext, size: size)\n end\n end\n end\n end\nend",
"def grouped(files); end",
"def convert!\n # Fonts and headings\n semanticize_font_styles!\n semanticize_headings!\n\n # Tables\n remove_paragraphs_from_tables!\n semanticize_table_headers!\n\n # list items\n remove_paragraphs_from_list_items!\n remove_unicode_bullets_from_list_items!\n remove_whitespace_from_list_items!\n remove_numbering_from_list_items!\n end",
"def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)",
"def process_images(dir)\n pattern = File.join(\"**\", dir, \"*.png\")\n files = Dir.glob(pattern)\n files.each do |f|\n unless f.include?(IMG_THUMB) || f.include?(IMG_FINAL)\n puts \"Converting image #{f}\"\n f2 = f.gsub /.png/, ''\n # thumbs\n system \"convert #{f} -resize #{IMG_THUMB_SIZE}^ -extent #{IMG_THUMB_SIZE} #{f2}#{IMG_THUMB}.png\" unless File.exists?(\"#{f2}#{IMG_THUMB}.png\")\n # final\n system \"convert #{f} -resize #{IMG_SIZE} #{f2}#{IMG_FINAL}.png\" unless File.exists?(\"#{f2}#{IMG_FINAL}.png\") \n end\n end\nend",
"def edit_matched_files(*match, &block)\n match.each do |m|\n if Pathname.new(m).absolute?\n path = m\n else\n path = File.join(File.expand_path(TARGET_PATH), m)\n end\n puts \"path: #{path}\"\n\n Dir.glob(path).each do |file|\n block.call(Content.create(file))\n end\n end\nend",
"def merge_files(files, to, &blk)\n File.moves_to_merge(files, to).each do |move|\n continue = true\n continue = yield(move) if block_given?\n break unless continue\n mv_p move[:from], move[:to]\n end\n end",
"def enrich_with_attributes(dir_list, path)\n rich_dir_list = []\n dir_list.each do |element|\n file_path = path + '/' + element\n filename, extension = split_to_filename_and_extension element\n file_size = File.size file_path\n file_time = File.stat(file_path).mtime\n rich_dir_list << { :original_name => element, \n :filename => filename,\n :extension => extension,\n :type => file_type(file_path),\n :size => file_size,\n :file_time => file_time,\n :timestamp => file_time.to_i\n }\n end\n rich_dir_list\n end",
"def parse_files(files_a)\n\t\tfiles_a.each do |file_p|\n\t\t\tparse_file(file_p) do |cons|\n\t\t\t\tyield(cons)\n\t\t\tend\n\t\tend\n\tend",
"def analyze_text\n reset_analyzed\n @renames = {}\n @names = {}\n\n Dir.chdir(@dir) do\n if Dir.glob('*').length == 0\n @errors.add(:structure, \"No files found in directory: '#{@dir}'.\")\n return\n end\n end\n\n Dir.foreach(@dir) do |f|\n next if (f == '.' || f == '..')\n\n @errors.add(:structure, \"error: found a subdirectory. cannot process.\") if File.directory?(f)\n\n i = Nyudl::Text::Filename.new(f, @prefix, @options)\n\n @errors.add(:unrecognized, \"#{File.join(@dir,i.fname)}\") unless i.recognized?\n\n # only add to hash if rename is required\n @renames[i.newname] = i if i.rename?\n @names[i.newname] = i\n end\n set_analyzed\n end",
"def single_ucf_file_lists\n File.open(single_bad_ucf_file, 'a') do |mergedfile|\n Dir.glob(\"#{output_directory_path}*name.txt\").each do |file|\n File.foreach(file) do |line|\n mergedfile.write(line)\n end\n end\n end\n end",
"def convert\n \n # People might forget the trailing slash\n @options[:output_dir] = @options[:output_dir] + \"/\" unless @options[:output_dir].end_with?(\"/\")\n \n # Make sure that the output directory exits\n if !File.directory? @options[:output_dir] \n $LOG.info(\"Creating output directory #{@options[:output_dir]}...\")\n Dir.mkdir(@options[:output_dir])\n end\n \n # Array for storing ESE file pointers\n source_ese_files = []\n \n # If source ESE files are provided in batch mode (in a text file) ...\n unless @options[:batch_file] == nil\n # .. read the file line by line and extract the file location\n File.open(@options[:batch_file], \"r\") do |batch_file| \n # each line should point to a file path\n while path = batch_file.gets\n source_ese_files << path.chomp\n end\n end\n else\n # .. just take the source files provided on the command line\n source_ese_files = @files2convert\n end\n\n $LOG.info(\"Converting #{source_ese_files.size} ESE XML files to EDM RDF/XML...\")\n \n converted_files = []\n # Convert each ESE file individually\n source_ese_files.each do |source_file|\n \n unless File.exists?(source_file)\n $LOG.error(\"Cannot access source file #{source_file}. Exiting conversion process.\")\n return\n end\n \n # convert the file\n converted_file = transform(source_file, @options[:stylesheet], @options[:output_dir], @options[:base_uri], @options[:pretty_print])\n converted_files << converted_file\n \n end\n \n $LOG.info(\"*** Finished RDF/XML conversion *** Transformed #{source_ese_files.size} ESE XML files to EDM RDF/XML.\")\n \n # create an N-Triples dump if requested so\n if @options[:dump]\n \n $LOG.info(\"Merging created RDF/XML files into N-TRIPLES dump file: #{@options[:nt_dump_file]} ...\")\n \n create_NT_dump(converted_files, @options[:output_dir], @options[:nt_dump_file])\n \n $LOG.info(\"*** Finished N-TRIPLES dumping *** Dumped #{source_ese_files.size} RDF/XML files into #{@options[:nt_dump_file]}\")\n \n end\n \n end",
"def parse_in_order(*files); end",
"def rename_all(pattern, replace)\n Dir.new('.').each do |f|\n File.rename(f, f.gsub(pattern, replace)) if f.match(pattern)\n end\nend",
"def each\n changeset.each { |file| yield file }\n end",
"def glob_to_directory(glob); end",
"def sweep(mode=:test)\n unmapped = []\n # For each file in the folder @folder\n Dir.foreach @folder do |file|\n FileUtils.cd @folder\n h = [:patterns, :types, :unhandled]\n\n # If we are indeed looking at a file and not a directory\n if File.file?(file)\n handled = false\n h.each do |key|\n unless handled\n match = @handlers[key].is_match? file\n\n if match\n puts \"Match for #{file} -> #{match.destination}\"\n handled = true\n @handlers[key].process match, mode\n end\n end\n end\n\n #unless handle_pattern_match file\n # unless handle_extension_match file\n # handle_no_match file\n # end\n #end\n\n #ext = File.extname(file).downcase\n #ext.slice!(0)\n #if m.key?(ext)\n ##Check to make sure that m.value folder exists\n ##if not, create it\n #target_dir = @folder + \"/\" + m[ext]\n #puts \"Moving #{file} to #{target_dir}\"\n\n ##Move the file into the folder\n #FileUtils.mkdir_p(target_dir) unless Dir.exists?(target_dir)\n #FileUtils.move(file, \"#{target_dir}/#{file}\")\n #else\n #unmapped.push file\n #end\n end\n end\n\n @handlers[:unhandled].output\n\n end",
"def process!\n process_previews! if self.class.preview?\n\n versions.each do |name, blk|\n path = File.join(@dir, \"#{name}_#{@filename}\")\n process_version!(path, &blk)\n @paths << path\n end\n\n @paths\n end",
"def update_migration_files\n migration_templates = Dir.children(File.join(TEMPLATES, 'migrations')).sort\n migration_templates.each do |template_file|\n destination_file = template_file.match(/^\\d*_(.*\\.rb)/)[1] # 01_create_good_jobs.rb.erb => create_good_jobs.rb\n migration_template \"migrations/#{template_file}\", File.join(db_migrate_path, destination_file), skip: true\n end\n end",
"def processDir( dirPath )\n return if not File.directory?( dirPath )\n\n puts File.basename( dirPath ) + \"/\"\n\n Dir.foreach( dirPath ) do | content |\n next if content == \".\" or content == \"..\"\n\n contentPath = dirPath + \"/\" + content\n next if File.symlink?( contentPath )\n\n if File.directory?( contentPath )\n processDir contentPath\n elsif File.file?( contentPath )\n fork do\n flacFile = FlacFile.new contentPath\n flacFile.normalize\n end\n end\n end\n\n Process.waitall\nend",
"def parse_files(*files); end",
"def run_through_directory\n@file_array = []\n Dir.foreach('text_files') do |item|\n next if item == '.' or item == '..'\n @file_array << item\n end\nend",
"def convert(tableread)\n\ttableread[0].each do |filename|\n\t\t#puts filename\n\t\ttext = File.open(filename).read\n\t\ttext = text.gsub(\"<\", \"<\").gsub(\">\", \">\")\n\t\t#convert code to html\n\t\ttextlines = text.split(/\\r*\\n/)\n\t\tcounter = 1\n\t\ttext = \"<html><head><meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=utf-8\\\"/></head>\\n<body><pre>\"\n\t\ttextlines.each do |line|\n\t\t\tline = \"<a name=\\\"\"+counter.to_s+\"\\\">\"+line+\"</a>\\n\"\n\t\t\ttext += line\n\t\t\tcounter = counter + 1\n\t\tend\n\t\ttext = text + \"</pre></body></html>\"\n\t\t#modify text based on dump (may need to reorder it)\n\t\ttableread[1].each do |var|\n\t\t\t#puts var[0]+\" \"+var[1]+\" \"+var[2].to_s+\" \"+var[3].to_s\n\t\t\tif var.last == -2 or var.last == 1\n\t\t\t\t#Need to change this to allow multi-files\n\t\t\t\tappearances = text.split(/(?<=\\n)/)\n\t\t\t\ttext = \"\"\n\t\t\t\tappearances.each do |temp|\n\t\t\t\t\tif not temp.include? (\">\"+var[0])\n\t\t\t\t\t\tif not temp.include? \"<a name=\\\"\"+var[2].to_s+\"\\\">\" or filename != var[1]\n\t\t\t\t\t\t\tif temp =~ (temp.scan '\\W'+var[0]+'\\W')\n\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a href=\\\"\"+var[1].gsub(/\\./,\"_\")+\".html\"+\"#\"+var[2].to_s+\"\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a name=\\\"searched\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t#text = text.gsub(var[0],\"<a href=\\\"\"+var[1]+\"#\"+var[2].to_s+\"\\\">\"+var[0]+\"</a>\")\n\t\t\telsif var.last == -1\n\t\t\t\tif var[1] == filename.split(/\\//).last\n\t\t\t\t\tprocessed = false\n\t\t\t\t\tbalance = 0\n\t\t\t\t\tcounter = 0\n\t\t\t\t\tsplitter = text.split(Regexp.new \"(?=<a name=\\\"\"+var[2].to_s+\"\\\">)\")\n\t\t\t\t\ttext = splitter.first\n\t\t\t\t\ttemptext = splitter.last\n\t\t\t\t\tskipping = false\n\t\t\t\t\twhile processed == false or balance != 0\n\t\t\t\t\t\tcounter = counter + 1\n\t\t\t\t\t\tif temptext[counter] == '\"'\n\t\t\t\t\t\t\tif skipping == true\n\t\t\t\t\t\t\t\tskipping = false\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tskipping = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif temptext[counter] == '{' and skipping == false\n\t\t\t\t\t\t\tprocessed = true\n\t\t\t\t\t\t\tbalance = balance + 1\n\t\t\t\t\t\telsif temptext[counter] == '}' and skipping == false\n\t\t\t\t\t\t\tprocessed = true\n\t\t\t\t\t\t\tbalance = balance - 1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tusefultext = temptext[0..counter]\n\t\t\t\t\t\n\t\t\t\t\tappearances = usefultext.split(/(?<=\\n)/)\n\t\t\t\t\tappearances.each do |temp|\n\t\t\t\t\t\tif not temp.include? (\">\"+var[0])\n\t\t\t\t\t\t\tif not temp.include? \"<a name=\\\"\"+var[2].to_s+\"\\\">\"\n\t\t\t\t\t\t\t\tif temp =~ (Regexp.new '\\W'+var[0]+'\\W',true)\n\t\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a href=\\\"\"+var[1].gsub(/\\./,\"_\")+\".html\"+\"#\"+var[2].to_s+\"\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a name=\\\"searched\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\ttext = text + temptext[counter+1..-1]\n\t\t\t\tend\n\t\t\telsif var.last == -5\n\t\t\t\tif var[1] == filename.split(/\\//).last\n\t\t\t\t\tappearances = text.split(Regexp.new \"(?<=\"+var[0]+\")\")\n\t\t\t\t\ttext = \"\"\n\t\t\t\t\tappearances.each do |temp|\n\t\t\t\t\t\tif not temp.include? (\">\"+var[0])\n\t\t\t\t\t\t\tif not temp.include? \"<a name=\\\"\"+var[2].to_s+\"\\\">\"\n\t\t\t\t\t\t\t\tif temp =~ (Regexp.new '\\W'+var[0]+'\\W',true)\n\t\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a href=\\\"\"+var[1].gsub(/\\./,\"_\")+\".html\"+\"#\"+var[2].to_s+\"\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a name=\\\"searched\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t#puts \"Local: \"+ appearances\n\t\t\telse\n\t\t\t\tif var[1] == filename.split(/\\//).last\n\t\t\t\t\tprocessed = false\n\t\t\t\t\tbalance = 0\n\t\t\t\t\tcounter = 0\n\t\t\t\t\tsplitter = text.split(Regexp.new \"(?=<a name=\\\"\"+var[2].to_s+\"\\\">)\")\n\t\t\t\t\ttext = splitter.first\n\t\t\t\t\ttemptext = splitter.last\n\t\t\t\t\tskipping = false\n\t\t\t\t\twhile processed == false or balance != -1\n\t\t\t\t\t\tcounter = counter + 1\n\t\t\t\t\t\tif temptext[counter] == '\"'\n\t\t\t\t\t\t\tif skipping == true\n\t\t\t\t\t\t\t\tskipping = false\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tskipping = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif temptext[counter] == '{' and skipping == false\n\t\t\t\t\t\t\tprocessed = true\n\t\t\t\t\t\t\tbalance = balance + 1\n\t\t\t\t\t\telsif temptext[counter] == '}' and skipping == false\n\t\t\t\t\t\t\tprocessed = true\n\t\t\t\t\t\t\tbalance = balance - 1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tusefultext = temptext[0..counter]\n\t\t\t\t\t\n\t\t\t\t\t#appearances = usefultext.split(Regexp.new \"(?<=\"+var[0]+\")\")\n\t\t\t\t\tappearances = usefultext.split(/(?<=\\n)/)\n\t\t\t\t\tappearances.each do |temp|\n\t\t\t\t\t\tif not temp.include? (\">\"+var[0])\n\t\t\t\t\t\t\tif not temp.include? \"<a name=\\\"\"+var[2].to_s+\"\\\">\"\n\t\t\t\t\t\t\t\tif temp =~ (Regexp.new '\\W'+var[0]+'\\W',true)\n\t\t\t\t\t\t\t\t\ttemp = temp.gsub((Regexp.new '(?<=\\W'+var[0]+'\\W)'),\"<a href=\\\"\"+var[1].gsub(/\\./,\"_\")+\".html\"+\"#\"+var[2].to_s+\"\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a name=\\\"searched\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\ttext = text + temptext[counter+1..-1]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#htmlParse(text)\n\n\t\t#print text\n\t\t#text = text.gsub(/\\r*\\n/, \"<br>\\n\")\n\t\t#puts text\n\t\tFile.open(filename.gsub(/\\./,\"_\")+\".html\", \"w\") do |out|\n\t\t\tout.write(text)\n\t\t\t#out.write(replaceGT)\n\t\tend\n\tend\nend",
"def process_files(manifest, file_list, options = {})\n file_list.each do |file|\n if(File.directory?(file_root(file)))\n manifest.directory(file)\n else\n manifest.file(talia_root(file), file, options)\n end\n end\n end"
] | [
"0.67649734",
"0.6670742",
"0.6469586",
"0.633741",
"0.62945455",
"0.6190535",
"0.61411077",
"0.6111291",
"0.6109648",
"0.60937256",
"0.60236865",
"0.6023474",
"0.598543",
"0.5969204",
"0.5932392",
"0.593233",
"0.5889535",
"0.5884787",
"0.5871994",
"0.58075887",
"0.5750295",
"0.57502544",
"0.5746188",
"0.57377565",
"0.5726986",
"0.57229424",
"0.5721555",
"0.57124156",
"0.56855255",
"0.5684141",
"0.5669393",
"0.566497",
"0.56499547",
"0.56036043",
"0.55669266",
"0.5557033",
"0.55565447",
"0.5540673",
"0.5533792",
"0.55089635",
"0.5504659",
"0.54881245",
"0.5480333",
"0.5476197",
"0.5476191",
"0.54720354",
"0.54700536",
"0.54664075",
"0.54610115",
"0.54522043",
"0.5444882",
"0.5429448",
"0.54264003",
"0.54157025",
"0.5386528",
"0.5386255",
"0.5370056",
"0.5350289",
"0.5336486",
"0.5323196",
"0.5323196",
"0.53218037",
"0.5317291",
"0.53064835",
"0.53047407",
"0.5301036",
"0.52903384",
"0.5281174",
"0.5280803",
"0.52765274",
"0.52663827",
"0.5260356",
"0.52602977",
"0.52470076",
"0.524172",
"0.52403224",
"0.52399516",
"0.5232837",
"0.52293754",
"0.5226917",
"0.5225787",
"0.52257174",
"0.52230006",
"0.5211931",
"0.5211742",
"0.52068996",
"0.51944214",
"0.5191023",
"0.51879954",
"0.5186453",
"0.51796913",
"0.51754785",
"0.51741683",
"0.5173645",
"0.5167549",
"0.5160269",
"0.5151735",
"0.5147053",
"0.51453364",
"0.5140861"
] | 0.69372356 | 0 |
directory will be created in config/locales/type/ in dump_yaml! | def create_filepath(language)
@dirpath = File.join(LOCALE_DIR + @type + '/' + @dirnames.first)
File.join(@dirpath + '/' + language + '.yml')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end",
"def create_local\n template \"config/locales/en.rb\", \"config/locales/#{class_name.underscore}.en.yml\"\n end",
"def file_dumps\r\n Dir.new(translation_base).entries.select{|x| x['.yml']}\r\n end",
"def save_config_file(locale, key)\n locale_config = {}\n locale_config[locale] = {}\n unless @config[key].nil?\n locale_config[locale][key] = @config[key]\n path = \"config/locales/org/#{key}/#{locale}.yml\"\n File.delete(path) if File.exist?(path)\n TTY::File.create_file(path, locale_config.to_yaml)\n end\nend",
"def write_locale(directory, file, strings, plurals, locale, date); end",
"def output_config_for_locale(locale)\n save_config_file(locale, \"config\")\n save_config_file(locale, \"faq\")\n save_config_file(locale, \"form\")\nend",
"def yml_path language\n Rails.root.join('config', 'locales', \"#{language}.yml\")\nend",
"def create_locale_files\n @i18n_scope = model.i18n_scope.to_s\n @i18n_key = model.model_name.i18n_key.to_s\n @columns = model.column_names\n\n options[:locales].each do |locale|\n @locale = locale\n locale_file = File.join(\n 'config/locales/models', model_name.underscore, \"#{@locale}.yml\"\n )\n template 'locale.yml', locale_file\n end\n rescue NameError\n puts \"#{model_name} is undefined.\"\n end",
"def type_directory\n Pathname.new(puppet_lib) + 'type'\n end",
"def dump_yaml!(filepath,translations)\n return if translations.blank?\n FileUtils.mkdir_p(@dirpath) unless File.exists?(@dirpath)\n File.open(filepath, 'w+') { |f| YAML::dump(translations, f) } \n end",
"def dump\n files = Dir[Rails.root.join(\"config\", \"locales\", \"*.yml\").to_s]\n delete_all unless Interpret.soft\n\n records = []\n files.each do |f|\n ar = YAML.load_file f\n locale = ar.keys.first\n records += parse_hash(ar.first[1], locale)\n end\n\n # TODO: Replace with activerecord-import bulk inserts\n transaction do\n records.each {|x| x.save(:validate => false)}\n end\n end",
"def create_yml_file_for_locale_mission(main_language, id, title, instructions)\n File.open(yml_path(main_language), 'w+') do |file|\n write_locale_file_headers(file, main_language)\n write_mission_to_locale(file, id, instructions, title)\n end\nend",
"def write!\n Dir.mkdir @directory unless File.directory? @directory\n\n @locales.each_with_index do |locale, index|\n strings = @strings[locale]\n plurals = @plurals[locale]\n\n l_directory = locale_directory locale, index.zero?\n\n file = @table.to_s.empty? ? @adapter.default_file_name : @table\n\n date = DateTime.now\n\n Dir.mkdir l_directory unless File.directory? l_directory\n\n @adapter.write_locale(l_directory,\n file,\n strings,\n plurals,\n locale,\n date)\n end\n end",
"def metas_path(locale)\n # TODO: Let user configure it.\n Rails.root.join('config', 'metaslug', \"#{locale}.yml\")\n end",
"def po_dir; end",
"def write\n self.mounting_point.content_types.each do |filename, content_type|\n self.output_resource_op content_type\n\n self.open_file(\"app/content_types/#{filename}.yml\") do |file|\n file.write(content_type.to_yaml)\n end\n\n self.output_resource_op_status content_type\n end\n end",
"def generate_locale_files\n enforce = I18n.enforce_available_locales\n I18n.enforce_available_locales = false\n\n locales.each do |locale|\n I18n.with_locale(locale) do\n template 'locale.yml', File.join(\"config\", \"locales\", \"#{file_name}.#{locale.to_s}.yml\")\n end\n end\n\n I18n.enforce_available_locales = enforce\n end",
"def po_dir=(dir); end",
"def create_base_yml_file_without_missions(main_language)\n File.open(yml_path(main_language), 'w+') do |file|\n write_locale_file_headers(file, main_language)\n file.write((' ' * 4) + \"hello: \\\"Hello world!\\\"\\n\")\n end\nend",
"def root_dir\n File.join(self.runner.path, 'app', 'content_types')\n end",
"def testlocale\n check_path = 'config/locales/'\n locale_list = %w(vi en ja)\n\n @missing_files = []\n @missing_keys = []\n # begin checking if all the necessary locale files exist\n folders = Dir.glob(\"#{check_path}**/*/\").push(check_path)\n for folder in folders do\n key_list = []\n for locale in locale_list do\n file = \"#{folder}#{locale}.yml\"\n if File.exist?(file)\n thing = YAML.load_file(file)\n key_list.push(flatten_keys(thing[locale]))\n else\n @missing_files.push(file)\n end\n end\n key_list.each_with_index do |key1,k1|\n for key2 in key_list do\n missing = key2 - key1\n if missing.any?\n missing.each { |key| @missing_keys.push(\"Missing #{key} in #{folder}#{locale_list[k1]}.yml\") }\n end\n\n end\n end\n end\n\n end",
"def locale_file_path(locale)\n \"config/locales/#{locale}.yml\"\n end",
"def yml_directory\n @data_magic_yml_directory ||= 'config'\n end",
"def create_file_config\n # template \"config/express_translate.yml\", \"config/express_translate.yml\"\n end",
"def save!\n FileUtils.mkdir_p File.dirname(self.file)\n\n File.open(self.file, \"w+\") do |f|\n f << %(#{self.namespace}.translations || (#{self.namespace}.translations = {});\\n)\n self.translations.each do |locale, translations_for_locale|\n f << %(#{self.namespace}.translations[\"#{locale}\"] = #{translations_for_locale.to_json};\\n);\n end\n end\n end",
"def to_yaml_type \n YAML_TYPE\n end",
"def directory(_mapped_locale, _is_default)\n ''\n end",
"def export\n keys = {}\n reset\n db_localizations = {}\n Lit::Localization.find_each do |l|\n db_localizations[l.full_key] = l.get_value\n end\n db_localizations.sort.each do |(l_key, value)|\n current = keys\n yaml_keys = l_key.split('.')\n\n 0.upto(yaml_keys.size - 2) do |i|\n key = yaml_keys[i]\n # Overwrite en.key with en.sub.key\n unless current[key].class == Hash\n current[key] = {}\n end\n current = current[key]\n end\n current[yaml_keys.last] = value\n end\n keys.to_yaml\n end",
"def generate_yaml(locale_name, translations)\n yaml = YamlDocument.new(\"config/locales/translation_#{locale_name}.yml\", locale_name)\n each_value [], translations do |parents, value|\n node = parents.inject(yaml[locale_name]) {|node, parent| node[parent]}\n node.value = value\n end\n yaml\n end",
"def object_dir(plural = true)\n dirname = new_resource.declared_type.to_s.gsub(/^sensu_/, '')\n if plural\n ::File.join(new_resource.config_home, dirname) + 's'\n else\n ::File.join(new_resource.config_home, dirname)\n end\n end",
"def type_attribute_directory\n Pathname.new(puppet_lib) + 'type' + @name\n end",
"def type_path\n type_directory + \"#{@name}.rb\"\n end",
"def rails_localization_files\n loc_files = Dir[File.join( RAILS_ROOT, '/vendor/plugins/globalite/lang/rails/', '*.{yml,yaml}')]\n end",
"def object_dir\n ::File.join(new_resource.config_home, type_from_name) + 's'\n end",
"def yaml_path\n \"#{user_directory}/.yolo/config.yml\"\n end",
"def i18n\n %w(en es).each do |locale|\n copy_file \"i18n.#{ locale }.yml\", \"config/locales/seo_landing_pages.#{ locale }.yml\"\n end\n end",
"def store(dir,resume)\n if File.exists?(dir)\n rm(Dir.glob(\"#{dir}/*.yaml\"))\n else\n mkdir(dir)\n end\n File.open(\"#{dir}/resume.yaml\",'w') { |out| YAML::dump(resume.core,out) }\n dump(dir,\"experience\",resume.experience)\n dump(dir,\"education\",resume.education)\n dump(dir,\"reference\",resume.references)\n dump(dir,\"samples\",resume.samples)\n File.open(\"#{dir}/skills.yaml\",'w') { |out| YAML::dump(resume.skills,out) }\n end",
"def dir_for(type) Merb.load_paths[type].first end",
"def destination(lang)\n output_path.mkpath\n\n path = output_path.join(\"#{lang}.json\")\n path.open(\"w\") do |f|\n f.write yield\n end\n\n puts \"Created #{path}\"\n end",
"def dir\n Rails.root.join(ROOT, type, name).to_s\n end",
"def file_extension\n \"yml\"\n end",
"def format_local_yaml()\n prev = nil\n index_to_add = Array.new\n n = 0\n ifile = File.open( \"local.yaml\" )\n local_data = ifile.readlines\n ifile.close\n local_data.each_with_index { |line, index|\n if(index == 0)\n next\n end\n if(line =~ /^type:/)\n if not(prev =~ /---/)\n index_to_add.push(index+n)\n n=n+1\n end\n end\n prev = line\n }\n index_to_add.each { |i|\n local_data.insert(i, '---')\n }\n File.open(\"local.yaml\", \"w+\") do |f|\n f.puts(local_data)\n end\nend",
"def create_config_file\n template 'mongoid.yml', File.join('config', 'mongoid.yml')\n end",
"def application_mode_file_path locale = locale\n File.join(Translate::Storage.root_dir, \"config\", \"locales\", \"#{locale}.yml\")\n end",
"def store_dir\n \"text/\"\n end",
"def yaml_save(packages)\n FileUtils.mkdir_p(File.dirname(yaml_file))\n File.open(yaml_file, \"w\") do |file|\n file.write(packages.to_yaml)\n end\n end",
"def dumpConfig(type=:manifests, manOut=nil, tmpOut=nil, binOut=nil, instvar=true)\n\t\t\tif (type == :manifests) or ( type == :all )\n\t\t\t\t@manifests.each do |name,manifest|\n\t\t\t\t\tmanifest.dump()\n\t\t\t\t\tif tmpOut != nil\n\t\t\t\t\t\tmanifest.genTemplate(tmpOut,instvar)\n\t\t\t\t\tend\n\t\t\t\t\tif manOut != nil\n\t\t\t\t\t\tmanifest.genManifest(manOut)\n\t\t\t\t\tend\n\t\t\t\t\tif binOut != nil\n\t\t\t\t\t\tmanifest.genBinary(binOut)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif ( type == :objects ) or ( type == :all )\n\t\t\t\t@objects.each do |name,manifest|\n\t\t\t\t\tmanifest.dump()\n\t\t\t\t\tif name.start_with?(\"traffic_managers_\")\n\t\t\t\t\t\tnext;\n\t\t\t\t\tend\n\t\t\t\t\tif tmpOut != nil\n\t\t\t\t\t\tmanifest.genTemplate(tmpOut,instvar)\n\t\t\t\t\tend\n\t\t\t\t\tif manOut != nil\n\t\t\t\t\t\tmanifest.genManifest(manOut, true)\n\t\t\t\t\tend\n\t\t\t\t\tif binOut != nil\n\t\t\t\t\t\tmanifest.genBinary(binOut)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def locale_files\n Dir[File.join(File.dirname(__FILE__), \"polish\", \"locale\", \"**/*\")]\n end",
"def locale_files\n Dir[File.join(File.dirname(__FILE__), \"polish\", \"locale\", \"**/*\")]\n end",
"def yaml_file?; end",
"def define_path\n raise GetMeSubsError.new(\"Settings for this OS aren't supported.\") if @os != :windows\n @path = (\n case @os\n when :windows\n ENV['APPDATA'] + \"/GetMeSubs/settings.yaml\"\n end\n )\n FileUtils.mkdir_p(File.dirname(@path))\n end",
"def process_locale(locale)\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(\"#{locale}_tmp\")\n\n # Remove temporary directory if it exists\n FileUtils.rm_rf output_dir\n\n # Output results to temporary directory\n Dir[templ_dir.join('**/*.yml')].each do |f|\n process_file(\n Pathname.new(f).relative_path_from(templ_dir), # Filename\n locale, # Locale\n \"#{locale}_tmp\" # Output locale \n )\n end\n\n # Override the locales folder\n FileUtils.rm_rf local_dir\n FileUtils.mv output_dir, local_dir\n end",
"def generate_yaml(data, locale_name, model_name, model_keys)\n # fill missing fields\n a = (data[locale_name] ||= {})\n a = b = (a[\"activerecord\"] ||= {})\n\n a = (a[\"models\"] ||= {})\n a[model_name] ||= model_name.camelize\n #a = (a[model_name] ||= {})\n #a[\"one\"] ||= model_name.camelize\n #a[\"other\"] ||= model_name.camelize.pluralize\n\n b = (b[\"attributes\"] ||= {})\n b = (b[model_name] ||= {})\n\n # c_key => key\n model_keys.each do |key|\n key.sub!(/^(._)?/, \"\")\n b[key] ||= key.humanize\n end\n\n data.ya2yaml\nend",
"def dir_for(type)\n Merb.load_paths[type].first\n end",
"def load_objects(dir_name, kind, klass)\n all_split_files_in(dir_name).map do |base_filename, (meta_ext, content_ext, locales)|\n I18n.locale = I18n.default_locale # Set current locale to default\n\n # Get filenames\n meta_filename = filename_for(base_filename, meta_ext)\n content_filename = filename_for(base_filename, content_ext)\n\n # is binary content?\n is_binary = !!(content_filename && !@site.config[:text_extensions].include?(File.extname(content_filename)[1..-1]))\n\n # Read content and metadata\n meta, content_or_filename = parse(content_filename, meta_filename, kind, (is_binary && klass == Nanoc::Item))\n\n # Is locale content?\n # - excluded content with locale meta IS a locale content\n # - excluded content without locale meta IS NOT locale content\n # - included content with or without locale meta IS locale content\n # - included content with locale meta set to `false` IS NOT locale\n # content\n is_locale = !!(meta['locale'] || (meta['locale'] != false && locale_content?(content_filename || meta_filename, kind)))\n\n # Create one item by locale, if content don't need a localized version,\n # use default locale\n (is_locale ? I18n.available_locales : [I18n.default_locale]).map do |locale|\n I18n.locale = locale # Set current locale\n\n # Process for localized files\n if is_locale\n # Get filenames for localized content\n meta_filename = filename_for(base_filename, meta_ext)\n content_filename = filename_for(base_filename, content_ext)\n\n # Read content and metadata for localized content\n meta, content_or_filename = parse(content_filename, meta_filename, kind, (is_binary && klass == Nanoc::Item))\n\n # merge meta for current locale, default locale meta used by\n # default is meta don't have key\n meta_locale = meta.delete('locale') {|el| Hash.new }\n meta = (meta_locale[I18n.default_locale] || Hash.new).merge(meta)\n meta.merge!(meta_locale[locale.to_s] || Hash.new)\n end\n\n # Get attributes\n attributes = {\n :filename => content_filename,\n :content_filename => content_filename,\n :meta_filename => meta_filename,\n :extension => content_filename ? ext_of(content_filename)[1..-1] : nil,\n :locale => locale,\n # WARNING :file is deprecated; please create a File object manually\n # using the :content_filename or :meta_filename attributes.\n # TODO [in nanoc 4.0] remove me\n :file => content_filename ? Nanoc::Extra::FileProxy.new(content_filename) : nil\n }.merge(meta)\n\n # Get identifier\n if meta_filename\n identifier = identifier_for_filename(meta_filename[(dir_name.length+1)..-1])\n elsif content_filename\n identifier = identifier_for_filename(content_filename[(dir_name.length+1)..-1])\n else\n raise RuntimeError, \"meta_filename and content_filename are both nil\"\n end\n # Prepend locale code to identifier if content is localized\n identifier = \"/#{locale}#{identifier}\" if is_locale\n\n # Get modification times\n meta_mtime = meta_filename ? File.stat(meta_filename).mtime : nil\n content_mtime = content_filename ? File.stat(content_filename).mtime : nil\n if meta_mtime && content_mtime\n mtime = meta_mtime > content_mtime ? meta_mtime : content_mtime\n elsif meta_mtime\n mtime = meta_mtime\n elsif content_mtime\n mtime = content_mtime\n else\n raise RuntimeError, \"meta_mtime and content_mtime are both nil\"\n end\n\n # Create layout object\n klass.new(\n content_or_filename, attributes, identifier,\n :binary => is_binary, :mtime => mtime\n )\n end\n end.flatten # elements is an array with all locale item, flatten in to one items list\n end",
"def yaml_files\n file_list('{,puppet/}{,hiera}data/**/*.{yaml,eyaml}') +\n file_list('config/**/*.yml')\n end",
"def create_yaml_templates_dir(templates_yaml_source, templates_yaml_destination)\n log(\"Creating #{templates_yaml_destination}\")\n remote_directory templates_yaml_destination do\n source templates_yaml_source # files/default/templates_yaml\n files_owner node['jmxtrans']['user']\n files_group node['jmxtrans']['user']\n files_mode \"0755\"\n owner node['jmxtrans']['user']\n group node['jmxtrans']['user']\n mode \"0755\"\n purge true\n action :nothing\n # because we need all the templates on disk for\n # rendering, we force this to happen at compile time\n end.run_action(:create)\nend",
"def initialize(path, path_type = :full)\n super()\n @ext_name = :yml\n @path_type = path_type\n @path = path\n end",
"def save(dir = \".\")\n File.open(File.join(dir, \"#{name}.yaml\"), 'w') do |f|\n f.print YAML.dump(self)\n end\n end",
"def load_config\n create_yolo_dir\n unless File.exist?(yaml_path)\n @formatter.config_created(yaml_path)\n FileUtils.cp_r(File.dirname(__FILE__) + \"/config.yml\", yaml_path)\n end\n end",
"def yaml_parts_in_saving_order\n lang_file_dirs_by_parts = ActiveSupport::OrderedHash.new\n @yaml_parts.each do |lang_file_dir, parts_in_this_dir|\n parts_in_this_dir.each do |part|\n lang_file_dirs_by_parts[part] = (lang_file_dirs_by_parts[part] || []) << lang_file_dir\n end\n end\n \n ordered_yaml_parts = []\n lang_file_dirs_by_parts.keys.sort_by{|key| key.split('.').size}.reverse.each do |part|\n lang_file_dirs_by_parts[part].reverse.each do |lang_file_dir|\n ordered_yaml_parts << File.join(lang_file_dir, part)\n end\n end\n \n ordered_yaml_parts\n end",
"def store_to_dir dir\n begin\n \n Dir.mkdir(dir) unless File.exists?(dir)\n instance_variables.each{|var|\n #a chatinfokat nem tároljuk le, mert jó ha lekérdezi új üzenetkor\n\n next unless var =~ /_ids/\n\n i = 0\n str = <<-EOT\n File.open(File.join(dir,\\\"#{var.gsub('@','').gsub('_id','')}.yml\\\"),'w'){|f| \n #{var}.each{|id| \n f.write(Hash[id.to_s.to_sym,get_obj('#{var.gsub('@','').gsub('_ids','')}',id.to_s)].to_yaml)}}\nEOT\n try( str )\n try(\"puts \\\"Cache stored #{var.gsub('_id','')}: \\#{#{var}.length} instances to disk.\\\"\")}\n \n rescue Exception => e\n puts e.message\n puts \"Backtrace:\"\n e.backtrace.each {|line| puts line }\n end\n end",
"def transform_files!(files, type) \n files.each do |file|\n @file = file\n @type = type\n parsed = \"\"\n @dirnames = Base.get_namespace(file,type) # directories after the app/type/ directory\n \n namespaces = LANGUAGES.collect do |lang|\n if type == 'views'\n namespace = [lang] + @dirnames\n else\n namespace = [lang, type] + @dirnames\n end\n \n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n Namespace.new(namespace,lang)\n end\n\n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, namespaces, type)\n \n # write the app/type/file with new i18n format instead of gettext\n File.open(file, 'w') { |file| file.write(parsed)}\n \n namespaces.each do |ns|\n new_file_handler(ns)\n end\n end\n end",
"def dir_path(locale, category, section = nil, article = nil)\n # each resource has an id and name attribute\n # let's use this to build a path where we can store the actual data\n log(\" buidling dir_path for #{[locale, category, section, article].compact.map{|r| r['name']}}\", :verbose)\n [locale, category, section, article].compact.inject(\"./\") do |dir_path, resource|\n # check if we have existing folder that needs to be renamed\n path_to_append = output_type == :slugified ? \"#{resource['id']}-#{slugify(resource['name'])}\" : \"#{resource['id']}\"\n rename_dir_or_file_starting_with_id!(dir_path, resource['id'], path_to_append)\n # build path and check if folder exists\n log(\" #{path_to_append} appended to #{dir_path}\", :verbose)\n dir_path += path_to_append + \"/\"\n Dir.mkdir(dir_path) unless File.exists?(dir_path)\n # end point is begin point of next iteration\n dir_path\n end\n end",
"def data_path name\n File.join File.dirname(__FILE__), 'data', \"#{ name }.yml\"\nend",
"def write_yaml(stations)\n log(' - Writing YAML...', false)\n File.open(YAML_PATH.to_s, 'w') { |file| file.write(stations.to_yaml) }\n log('DONE')\nend",
"def process_file(filename, locale, output_locale)\n\n def assemble(templ, local)\n # If already assembling the string\n return local unless templ.is_a?(Hash)\n\n # If templ is a hash but local is nil, it means that the entire current \n # branch is not yet translated. Therefore create an empty hash to act as\n # placeholder\n local = {} if local.nil?\n\n # Recursing to traverse hash\n pairs = templ.collect { |k, v| [k, assemble(v, local[k])] }\n Hash[pairs]\n end\n\n def validate(node, path)\n if node.nil?\n puts \"Warning: path #{path} is nil. \"\n return\n end\n\n return unless node.is_a?(Hash)\n\n node.each { |k, v| validate(v, \"#{path}.#{k}\") }\n end\n\n puts \"Processing file #{filename} of locale #{locale}. \"\n\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(output_locale)\n\n # Loading template\n templ_file = templ_dir.join(filename)\n templ = YAML::load_file(templ_file)['template']\n\n # If the topmost level of the template is not 'template'\n if !templ\n puts \"Warning: Template is nil for #{filename}. Aborting for this file. \"\n return\n end\n\n # Loading localized YAML\n local_file = local_dir.join(filename)\n local = File.exists?(local_file) ? YAML::load_file(local_file)[locale] : {}\n\n # Alert for new file creation\n puts \"Warning: Creating new file #{filename} of locale #{locale}. \" unless File.exists?(local_file)\n\n # Assemble localized strings into template file\n assembled = assemble(templ, local)\n\n # Validate to find missed translations\n validate(assembled, locale)\n\n # Output to file\n output_file = output_dir.join(filename)\n FileUtils.mkdir_p output_file.dirname\n content = {locale => assembled}.to_yaml\n File.open(output_file, 'w') { |f| f.write(content) }\n\n end",
"def load_metas_for_locale(locale)\n path = metas_path(locale)\n if File.exists?(path)\n YAML.load(File.open(path))\n else\n logger.error \"[Metaslug] #{path} not found.\"\n {}\n end\n end",
"def configure(allow_suffix=true)\n [:'config-dir', :'spool-dir'].each {|dir| mkdir($config[dir]) }\n %w(CONFIG RECIPIENTS MESSAGES).each {|file| mkyml(file, allow_suffix) }\n 0\n end",
"def configure_i18n\n I18n.load_path += Dir[self.class.root_pathname.join('config', 'locales', '*.{rb,yml}')]\n end",
"def yml_directory=(value)\n @data_magic_yml_directory = value\n end",
"def set_post_dir_and_yaml_cat(dir)\n # Written like this to deal with category being nil\n if @category and Dir.exists?(File.join(@category, dir)) then\n @post_dir = File.join(@category, dir)\n @yaml_cat = nil\n else\n @post_dir = dir\n @yaml_cat = @category ? \"category: #{@category}\\n\" : nil\n end\n end",
"def ui_localization_files\n loc_files = Dir[File.join(RAILS_ROOT, 'lang/ui/', '*.{yml,yaml}')]\n unless @@localization_sources.empty?\n @@localization_sources.each do |path|\n loc_files += Dir[File.join(path, '*.{yml,yaml}')]\n end\n end\n loc_files\n end",
"def initialize(path, path_type = :full)\n super()\n @ext_name = :yml\n @path_type = path_type\n @original_path = path\n @relative_save_file_path = PathnameManager.new(path, path_type).relative_save_file_path\n end",
"def store_loot(ltype, ctype, host, data, filename=nil, info=nil, service=nil)\n if ! ::File.directory?(Msf::Config.loot_directory)\n FileUtils.mkdir_p(Msf::Config.loot_directory)\n end\n\n ext = 'bin'\n if filename\n parts = filename.to_s.split('.')\n if parts.length > 1 and parts[-1].length < 4\n ext = parts[-1]\n end\n end\n\n case ctype\n when /^text\\/[\\w\\.]+$/\n ext = \"txt\"\n end\n # This method is available even if there is no database, don't bother checking\n host = Msf::Util::Host.normalize_host(host)\n\n ws = (db ? myworkspace.name[0,16] : 'default')\n name =\n Time.now.strftime(\"%Y%m%d%H%M%S\") + \"_\" + ws + \"_\" +\n (host || 'unknown') + '_' + ltype[0,16] + '_' +\n Rex::Text.rand_text_numeric(6) + '.' + ext\n\n name.gsub!(/[^a-z0-9\\.\\_]+/i, '')\n\n path = File.join(Msf::Config.loot_directory, name)\n full_path = ::File.expand_path(path)\n File.open(full_path, \"wb\") do |fd|\n fd.write(data)\n end\n\n if (db)\n # If we have a database we need to store it with all the available\n # metadata.\n conf = {}\n conf[:host] = host if host\n conf[:type] = ltype\n conf[:content_type] = ctype\n conf[:path] = full_path\n conf[:workspace] = myworkspace\n conf[:name] = filename if filename\n conf[:info] = info if info\n conf[:data] = data if data\n\n if service and service.kind_of?(::Mdm::Service)\n conf[:service] = service if service\n end\n\n framework.db.report_loot(conf)\n end\n\n return full_path.dup\n end",
"def copy_yml\n template \"config/regulate.yml\", \"config/regulate.yml\"\n end",
"def save( directory )\n File.open( \"parsed_data/#{directory}.yaml\", 'w' ) do |f|\n f.write( @pages.to_yaml )\n end\n end",
"def generate_from_templates\r\n %w{package.json _config.yml}.each do |file|\r\n template file\r\n end\r\n end",
"def make_new_category_file(category)\n base_yaml = {}\n base_yaml['websites'] = nil\n write_yaml(category, base_yaml) \\\n unless File.exist?(File.join(base_dir, \"_data/#{category}.yml\"))\n end",
"def to_yaml_type\n \"!hobix.com,2004/weblog\"\n end",
"def write_to_file keys\n init_translations_and_ignore_app_mode_file_dump if self.class.mode == :origin\n # Hash to capture the files updated on origin mode and the keys for each one\n result = {}\n keys.each do |key, value|\n #\n # Search the files where the translation will be applied to\n decide_filenames(key).each do |filename| \n (result[filename] ||= []) << key\n # Apply the current translation to the filenames\n #\n # It will save a key 'ubiquo.categories.index.title' with a value 'Title'\n # mergin the content of $filename with it\n #\n # Load the file\n hash = YAML.load_file(filename)\n # Morph the translation key\n # from: 'ubiquo.categories.index.title'\n # to: { :ubiquo => {\n # :categories => {\n # :index => {\n # :title => 'Title'\n # }\n # }\n # }\n # }\n # }\n branch_hash = Translate::Keys.to_deep_hash({key => value})\n #\n # Cast all the hash keys to String\n #\n branch_hash = Translate::File.deep_stringify_keys({self.locale => branch_hash})\n #\n # Merge the translation with the content of the file\n #\n #\n hash.deep_merge!(branch_hash)\n #\n # Save to file updated to disk\n Translate::File.new(filename).write(hash)\n end \n end\n result\n end",
"def store_dir\n \"#{model.class.to_s.underscore}\"\n end",
"def fixtures_route_dir(kind, epoch)\n ::File.join(\n @fixtures_dir,\n epoch.to_s,\n @route_data[:subdir],\n kind.to_s)\n end",
"def create_default_template_file\n unless self.description.redirection_required?\n self.localizations.each do |page_localization|\n file_path = File.join(Rails.root, \"app\", \"views\" , \"pages\" , \"#{self.view}.#{page_localization.locale.slug}.html.haml\" )\n unless File.exists?(file_path)\n file = File.new(file_path, \"w\")\n\n page_localization.contents.each do |content|\n file.puts(\"= @page.easy_contents(:#{content.section_name})\")\n end\n file.close\n end\n end\n end\n end",
"def to_yaml_type\n \"!fuzz.io,2011/Chunk\"\n end",
"def yml_directory\n return @yml_directory if @yml_directory\n return default_directory if self.respond_to? :default_directory\n nil\n end",
"def save\n if !Dir.exists? @config_directory\n FileUtils.mkdir_p @config_directory\n end\n\n open(@file, 'w').write @main.to_yaml\n end",
"def write_localization_file\n render_template(resource_path('localization-en-us.wxl.erb'),\n destination: \"#{staging_dir}/localization-en-us.wxl\",\n variables: {\n name: project.package_name,\n friendly_name: project.friendly_name,\n maintainer: project.maintainer,\n }\n )\n end",
"def get_sentence_ending_words_list_path\n case Rails.env\n when 'production'\n \"lib/dictionaries/sentence_ending_words.yml\".freeze # in Dokku app directory\n when 'development'\n \"#{Rails.root.to_s}/lib/dictionaries/sentence_ending_words.yml\".freeze\n when 'test'\n \"#{Rails.root.to_s}/lib/dictionaries/sentence_ending_words.test.yml\".freeze\n end\n end",
"def list\n Dir.glob(\"#{App.config.resource_directory}/*.yaml\").each do |res|\n puts File.basename(res, '.yaml')\n end\n end",
"def file_type; 'directory' end",
"def write\n self.each_locale do |locale|\n self.output_locale\n\n self.snippets.values.each { |snippet| self.write_snippet(snippet) }\n end\n end",
"def load_library(path)\n data = YAML.load_file(path)\n # maps the data to their proper language despcriptions\n data.map do |key, value|\n data[key] = { english: value[0], japanese: value[1] }\n end\n data\nend",
"def reset_locale language\n if language.nil? or language.empty?\n return\n end\n create_base_yml_file_without_missions(language) unless File.exists?(yml_path(language))\n\n I18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]\n I18n.locale = language\nend",
"def filename\n \"#{RAILS_ROOT}/tmp/gnip_status.yml\"\n end",
"def default_directories\n [Texas.contents_subdir_name, \"lib/\", Texas.texas_dir]\n end",
"def to_yaml( opts={} )\n\t\trequire 'yaml'\n\t\tYAML.quick_emit( self.object_id, opts ) {|out|\n\t\t\tout.seq( self.class.to_yaml_type ){|seq|\n\t\t\t\tseq.add( self.dirs )\n\t\t\t}\n\t\t}\n\tend",
"def load_library(file)\n emoticon = YAML.load_file('./lib/emoticons.yml')\ncontainer = {}\n emoticon.each do |meaning,emoticon|\n container[meaning] = {}\n container[meaning][:english] = emoticon[0]\n container[meaning][:japanese] = emoticon[1]\n end\n container\nend",
"def run\n locales.each do |locale|\n # checking that all files / keys exist for any non.default locale\n self.files[locale].each do |file|\n build_hash(file)\n create_csv(file, locale)\n end\n end\n end",
"def store_dir\n \"listings\"\n end"
] | [
"0.69399136",
"0.6430094",
"0.62637156",
"0.61745507",
"0.605668",
"0.6015132",
"0.600937",
"0.5980962",
"0.5938675",
"0.5921478",
"0.5842158",
"0.5831651",
"0.5827498",
"0.58187544",
"0.58163184",
"0.58013827",
"0.574444",
"0.5665773",
"0.56035733",
"0.55927724",
"0.5578496",
"0.55675274",
"0.5529748",
"0.55258006",
"0.55147153",
"0.54825836",
"0.548012",
"0.5478843",
"0.54701525",
"0.5446629",
"0.5438119",
"0.5429245",
"0.5415329",
"0.5401312",
"0.539879",
"0.5386069",
"0.5340283",
"0.53341955",
"0.5333734",
"0.53325933",
"0.5315324",
"0.5308955",
"0.53001493",
"0.52941775",
"0.52767396",
"0.527537",
"0.52647746",
"0.5260655",
"0.5260655",
"0.5251691",
"0.52496624",
"0.5220096",
"0.5220073",
"0.5165591",
"0.51552576",
"0.51535636",
"0.51441056",
"0.5143658",
"0.5140583",
"0.5137825",
"0.5120912",
"0.5117583",
"0.51034874",
"0.50993294",
"0.5097665",
"0.5076399",
"0.5067956",
"0.50675386",
"0.50669307",
"0.50565183",
"0.5048834",
"0.50436896",
"0.5028479",
"0.5022085",
"0.5019114",
"0.50183874",
"0.5012118",
"0.50070965",
"0.5005581",
"0.50011826",
"0.49976596",
"0.49828783",
"0.49693143",
"0.4949646",
"0.49481502",
"0.494558",
"0.49383947",
"0.4935491",
"0.4935194",
"0.49267855",
"0.49264237",
"0.4918123",
"0.4910642",
"0.49086148",
"0.4896587",
"0.48949233",
"0.48879445",
"0.4880608",
"0.4878588",
"0.48749253"
] | 0.6269849 | 2 |
dumps the translation strings into yml files | def dump_yaml!(filepath,translations)
return if translations.blank?
FileUtils.mkdir_p(@dirpath) unless File.exists?(@dirpath)
File.open(filepath, 'w+') { |f| YAML::dump(translations, f) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end",
"def save!\n FileUtils.mkdir_p File.dirname(self.file)\n\n File.open(self.file, \"w+\") do |f|\n f << %(#{self.namespace}.translations || (#{self.namespace}.translations = {});\\n)\n self.translations.each do |locale, translations_for_locale|\n f << %(#{self.namespace}.translations[\"#{locale}\"] = #{translations_for_locale.to_json};\\n);\n end\n end\n end",
"def file_dumps\r\n Dir.new(translation_base).entries.select{|x| x['.yml']}\r\n end",
"def dump\n files = Dir[Rails.root.join(\"config\", \"locales\", \"*.yml\").to_s]\n delete_all unless Interpret.soft\n\n records = []\n files.each do |f|\n ar = YAML.load_file f\n locale = ar.keys.first\n records += parse_hash(ar.first[1], locale)\n end\n\n # TODO: Replace with activerecord-import bulk inserts\n transaction do\n records.each {|x| x.save(:validate => false)}\n end\n end",
"def generate_yaml(locale_name, translations)\n yaml = YamlDocument.new(\"config/locales/translation_#{locale_name}.yml\", locale_name)\n each_value [], translations do |parents, value|\n node = parents.inject(yaml[locale_name]) {|node, parent| node[parent]}\n node.value = value\n end\n yaml\n end",
"def create_file_config\n # template \"config/express_translate.yml\", \"config/express_translate.yml\"\n end",
"def serialize\n margaret_file = File.open(\"messages.yaml\", \"a+\")\n margaret_file.puts YAML::dump(@string_margaret)\n end",
"def write_to_file keys\n init_translations_and_ignore_app_mode_file_dump if self.class.mode == :origin\n # Hash to capture the files updated on origin mode and the keys for each one\n result = {}\n keys.each do |key, value|\n #\n # Search the files where the translation will be applied to\n decide_filenames(key).each do |filename| \n (result[filename] ||= []) << key\n # Apply the current translation to the filenames\n #\n # It will save a key 'ubiquo.categories.index.title' with a value 'Title'\n # mergin the content of $filename with it\n #\n # Load the file\n hash = YAML.load_file(filename)\n # Morph the translation key\n # from: 'ubiquo.categories.index.title'\n # to: { :ubiquo => {\n # :categories => {\n # :index => {\n # :title => 'Title'\n # }\n # }\n # }\n # }\n # }\n branch_hash = Translate::Keys.to_deep_hash({key => value})\n #\n # Cast all the hash keys to String\n #\n branch_hash = Translate::File.deep_stringify_keys({self.locale => branch_hash})\n #\n # Merge the translation with the content of the file\n #\n #\n hash.deep_merge!(branch_hash)\n #\n # Save to file updated to disk\n Translate::File.new(filename).write(hash)\n end \n end\n result\n end",
"def create_local\n template \"config/locales/en.rb\", \"config/locales/#{class_name.underscore}.en.yml\"\n end",
"def write_locale(directory, file, strings, plurals, locale, date); end",
"def output_config_for_locale(locale)\n save_config_file(locale, \"config\")\n save_config_file(locale, \"faq\")\n save_config_file(locale, \"form\")\nend",
"def save filename\n File.open(filename, 'w') { |file| @translated.each {|value| file.write(\"#{value}\") } } \n end",
"def create_yml_file_for_locale_mission(main_language, id, title, instructions)\n File.open(yml_path(main_language), 'w+') do |file|\n write_locale_file_headers(file, main_language)\n write_mission_to_locale(file, id, instructions, title)\n end\nend",
"def save_config_file(locale, key)\n locale_config = {}\n locale_config[locale] = {}\n unless @config[key].nil?\n locale_config[locale][key] = @config[key]\n path = \"config/locales/org/#{key}/#{locale}.yml\"\n File.delete(path) if File.exist?(path)\n TTY::File.create_file(path, locale_config.to_yaml)\n end\nend",
"def i18n\n %w(en es).each do |locale|\n copy_file \"i18n.#{ locale }.yml\", \"config/locales/seo_landing_pages.#{ locale }.yml\"\n end\n end",
"def copy_yml\n template \"config/regulate.yml\", \"config/regulate.yml\"\n end",
"def create_base_yml_file_without_missions(main_language)\n File.open(yml_path(main_language), 'w+') do |file|\n write_locale_file_headers(file, main_language)\n file.write((' ' * 4) + \"hello: \\\"Hello world!\\\"\\n\")\n end\nend",
"def init_translations_and_ignore_app_mode_file_dump\n # Get the current yaml file list sorted\n files = (I18n.load_path + Dir.glob(File.join(\"config\", \"locales\", \"**\",\"*.{rb,yml}\"))).uniq.sort\n # Avoid application mode file paths\n files -= I18n.available_locales.map{|l| application_mode_file_path(l)}\n files -= I18n.available_locales.map{|l| File.join(\"config\", \"locales\", \"#{l}.yml\")}\n # Load the new translation file list\n I18n.load_path = files\n # Reset I18n to track the updated file list\n I18n.reload!\n I18n.backend.send(:init_translations)\n end",
"def write_localization_file\n render_template(resource_path('localization-en-us.wxl.erb'),\n destination: \"#{staging_dir}/localization-en-us.wxl\",\n variables: {\n name: project.package_name,\n friendly_name: project.friendly_name,\n maintainer: project.maintainer,\n }\n )\n end",
"def generate\n I18n.backend.load_translations\n translations = wrap(source_translations)\n I18n.backend.store_translations(destination_locale, translations)\n I18n.available_locales += [destination_locale]\n end",
"def setup_mass_copy_translations\n end",
"def generate_locale_files\n enforce = I18n.enforce_available_locales\n I18n.enforce_available_locales = false\n\n locales.each do |locale|\n I18n.with_locale(locale) do\n template 'locale.yml', File.join(\"config\", \"locales\", \"#{file_name}.#{locale.to_s}.yml\")\n end\n end\n\n I18n.enforce_available_locales = enforce\n end",
"def export(data, indent=0)\n target = data[@translate.lang]\n xml = <<EOF\n<?xml version=\"1.0\" encoding=\"#{@translate.options[:encoding]}\"?>\n<!DOCTYPE TS>\n<TS version=\"2.0\" language=\"#{@translate.lang}\">\nEOF\n\n keys = I18n::Translate.hash_to_keys(target).sort\n keys.each do |key|\n value = @translate.find(key, target)\n next unless value\n\n if value.kind_of?(String) || value.kind_of?(Array) || value.kind_of?(Integer)\n fuzzy = (value.to_s.empty?) ? %~ type=\"unfinished\"~ : \"\"\n xml += <<EOF\n <context>\n <name>#{::CGI.escapeHTML(key)}</name>\n <message>\n <source>#{::CGI.escapeHTML(@translate.find(key, @translate.default).to_s)}</source>\n <translation#{fuzzy}>#{::CGI.escapeHTML(value.to_s)}</translation>\n </message>\n </context>\nEOF\n else\n fuzzy = ((value[\"flag\"] == \"ok\") or value[\"flag\"].to_s.strip.empty?) ? \"\" : (value[\"flag\"] == \"obsolete\") ? %~ type=\"obsolete\"~ : %~ type=\"unfinished\"~\n xml += <<EOF\n <context>\n <name>#{::CGI.escapeHTML(key)}</name>\n <message>\nEOF\n if value[\"file\"] or value[\"line\"]\n xml += <<EOF\n <location filename=\"#{::CGI.escapeHTML(value[\"file\"].to_s)}\" line=\"#{::CGI.escapeHTML(value[\"line\"].to_s)}\" />\nEOF\n end\n xml += <<EOF\n <source>#{::CGI.escapeHTML(value[\"default\"].to_s)}</source>\nEOF\n unless value[\"old_default\"].to_s.empty?\n xml += <<EOF\n <oldsource>#{::CGI.escapeHTML(value[\"old_default\"].to_s)}</oldsource>\nEOF\n end\n unless value[\"extracted_comment\"].to_s.empty?\n xml += <<EOF\n <extracomment>#{::CGI.escapeHTML(value[\"extracted_comment\"].to_s)}</extracomment>\nEOF\n end\n unless value[\"comment\"].to_s.empty?\n xml += <<EOF\n <translatorcomment>#{::CGI.escapeHTML(value[\"comment\"].to_s)}</translatorcomment>\nEOF\n end\n xml += <<EOF\n <translation#{fuzzy}>#{::CGI.escapeHTML(value[\"translation\"].to_s)}</translation>\nEOF\n unless value[\"flag\"].to_s.strip.empty?\n xml += <<EOF\n <extra-po-flags>#{::CGI.escapeHTML(value[\"flag\"].to_s.strip)}</extra-po-flags>\nEOF\n end\n xml += <<EOF\n </message>\n </context>\nEOF\n end\n end\n\n xml += <<EOF\n</TS>\nEOF\n xml\n end",
"def translations; end",
"def create_translations\n end",
"def create_locale_files\n @i18n_scope = model.i18n_scope.to_s\n @i18n_key = model.model_name.i18n_key.to_s\n @columns = model.column_names\n\n options[:locales].each do |locale|\n @locale = locale\n locale_file = File.join(\n 'config/locales/models', model_name.underscore, \"#{@locale}.yml\"\n )\n template 'locale.yml', locale_file\n end\n rescue NameError\n puts \"#{model_name} is undefined.\"\n end",
"def process_file(filename, locale, output_locale)\n\n def assemble(templ, local)\n # If already assembling the string\n return local unless templ.is_a?(Hash)\n\n # If templ is a hash but local is nil, it means that the entire current \n # branch is not yet translated. Therefore create an empty hash to act as\n # placeholder\n local = {} if local.nil?\n\n # Recursing to traverse hash\n pairs = templ.collect { |k, v| [k, assemble(v, local[k])] }\n Hash[pairs]\n end\n\n def validate(node, path)\n if node.nil?\n puts \"Warning: path #{path} is nil. \"\n return\n end\n\n return unless node.is_a?(Hash)\n\n node.each { |k, v| validate(v, \"#{path}.#{k}\") }\n end\n\n puts \"Processing file #{filename} of locale #{locale}. \"\n\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(output_locale)\n\n # Loading template\n templ_file = templ_dir.join(filename)\n templ = YAML::load_file(templ_file)['template']\n\n # If the topmost level of the template is not 'template'\n if !templ\n puts \"Warning: Template is nil for #{filename}. Aborting for this file. \"\n return\n end\n\n # Loading localized YAML\n local_file = local_dir.join(filename)\n local = File.exists?(local_file) ? YAML::load_file(local_file)[locale] : {}\n\n # Alert for new file creation\n puts \"Warning: Creating new file #{filename} of locale #{locale}. \" unless File.exists?(local_file)\n\n # Assemble localized strings into template file\n assembled = assemble(templ, local)\n\n # Validate to find missed translations\n validate(assembled, locale)\n\n # Output to file\n output_file = output_dir.join(filename)\n FileUtils.mkdir_p output_file.dirname\n content = {locale => assembled}.to_yaml\n File.open(output_file, 'w') { |f| f.write(content) }\n\n end",
"def update_translation( key, value, locale )\n \n # lock file\n filename = File::join RAILS_ROOT, \"config/locales\", File::basename( locale + \".yml\" )\n if( File.exists? filename )\n file = File.new( filename, \"r+\")\n else\n file = File.new( filename, \"w+\" ) \n end\n \n file.flock( File::LOCK_EX )\n \n begin \n # read project locale file\n data = YAML.load( file )\n unless data.is_a? Hash \n I18n.load_path << filename\n data = { locale => {} } unless data \n end\n \n tmp = data\n \n # create middle hash keys as needed\n key = locale + \".\" + key\n keys = key.split(/\\./)\n base_key = keys.pop\n \n while tmpkey = keys.shift\n unless tmp[tmpkey].class == Hash\n tmp[tmpkey] = {}\n end\n tmp = tmp[tmpkey]\n end\n \n # update or create value\n tmp[base_key] = value\n \n # save file\n file.truncate( 0 )\n file.rewind\n file.write( data.to_yaml )\n ensure\n # unlock and close file\n file.flock( File::LOCK_UN )\n file.close\n end\n \n I18n.reload!\n \n end",
"def update\n files = Dir[Rails.root.join(\"config\", \"locales\", \"*.yml\").to_s]\n\n @languages = {}\n files.each do |f|\n ar = YAML.load_file f\n lang = ar.keys.first\n if @languages.has_key?(lang.to_s)\n @languages[lang.to_s] = @languages[lang.to_s].deep_merge(ar.first[1])\n else\n @languages[lang.to_s] = ar.first[1]\n end\n end\n\n sync(@languages[I18n.default_locale.to_s])\n end",
"def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end",
"def export\n keys = {}\n reset\n db_localizations = {}\n Lit::Localization.find_each do |l|\n db_localizations[l.full_key] = l.get_value\n end\n db_localizations.sort.each do |(l_key, value)|\n current = keys\n yaml_keys = l_key.split('.')\n\n 0.upto(yaml_keys.size - 2) do |i|\n key = yaml_keys[i]\n # Overwrite en.key with en.sub.key\n unless current[key].class == Hash\n current[key] = {}\n end\n current = current[key]\n end\n current[yaml_keys.last] = value\n end\n keys.to_yaml\n end",
"def load_translations(*filenames); end",
"def load_translations(*filenames); end",
"def insert_translation yml_path, k, v\n # TODO quote key if ':' in series\n series = k.to_series\n lines = File.readlines(yml_path).to_a\n\n # construct new_key (Array)\n i, id = seek_pos lines, series\n new_key = []\n series = series[(id || 0)..-1]\n if series.empty?\n if I18n.t(k) !~ /translation\\ missing/\n TextMate::UI.tool_tip \"translation key and value exists\"\n else\n print v\n TextMate::UI.tool_tip \"translation key exists, but value different\"\n end\n return\n end\n series.each do |e|\n new_key << (e[0] + e[1] + ':')\n end\n v = v.inspect if v.index(\"\\n\")\n new_key.last << ' ' << v\n new_key.map! {|l| l + \"\\n\" }\n\n # insert new_key (String) into file\n new_key = new_key.join\n if i\n lines.insert i, new_key\n else\n # remove trailing space\n while lines.last =~ /^\\s*$/\n lines.pop\n end\n if !lines.last.end_with?(\"\\n\")\n lines << \"\\n\"\n end\n lines << new_key.rstrip\n end\n\n # write\n lines = lines.join\n File.open yml_path, 'w' do |f|\n f << lines\n end\nend",
"def fill_file_ios(language, translations)\n translations[:filename] = language.to_s.downcase + \".lproj/\" + \"Localizable.strings\"\n file = translations[:file]\n\n # Header\n file.puts \"/*\"\n file.puts \" Localizable.strings\"\n file.puts \" \" + @project.name\n file.puts \"\"\n file.puts \" Created on Translate Community on \" + Time.new.strftime(\"%d.%m.%y\")\n file.puts \"*/\"\n file.puts \"\"\n\n # Content\n translations.each do |key, value|\n unless key == :file or key == :filename\n file.puts \"\\\"\" + key.gsub(/[^\\\\]\"|^\"/) { |s| (s.size > 1 ? s.first : \"\") + \"\\\\\\\"\"} + \"\\\" = \\\"\" + value[:value].gsub(/[^\\\\]\"|^\"/) {|s| (s.size > 1 ? s.first : \"\") + \"\\\\\\\"\"} + \"\\\";\"\n end\n end\n\n file.close\n end",
"def save\n File.open(SETTING_FILE, 'w') do |file|\n file.write @values.to_yaml\n end\n end",
"def yml_path language\n Rails.root.join('config', 'locales', \"#{language}.yml\")\nend",
"def write\n self.each_locale do |locale|\n self.output_locale\n\n self.snippets.values.each { |snippet| self.write_snippet(snippet) }\n end\n end",
"def queuedump\n queuefile = YAML.load_file(\"/config/queue.yml\")\n puts queuefile['queue']\n queuefile['last_update'] = \"text\"\n File.open('/config/queue.yml','w') do |h| \n h.write queuefile.to_yaml\n end\nend",
"def write_yml(filename,object)\n File.open(filename,'w') do |f|\n f.write(YAML.dump(object))\n end\n end",
"def yaml_export\n all_tables = {}\n\n all_tables['todos'] = current_user.todos.includes(:tags).load\n all_tables['contexts'] = current_user.contexts.load\n all_tables['projects'] = current_user.projects.load\n\n todo_tag_ids = Tag.find_by_sql(\n \"SELECT DISTINCT tags.id \"+\n \"FROM tags, taggings, todos \"+\n \"WHERE todos.user_id=? \"+\n \"AND tags.id = taggings.tag_id \" +\n \"AND taggings.taggable_id = todos.id \", current_user.id)\n rec_todo_tag_ids = Tag.find_by_sql(\n \"SELECT DISTINCT tags.id \"+\n \"FROM tags, taggings, recurring_todos \"+\n \"WHERE recurring_todos.user_id=? \"+\n \"AND tags.id = taggings.tag_id \" +\n \"AND taggings.taggable_id = recurring_todos.id \", current_user.id)\n tags = Tag.where(\"id IN (?) OR id IN (?)\", todo_tag_ids, rec_todo_tag_ids)\n taggings = Tagging.where(\"tag_id IN (?) OR tag_id IN(?)\", todo_tag_ids, rec_todo_tag_ids)\n\n all_tables['tags'] = tags.load\n all_tables['taggings'] = taggings.load\n all_tables['notes'] = current_user.notes.load\n all_tables['recurring_todos'] = current_user.recurring_todos.load\n\n result = all_tables.to_yaml\n result.gsub!(/\\n/, \"\\r\\n\") # TODO: general functionality for line endings\n send_data(result, :filename => \"tracks_backup.yml\", :type => 'text/plain')\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n stylesheet_link_tag \"application\", :media => \"all\" \n stylesheet_link_tag \"print\", :media => \"print\" \n javascript_include_tag \"application\" \n csrf_meta_tags \n@source_view\n raw(protect_against_forgery? ? form_authenticity_token.inspect : \"\") \n @tag_name ? @tag_name : \"\" \n @group_view_by ? @group_view_by : \"\" \n default_contexts_for_autocomplete.html_safe rescue '{}' \n default_tags_for_autocomplete.html_safe rescue '{}' \n date_format_for_date_picker \n current_user.prefs.week_starts \n root_url \n if current_user.prefs.refresh != 0 \n current_user.prefs[\"refresh\"].to_i*60000 \n end \n unless controller.controller_name == 'feed' or session['noexpiry'] == \"on\" \nurl_for(:controller => \"login\", :action => \"check_expiry\")\n end \ncheck_deferred_todos_path(:format => 'js')\n generate_i18n_strings \n favicon_link_tag 'favicon.ico' \n favicon_link_tag 'apple-touch-icon.png', :rel => 'apple-touch-icon', :type => 'image/png' \n auto_discovery_link_tag(:rss, {:controller => \"todos\", :action => \"index\", :format => 'rss', :token => \"#{current_user.token}\"}, {:title => t('layouts.next_actions_rss_feed')}) \n search_plugin_path(:format => :xml) \n @page_title \n if @count \n @count \n end \n l(Time.zone.today, :format => current_user.prefs.title_date_format) \n navigation_link(t('layouts.navigation.home'), root_path, {:accesskey => \"t\", :title => t('layouts.navigation.home_title')} ) \n navigation_link(t('layouts.navigation.starred'), tag_path(\"starred\"), :title => t('layouts.navigation.starred_title')) \n navigation_link(t('common.projects'), projects_path, {:accesskey=>\"p\", :title=>t('layouts.navigation.projects_title')} ) \n navigation_link(t('layouts.navigation.tickler'), tickler_path, {:accesskey =>\"k\", :title => t('layouts.navigation.tickler_title')} ) \n t('layouts.navigation.organize') \n navigation_link( t('common.contexts'), contexts_path, {:accesskey=>\"c\", :title=>t('layouts.navigation.contexts_title')} ) \n navigation_link( t('common.notes'), notes_path, {:accesskey => \"o\", :title => t('layouts.navigation.notes_title')} ) \n navigation_link( t('common.review'), review_path, {:accesskey => \"r\", :title => t('layouts.navigation.review_title')} ) \n navigation_link( t('layouts.navigation.recurring_todos'), {:controller => \"recurring_todos\", :action => \"index\"}, :title => t('layouts.navigation.recurring_todos_title')) \n t('layouts.navigation.view') \n navigation_link( t('layouts.navigation.calendar'), calendar_path, :title => t('layouts.navigation.calendar_title')) \n navigation_link( t('layouts.navigation.completed_tasks'), done_overview_path, {:accesskey=>\"d\", :title=>t('layouts.navigation.completed_tasks_title')} ) \n navigation_link( t('layouts.navigation.feeds'), feeds_path, :title => t('layouts.navigation.feeds_title')) \n navigation_link( t('layouts.navigation.stats'), stats_path, :title => t('layouts.navigation.stats_title')) \n link_to(t('layouts.toggle_contexts'), \"#\", {:title => t('layouts.toggle_contexts_title'), :id => \"toggle-contexts-nav\"}) \n link_to(t('layouts.toggle_notes'), \"#\", {:accesskey => \"S\", :title => t('layouts.toggle_notes_title'), :id => \"toggle-notes-nav\"}) \n group_view_by_menu_entry \n t('layouts.navigation.admin') \n navigation_link( t('layouts.navigation.preferences'), preferences_path, {:accesskey => \"u\", :title => t('layouts.navigation.preferences_title')} ) \n navigation_link( t('layouts.navigation.export'), data_path, {:accesskey => \"e\", :title => t('layouts.navigation.export_title')} ) \n navigation_link( t('layouts.navigation.import'), import_data_path, {:accesskey => \"i\", :title => t('layouts.navigation.import_title')} ) \n if current_user.is_admin? \n navigation_link(t('layouts.navigation.manage_users'), users_path, {:accesskey => \"a\", :title => t('layouts.navigation.manage_users_title')} ) \n end \n t('layouts.navigation.help') \n link_to t('layouts.navigation.integrations_'), integrations_path \n link_to t('layouts.navigation.api_docs'), rest_api_docs_path \n navigation_link(image_tag(\"system-search.png\", :size => \"16X16\", :border => 0), search_path, :title => t('layouts.navigation.search')) \n link_to(\"#{t('common.logout')} (#{current_user.display_name}) »\".html_safe, logout_path) \n \n controller.controller_name \n render_flash \n controller.controller_name \n TRACKS_VERSION \n (link_to(t('layouts.mobile_navigation.full'), todos_path(:format => 'html'))) \n \n\nend\n\n end",
"def ansible_setup_yaml(built_setup)\n YAML.dump(built_setup)\nend",
"def generate_save\n YAML.dump(self)\n end",
"def save_yml_test_case_map()\n new_test_case_map_path = self.class.test_case_map_path + '.new'\n yaml_content = @tc_id_map.to_yaml\n File.open(new_test_case_map_path, \"w:UTF-8\"){ |file| file.write(yaml_content) } if yaml_content\n FileUtils.mv(self.class.test_case_map_path, self.class.test_case_map_path + \".bak\")\n FileUtils.mv(new_test_case_map_path, self.class.test_case_map_path)\n end",
"def fill_file_android(language, translations)\n translations[:filename] = \"values-\" + language.to_s.downcase + \"/strings.xml\"\n file = translations[:file]\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.resources {\n translations.each do |key, value|\n unless key == :file or key == :filename\n xml.string_('name' => key) {\n value = value[:value].gsub(/'/) {|s| \"\\\\'\"}\n i = 0\n value = value.gsub(/%[^% ]{1}/) {|s| \"%\" + (i+=1).to_s + \"$\" + s.split(//).last}\n xml.text(value)\n }\n end\n end\n }\n end\n\n file.puts builder.to_xml\n\n file.close\n end",
"def load_i18n\n res = YAML.load_file(File.join(File.dirname(__FILE__), 'ie6nomore.i18n.yml'))\n end",
"def configure_i18n\n I18n.load_path += Dir[self.class.root_pathname.join('config', 'locales', '*.{rb,yml}')]\n end",
"def init_translations; end",
"def translate(settings); end",
"def translations_hash; end",
"def export_i18n_messages\n SimplesIdeias::I18n.export! if Rails.env.development?\n end",
"def merge_i18n(barclamp)\n locales = barclamp['locale_additions']\n locales.each do |key, value|\n #translation file (can be multiple)\n f = File.join CROWBAR_PATH, 'config', 'locales', \"#{key}.yml\"\n if File.exist? f\n puts \"merging translation for #{f}\" if DEBUG\n master = YAML.load_file f\n master = merge_tree(key, value, master)\n File.open( f, 'w' ) do |out|\n YAML.dump( master, out )\n end\n else\n puts \"WARNING: Did not attempt tranlation merge for #{f} because file was not found.\"\n end\n end\n end",
"def save\n open @config_path, 'w' do |io|\n io.write({'files' => @files.collect(&:to_hash)}.to_yaml)\n end\n end",
"def emit(key)\n yaml = YAML.load_file(file)\n yaml ||= {}\n yaml[language] ||= {}\n\n value = key.to_s\n\n key = normalize_key(value)\n\n # TODO: handle duplicate keys somehow?\n puts \"Dup: #{key}\" if yaml[language][key]\n\n yaml[language][key] = unescape(value)\n File.write(file, YAML.dump(yaml))\n end",
"def load_translations\n super(@load_paths)\n end",
"def load_translations\n super(@load_paths)\n end",
"def save!\n if self.file =~ LOCALE_INTERPOLATOR\n I18n.available_locales.each do |locale|\n write_file(file_for_locale(locale), self.translations.slice(locale))\n end\n else\n write_file\n end\n end",
"def load_yml(filename); end",
"def yaml_save object, filename\nFile.open filename, 'w' do |f| f.write(object.to_yaml)\nend end",
"def translations\n @translations ||= {}\n end",
"def yaml_save(packages)\n FileUtils.mkdir_p(File.dirname(yaml_file))\n File.open(yaml_file, \"w\") do |file|\n file.write(packages.to_yaml)\n end\n end",
"def store_translations(locale, data, options = T.unsafe(nil)); end",
"def to_yaml() end",
"def download_translations\n status\n @crowdin.export_translations\n @lang_ready.each do |lang|\n puts \"Downloading '#{lang}' in zip format\"\n @crowdin.download_translation(lang, output: \"#{@download_folder}/output-#{lang}.zip\")\n end\n end",
"def write_yaml(stations)\n log(' - Writing YAML...', false)\n File.open(YAML_PATH.to_s, 'w') { |file| file.write(stations.to_yaml) }\n log('DONE')\nend",
"def save\n if !Dir.exists? @config_directory\n FileUtils.mkdir_p @config_directory\n end\n\n open(@file, 'w').write @main.to_yaml\n end",
"def logyml(service, yml)\n File.open(\"/tmp/#{service}.yml\", 'w') do |f| f.write(yml) end\n end",
"def export_translations!(crowdin)\n print 'Building ZIP archive with the latest translations '\n export_translations = crowdin.export_translations\n if export_translations['success']\n if export_translations['success']['status'] == 'built'\n puts \"- OK\"\n elsif export_translations['success']['status'] == 'skipped'\n puts \"- Skipped\"\n puts \"Warning: Export was skipped. Please note that this method can be invoked only once per 30 minutes.\"\n end\n end\n end",
"def store ( yml, name )\n storefile = File.new( name, \"w\")\n storefile.puts(yml)\n storefile.close\n return [yml]\n end",
"def to_yml\n \"generate_to: '#{generate_to}'\\n\" <<\n \"builders_matcher: '#{builders_matcher}'\\n\" <<\n \"factories_matcher: '#{factories_matcher}'\"\n end",
"def files_to_translate\n folders = [\n \"app\",\n \"lib\",\n \"config\",\n locale_path\n ].join(\",\")\n\n exts = [\n \"rb\",\n \"erb\",\n \"haml\",\n \"slim\",\n \"rhtml\",\n \"js\",\n \"jsx\",\n \"vue\",\n \"coffee\",\n \"handlebars\",\n \"hbs\",\n \"mustache\"\n ].join(\",\")\n\n Dir.glob(\n \"{#{folders}}/**/*.{#{exts}}\"\n )\n end",
"def load_translations\n files = if File.directory?(@path)\n Dir[@path + '/**/*.yml']\n elsif File.file?(@path)\n detect_list_or_file @path\n else\n $stderr.puts 'No valid translation file given'\n []\n end\n update_store files\n end",
"def generate_yaml(data, locale_name, model_name, model_keys)\n # fill missing fields\n a = (data[locale_name] ||= {})\n a = b = (a[\"activerecord\"] ||= {})\n\n a = (a[\"models\"] ||= {})\n a[model_name] ||= model_name.camelize\n #a = (a[model_name] ||= {})\n #a[\"one\"] ||= model_name.camelize\n #a[\"other\"] ||= model_name.camelize.pluralize\n\n b = (b[\"attributes\"] ||= {})\n b = (b[model_name] ||= {})\n\n # c_key => key\n model_keys.each do |key|\n key.sub!(/^(._)?/, \"\")\n b[key] ||= key.humanize\n end\n\n data.ya2yaml\nend",
"def yaml_save(object, filename)\n File.open (filename), \"w\" do |f|\n f.write(object.to_yaml)\n end\nend",
"def create_files(translations)\n translations.each do |language, translation|\n translations[language][:file] = Tempfile.new(language.to_s)\n end\n translations\n end",
"def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end",
"def yaml_save(object, filename)\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def load_translations_and_collect_file_errors(files); end",
"def dump_settings\n File.open(SETTINGS_FILE, 'w') do |out|\n YAML.dump( { :targets => @targets, :src => @src }, out)\n end\n end",
"def save()\n File.open(CONFIG_FILE, 'w'){ |f| f.write config.to_yaml } # Store\n end",
"def save_yaml(path=nil)\n unless path\n # Display file explorer\n path = Qt::FileDialog.getSaveFileName(self, \"Save configuration file\", \"./myconfig.yml\", \"YAML Files (*.yml *.yaml)\")\n end\n\n begin\n config_hash = Hash.new\n @container_hash.each do |pos, container|\n config_hash[pos] = container.config\n end\n File.open(path, \"w\") {|f| f.write(config_hash.to_yaml) }\n rescue Exception => e\n Vizkit.error \"A problem occured while trying to write configuration to '#{path}': \\n#{e.message}\"\n end\n end",
"def sync_languages(languages, save_to = \"#{__dir__}\")\n validate\n languages.each { |language|\n self.sync_language(language, save_to)\n }\n end",
"def initialize_config_yaml(filename, files = Dry::Files.new, template: config_template)\n files.write(filename, template)\n end",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def save(filename)\n FileUtils.mkdir_p(File.dirname(filename))\n File.write(filename, YAML.dump(@metadata) + \"---\\n#{text}\")\n end",
"def yaml_dump(val)\n yml = \"\\n\" + YAML.dump(val)\n yml.gsub(/ +\\n/, \"\\n\")\n end",
"def rails_localization_files\n loc_files = Dir[File.join( RAILS_ROOT, '/vendor/plugins/globalite/lang/rails/', '*.{yml,yaml}')]\n end",
"def save\n File.write(yfile, to_yaml)\n end",
"def destination(lang)\n output_path.mkpath\n\n path = output_path.join(\"#{lang}.json\")\n path.open(\"w\") do |f|\n f.write yield\n end\n\n puts \"Created #{path}\"\n end",
"def config_write\n # Putting it in a format that zfm can also read and write\n f1 = File.expand_path(CONFIG_FILE)\n hash = {}\n hash['DIRS'] = @used_dirs.select { |dir| File.exist? dir }\n hash['FILES'] = @visited_files.select { |file| File.exist? file }\n # NOTE bookmarks is a hash and contains FILE:cursor_pos\n hash['BOOKMARKS'] = @bookmarks # .select {|file| File.exist? file}\n writeYML hash, f1\n @writing = @modified = false\n message \"Saved #{f1}\"\nend",
"def transform_files!(files, type) \n files.each do |file|\n parsed = \"\"\n namespace = [DEFAULT_LANGUAGE, 'txt', type] + Base.get_namespace(file, type)\n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n n = Namespace.new(namespace)\n \n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, n)\n \n #puts parsed\n # write the file\n \n File.open(file, 'w') { |file| file.write(parsed)}\n \n \n \n n.merge(@translations)\n end\n end",
"def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend",
"def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend",
"def save\n File.open(yaml_file, 'w') {|f| f.write(to_yaml) }\n end"
] | [
"0.7478688",
"0.6756288",
"0.6724751",
"0.65271837",
"0.6494844",
"0.6396262",
"0.63741976",
"0.63378483",
"0.62018317",
"0.61155903",
"0.6104265",
"0.6073624",
"0.6061962",
"0.59855217",
"0.59820116",
"0.5876098",
"0.5857729",
"0.5797701",
"0.5760566",
"0.5747575",
"0.5725606",
"0.5679594",
"0.56745756",
"0.56552225",
"0.5611683",
"0.55471903",
"0.5541763",
"0.55293375",
"0.5524457",
"0.5522389",
"0.55132073",
"0.54942083",
"0.54942083",
"0.54874897",
"0.5485856",
"0.54676765",
"0.54661447",
"0.5462586",
"0.54448056",
"0.54212284",
"0.5419747",
"0.54190886",
"0.5392197",
"0.5384132",
"0.5383392",
"0.53702974",
"0.53633565",
"0.53617287",
"0.5353309",
"0.5351086",
"0.53404194",
"0.5338239",
"0.53354585",
"0.5283321",
"0.52772236",
"0.52772236",
"0.5275767",
"0.52746534",
"0.5270757",
"0.52681977",
"0.52624565",
"0.5233543",
"0.5229975",
"0.5228",
"0.5224701",
"0.52180934",
"0.5216133",
"0.5201981",
"0.5200775",
"0.5197825",
"0.51972914",
"0.5191942",
"0.5182076",
"0.51762223",
"0.51738787",
"0.5173771",
"0.51736265",
"0.5165987",
"0.5159704",
"0.51509225",
"0.51467043",
"0.5145548",
"0.51395804",
"0.5139558",
"0.5139558",
"0.5139558",
"0.5139558",
"0.5139558",
"0.5139558",
"0.5139558",
"0.5138293",
"0.51340306",
"0.51334965",
"0.5132137",
"0.51254165",
"0.5119355",
"0.51091117",
"0.51051736",
"0.51051736",
"0.50899345"
] | 0.6956579 | 1 |
cleanup empty keys recursivley | def cleanup!(content)
content.each do |key, value|
cleanup!(value) if value.is_a? Hash
content.delete(key) if value.blank?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup!\n self.reject! { |k, v| v.empty? }\n end",
"def strip_empty_entries(hash)\n return hash unless hash.is_a?(Hash)\n\n hash.inject({}) do |m, (k, v)|\n m[k] = strip_empty_entries(v) unless v&.empty?\n m.delete(k) if m[k].nil? || m[k].empty?\n m\n end\nend",
"def strip_nulls!(hash)\n hash.each_key do |key|\n case value = hash[key]\n when Hash\n strip_nulls!(value)\n hash.delete(key) if value.empty?\n when nil then hash.delete(key)\n end\n end\n\n hash\n end",
"def stringify_keys_recursively!(object); end",
"def deep_clean(data)\r\n proc = Proc.new { |k, v|\r\n if v.kind_of?(Hash) && !v.empty?\r\n v.delete_if(&proc)\r\n nil\r\n end\r\n v.nil? || v.empty?\r\n }\r\n hash.delete_if(&proc)\r\n end",
"def parse_query_api_pattern_remove_blank_key( key, value, result)\n # 'KeyName{!remove-if-blank}'\n blank_key_sign = key[FIND_BLANK_KEYS_TO_REMOVE]\n if blank_key_sign\n # Delete the original key from the resulting hash.\n result.delete(key)\n # But if its value is not blank then fix the key name (get rid of {!remove-if-blank}) and\n # put it back.\n unless value.respond_to?(:_blank?) && value._blank?\n key = key.sub(blank_key_sign, '')\n result[key] = value\n end\n end\n [key, value]\n end",
"def recursive_delete_if_nil\n self.inject({}) do |h,(k,v)|\n if !v.nil?\n h[k] = v.respond_to?('recursive_delete_if_nil') ? v.recursive_delete_if_nil : v\n end\n h\n end\n end",
"def strip_hash_of_keys(array_of_keys_to_strip)\n self.keys.each do |k|\n strip = false\n array_of_keys_to_strip.each do |i|\n if i.class == Regexp\n strip = true if k =~ i\n else\n strip = true if k == i\n end\n end\n\n if strip\n self.delete(k)\n else\n if self[k].class == Hash\n self[k] = self[k].strip_hash_of_keys(array_of_keys_to_strip)\n elsif self[k].class == Array\n self[k].each do |h|\n h = h.strip_hash_of_keys(array_of_keys_to_strip) if h.class == Hash\n end\n end\n end\n end\n self\n end",
"def delete_unwanted_children\n @children.keys.each do |key|\n if(@children[key][:value].class.name === \"Array\")\n if(@children[key][:value].empty?)\n @children.tap { |hs| hs.delete(key) }\n end\n else\n if(@children[key][:value].nil?)\n @children.tap { |hs| hs.delete(key) }\n end\n end\n end\n end",
"def remove_empty_fields\n self.each_pair do |k, v|\n if self[k].class == Hash\n self[k] = self[k].remove_empty_fields\n else\n self.delete(k) if v.to_s == \"\"\n end\n end\n self\n end",
"def clean!\n if @keys.size > Cache.max_size\n @keys = @keys[(Cache.max_size/2)...@keys.size]\n reject! { |key, value| !@keys.include?(key) }\n end\n end",
"def remove_empties(h)\n h.delete_if do |_k, v|\n v == '∅∅∅'\n end\n\n h.each_pair do |_k, v|\n remove_empties(v) if v.is_a?(Hash)\n end\n\n h.delete_if do |_k, v|\n v.is_a?(Hash) && v.empty?\n end\n end",
"def ordered_clean_hash source\n ordered_keys.each_with_object({}) do |key, target|\n if source.key? key\n target[key] = source[key] unless value_is_an_empty_hash(source[key])\n end\n end\n end",
"def clean_unwanted_keys(hash)\r\n ignored_keys = [:only_path, :use_route]\r\n hash.dup.delete_if{|key,value| ignored_keys.include?(key)}\r\n end",
"def compact!\n keys = []\n self.each { |k, v| keys << k if v.include? '*' }\n keys.each { |k| self[k] = [] }\n end",
"def convert_nils_to_empty_hashes(hash); end",
"def cleanse\n select { |_k, v| v }\n end",
"def deep_transform_keys!(&block); end",
"def normalize_flat_keys(locale, key, scope, separator); end",
"def normalize_flat_keys(locale, key, scope, separator); end",
"def child_keys() []; end",
"def deep_munge(hash)\r\nhash.each do |k, v|\r\ncase v\r\nwhen Array\r\nv.grep(Hash) { |x| deep_munge(x) }\r\nv.compact!\r\nhash[k] = nil if v.empty?\r\nwhen Hash\r\ndeep_munge(v)\r\nend\r\nend\r\nhash\r\nend",
"def transform_to_empty_key(key)\n (key.to_s << '/').to_sym\n end",
"def prune\n # First: prune all children.\n self.each { |_, n| n.prune }\n # Then delete all nil leaf children.\n @succ.clone.each do |key, n|\n delete key if n.val == nil && n.leaf?\n end\n end",
"def deep_transform_keys(&block); end",
"def compact!\n delete_if { |k, v| v.nil? }\n end",
"def recursive_remove_empty_and_nil_values(hash_or_array)\n p = proc do |*args|\n v = args.last\n v.delete_if(&p) if v.respond_to? :delete_if\n v.nil? || v.respond_to?(:\"empty?\") && v.empty?\n end\n\n hash_or_array.delete_if(&p)\n end",
"def recursively_stringify_key\n recursively_transform_keys { |key| key.to_s rescue key }\n end",
"def clean_hash hash\n hash ||= {}\n hash = hash.map do |k,v|\n if v.is_a? Hash\n [k,clean_hash(v)]\n else\n [k,v]\n end\n end\n hash = Hash[hash]\n Hash[hash.select do |k,v|\n if v.is_a? Hash\n v.size > 0\n else\n v.present?\n end\n end]\n end",
"def unmatched_keys; end",
"def compact!\n hsh = {}\n any = false\n each do |k, v|\n if v.nil?\n any = true\n else\n hsh[k] = v\n end\n end\n return unless any\n replace hsh\n self\n end",
"def remove_empties_from_hash(old_hash)\n new_hash = {}\n old_hash.each do |key, value|\n next if value.nil? || value == '' || value == [] || value == {}\n new_hash[key] = value.is_a?(Hash) ? remove_empties_from_hash(value) : value\n end\n \n return new_hash\n end",
"def clean_keys\n self.validator_key = clean_key(validator_key)\n self.client_key = clean_key(client_key)\n self.databag_key = clean_key(databag_key)\n end",
"def compact\n reject{|key,val| val.nil? }\n end",
"def process_empty_object\n clear_data!\n self.key = transform_to_empty_key(key)\n end",
"def simplify_key_value_list(elements)\n # remove everything form right to left till the double unerline\n elements.each do |element|\n element.keyValueList.transform_keys! do |key|\n index = key.index('__')\n if !index.nil?\n key.slice(index + 2, key.length)\n else\n key\n end\n end\n end\n end",
"def transform_keys!\n return enum_for(:transform_keys!) { size } unless block_given?\n keys.each do |key|\n self[yield(key)] = delete(key)\n end\n self\n end",
"def transform_keys!\n return enum_for(:transform_keys!) { size } unless block_given?\n keys.each do |key|\n self[yield(key)] = delete(key)\n end\n self\n end",
"def transform_keys!\n return enum_for(:transform_keys!) { size } unless block_given?\n keys.each do |key|\n self[yield(key)] = delete(key)\n end\n self\n end",
"def recursively_normalize_keys\n recursively_transform_keys { |key| key.downcase.to_sym rescue key }\n end",
"def filter_search_keys(search_keys)\n search_keys.delete_if { |_key, value| value.empty? }\n end",
"def compact(h={})\n h.each do|k,v|\n if v.nil?\n h.delete(k)\n elsif (v.is_a?(Hash) && v.empty?)\n next\n end\n\n compact v if v.is_a?Hash\n end\n\n # Remove all empty hashes except first key if it is empty\n # since that is required for XML root element attributes\n h.delete_if do|k,v|\n v.is_a?(Hash) && v.empty? && k != h.keys[0]\n end\n\n h\n end",
"def except_empty\n self.reject{|k, v| v.to_s.empty?}\n end",
"def trim\n self.select { |_k, v| v.present? }\n end",
"def recursive_hash_normalize_keys val\n if val.is_a? Hash\n deep_hash_normalize val\n else\n val\n end\n end",
"def transform_keys!\n keys.each do |key|\n self[yield(key)] = delete(key)\n end\n self\n end",
"def delete_blanks(hash)\n hash.delete_if do |k, v|\n (v.respond_to?(:empty?) ? v.empty? : !v) or v.instance_of?(Hash) && (delete_blanks v).empty?\n end\n end",
"def clean_dict(original_dict)\n original_dict.each_with_object({}) do |(k, v), memo|\n memo[k.to_i] = clean_node(v)\n end\n end",
"def transform_keys!(&block); end",
"def normalize_keys(locale, key, scope, separator = T.unsafe(nil)); end",
"def prune_nil_values!(o)\n if o.is_a? Hash\n o.keys.each do |k|\n if o[k].nil?\n o.delete k\n else\n o[k] = prune_nil_values o[k]\n o.delete k if o[k].nil?\n end\n end\n o\n elsif o.is_a? Array\n o.reject { |e| e.nil? }\n o.collect! { |e| prune_nil_values e }\n else\n o\n end\nend",
"def clean_hash(hash)\n hash.each do |key, value|\n if value == ''\n hash[key] = nil\n elsif value.is_a?(Array)\n value.each do |item|\n clean_hash(item) if item.is_a?(Hash)\n end\n elsif [DateTime, Time].include?(value.class)\n hash[key] = convert_date(value)\n elsif value.is_a?(Hash)\n clean_hash(value)\n end\n end\n end",
"def transform_keys!\n return enum_for(:transform_keys!) { size } unless block_given?\n keys.each do |key|\n self[yield(key)] = delete(key)\n end\n self\n end",
"def tidy_up!\n antecedence.each_key do |entry|\n antecedence[entry].uniq!\n end\n end",
"def sanitize_keys(value)\n if value.is_a?(Hash)\n value.map { |k, v|\n k = k.to_s.downcase.tr('^a-z0-9_', '_').to_sym\n v = sanitize_keys(v)\n [k, v]\n }.to_h\n elsif value.is_a?(Array) && (value.size > 1)\n value.map { |v| sanitize_keys(v) }\n elsif value.is_a?(Array)\n sanitize_keys(value.first)\n elsif value.is_a?(String) && value.include?(FileFormat::FILE_FORMAT_SEP)\n value.split(FileFormat::FILE_FORMAT_SEP).compact_blank\n else\n value\n end\n end",
"def cleanup\n keys = redis.keys(raw_data_key('*')) + redis.keys(data_key('*'))\n multi do\n keys.each{|key| redis.del(key)}\n end\n super\n end",
"def transform_keys(&block); end",
"def tree_reject(map, ignored_keys)\n ignored_leaves = extract_leaves(ignored_keys)\n ignored_subtrees = extract_subtrees(ignored_keys, ignored_leaves)\n\n map.to_h.each_with_object({}) do |(k, v), cleaned|\n if ignored_leaves.include?(k)\n next\n elsif v.is_a?(Hash) || v.respond_to?(:attributes)\n cleaned_v = tree_reject(v.to_h, ignored_subtrees[k])\n cleaned[k] = cleaned_v unless cleaned_v == {}\n elsif !v.nil?\n cleaned[k] = v\n end\n end\n end",
"def clean(data)\n data.inject({}) do |hash, (key, val)| \n hash[key] = val.is_a?(Array) ? val.map { |v| clean v } : (val.is_a?(Hash) ? clean(val) : val.try(:strip))\n hash\n end\n end",
"def deep_transform_keys! &block\n keys.each do |key|\n value = delete(key)\n\n self[yield(key)] = case value\n when Hash\n value.deep_transform_keys!(&block)\n when Array\n value.each{ |e| e.deep_transform_keys!(&block) rescue value }\n else\n value\n end\n end\n self\n end",
"def deep_populate_nil_values(hash)\n hash.each do |k, v|\n deep_populate_nil_values(v) if v.is_a?(Hash)\n hash[k] = 'kubecf' if v.nil?\n end\nend",
"def sanitize_keys(hash)\n new_hash = Hash.new\n hash.each do |key,value|\n sanitized_key = key.downcase.tr(\" \", \"_\")\n\n if value.is_a? Hash\n new_hash[sanitized_key] = sanitize_keys(value)\n else\n new_hash[sanitized_key] = value\n end\n end\n return new_hash\n end",
"def deconstruct_keys(keys)\n if @value.respond_to?(:deconstruct_keys)\n @value.deconstruct_keys(keys)\n else\n EMPTY_HASH\n end\n end",
"def deconstruct_keys(keys)\n if @value.respond_to?(:deconstruct_keys)\n @value.deconstruct_keys(keys)\n else\n EMPTY_HASH\n end\n end",
"def clean_values(h)\n return nil if h.empty?\n return h[\"$t\"] if h.has_key?(\"$t\")\n\n h.each do |k, v|\n if v.is_a?(Array)\n v.map! { |e| clean_values(e) }\n else\n h[k] = clean_values(v)\n end\n end\n end",
"def empty_square(b)\n b.keys.select{|position| b[position] == \" \"}\nend",
"def compact_hash(hash)\n hash.delete_if { |key, value| value.blank? }\n end",
"def nil_values(the_input, nil_keys_array = Array.new)\n the_input.select { |_, v| v.blank? }.each_key do |key|\n nil_keys_array << key.to_s\n end\n raise K2EmptyParams.new(nil_keys_array) unless nil_keys_array.blank?\n end",
"def replace_empty(key, params, empty_str)\n params[key] = empty_str if [nil, '', '-'].include?(params[key])\n return params\n end",
"def clean(source,target)\n source.stringify_keys!\n target.stringify_keys!\n output = Hash.new\n target.each do |key,value|\n if not value.is_a? Hash and source[key]\n output[key] = value\n elsif value.is_a? Hash and source[key]\n output[key] = clean(source[key],value)\n else\n puts \" Cleaning #{key} from target\"\n end\n end\n return output\nend",
"def missing_keys; end",
"def report_non_nil_and_missing_keys(data)\n data.each{ |h|\n %w[key ref _owner].each{ |k| check_key(h, k) }\n }\n end",
"def compact_blank!\n reject! { |_k, v| v.blank? }\n end",
"def symbolize_keys_recursively!(object); end",
"def strip_out_unsupported!(hash)\n hash.each do |key, value|\n delete_key = false\n # delete fhir_comments and primitive extensions\n if key == 'fhir_comments' || key.start_with?('_')\n delete_key = true\n elsif value.is_a?(Array)\n value.each do |thing|\n strip_out_unsupported!(thing) if thing.is_a?(Hash)\n end\n elsif value.is_a?(Hash)\n strip_out_unsupported!(value)\n delete_key = value.empty?\n end\n hash.delete(key) if delete_key\n end\n end",
"def del_min\n return if @keys.size == 0\n @keys.delete_at(0)\n @values.delete_at(0)\n end",
"def filter_keys(data, *expected_keys)\n excess_keys = data.keys - expected_keys\n excess_keys.each do |key|\n data.delete(key)\n end\n return data\nend",
"def compact_blank\n reject { |_k, v| v.blank? }\n end",
"def type_note_keys_without_blanks\n @args[:type_note_keys].reject(&:empty?)\n end",
"def missing_keys(route, parts); end",
"def convert_nils_to_empty_hashes(hash)\n hash.each_with_object({}) do |(key, value), h|\n h[key] =\n case value\n when nil then {}\n when Hash then convert_nils_to_empty_hashes(value)\n else\n value\n end\n end\n end",
"def remove_large_groupings(root)\n epilogue = root.pop\n newroot = []\n root.map { |la| newroot.push(*la.values.first) } # only a single key/value pair\n newroot << epilogue\n return newroot\nend",
"def recursively_symbolize_keys\n recursively_transform_keys { |key| key.to_sym rescue key }\n end",
"def recursively_transform_keys(&block)\n _recursively_transform_keys_in_object(self, &block)\n end",
"def keys_to_s!(recursive: true)\n replace(keys_to_s(recursive: recursive))\n end",
"def remove_pairs_start_with_s\n h = {key: 1,\n s_key1: 1,\n s_key2: 2,\n key_s: 3\n }\n h.delete_if { |key| key.to_s.match(/^s/) }\n puts h\nend",
"def empty_squares(board)\n board.keys.select {|k| board[k] == ' '}\nend",
"def forms_merge(hash1, hash2) \r\n target = hash1.dup\r\n hash2.keys.each do |key|\r\n if hash2[key].is_a? Hash and hash1[key].is_a? Hash\r\n target[key] = forms_merge(hash1[key], hash2[key])\r\n next\r\n end\r\n target[key] = hash2[key] == '/' ? nil : hash2[key]\r\n end\r\n# delete keys with nil value \r\n target.delete_if{ |k,v| v.nil? }\r\nend",
"def unprefixed_subtree_keys(key)\n prefixed_keys = subtree_keys(key)\n prefix = key.end_with?('/') ? key : key + '/'\n prefixed_keys.collect {|k| k.delete_prefix(prefix)}\n end",
"def clear\n if warning?\n warn(\"This operation can run for a very long time if the namespace contains lots of keys! \" +\n \"It should be used in tests, or when the namespace is small enough \" +\n \"and you are sure you know what you are doing.\")\n end\n\n batch_size = 1000\n\n if supports_scan?\n cursor = \"0\"\n begin\n cursor, keys = scan(cursor, count: batch_size)\n del(*keys) unless keys.empty?\n end until cursor == \"0\"\n else\n all_keys = keys(\"*\")\n all_keys.each_slice(batch_size) do |keys|\n del(*keys)\n end\n end\n end",
"def expanded_keys( hash )\n hash.each do |k,v|\n ek = expand_key( k )\n yield ek, v unless ek.empty?\n end\n end",
"def keys_to_sym clean: false\n self.inject({}){|memo,(k,v)| memo[clean ? k.to_s.to_clean_sym : k.to_s.to_sym] = (v.is_a?(Hash) || v.is_a?(Array) ? v.keys_to_sym(clean:clean) : v); memo}\n end",
"def clear\n keys.each do |k|\n Jeapie.instance_variable_set(\"@#{k}\", nil)\n end\n end",
"def empty_positions(b)\n b.select {|key, value| value == ' '}.keys # returns array of keys whose values are empty\nend",
"def remove_all_keys\n deprecate # 07/31/2012\n delete(\"/user/keys\").to_s\n end",
"def stringify_keys!\n keys.each{|k| \n v = delete(k)\n self[k.to_s] = v\n v.stringify_keys! if v.is_a?(Hash)\n v.each{|p| p.stringify_keys! if p.is_a?(Hash)} if v.is_a?(Array)\n }\n self\n end",
"def _flatten(data, recursive_key = '')\n data.each_with_object({}) do |(k, v), ret|\n key = recursive_key + k.to_s\n key = key.gsub(/[^a-zA-Z]/, '_')\n begin\n if v.is_a? Hash\n ret.merge! _flatten(v, key + '_')\n elsif v.is_a? Array\n v.each do |x|\n if x.is_a? String\n ret[key] = v.join(',')\n else \n ret.merge! _flatten(x, key + '_')\n end\n end\n else\n ret[key] = v\n end\n rescue\n pp [v, v.class, v.size, v.length, v.empty?]\n end\n end\nend",
"def deep_transform_keys!(&block)\n keys.each do |key|\n value = delete(key)\n self[yield(key)] = value.is_a?(Hash) ? value.deep_transform_keys!(&block) : value\n end\n self\n end",
"def deep_transform_keys!(&block)\n keys.each do |key|\n value = delete(key)\n self[yield(key)] = value.is_a?(Hash) ? value.deep_transform_keys!(&block) : value\n end\n self\n end",
"def transform_keys\n { a: 1, b: 2 }.transform_keys { |key| key_map[key] || key }\n end"
] | [
"0.6784451",
"0.6473593",
"0.6402198",
"0.63760006",
"0.6329877",
"0.6300712",
"0.62988967",
"0.62974083",
"0.6265873",
"0.6232406",
"0.6119637",
"0.60819286",
"0.6034449",
"0.60061765",
"0.5996029",
"0.5963863",
"0.5957308",
"0.5938296",
"0.5932182",
"0.5932182",
"0.5921553",
"0.5920475",
"0.59156233",
"0.5903607",
"0.5888121",
"0.5877007",
"0.5872538",
"0.58717984",
"0.5865536",
"0.58556116",
"0.58538973",
"0.5820783",
"0.57967246",
"0.5778604",
"0.5768152",
"0.57648575",
"0.5754679",
"0.5754679",
"0.5754679",
"0.57505584",
"0.5738894",
"0.57355756",
"0.5682167",
"0.56696427",
"0.56679404",
"0.5662041",
"0.5661173",
"0.5656319",
"0.5643174",
"0.56395155",
"0.56321716",
"0.56112826",
"0.56105775",
"0.55834746",
"0.5580269",
"0.5578035",
"0.55684584",
"0.55602485",
"0.55562603",
"0.55473244",
"0.55426663",
"0.55418015",
"0.55247444",
"0.55247444",
"0.5518992",
"0.550888",
"0.550684",
"0.5476185",
"0.5471719",
"0.5471252",
"0.54709095",
"0.54547447",
"0.5454619",
"0.54521704",
"0.54480934",
"0.5440603",
"0.5432653",
"0.54021114",
"0.5384663",
"0.53837025",
"0.5367359",
"0.53619266",
"0.53336865",
"0.5328331",
"0.5312865",
"0.53015244",
"0.53007776",
"0.52986366",
"0.52895033",
"0.5287705",
"0.52688473",
"0.52645934",
"0.5253078",
"0.5244628",
"0.5240996",
"0.5240941",
"0.5238328",
"0.523189",
"0.523189",
"0.52312046"
] | 0.6214484 | 10 |
A generalized method to handle tablesorter queries. It's meant to be used in the corresponding Controller action. Params: clazz: The model's primary class base_query: If there are any relevant joins or so > pass the AR relation here partial (optional): path to the partial to be rendered | def create_query_html_response(base_query, partial: 'row', locals: {})
resp_data = ts_ajax_handler.query_data(base_query)
records = resp_data.delete(:records)
resp_data[:data] = render_response_html(records, partial: partial, locals: locals)
resp_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_table(klass, objects)\n # get links from class' helper\n links = send(\"#{klass.table_name}_index_links\", objects).compact\n\n # if there are any batch links, insert the 'select all' link\n batch_ops = !links.reject{|l| !l.match(/class=\"batch_op_link\"/)}.empty?\n links.insert(0, select_all_link) if batch_ops\n \n # render, getting fields and checking if there are no objects at all\n render(\"layouts/index_table\",\n :klass => klass,\n :objects => objects,\n :paginated => objects.respond_to?(:total_entries),\n :links => links.flatten.join.html_safe,\n :fields => send(\"#{klass.table_name}_index_fields\"),\n :batch_ops => batch_ops\n )\n end",
"def generate_sorted_table(request)\n\t\t# Get the rank to highlight from the query string\n\t\trank_to_highlight = request.GET()[\"rank\"].to_i\n\t\t# Generate table HTML\n\t\ttable_content = \"<table>\"\n\t\t@albums.each do |album|\n\t\t\tif album[@@COL_RANK] == rank_to_highlight\n\t\t\t\ttable_content += \"<tr id=\\\"highlight\\\"><td>#{album[@@COL_RANK]}</td>\"\n\t\t\telse\n\t\t\t\ttable_content += \"<tr><td>#{album[@@COL_RANK]}</td>\"\n\t\t\tend\n\t\t\ttable_content += \"<td>#{album[@@COL_NAME]}</td><td>#{album[@@COL_YEAR]}</td></tr>\"\n\t\tend\n\t\ttable_content += \"</table>\"\n\tend",
"def build_table_helpers(resource)\n @module.module_eval <<-end_eval\n def #{resource.singular}_table(opts={}, &block)\n content = capture(&block)\n opts[:class] = ResourcefulViews.resourceful_classnames('#{resource.singular}_table', *(opts.delete(:class) || '').split)\n concat(content_tag(:table, content, opts))\n end\n def #{resource.singular}_row(*args, &block)\n opts = args.extract_options!\n opts[:class] = ResourcefulViews.resourceful_classnames('#{resource.singular}', *(opts.delete(:class) || '').split)\n opts[:id] = '#{resource.singular}_' + args.first.id.to_s unless args.empty?\n content = capture(&block)\n concat(content_tag(:tr, content, opts))\n end\n end_eval\n end",
"def render_table(arel)\n return if arel.first.nil?\n partial :table, :locals => {:model => arel.first.class, :arel => arel}\n end",
"def get_list_of_records(klass, options = {}, &block)\n items = klass.name.tableize\n self.current_page = options[:page] if options[:page]\n query = options[:query] if options[:query]\n category = options[:category] if options[:category]\n pagination = options[:pagination].nil? ? true : options[:pagination] \n date = options[:date] if options[:date]\n #date_range = options[:date_range] if options[:date_range]\n start_date = options[:start_date] if options[:start_date]\n end_date = options[:end_date] if options[:end_date]\n sort_fields = options[:sort] if options[:sort]\n sort_dir = options[:dir] || \"ASC\"\n per_page = options[:per_page] if options[:per_page]\n\n #self.current_query = options\n records = {\n :user => @current_user #,\n # :order => @current_user.pref[:\"#{items}_sort_by\"] || klass.sort_by\n }\n\n # Use default processing if no hooks are present. Note that comma-delimited\n # export includes deleted records, and the pagination is enabled only for\n # plain HTTP, Ajax and XML API requests.\n wants = request.format\n filter = session[options[:filter]].to_s.split(',') if options[:filter]\n scope = klass.scoped\n scope = scope.category(category) if category.present?\n scope = scope.state(filter) if filter.present?\n scope = scope.search(query) if query.present?\n scope = scope.at_date(date) if date.present?\n #scope = scope.between_dates(date_range) if date_range.present?\n scope = scope.between_dates(start_date, end_date) if (start_date.present? && end_date.present?)\n\n if sort_fields.present?\n words = sort_fields.split(\".\")\n if words.length > 1\n table = words.shift.tableize # popup first item\n field = words.join(\".\")\n sort_fields2 = \"#{table}.#{field}\" \n else\n sort_fields2 = \"#{items}.#{words.first}\"\n end\n scope = scope.order_by(sort_fields2, sort_dir)\n end\n\n scope = yield scope if block_given?\n scope = scope.unscoped if wants.csv?\n scope = scope.page(current_page).per(per_page)\n scope\n end",
"def table_of(things,opts={})\n kind = things.first.table_name\n # columns = things.first.visible_columns\n add_class_to_html_options(opts, kind)\n content_tag(\n :table,\n render(:partial => \"/#{kind}/table_row\", :collection => things),\n opts\n )\n end",
"def inherited(subclass)\n subclass.sorter = sorter\n super\n end",
"def _define_related_entries_method(meritable_class_name)\n define_method(:\"#{meritable_class_name.underscore.pluralize}\") do\n sashes = BadgesSash.where(badge_id: id).pluck(:sash_id)\n meritable_class_name.constantize.where(send \"_#{Merit.orm}_sash_in\", sashes)\n end\n end",
"def full_search_table_render(form_input_hash)\n\tprep_html(response_obj(prep_query(form_input_hash)))\nend",
"def handle_search_n_sort\n if @search_sort\n inject_into_file \"app/models/#{singular_table_name}.rb\",\n before: /^end/ do\n \"\\n\\textend SqlSearchableSortable\\n\"\n end\n inject_into_file \"app/models/#{singular_table_name}.rb\",\n before: /^end/ do\n \"\\n\\tsql_searchable #{searchable_cols_as_symbols}\\n\" \n end\n inject_into_file \"app/models/#{singular_table_name}.rb\",\n before: /^end/ do\n \"\\n\\tsql_sortable #{cols_to_symbols}\\n\"\n end\n end\n\n end",
"def index t,param\n subclass,id = param\n models = t.find_models subclass\n if models\n models.values[0].each do |model_name, model_attributes|\n if model_name.to_s ==\"sql_query\"\n #some magic is needed here ..parse the sql query?\n else\n m = Model.new model_name, models.keys[0].to_s\n row_values=m.get_row_by_id(id).first\n c1=Hash.new\n if row_values\n m.model.columns_hash.each_with_index do |column_name,i|\n c1[column_name[0]]=eval(\"row_values.#{column_name}\")\n end\n t.extract_id_line model_attributes, c1,row_values,m.get_datatypes\n t.make_triples(c1, models.keys[0].to_s , \"\", m.get_datatypes)\n end\n end\n end\n end\n #render :text => t.make_triples(c1, controller , \"\", t.dbd_types)\n \n end",
"def mti_delegate_query_table param\n return self.table_name.to_sym if mti_handles_query_param param\n mti_ancestor_classes.find {|e| e.mti_handles_query_param param}&.table_name&.to_sym\n end",
"def table_for(collection, options = {}, *attr_list)\n actions = false\n classes = options[:classes] || \"\"\n model_class_name = options[:model_name] || collection.name\n table_id = options[:id] || model_class_name.tableize\n table_klazz = model_class_name.constantize\n table_headers = []\n\n attr_list.flatten.each do |attr_name|\n if attr_name.class == Hash && !attr_name[:actions].nil?\n actions = attr_name[:actions]\n else\n header_content = table_klazz.human_attribute_name(attr_name)\n header = content_tag(:th, header_content)\n table_headers << header\n end\n end\n\n if actions\n table_headers << content_tag(:th, t('actions'), class: 'table_actions')\n end\n\n thead = content_tag :thead, content_tag(:tr, table_headers.join(\" \").html_safe)\n table_content = \"\"\n if options[:partial].present?\n table_content = render partial: options[:partial], collection: collection\n else\n table_content = render collection\n end\n tbody = content_tag :tbody, table_content\n table = content_tag(:table, \"#{thead} #{tbody}\".html_safe, id: table_id, class: \"table table-hover #{classes}\")\n table.html_safe\n end",
"def table\n\n ### Get the default set of users ###\n users = join_builder\n\n ### Pluck out the Params ###\n page = (table_params[:page] || 0).to_i\n page_size = (table_params[:page_size] || users.count).to_i\n role = params[:role]\n search = (table_params[:search])\n offset = page*page_size\n sort_column = params[:sort_column]\n sort_order = params[:sort_order]\n columns = params[:columns]\n\n organization_id = [params[:organization_id].to_i] & @organization_list\n\n ### Update SORT and COLUMNS Preferences ###\n if sort_column.present? || columns.present?\n current_user.update_table_prefs(:users, sort_column, sort_order, columns)\n end\n\n ### Search ###\n if search.present?\n searchable_columns = [:first_name, :last_name, :phone, :phone_ext, :email, :title, :external_id] \n search_string = \"%#{search}%\"\n query = query_builder(searchable_columns, search_string)\n case search.downcase\n when 'active'\n query = query.or(User.arel_table[:active].eq(true))\n when 'inactive'\n query = query.or(User.arel_table[:active].eq(false))\n end\n users = users.where(query)\n\n ####### Get users who match search on role\n ##users_on_role = (role_query search_string).pluck(:id)\n ######## Search on every column (except role)\n ##all_user_table = User.joins(:organization).joins(:roles).where(query).pluck(:id)\n ######### Take the union of the above searches\n ##users = User.where(id: [users_on_role + all_user_table].uniq)\n end\n\n ### Filter ###\n if role.present?\n users = users.joins(:roles).where({roles: {name: role.split(',')}}).distinct\n end\n\n # Handle org list\n unless organization_id.empty?\n users = users.where(organization_id: organization_id)\n else\n users = users.where(organization: @organization_list)\n end\n \n ### SORT ###\n users = users.order(current_user.table_sort_string :users)\n\n ### Rowify Everything ###\n column_prefs = current_user.column_preferences :users\n user_table = users.offset(offset).limit(page_size).map{ |u| u.rowify column_prefs}\n render status: 200, json: {count: users.count, rows: user_table}\n end",
"def sort_tables(default_column = 0)\n content_for :head do\n \"<script type=\\\"text/javascript\\\">\n $(document).ready(function() \n { \n $('table').tablesorter({widgets: ['zebra'], sortList: [[#{default_column}, 0]]}); \n } \n );\n </script>\"\n end\n end",
"def table_csv_string(options = {})\n opt = {\n :klass => nil,\n :header_row => true\n }.merge!(options)\n str = ''\n \n return false if !opt[:klass]\n\n klass_name = opt[:klass].name\n tbl = ActiveSupport::Inflector.tableize(opt[:klass].name.to_s)\n\n cols = []\n sql = ''\n\n if klass_name == \"Person\" \n cols = %w(id last_name first_name middle_name login)\n else\n cols = opt[:klass].columns.map(&:name) \n end\n\n cols_str = cols.join(\", \")\n\n case opt[:klass].name\n when \"Person\"\n sql = \"SELECT #{cols_str} FROM people p INNER JOIN people_projs pp on p.id = pp.person_id WHERE pp.proj_id = #{self.id};\"\n when \"Ref\"\n cols_str = cols.collect{|c| \"r.#{c}\"}.join(\", \") # refs shared across projects, be more explicit for the join table\n sql = \"SELECT #{cols_str} FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id};\"\n when \"TaxonName\"\n sql = \"SELECT #{cols_str} FROM taxon_names WHERE #{self.sql_for_taxon_names}\"\n when \"Author\"\n sql = \"SELECT #{cols_str} FROM authors a WHERE a.ref_id IN (SELECT r.id FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id})\"\n when \"ChrState\"\n sql = \"SELECT #{cols_str} FROM chr_states cs WHERE cs.chr_id IN (SELECT chrs.id from chrs WHERE chrs.proj_id = #{self.id})\" \n # when \"Identifier\"\n # sql = \"SELECT #{cols_str} FROM identifiers si WHERE si.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n when \"SpecimenDetermination\"\n sql = \"SELECT #{cols_str} FROM specimen_determinations sd WHERE sd.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n\n else\n sql = \"SELECT #{cols_str} FROM #{tbl}\" \n end\n\n # add the project level restrictions if they exist\n sql << \" WHERE proj_id = #{self.id}\" if opt[:klass].columns.collect{|c| c.name}.include?(\"proj_id\")\n\n # build the str\n str << cols.join(\"\\t\") if opt[:header_row]# the header row\n str << \"\\n\"\n\n ActiveRecord::Base.connection.select_rows(sql).each do |row| \n # not filtering for tab characters here, likely should\n str << row.collect{|c| c == nil ? nil : c.gsub(/\\n|\\r\\n|\\r/, '\\n')}.join(\"\\t\") + \"\\n\"\n end\n str\n end",
"def tables\n @entries = Table.includes(:outlet, :table_section).where(\"location_id=? #{@outlet_query}\", params[:location_id].to_i).paginate(:page => params[:page]) if request.xhr? \n end",
"def table_list(objetos, show_all_actions = true, options = {})\n render :partial => '/admin/shared/table_list', :locals => { :objetos => objetos, :show_all_actions => show_all_actions, :options => options }\n end",
"def check_sorted_table_with_class(sort_type, column_name)\n if sort_type == 'asc'\n @session.find(:css, '#table2 thead .'+column_name+'').click\n elsif sort_type == 'desc'\n @session.find(:css, '#table2 thead .'+column_name+'').click\n @session.find(:css, '#table2 thead .'+column_name+'').click\n else\n raise 'Error: Only asc and desc are supported'\n end\n dues_desc = @session.all(:css, '#table2 tbody .'+column_name+'')\n due_values_desc = ''\n dues_desc.each do |x|\n if x.text.include? '$'\n due_values_desc = dues_desc.map{|x| x.text.delete('$').to_f}\n else\n due_values_desc = dues_desc.map{|x| x.text}\n end\n end\n due_values_desc\n end",
"def table(*args, &block)\n params = args.present? && args.last.is_a?(Hash) ? args.pop : {}\n cl = params.delete(:class) || %w(table table-striped)\n cl = [cl] unless cl.is_a?(Array)\n\n options = {class: cl}.merge(params)\n content_tag :table, options do\n thead(args) +\n content_tag(:tbody, &block)\n end\n end",
"def render \n# search field name\n if @yaml['search'].to_s.match(/\\./)\n table, field_name, method = @yaml['search'].split(/\\.|\\,/) \n search = method.nil? ? field_name : \"#{field_name}.#{method}\"\n else # search and table name are separated\n search = field_name = @yaml['search']\n end\n# determine table name \n if @yaml['table']\n table = if @yaml['table'].class == String\n @yaml['table']\n# eval(how_to_get_my_table_name) \n elsif @yaml['table']['eval']\n eval @yaml['table']['eval']\n else\n p \"Field #{@yaml['name']}: Invalid table parameter!\"\n nil\n end\n end\n unless (table and search)\n @html << 'Table or search field not defined!' \n return self\n end\n# \n return ro_standard(table, search) if @readonly\n# TODO check if table exists \n collection = table.classify.constantize\n unless @record.respond_to?(@yaml['name'])\n @html << \"Invalid field name: #{@yaml['name']}\" \n return self\n end\n# put field to enter search data on form\n @yaml['html'] ||= {}\n @yaml['html']['value'] = '' # must be. Otherwise it will look into record and return error\n _name = '_' + @yaml['name']\n @html << '<table class=\"ui-autocomplete-table\"><td>'\n @html << @parent.link_to(@parent.fa_icon('plus-square lg', class: 'dc-animate dc-green'), '#',onclick: 'return false;') # dummy add. But it is usefull.\n\n record = record_text_for(@yaml['name']) \n @html << ' ' << @parent.text_field(record, _name, @yaml['html']) # text field for autocomplete\n @html << \"<div id =\\\"#{record}#{@yaml['name']}\\\">\" # div to list active records\n# find value for each field inside categories \n unless @record[@yaml['name']].nil?\n @record[@yaml['name']].each do |element|\n# this is quick and dirty trick. We have model dc_big_table which can be used for retrive \n# more complicated options\n# TODO retrieve choices from big_table\n rec = if table == 'dc_big_table'\n collection.find(@yaml['name'], @parent.session)\n else\n collection.find(element)\n end\n# Related data is missing. It happends.\n @html << if rec\n link = @parent.link_to(@parent.fa_icon('remove lg', class: 'dc-animate dc-red'), '#',\n onclick: \"$('##{rec.id}').hide(); var v = $('##{record}_#{@yaml['name']}_#{rec.id}'); v.val(\\\"-\\\" + v.val());return false;\")\n field = @parent.hidden_field(record, \"#{@yaml['name']}_#{rec.id}\", value: element)\n \"<div id=\\\"#{rec.id}\\\" style=\\\"padding:2px;\\\">#{link} #{rec.send(field_name)}<br>#{field}</div>\"\n else\n '** error **'\n end\n end\n end\n @html << \"</div></td></table>\"\n# Create text for div to be added when new category is selected \n link = @parent.link_to(@parent.fa_icon('remove lg', class: 'dc-animate dc-red'), '#', \n onclick: \"$('#rec_id').hide(); var v = $('##{record}_#{@yaml['name']}_rec_id'); v.val(\\\"-\\\" + v.val());return false;\")\n field = @parent.hidden_field(record, \"#{@yaml['name']}_rec_id\", value: 'rec_id')\n one_div = \"<div id=\\\"rec_id\\\" style=\\\"padding:2px;\\\">#{link} rec_search<br>#{field}</div>\"\n \n# JS stuff \n @js << <<EOJS\n$(document).ready(function() {\n $(\"##{record}_#{_name}\").autocomplete( {\n source: function(request, response) {\n $.ajax({\n url: \"#{ @parent.url_for( controller: 'dc_common', action: 'autocomplete' )}\",\n type: \"POST\",\n dataType: \"json\",\n data: { input: request.term, table: \"#{table}\", search: \"#{search}\" #{(',id: \"'+@yaml['id'] + '\"') if @yaml['id']} },\n success: function(data) {\n response( $.map( data, function(key) {\n return key;\n }));\n }\n });\n },\n change: function (event, ui) { \n var div = '#{one_div}';\n div = div.replace(/rec_id/g, ui.item.id)\n div = div.replace('rec_search', ui.item.value)\n $(\"##{record}#{@yaml['name']}\").append(div);\n $(\"##{record}_#{_name}\").val('');\n },\n minLength: 2\n });\n});\nEOJS\n\n self \nend",
"def get_model_query\n\n user_relational_query = User.using_client_shard(client: @client).\n where(client_id: @client_id).is_active.filter_by(@allowed_filters)\n user_relational_query.sorting_by(@sortings)\n end",
"def sort_td_class_helper(param)\n result = 'class=\"sortup\"' if params[:sort] == param\n result = 'class=\"sortdown\"' if params[:sort] == param + \"_reverse\"\n return result\n end",
"def to_html\n html = \"<table class='bodyTable'><thead><th>Name</th><th>Lines</th><th>LOC</th><th>Classes</th><th>Methods</th><th>M/C</th><th>LOC/M</th></thead><tbody>\"\n i = 0\n results = self.result.split(/$/)\n bottom = 4 if ENV[\"RAILS_ROOT\"].present?\n bottom ||= 3\n top = bottom\n while !results[bottom].nil? and results[bottom][0..1] != \"\\n+\" do\n bottom = bottom + 1\n end\n lines = results[top..bottom-1]\n lines.each do |line|\n elements = line.split(/\\|/)\n html = html + \"<tr class='#{ i % 2 == 0 ? 'a' : 'b'}'>\"\n html = html + \"<td><strong>#{elements[1]}</strong></td>\"\n html = html + \"<td style='text-align: right;'>#{elements[2]}</td>\"\n html = html + \"<td style='text-align: right;'>#{elements[3]}</td>\"\n html = html + \"<td style='text-align: right;'>#{elements[4]}</td>\"\n html = html + \"<td style='text-align: right;'>#{elements[5]}</td>\"\n html = html + \"<td style='text-align: right;'>#{elements[6]}</td>\"\n html = html + \"<td style='text-align: right;'>#{elements[7]}</td>\"\n html = html + \"</tr>\"\n i = i + 1\n end\n total = results[bottom + 1]\n elements = total.split(/\\|/)\n html = html + \"<tr class='#{ i % 2 == 0 ? 'a' : 'b'}'>\"\n html = html + \"<td><strong>#{elements[1]}</strong></td>\"\n [2,3,4,5,6,7].each do |j|\n html = html + \"<td style='text-align: right;'><strong>#{elements[j]}</strong></td>\"\n end\n html = html + \"</tr>\"\n html = html + \"</tbody></table>\"\n extra = results[bottom + 3]\n elements = extra.split(/:| /)\n @percent = (elements[3].strip.to_f * 100.0) / elements[1].strip.to_f\n return html\n end",
"def apply_sorting(query, sort_params)\n (sort_params[:sort] || {}).each do |idx, order|\n order = (order.to_i % 2 == 0) ? :asc : :desc\n filter = ajax_filters.find { |f| f.position == idx.to_i }\n\n next if filter.blank?\n\n klass = filter.klass || query.klass\n column = filter.column\n\n if filter.sorter_query.present?\n query = filter.sorter_query.call(query, order)\n else\n query = query.reorder(\"#{klass.table_name}.#{column} #{order} NULLS LAST\")\n end\n end\n\n query\n end",
"def content_sorter_path(type)\n \"//table[contains(@class, 'sticky-enabled')]/thead/tr/th/a[@title = 'sort by #{type}']\"\n end",
"def autocomplete\r\n # table parameter must be defined. If not, get it from search parameter\r\n if params['table'].nil? && params['search'].match(/\\./)\r\n name = params['search'].split('.').first\r\n params['table'] = name.underscore\r\n end\r\n if params['table'].match('_control')\r\n # it must be at least logged on\r\n return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW, 'dc_memory')\r\n else\r\n return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW)\r\n end\r\n\r\n table = params['table'].classify.constantize\r\n input = params['input'].gsub(/\\(|\\)|\\[|\\]|\\{|\\|\\.|\\,}/, '')\r\n # call method in class if search parameter contains . This is for user defined searches\r\n a = if params['search'].match(/\\./)\r\n #method, additional_params = params['search'].split('.')\r\n #data = additional_params ? table.send(method, input, additional_params, self) : table.send(method, input)\r\n name, method = params['search'].split('.')\r\n data = table.send(method, input)\r\n data.map do |v|\r\n { label: v[0], value: v[0], id: (v[1] || v[0]).to_s }\r\n end\r\n # will search and return field_name defined in params['search']\r\n else\r\n table.where(params['search'] => /#{input}/i).limit(20).map do |v|\r\n { label: v[params['search']], value: v[params['search']], id: v.id.to_s }\r\n end\r\n end\r\n\r\n render json: a\r\nend",
"def helper_datagrid_header(title,hash_search_action,hash_action_new,cabeceras,div_result)\n #title: el titulo que va en la cabecera, \"Listado de ....\"\n #hash_action_search: el controlador y la accion para el metodo buscar, {:controller=>'cargos',:action=>'search'}\n #hash_action_new: el label y la accion para el metodo new, si tiene remote, entonces la accion va en onclick\n #div_result: indica en que div se debe mostrar los resultados\n\n link_parameters = hash_search_action.merge({:remote=>'true', :direction => params[:direction], :sort => params[:sort], :term =>''})\n url = url_for link_parameters\n\n if hash_action_new.blank?\n render :partial => '/helper/datagrid_header' , :locals => {:title => title,:search_action=>url,:new_action => hash_action_new[:action],:no_new_action=>true,:cabeceras=>cabeceras, :div_result=>div_result}\n else\n render :partial => '/helper/datagrid_header' , :locals => {:title => title,:search_action=>url,:new_action => hash_action_new[:action],:new_action_label => hash_action_new[:label],:new_action_remote => hash_action_new[:remote],:cabeceras=>cabeceras, :div_result=>div_result}\n end\n end",
"def admin_table_heading(name, order_name, html_options = {})\n class_names = []\n if order_name == params[:order]\n class_names << 'sorted'\n class_names << (params[:direction].downcase == 'desc' ? 'descending' : 'ascending')\n\n new_order = (params[:direction].downcase == 'desc' ? 'asc' : 'desc')\n else\n new_order = 'asc'\n end\n class_names << html_options[:class]\n class_names.compact!\n html_options[:class] = class_names.length > 0 ? class_names.join(' ') : nil\n\n return content_tag(:th, content_tag(:a, name, :href => url_for(params.merge(:order => order_name, :direction => new_order))), html_options)\n end",
"def before_render\n select = get_select_query\n @model = @model.select(select) unless select.nil?\n @model = @model.order(@sort_before) unless @sort_before.blank?\n @model = @model.order(get_sort_query)\n @model = @model.order(@sort_after) unless @sort_after.blank?\n end",
"def sorting_logic\n if params[:sort_by] == \"score\"\n @reviews = @city.department_reviews.sort_by { |dr| dr.score }\n @reviews.reverse!\n render action: :index\n elsif params[:sort_by] == \"date\"\n @reviews = @city.department_reviews.order('created_at DESC')\n render action: :index\n elsif params[:sort_by] == \"endorsements\"\n @reviews = @city.department_reviews.sort_by { |dr| dr.votes_for.size }\n @reviews.reverse!\n render action: :index\n elsif params[:sort_by] == \"comments\"\n @reviews = @city.department_reviews.sort_by { |dr| dr.count_comments }\n @reviews.reverse!\n render action: :index\n elsif params[:sort_by] == \"trending\"\n @reviews = @city.department_reviews.sort_by { |dr| dr.hits }\n @reviews.reverse!\n render action: :index\n else \n @reviews = @city.department_reviews.sort_by { |dr| dr.hits }\n @reviews.reverse!\n render action: :index\n end \n end",
"def table\n projects = join_builder\n page = (table_params[:page] || 0).to_i\n page_size = (table_params[:page_size] || projects.count).to_i\n search = (table_params[:search])\n offset = page*page_size\n\n sort_column = table_params[:sort_column]\n sort_order = table_params[:sort_order]\n\n ### Update SORT Preferences ###\n if sort_column\n current_user.update_table_prefs(:projects, sort_column, sort_order)\n end\n\n query = nil \n if search\n searchable_columns = [:project_number, :fy_year, :title]\n search_string = \"%#{search}%\"\n search_year = (is_number? search) ? search.to_i : nil \n query = (query_builder(searchable_columns, search_string))\n .or(org_query search_string)\n .or(capital_project_type_query search_string)\n projects = projects.where(query)\n end\n\n projects = projects.order(current_user.table_sort_string :projects)\n \n project_table = projects.offset(offset).limit(page_size).map{ |p| p.rowify }\n render status: 200, json: {count: projects.count, rows: project_table} \n\n end",
"def typus_table_header(model, fields)\n returning(String.new) do |html|\n headers = []\n fields.each do |key, value|\n order_by = model.reflect_on_association(key.to_sym).primary_key_name rescue key\n sort_order = (params[:sort_order] == 'asc') ? 'desc' : 'asc'\n if (model.model_fields.map(&:first).collect { |i| i.to_s }.include?(key) || model.reflect_on_all_associations(:belongs_to).map(&:name).include?(key.to_sym)) && params[:action] == 'index'\n headers << \"<th>#{link_to \"<div class=\\\"#{sort_order}\\\">#{t(key.humanize)}</div>\", { :params => params.merge(:order_by => order_by, :sort_order => sort_order) }}</th>\"\n else\n headers << \"<th>#{t(key.humanize)}</th>\"\n end\n end\n headers << \"<th> </th>\"\n html << <<-HTML\n<tr>\n#{headers.join(\"\\n\")}\n</tr>\n HTML\n end\n end",
"def index\n \n get_table_name #method for table_names and model_names \n\n get_table_column_name # method for table_name, column_names and model_name \n\n get_table_data # method for table data\n\n @model_data = []\n \n @model_data = @model_name.order(sort_column + \" \" + sort_direction).page(params[:page]).per(10)\n\n respond_to do |format|\n\t format.html\n\t format.json\n \tend\n\n end",
"def column_sort_link(title, column, paramval, width, align, options = {},stage=nil,column_name=nil,assigned_to=nil,dropdown=nil)\n params.merge!(:paramval=>paramval)\n options.merge!({:letter => params[:letter]}) unless (params[:letter].nil? || params[:letter].empty?) \n if assigned_to && column==column_name\n content_tag 'th', sort_link_new(title, column, paramval, width, align, options)+ (options[:search_item] ? \"<div style='position: absolute; bottom: 0;'>#{eval(dropdown)}</div>\" : \"</div>\"),\n :width => width, :align => align,\n :class => (options[:class].blank? ? \"tablesorter\" : options[:class])\n elsif stage && column==column_name\n content_tag 'th', sort_link_new(title, column, paramval, width, align, options)+ (options[:search_item] ? \"<div style='position: absolute; bottom: 0;'>#{eval(dropdown)}</div>\" : \"</div>\"),\n :width => width, :align => align,\n :class => (options[:class].blank? ? \"tablesorter\" : options[:class])\n else\n content_tag 'th', sort_link_new(title, column, paramval, width, align, options)+ (options[:search_item] ? \"<div style='position: absolute; bottom: 0;'><input type='text' style=#{options[:search_items] ? \"width:60px;\" : \"width:60px;display:none;\"} size='5' value='#{params[:search] ? params[:search][column.sub(\".\",\"--\")] || params[:search][column] : \"\"}' name='search[#{column.sub(\".\",\"--\")}]' id= 'search_#{column.sub(\".\",\"--\")}' /></div></div>\" : \"</div>\"),\n :width => width, :align => align,\n :class => (options[:class].blank? ? \"tablesorter\" : options[:class])\n end\n end",
"def autocomplete\r\n# return '' unless session[:edit_mode] > 0 # \r\n return render text: t('drgcms.not_authorized') unless dc_user_can(DcPermission::CAN_VIEW)\r\n# TODO Double check if previous line works as it should.\r\n table = params['table'].classify.constantize\r\n id = [params['id']] || '_id'\r\n# call method in class if search parameter has . This is for user defined searches\r\n# result must be returned as array of [id, search_field_value]\r\n a = if params['search'].match(/\\./)\r\n name, method = params['search'].split('.')\r\n table.send(method, params['input']).inject([]) do |r,v|\r\n r << { label: v[0], value: v[0], id: v[1].to_s }\r\n end\r\n# simply search which will search and return field_name defined in params['search']\r\n else\r\n table.where(params['search'] => /#{params['input']}/i).limit(20).inject([]) do |r,v|\r\n r << { label: v[params['search']], value: v[params['search']], id: v.id.to_s }\r\n end\r\n end\r\n\r\n render inline: a.to_json, formats: 'js'\r\nend",
"def query_table\n raise StandardError, 'The query is not defined yet' if query.nil?\n return query.arel_table if relation_query?(query)\n @query_table\n end",
"def query_table\n raise StandardError, 'The query is not defined yet' if query.nil?\n return query.arel_table if relation_query?(query)\n @query_table\n end",
"def sorter\n BrowseEverything::Driver::Base.sorter\n end",
"def table options = {} \n render_partial :table, template_locals(:table_row, options)\n end",
"def query_sort(query)\n return query unless has_sort_params?\n\n apply_sort(query, @table, @sorting[:order_by], @valid_fields + @custom_fields2.keys, @sorting[:direction])\n end",
"def index\n\n #the following sort order items are sorted by the model\n unless params[:id].nil?\n case true\n when params[:id] == \"model\"\n Classified.set_order_var( \" makes.name , models.name ASC \")\n @classifieds = Classified.available_sorted\n when params[:id] == \"stock_code\"\n Classified.set_order_var( params[:id] << \" ASC\")\n @classifieds = Classified.available_sorted\n when params[:id] == \"price_in_cents\"\n Classified.set_order_var( params[:id] << \" DESC\")\n @classifieds = Classified.available_sorted\n when params[:id] == \"colour\"\n Classified.set_order_var( params[:id] << \" ASC\")\n @classifieds = Classified.available_sorted\n when params[:id] == \"days_in_stock\"\n Classified.set_order_var( params[:id] << \" DESC \" )\n @classifieds = Classified.available_sorted\n when params[:id] == \"mileage\"\n Classified.set_order_var( params[:id] << \" DESC \" )\n @classifieds = Classified.available_sorted\n when params[:id] == \"views\" || params[:id] == \"forms_sent\" || params[:id] == \"conversions\"\n @classifieds = Classified.available\n end\n else\n Classified.set_order_var(\"\")\n @classifieds = Classified.available\n end\n\n\n #the following params[:id] values cause the array to be sorted as the values\n # to be sorted are added to the array programmatically\n unless params[:id].nil?\n case true\n when params[:id] == \"views\" \n @classifieds.sort! {|a, b| a.stats_count <=> b.stats_count}\n @classifieds.reverse!\n when params[:id] == \"forms_sent\"\n @classifieds.sort! {|a, b| a.form_count <=> b.form_count}\n @classifieds.reverse!\n when params[:id] == \"conversions\"\n @classifieds.sort! {|a, b| a.conversions.to_f <=> b.conversions.to_f}\n @classifieds.reverse!\n end\n end\n #@classifieds.reverse!\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end",
"def plantilla_colocar_tabla(usuarios,historiales,cabecera_notas, tipo_evaluaciones, accion, editar)\n form_tag accion do\n haml_tag(:table, :class => 'tablesorter', :id => \"ingles\") do\n haml_tag :thead do\n haml_tag :tr do\n haml_tag :th, '#'\n haml_tag :th, 'Nombres'\n haml_tag :th, 'Cédula'\n haml_tag :th, cabecera_notas[0]\n haml_tag :th, cabecera_notas[1]\n haml_tag :th, cabecera_notas[2]\n haml_tag :th, cabecera_notas[3]\n haml_tag :th, 'Final'\n haml_tag :th, 'Descripción'\n end\n end\n haml_tag :tbody do \n historiales.each_with_index{ |h,i|\n haml_tag :tr do\n haml_tag :td, i+1\n haml_tag :td, h.usuario.nombre_completo\n haml_tag :td, h.usuario.ci\n valor = nil\n valor = h.nota_en_evaluacion(tipo_evaluaciones[0]).nota_valor\n if editar\n haml_tag :td do\n if valor != HistorialAcademico::SC\n haml_concat (text_field :nota1,h.usuario.ci, \\\n {:value => valor, :maxlength => 5})\n else\n haml_concat(text_field :nota1,h.usuario.ci,{:placeholder => \"SC\",:maxlength => 5})\n end\n end\n else\n haml_tag :td, valor\n end\n \n valor = h.nota_en_evaluacion(tipo_evaluaciones[1]).nota_valor\n \n if editar\n haml_tag :td do\n if valor != HistorialAcademico::SC\n haml_concat (text_field :nota2,h.usuario.ci, \\\n {:value => valor, :maxlength => 5})\n else\n haml_concat(text_field :nota2,h.usuario.ci,{:placeholder => \"SC\",:maxlength => 5})\n end\n end\n else\n haml_tag :td, valor\n end\n\n valor = h.nota_en_evaluacion(tipo_evaluaciones[2]).nota_valor\n \n if editar\n haml_tag :td do\n if valor != HistorialAcademico::SC\n haml_concat (text_field :nota3,h.usuario.ci, \\\n {:value => valor, :maxlength => 5})\n else\n haml_concat(text_field :nota3,h.usuario.ci,{:placeholder => \"SC\",:maxlength => 5})\n end\n end\n else\n haml_tag :td, valor\n end\n\n valor = h.nota_en_evaluacion(tipo_evaluaciones[3]).nota_valor\n\n if editar\n haml_tag :td do\n if valor != HistorialAcademico::SC\n haml_concat (text_field :nota4,h.usuario.ci, \\\n {:value => valor, :maxlength => 5})\n else\n haml_concat(text_field :nota4,h.usuario.ci,{:placeholder => \"SC\",:maxlength => 5})\n end\n end\n else\n haml_tag :td, valor\n end\n \n if h.nota_final != HistorialAcademico::SC\n haml_tag(:td,:id => \"nota_final_\"+h.usuario.ci) do\n haml_concat HistorialAcademico.colocar_nota(h.nota_final)\n end\n else \n haml_tag(:td,:id => \"nota_final_\"+h.usuario.ci) do\n haml_concat \"SC\"\n end\n end\n if h.nota_final == -1\n valor = -1\n else\n valor = h.nota_final\n end\n if editar\n haml_concat(hidden_field :notafinal,h.usuario.ci,{:value => valor})\n end\n \n haml_tag :td do\n haml_tag(:div, :id => \"descripcion_#{h.usuario.ci}\") do\n haml_concat HistorialAcademico::NOTASPALABRAS[h.nota_final+2]\n end\n end\n end\n }\n end\n end \n if editar\n haml_tag :br\n haml_concat(submit_tag :Calificar)\n end\n end \n end",
"def result \n # Get appropriate search types\n case params[:search_type]\n when \"purchase_order_search\"\n @class = PurchaseOrder\n @css_class = \"purchaseorders\"\n @name = \"Purchase Orders\"\n when \"keycodes_search\"\n @class = Key\n @css_class = \"keycodes\"\n @name = \"Key Codes\"\n when \"end_user_search\"\n @class = EndUser\n @css_class = \"endusers\"\n @name = \"End Users\"\n when \"purchaser_search\"\n @class = Purchaser\n @css_class = \"purchasers\"\n @name = \"Purchaser\"\n when \"assignment_search\"\n @class = Relationship\n @css_class = \"assignments\"\n @name = \"Assignments\"\n end\n \n # Execute search and sort results based on selected model\n @search = @class.search(params[:q])\n @list = @search.result\n @search.build_condition if @search.conditions.empty?\n @search.build_sort if @search.sorts.empty?\n end",
"def ordering_query; end",
"def get_sorted_objects(params, options={})\n objects = options[:objects].nil? ? sortable_class : options[:objects]\n include_rel = options[:include_relations].nil? ? sortable_include_relations : options[:include_relations]\n @headings = options[:table_headings].nil? ? sortable_table_headings : options[:table_headings]\n @column_procs = options[:sortable_column_procs].nil? ? sortable_column_procs : options[:sortable_column_procs]\n sort_map = options[:sort_map].nil? ? sortable_sort_map : HashWithIndifferentAccess.new(options[:sort_map])\n default_sort = options[:default_sort].nil? ? sortable_default_sort : options[:default_sort]\n conditions = options[:conditions].nil? ? '' : options[:conditions]\n search_array = options[:search_array].nil? ? sortable_search_array : options[:search_array]\n search_type = options[:search_type].nil? ? sortable_search_type : options[:search_type]\n search_conditions = options[:search_conditions].nil? ? sortable_search_conditions : options[:search_conditions]\n\n conditions = process_search(params, conditions, {:search_array => search_array, :search_type => search_type, :search_conditions => search_conditions})\n items_per_page = options[:per_page].nil? ? sortable_per_page : options[:per_page]\n\n @sort_map = sort_map\n sort = process_sort(params, sort_map, default_sort)\n page = params[:page]\n page ||= 1\n # fetch the objects, paginated and sorted as desired along with any extra filtering conditions\n get_paginated_objects(objects, sort, include_rel, conditions, page, items_per_page)\n end",
"def show\n @trtype = Trtype.find(params[:id])\n # want to make sql for view\n v_column_array = [\"trfiles.subjectid\",\"trfiles.secondary_key\",\"trfiles.enrollment_id\",\"trfiles.scan_procedure_id\", \"trfiles.file_completed_flag\",\"trfiles.qc_value\",\"trfiles.qc_notes\"]\n v_table_array = [\"trfiles\"]\n v_table_conditions =[\"trfiles.trtype_id = \"+params[:id]+\" \"]\n\n @tractiontypes = Tractiontype.where(\"trtype_id in (?)\",params[:id]).where(\"tractiontypes.form_display_label is not null and tractiontypes.form_display_label >''\" ).order(:display_order)\n @tractiontypes.each do |act|\n v_value_sql = \"\"\n # (\"trfiles.id = v_\"+act.id.to_s+\".trfile_id\")\n v_col = (act.form_display_label).gsub(/ /,\"\").gsub(/\\'/,\"_\").gsub(/\\\"/,\"_\").gsub(/\\-/,\"_\").downcase+\"_\" \n v_column_array.push(\"v_\"+act.id.to_s+\".\"+v_col) \n # need last edit\n if !act.ref_table_b_1.blank?\n v_value_sql = \"LEFT JOIN (select \"+act.ref_table_a_1+\".description \"+v_col+\", trfile2.id trfile_id from trfiles trfile2, tredits , tredit_actions, \"+act.ref_table_a_1+\" \n where trfile2.id = tredits.trfile_id \n and tredits.id = tredit_actions.tredit_id \n and tredit_actions.tractiontype_id = \"+act.id.to_s+\" \n and \"+act.ref_table_a_1+\".label = '\"+act.ref_table_b_1+\"'\n and tredit_actions.value = \"+act.ref_table_a_1+\".ref_value\n and tredits.id in ( select max(tredit2.id) from tredits tredit2 where tredit2.trfile_id = trfile2.id) ) v_\"+act.id.to_s+\" on trfiles.id = v_\"+act.id.to_s+\".trfile_id \"\n v_table_array.push(v_value_sql)\n\n elsif !act.ref_table_a_1.blank?\n v_value_sql = \"LEFT JOIN (select \"+act.ref_table_a_1.pluralize.underscore+\".description \"+v_col+\", trfile2.id trfile_id from trfiles trfile2, tredits , tredit_actions, \"+act.ref_table_a_1.pluralize.underscore+\" \n where trfile2.id = tredits.trfile_id \n and tredits.id = tredit_actions.tredit_id \n and tredit_actions.tractiontype_id = \"+act.id.to_s+\" \n and \"+act.ref_table_a_1+\".label = '\"+act.ref_table_b_1+\"'\n and tredit_actions.value = \"+act.ref_table_a_1.pluralize.underscore+\".id\n and tredits.id in ( select max(tredit2.id) from tredits tredit2 where tredit2.trfile_id = trfile2.id) ) v_\"+act.id.to_s+\" on trfiles.id = v_\"+act.id.to_s+\".trfile_id \"\n v_table_array.push(v_value_sql)\n\n else\n v_value_sql = \"LEFT JOIN (select tredit_actions.value \"+v_col+\", trfile2.id trfile_id from trfiles trfile2, tredits , tredit_actions \n where trfile2.id = tredits.trfile_id \n and tredits.id = tredit_actions.tredit_id \n and tredit_actions.tractiontype_id = \"+act.id.to_s+\" \n and tredits.id in ( select max(tredit2.id) from tredits tredit2 where tredit2.trfile_id = trfile2.id) ) v_\"+act.id.to_s+\" on trfiles.id = v_\"+act.id.to_s+\".trfile_id \"\n v_table_array.push(v_value_sql)\n end\n end\n # using LEFT JOIN\n @sql_view = \"select * from ( select \"+v_column_array.join(',')+\" from \"+v_table_array.join(' ')+\" where \"+v_table_conditions.join(' and ') +\" ) t1\"\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trtype }\n end\n end",
"def process_grid(opts = {})\n klass = opts[:klass] || nil\n column_defs = opts[:column_defs] || nil\n q = opts[:q] || nil\n filter_params = opts[:filter_params] || nil\n page = opts[:page] || DEFAULT_PAGE\n per_page = opts[:per_page] || DEFAULT_PER_PAGE\n sort_info = opts[:sort_info] || DEFAULT_SORT_INFO\n enable_paging = opts[:enable_paging].nil? ? DEFAULT_ENABLE_PAGING : opts[:enable_paging].to_bool\n join_objects = opts[:join_objects] || []\n field_lookup = opts[:field_lookup] || {}\n custom_where_query = opts[:custom_where_query] || nil\n group_by_query = opts[:group_by_query] || nil\n\n # Enforce default values\n page ||= DEFAULT_PAGE\n per_page ||= DEFAULT_PER_PAGE\n sort_info ||= DEFAULT_SORT_INFO\n\n # Parse parameters into correct format\n column_defs = parse_params(column_defs)\n filter_params = parse_params(filter_params)\n page = page.to_i\n per_page = per_page.to_i\n sort_info = parse_params(sort_info)\n field_lookup = parse_params(field_lookup)\n\n # Check for client errors\n raise \"Invalid per_page parameter. Valid values are #{VALID_PER_PAGES}\" unless VALID_PER_PAGES.include?(per_page)\n sort_info ||= {}\n\n # select\n select_query = process_select(klass, column_defs, field_lookup)\n objects = klass.select(select_query)\n\n # join (optional)\n objects = [join_objects].flatten.compact.inject(objects, :joins) unless [join_objects].flatten.compact.empty?\n\n # where\n objects = objects.where(custom_where_query) if custom_where_query\n if filter_params\n where_query = process_advanced_search_query_where(column_defs, filter_params, field_lookup)\n else\n where_query = process_where(column_defs, q, field_lookup)\n end\n objects = objects.where(where_query)\n\n # group\n if group_by_query\n objects = objects.group(group_by_query)\n\n # Convert objects from group_by_query to array\n # so its size can be grokked\n objects.to_a\n end\n\n # Force per_page value with total_entries and page value with 1.\n # Happens when pagination is disabled.\n unless enable_paging\n per_page = objects.size\n page = 1\n end\n\n # pagination\n # TODO: @ralibi this is fix for total entries when using group by query and\n # pagination\n objects = objects.paginate(page: page, per_page: per_page, total_entries: objects.size)\n\n # order\n order_query = process_order(sort_info, field_lookup)\n objects = objects.reorder(order_query) unless objects.empty?\n\n objects\n end",
"def crud_table(*attrs, &block)\n options = attrs.extract_options!\n attributes = (block_given? || attrs.present?) ? attrs : default_attrs\n first = attributes.shift\n table(entries, options) do |t|\n col_show(t, first) if first\n t.sortable_attrs(*attributes)\n yield t if block_given?\n add_table_actions(t)\n end\n end",
"def query_data(base_query)\n query = base_query\n result = Hash.new\n\n # Filters\n query = apply_filters(query, tablesorter_params)\n\n # Calculate row counts\n rec_counts = record_counts(base_query, query)\n result[:filtered_rows] = rec_counts[:filtered_rows]\n result[:total_rows] = rec_counts[:total_rows]\n\n # Handle paging afterwards\n query = handle_pagination(query, tablesorter_params, result)\n\n # Sorting\n query = apply_sorting(query, tablesorter_params)\n\n result[:records] = query\n\n result\n end",
"def create_table objects, columns, title, date_param = nil, nosort = false\n\t\tcurr_user = current_user\n\t\n\t\tid_to_names = [\"trip_id\",\"destination_id\",\"bus_id\"]\n\t\ttimes = [\"depart_time\",\"arrive_time\",\"return_time\"]\n\t\tdates = [\"date\",\"start\",\"expiry\",\"offset_date\",\"start_date\",\"end_date\",\"created_at\",\"updated_at\"]\n\t\tno_management = [\"permissions\", \"roles\"]\n\t\tmanagement_headers = [\"updated_by\",\"created_at\",\"updated_at\"]\n\t\t\n\t\thtml = \"\"\n\t\thtml << '<h1>'.html_safe\n\t\thtml << title\n\t\t\n\t\thtml << '</h1>'.html_safe\n\t\t\n\t\thtml << '<table class=\"admin_table\">'.html_safe\n\t\t\n\t\thtml << '<tr class=\"tr_header\">'.html_safe\n\t\tcolumns.each do |col|\n\t\t\t\n\t\t\tcol_title = col\n\t\t\t\n\t\t\tif col.include? '_id' then col_title = col.split('_id')[0] end\n\t\t\t\n\t\t\tif management_headers.include? col\n\t\t\t\tif curr_user.has_permission? :management\n\t\t\t\t\thtml << '<th>'.html_safe\n\t\t\t\t\tif !nosort \n\t\t\t\t\t\thtml << sort_table(col, col_title.humanize, date_param).html_safe\n\t\t\t\t\telse\n\t\t\t\t\t\thtml << col_title.humanize\n\t\t\t\t\tend\n\t\t\t\t\thtml << '</th>'.html_safe\n\t\t\t\tend\n\t\t\telse\n\t\t\t\thtml << '<th>'.html_safe\n\t\t\t\tif !nosort \n\t\t\t\t\thtml << sort_table(col, col_title.humanize, date_param).html_safe\n\t\t\t\telse\n\t\t\t\t\thtml << col_title.humanize\n\t\t\t\tend\n\t\t\t\thtml << '</th>'.html_safe\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\t\t# Show Column\n\t\thtml << '<th></th>'.html_safe\n\t\t\n\t\t# Edit Column\n\t\tif (curr_user.has_permission? :admin) || (!(no_management.include? objects[0].class.name.tableize) && (curr_user.has_permission? :management))\n\t\t\thtml << '<th></th>'.html_safe\n\t\tend\n\t\t\n\t\t# Destroy Column\n\t\tif curr_user.has_permission? :admin\n\t\t\thtml << '<th></th>'.html_safe\n\t\tend\n\t\t\n\t\thtml << '</tr>'.html_safe\n\t\t\n\t\ti = 0\n\t\tobjects.each do |obj|\n\t\t\tif i.even?\n\t\t\t\thtml << '<tr class=\"tr_alt_1\">'.html_safe\n\t\t\telse\n\t\t\t\thtml << '<tr class=\"tr_alt_2\">'.html_safe\n\t\t\tend\n\t\t\t\tcolumns.each do |col|\n\t\t\t\t\t\n\t\t\t\t\tif id_to_names.include? col\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\tcol = col.split('_id')[0]\n\t\t\t\t\t\thtml << (link_to obj.send(col).id.to_s + \": \" + obj.send(col).name, obj.send(col)).html_safe\n\t\t\t\t\telsif col == \"user_id\" || col == \"updated_by\"\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\tcol = col.split('_id')[0]\n\t\t\t\t\t\tif obj.send(col)\n\t\t\t\t\t\t\thtml << (link_to obj.send(col).userid, obj.send(col)).html_safe\n\t\t\t\t\t\tend\n\t\t\t\t\telsif col == \"id\"\n\t\t\t\t\t\thtml << '<td class=\"td_links\">'.html_safe\n\t\t\t\t\t\thtml << obj.send(col).to_s\n\t\t\t\t\telsif col == \"weekday\"\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\thtml << Date::DAYNAMES[obj.send(col)]\n\t\t\t\t\telsif times.include? col\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\thtml << obj.send(col).strftime(\"%I:%M %p\")\n\t\t\t\t\telsif dates.include? col\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\thtml << obj.send(col).strftime(\"%B %d, %Y\")\n\t\t\t\t\telsif col.include? \"_id\"\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\tcol = col.split('_id')[0]\n\t\t\t\t\t\tif obj.send(col)\n\t\t\t\t\t\t\thtml << (link_to obj.send(col).id.to_s, obj.send(col)).html_safe\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\thtml << obj.send(col).to_s\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\thtml << '</td>'.html_safe\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Show Column\n\t\t\t\thtml << '<td class=\"td_links\">'.html_safe\n\t\t\t\thtml << (link_to \"Show\", obj).html_safe\n\t\t\t\thtml << '</td>'.html_safe\n\t\t\t\t\n\t\t\t\t# Edit Column\n\t\t\t\tif (curr_user.has_permission? :admin) || (!(no_management.include? objects[0].class.name.tableize) && (curr_user.has_permission? :management))\n\t\t\t\t\thtml << '<td class=\"td_links\">'.html_safe\n\t\t\t\t\thtml << (link_to \"Edit\", \"/\" + obj.class.name.tableize + \"/\" + obj.id.to_s + \"/edit\").html_safe\n\t\t\t\t\thtml << '</td>'.html_safe\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Destroy Column\n\t\t\t\tif curr_user.has_permission? :admin\n\t\t\t\t\thtml << '<td class=\"td_links\">'.html_safe\n\t\t\t\t\thtml << (link_to \"Destroy\", obj, :confirm => 'Are you sure?', :method => :delete).html_safe\n\t\t\t\t\thtml << '</td>'.html_safe\n\t\t\t\tend\n\t\t\n\t\t\thtml << '</tr>'.html_safe\n\t\t\ti = i + 1\n\t\tend\n\t\t\n\t\thtml << '</table>'.html_safe\n\t\t\n\t\thtml.html_safe\n\tend",
"def display_search_results_row(object)\n user_column_fields.reduce(String.new) do |string, field|\n string << (tag.td object.send(field))\n end\n .html_safe +\n display_user_posts(object.posts)\n end",
"def index\n @tasks = Task.find_by_sql(\"SELECT * FROM tasks ORDER BY CASE status\n WHEN '' THEN 1\n WHEN 'in progress' THEN 2\n WHEN 'reviewing' THEN 3\n WHEN 'done' THEN 4 END\")\n @sortType = params[:sort]\n\n if @sortType == \"title\"\n @tasks = Task.find_by_sql(\"SELECT * FROM tasks ORDER BY title ASC\")\n end\n\n if @sortType == \"status\"\n @tasks = Task.find_by_sql(\"SELECT * FROM tasks ORDER BY CASE status\n WHEN '' THEN 1\n WHEN 'in progress' THEN 2\n WHEN 'reviewing' THEN 3\n WHEN 'done' THEN 4 END\")\n end\n\n if @sortType == \"description\"\n @tasks = Task.find_by_sql(\"SELECT * FROM tasks ORDER BY description ASC\")\n end\n\n if @sortType == \"deadline\"\n @tasks = Task.find_by_sql(\"SELECT * FROM tasks ORDER BY deadline ASC\")\n end\n\n\n if @sortType == \"story_points\"\n @tasks = Task.find_by_sql(\"SELECT * FROM tasks ORDER BY story_points ASC\")\n end\n\n if @sortType == \"priority\"\n @tasks = Task.find_by_sql(\"SELECT * FROM tasks ORDER BY CASE priority\n WHEN '' THEN 1\n WHEN 'high' THEN 2\n WHEN 'medium' THEN 3\n WHEN 'low' THEN 4 END\")\n end\n @project = Project.find(params[:project_id])\n @sprint = Sprint.find(params[:sprint_id])\n end",
"def report_table(output, sort, options = {}, &block)\n output.puts\n\n top_categories = output.slice_results(sorted_by(sort))\n output.with_style(:top_line => true) do \n output.table(*statistics_header(:title => options[:title],:highlight => sort)) do |rows|\n top_categories.each { |(cat, info)| rows.push(statistics_row(cat)) }\n end\n end\n output.puts\n end",
"def sorter_query\n @options[:sorter_query].presence\n end",
"def queryable_class\n @queryable_class || self.class.queryable_class\n end",
"def sorting\n @records = Record.all #Get existing records\n @sortType = params[:sortType] #Get parameters from the form on index\n @sortField = params[:sortField]\n\n @limit = params[:sortNum].to_i # params must be converted from string\n\n if @sortType == \"Decending\" # check if sort direction is decending\n case @sortField #check what header to sort by\n when \"id\" # when table header is ID sort by ID descending\n @sortedSet = Record.order(id: :desc).limit(@limit)\n when \"REF_DATE\"\n @sortedSet = Record.order(REF_DATE: :desc).limit(@limit)\n when \"GEO\"\n @sortedSet = Record.order(GEO: :desc).limit(@limit)\n when \"DGUID\"\n @sortedSet = Record.order(DGUID: :desc).limit(@limit)\n when \"Sex\"\n @sortedSet = Record.order(Sex: :desc).limit(@limit)\n when \"Age_group\"\n @sortedSet = Record.order(Age_group: :desc).limit(@limit)\n when \"Student_response\"\n @sortedSet = Record.order(Student_response: :desc).limit(@limit)\n when \"UOM\"\n @sortedSet = Record.order(UOM: :desc).limit(@limit)\n when \"UOM_ID\"\n @sortedSet = Record.order(UOM_ID: :desc).limit(@limit)\n when \"SCALAR_FACTOR\"\n @sortedSet = Record.order(SCALAR_FACTOR: :desc).limit(@limit)\n when \"SCALAR_ID\"\n @sortedSet = Record.order(SCALAR_ID: :desc).limit(@limit)\n when \"VECTOR\"\n @sortedSet = Record.order(VECTOR: :desc).limit(@limit)\n when \"COORDINATE\"\n @sortedSet = Record.order(COORDINATE: :desc).limit(@limit)\n when \"VALUE\"\n @sortedSet = Record.order(VALUE: :desc).limit(@limit)\n when \"STATUS\"\n @sortedSet = Record.order(STATUS: :desc).limit(@limit)\n when \"SYMBOL\"\n @sortedSet = Record.order(SYMBOL: :desc).limit(@limit)\n when \"TERMINATED\"\n @sortedSet = Record.order(TERMINATED: :desc).limit(@limit)\n when \"DECIMALS\"\n @sortedSet = Record.order(DECIMALS: :desc).limit(@limit)\n \n end # end case/when\n else # if not decending its ascending\n case @sortField # check header to sort by\n when \"id\" # when table header is ID sort by ID ascending\n @sortedSet = Record.order(id: :asc).limit(@limit)\n when \"REF_DATE\"\n @sortedSet = Record.order(REF_DATE: :asc).limit(@limit)\n when \"GEO\"\n @sortedSet = Record.order(GEO: :asc).limit(@limit)\n when \"DGUID\"\n @sortedSet = Record.order(DGUID: :asc).limit(@limit)\n when \"Sex\"\n @sortedSet = Record.order(Sex: :asc).limit(@limit)\n when \"Age_group\"\n @sortedSet = Record.order(Age_group: :asc).limit(@limit)\n when \"Student_response\"\n @sortedSet = Record.order(Student_response: :asc).limit(@limit)\n when \"UOM\"\n @sortedSet = Record.order(UOM: :asc).limit(@limit)\n when \"UOM_ID\"\n @sortedSet = Record.order(UOM_ID: :asc).limit(@limit)\n when \"SCALAR_FACTOR\"\n @sortedSet = Record.order(SCALAR_FACTOR: :asc).limit(@limit)\n when \"SCALAR_ID\"\n @sortedSet = Record.order(SCALAR_ID: :asc).limit(@limit)\n when \"VECTOR\"\n @sortedSet = Record.order(VECTOR: :asc).limit(@limit)\n when \"COORDINATE\"\n @sortedSet = Record.order(COORDINATE: :asc).limit(@limit)\n when \"VALUE\"\n @sortedSet = Record.order(VALUE: :asc).limit(@limit)\n when \"STATUS\"\n @sortedSet = Record.order(STATUS: :asc).limit(@limit)\n when \"SYMBOL\"\n @sortedSet = Record.order(SYMBOL: :asc).limit(@limit)\n when \"TERMINATED\"\n @sortedSet = Record.order(TERMINATED: :asc).limit(@limit)\n when \"DECIMALS\"\n @sortedSet = Record.order(DECIMALS: :asc).limit(@limit) \n end\n end\n \n end",
"def sort_column klass, default_column = \"title_sort\"\n klass.constantize.column_names.include?(params[:sort]) ? params[:sort] : default_column\n end",
"def sort_column klass, default_column = \"title_sort\"\n klass.constantize.column_names.include?(params[:sort]) ? params[:sort] : default_column\n end",
"def index_for objects, html_options = {}, &block\n html_options = html_options.dup\n\n tag = html_options[:table_tag] || IndexFor.table_tag\n\n klass = html_options[:klass] || objects.try(:klass) || objects.first.class\n\n html_options[:id] ||= index_for_id(klass)\n html_options[:class] = index_for_class(klass, html_options)\n\n head = index_for_head(klass.new, html_options, &block)\n body = index_for_body(objects, html_options, &block)\n content = head + body\n\n content_tag(tag, content, html_options)\n end",
"def index\n if request.xhr?\n @data = InstructorInfo.search(params)\n sort_by = params[:sort_by]\n order_by = params[:order_by]\n\n if sort_by == 'price'\n @results = @data.order(\"min_price #{order_by}\")\n else\n arr=[]\n @results = []\n @data.each do |obj|\n arr << [obj.id, obj.user_info.user.get_rating]\n end\n sorted_arr = arr.sort {|a,b| a[1] <=> b[1]}\n sorted_arr = sorted_arr.reverse if order_by == 'desc'\n sorted_arr.each{|obj| @results << InstructorInfo.find(obj[0]) }\n end\n else\n if params[:service].present? || params[:specialization].present?\n @results = InstructorInfo.search(params)\n @service = params[:service] #pass in service to view, and ajax will be able to send back for order-by\n @specialization = params[:specialization] #pass in specialization to view, and ajax will be able to send back for order-by\n else\n @results = InstructorInfo.limit(20)\n end\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.haml\n format.json {\n page = 1\n\n page = params[:iDisplayStart].to_i/10+1 if params[:iDisplayStart]\n e = Course\n e = e.joins(:instructor, :college)\n\n total_record_size = 0\n display_length = 10\n\n if params[:iDisplayLength].to_i > 10\n display_length = params[:iDisplayLength].to_i\n end\n\n if params[:iSortCol_0].to_i != 0\n sort_column = DatatableFields[params[:iSortCol_0].to_i]\n sort_direction = params[:sSortDir_0]\n if [\"instructor\", \"college\"].include?(sort_column)\n sc = \"\"\n case sort_column\n when /instructor/\n sc = \"instructors.name\"\n when /college/\n sc = \"colleges.college_tag\"\n end\n e = e.order(\"#{sc} #{sort_direction}\")\n else\n e = e.order(\"#{sort_column} #{sort_direction}\")\n end\n end\n\n\n if params[:sSearch] != \"\" && !params[:sSearch].nil?\n \n search = DatatableFields.collect{|d| \"#{d} LIKE '%#{params[:sSearch]}%'\" unless [\"college\",\"instructor\", \"add\", \"friends\"].include?(d) }.compact.join(' OR ')\n search2 = \" OR instructors.name LIKE '%SUB%' OR colleges.college_tag LIKE '%SUB%' \".gsub('SUB', params[:sSearch])\n search += search2\n\n e = e.where(search)\n total_record_size = e.count\n e = e.page(page).per(display_length)\n #logger.info \"EQ: \" + e.to_sql\n else\n total_record_size = e.count\n e = e.page(page).per(display_length)\n end\n\n\n json = DatatablesRails::Structify.new(e)\n \n json.formatter do |u|\n course = Course.find(u['id'])\n if current_user.courses.where(:id => u['id']).first.blank?\n u['add'] = self.class.helpers.link_to \"Add\", user_courses_path(:course_id => u['id']), :method => :post, :remote => :true, :onclick => \"$(this).html('Added')\"\n else\n u['add'] = \"Added\"\n end\n u['course_number'] = self.class.helpers.link_to u['course_number'], course_path(:id => u['id'])\n u['instructor'] = self.class.helpers.link_to course.try(:instructor).try(:name), instructor_path(:id => course.try(:instructor_id))\n u['college'] = course.college.college_tag.upcase\n u['begin_time'] = u['begin_time'].strftime(\"%I:%M %p\")\n u['end_time'] = u['end_time'].strftime(\"%I:%M %p\")\n u['friends'] = current_user.find_friends_in_course(u['id']).size\n end\n json_struct = json.struct\n json_struct[\"iTotalRecords\"] = total_record_size\n json_struct[\"iTotalDisplayRecords\"] = total_record_size\n json_struct[\"sEcho\"] = params[:sEcho]\n render :json => json_struct\n\n }\n end\n end",
"def index\n params[:term] ||= ''\n params[:page] ||= '1'\n params[:order] ||= 'name'\n params[:dir] ||= 'up'\n\n dir = params[:dir] == 'up' ? 'ASC' : 'DESC'\n stats = current_user ? \"status_id IN (4,3,2)\" : \"status_id = 4\"\n @sub = Submission.where([\"name LIKE ? AND #{stats}\", params[:term] + '%'])\n .order(\"#{params[:order]} #{dir}\")\n .paginate(:page => params[:page], :per_page => 12)\n if request.xhr?\n render :partial => 'search_table', :layout => false\n else\n render 'index', :layout => (logged_in? ? 'application' : 'public')\n end\n end",
"def sort_column\n \n @sort_field = ''\n if params[:sort].to_s == MadConstants.donor_name\n @sort_field = 'concat(donours.first_name,donours.last_name)'\n elsif params[:sort].to_s == MadConstants.donation_amount\n @sort_field = 'donations.donation_amount'\n elsif params[:sort].to_s == MadConstants.donation_type\n @sort_field = 'donations.donation_type'\n elsif params[:sort].to_s == MadConstants.product\n @sort_field = 'cfr_products.name'\n elsif params[:sort].to_s == MadConstants.fundraiser_name\n @sort_field = 'users.first_name'\n elsif params[:sort].to_s == MadConstants.donation_status\n @sort_field = 'donations.donation_status'\n elsif params[:sort].to_s == MadConstants.eighty_g_required\n @sort_field = 'donations.eighty_g_required'\n else\n @sort_field = 'donations.id' \n end\n \n Donation.joins(:donour).joins('inner join cfr_products as cfr_products on cfr_products.id = donations.product_id').\n joins('inner join users as users on users.id = donations.fundraiser_id').\n cfr_txn_search(params[:search]).order(@sort_field + ' ' + sort_direction).\n paginate(:per_page => 10, :page => params[:page])\n end",
"def indexKaminariTable\n\n @sort = nil\n @direction = nil\n @sort = params[:sort] if params[:sort]\n @direction = params[:direction] if params[:direction]\n\n @sort = 'id' if @sort == nil\n @direction = 'asc' if @direction == nil\n if params[:search]\n @downloads = Download.where(\"name like :search\", search: params[:search]).order(\"#{@sort} #{@direction}\").page(params[:page]).per(get_perPage)\n else\n @downloads = Download.order(\"#{@sort} #{@direction}\").page(params[:page]).per(get_perPage)\n end\n\n end",
"def index\n \n #@food_courts = FoodCourt.all\n @sort = params[:sort] || session[:sort]\n @food_court = FoodCourt.order(@sort)\n #puts \"printing food courts\",@food_court\n \n sort = params[:sort] || session[:sort]\n case sort\n when 'foodCourt'\n ordering,@foodCourt_header = {:foodCourt => :asc}, 'hilite'\n when 'distance'\n ordering,@distance_header = {:distance => :asc}, 'hilite'\n end\n #sort = params[:sort] || session[:sort]\n #case sort\n #when 'foodCourt'\n # ordering,@title_header = {:foodCourt => :asc}, 'hilite'\n #when 'distance'\n # ordering,@date_header = {:distance => :asc}, 'hilite'\n #end\n end",
"def show_table\n build_html do\n if upd_apar_defs.length == 0\n div.upd_apar_defs do\n span \"Did not find any items matching request\"\n end\n else\n table.upd_apar_defs do\n thead do\n tr do\n th '#'\n [ \"Defect\", \"Apar\", \"PTF\", \"Abstract\",\n \"LPP\", \"VRMF\", \"Version\", \"Service Pack\" ].each do |header_label|\n th class: \"upd_apar_def-#{header_label.gsub(\" \", \"_\").downcase}\" do\n span class: \"upd_apar_defs_header_span\" do\n text header_label\n span class: \"sort sortable\" do\n end\n end\n end\n end\n end\n end\n tbody do\n # upd_apar_defs.each_with_index { |o, i| show_upd_apar_def(o,i) }\n end\n end\n end\n end\n end",
"def make_class(klass)\n %Q{\n <td class=\"class_item\" colspan=\"#{klass.intervals}\">\n <p>#{klass.name} - #{klass.location}</p>\n <p>#{klass.type}</p>\n </td>}\n end",
"def render_json_query(table)\n if request_type_find? && time_query?\n render json: serializer(table).new(model(table).where(generate_date_query_argument(date_parsed)).take)\n elsif request_type_find? && !time_query?\n render json: serializer(table).new(model(table).find_by(valid_params))\n elsif request_type_find_all? && time_query?\n render json: serializer(table).new(model(table).where(generate_date_query_argument(date_parsed)))\n elsif request_type_find_all? && !time_query?\n render json: serializer(table).new(model(table).where(valid_params))\n end\n end",
"def show_only(status_query)\n\n sorted_tasks = @tasks.select{|task_id, task| task.status == status_query}\n\n if sorted_tasks.empty?\n table_empty\n else\n table_placeholder\n fill_table(sorted_tasks)\n end\n end",
"def index\n user_works = Work.joins(:pseuds => :user).where(\"users.id = ?\", @user.id)\n work_query = user_works.joins(:taggings).\n joins(\"inner join tags on taggings.tagger_id = tags.id AND tags.type = 'Fandom'\").\n select(\"distinct tags.name as fandom, \n works.id as id, \n works.title as title, \n works.revised_at as date,\n works.word_count as word_count\")\n\n # sort \n \n # NOTE: Because we are going to be eval'ing the @sort variable later we MUST make sure that its content is \n # checked against the whitelist of valid options\n sort_options = \"\"\n @sort = \"\"\n if current_user.preference.hide_hit_counts\n sort_options = %w(kudos.count comments.count bookmarks.count subscriptions.count word_count)\n @sort = sort_options.include?(params[:sort_column]) ? params[:sort_column] : \"kudos.count\"\n else\n sort_options = %w(hits date kudos.count comments.count bookmarks.count subscriptions.count word_count)\n @sort = sort_options.include?(params[:sort_column]) ? params[:sort_column] : \"hits\"\n end\n \n @dir = params[:sort_direction] == \"ASC\" ? \"ASC\" : \"DESC\"\n params[:sort_column] = @sort\n params[:sort_direction] = @dir\n\n # gather works and sort by specified count\n @years = [\"All Years\"] + user_works.value_of(:revised_at).map {|date| date.year.to_s}.uniq.sort\n @current_year = @years.include?(params[:year]) ? params[:year] : \"All Years\"\n if @current_year != \"All Years\"\n start_date = DateTime.parse(\"01/01/#{@current_year}\")\n end_date = DateTime.parse(\"31/12/#{@current_year}\")\n work_query = work_query.where(\"works.revised_at >= ? AND works.revised_at <= ?\", start_date, end_date)\n end\n # NOTE: eval is used here instead of send only because you can't send \"bookmarks.count\" -- avoid eval\n # wherever possible and be extremely cautious of its security implications (we whitelist the contents of\n # @sort above, so this should never contain potentially dangerous user input)\n works = work_query.all.sort_by {|w| @dir == \"ASC\" ? (eval(\"w.#{@sort}\") || 0) : (0 - (eval(\"w.#{@sort}\") || 0).to_i)} \n\n # on the off-chance a new user decides to look at their stats and have no works\n if works.blank?\n render \"no_stats\" and return\n end\n \n # group by fandom or flat view\n if params[:flat_view]\n @works = {ts(\"All Fandoms\") => works.uniq}\n else\n @works = works.group_by(&:fandom)\n end\n \n # gather totals for all works\n @totals = {}\n (sort_options - [\"date\"]).each do |value|\n # see explanation above about the eval here\n # the inject is used to collect the sum in the \"result\" variable as we iterate over all the works\n @totals[value.split(\".\")[0].to_sym] = works.uniq.inject(0) {|result, work| result + (eval(\"work.#{value}\") || 0)} # sum the works\n end\n @totals[:author_subscriptions] = Subscription.where(:subscribable_id => @user.id, :subscribable_type => 'User').count\n\n # graph top 5 works\n @chart_data = GoogleVisualr::DataTable.new \n @chart_data.new_column('string', 'Title')\n chart_col = @sort == \"date\" ? \"hits\" : @sort\n chart_col_title = chart_col.split(\".\")[0].titleize == \"Comments\" ? ts(\"Comment Threads\") : chart_col.split(\".\")[0].titleize\n chart_title = @sort == \"date\" ? ts(\"Most Recent\") : ts(\"Top Five By #{chart_col_title}\")\n @chart_data.new_column('number', chart_col_title)\n \n # Add Rows and Values \n # see explanation above about the eval here\n @chart_data.add_rows(works.uniq[0..4].map {|w| [w.title, eval(\"w.#{chart_col}\")]})\n\n # image version of bar chart\n # opts from here: http://code.google.com/apis/chart/image/docs/gallery/bar_charts.html\n @image_chart = GoogleVisualr::Image::BarChart.new(@chart_data, {:isVertical => true}).uri({\n :chtt => chart_title,\n :chs => \"800x350\",\n :chbh => \"a\",\n :chxt => \"x\",\n :chm => \"N,000000,0,-1,11\"\n })\n\n @chart = GoogleVisualr::Interactive::ColumnChart.new(@chart_data, :title => chart_title)\n \n end",
"def table_header_grouping(*cls, &blk)\n raise \"table_grouping out of table_by_columns block\" if @table_listing_columns.nil?\n @table_group_class = cls*' '\n @table_grouping = blk\n end",
"def sorting\n sort_no = 0\n sorts = []\n\n loop do\n sorted = false\n name_col = \"iSortCol_#{sort_no}\"\n name_mode = \"sSortDir_#{sort_no}\"\n sort_col = @dts[name_col]\n break if !sort_col\n\n col_name = @columns[sort_col.to_i]\n next if !col_name\n\n if @dts[name_mode] == \"desc\"\n sort_mode = \"DESC\"\n else\n sort_mode = \"ASC\"\n end\n\n if match = col_name.to_s.match(/^(.+)_id$/)\n method_name = match[1]\n sub_model_name = StringCases.snake_to_camel(col_name.slice(0, col_name.length - 3))\n\n if Kernel.const_defined?(sub_model_name)\n sub_model_const = Kernel.const_get(sub_model_name)\n unless @joins.key?(method_name)\n @query = @query.includes(method_name)\n @joins[method_name] = true\n end\n\n @sort_columns.each do |sort_col_name|\n if sub_model_const.column_names.include?(sort_col_name.to_s)\n sorts << \"`#{sub_model_const.table_name}`.`#{escape_col(sort_col_name)}` #{sort_mode}\"\n sorted = true\n break\n end\n end\n end\n end\n\n if @model.column_names.include?(col_name.to_s)\n sorts << \"`#{@model.table_name}`.`#{escape_col(col_name)}` #{sort_mode}\"\n elsif @args[:sort]\n res = @args[:sort].call(:key => col_name, :sort_mode => sort_mode, :query => @query)\n @query = res if res\n else\n raise \"Unknown sort-column: '#{col_name}'.\"\n end\n\n sort_no += 1\n end\n\n @query = @query.order(sorts.join(\", \"))\n end",
"def link_to_coerced_query(query, model)\n tab = coerced_query_tab(query, model)\n return nil unless tab\n\n link_to(*tab)\n end",
"def sortable_heading(heading, column, id)\n link_to(heading,\n { :controller => :movies,\n :sort_order => column,\n :ratings => @selected_ratings\n },\n :id => id)\n end",
"def render_timelogquery_block(block, settings)\n query = TimeEntryQuery.visible.find_by_id(settings[:query_id])\n\n if query\n query.column_names = settings[:columns] if settings[:columns].present?\n query.sort_criteria = settings[:sort] if settings[:sort].present?\n\n scope = query.results_scope\n scope = scope.\n preload(:issue => [:project, :tracker, :status, :assigned_to, :priority]).\n preload(:project, :user)\n\n entries = scope.limit(10).to_a\n\n render :partial => 'my/blocks/partials/timelogs', :locals => {:query => query, :scope => scope, :entries => entries, :block => block, :settings => settings}\n else\n queries = TimeEntryQuery.visible.sorted\n render :partial => 'my/blocks/partials/timelog_query_selection', :locals => {:queries => queries, :block => block, :settings => settings}\n end\n end",
"def data(*args, &block) # :yields: tablebody\n options = args.extract_options!\n if block_given?\n yield self\n else\n @table_fields += args.empty? ? orm_fields : args.collect {|f| TableField.new(f.to_sym)}\n @sortable_fields = options[:sortables] || []\n @current_sortable = [:created_at, \"DESC\"]\n if @sortable_fields.include?(@params[:sort_by].try(:to_sym))\n @current_sortable[0] = @params[:sort_by].to_sym\n end\n if [\"ASC\", \"DESC\"].include?(@params[:sort])\n @current_sortable[1] = @params[:sort]\n end\n end\n\n if (options[:mass_actions])\n @table_fields = [TableField.new(:mass_actions)] + @table_fields\n end\n\n @mass_action = options[:mass_actions]\n @mass_action_prefix = options[:mass_action_prefix]\n @cell_links = options[:links] || []\n @cell_prefix = options[:action_prefix]\n action_cells(options[:actions], options[:action_prefix])\n [\"\\n\", head, \"\\n\", body, \"\\n\"].join(\"\").html_safe\n end",
"def crud_table(*attrs, &block)\n attrs, options = explode_attrs_with_options(attrs, &block)\n first = attrs.shift\n plain_table_or_message(entries, options) do |t|\n t.attr_with_show_link(first) if first\n t.sortable_attrs(*attrs)\n yield t if block_given?\n standard_table_actions(t)\n end\n end",
"def index\n=begin\n if sort_column == \"category_id\" && params[:locale] == :en\n @jobs = Job.cat_by_name.paginate(:per_page => 1, :page => params[:page])\n elsif sort_column == \"category_id\" && params[:locale] == :tr\n @jobs = Job.cat_by_isim.paginate(:per_page => 1, :page => params[:page])\n else\n @jobs = Job.order(sort_column + \" \" + sort_direction).paginate(:per_page => 1, :page => params[:page])\n end\n=end\n @title = t('general.main_list')\n\n=begin\n if params[:locale]==\"tr\"\n loc = \"tr\"\n end\n if params[:locale]==\"en\"\n loc = \"en\"\n end\n=end\n\n sorting # defined in the application controller\n\n respond_to do |format|\n format.html # index.html.erb\n #format.js\n format.json { render json: @jobs }\n end\n end",
"def link_sort_header(column_translation_code )\n #title ||= column.titleize\n if column_translation_code.index('.') then\n column=column_translation_code.split.last\n else\n column=column_translation_code\n end\n css_class = (column == sort_column) ? \"current #{sort_direction}\" : nil\n # need to add back the sqlinjection protection here\n #css_class = \"current #{sort_direction}\" \n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to tlabel(column_translation_code), {:sort => column, :direction => direction}, {:class => css_class}\n end",
"def publish_status_links(klass, parent=nil)\n parent_path = parent ? \"#{parent.class.name.underscore}_\" : ''\n klass_name = klass.name.tableize\n pars = {:sort => params[:sort], :q => params[:q]}\n h = content_tag(:li,\n link_to(\"all (#{klass.count})\",send(*[:\"admin_#{parent_path}#{klass_name}_path\",parent,pars.except(:q)].compact), \n :class => \"publish_status status_all\"),\n :class => ((controller.action_name == 'index' && pars[:q].blank?) ? 'current' : '')\n )\n if pars[:q]\n h << content_tag(:li,\n link_to(\"all results (#{klass.like(pars[:q]).count})\",\n send(*[:\"admin_#{parent_path}#{klass_name}_path\",parent,pars].compact), \n :class => \"publish_status status_all\"),\n :class => (controller.action_name == 'index' ? 'current' : '')\n )\n end\n ArPublishControl::STATUSES.inject(h) do |html,status|\n html << content_tag(:li,\n link_to(\"#{status} (#{klass.send(status).like(pars[:q]).count})\",\n send(*[:\"#{status}_admin_#{parent_path}#{klass_name}_path\",parent,pars].compact), \n :class => \"publish_status status_#{status}\"),\n :class => (controller.action_name == status.to_s ? 'current' : '')\n )\n html\n end\n h << content_tag(:li,link_to(\"← back to %s index\"%klass_name,send(:\"admin_#{klass_name}_path\"))) if parent\n h\n end",
"def get_table(object)\n raise NotImplementedError, \"Subclasses must implement private method get_table\"\n end",
"def initialize(name, klass = nil, table_name = nil, params = nil)\n super(self, nil, name)\n initialize_node(name, klass, table_name)\n \n self.url = nil\n self.ajax_type = :get\n self.enable_sort_window = false\n self.leafs = []\n self.dataset = nil\n self.resultcount = 0\n\n self.query = {}\n self.request_params = (params || {})\n \n self.grid_type = Fancygrid.default_grid_type\n self.search_visible = Fancygrid.search_visible\n self.search_type = Fancygrid.default_search_type\n self.search_operators = Fancygrid.search_operators\n self.search_formats = {}\n self.simple_search_operators = ActiveSupport::HashWithIndifferentAccess.new({})\n \n if Fancygrid.use_grid_name_as_cells_template\n self.template = File.join(Fancygrid.cells_template_directory.to_s, name.to_s)\n else\n self.template = File.join(Fancygrid.cells_template_directory.to_s, Fancygrid.cells_template.to_s)\n end\n \n self.per_page_options = Fancygrid.default_per_page_options\n self.per_page_selection = Fancygrid.default_per_page_selection\n \n view_opts = self.request_params[:fancygrid] || {}\n view_opts = view_opts[self.name]\n \n self.load_view(view_opts || {})\n end",
"def construct_table_row(user)\n result = {}\n result[:id] = user.id\n result[:user_name] = CGI.escapeHTML(user.user_name)\n result[:first_name] = CGI.escapeHTML(user.first_name)\n result[:last_name] = CGI.escapeHTML(user.last_name)\n @render_note_link = false\n if user.student?\n result[:grace_credits] = user.remaining_grace_credits.to_s + '/' + user.grace_credits.to_s\n if user.has_section?\n result[:section] = user.section.name\n else\n result[:section] = '-'\n end\n @render_note_link = true\n end\n result[:hidden] = user.hidden\n result[:filter_table_row_contents] =\n render_to_string :partial => 'users/table_row/filter_table_row',\n :formats => [:html], :handlers => [:erb],\n :locals => {:user => user,\n :controller => self.controller_name,\n :render_note_link => @render_note_link}\n result\n end",
"def display_sort_column_headers(search)\n user_column_headers.reduce(String.new) do |string, field|\n string << (tag.th sort_link(search, field, {}, method: action))\n end +\n post_title_header_labels.reduce(String.new) do |str, i|\n str << (tag.th \"Post #{i} title\")\n end\n end",
"def index\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @priors = Prior.sorted_order(\"#{sort_column('priors','updated_at')} #{sort_direction}\").search(params[:search]).paginate(\n :page => params[:page], \n :per_page => params[:DataTables_Table_0_length]\n )\n log_searches(Prior)\n else # Allow url queries of data, with scopes, only xml & csv ( & json? )\n @priors = Prior.api_search(params)\n log_searches(Prior.method(:api_search), params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @priors }\n format.csv { render :csv => @priors }\n format.json { render :json => @priors }\n end\n end",
"def index \n # set the default value for the clear button \n params[:clear] = \"\" unless params[:clear]\n params[:sort] = \"last_name_asc\" unless params[:sort]\n #params[:filter] = {} unless params[:filter]\n \n # save the model names for use by the views (filter & sort)\n @plural_model_name = 'users'\n @model_name = 'user'\n @act_restful = true\n \n # sanatize the display param.\n params[:display] = sanitize_display(params[:display])\n\n # sanatize the sort params\n @sort_col, @sort_dir, model_name, @orig_col_name = sanitize_sort(params[:sort], '', @plural_model_name)\n \n # sanatize the filter params\n params[:filter] = nil if params[:clear].downcase == \"clear\" # if the user clicked on the 'clear' toss the filter params to the bit bucket.\n conditions = HashWithIndifferentAccess.new\n conditions.merge!(logged_in? ? {:is_active => 1} : {:show_personal_info => 1, :is_active => 1}) # the built in filter.\n conditions = params[:filter].merge!(conditions) if params[:filter]\n \n @filter = sanitize_filter(conditions)\n \n # create the params for the find method\n find_params = {:per_page => params[:display].to_i}\n \n # we need to remove the single quotes so the order works with included tables.\n # because rails alises all of the columns to generated names i.e. t0_r0, t0_r1\n find_params.merge!({:order => ActiveRecord::Base.send(:sanitize_sql, [\" #{model_name}.? #{@sort_dir}\", @sort_col]).delete(\"'\")}) if @sort_col\n find_params.merge!({:conditions => @filter}) if @filter\n find_params.merge!({:include => :discipline })\n\n # do the search\n @user_pages, @user_data = paginate :users, find_params\n \n # take care of rendeing if the user wants us to.\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @user_data.to_xml }\n format.text { render :text => data_text(false) }\n format.csv { render :text => data_text }\n end \n end",
"def render_html_table(rde_table)\n content_tag(:table, class: 'table rde-table') do\n rde_table.rows.map { |row|\n content_tag(row.tag, class: row.css_class) do\n row.cells.map { |cell|\n if cell.ruby_formatter\n content_tag(\n cell.tag,\n instance_exec(cell.value, &cell.ruby_formatter),\n class: cell.css_class,\n title: cell.title,\n style: cell.style,\n )\n else\n content_tag(\n cell.tag,\n cell.value,\n class: cell.css_class,\n title: cell.title,\n style: cell.style,\n )\n end\n }.join.html_safe\n end\n }.join.html_safe\n end\n end",
"def index\n @top_sort_active = false\n @active_tab = 'all'\n\n if params[:sort].to_s.downcase == 'top' && allowed_sort_times.include?(params[:t].to_s)\n @top_sort_active = true\n @active_tab = 'top'\n @dogs = Dog.by_likes(params[:t])\n\n else\n @dogs = Dog.all\n end\n\n @dogs = @dogs.paginate(page: params[:page])\n end",
"def table_sections\n @entries = TableSection.includes(:outlet).where(\"location_id=? #{@outlet_query}\", params[:location_id].to_i).paginate(:page => params[:page]) if request.xhr? \n end",
"def table_links_page(hierarchy, current_level, select = '', where = '', group = '')\n res,more = data(select, where, group)\n\n html_title = 'data'\n #request.path\n page_title = '<h1>Well Finder</h1>' + (more ? '<h2>(there\\'s more than this...)</h2>' : '')\n if(res.length > 1)\n table = '<table><tr>%s</tr>%s</table>'\n headers = res[0]\n header_html = '<th>' + headers.join('</th><th>') + '</th>' #TODO put in explanations of what these are/units\n #header_html = headers.inject('<th>')\n \n link = headers.collect{|o| hierarchy.include?(o.to_sym) && (current_level + hierarchy.index(o.to_sym)) < hierarchy.length * 2 - 1 } #everything but the last one\n path = request.path_info.split('/')\n rows = res[1..-1].collect do |row|\n #only want base urls for high-heirarchy levels\n #don't want links on the lowest level of the hierarhcy levels\n #TODO pass the query params of the url onto the next one\n ret = '<td>'\n (0..row.length).each do |i| \n if(link[i]) \n url = path[0..hierarchy.index(headers[i].to_sym)+1].collect{|o| !o.empty? && o.to_sym == :':all' ? row[i-1] : o }\n #grab the path for where we are in the row\n ret += \"<a href=\\\"#{url.join('/') + \"/#{row[i]}\"}\\\">#{row[i]}</a>\"\n else\n ret += row[i].to_s\n end\n ret += '</td><td>'\n end\n ret += '</td>'\n ret\n end\n row_html = \"\\n<tr>#{rows.join(\"</tr>\\n<tr>\")}</tr>\\n\"\n \n body = page_title + \"<p class=\\\"headnote\\\"><a href=\\\"#{path[0..1].join('/')}\\\">Top summary level</a></p>\\n\" + table % [header_html, row_html]\n else\n body = '<p>Couldn\\'t find anything with that designation.</p>' #TODO this or do 404?\n end\n \n PREFIX + (HEAD % html_title) + (BODY % body) + SUFFIX\n end",
"def index\n # sorting code -----------------------------------------------------------------------------------------\n @columns = [\n { title: 'Emp #', key: 'badges.employee_id' },\n { title: 'Name', key: 'badges.last_name, badges.first_name' },\n { title: 'Title', key: 'badges.title' },\n { title: 'Department', key: 'badges.department' },\n { title: 'Created', key: 'badges.created_at' }\n ]\n default_sort = '-badges.created_at'\n redirect_url = badges_path\n sort = click_sort_info(@columns, default_sort, redirect_url)\n# return if performed?\n Rails.logger.debug(\"click_sorting = #{sort}\")\n # end of sorting code, returns \"sort\", order your results like so: ...reorder(sort) --------------------\n \n source = Badge.all #paginate(page: params[:page])\n pg_size = 25\n filter_list source, pg_size, sort\n end",
"def tableize_order_payment(hash, options = {class: 'table table-bordered'})\n if hash.present? && hash.kind_of?(Hash)\n content_tag(:table, class: options[:class]) do\n title = options.delete(:title)\n\n content = content_tag(:tbody) do\n hash.map do |k, v|\n content_tag(:tr) do\n content_tag((options[:th] ? :th : :td), k) +\n content_tag(:td) do\n if v.kind_of?(Hash)\n tableize_order_payment(v, options.merge(th: (options.key?(:sub_th) ? options[:sub_th] : options[:th])))\n elsif v.kind_of?(Array)\n '[' + v.join(', ') + ']'\n else\n v\n end\n end\n end\n end.join.html_safe\n end\n\n title.blank? ? content : (content_tag(:thead) { content_tag(:tr) { content_tag(:th, title, colspan: 2) } } + content)\n end\n else\n hash.to_s.html_safe\n end\n end",
"def build_query_parts\n # Always include the following columns:\n select_clause = ['DISTINCT(Person.' + _(:id, :person) + ') as person_id'] # person id\n select_clause += ['Person.' + _(:first_name, :person) + ' as First_Name'] # first name\n select_clause += ['Person.' + _(:last_name, :person) + ' as Last_Name'] # last name\n \n # Always include the person table\n tables = ['Person']\n tables_clause = Person.table_name + ' as Person'\n # Always include the campus involvements table\n tables << 'CampusInvolvement'\n tables_clause += \" LEFT JOIN #{CampusInvolvement.table_name} as CampusInvolvement on Person.#{_(:id, :person)} = CampusInvolvement.#{_(:person_id, :campus_involvement)} AND CampusInvolvement.end_date IS NULL\"\n # Always include the ministry involvements table\n tables << 'MinistryInvolvement'\n tables_clause += \" LEFT JOIN #{MinistryInvolvement.table_name} as MinistryInvolvement on Person.#{_(:id, :person)} = MinistryInvolvement.#{_(:person_id, :ministry_involvement)} AND MinistryInvolvement.end_date IS NULL\"\n # Always include the current address\n tables << 'CurrentAddress'\n tables_clause += \" LEFT JOIN #{CurrentAddress.table_name} as CurrentAddress on Person.#{_(:id, :person)} = CurrentAddress.#{_(:person_id, :address)} AND #{_(:address_type, :address)} = 'current'\"\n # Hooks to support different schemas\n tables += build_query_parts_custom_tables if self.respond_to?(:build_query_parts_custom_tables)\n tables_clause += build_query_parts_custom_tables_clause if self.respond_to?(:build_query_parts_custom_tables_clause)\n\n columns.each do |column|\n raise inspect if column.nil? # If something goes wrong, we want good information\n # Add table to table clause\n table_name = column.from_clause.constantize.table_name if column.from_clause.present?\n unless !column.from_clause.present? || tables.include?(column.from_clause)\n tables << column.from_clause\n source_model = (column.source_model.to_s.empty? ? 'Person' : column.source_model).constantize\n source_column = column.source_column.to_s.empty? ? 'id' : column.source_column\n foreign_key = column.foreign_key.to_s.empty? ? 'person_id' : column.foreign_key\n source_table_name = source_model.table_name\n join_on_left = \"#{source_model}.#{_(source_column.to_sym, source_model.name.downcase.to_sym)}\"\n join_on_right = \"#{column.from_clause}.#{_(foreign_key.to_sym, column.from_clause.underscore.to_sym)}\"\n tables_clause += \" LEFT JOIN #{table_name} as #{column.from_clause} on #{join_on_left} = #{join_on_right}\"\n tables_clause += \" AND \" + column.join_clause unless column.join_clause.blank?\n end\n \n # Don't add id, first name or last name here because we added them earlier\n unless ['id','first_name','last_name'].include?(column.select_clause)\n # Add column to select clause\n unless column.select_clause.first == '('\n select_clause << \"#{column.from_clause}.#{_(column.select_clause, column.from_clause.underscore)} as #{column.safe_name}\"\n else\n select_clause << \"#{column.select_clause} as #{column.safe_name}\"\n end\n end\n end\n self.select_clause = select_clause.join(', ')\n self.tables_clause = tables_clause\n return tables\n end",
"def table_header\n print '<table class=\"colors sortable\">', \"\\n\"\n print '<col width=\"15%\"><col width=\"20%\"><col width=\"15%\"><col width=\"50%\">'\n\n print '<tr>'\n print '<th class=\"sorttable_nosort\">Swatch</th>', \"\\n\"\n print '<th class=\"clickable\">Color name</th>', \"\\n\"\n print '<th id=\"hex\" class=\"hidden\">' # fake column for colors\n\n print '<th class=\"sorttable_nosort clickable\">', \"\\n\"\n print \"<span title='Sort by triplet' onclick='sortcol(\\\"hex\\\")'>Hex Triplet</span>\", \"\\n\"\n print \"<img id=\\\"arrow\\\" src='css/images/arrow-both.png'/>\", \"\\n\"\n %w[R G B].each do |letter|\n print \"<span title='Sort by #{letter} value' onclick='sortcol(\\\"#{letter}\\\")'>#{letter}</span>\", \"\\n\"\n end\n print '</th>', \"\\n\"\n\n print '<th class=\"sorttable_nosort\"><span class=\"latex\">L<sup>a</sup>T<sub>e</sub>X</span></th>', \"\\n\"\n print '<th id=\"R\" class=\"hidden\"></th>'\n print '<th id=\"G\" class=\"hidden\"></th>'\n print '<th id=\"B\" class=\"hidden\"></th>'\n print '</tr>'\nend",
"def undecorated_table_name(class_name = class_name_of_active_record_descendant(self))\n table_name = Inflector.underscore(Inflector.demodulize(class_name))\n table_name = Inflector.pluralize(table_name) if pluralize_table_names\n return table_name\n end",
"def render_for_webquery( statement, group_by_columns )\n\n report_state_hash = YAML.load(self.view_state)\n conn = User.connection\n recordset = conn.select_all(Globals.cleanup_where(statement))\n\n if group_by_columns.nil? || group_by_columns.empty?\n if report_state_hash[:columns_list].nil? || report_state_hash[:columns_list].empty?\n if recordset.empty?\n keys = ['No records found']\n else\n keys = recordset[0].keys\n end\n else\n # Use the provided list of columns.\n keys = report_state_hash[:columns_list].map {|k| k.gsub('\"', '').strip }\n end\n else\n keys = group_by_columns\n # Include the sum or count columns.\n unless recordset.empty?\n extra_cols = recordset[0].keys - keys\n keys += extra_cols\n end\n end\n\n s = \"<table><tr><th>#{keys.join('</th><th>')}</th></tr>\"\n recordset.each do |record|\n s << '<tr>'\n keys.each do |k|\n s << \"<td>#{format_for_spreadsheet(record[k])}</td>\"\n end\n s << '</tr>'\n end\n s << '</table>'\n end",
"def fetchControllerForTableView(tableView)\n Cliente.searchController(@searchString, withScope:nil) \n end",
"def index\n if params[:sorttype] == 'programming'\n @tasks = Task.where(:status => \"todo\").where(:job_type => \"Programming\").page params[:page]\n if params[:sort] == 'updated_at'\n @tasks = @tasks.order(\"updated_at ASC\")\n elsif params[:sort] == 'name'\n @tasks = @tasks.order(\"LOWER(title) DESC\")\n elsif params[:sort] == 'name_reverse'\n @tasks = @tasks.order(\"LOWER(title) ASC\")\n else\n @tasks = @tasks.order(\"created_at ASC\")\n end\n elsif params[:sorttype] == 'music'\n @tasks = Task.where(:status => \"todo\").where(:job_type => \"Music\").page params[:page]\n if params[:sort] == 'updated_at'\n @tasks = @tasks.order(\"updated_at ASC\")\n elsif params[:sort] == 'name'\n @tasks = @tasks.order(\"LOWER(title) DESC\")\n elsif params[:sort] == 'name_reverse'\n @tasks = @tasks.order(\"LOWER(title) ASC\")\n else\n @tasks = @tasks.order(\"created_at ASC\")\n end\n elsif params[:sorttype] == 'art'\n @tasks = Task.where(:status => \"todo\").where(:job_type => \"Art\").page params[:page]\n if params[:sort] == 'updated_at'\n @tasks = @tasks.order(\"updated_at ASC\")\n elsif params[:sort] == 'name'\n @tasks = @tasks.order(\"LOWER(title) DESC\")\n elsif params[:sort] == 'name_reverse'\n @tasks = @tasks.order(\"LOWER(title) ASC\")\n else\n @tasks = @tasks.order(\"created_at ASC\")\n end\n elsif params[:sorttype] == 'story'\n @tasks = Task.where(:status => \"todo\").where(:job_type => \"Story\").page params[:page]\n if params[:sort] == 'updated_at'\n @tasks = @tasks.order(\"updated_at ASC\")\n elsif params[:sort] == 'name'\n @tasks = @tasks.order(\"LOWER(title) DESC\")\n elsif params[:sort] == 'name_reverse'\n @tasks = @tasks.order(\"LOWER(title) ASC\")\n else\n @tasks = @tasks.order(\"created_at ASC\")\n end\n elsif params[:sorttype] == 'level'\n @tasks = Task.where(:status => \"todo\").where(:job_type => \"Level\").page params[:page]\n if params[:sort] == 'updated_at'\n @tasks = @tasks.order(\"updated_at ASC\")\n elsif params[:sort] == 'name'\n @tasks = @tasks.order(\"LOWER(title) DESC\")\n elsif params[:sort] == 'name_reverse'\n @tasks = @tasks.order(\"LOWER(title) ASC\")\n else\n @tasks = @tasks.order(\"created_at ASC\")\n end\n elsif params[:sorttype] == 'puzzles'\n @tasks = Task.where(:status => \"todo\").where(:job_type => \"Puzzles\").page params[:page]\n if params[:sort] == 'updated_at'\n @tasks = @tasks.order(\"updated_at ASC\")\n elsif params[:sort] == 'name'\n @tasks = @tasks.order(\"LOWER(title) DESC\")\n elsif params[:sort] == 'name_reverse'\n @tasks = @tasks.order(\"LOWER(title) ASC\")\n else\n @tasks = @tasks.order(\"created_at ASC\")\n end\n elsif params[:sorttype] == 'misc'\n @tasks = Task.where(:status => \"todo\").where(:job_type => \"Miscellaneous\").page params[:page]\n if params[:sort] == 'updated_at'\n @tasks = @tasks.order(\"updated_at ASC\")\n elsif params[:sort] == 'name'\n @tasks = @tasks.order(\"LOWER(title) DESC\")\n elsif params[:sort] == 'name_reverse'\n @tasks = @tasks.order(\"LOWER(title) ASC\")\n else\n @tasks = @tasks.order(\"created_at ASC\")\n end\n else\n @tasks = Task.where(:status => \"todo\").page params[:page]\n if params[:sort] == 'updated_at'\n @tasks = @tasks.order(\"updated_at ASC\")\n elsif params[:sort] == 'name'\n @tasks = @tasks.order(\"LOWER(title) DESC\")\n elsif params[:sort] == 'name_reverse'\n @tasks = @tasks.order(\"LOWER(title) ASC\")\n else\n @tasks = @tasks.order(\"created_at ASC\")\n end\n end\n end",
"def search\n @sorting = 'DESC'\n\n if (params[:sortBtn] == 'ASC')\n @sorting = 'ASC'\n else\n @sorting = 'DESC'\n end\n \n @qualities_search = Quality.order(\"strftime('%Y',date) \" + @sorting + \", julian_date DESC, lot DESC, time DESC\").search :lot_or_user_first_name_or_user_last_name_contains => params[:term]\n @users_search = User.order(\"last_name ASC\").search :first_name_or_last_name_or_email_contains => params[:term]\n \n if current_user.facility_id == 3\n @qualities = @qualities_search.where('facility_origin_id = ?','3').order(\"strftime('%Y',date) \" + @sorting + \", julian_date DESC, lot DESC, time DESC\").page params[:qualities_page]\n @users = @users_search.where('facility_id = ?','3').order(\"last_name ASC\").page params[:users_page]\n elsif current_user.facility_id == 2\n @qualities = @qualities_search.where('facility_origin_id = ?','2').order(\"strftime('%Y',date) \" + @sorting + \", julian_date DESC, lot DESC, time DESC\").page params[:qualities_page]\n @users = @users_search.where('facility_id = ?','2').order(\"last_name ASC\").page params[:users_page]\n else\n @qualities = @qualities_search.order(\"strftime('%Y',date) \" + @sorting + \", julian_date DESC, lot DESC, time DESC\").page params[:qualities_page]\n @users = @users_search.order(\"last_name ASC\").page params[:users_page]\n end\n\n respond_to do |format|\n format.html\n format.js\n format.xlsx {\n if !current_user.administrator? and current_user.technician?\n flash[:alert] = 'You do not have the necessary permissions to download this data.'\n redirect_to '/'\n else\n if(params[:searchType] == 'qualities')\n @qualities_search = Quality.order(\"strftime('%Y',date) DESC, julian_date DESC, lot DESC, time DESC\").search :lot_or_user_first_name_or_user_last_name_contains => params[:term]\n if current_user.facility_id == 3\n send_data @qualities_search.where('facility_id = ?','3').order(\"strftime('%Y',date) DESC, julian_date DESC, lot DESC, time DESC\").to_xlsx.to_stream.read, :filename => 'search.xlsx', :type => \"application/vnd.openxmlformates-officedocument.spreadsheetml.sheet\" \n elsif current_user.facility_id == 2\n send_data @qualities_search.where('facility_id = ?','2').order(\"strftime('%Y',date) DESC, julian_date DESC, lot DESC, time DESC\").to_xlsx.to_stream.read, :filename => 'search.xlsx', :type => \"application/vnd.openxmlformates-officedocument.spreadsheetml.sheet\" \n else\n send_data @qualities_search.order(\"strftime('%Y',date) DESC, julian_date DESC, lot DESC, time DESC\").to_xlsx.to_stream.read, :filename => 'search.xlsx', :type => \"application/vnd.openxmlformates-officedocument.spreadsheetml.sheet\" \n end \n elsif(params[:passed] == \"users\")\n #do nothing\n else\n #do nothing\n end\n end\n }\n end\n end"
] | [
"0.5548069",
"0.5349646",
"0.53415644",
"0.5231635",
"0.515947",
"0.5149141",
"0.5112904",
"0.51075965",
"0.51056933",
"0.50279224",
"0.5010953",
"0.50074697",
"0.49906096",
"0.49256086",
"0.49144667",
"0.49069282",
"0.4898878",
"0.48711687",
"0.4863244",
"0.48568588",
"0.48333272",
"0.48216403",
"0.48164427",
"0.4812926",
"0.48118484",
"0.48052365",
"0.4802165",
"0.48006034",
"0.47864506",
"0.4779408",
"0.4768839",
"0.47446948",
"0.4726074",
"0.47241965",
"0.46863237",
"0.46813834",
"0.46773306",
"0.46773306",
"0.46712",
"0.46583575",
"0.46442986",
"0.4643079",
"0.46398035",
"0.46345776",
"0.46274093",
"0.46231216",
"0.46211606",
"0.4617823",
"0.46048826",
"0.4598821",
"0.4588225",
"0.45719725",
"0.45707178",
"0.45673752",
"0.4552615",
"0.45435432",
"0.45152488",
"0.45126218",
"0.45126218",
"0.45122597",
"0.4505681",
"0.45007673",
"0.4498318",
"0.44933656",
"0.44860348",
"0.44833723",
"0.44727823",
"0.4472392",
"0.44717634",
"0.44683003",
"0.44620144",
"0.44620004",
"0.44558594",
"0.4451172",
"0.4440132",
"0.44372287",
"0.44260418",
"0.44248825",
"0.44245228",
"0.4421993",
"0.4394115",
"0.43905807",
"0.439048",
"0.43886134",
"0.43814856",
"0.43805307",
"0.43791062",
"0.4374985",
"0.4373723",
"0.43647373",
"0.43646896",
"0.4352637",
"0.43426538",
"0.4342414",
"0.43351626",
"0.43283066",
"0.43204597",
"0.4308341",
"0.43000332",
"0.4298869"
] | 0.5000707 | 12 |
Render the html rows for the given records and an optional named partial. Returns HTML string or nil | def render_response_html(records, partial: 'row', locals: {} )
output = render_to_string(partial: partial, locals: { records: records }.merge(locals))
# if the query has no results, it will return a string which causes jquery to crash
output = nil unless records.any?
output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_record_from_config(record, renderer = record_select_config.label)\n case renderer\n when Symbol, String\n # return full-html from the named partial\n render :partial => renderer.to_s, :locals => {:record => record}\n\n when Proc\n # return an html-cleaned descriptive string\n h renderer.call(record)\n end\n end",
"def render_record(record)\n render_records(record)\n end",
"def render_records_with(&blk)\n @render_records_with = blk if blk\n @render_records_with || DEFAULT_RECORD_RENDERER\n end",
"def create_query_html_response(base_query, partial: 'row', locals: {})\n resp_data = ts_ajax_handler.query_data(base_query)\n records = resp_data.delete(:records)\n resp_data[:data] = render_response_html(records, partial: partial, locals: locals)\n\n resp_data\n end",
"def render_cell(column_name,cell_value,record)\n if column_name == \"show_records\"\n id_string = \"\"\n text = \"show records\"\n keys = record.keys\n keys.each do |key|\n val = \"\"\n if record[key].to_s.index(\" \")!= nil\n val = record[key].to_s.gsub(\" \",\"se2345se\")\n else\n val = record[key].to_s\n end\n if key.to_s.upcase().index(\"COUNT\") == nil && key.to_s.upcase().index(\"AVG\") == nil && key.to_s.upcase().index(\"SUM\") == nil && key.to_s.upcase().index(\"MIN\") == nil && key.to_s.upcase().index(\"MAX\") == nil\n if id_string != \"\"\n id_string += \"!\" + key.to_s + \"-3457-\" + val\n else\n id_string += key.to_s + \"-3457-\" + val\n end\n end\n end\n\n link_url = @env.link_to(text, \"http://\" + @request.host_with_port + \"/\" + \"reports/reports/show_records\" + \"?id=\" + id_string , {:class=>'action_link'})\n return link_url\n end\n return \"\" \n end",
"def render_table(arel)\n return if arel.first.nil?\n partial :table, :locals => {:model => arel.first.class, :arel => arel}\n end",
"def rows\n render 'rows.html'\n end",
"def render \n# search field name\n if @yaml['search'].to_s.match(/\\./)\n table, field_name, method = @yaml['search'].split(/\\.|\\,/) \n search = method.nil? ? field_name : \"#{field_name}.#{method}\"\n else # search and table name are separated\n search = field_name = @yaml['search']\n end\n# determine table name \n if @yaml['table']\n table = if @yaml['table'].class == String\n @yaml['table']\n# eval(how_to_get_my_table_name) \n elsif @yaml['table']['eval']\n eval @yaml['table']['eval']\n else\n p \"Field #{@yaml['name']}: Invalid table parameter!\"\n nil\n end\n end\n unless (table and search)\n @html << 'Table or search field not defined!' \n return self\n end\n# \n return ro_standard(table, search) if @readonly\n# TODO check if table exists \n collection = table.classify.constantize\n unless @record.respond_to?(@yaml['name'])\n @html << \"Invalid field name: #{@yaml['name']}\" \n return self\n end\n# put field to enter search data on form\n @yaml['html'] ||= {}\n @yaml['html']['value'] = '' # must be. Otherwise it will look into record and return error\n _name = '_' + @yaml['name']\n @html << '<table class=\"ui-autocomplete-table\"><td>'\n @html << @parent.link_to(@parent.fa_icon('plus-square lg', class: 'dc-animate dc-green'), '#',onclick: 'return false;') # dummy add. But it is usefull.\n\n record = record_text_for(@yaml['name']) \n @html << ' ' << @parent.text_field(record, _name, @yaml['html']) # text field for autocomplete\n @html << \"<div id =\\\"#{record}#{@yaml['name']}\\\">\" # div to list active records\n# find value for each field inside categories \n unless @record[@yaml['name']].nil?\n @record[@yaml['name']].each do |element|\n# this is quick and dirty trick. We have model dc_big_table which can be used for retrive \n# more complicated options\n# TODO retrieve choices from big_table\n rec = if table == 'dc_big_table'\n collection.find(@yaml['name'], @parent.session)\n else\n collection.find(element)\n end\n# Related data is missing. It happends.\n @html << if rec\n link = @parent.link_to(@parent.fa_icon('remove lg', class: 'dc-animate dc-red'), '#',\n onclick: \"$('##{rec.id}').hide(); var v = $('##{record}_#{@yaml['name']}_#{rec.id}'); v.val(\\\"-\\\" + v.val());return false;\")\n field = @parent.hidden_field(record, \"#{@yaml['name']}_#{rec.id}\", value: element)\n \"<div id=\\\"#{rec.id}\\\" style=\\\"padding:2px;\\\">#{link} #{rec.send(field_name)}<br>#{field}</div>\"\n else\n '** error **'\n end\n end\n end\n @html << \"</div></td></table>\"\n# Create text for div to be added when new category is selected \n link = @parent.link_to(@parent.fa_icon('remove lg', class: 'dc-animate dc-red'), '#', \n onclick: \"$('#rec_id').hide(); var v = $('##{record}_#{@yaml['name']}_rec_id'); v.val(\\\"-\\\" + v.val());return false;\")\n field = @parent.hidden_field(record, \"#{@yaml['name']}_rec_id\", value: 'rec_id')\n one_div = \"<div id=\\\"rec_id\\\" style=\\\"padding:2px;\\\">#{link} rec_search<br>#{field}</div>\"\n \n# JS stuff \n @js << <<EOJS\n$(document).ready(function() {\n $(\"##{record}_#{_name}\").autocomplete( {\n source: function(request, response) {\n $.ajax({\n url: \"#{ @parent.url_for( controller: 'dc_common', action: 'autocomplete' )}\",\n type: \"POST\",\n dataType: \"json\",\n data: { input: request.term, table: \"#{table}\", search: \"#{search}\" #{(',id: \"'+@yaml['id'] + '\"') if @yaml['id']} },\n success: function(data) {\n response( $.map( data, function(key) {\n return key;\n }));\n }\n });\n },\n change: function (event, ui) { \n var div = '#{one_div}';\n div = div.replace(/rec_id/g, ui.item.id)\n div = div.replace('rec_search', ui.item.value)\n $(\"##{record}#{@yaml['name']}\").append(div);\n $(\"##{record}_#{_name}\").val('');\n },\n minLength: 2\n });\n});\nEOJS\n\n self \nend",
"def render_table(rows, options = {})\n options = { :description => false }.merge options\n # Figure out the fields from the :model option\n if options[:model] && options[:fields].nil?\n options[:fields] = options[:model].default_field_order\n end\n # Figure out the fields from the first row\n if options[:fields].nil? && rows.first.class.respond_to?(:default_field_order)\n options[:fields] = rows.first.class.default_field_order\n end\n # Call to_row on all the rows\n rows = rows.map do |row|\n row.respond_to?(:to_row) ? row.to_row : row\n end\n # Call render_cell on all the cells\n rows.each do |row|\n # FIXME: default Api subclasses do not respond to #keys so specialising\n # #to_row is required to not break the following\n row.each_key do |k|\n row[k] = row[k].render_cell if row[k].respond_to? :render_cell\n end\n end\n if options[:s]\n # Simple output\n rows.each do |row|\n if options[:vertical]\n data options[:fields].map { |k| [k, row[k]].join(\"\\t\") }.join(\"\\n\")\n else\n data options[:fields].map { |k| row[k].is_a?(Array) ? row[k].join(\",\") : row[k] }.join(\"\\t\")\n end\n end\n elsif options[:vertical]\n # \"graphical\" table\n data ShowTable.render(rows, options)\n else\n data SimpleTable.render(rows, options)\n end\n end",
"def full_search_table_render(form_input_hash)\n\tprep_html(response_obj(prep_query(form_input_hash)))\nend",
"def respond_with_record_info(table_name, record_name, record_sys_id)\n record = ServiceNowApi.table_record_request(table_name, record_sys_id)\n\n render :partial => 'shared/show_record',\n :formats => [ :js ],\n :locals => { :name => record_name, :record => record }\n end",
"def render\n @mark.table_begin(\"table-striped table-sm table-responsive table-hover\")\n generate_headers\n generate_rows\n @mark.table_end\n @mark.render\n end",
"def table options = {} \n render_partial :table, template_locals(:table_row, options)\n end",
"def render_rows\n [header.indices, *(records.map &:values)]\n end",
"def rows(parts, fields = [\n [\n \"Sub Assembly\",\n \"sub_assembly\" \n ],\n [ \n \"Part Name\", \n \"part_name\"\n ],\n [ \n \"Quantity\", \n \"quantity\"\n ],\n [ \n \"Width\",\n \"width\"\n ],\n [ \n \"Length\",\n \"length\"\n ],\n [ \n \"Thickness\", \n \"thickness\"\n ],\n [ \n \"Material\",\n \"material\"\n ]\n ])\n \n # TODO: Get the order of items in a list to be configurable somehow...\n \n html = <<-EOS\n \n <table>\n <thead>\n <tr>\n \n EOS\n \n # List each heading for the coumns based on the `fields` parameter.\n fields.each { |f|\n \n html += \"<th>#{f[0].to_s}</th>\"\n \n }\n\n \n html += <<-EOS\n \n </tr>\n </thead>\n <tbody>\n \n EOS\n \n if parts != nil\n \n all_rows = ''\n \n parts.each { |p| \n \n all_rows += row(p, fields)\n \n }\n \n puts \"[HTMLRenderer.rows] all_rows: #{all_rows}\" if $cutlister_debug\n \n html += all_rows.to_s\n \n else\n \n UI.messagebox \"Sorry, there are no parts to cutlist...\", MB_OK\n \n end\n \n html += <<-EOS\n \n </tbody>\n </table>\n \n EOS\n \n html += section_footer(parts)\n \n html\n \n end",
"def row(part, fields)\n \n # TODO: Add in notes, grain direction.\n html = \"<tr>\"\n\n fields.each { |f|\n \n # val = eval f[1] # Eval can be dangerous if passing something wrong into it...\n val = part[f[1]]\n \n # Check if the val is a float, so we can perform fraction conversion.\n if val.class == Float\n val = val.to_html_fraction(@round_dimensions)\n end\n\n puts \"[HTMLRenderer.row] row values: #{f[0]}, #{val}\\n\\n\" if $cutlister_debug\n \n html += \"<td>#{val.to_s}</td>\"\n \n }\n \n html += \"</tr>\"\n \n puts \"[HTMLRenderer.row] row html: #{html}\" if $cutlister_debug\n \n html\n \n end",
"def generate_html(record)\n \"<!DOCTYPE html>\n <html>\n <head>\n <meta charset=\\\"utf-8\\\">\n <link rel=\\\"stylesheet\\\" href=\\\"./style.css\\\" />\n <script type=\\\"application/javascript\\\" src=\\\"./click_handlers.js\\\"></script>\n <title></title>\n </head>\n <body>\n #{main_text(record)}\n </body>\n </html>\"\nend",
"def actings_for(record)\n returning '' do |html|\n record.acting_roles.each do |role|\n view_path = record.class.acting_view_path(role)\n if File.exists?(view_path)\n html << @template.render(:file => view_path, :locals => {:object => record, :record => record})\n end\n end\n end\n end",
"def render_cell(column_name,cell_value,record)\n \"\"\n end",
"def render_simple_index(aggregation, options = {})\n return \"<p>No Records Found.</p>\" if aggregation[0].class.name == 'NilClass'\n options.symbolize_keys!\n options[:exclude] ||= []\n options[:ignored_foreign_keys] ||= []\n if options[:prefix]\n options[:prefix] += '_'\n else\n options[:prefix] = ''\n end\n linkcols = 0\n [options[:display_show], options[:display_edit], options[:display_destroy]].each do |opt|\n opt = true if opt.nil?\n linkcols += 1 if opt == true\n end\n options[:display_show] = true if options[:display_show].nil?\n options[:display_edit] = true if options[:display_edit].nil?\n options[:display_destroy] = true if options[:display_destroy].nil?\n haml_tag :table do\n haml_tag :thead do\n aggregation[0].class.columns.each do |c|\n next if options[:exclude].include? c.name.to_sym\n haml_tag :th do\n haml_concat h(c.name.humanize)\n end\n end\n linkcols > 0 ? haml_tag(:th, \"Options\", {:colspan => linkcols}) : nil\n end\n\n haml_tag :tbody do\n aggregation.each do |instance|\n haml_tag :tr do\n instance.class.columns.each do |c|\n haml_tag :td do\n if ((c.name.split('_')[-1] == 'id' && c.name != 'id') && (!options[:ignored_foreign_keys].include?(c.name.to_sym)))\n # handle foreign key fields\n foreign_model = (options[:prefix].to_s + c.name.gsub(/_id$/, '')).camelize.constantize\n if foreign_model.column_names.include?('name')\n haml_concat h(instance.__send__(foreign_model.to_s.underscore).name)\n elsif foreign_model.column_names.include?('description')\n haml_concat h(instance.__send__(foreign_model.to_s.underscore).description)\n else\n haml_concat h(instance.__send__(c.name))\n end\n else\n haml_concat h(instance.__send__(c.name))\n end # big if\n end #td\n end #columns.each\n if options[:display_show]\n haml_tag :td do\n haml_concat link_to('Show', url_for(instance))\n end\n end\n if options[:display_edit]\n haml_tag :td do\n haml_concat link_to('Edit', url_for(instance) + \"/edit\")\n end\n end\n if options[:display_destroy]\n haml_tag :td do\n haml_concat link_to('Destroy', url_for(instance), :confirm => \"Are You Sure?\", :method => :delete)\n end\n end\n end #tr\n end #aggregation\n end #tbody\n end #table\n end",
"def render(presult)\n self.render_headings(presult) + self.render_body(presult)\n end",
"def render_for_webquery( statement, group_by_columns )\n\n report_state_hash = YAML.load(self.view_state)\n conn = User.connection\n recordset = conn.select_all(Globals.cleanup_where(statement))\n\n if group_by_columns.nil? || group_by_columns.empty?\n if report_state_hash[:columns_list].nil? || report_state_hash[:columns_list].empty?\n if recordset.empty?\n keys = ['No records found']\n else\n keys = recordset[0].keys\n end\n else\n # Use the provided list of columns.\n keys = report_state_hash[:columns_list].map {|k| k.gsub('\"', '').strip }\n end\n else\n keys = group_by_columns\n # Include the sum or count columns.\n unless recordset.empty?\n extra_cols = recordset[0].keys - keys\n keys += extra_cols\n end\n end\n\n s = \"<table><tr><th>#{keys.join('</th><th>')}</th></tr>\"\n recordset.each do |record|\n s << '<tr>'\n keys.each do |k|\n s << \"<td>#{format_for_spreadsheet(record[k])}</td>\"\n end\n s << '</tr>'\n end\n s << '</table>'\n end",
"def draw()\n @vc.content_tag(:table) do\n @left = true\n @vc.capture do\n for col in columns do\n @vc.concat col.field(@record, self)\n end\n @vc.concat('<td colspan=3></td>'.html_safe) if !@left\n end\n end\n end",
"def render_record_in_list(record, controller_path)\n text = render_record_from_config(record)\n if record_select_config.link?\n url_options = {:controller => controller_path, :action => :select, :id => record.id, :escape => false}\n link_to text, url_options, :method => :post, :remote => true, :class => ''\n else\n text\n end\n end",
"def result_partial\n if params[:q_ds].nil?\n obj = @project\n proj = obj\n unless params[:r_ds].nil?\n obj = obj.miga.dataset(params[:r_ds])\n obj_miga = obj\n end\n else\n obj = QueryDataset.find(params[:q_ds])\n end\n obj_miga ||= obj.miga\n res = obj_miga.result(params[:result])\n render partial: 'shared/result',\n locals: { res: res, key: params[:result].to_sym, obj: obj, proj: proj },\n layout: false\n #rescue\n # head :ok, content_type: 'text/html'\n end",
"def render_item_list(params)\n docpath = params.fetch(:docpath)\n key = params.fetch(:key)\n klass = params.fetch(:klass, ItemList)\n title = params.fetch(:title, \"Cloud Platform Reports\")\n\n template = docpath.to_sym\n\n item_list = get_data_from_json_file(docpath, key, klass)\n\n locals = {\n title: title,\n updated_at: item_list.updated_at,\n list: item_list.list,\n }\n\n erb template, locals: locals\nend",
"def row_for_single(match)\n row = content_tag :tr do\n cells = []\n \n cell = content_tag :td do \n formatted_date(match.date_played) \n end\n cells << cell\n\n cell = content_tag :td do\n match['pname']\n end\n cells << cell\n\n\n\n cell = content_tag :td do \n match.place \n end\n cells << cell\n\n cell = content_tag :td do \n match.surface \n end\n cells << cell\n\n cell = content_tag :td do\n match.environment\n end\n\n cells.join.html_safe\n end\n\n row.html_safe\n end",
"def render\n render_to_string(:inline => '<%= render_grid(grid) %>', :locals => {:grid => self})\n end",
"def to_html(fields) \n output = []\n output << %(<table class=\"#{@options[:table_class]}\">)\n\n # Title\n if @options.has_key?(:title)\n output << %(<tr class=\"#{@options[:first_row_class]}\">)\n output << %(<th class=\"#{@options[:title_class]} #{@options[:first_row_class]} #{@options[:first_column_class]}\" colspan=\"#{fields.length}\">#{@options[:title]}</th>)\n output << %(</tr>)\n end\n\n # First row (header)\n output << %(<tr class=\"#{@options[:first_row_class]}\">)\n fields.each_with_index do |field, index|\n output << %(<th class=\"#{@options[:first_row_class]} #{column_classes(fields, index)}\">#{field}</th>)\n end\n output << \"</tr>\"\n\n @rows.each_with_index do |row, row_index|\n if block_given?\n yield_output = yield(row)\n\n data = []\n row_options = {}\n case yield_output\n when Array\n data = yield_output\n when Hash\n data = yield_output.delete(:data)\n row_options = yield_output\n else\n raise ArgumentError, \"TidyTable block expects an Array or Hash, but a #{yield_output.class} was returned.\"\n end\n\n row_classes = [row_index % 2 == 0 ? 'even': 'odd', row_options[:class]].select {|i| !i.nil?}.join(' ')\n output << %(<tr class=\"#{row_classes}\" #{\"id=\\\"#{row_options[:id]}\\\"\" if row_options.has_key?(:id)}>)\n data.each_with_index do |item, index|\n output << %(<td class=\"#{column_classes(data, index)}\">#{item}</td>)\n end\n else\n output << %(<tr class=\"#{row_index % 2 == 0 ? 'even': 'odd'}\">)\n fields.each_with_index do |field, index|\n output << %(<td class=\"#{column_classes(fields, index)}\">#{row.send(field.to_sym)}</td>)\n end\n end\n output << \"</tr>\"\n end\n output << \"</table>\"\n output.join\n end",
"def to_html\n %Q|<table border=1>\\n<caption>#@name</caption>\\n| + data.map { |row| '<tr>' + row.map { |v| '<td>' + CGI.escapeHTML(v.to_s) }.join }.join(\"\\n\") + \"\\n</table>\"\n end",
"def get_search_result_body_html(record_arr)\n str_arr = []\n record_arr.each_with_index do |r, index|\n str_arr << %{<div class=\"search_item\" id=\"search_item_#{index}\">\n <h3 class=\"titbg\"><span class=\"title_ico\"> </span>\n <a href=\"#{r.url}\" target=\"_blank\">#{r.title}</a>\n </h3>\n <a href=\"#{r.url}\" target=\"_blank\">#{r.url[0..79]}</a><br/>\n #{(r.summary).html_safe}\n </div>}\n end\n str_arr.join(\"\\n\")\n end",
"def ft_generate_html(tags, *args, &block)\n # todo: pass these tags as a parameter; don't rely on ugly globals\n FreightTrain.tags = tags\n\n options = args.extract_options!\n collection_name = args.last.to_s\n raise ArgumentError, \"Missing collection name\" if collection_name.blank?\n model_name = collection_name.classify\n instance_name = collection_name.singularize\n partial = options[:partial] || instance_name\n\n @inline_editor = \"function(tr){}\"\n\n records = instance_variable_get \"@#{collection_name}\"\n path = options[:path] || polymorphic_path(args)\n\n # put everything inside a form\n raw_or_concat(\n \"<form class=\\\"freight_train\\\" data-model=\\\"#{model_name}\\\" action=\\\"#{path}\\\" method=\\\"get\\\">\" <<\n \"<input name=\\\"#{request_forgery_protection_token}\\\" type=\\\"hidden\\\" value=\\\"#{escape_javascript(form_authenticity_token)}\\\"/>\\n\" <<\n \"<input name=\\\"ft[partial]\\\" type=\\\"hidden\\\" value=\\\"#{partial}\\\"/>\\n\" <<\n \"<input name=\\\"freight_train\\\" type=\\\"hidden\\\" value=\\\"true\\\"/>\\n\" <<\n\n # table\n alt_content_tag(:table, :class => \"list #{options[:class]}\") {\n=begin\n head = block_given? ? capture(ListBuilder.new(instance_name, self, options), &block) : \"\"\n body = (records and !records.empty?) ? render(:partial => partial, :collection => records) : \"\"\n alt_content_tag(:thead, head) <<\n alt_content_tag(:body, body, :id => collection_name)\n=end\n lb = ListBuilder.new(instance_name, self, options)\n header = capture(lb, &block) if block_given?\n footer = lb.footer_html\n html = \"\"\n html << alt_content_tag(:thead) { header.html_safe } unless header.blank?\n html << alt_content_tag(:tbody, :id => collection_name) {\n render(:partial => partial, :collection => records) unless !records or records.empty?\n }\n html << alt_content_tag(:tfoot) { footer.html_safe } unless footer.blank?\n html.html_safe\n } <<\n \"</form>\\n\" <<\n\n \"#{will_paginate(records) if options[:paginate]}\" <<\n make_interactive(path, collection_name, options)\n\n )\n end",
"def build_html\n ApplicationController.render(partial: partial, locals: locals)\n end",
"def render_partial(*ignore_args); end",
"def render(columns)\n output = ''\n columns.each do |column|\n m = column.name\n output << if m == :name && @selected\n column.render(color.white.bold(@name) + color.bold.yellow('>'))\n else\n column.render(send(m))\n end\n end\n output\n end",
"def to_partial_path\n 'row'\n end",
"def render(what, *args, &blk)\n case what\n when NilClass then ''\n when String then render_template(what, *args, &blk)\n when Enumerable then what.map { |i| render(i, *args, &blk) }.join\n else render_resource(what, *args)\n end\n end",
"def table_row_helper(cells, opts={})\n if cells[0] == :divider\n # this is not very nice..\n \"<tr><td colspan='#{cells[1]}' class='divider'><div></div></td></tr>\".html_safe\n else\n # Tried making this with content_tag but couldn't get the html_safe to work right... :S\n \"<tr>#{cells.compact.each_with_index.map{ |cell, i|\n # ... fixme\n if cell.is_a? Hash\n cell_content = ERB::Util.h(cell[:content])\n cell_opts = cell\n else\n cell_content = ERB::Util.h(cell)\n cell_opts = {}\n end\n classes = []\n classes << 'small_label' if i.even? && opts[:labels] && cells.length > 1\n classes << 'pre' if cell_opts[:pre]\n classes << 'tiny' if cell_opts[:tiny]\n classes << 'small' if cell_opts[:small]\n classes << 'bold' if cell_opts[:bold]\n classes << 'light' if cell_opts[:light]\n classes << 'superlight' if cell_opts[:superlight]\n\n styles = []\n styles << 'padding-left:2em' if i != 0 && i.even?\n # Yuck, this is nuts..\n \"<td\" +\n \"#{\" colspan='#{cell_opts[:colspan]}'\" if cell_opts[:colspan]}\" +\n \" style='#{safe_join(styles, ';')}'\" +\n \" class='#{safe_join(classes, ' ')}'\" +\n \">#{cell_content}\"+\n \"#{\"<br/><span class='small light'>#{cell_opts[:note]}</span>\" if cell_opts[:note]}\" + # even more hackery\n \"</td>\"\n }.join(\"\\n\")}</tr>\".html_safe\n end\n end",
"def in_rows_of(n,collection)\n return '' if (collection.nil? || collection.empty?)\n rows = ''\n collection.each_slice(n) do |things|\n row = ''\n things.each { |l| row << content_tag('td', yield(l)) }\n rows << content_tag('tr', row.html_safe)\n end\n content_tag('table') do\n content_tag('tbody', rows.html_safe)\n end\n end",
"def render_search_items(params, matches)\n result = []\n result << heading_content\n @block.block_one_table_headers.each do |both|\n oth = both.one_table_header\n result << render_search_item(repeating_content, both, oth)\n end\n result << trailing_content\n result.join(\"\\n\")\n end",
"def load_data_with_partials(hash=nil)\n if(@partials != nil) #if a partial has actually been submitted\n hash ||= {}; #if nil, make a hash. (return value)\n hash[:htmlElts] = {}; #hash for each elementID<=>newHTML pair\n \n @partials.each { |p| #for each partial submitted\n partial_id = find_partial_name(p[0].to_s);\n\n #build the html from embedded ruby files in views and relevant inputs\n hash[:htmlElts][partial_id] = ERB.new(render_to_string(render_function_hash(p))).result;\n }\n end\n return hash;\n end",
"def render_ext_grids(title, url, fields, options = {})\n render :partial => \"admin/extjs/list\", :locals => {\n :remote_url => url,\n :title => title,\n :fields => fields,\n :auto_expand => options[:auto_expand],\n :random_id => rand(10000) }\n end",
"def rows(parts=@parts)\n \n @renderer.rows(parts)\n \n end",
"def table_of(things,opts={})\n kind = things.first.table_name\n # columns = things.first.visible_columns\n add_class_to_html_options(opts, kind)\n content_tag(\n :table,\n render(:partial => \"/#{kind}/table_row\", :collection => things),\n opts\n )\n end",
"def partial(filename, binding)\n template_file = get_template_file(filename)\n ERB.new(template_file, nil, '-', '_erbout2').result(binding)\nend",
"def render(options = {}, local_assigns = {}, &block)\n ### TODO: delegate dynamically:\n ### TODO: we have to find out if this is a call to the cells #render method, or to the rails\n ### method (e.g. when rendering a layout). what a shit.\n if view = options[:view]\n return cell.render_view_for(options, view)\n end\n \n \n # rails compatibility we should get rid of:\n if partial_path = options[:partial]\n # adds the cell name to the partial name.\n options[:partial] = expand_view_path(partial_path)\n end\n #throw Exception.new\n \n super(options, local_assigns, &block)\n end",
"def populate_html_template(html, status, table_results)\n #####TODO: put in data set\n @failed = status[1]\n @passed = status[3]\n @table_results = table_results.split().join.strip\n html_template = parse_file_template(html)\n html_src = ERB.new(html_template).result(binding)\n end",
"def render(template_name)\n if already_built_response? \n raise \"DoubleRenderError\"\n else \n controller_name = self.class.to_s.underscore \n dir = File.join(\"views\",controller_name, \"#{template_name}.html.erb\")\n # debugger\n content = File.read(dir).split(\"\\n\")\n content.map! do | statement | \n start_point = /<%/ =~ statement\n # debugger\n if start_point.nil? \n statement\n else \n front_part = statement[0...start_point]\n # returning = \n # start_point += statement[start_point+2] == \"=\" ? 2 : 1\n end_point = /%>/ =~ statement \n end_point += 1\n rear_part = statement[end_point+2..-1]\n front_part.to_s + ERB.new(statement[start_point..end_point]).result(binding) + rear_part.to_s\n end \n end \n render_content(content)\n end \n end",
"def render(pathname)\n @partial_templates ||= {}\n ::ERB.new(File.read(pathname)).result(binding)\n end",
"def unified_simple_body(builder)\n gen_cols = @generated.transpose.map { |col| col.join(\"\\n\") }\n builder.tr do\n builder.td(class: 'line-nr') do\n builder << (1..@generated.length).to_a.join(\"\\n\")\n end\n builder.td(class: 'line-nr')\n\n builder << Array.new(@combined_headers.length) { |i| @gen_header_indices.index(i) }.map do |idx|\n if idx.nil?\n '<td></td>'\n else\n %(<td class=\"del\">#{CGI.escape_html gen_cols[idx]}</td>)\n end\n end.join\n end\n\n exp_cols = @expected.transpose.map { |col| col.join(\"\\n\") }\n builder.tr do\n builder.td(class: 'line-nr')\n builder.td(class: 'line-nr') do\n builder << (1..@expected.length).to_a.join(\"\\n\")\n end\n\n builder << Array.new(@combined_headers.length) { |i| @exp_header_indices.index(i) }.map do |idx|\n if idx.nil?\n '<td></td>'\n else\n %(<td class=\"ins\">#{CGI.escape_html exp_cols[idx]}</td>)\n end\n end.join\n end\n end",
"def render\n return ro_standard if @readonly\n\n set_initial_value('html','selected')\n # separate options and html part\n options_part = {}\n @yaml['html'].symbolize_keys!\n %i(selected include_blank).each { |sym| options_part[sym] = @yaml['html'].delete(sym) if @yaml['html'][sym] }\n @yaml['html'][:multiple] = true if @yaml['multiple']\n\n record = record_text_for(@yaml['name'])\n if @yaml['html'][:multiple]\n @html << @parent.select(record, @yaml['name'], get_choices, options_part, @yaml['html'])\n @js << \"$('##{record}_#{@yaml['name']}').selectMultiple();\"\n else\n @html << @parent.select(record, @yaml['name'], get_choices, options_part, @yaml['html'])\n # add code for view more data\n @html << add_view_code() if @yaml['view']\n end\n self\nend",
"def display_search_results_row(object)\n user_column_fields.reduce(String.new) do |string, field|\n string << (tag.td object.send(field))\n end\n .html_safe +\n display_user_posts(object.posts)\n end",
"def render(*data)\n data.map do |datum|\n if bind\n erb.result(bind)\n else\n Entry.new(self, datum, colorize).render(erb)\n end\n end.join(separator)\n end",
"def render_cell(column_name, cell_value, record)\n\n if column_name==\"get_historic_pricing\"\n column_config = {:id_value => record['id'],\n :image => 'historic_pricing',\n :host_and_port => @request.host_with_port.to_s,\n :controller => @request.path_parameters['controller'].to_s,\n :target_action => 'get_historic_pricing'}\n popup_link = ApplicationHelper::LinkWindowField.new(nil, nil, 'none', 'none', 'none', column_config, true, nil, @env)\n return popup_link.build_control\n end\n\n if !@env.session.data[:current_viewing_order]\n if(column_name==\"price_per_carton\" || column_name==\"price_per_kg\" || column_name==\"fob\")\n return @env.text_field('order_product', \"#{record['id']}_#{column_name}\", {:size=>5,:value=>record[column_name]})\n end\n else\n if column_name==\"price_per_carton\"\n return record['price_per_carton']\n elsif column_name==\"price_per_kg\"\n return record['price_per_kg']\n elsif column_name==\"fob\"\n return record['fob']\n end\n end\n\n if column_name==\"price_histories\"\n column_config = {:id_value => record['id'],\n :image => 'price_histories',\n :host_and_port => @request.host_with_port.to_s,\n :controller => @request.path_parameters['controller'].to_s,\n :target_action => 'price_histories'}\n popup_link = ApplicationHelper::LinkWindowField.new(nil, nil, 'none', 'none', 'none', column_config, true, nil, @env)\n return popup_link.build_control\n end\n\n\n if column_name==\"subtotal\"\n if record['price_per_carton']==nil\n subtotal=0\n else\n subtotal=record['price_per_carton'] * record['carton_count']\n end\n return subtotal\n end\n\n if column_name==\"delete\"\n link_url = @env.link_to('delete', \"http://\" + @request.host_with_port + \"/\" + \"fg/order_product/delete_order_product\" + \"/\" + record['id'].to_s , {:class=>'action_link'})\n return link_url\n end\n end",
"def build_table_helpers(resource)\n @module.module_eval <<-end_eval\n def #{resource.singular}_table(opts={}, &block)\n content = capture(&block)\n opts[:class] = ResourcefulViews.resourceful_classnames('#{resource.singular}_table', *(opts.delete(:class) || '').split)\n concat(content_tag(:table, content, opts))\n end\n def #{resource.singular}_row(*args, &block)\n opts = args.extract_options!\n opts[:class] = ResourcefulViews.resourceful_classnames('#{resource.singular}', *(opts.delete(:class) || '').split)\n opts[:id] = '#{resource.singular}_' + args.first.id.to_s unless args.empty?\n content = capture(&block)\n concat(content_tag(:tr, content, opts))\n end\n end_eval\n end",
"def all_input_tags_wrapper(record, rows)\n \"\\n<table class='#{record.class.scaffold_table_class :form}'><tbody>\\n#{rows.join}</tbody></table>\\n\"\n end",
"def render_partial(context, options, &block); end",
"def render_grid_template_row(model = nil, **opt)\n model ||= grid_row_model_class.new\n opt[:row] &&= 0\n opt[:id] = unique_id(opt[:id])\n opt[:index] = GridIndex::NONE\n opt[:outer] = append_css(opt[:outer], 'hidden')\n opt[:template] = true\n # noinspection RubyMismatchedArgumentType\n render_grid_data_row(model, **opt)\n end",
"def render(options={}, &block)\n if options[:nothing]\n return \"\" \n end\n \n if options[:text]\n options.reverse_merge!(:render_children => false)\n end\n \n options.reverse_merge! :render_children => true,\n :locals => {},\n :invoke => {},\n :suppress_js => false\n \n \n rendered_children = render_children_for(options)\n \n options[:locals].reverse_merge!(:rendered_children => rendered_children)\n \n @suppress_js = options[:suppress_js] ### FIXME: implement with ActiveHelper and :locals.\n \n \n render_view_for(options, action_name) # defined in Cell::Base.\n end",
"def results\n get_results(true)\n render :partial => (params[:result_partial] || 'results')\n end",
"def render_cell(*)\n Capybara.string super\n end",
"def index\n @scan = scan\n\n html_block = if render_partial?\n proc { render partial: 'table' }\n else\n proc { redirect_to @scan }\n end\n\n respond_to do |format|\n format.html( &html_block )\n format.js { render partial: 'table.js' }\n #format.json { render json: @issues }\n end\n end",
"def show_row\n @dataset = Dataset.find(params[:dataset_id])\n if params[:row_id].gsub(/[0-9]/,\"\").length == 0 #il n'y a que des chiffres\n @data = ActiveRecord::Base.connection.select_one(\"SELECT * from dataset_#{@dataset.id} WHERE id = #{params[:row_id]} LIMIT 1\")\n render :inline => @data.to_json \n else\n render :text => 'Invalid parameters'\n end\n end",
"def render(props)\n # HTML.\n end",
"def partial(file_name)\n erb file_name, :layout => false\n end",
"def render_in_page(thepage)\n render_to_string(:inline => '<%= render_grid_in_page(grid,page) %>', :locals => {:grid => self, :page => thepage})\n end",
"def construct_table_row(user)\n result = {}\n result[:id] = user.id\n result[:user_name] = CGI.escapeHTML(user.user_name)\n result[:first_name] = CGI.escapeHTML(user.first_name)\n result[:last_name] = CGI.escapeHTML(user.last_name)\n @render_note_link = false\n if user.student?\n result[:grace_credits] = user.remaining_grace_credits.to_s + '/' + user.grace_credits.to_s\n if user.has_section?\n result[:section] = user.section.name\n else\n result[:section] = '-'\n end\n @render_note_link = true\n end\n result[:hidden] = user.hidden\n result[:filter_table_row_contents] =\n render_to_string :partial => 'users/table_row/filter_table_row',\n :formats => [:html], :handlers => [:erb],\n :locals => {:user => user,\n :controller => self.controller_name,\n :render_note_link => @render_note_link}\n result\n end",
"def td_content record, col\n content = col.count ? record.send(col.data_index).count : record.send(col.data_index)\n unless content.nil?\n content = content.strftime(col.date_format) unless col.date_format.nil?\n content = link_to content, action.inject_url(col.link, record) unless col.link.nil?\n content = col.format.call(@store.records, record) unless col.format.nil?\n content\n end\n end",
"def table(records, &block)\n return if records.empty?\n rows = collect_rows(records, &block)\n col_widths = calculate_column_widths(rows)\n\n rows.each do |row|\n line = row.values.each_with_index.map do |value, col|\n value.to_s.ljust(col_widths[col])\n end.join(\" \").rstrip\n line = color.colorize(line, row.color) if row.color\n puts line\n end\n end",
"def fancygrid(name, options=nil, &block)#:yields: column, record, value\n store_name = name.to_s\n raise \"Missing fancygrid for name '#{store_name}'\" if(@fancygrid.nil? || @fancygrid[store_name].nil?)\n fancygrid_instance = @fancygrid[store_name]\n \n options ||= {}\n [:data, :template, :url, :search_visible, :hide_top_control, \n :hide_bottom_control, :grid_type, :search_formats\n ].each do |option|\n fancygrid_instance.send(option.to_s + \"=\", options[option]) if options[option]\n end\n \n format_block = block_given? ? block : nil\n template = Fancygrid.table_template\n template = Fancygrid.list_template if(fancygrid_instance.grid_type.to_s == \"list\")\n \n render(:template => template, :locals => { \n :fancygrid => fancygrid_instance, \n :cells_block => format_block, :format_block => format_block\n })\n end",
"def search\n col_dict = {\n :unit_code => \"0\",\n :name => \"1\",\n :email => \"2\"\n }\n \n if params[:filter]\n col_dict.keys.each do |k|\n search = params[:filter][ col_dict[k] ]\n next if search.blank?\n \n if k == :name\n fn, ln = search.split(\" \", 2)\n \n if !ln.blank?\n params[:first_name] = fn\n params[:last_name] = ln\n \n else\n params[:first_name] = fn\n end\n \n else\n params[k] = search\n end\n \n end\n end\n \n # tablesorter page index start with 0\n params[:page] = params[:page].to_i + 1\n \n filter_residents(10)\n \n #render :json => {:resident_path => @resident ? property_resident_path(@property, @resident, :anchor => \"addTicket\") : nil }\n \n render template: \"residents/table.json.rabl\" \n \n end",
"def render\n res = { content: fields, data: { csv_row_index: @csv_row.row_index } }\n format.add_class res, row_css_classes\n res\n end",
"def to_partial_path\n 'documents_submitted_row'\n end",
"def partial(name, options={})\n old_format = self.template_format\n self.template_format = :html\n js render({ :partial => name }.merge(options))\n ensure\n self.template_format = old_format\n end",
"def renderRec(model, rec, result)\n nameSpace, base = assertNamespace(rec.name)\n L.info(\"Rendering record #{rec.name}\")\n result << %<\nmessage #{base} {\n>\n pbInt = 1\n rec.fields.each_key { | fldId|\n fld = rec.fields[fldId]\n ty = fld.dataType.type\n if fld.aggr && !fld.map?\n result << \"#{INDENT}repeated #{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n elsif fld.map?\n raise ArgumentError, %<Field \"#{fldId}\" of the rec \"#{base}\": for Protobuf, map can not be optional, it must be required> unless fld.isRequired\n result << \"#{INDENT}map<#{protoType(fld.dataType, model, rec)}, #{protoType(fld.trgType, model, rec)}> #{fldId} = #{pbInt};\\n\"\n elsif model.enums[ty] && model.enums[ty].is_a?(DataMetaDom::Mapping)\n raise ArgumentError, %<Field \"#{fldId}\" of the rec \"#{base}\": for Protobuf, map can not be optional, it must be required> unless fld.isRequired\n result << \"#{INDENT}map<#{protoType(model.enums[ty].fromT, model, rec)}, #{protoType(model.enums[ty].toT, model, rec)}> #{fldId} = #{pbInt};\\n\"\n elsif fld.isRequired\n result << \"#{INDENT}#{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n else\n result << \"#{INDENT}repeated #{protoType(fld.dataType, model, rec)} #{fldId} = #{pbInt};\\n\"\n end\n pbInt += 1\n }\n result << %q<}\n>\n end",
"def table_for(collection, options = {}, *attr_list)\n actions = false\n classes = options[:classes] || \"\"\n model_class_name = options[:model_name] || collection.name\n table_id = options[:id] || model_class_name.tableize\n table_klazz = model_class_name.constantize\n table_headers = []\n\n attr_list.flatten.each do |attr_name|\n if attr_name.class == Hash && !attr_name[:actions].nil?\n actions = attr_name[:actions]\n else\n header_content = table_klazz.human_attribute_name(attr_name)\n header = content_tag(:th, header_content)\n table_headers << header\n end\n end\n\n if actions\n table_headers << content_tag(:th, t('actions'), class: 'table_actions')\n end\n\n thead = content_tag :thead, content_tag(:tr, table_headers.join(\" \").html_safe)\n table_content = \"\"\n if options[:partial].present?\n table_content = render partial: options[:partial], collection: collection\n else\n table_content = render collection\n end\n tbody = content_tag :tbody, table_content\n table = content_tag(:table, \"#{thead} #{tbody}\".html_safe, id: table_id, class: \"table table-hover #{classes}\")\n table.html_safe\n end",
"def show_raw\n rid = find_request(params[:rid])\n return render_404 if rid.nil?\n\n setup_template_variables(rid)\n render partial: 'single_request'\n end",
"def get_candidates_for_recruiter int_id\r\n # Add more column names in query if you want\r\n @all = Answer.find(:all, :select => \"invitations.candidate_email ,invitations.interview_id ,users.id\", :from => \"invitations\", :joins => \"INNER JOIN users ON invitations.candidate_email = users.email WHERE invitations.interview_id = #{int_id} and invitations.status = true\", :conditions => \"invitations.interview_id = #{session[:int_id]} and candidates.user_id = users.id and invitations.status = 1\")\r\n #@all = Answer.find_by_sql(\"SELECT invitations.candidate_email ,invitations.interview_id ,users.id\r\n # FROM invitations INNER JOIN users ON invitations.candidate_email = users.email WHERE invitations.interview_id = #{int_id} and invitations.status =1\")\r\n render :partial => \"some_partial_name\"\r\n end",
"def showrecord(record, &pregrid)\n color, normal = getcolors(record)\n @grids.each do |grid|\n pregrid and pregrid.call( grid )\n rowstr = grid.rowstr { |col|\n value = ( record[col.shortname] || '' )\n value = value.gsub(/\\s+/, ' ').strip\n }\n puts [color, rowstr, normal].join\n end\n puts if @grids.length > 1\n return true\n end",
"def fetch_and_render\n @courses = Course.active\n @fee_accounts = FeeAccount.all\n if request.xhr?\n\n @search_params[:search_method] = @search_method\n result = MasterParticularReport.search(@search_params)\n\n if result.is_a?(Array)\n flash.now[:notice] = t(result[1])\n else\n @report_hash = result\n @report_hash[:course_id] = @search_params[:course_id]\n @report_hash[:batch_id] = @search_params[:batch_id]\n end\n\n render :update do |page|\n if @status\n page.replace_html 'flash_msg', :text => \"\"\n page.replace_html 'report_results', :partial => @partial\n page << \"enable_disable_submit(false)\"\n else\n flash.now[:notice] = \"Please make a valid selection for fetching report\"\n page.replace_html 'flash_msg', :partial => 'flash_msg'\n page.replace_html 'report_results', :text => \"\"\n page << \"enable_disable_submit(true)\"\n end\n end\n end\n end",
"def _render_template(options); end",
"def _render_template(options); end",
"def partial (filename,locals={})\n source = File.read(find(filename))\n engine = Haml::Engine.new(source)\n engine.render(binding,locals)\nend",
"def rendered_cell_content(route, parameters)\n render_cell(route.klass.underscore.to_sym, route.action.to_sym, parameters)\n end",
"def render_dl_row\n markup = ''\n\n return markup if (values.blank? || array_of_empty_strings?(values)) && !options[:include_empty]\n markup << %(<dt>#{label}</dt>\\n<dd><ul class='tabular'>)\n attributes = microdata_object_attributes(field).merge(class: \"attribute attribute-#{field}\")\n Array(values).each do |value|\n markup << \"<li#{html_attributes(attributes)}>#{attribute_value_to_html(value.to_s)}</li>\"\n end\n markup << %(</ul></dd>)\n markup.html_safe\n end",
"def render_games( games, opts={} )\n render partial: 'sport_db_admin/shared/table_games', locals: { games: games }\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.haml\n format.json {\n page = 1\n\n page = params[:iDisplayStart].to_i/10+1 if params[:iDisplayStart]\n e = Course\n e = e.joins(:instructor, :college)\n\n total_record_size = 0\n display_length = 10\n\n if params[:iDisplayLength].to_i > 10\n display_length = params[:iDisplayLength].to_i\n end\n\n if params[:iSortCol_0].to_i != 0\n sort_column = DatatableFields[params[:iSortCol_0].to_i]\n sort_direction = params[:sSortDir_0]\n if [\"instructor\", \"college\"].include?(sort_column)\n sc = \"\"\n case sort_column\n when /instructor/\n sc = \"instructors.name\"\n when /college/\n sc = \"colleges.college_tag\"\n end\n e = e.order(\"#{sc} #{sort_direction}\")\n else\n e = e.order(\"#{sort_column} #{sort_direction}\")\n end\n end\n\n\n if params[:sSearch] != \"\" && !params[:sSearch].nil?\n \n search = DatatableFields.collect{|d| \"#{d} LIKE '%#{params[:sSearch]}%'\" unless [\"college\",\"instructor\", \"add\", \"friends\"].include?(d) }.compact.join(' OR ')\n search2 = \" OR instructors.name LIKE '%SUB%' OR colleges.college_tag LIKE '%SUB%' \".gsub('SUB', params[:sSearch])\n search += search2\n\n e = e.where(search)\n total_record_size = e.count\n e = e.page(page).per(display_length)\n #logger.info \"EQ: \" + e.to_sql\n else\n total_record_size = e.count\n e = e.page(page).per(display_length)\n end\n\n\n json = DatatablesRails::Structify.new(e)\n \n json.formatter do |u|\n course = Course.find(u['id'])\n if current_user.courses.where(:id => u['id']).first.blank?\n u['add'] = self.class.helpers.link_to \"Add\", user_courses_path(:course_id => u['id']), :method => :post, :remote => :true, :onclick => \"$(this).html('Added')\"\n else\n u['add'] = \"Added\"\n end\n u['course_number'] = self.class.helpers.link_to u['course_number'], course_path(:id => u['id'])\n u['instructor'] = self.class.helpers.link_to course.try(:instructor).try(:name), instructor_path(:id => course.try(:instructor_id))\n u['college'] = course.college.college_tag.upcase\n u['begin_time'] = u['begin_time'].strftime(\"%I:%M %p\")\n u['end_time'] = u['end_time'].strftime(\"%I:%M %p\")\n u['friends'] = current_user.find_friends_in_course(u['id']).size\n end\n json_struct = json.struct\n json_struct[\"iTotalRecords\"] = total_record_size\n json_struct[\"iTotalDisplayRecords\"] = total_record_size\n json_struct[\"sEcho\"] = params[:sEcho]\n render :json => json_struct\n\n }\n end\n end",
"def render_multi(multi)\n end",
"def browse_partial\n render :layout => false, :html => (params.to_json * 20)\n end",
"def render_record_select(options = {}) #:nodoc:\n controller.send(:render_record_select, options) do |options|\n render options\n end\n end",
"def render(views, filter_results)\n @content\n end",
"def content\n @row.html\n end",
"def display\n\t\tdisplay_headers\n\t\t@rows.each do |row|\n\t\t\tdisplay_row(row)\n\t\tend\n\tend",
"def partial(partial)\n partial_view = \"partials/_#{partial}\".to_sym\n erb partial_view, :layout => false\nend",
"def to_partial_path\n 'contact_details_row'\n end",
"def records(options = {})\n persisted_records_for(@association, @form, options) do |fields_for_association|\n render_association_partial(fields_for_association, options)\n end\n end",
"def nasty_columns_1\n @company = Company.new\n @company.name = \"B\"\n @company.rating = 2\n render :inline => \"snicker....\"\n end",
"def erb(template) render template end",
"def render(*args)\n options = {}\n if args.length == 1 && args[0].class == String\n # render partial\n options[:partial] = args[0]\n elsif args.length == 1 && args[0].class == Hash\n # render :partial => 'partial', :locals => {:var1 => value1, :var2 => value2}\n options = args[0]\n elsif args.length == 2 && args[0].class == String && args[1].class == Hash\n # render 'partial', :var1 => value1, :var2 => value2\n options[:locals] = args[1]\n options[:partial] = args[0]\n elsif args.length == 1 && args[0].class == Array\n # render ['xpartials','ypartials']\n raise PartialError, \"render array not yet implemented\"\n else\n raise PartialError, \"unsupported arguments\"\n end\n partial = options[:partial] || nil\n raise PartialError, \"partial not specified\" unless partial\n prawn = options[:prawn] || pdf\n @locals_stack ||= []\n @locals_stack.push @locals\n @locals = options[:locals]\n @pdf_stack ||= []\n @pdf_stack.push @pdf\n @pdf = prawn\n instance_eval(partial_source(partial), __FILE__, __LINE__)\n @pdf = @pdf_stack.pop\n @locals = @locals_stack.pop\n end",
"def eob_claim_sidebar(claim)\n str = \"<b>Submitted Claim:</b><br />\"\n str += \"<table>\"\n str += \"<tr><td>Claim Number:</td><td>#{claim.claim_number}</td></tr>\"\n str += \"<tr><th>Copay:</th><td>#{number_to_currency(claim.insurance_session.copay_amount)}</td></tr>\"\n str += \"<tr><th>Lab Charges:</th><td>$</td></tr>\"\n str += \"<tr><td>---------</td></tr>\"\n str += \"<tr><td>CPT</td><td>Charge</td></tr>\" \n claim.iprocedures.each do |procedure|\n str += \"<tr><td>#{procedure.cpt_code}</td><td>#{number_to_currency(procedure.total_charge)}</td></tr>\"\n end\n str += \"<tr><th>Sub Total:</th><td>#{number_to_currency(claim.insurance_billed)}</td></tr>\"\n str += \"<tr><td>---------</td></tr>\"\n if !claim.insurance_session.ins_allowed_amount.blank? && claim.insurance_session.ins_allowed_amount > 0 \n str += \"<tr><th>Allowed Amt:</th><td>#{number_to_currency(claim.insurance_session.ins_allowed_amount)}</td></tr>\"\n else\n str += \"<tr><th>Charges:</th><td>#{number_to_currency(claim.insurance_session.charges_for_service)}</td></tr>\"\n end\n str += \"<tr><th>Ins Paid:</th><td>#{number_to_currency(claim.insurance_session.ins_paid_amount)}</td></tr>\"\n str += \"<tr><th>Bal Bill Paid:</th><td>#{number_to_currency(claim.insurance_session.bal_bill_paid_amount.blank? ? 0 : claim.insurance_session.bal_bill_paid_amount)}</td></tr>\"\n str += \"<tr><th>Waived Fee:</th><td>#{number_to_currency(claim.insurance_session.waived_fee.blank? ? 0 : claim.insurance_session.waived_fee)}</td></tr>\"\n str += \"<tr><th>Balance Due:</th><td>#{number_to_currency(claim.insurance_session.balance_owed)}</td></tr>\"\n str += \"</table>\"\n return str.html_safe\n end"
] | [
"0.67454976",
"0.6625903",
"0.6348517",
"0.60518867",
"0.59954494",
"0.5915619",
"0.58751804",
"0.5839854",
"0.57700557",
"0.56415856",
"0.5578389",
"0.5541731",
"0.54972696",
"0.5467913",
"0.54628384",
"0.5453182",
"0.54108423",
"0.53909916",
"0.5385601",
"0.5363377",
"0.535562",
"0.5338655",
"0.53170323",
"0.52952844",
"0.52801144",
"0.52558243",
"0.5252423",
"0.52347225",
"0.5233357",
"0.5226917",
"0.5226545",
"0.5206474",
"0.5172169",
"0.5156649",
"0.51503253",
"0.51379466",
"0.51376814",
"0.51338416",
"0.5099496",
"0.508931",
"0.50616306",
"0.5051036",
"0.50446784",
"0.50395644",
"0.50346893",
"0.5017654",
"0.5015399",
"0.50049",
"0.49970767",
"0.49909905",
"0.49841747",
"0.49808905",
"0.49794963",
"0.49757168",
"0.49719334",
"0.49716917",
"0.49716327",
"0.49666524",
"0.49624786",
"0.49476042",
"0.4947278",
"0.4943596",
"0.49293157",
"0.49263504",
"0.49194846",
"0.49157703",
"0.49103948",
"0.4904142",
"0.48962888",
"0.4896021",
"0.4895652",
"0.48929828",
"0.48885682",
"0.48864338",
"0.48862562",
"0.48673245",
"0.48669943",
"0.48666856",
"0.48550028",
"0.4853126",
"0.4842806",
"0.4842806",
"0.48427737",
"0.48397166",
"0.48364645",
"0.48315006",
"0.48242646",
"0.48230213",
"0.4821587",
"0.48183337",
"0.48126233",
"0.48110718",
"0.4811054",
"0.48099846",
"0.48094523",
"0.48005602",
"0.4791192",
"0.47910383",
"0.47906968",
"0.47873124"
] | 0.7949676 | 0 |
skip_before_filter :override_db, :only => [:index, :edit] | def new
@shop_product = ShopProduct.new
#@shop_product.product_id = 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n prevent_non_admin\n end",
"def before_filter; end",
"def prevent_edit\n !can_edit?\n end",
"def index\n index_filter\n end",
"def reset_filter!\n skip_before_action(:filter_access_filter) if method_defined?(:filter_access_filter)\n before_action :filter_access_filter\n end",
"def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end",
"def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end",
"def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end",
"def index\n no_cache\n super\n end",
"def index\n super\n end",
"def filter\n super\n end",
"def show\n admin_only\n end",
"def show\n admin_only\n end",
"def show\n admin_only\n end",
"def index?\n not admin.nobody?\n end",
"def skip_admin_flash\n @skip_admin_flash = true\n end",
"def cannot_edit_All\n if @page.name == Rails.application.config.ALL_PAGE\n redirect_to show_all_path\n end\n end",
"def skip_actions; end",
"def preserve_default_filters!\n\n config.preserve_default_filters!\n\n end",
"def handle_edit\n render nothing: true\n end",
"def index_disabled\n @index_disabled ||= false\n end",
"def show\n admin_only do\n end\n end",
"def index # Only view\n end",
"def edit\n\t\t#super\n\tend",
"def before_action \n end",
"def admin_only\n false\n end",
"def require_admin\n end",
"def edit\n #Nothing necessary\n end",
"def ignore_request_unless_permitted\n return if permitted?\n flash_notice(:permission_denied.t)\n redirect_to(action: \"index_article\") and return\n end",
"def handle_unverified_request\n unless action_name == \"fire_object_search\" || action_name == \"fire_populate_drop_down\" \n super\n end\n end",
"def index\n @admin_logins = Login.where('id != ?', 1000)\n end",
"def authorized_to_edit_records\n scope.none\n end",
"def action_disable\n super\n end",
"def after_filter; end",
"def restrict_developer\n if (controller_name == 'user_sessions' and action_name == 'destroy') or\n (controller_name == 'users' and (action_name == 'edit' || action_name == 'update'))\n return\n end\n if current_user and is_developer \n redirect_to :controller => 'efforts'\n end\n end",
"def index?\n false\n end",
"def edit\n # super\n end",
"def index_filters\n {}\n end",
"def croucher_index_confidentiality\n \"private\"\n end",
"def before_update\n lock_column_instance_filter\n super\n end",
"def index\n redirect_to :action => \"new_or_edit\"\n end",
"def edit\n super\n end",
"def edit\n super\n end",
"def edit\n super\n end",
"def index_redirect(**opt, &blk)\n opt[:dst] ||= :list_own\n super(**opt, &blk)\n end",
"def index\n redirect_to :action => \"edit\" and return\n end",
"def index\n init(false,false)\n \n end",
"def skip_schema_queries; end",
"def index\n authorize Admin\n @admins = initialize_grid(Admin.where(\"id != ?\", current_admin.id).order('id desc'), per_page: 10)\n end",
"def index(model, instance = nil)\n # do nothing\n true\n end",
"def set_record_action\n @record_action = case\n when request.original_url.include?('edit')\n 'edit'\n when request.original_url.include?('delete')\n 'delete'\n when request.original_url.include?('clone')\n 'clone'\n when request.original_url.include?('revert')\n 'revert'\n end\n end",
"def set_record_action\n @record_action = case\n when request.original_url.include?('edit')\n 'edit'\n when request.original_url.include?('delete')\n 'delete'\n when request.original_url.include?('clone')\n 'clone'\n when request.original_url.include?('revert')\n 'revert'\n end\n end",
"def admin_logic\n end",
"def filter_redirect; end",
"def filter_redirect; end",
"def view_only!\n @view_only = true\n end",
"def show\r\n find_record\r\n # before_show callback\r\n if (m = callback_method('before_show') )\r\n ret = call_callback_method(m)\r\n if ret.class == FalseClass\r\n @form['readonly'] = nil # must be\r\n flash[:error] ||= t('drgcms.not_authorized')\r\n return index\r\n end\r\n end \r\n\r\n render action: 'edit', layout: 'cms'\r\nend",
"def hijack_db\n unless current_government\n redirect_to \"http://\" + NB_CONFIG['multiple_government_base_url'] + \"/\"\n return\n end\n current_government.switch_db\n end",
"def admin_index\n return unless (user_is_allowed_to 'view', 'rets_properties') \n render :layout => 'caboose/admin' \n end",
"def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def index\n checar_super\n end",
"def edit?\n update? # same as update - no access \n end",
"def prevent_editing_old_content\n raise ActiveRecord::ReadOnlyRecord if shared? || !versions.first.latest?\n end",
"def prevent_editing_old_content\n raise ActiveRecord::ReadOnlyRecord if shared? || !versions.first.latest?\n end",
"def edit\n #SET_CHEF method will be called form BEFORE_ACTION\n end",
"def index\n @what_should_avoids = WhatShouldAvoid.all\n end",
"def edit\n\t\t\n\tend",
"def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:status => 'failure'}, :status => 403\n }\n end\n end\n end",
"def edit\n #@user = User.find(params[:id]) \n #replced by the before_action at the top\n end",
"def index\n @admin_posts = Post.where(\"type <> 'VideoPost'\")\n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def require_admin\n unless view_context.admin?\n redirect_to root_url\n end\n end",
"def can_edit?(object)\n false\n end",
"def index_disabled= bool\n @index_disabled = bool\n end",
"def admin\n #TODO\n end",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def edit\n\tend",
"def admin\n\n end",
"def edit\n nil\n end",
"def edit\n nil\n end",
"def index\n if has_search_parameters? || advanced_controller?\n super\n else\n respond_to do |format|\n format.html { store_preferred_view }\n end\n end\n end"
] | [
"0.6871658",
"0.6593347",
"0.6203222",
"0.6157025",
"0.6057748",
"0.5893718",
"0.5893718",
"0.5893718",
"0.5859201",
"0.5828274",
"0.56969804",
"0.5652371",
"0.5652371",
"0.5652371",
"0.5639119",
"0.5633347",
"0.563103",
"0.56298286",
"0.56046116",
"0.5591556",
"0.5588635",
"0.5560303",
"0.5557368",
"0.5539771",
"0.5511632",
"0.54975295",
"0.54831284",
"0.5473894",
"0.5455479",
"0.54341453",
"0.5430758",
"0.5429411",
"0.54284126",
"0.54123724",
"0.5405836",
"0.53982264",
"0.53973067",
"0.5388302",
"0.5385335",
"0.53773826",
"0.53647405",
"0.5364202",
"0.5364202",
"0.5364202",
"0.53582126",
"0.53578216",
"0.5344784",
"0.5338619",
"0.5335308",
"0.53152907",
"0.531449",
"0.531449",
"0.5295458",
"0.5294042",
"0.5294042",
"0.52877307",
"0.52858585",
"0.52852154",
"0.52833223",
"0.52769667",
"0.52763814",
"0.5274482",
"0.52707565",
"0.52608716",
"0.52608716",
"0.5259717",
"0.525612",
"0.5244043",
"0.5242168",
"0.52383757",
"0.5237354",
"0.5235099",
"0.5235099",
"0.5235099",
"0.5235099",
"0.52288204",
"0.52278554",
"0.5225807",
"0.5225086",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.522222",
"0.5219147",
"0.520758",
"0.520758",
"0.5205333"
] | 0.0 | -1 |
TeleSign RestClient, useful for making generic RESTful requests against the API. +customer_id+ Your customer_id string associated with your account. +api_key+ Your api_key string associated with your account. +rest_endpoint+ (optional) Override the default rest_endpoint to target another endpoint. +timeout+ (optional) How long to wait for the server to send data before giving up, as a float. | def initialize(customer_id,
api_key,
rest_endpoint: 'https://rest-api.telesign.com',
proxy: nil,
timeout: 10)
@customer_id = customer_id
@api_key = api_key
@rest_endpoint = rest_endpoint
@http = Net::HTTP::Persistent.new(name: 'telesign', proxy: proxy)
unless timeout.nil?
@http.open_timeout = timeout
@http.read_timeout = timeout
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest\n @rest ||= RestClient.new ENDPOINT[type], lgn: login, pwd: password\n end",
"def call_api(**rest_options)\n @retry.do do\n res = RestClient::Request.execute(**rest_options)\n json = res && !res.empty? ? ::JSON.parse(res.to_s) : nil\n call_api_response(res) if respond_to?(:call_api_response)\n [res, json]\n end\n end",
"def call_rest(action, url, auth_cert, auth_key, ref, content_type, body = nil)\n begin\n # change url based on if we have a ref or not\n if ref.nil?\n url = url\n else\n url = url + \"/\" + ref\n end\n\n # set params for api call\n params = {\n :method => action,\n :url => url,\n :ssl_client_cert => OpenSSL::X509::Certificate.new(auth_cert),\n :ssl_client_key => OpenSSL::PKey::RSA.new(auth_key),\n :verify_ssl => false,\n :headers => { :content_type => content_type, :accept => content_type }\n }\n\n # generate payload data\n content_type == :json ? (params[:payload] = JSON.generate(body) if body) : (params[:payload] = body if body)\n log(:info, \"call_rest: Request: #{url} action: #{action} payload: #{params[:payload]}\")\n\n # execute the request\n RestClient::Request.new(params).execute\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"call_rest: #{err}. Returning nil.\")\n return nil\n end\nend",
"def client(resource, parameters = {})\n url = \"https://#{self.subdomain}.freeagentcentral.com/#{resource}#{parameters.empty? ? \"\" : \"?\" + parameters.collect { |p| p.join(\"=\") }.join(\"&\")}\"\n RestClient::Resource.new(url, self.username, self.password)\n end",
"def get_testrail_api(credentials)\n client = TestRail::APIClient.new(TESTRAIL_URL)\n client.user = credentials[\"testrail_username\"]\n client.password = credentials[\"testrail_password\"]\n\n return client\n end",
"def call_rest(action, url, headers, ref, body = nil)\n begin\n # change url based on if we have a ref or not\n if ref.nil?\n url = url\n else\n url = url + \"/\" + ref\n end\n\n # set params for api call\n params = {\n :method => action,\n :url => url,\n :verify_ssl => false,\n :headers => headers\n }\n\n # generate payload data\n params[:payload] = body if body\n log(:info, \"call_rest: Request URL: #{url}\")\n log(:info, \"call_rest: Request Action: #{action}\")\n log(:info, \"call_rest: Request Headers: #{headers.inspect}\")\n log(:info, \"call_rest: Request Payload: #{params[:payload]}\")\n\n # execute the request\n RestClient::Request.new(params).execute\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"call_rest: #{err}. Returning nil.\")\n return nil\n end\nend",
"def call_api(**rest_options)\n json = nil\n response = nil\n begin\n response = RestClient::Request.execute(**rest_options)\n json = JSON.parse(response.to_s) if response && !response.empty?\n headers = response.headers\n self.rate_limit = headers[:x_ratelimit_limit].to_i if headers.include?(:x_ratelimit_limit)\n self.rate_remaining = headers[:x_ratelimit_remaining].to_i if headers.include?(:x_ratelimit_remaining)\n self.rate_reset = Time.at(headers[:x_ratelimit_reset].to_i) if headers.include?(:x_ratelimit_reset)\n rescue RestClient::Exceptions::Timeout => e\n raise\n rescue RestClient::ExceptionWithResponse => e\n response = e.response\n #json = JSON.parse(response.to_s) if response && !response.empty?\n json = nil\n rescue => e\n raise\n end\n return response, json\n end",
"def requestIngestAPI(method, url, timeout, payload, additionalErrorMessage=\"\")\n begin\n response = RestClient::Request.new(\n :method => method,\n :url => $oc_server + url,\n :user => $oc_user,\n :password => $oc_password,\n :timeout => timeout,\n :payload => payload\n ).execute\n rescue RestClient::Exception => e\n BigBlueButton.logger.error(\" A problem occured for request: #{url}\")\n BigBlueButton.logger.info( e)\n BigBlueButton.logger.info( e.http_body)\n BigBlueButton.logger.info( additionalErrorMessage)\n exit 1\n end\n\n return response\nend",
"def initialize(api_client_id = nil, api_secret = nil, tenancy_code = nil, api_root: nil, api_root_auth: nil,\n api_version: nil, logger: nil, tenancy_root: nil, timeout: nil)\n\n self.api_root = api_root || 'https://rl.talis.com'\n self.api_root_auth = api_root_auth || 'https://users.talis.com/1/oauth/tokens'\n self.api_version = api_version || 2\n self.logger = logger\n self.rate_limit = nil\n self.rate_remaining = nil\n self.rate_reset = nil\n self.tenancy_code = tenancy_code\n self.tenancy_root = tenancy_root\n self.timeout = timeout.to_i\n\n @api_client_id = api_client_id\n @api_secret = api_secret\n @api_token = nil\n\n RestClient.log = self.logger if self.logger\n\n end",
"def client_method(rest_method, url_elements, query_elements = [], parameters = nil)\n url = File.join(@base_url, *url_elements)\n url = URI.escape(url)\n query_elements.each_with_index do |s, i|\n char = (i == 0) ? '?' : '&'\n url = '%s%s%s' % [url, char, s]\n end\n\n args = Hash.new\n\n args.store(:method, rest_method)\n args.store(:url, url)\n args.store(:timeout, @time_out)\n headers = {\n 'content-type' => 'application/json',\n 'X-TrackerToken' => @token\n }\n if parameters.nil?\n parameters_json = nil\n else\n parameters_json = parameters.to_json\n end\n # args.store(:user, @account_name)\n # args.store(:password, @password)\n args.store(:payload, parameters_json)\n args.store(:headers, headers)\n\n # noinspection RubyResolve\n args.store(:verify_ssl, OpenSSL::SSL::VERIFY_NONE)\n\n RestClient.proxy = \"http://172.20.240.5:8080\"\n response = RestClient::Request.execute(args)\n # Don't parse as Json if empty.\n return response.code if response == ''\n begin\n parser = JSON::Ext::Parser.new(response)\n json = parser.parse\n json = DataHelper.rehash_to_symbol_keys(json)\n return [response.code, json]\n rescue\n # Isn't Json.\n return [response.code, response]\n end\n end",
"def build_rest(rest_resource, rest_action, rest_payload = nil, rest_auth_type = 'basic', rest_verify_ssl = false)\n # set rest url\n rest_url = URI.join(@rest_base_url, rest_resource).to_s\n log(:info, \"Used rest_base_url: <#{@rest_base_url}>, and rest_resource: <#{rest_resource}>, to generate rest_url: <#{rest_url}>\")\n\n # set params for api call\n params = {\n :method => rest_action,\n :url => rest_url,\n :verify_ssl => rest_verify_ssl,\n :headers => {\n :content_type => @rest_content_type,\n :accept => @rest_return_type\n }\n }\n\n # set the authorization header based on the type requested\n if rest_auth_type == 'basic'\n params[:headers][:authorization] = \"Basic #{Base64.strict_encode64(\"#{@rest_api_user}:#{@rest_api_password}\")}\"\n else\n #\n # code for extra rest_auth_types goes here. currently only supports basic authentication\n #\n end\n\n # generate payload data\n if @rest_content_type.to_s == 'json'\n # generate our body in JSON format\n params[:payload] = JSON.generate(rest_payload) unless rest_payload.nil?\n else\n # generate our body in XML format\n params[:payload] = Nokogiri::XML(rest_payload) unless rest_payload.nil?\n end\n\n # get the rest_response and set it on the parent object\n rest_results = execute_rest(rest_url, params)\n end",
"def rest_endpoint; end",
"def initialize_api_client(options = {})\n require 'right_api_client'\n\n options = {\n rl10: true,\n timeout: 20 * 60\n }.merge options\n\n client = RightApi::Client.new(options)\n client.log(Chef::Log.logger)\n client\n end",
"def request(endpoint, params = {})\n url = @@url + endpoint\n response = RestClient::Request.execute(method: 'get', url: url, headers: {token: @@token, params: params})\n JSON.parse(response.body)\n end",
"def api_client\n @api_client ||= ::Lokalise.client LokaliseRails.api_token, {enable_compression: true}.merge(LokaliseRails.timeouts)\n end",
"def login_sample()\n login_json = {\n :username => $username,\n :password => $password,\n :accessrights => $api_key\n }\n\n client = RestClient::Resource.new \"https://#{$hostname}/live/api/v3/\", :headers => {}, :verify_ssl => OpenSSL::SSL::VERIFY_NONE\n\n request = login_json.to_json\n response = client['login'].post request, { :content_type => 'application/json' }\n\n client.options[:headers][:cookies] = response.cookies\n\n p ''\n p 'Login'\n p response\n client\nend",
"def rest_client_get(api_call)\n response = nil\n with_retries(max_tries: 3, rescue: RestClient::Exception,\n base_sleep_seconds: 3.0, max_sleep_seconds: 10.1) do\n response = RestClient.get api_call\n fail RestClient::Exception if response.nil?\n end\n return response\n end",
"def make_request(method, endpoint, payload={})\n params = [\"#{API_URL_BASE}/#{endpoint}\", payload, @request_header]\n begin\n JSON.parse RestClient.send(method.to_sym, *params.reject { |p| p.empty? })\n rescue RestClient::Unauthorized => e\n # an authorization error is indicative that the configuration won't work,\n # not that an individual request errored, so raise instead of recovering\n raise \n rescue RestClient::Exception => e\n # attempt to handle other RestClient exceptions gracefully\n # return the erorr message and keep moving\n return { \"error\" => e.message }\n end\n end",
"def initialize(api_key, api_url = 'https://api.telerivet.com/v1')\n @api_key = api_key\n @api_url = api_url\n @num_requests = 0\n @session = nil\n end",
"def build_rest_client(url)\n RestClient::Resource.new(URI.encode(url), :verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n end",
"def initialize(api_key:, read_timeout: 60, open_timeout: 30, api_base: 'https://api.easypost.com',\n custom_client_exec: nil)\n raise EasyPost::Errors::MissingParameterError.new('api_key') if api_key.nil?\n\n @api_key = api_key\n @api_base = api_base\n @api_version = 'v2'\n @read_timeout = read_timeout\n @open_timeout = open_timeout\n @lib_version = File.open(File.expand_path('../../VERSION', __dir__)).read.strip\n\n # Make an HTTP client once, reuse it for all requests made by this client\n # Configuration is immutable, so this is safe\n @http_client = EasyPost::HttpClient.new(api_base, http_config, custom_client_exec)\n end",
"def request(\n method,\n path,\n headers = nil,\n body = nil,\n api_version = EasyPost::InternalUtilities::Constants::API_VERSION\n )\n # Remove leading slash from path.\n path = path[1..] if path[0] == '/'\n\n uri = URI.parse(\"#{@base_url}/#{api_version}/#{path}\")\n headers = @config[:headers].merge(headers || {})\n serialized_body = JSON.dump(EasyPost::InternalUtilities.objects_to_ids(body)) if body\n open_timeout = @config[:open_timeout]\n read_timeout = @config[:read_timeout]\n request_timestamp = Time.now\n request_uuid = SecureRandom.uuid\n\n if EasyPost::Hooks.any_subscribers?(:request)\n request_context = EasyPost::Hooks::RequestContext.new(\n method: method,\n path: uri.to_s,\n headers: headers,\n request_body: body,\n request_timestamp: request_timestamp,\n request_uuid: request_uuid,\n )\n EasyPost::Hooks.notify(:request, request_context)\n end\n\n # Execute the request, return the response.\n\n response = if @custom_client_exec\n @custom_client_exec.call(method, uri, headers, open_timeout, read_timeout, serialized_body)\n else\n default_request_execute(method, uri, headers, open_timeout, read_timeout, serialized_body)\n end\n response_timestamp = Time.now\n\n if EasyPost::Hooks.any_subscribers?(:response)\n response_context = {\n http_status: nil,\n method: method,\n path: uri.to_s,\n headers: nil,\n response_body: nil,\n request_timestamp: request_timestamp,\n response_timestamp: response_timestamp,\n client_response_object: response,\n request_uuid: request_uuid,\n }\n\n # If using a custom HTTP client, the user will have to infer these from the raw\n # client_response_object attribute\n if response.is_a?(Net::HTTPResponse)\n response_body = begin\n JSON.parse(response.body)\n rescue JSON::ParseError\n response.body\n end\n response_context.merge!(\n {\n http_status: response.code.to_i,\n headers: response.each_header.to_h,\n response_body: response_body,\n },\n )\n end\n\n EasyPost::Hooks.notify(:response, EasyPost::Hooks::ResponseContext.new(**response_context))\n end\n\n response\n end",
"def client\n @client ||= Twilio::REST::Client.new(ENV[\"TWILIO_SID\"], ENV[\"TWILIO_AUTH\"])\n end",
"def client\n @client ||= Twitter::REST::Client.new(client_params)\n end",
"def make_request(method, endpoint, payload={})\n params = [\"#{API_URL_BASE}/#{endpoint}\", payload, @request_header]\n begin\n JSON.parse RestClient.send(method.to_sym, *params.reject { |p| p.empty? })\n rescue RestClient::Exception => e\n return { \"error\" => e.message }\n end\n end",
"def initialize(*args)\n @client ||= Betaface::REST::Client.new(*args) \n end",
"def make_api_call(method, url, token, params = nil, payload = {}, custom_headers=nil)\n\n conn_params = {\n url: @api_host % { version: @version }\n }\n\n if @enable_fiddler\n conn_params[:proxy] = 'http://127.0.0.1:8888'\n conn_params[:ssl] = {:verify => false}\n end\n\n conn = Faraday.new(conn_params) do |faraday|\n # Uses the default Net::HTTP adapter\n faraday.adapter Faraday.default_adapter\n faraday.response :logger if @debug\n end\n\n conn.headers = {\n 'Authorization' => \"Bearer #{token}\",\n 'Accept' => \"application/json\",\n\n # Client instrumentation\n # See https://msdn.microsoft.com/EN-US/library/office/dn720380(v=exchg.150).aspx\n 'User-Agent' => @user_agent,\n 'client-request-id' => SecureRandom.uuid,\n 'return-client-request-id' => \"true\"\n }\n\n if custom_headers && custom_headers.class == Hash\n conn.headers = conn.headers.merge( custom_headers )\n end\n \n case method.upcase\n when \"GET\"\n response = conn.get do |request|\n request.url url, params\n end\n when \"POST\"\n conn.headers['Content-Type'] = \"application/json\"\n response = conn.post do |request|\n request.url url, params\n request.body = JSON.dump(payload)\n end\n when \"PATCH\"\n conn.headers['Content-Type'] = \"application/json\"\n response = conn.patch do |request|\n request.url url, params\n request.body = JSON.dump(payload)\n end\n when \"DELETE\"\n response = conn.delete do |request|\n request.url url, params\n end\n end\n\n if response.status >= 300\n error_info = if response.body.empty?\n ''\n else\n begin\n JSON.parse( response.body )\n rescue JSON::ParserError => _e\n response.body\n end\n end\n return JSON.dump({\n 'ruby_outlook_error' => response.status,\n 'ruby_outlook_response' => error_info })\n end\n\n response.body\n end",
"def client\n @client ||= Faraday.new(api_host) do |faraday|\n faraday.headers[\"Authorization\"] = \"Bearer #{access_token}\"\n faraday.response :logger if Rails.env.test?\n faraday.adapter Faraday.default_adapter\n end\n end",
"def make_rest_call(method, url, payload = nil, headers = nil)\n options = call_options_builder(method, url, payload, headers)\n RestClient::Request.execute(options)\n rescue => e\n raise e\n end",
"def restful_api\n @restful_api ||= AlephApi::RestfulApiClient.new(url: @restful_api_url)\n end",
"def api_request(method, uri, token, payload, options={})\n params = options.fetch('params', {})\n headers = options.fetch('headers', {})\n req_headers = headers.merge({params: params}).merge({'X-Auth-Token': token})\n RestClient::Request.execute(method: method.to_sym,\n url: uri,\n headers: req_headers,\n timeout: @timeout,\n payload: payload)\n end",
"def callAPI(endpoint, params = {})\n\t\t\tif !@api_client\n\t\t\t\t@api_client = ApiClient.new()\n\t\t\tend\n\n\t\t\tres = @api_client.call(@username, @api_key, endpoint, params)\n\n\t\t\t# Set up the return value\n\t\t\tretval = res['data']\n\n\t\t\t# Update the rate limits from the headers\n\t\t\t@rate_limit = res['rate_limit']\n\t\t\t@rate_limit_remaining = res['rate_limit_remaining']\n\n\t\t\tcase res['response_code']\n\t\t\twhen 200\n\t\t\t\t# Do nothing\n\t\t\twhen 401\n\t\t\t\t# Authentication failure\n\t\t\t\traise AccessDeniedError, retval.has_key?('error') ? retval['error'] : 'Authentication failed'\n\t\t\twhen 403\n\t\t\t\t# Check the rate limit\n\t\t\t\traise RateLimitExceededError, retval['comment'] if @rate_limit_remaining == 0\n\t\t\t\t# Rate limit is ok, raise a generic exception\n\t\t\t\traise APIError.new(403), retval.has_key?('error') ? retval['error'] : 'Unknown error'\n\t\t\telse\n\t\t\t\traise APIError.new(res['http_code']), retval.has_key?('error') ? retval['error'] : 'Unknown error'\n\t\t\tend\n\n\t\t\tretval\n\t\tend",
"def client\n @client ||= ::Twilio::REST::Client.new(@account_sid, @auth_token)\n end",
"def rest_get(api_url)\n RestClient::Request.execute(method: :get,\n url: api_url,\n verify_ssl: @verify_ssl).body\n end",
"def rest_client=(value)\n raise Amfetamine::ConfigurationInvalid, 'Invalid value for rest_client' if ![:get,:put,:delete,:post].all? { |m| value.respond_to?(m) }\n @rest_client = value\n end",
"def request(host, port, method, uri, params = {}, data = {}, headers = {}, auth = nil, timeout = nil) # rubocop:disable Metrics/MethodLength\n auth ||= @auth\n headers = generate_headers(method, headers)\n uri = build_uri(uri)\n\n if @logger\n @logger.debug('--BEGIN Twilio API Request--')\n @logger.debug(\"Request Method: <#{method}>\")\n\n headers.each do |key, value|\n @logger.debug(\"#{key}:#{value}\") unless key.downcase == 'authorization'\n end\n\n url = URI(uri)\n @logger.debug(\"Host:#{url.host}\")\n @logger.debug(\"Path:#{url.path}\")\n @logger.debug(\"Query:#{url.query}\")\n @logger.debug(\"Request Params:#{params}\")\n end\n\n response = @http_client.request(\n host,\n port,\n method,\n uri,\n params,\n data,\n headers,\n auth,\n timeout\n )\n\n if @logger\n @logger.debug(\"Response Status Code:#{response.status_code}\")\n @logger.debug(\"Response Headers:#{response.headers}\")\n @logger.debug('--END TWILIO API REQUEST--')\n end\n\n response\n end",
"def perform_get(rest_url, request)\n query_params = request.api_params.blank? ? '' : to_query_params(request.api_params)\n url = \"#{rest_url}&#{query_params}\"\n\n response = RestClient::Request.execute(\n method: request.http_method,\n url: url,\n headers: request.header_params,\n read_timeout: 30,\n open_timeout: 15\n )\n JSON.parse(response)\n end",
"def rest_call(url, method, options = {})\n methods = %w{get post put}\n result = {\"status\" => \"ERROR\", \"response\" => \"\", \"message\" => \"\"}\n method = method.downcase\n verbose = get_option(options, \"verbose\") == \"yes\" or get_option(options, \"verbose\")\n headers = get_option(options, \"headers\", {:accept => :json, :content_type => :json})\n return result[\"message\"] = \"ERROR - #{method} not recognized\" unless methods.include?(method)\n log \"Rest URL: #{url}\" if verbose\n begin\n data = get_option(options, \"data\")\n rest_params = {}\n rest_params[:url] = url\n rest_params[:method] = method.to_sym\n rest_params[:verify_ssl] = OpenSSL::SSL::VERIFY_NONE if url.start_with?(\"https\")\n rest_params[:payload] = data.to_json unless data == \"\"\n if options.has_key?(\"username\") && options.has_key?(\"password\")\n rest_params[:user] = options[\"username\"]\n rest_params[:password] = options[\"password\"]\n end\n rest_params[:headers] = headers\n log \"RestParams: #{rest_params.inspect}\" if verbose\n if %{put post}.include?(method)\n return result[\"message\"] = \"ERROR - no data param for post\" if data == \"\"\n response = RestClient::Request.new(rest_params).execute\n else\n response = RestClient::Request.new(rest_params).execute\n end\n rescue Exception => e\n result[\"message\"] = e.message\n raise \"RestError: #{result[\"message\"]}\" unless get_option(options, \"suppress_errors\") == true\n return result\n end\n log \"Rest Response:\\n#{response.inspect}\" if verbose\n if headers[:accept] == :json\n parsed_response = JSON.parse(response) rescue nil\n else\n parsed_response = response\n end\n parsed_response = {\"info\" => \"no data returned\"} if parsed_response.nil?\n result[\"code\"] = response.code\n if response.code < 300\n result[\"status\"] = \"success\"\n result[\"data\"] = parsed_response\n elsif response.code == 422\n result[\"message\"] = \"REST call returned code 422 usually a bad token\"\n else\n result[\"message\"] = \"REST call returned HTTP code #{response.code}\"\n end\n if result[\"status\"] == \"ERROR\"\n raise \"RestError: #{result[\"message\"]}\" unless get_option(options, \"suppress_errors\") == true\n end\n result\n end",
"def rest_call(call,base_uri,json_payload,access_token)\n params =\n {\"Authorization\" => \"Bearer #{access_token}\",\n :content_type => 'application/json',\n :accept => 'application/json',\n :verify => false}\n case call\n when \"get\"\n response = rest_get(base_uri,params)\n when \"post\"\n response = rest_post(base_uri,json_payload,params)\n when \"patch\"\n response = rest_patch(base_uri,json_payload,params)\n end\n return response\n end",
"def APICall params = {}\n \n path = params[:path]\n method = params[:method] || 'GET'\n payload = params[:payload] || nil\n \n params.delete(:method)\n params.delete(:path)\n params.delete(:payload)\n \n a = Time.now.to_f\n \n http = Net::HTTP.new(@infra[:domain]+'.zendesk.com',443)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.use_ssl = true\n \n uri = %{#{@infra[:path]}#{path}}\n uri << '?'+params.map{ |key,val| \"#{key}=#{val}\" }.join('&') if params && params.count > 0\n uri = URI.escape uri\n \n reqs = {\n 'GET' => Net::HTTP::Get.new(uri),\n 'POST' => Net::HTTP::Post.new(uri),\n 'PUT' => Net::HTTP::Put.new(uri),\n 'DELETE' => Net::HTTP::Delete.new(uri)\n }\n req = reqs[method]\n \n content_type = 'application/json'\n content_type = 'application/binary' if path.include? 'uploads'\n req.content_type = content_type\n \n req.basic_auth @username,@infra[:authentication]\n \n req.body = payload if method == 'POST' || method == 'PUT'\n \n response = http.request req\n \n code = response.code.to_f.round\n body = response.body\n \n b = Time.now.to_f\n c = ((b-a)*100).round.to_f/100\n \n final = {code: code.to_i,body: nil}\n final = final.merge(body: JSON.parse(body)) if method != 'DELETE' && code != 500\n final = final.merge(time: c)\n \n @api += 1\n \n final\n \n end",
"def request(params)\n\n # Add auth header\n headers = params[:headers] || {}\n headers['x-vcloud-authorization'] = @auth_key if !@auth_key.nil? || !@auth_key.equal?('')\n\n # set connection options\n options = {:url => params[:url],\n :body => params[:body] || '',\n :expects => params[:expects] || 200,\n :headers => headers || {},\n :method => params[:method] || 'GET'\n }\n\n # connect\n res = RestClient::Request.execute options\n\n raise res if (res.code!=params[:expects] && res.code!=200)\n\n res\n\n\n end",
"def rest_token_endpoint; end",
"def twilio_client\n Twilio::REST::Client.new TWILIO_CONFIG['sid'], TWILIO_CONFIG['token']\n end",
"def call(path, headers: nil, options: nil, payload: nil, auth: true, expand_path: true, **params)\n\n # Set the REST client headers\n rest_headers = {}.merge(headers || {})\n rest_headers[:params] = params if params && !params.empty?\n\n # Set the REST client options\n rest_options = {\n headers: rest_headers,\n url: expand_path ? url(path) : path,\n }\n rest_options[:payload] = payload if payload\n rest_options[:timeout] = self.timeout > 0 ? self.timeout : nil\n rest_options.merge(options) if options\n rest_options[:method] ||= payload ? :post : :get\n\n data = nil\n refresh_token = false\n response = nil\n\n if auth\n loop do\n rest_headers['Authorization'] = \"Bearer #{api_token(refresh_token)}\"\n response, data = call_api(**rest_options)\n if response && response.code == 401 && !refresh_token\n # The API token may have expired, try one more time with a new token\n refresh_token = true\n else\n break\n end\n end\n else\n response, data = call_api(**rest_options)\n end\n\n yield(response, data) if block_given?\n\n data\n\n end",
"def perform\n args = {\n :method => method,\n :url => url,\n :headers => headers,\n :timeout => 120,\n :open_timeout => 30\n }\n args[:payload] = payload.to_json if payload\n\n Response.new RestClient::Request.execute(args)\n rescue RestClient::Exception => e\n response = e.response\n\n if e.is_a?(RestClient::RequestTimeout)\n response = JSON.generate({:error => {:cause => 'REQUEST_TIMEDOUT'}})\n end\n\n ErrorResponse.new response\n end",
"def resource(options = {})\n RestClient::Resource.new @endpoint, default_resource_options.deep_merge(options)\n end",
"def client_args\n { uuid: uuid, api_key: api_key }\n end",
"def client\n Twilio::REST::Client.new(ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']) if ENV[\"TWILIO_ACCOUNT_SID\"].present?\n end",
"def request(endpoint, body, content_type, retry_limit: 0)\n http_rate_limiter.shift if rate_limit_enabled?\n\n request_options = {\n read_timeout: read_timeout,\n idempotent: true,\n retry_limit: retry_limit.to_i,\n expects: [200, 201],\n method: :post,\n body: body,\n headers: { 'Content-Type' => content_type }\n }\n\n begin\n retries ||= 0\n http_connection(endpoint).request(request_options)\n rescue Excon::Error::Timeout => e\n retries += 1\n retry if retries <= retry_limit\n raise e\n end\n end",
"def initialize(options = {})\n # Mandatory params\n @client_id = @@client_id || options.fetch(:client_id)\n @client_key = @@client_key || options.fetch(:client_key)\n @tenant_id = @@tenant_id || options.fetch(:tenant_id)\n\n # Optional params\n @subscription_id = @@subscription_id || options[:subscription_id]\n @resource_group = @@resource_group || options[:resource_group]\n @api_version = @@api_version || options[:api_version] || '2015-01-01'\n @grant_type = @@grant_type || options[:grant_type] || 'client_credentials'\n\n # The content-type used for all internal http requests\n @content_type = @@content_type || 'application/json'\n\n # Call the get_token method to set this.\n @token = @@token || options[:token]\n\n # Base URL used for REST calls. Modify within method calls as needed.\n @base_url = Azure::Armrest::RESOURCE\n end",
"def call_satellite(action, url, user, password, ref, content_type, body = nil)\n begin\n # change url based on if we have a ref or not\n if ref.nil?\n url = url\n else\n url = url + \"/\" + ref\n end\n\n # set params for api call\n params = {\n :method => action,\n :url => url,\n :user => user,\n :password => password,\n :verify_ssl => false,\n :headers => { :content_type => content_type, :accept => content_type }\n }\n\n # generate payload data\n content_type == :json ? (params[:payload] = JSON.generate(body) if body) : (params[:payload] = body if body)\n log(:info, \"Satellite6 Request: #{url} action: #{action} payload: #{params[:payload]}\")\n\n # execute the request\n RestClient::Request.new(params).execute\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"call_satellite: #{err}. Returning nil.\")\n return nil\n end\nend",
"def initialize(api_key, resource_url)\n @rest_client = RestClient.new(resource_url, api_key)\n end",
"def make_get_request(endpoint, custom_params = {})\n base_params = base_params(endpoint, custom_params)\n raw_url = get_api_url(endpoint) + \"?#{base_params.merge(custom_params).to_query}\"\n\n begin\n Timeout.timeout(GlobalConstant::PepoCampaigns.api_timeout) do\n result = URI.parse(raw_url).read\n return JSON.parse(result)\n end\n rescue Timeout::Error => e\n return {\"error\" => \"Timeout Error\", \"message\" => \"Error: #{e.message}\"}\n rescue => e\n return {\"error\" => \"Exception: Something Went Wrong\", \"message\" => \"Exception: #{e.message}\"}\n end\n end",
"def do_get(url, api_key, password, version)\n begin\n RestClient::Request.new(\n :method => :get,\n :url => url,\n :user => api_key,\n :password => password,\n :ssl_version => 'TLSv1_2',\n :headers => {\n :accept => :json,\n :content_type => :json,\n :user_agent => get_user_agent,\n :'X-EWAY-APIVERSION' => version\n }\n ).execute\n rescue SocketError => e\n raise Exceptions::CommunicationFailureException.new(e.to_s)\n rescue RestClient::Exception => e\n if e.http_code == 401 || e.http_code == 403 || e.http_code == 404\n raise Exceptions::AuthenticationFailureException.new(e.to_s)\n else\n raise Exceptions::SystemErrorException.new(e.to_s)\n end\n end\n end",
"def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.get_customers ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/customers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.get_customers\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomersApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize(**options)\n @api_client = PayPoint::Blue::API.new(**options)\n super\n end",
"def initialize(url, user = nil, password = nil, use_proxy = false)\n user = ENV['CENTREON_USERNAME'] if user.nil?\n password = ENV['CENTREON_PASSWORD'] if password.nil?\n\n # Disable proxy\n RestClient.proxy = if use_proxy\n ENV['http_proxy']\n else\n nil\n end\n RestClient.log = logger\n\n # Checks parameters\n if url.nil? || url.empty?\n raise('You must provider API URL')\n end\n if user.nil? || user.empty?\n raise('You must provider username to connect on API')\n end\n if password.nil? || password.empty?\n raise('You must provider password to connect on API')\n end\n\n # Authenticate\n r = ::RestClient::Resource.new(\n url + '?action=authenticate',\n verify_ssl: OpenSSL::SSL::VERIFY_NONE,\n ).post(\n username: user,\n password: password,\n )\n data = JSON.parse(r.body)\n if data['authToken'].empty?\n raise 'Token is empty'\n end\n\n # Create client\n @client = ::RestClient::Resource.new(\n url + '?action=action&object=centreon_clapi',\n headers: { 'centreon-auth-token' => data['authToken'] },\n verify_ssl: OpenSSL::SSL::VERIFY_NONE,\n )\n\n @host = Centreon::APIClient::Host.new(@client)\n @host_group = Centreon::APIClient::HostGroup.new(@client)\n @service = Centreon::APIClient::Service.new(@client)\n @host_template = Centreon::APIClient::HostTemplate.new(@client)\n @service_template = Centreon::APIClient::ServiceTemplate.new(@client)\n @service_group = Centreon::APIClient::ServiceGroup.new(@client)\n @command = Centreon::APIClient::Command.new(@client)\n end",
"def api(options = {})\n @api ||= case url.host\n when String then RestClient::Resource.new(url.host, options)\n else RestClient::Resource.new(API_ENDPOINT.host, options)\n end\n end",
"def perform(secret, endpoint, _args = {})\n @client = ::OpenNebula::Client.new(secret, endpoint)\n end",
"def make_api_call(url, api_params)\n RestClient.post(url, api_params, content_type: :json)\n end",
"def connection\n @connection ||= RestClient::Resource.new(api_uri.to_s)\n end",
"def initialize(options)\n @fabric = options[:fabric]\n @rest_uri = options[:rest_uri]\n @api_uri = \"#{@rest_uri}#{@fabric}\"\n end",
"def api(method, url, options = {})\n unless [:get, :delete, :post, :put, :patch].include? method\n raise \"Unknown REST method: #{method}\"\n end\n \n config = RequestConfig.new\n config.authorization_bearer = @authorization_bearer\n config.method = method\n config.access_token = options[:access_token]\n config.request_params = options[:request_params]\n config.request_body = options[:request_body]\n config.content_type = \"application/json\" unless url == @refresh_token_url\n config.form_encoding = true if url == @refresh_token_url\n refresh_token = options[:refresh_token]\n user_uid = options[:user_uid]\n\n puts \"*\" * 88\n puts url.to_s\n puts method.to_s\n configp = config.dup\n puts configp.finalize!.to_hash.inspect\n puts \"*\" * 88\n \n request = Typhoeus::Request.new url, config.finalize!\n request.on_complete do |response|\n case\n when response.success?\n puts \"Success\"\n @callback_request_made.call\n return Echidna::Response.new response\n when response.timed_out?\n puts \"Timed out. Is google down?\"\n return Echidna::Error.new response\n when response.code == 401\n puts \"In refresh block\"\n if refresh_token && @client_id && @client_secret\n new_access_token = fetch_new_access_token(user_uid, refresh_token)\n options.delete(:refresh_token)\n options[:access_token] = new_access_token\n return api(method, url, options)\n else\n return Echidna::Error.new response\n end\n when response.code == 0\n puts\"Could not get an http response, something's wrong.\"\n return Echidna::Error.new response\n else\n puts \"HTTP request failed: #{response.code}\"\n return Echidna::Error.new response\n end\n end\n \n @hydra.queue(request)\n @hydra.run\n \n request\n end",
"def rest_post(base_uri,json_payload,params)\n begin\n puts base_uri,json_payload\n @response = RestClient.post(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def post(url, query = {}, payload = {})\n restclient({\n method: :post,\n url: \"#{@scheme}://#{@host}/#{url}\",\n timeout: Timeout,\n open_timeout: OpenTimeout,\n payload: payload.to_json,\n headers: {\n authorization: @auth,\n content_type: :json,\n accept: :json,\n params: query\n }\n })\n end",
"def api_call(endpoint, request_body = false, params = false, access_token = false)\n\n #Create the url\n endpoint_string = params ? endpoint[:name].gsub(':id', params[:id].to_s) : endpoint[:name]\n\n url = URI.parse(@api_url + endpoint_string)\n\n # construct the call data and access token\n call = case endpoint[:method]\n when :post\n Net::HTTP::Post.new(url.request_uri, initheader = {'Content-Type' =>'application/json', 'User-Agent' => 'Weship Ruby SDK'})\n when :get\n Net::HTTP::Get.new(url.request_uri, initheader = {'Content-Type' =>'application/json', 'User-Agent' => 'Weship Ruby SDK'})\n when :put\n Net::HTTP::Put.new(url.request_uri, initheader = {'Content-Type' =>'application/json', 'User-Agent' => 'Weship Ruby SDK'})\n when :delete\n Net::HTTP::Delete.new(url.request_uri, initheader = {'Content-Type' =>'application/json', 'User-Agent' => 'Weship Ruby SDK'})\n else\n throw \"Unknown call method #{endpoint[:method]}\"\n end\n\n if request_body\n call.body = request_body.to_json\n end\n\n if access_token\n call.add_field(\"Authorization\" ,\"Token token=#{access_token}\" );\n end\n\n # create the request object\n request = Net::HTTP.new(url.host, url.port)\n\n request.read_timeout = 30\n request.use_ssl = true\n # make the call\n response = request.start {|http| http.request(call) }\n # returns JSON response as ruby hash\n JSON.parse(response.body) unless response.body == nil\n end",
"def get_client_using_get_with_http_info(client_id, appTokenConfig = {}, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ClientApi.get_client_using_get ...'\n end\n # verify the required parameter 'client_id' is set\n if @api_client.config.client_side_validation && client_id.nil?\n fail ArgumentError, \"Missing the required parameter 'client_id' when calling ClientApi.get_client_using_get\"\n end\n # resource path\n local_var_path = '/nucleus/v1/client/{client_id}'.sub('{' + 'client_id' + '}', client_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n\n if @api_client.config.client_side_validation && appTokenConfig['basePath'].nil?\n fail ArgumentError, \"Missing the required parameter 'basePath'\"\n end\n\n if @api_client.config.client_side_validation && appTokenConfig['authType'].nil?\n fail ArgumentError, \"Missing the required parameter 'authType'\"\n end\n\n @auth_config.config.host = appTokenConfig['basePath']\n @api_client.config.host = appTokenConfig['basePath']\n\n if appTokenConfig['authType'].downcase == 'client_credentials'\n client_credentials_token = create_client_credential_return(appTokenConfig)\n @api_client.config.access_token = client_credentials_token\n elsif appTokenConfig['authType'].downcase == 'password_credentials'\n password_credential_token = create_password_credential_return(appTokenConfig)\n @api_client.config.access_token = password_credential_token\n elsif appTokenConfig['authType'].downcase == 'client_token_credentials'\n client_token_credential = create_client_token_credential_return(appTokenConfig)\n @api_client.config.access_token = client_token_credential\n end\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Client')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ClientApi#get_client_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend",
"def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend",
"def client(token: nil)\n client = Faraday.new(url: ENV['AIRCALL_PUBLIC_API_HOST']) do |faraday|\n faraday.authorization :Bearer, token if token\n faraday.adapter Faraday.default_adapter\n faraday.headers['Content-Type'] = 'application/json'\n end\n\n client\n end",
"def initialize(api_key = Payable.api_key, path = Payable.current_rest_api_path, timeout = API_TIMEOUT, company_id = Payable.company_id)\n raise(\"api_key must be a non-empty string\") if !api_key.is_a?(String) || api_key.empty?\n raise(\"path must be a non-empty string\") if !path.is_a?(String) || path.empty?\n @api_key = api_key\n @path = path\n @timeout = timeout\n @company_id = company_id\n end",
"def rest_endpoint=(_arg0); end",
"def request(http_method: :get, path:'/', body: nil, query: {}, headers: {}, response_block: nil, expects: [200, 201, 204], host: nil, port: nil, auth: true, gzip: true)\n\n retried ||= false\n\n if auth && token_expired?\n raise Excon::Error::Unauthorized, \"Token expired or not valid, you need to login again, use: kontena #{token_is_for_master? ? \"master\" : \"cloud\"} login\"\n end\n\n request_headers = request_headers(headers, auth: auth, gzip: gzip)\n\n if body.nil?\n body_content = ''\n request_headers.delete(CONTENT_TYPE)\n else\n body_content = encode_body(body, request_headers[CONTENT_TYPE])\n request_headers.merge!('Content-Length' => body_content.bytesize)\n end\n\n uri = URI.parse(path)\n host_options = {}\n\n if uri.host\n host_options[:host] = uri.host\n host_options[:port] = uri.port\n host_options[:scheme] = uri.scheme\n path = uri.request_uri\n else\n host_options[:host] = host if host\n host_options[:port] = port if port\n end\n\n request_options = {\n method: http_method,\n expects: Array(expects),\n path: path_with_prefix(path),\n headers: request_headers,\n body: body_content,\n query: query\n }.merge(host_options)\n\n request_options.merge!(response_block: response_block) if response_block\n\n # Store the response into client.last_response\n @last_response = http_client.request(request_options)\n\n parse_response(@last_response)\n rescue Excon::Error::Unauthorized\n if token\n debug { 'Server reports access token expired' }\n\n if retried || !token || !token['refresh_token']\n raise Kontena::Errors::StandardError.new(401, 'The access token has expired and needs to be refreshed')\n end\n\n retried = true\n retry if refresh_token\n end\n raise Kontena::Errors::StandardError.new(401, 'Unauthorized')\n rescue Excon::Error::HTTPStatus => error\n if error.response.headers['Content-Encoding'] == 'gzip'\n error.response.body = Zlib::GzipReader.new(StringIO.new(error.response.body)).read\n end\n\n debug { \"Request #{error.request[:method].upcase} #{error.request[:path]}: #{error.response.status} #{error.response.reason_phrase}: #{error.response.body}\" }\n\n handle_error_response(error.response)\n end",
"def get(endpoint, params = {})\n\n path = build_connect_url(endpoint) + '?' + URI.encode_www_form(params)\n headers = build_headers(endpoint, 'GET', params)\n\n log \"GET \" + path\n log headers.to_s\n\n begin\n response = RestClient::Request.execute(method: :get, url: path, headers: headers, timeout: 15)\n rescue RestClient::ExceptionWithResponse => e\n log e.http_code.to_s + \" \" + e.response.to_s\n return e.response\n end\n\n log response.code.to_s + \" \" + response.to_s\n\n response\n\n end",
"def initialize(args)\n raise 'This API client is only compatible with Ruby 1.8.7 and upwards.' if (RUBY_VERSION < '1.8.7')\n\n @api_url, @api_version = DEFAULT_API_URL, API_VERSION\n @open_timeout, @timeout, @max_attempts = DEFAULT_OPEN_TIMEOUT, DEFAULT_TIMEOUT, DEFAULT_MAX_ATTEMPTS\n @ssl_version = DEFAULT_SSL_VERSION\n @enable_retry = false\n\n # Initializing all instance variables from hash\n args.each { |key,value|\n instance_variable_set(\"@#{key}\", value) if AUTH_PARAMS.include?(key.to_s)\n } if args.is_a? Hash\n\n raise 'This API client is only compatible with the RightScale API 1.5 and upwards.' if (Float(@api_version) < 1.5)\n\n # If rl10 parameter was passed true, read secrets file to set @local_token, and @api_url\n if @rl10\n case RbConfig::CONFIG['host_os']\n when /mswin|mingw|cygwin/\n local_secret_file = File.join(ENV['ProgramData'] || 'C:/ProgramData', 'RightScale/RightLink/secret')\n else\n local_secret_file = '/var/run/rightlink/secret'\n end\n local_auth_info = Hash[File.readlines(local_secret_file).map{ |line| line.chomp.split('=', 2) }]\n @local_token = local_auth_info['RS_RLL_SECRET']\n @api_url = \"http://localhost:#{local_auth_info['RS_RLL_PORT']}\"\n end\n\n # allow a custom resource-style REST client (for special logging, etc.)\n @rest_client_class ||= ::RestClient::Resource\n @rest_client = @rest_client_class.new(@api_url, :open_timeout => @open_timeout, :timeout => @timeout, :ssl_version => @ssl_version)\n @last_request = {}\n\n # There are five options for login:\n # - user email/password (using plaintext or base64-obfuscated password)\n # - user OAuth refresh token\n # - instance API token\n # - existing user-supplied cookies\n # - existing user-supplied OAuth access token\n #\n # The latter two options are not really login; they imply that the user logged in out of band.\n # See config/login.yml.example for more info.\n login() if need_login?\n\n timestamp_cookies\n\n # Add the top level links for instance_facing_calls\n if @instance_token || @local_token\n resource_type, path, data = self.do_get(ROOT_INSTANCE_RESOURCE)\n instance_href = get_href_from_links(data['links'])\n cloud_href = instance_href.split('/instances')[0]\n\n define_instance_method(:get_instance) do |*params|\n type, instance_path, instance_data = self.do_get(ROOT_INSTANCE_RESOURCE)\n RightApi::ResourceDetail.new(self, type, instance_path, instance_data)\n end\n\n Helper::INSTANCE_FACING_RESOURCES.each do |meth|\n define_instance_method(meth) do |*args|\n obj_path = cloud_href + '/' + meth.to_s\n # Following are special cases that need to over-ride the obj_path\n obj_path = '/api/backups' if meth == :backups\n obj_path = instance_href + '/live/tasks' if meth == :live_tasks\n obj_path = '/api/tags' if meth == :tags\n if has_id(*args)\n obj_path = add_id_and_params_to_path(obj_path, *args)\n RightApi::Resource.process(self, get_singular(meth), obj_path)\n else\n RightApi::Resources.new(self, obj_path, meth.to_s)\n end\n end\n end\n else\n # Session is the root resource that has links to all the base resources\n define_instance_method(:session) do |*params|\n RightApi::Resources.new(self, ROOT_RESOURCE, 'session')\n end\n # Allow the base resources to be accessed directly\n get_associated_resources(self, session.index.links, nil)\n end\n end",
"def make_post_request(endpoint, custom_params = {})\n base_params = base_params(endpoint, custom_params)\n uri = post_api_uri(endpoint)\n begin\n Timeout.timeout(GlobalConstant::PepoCampaigns.api_timeout) do\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n return JSON.parse(result.body)\n end\n rescue Timeout::Error => e\n return {\"error\" => \"Timeout Error\", \"message\" => \"Error: #{e.message}\"}\n rescue => e\n return {\"error\" => \"Something Went Wrong\", \"message\" => \"Exception: #{e.message}\"}\n end\n\n end",
"def client\n Twitter::REST::Client.new(consumer_key: Settings.consumer.key,\n consumer_secret: Settings.consumer.secret,\n access_token: oauth_token,\n access_token_secret: oauth_token_secret)\n end",
"def connection(options = {})\n default_options = {\n :headers => {\n :accept => 'application/json',\n :user_agent => user_agent,\n :host => EdgeCast::Config::DEFAULT_HOST\n },\n :ssl => { :verify => false },\n :url => endpoint,\n }\n\n @connection ||= Faraday.new(default_options.merge(connection_options)) do |builder|\n builder.request :auth, api_token\n builder.request :json\n builder.request :multipart\n builder.request :url_encoded\n\n builder.response :client_error\n builder.response :json\n builder.response :server_error\n\n builder.adapter(adapter)\n end\n end",
"def api_request(&block)\n response = block.call\n if response.status == 307 and response.body =~ /^\\/REST\\//\n response.body.sub!('/REST/','') \n response = get(response.body)\n end\n parse_response(JSON.parse(response.body || '{}'))\n end",
"def get_superfund_with_http_info(xero_tenant_id, super_fund_id, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PayrollAuApi.get_superfund ...'\n end\n # verify the required parameter 'xero_tenant_id' is set\n if @api_client.config.client_side_validation && xero_tenant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'xero_tenant_id' when calling PayrollAuApi.get_superfund\"\n end\n # verify the required parameter 'super_fund_id' is set\n if @api_client.config.client_side_validation && super_fund_id.nil?\n fail ArgumentError, \"Missing the required parameter 'super_fund_id' when calling PayrollAuApi.get_superfund\"\n end\n # resource path\n local_var_path = '/Superfunds/{SuperFundID}'.sub('{' + 'SuperFundID' + '}', super_fund_id.to_s)\n\n # camelize keys of incoming `where` opts\n opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?\n\n # query parameters\n query_params = opts[:query_params] || {}\n \n # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:\n query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?\n query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Xero-Tenant-Id'] = xero_tenant_id\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'SuperFunds' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, \"PayrollAuApi\", new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PayrollAuApi#get_superfund\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def api_request(params)\n authenticate\n response = cap_client.get \"#{API_PATH}#{params}\"\n JSON.parse(response.body)\n rescue Faraday::TimeoutError => e\n NotificationManager.error(e, 'Timeout error during CAP-API request', self)\n raise\n rescue StandardError => e\n NotificationManager.error(e, \"#{e.class.name} during CAP-API request\", self)\n raise\n end",
"def rest_connection\n client_rest = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n config.access_token = ENV[\"TWITTER_ACCESS_TOKEN\"]\n config.access_token_secret = ENV[\"TWITTER_ACCESS_TOKEN_SECRET\"]\n end\n return client_rest\nend",
"def query_echo(_query_parameters = nil)\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/'\n\n # append optional parameters to the query\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, _query_parameters\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body)\n return ServerResponse.from_hash(decoded)\n end",
"def get_timesheet_with_http_info(xero_tenant_id, timesheet_id, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PayrollAuApi.get_timesheet ...'\n end\n # verify the required parameter 'xero_tenant_id' is set\n if @api_client.config.client_side_validation && xero_tenant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'xero_tenant_id' when calling PayrollAuApi.get_timesheet\"\n end\n # verify the required parameter 'timesheet_id' is set\n if @api_client.config.client_side_validation && timesheet_id.nil?\n fail ArgumentError, \"Missing the required parameter 'timesheet_id' when calling PayrollAuApi.get_timesheet\"\n end\n # resource path\n local_var_path = '/Timesheets/{TimesheetID}'.sub('{' + 'TimesheetID' + '}', timesheet_id.to_s)\n\n # camelize keys of incoming `where` opts\n opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?\n\n # query parameters\n query_params = opts[:query_params] || {}\n \n # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:\n query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?\n query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Xero-Tenant-Id'] = xero_tenant_id\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'TimesheetObject' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, \"PayrollAuApi\", new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PayrollAuApi#get_timesheet\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_client_all_using_get_with_http_info(appTokenConfig = {}, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ClientApi.get_client_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/client'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n\n if @api_client.config.client_side_validation && appTokenConfig['basePath'].nil?\n fail ArgumentError, \"Missing the required parameter 'basePath'\"\n end\n\n if @api_client.config.client_side_validation && appTokenConfig['authType'].nil?\n fail ArgumentError, \"Missing the required parameter 'authType'\"\n end\n\n @auth_config.config.host = appTokenConfig['basePath']\n @api_client.config.host = appTokenConfig['basePath']\n\n if appTokenConfig['authType'].downcase == 'client_credentials'\n client_credentials_token = create_client_credential_return(appTokenConfig)\n @api_client.config.access_token = client_credentials_token\n elsif appTokenConfig['authType'].downcase == 'password_credentials'\n password_credential_token = create_password_credential_return(appTokenConfig)\n @api_client.config.access_token = password_credential_token\n elsif appTokenConfig['authType'].downcase == 'client_token_credentials'\n client_token_credential = create_client_token_credential_return(appTokenConfig)\n @api_client.config.access_token = client_token_credential\n end\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageClient')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ClientApi#get_client_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def request(verb, url, payload=nil, headers={})\n url = api_base_url + \"/\" + url\n\n headers = {\n :user_agent => USER_AGENT,\n :accept => :json,\n :accept_encoding => enable_gzip ? :gzip : nil\n }.merge(headers)\n\n opts = {\n :method => verb.to_s,\n :url => url,\n :user => api_key,\n :password => \"\",\n :headers => headers,\n :payload => payload,\n :verify_ssl => ssl_verify,\n }\n begin\n response = RestClient::Request.execute(opts)\n rescue RestClient::Exception => e\n begin\n r = MultiJson.decode(e.response)\n msg = r['message']\n code = r['code']\n rescue\n raise e\n end\n raise VeritableError.new(\"HTTP Error #{e.message} -- #{code}: #{msg}\", {'http_code' => e.message, 'api_code' => code, 'api_message' => msg})\n end\n return MultiJson.decode(response)\n end",
"def request(method:, resource_path:, headers: {}, body: nil, prefix: API_PREFIX)\n body_json = body.is_a?(String) || body.nil? ? body : body.to_json\n url = ((api_url + prefix) + resource_path).to_s\n request_headers = default_headers.merge(headers)\n\n if verbose\n puts(\"Executing #{method} request to #{url}\")\n request_headers.each_pair do |k, v|\n puts(\"- Header: #{k}: #{v}\")\n end\n puts(\"- body: #{body_json.class}: #{body_json}\")\n end\n\n response = RestClient::Request.execute(\n method: method,\n url: url,\n headers: request_headers,\n payload: body_json\n )\n\n JSON.parse(response.body)\n end",
"def rest_request options\n defaults = {\n headers: { :content_type => :json },\n timeout: @timeout,\n open_timeout: @open_timeout,\n user: @username,\n password: @password,\n }\n\n expected_code = options.delete(:expected_code) || 200\n\n RestClient::Request.execute(defaults.merge(options)).tap do |response|\n unless response.code == expected_code\n raise LBModelException.new \"Expected HTTP #{expected_code} but got #{response.code} instead\"\n end\n end\n end",
"def rest_request options\n defaults = {\n headers: { :content_type => :json },\n timeout: @timeout,\n open_timeout: @open_timeout,\n user: @username,\n password: @password,\n }\n\n expected_code = options.delete(:expected_code) || 200\n\n RestClient::Request.execute(defaults.merge(options)).tap do |response|\n unless response.code == expected_code\n raise LBModelException.new \"Expected HTTP #{expected_code} but got #{response.code} instead\"\n end\n end\n end",
"def execute(method_function, method_name, resource, **params)\n\n resource_uri = URI.parse(\"#{@rest_endpoint}#{resource}\")\n\n encoded_fields = ''\n if %w[POST PUT].include? method_name\n request = method_function.new(resource_uri.request_uri)\n if content_type == \"application/x-www-form-urlencoded\"\n unless params.empty?\n encoded_fields = URI.encode_www_form(params, Encoding::UTF_8)\n request.set_form_data(params)\n end\n else\n encoded_fields = params.to_json\n request.body = encoded_fields\n request.set_content_type(\"application/json\")\n end\n else\n resource_uri.query = URI.encode_www_form(params, Encoding::UTF_8)\n request = method_function.new(resource_uri.request_uri)\n end\n\n headers = RestClient.generate_telesign_headers(@customer_id,\n @api_key,\n method_name,\n resource,\n content_type,\n encoded_fields,\n user_agent: @@user_agent)\n\n headers.each do |k, v|\n request[k] = v\n end\n\n http_response = @http.request(resource_uri, request)\n\n Response.new(http_response)\n end",
"def get_conversation(url)\n response = RestClient::Request.execute method: :get,\n url: url,\n user: USERNAME,\n password: PASSWORD,\n :content_type => :json,\n :accept => :json\n\n if response.headers[:x_ratelimit_remaining].to_i < 3\n reset_time = Time.at(response.headers[:x_ratelimit_reset].to_i)\n delay = (reset_time - Time.now) + 5\n puts 'SLEEPING FOR: '+ delay.to_s\n sleep delay\n end\n\n JSON(response)\n end",
"def api(resource, parameters = {})\n res = self.client(resource, parameters).get\n raise \"No response from #{url}!\" if res.body.nil? && res.body.empty?\n Hpricot(res.body)\n end",
"def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend",
"def get_rest_api(endpoint, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP GET request against the specified REST API endpoint.\n request = Net::HTTP::Get.new(rest_api_endpoint)\n # Submit the request\n response = http.request(request)\n # Return the response body (JSON containing the results of the query).\n response.body\nend",
"def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"def common_rest_options(rest_options)\n SSL_OPTS.each { |opt| rest_options[opt] = ssl[opt] if ssl[opt] }\n rest_options[:timeout] = timeout > 0 ? timeout : nil\n rest_options\n end",
"def connection\n @connection ||= Faraday.new(api_endpoint) do |http|\n http.headers[:accept] = \"application/json, */*\"\n http.headers[:user_agent] = user_agent\n\n http.request :authorization, :Bearer, -> { token_store.get_token }\n http.request :json\n\n http.use Keap::REST::Response::RaiseError\n\n http.response :dates\n http.response :json, content_type: \"application/json\"\n # http.response :logger do |logger|\n # logger.filter(/(Bearer) (\\w+)/, '\\1 [FILTERED]')\n # end\n\n http.adapter adapter, @stubs\n end\n end",
"def initialize(api_client_id = nil, api_secret = nil, tenancy_code = nil,\n **opts)\n super(tenancy_code, **opts)\n @api_client_id = api_client_id\n @api_secret = api_secret\n @api_token = nil\n self.api_root = opts[:api_root] || API_ROOT\n self.api_root_auth = opts[:api_root_auth] || API_ROOT_AUTH\n self.api_version = opts[:api_version] || 2\n rate_limit\n end",
"def client(sid = nil, auth = nil)\n ::Twilio::REST::Client.new(\n sid || ENV['TWILIO_ACCOUNT_SID'],\n auth || ENV['TWILIO_AUTH_TOKEN']\n )\n end",
"def make_request!(options = {})\n\t\t\toptions[:client] = client\n\t\t\tself.client.transporter.make_request(options)\n\t\tend"
] | [
"0.6244816",
"0.6234532",
"0.60365266",
"0.59155256",
"0.58677393",
"0.58076847",
"0.5753729",
"0.5723202",
"0.56997734",
"0.5676537",
"0.56553006",
"0.564077",
"0.5604026",
"0.55906004",
"0.557717",
"0.5524308",
"0.5522994",
"0.55147743",
"0.54602253",
"0.5452858",
"0.5450617",
"0.5443196",
"0.5426662",
"0.5426366",
"0.5418967",
"0.5407452",
"0.5403337",
"0.53974336",
"0.5393766",
"0.5392664",
"0.5391747",
"0.53678185",
"0.53420866",
"0.5341096",
"0.5335149",
"0.53331894",
"0.5328551",
"0.52779955",
"0.5268456",
"0.5267366",
"0.5265611",
"0.52618504",
"0.52482104",
"0.524058",
"0.5238008",
"0.5228714",
"0.5220185",
"0.5220147",
"0.5185319",
"0.51734644",
"0.5173169",
"0.51674306",
"0.5141825",
"0.5139236",
"0.5136219",
"0.5130841",
"0.51193655",
"0.51186407",
"0.51170915",
"0.51143765",
"0.51026547",
"0.50877446",
"0.50868434",
"0.50852245",
"0.5071238",
"0.50542575",
"0.505258",
"0.50429475",
"0.50429475",
"0.503991",
"0.50334734",
"0.50233185",
"0.50201774",
"0.50059",
"0.5005141",
"0.49793473",
"0.49751085",
"0.49608737",
"0.4951931",
"0.49512002",
"0.49475658",
"0.49456507",
"0.49439362",
"0.49400303",
"0.49395353",
"0.49217322",
"0.49205655",
"0.49173614",
"0.49173614",
"0.4913994",
"0.49137276",
"0.49098414",
"0.49001828",
"0.48968095",
"0.48925218",
"0.4891808",
"0.4889873",
"0.48865706",
"0.48811302",
"0.4880417"
] | 0.7206188 | 0 |
Generic TeleSign REST API POST handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the POST request with, as a hash. | def post(resource, **params)
execute(Net::HTTP::Post, 'POST', resource, **params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(resource, params)\n Api.new.post(resource, params)\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def post(api_version, resource, payload, query_parameters = nil,\n headers = nil)\n make_rest_call(:post, uri_builder(api_version, resource,\n query_parameters), payload, headers)\n end",
"def post(resource_url, params, data=nil)\n headers = {'Authorization' => authorization('POST', resource_url, params)}\n url = resource_url + '?' + URI.encode_www_form(params)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.request_post(url, data, headers)\n Response.new(res)\n end",
"def post(resource_name, params, locale = nil, raw = false)\n params_name = resource_name.to_s.split('/').last.singularize\n\n query = { query: { params_name => params } }\n\n query[:query][:locale] = locale if locale\n\n response = Locomotive::Mounter::EngineApi.post(\"/#{resource_name}.json\", query)\n data = response.parsed_response\n\n if response.success?\n return data if raw\n self.raw_data_to_object(data)\n else\n message = data\n\n message = data.map do |attribute, errors|\n \" #{attribute} => #{[*errors].join(', ')}\\n\".colorize(color: :red)\n end.join(\"\\n\") if data.respond_to?(:keys)\n\n raise WriterException.new(message)\n\n # self.log \"\\n\"\n # data.each do |attribute, errors|\n # self.log \" #{attribute} => #{[*errors].join(', ')}\\n\".colorize(color: :red)\n # end if data.respond_to?(:keys)\n # nil\n end\n end",
"def post(resource, body = \"\", headers = {})\n prepare_request(:post, resource, body, headers)\n end",
"def post(resource, data)\n proxy(method: :post, url: url_for(resource), data: data)\n end",
"def post(resource:, data:, version: :v1)\n if data.is_a? String\n begin\n MultiJson.load data\n rescue MultiJson::ParseError => e\n raise BayPhoto::Exceptions::BadJSON, \"Invalid JSON string: #{e.message}\"\n end\n else\n data = MultiJson.dump data\n end\n\n handle = http_handle(version: version)\n\n req = Net::HTTP::Post.new(uri_path_for(resource: resource, version: version))\n req[\"Content-Type\"] = \"application/json\"\n SET_REQUEST_AUTH_TOKEN.call(req)\n req.body = data\n\n handle_response(handle.request(req))\n end",
"def send_post(resource, data)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Post.new(url.to_s, initheader = {'Content-Type' => 'application/json'})\n req.body = data\n\n puts 'Sending POST request to ' + url.to_s\n\n send_request(url, req)\n end",
"def _http_post resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Post.new(path)\n _build_request resource, request\nend",
"def _http_post resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Post.new(path)\n _build_request resource, request\nend",
"def post(resource_path, body:, headers: {}, prefix: API_PREFIX)\n request(method: :post, resource_path: resource_path, headers: headers, body: body, prefix: prefix)\n end",
"def post(path, params = {})\n resource(path).post(params)\n end",
"def post_multipart(resource_url, params, data={})\n headers = {'Authorization' => authorization('POST', resource_url, params)}\n url = resource_url + '?' + URI.encode_www_form(params)\n uri = URI.parse(url)\n form_data = []\n data.each{|k,v|\n form_data << [k,v]\n }\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Post.new(uri.request_uri, headers)\n req.set_form(form_data, 'multipart/form-data')\n res = http.start{|h|\n h.request(req)\n }\n Response.new(res)\n end",
"def create_resource_with_http_info(resource, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcesApi.create_resource ...'\n end\n # verify the required parameter 'resource' is set\n if @api_client.config.client_side_validation && resource.nil?\n fail ArgumentError, \"Missing the required parameter 'resource' when calling ResourcesApi.create_resource\"\n end\n # resource path\n local_var_path = '/resource_set'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(resource) \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse200' \n\n # auth_names\n auth_names = opts[:auth_names] || ['token_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcesApi#create_resource\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def transactions_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_post ...'\n end\n # resource path\n local_var_path = '/api/v1/transactions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'addrs'] = opts[:'addrs'] if !opts[:'addrs'].nil?\n query_params[:'confirmed'] = opts[:'confirmed'] if !opts[:'confirmed'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['csrfAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transactions_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :post,\n :url => \"#{self.uri}#{path}\",\n :headers=> {},\n :payload=> params,\n :verify_ssl=> @ssl_verify )\n end",
"def post\n resource.post(request, response)\n end",
"def post\n \"\n desc 'create #{resource.singularize}' do\n tags %w[#{resource.singularize}]\n end\n params do\n # TODO: specify the parameters\n end\n post do\n # your code goes here\n end\"\n end",
"def execute(method_function, method_name, resource, **params)\n\n resource_uri = URI.parse(\"#{@rest_endpoint}#{resource}\")\n\n encoded_fields = ''\n if %w[POST PUT].include? method_name\n request = method_function.new(resource_uri.request_uri)\n if content_type == \"application/x-www-form-urlencoded\"\n unless params.empty?\n encoded_fields = URI.encode_www_form(params, Encoding::UTF_8)\n request.set_form_data(params)\n end\n else\n encoded_fields = params.to_json\n request.body = encoded_fields\n request.set_content_type(\"application/json\")\n end\n else\n resource_uri.query = URI.encode_www_form(params, Encoding::UTF_8)\n request = method_function.new(resource_uri.request_uri)\n end\n\n headers = RestClient.generate_telesign_headers(@customer_id,\n @api_key,\n method_name,\n resource,\n content_type,\n encoded_fields,\n user_agent: @@user_agent)\n\n headers.each do |k, v|\n request[k] = v\n end\n\n http_response = @http.request(resource_uri, request)\n\n Response.new(http_response)\n end",
"def transactions_post_with_http_info(method, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_post ...'\n end\n # verify the required parameter 'method' is set\n if @api_client.config.client_side_validation && method.nil?\n fail ArgumentError, \"Missing the required parameter 'method' when calling DefaultApi.transactions_post\"\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'method'] = method\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'mobile'] = opts[:'mobile'] if !opts[:'mobile'].nil?\n query_params[:'holdername'] = opts[:'holdername'] if !opts[:'holdername'].nil?\n query_params[:'cardnumber'] = opts[:'cardnumber'] if !opts[:'cardnumber'].nil?\n query_params[:'cvv'] = opts[:'cvv'] if !opts[:'cvv'].nil?\n query_params[:'exp'] = opts[:'exp'] if !opts[:'exp'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'account'] = opts[:'account'] if !opts[:'account'].nil?\n query_params[:'reference'] = opts[:'reference'] if !opts[:'reference'].nil?\n query_params[:'genericmsg'] = opts[:'genericmsg'] if !opts[:'genericmsg'].nil?\n query_params[:'token'] = opts[:'token'] if !opts[:'token'].nil?\n query_params[:'bouquet'] = opts[:'bouquet'] if !opts[:'bouquet'].nil?\n query_params[:'payoption'] = opts[:'payoption'] if !opts[:'payoption'].nil?\n query_params[:'meternumber'] = opts[:'meternumber'] if !opts[:'meternumber'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apipassword', 'apiusername']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse200')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transactions_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params, signature_params)\n end",
"def post(path, params = {})\n signature_params = params.values.any? { |value| value.respond_to?(:to_io) } ? {} : params\n request(:post, path, params, signature_params)\n end",
"def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params, signature_params)\n end",
"def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params, signature_params)\n end",
"def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params, signature_params)\n end",
"def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params, signature_params)\n end",
"def create_resource_reservation_with_http_info(resource_reservation, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourceApi.create_resource_reservation ...'\n end\n # verify the required parameter 'resource_reservation' is set\n if @api_client.config.client_side_validation && resource_reservation.nil?\n fail ArgumentError, \"Missing the required parameter 'resource_reservation' when calling ResourceApi.create_resource_reservation\"\n end\n # resource path\n local_var_path = '/api/v1/resource/Reservations'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(resource_reservation)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceReservation'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourceApi.create_resource_reservation\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourceApi#create_resource_reservation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create(resource, format=@default_format)\n options = { resource: resource.class, format: format }\n reply = post resource_url(options), resource, fhir_headers(options)\n if [200,201].include? reply.code\n type = reply.response[:headers][:content_type]\n if !type.nil?\n if type.include?('xml') && !reply.body.empty?\n reply.resource = resource.class.from_xml(reply.body)\n elsif type.include?('json') && !reply.body.empty?\n reply.resource = resource.class.from_fhir_json(reply.body)\n else\n reply.resource = resource # just send back the submitted resource\n end\n else\n reply.resource = resource # don't know the content type, so return the resource provided\n end\n else\n reply.resource = resource # just send back the submitted resource\n end\n reply.resource_class = resource.class\n reply\n end",
"def request(resource, method, params = nil) \n resource = Resources.get(resource, method, params)\n params = append_api_credentials(params)\n\n if method == :post\n payload = prepare_params(params)\n else\n payload = {}\n end\n\n headers = @options[:headers] || {}\n if method == :get \n resource.send(method, headers) do |response, request, result, &block| \n ZipMoney::Response.new(response)\n end\n else\n resource.send(method, payload, headers) do |response, request, result, &block|\n ZipMoney::Response.new(response)\n end\n end\n end",
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, 'rack.input' => rack_input\nend",
"def txs_post_with_http_info(tx_broadcast, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.txs_post ...'\n end\n # verify the required parameter 'tx_broadcast' is set\n if @api_client.config.client_side_validation && tx_broadcast.nil?\n fail ArgumentError, \"Missing the required parameter 'tx_broadcast' when calling TransactionsApi.txs_post\"\n end\n # resource path\n local_var_path = '/txs'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tx_broadcast)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BroadcastTxCommitResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#txs_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def raw_post_request raw_params\n json_body = raw_params.to_json\n Rubix.logger.log(Logger::DEBUG, \"SEND: #{json_body}\") if Rubix.logger\n Net::HTTP::Post.new(uri.path).tap do |req|\n req['Content-Type'] = 'application/json-rpc'\n req.body = json_body\n end\n end",
"def post(path_part, payload, additional_headers = {}, &block)\n api_request { @rest.post('/REST/' + path_part, payload.to_json, additional_headers, &block) }\n end",
"def post(path, params={})\n RestClient.post request_base+path, params\n end",
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, {\"rack.input\" => rack_input}\nend",
"def http_post(path, data, content_type = 'application/json')\n http_methods(path, :post, data, content_type)\n end",
"def create(context)\n context.request.body.rewind # in case someone already read it\n begin\n data = JSON.parse(context.request.body.read)\n rescue JSON::ParserError\n context.halt(406, { status: 'error', message: 'Not acceptable JSON payload' }.to_json)\n end\n\n permitted_params = resource_fields.map { |k| k[:name] }\n permitted_params = data.select { |k, _| permitted_params.include?(k) }\n\n begin\n instance_variable_set(:\"@#{resource_name}\", resource_name.classify.constantize.new(permitted_params))\n\n if instance_variable_get(:\"@#{resource_name}\").save\n instance_variable_get(:\"@#{resource_name}\").to_json\n else\n errors = instance_variable_get(:\"@#{resource_name}\").errors.map { |k, v| \"#{k}: #{v}\" }.join('; ')\n context.halt(406, { status: 'error', message: errors }.to_json)\n end\n rescue StandardError => e\n context.halt(500, { status: 'error', message: e.message }.to_json)\n end\n end",
"def _make_api_call(json_params=nil)\n\n puts \"Crossbar::HTTP - Request: POST #{url}\" if self.verbose\n\n encoded_params = nil\n if json_params != nil\n if self.pre_serialize != nil and self.pre_serialize.is_a? Proc\n json_params = self._parse_params json_params\n end\n encoded_params = JSON.generate(json_params)\n end\n\n puts \"Crossbar::HTTP - Params: #{encoded_params}\" if encoded_params != nil and self.verbose\n\n uri = URI(self.url)\n\n if self.key != nil and self.secret != nil and encoded_params != nil\n signature, nonce, timestamp = self._compute_signature(encoded_params)\n params = {\n timestamp: timestamp,\n seq: self.sequence.to_s,\n nonce: nonce,\n signature: signature,\n key: self.key\n }\n uri.query = URI.encode_www_form(params)\n\n puts \"Crossbar::HTTP - Signature Params: #{params}\" if self.verbose\n end\n\n # TODO: Not sure what this is supposed to be but this works\n self.sequence += 1\n\n self._api_call uri, encoded_params\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def post(api, params)\n url2json(:POST, \"#{@endpoint}#{api}\", params)\n end",
"def post(path, params)\n request(:post, path, params)\n end",
"def post(path, params)\n parse_response @client[path].post(params)\n end",
"def api_post(action, data, binary_key = nil)\n api_request(action, data, 'POST', binary_key)\n end",
"def base_create(resource, options, format = nil, additional_header = {})\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n headers = {content_type: \"#{format}\"}\n headers[:prefer] = @return_preference if @use_return_preference\n headers.merge!(additional_header)\n options = {} if options.nil?\n options[:resource] = resource.class\n options[:format] = format || @default_format\n reply = post resource_url(options), resource, fhir_headers(headers)\n if [200, 201].include? reply.code\n type = reply.response[:headers].detect{|x, _y| x.downcase=='content-type'}.try(:last)\n if !type.nil?\n reply.resource = if type.include?('xml') && !reply.body.empty?\n klass = self.versioned_resource_class(:Xml)\n klass.from_xml(reply.body)\n elsif type.include?('json') && !reply.body.empty?\n klass = self.versioned_resource_class(:Json)\n klass.from_json(reply.body)\n else\n resource # just send back the submitted resource\n end\n resource.id = FHIR::ResourceAddress.pull_out_id(resource.class.name.demodulize, reply.self_link)\n else\n resource.id = FHIR::ResourceAddress.pull_out_id(resource.class.name.demodulize, reply.self_link)\n reply.resource = resource # don't know the content type, so return the resource provided\n end\n else\n resource.id = FHIR::ResourceAddress.pull_out_id(resource.class.name.demodulize, reply.self_link)\n reply.resource = resource # just send back the submitted resource\n end\n set_client_on_resource(reply.resource)\n reply.resource_class = resource.class\n reply\n end",
"def post payload, path = \"\" \n make_request(path, \"post\", payload)\n end",
"def post(api_route, url_params_hash)\n @request_class = Net::HTTP::Post\n set_api_url(api_route, url_params_hash)\n send\n end",
"def post(params = nil)\n request.method = :post\n execute(params)\n end",
"def post(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'post'}.merge(authentication))\n end",
"def post(path, params)\n with_monitoring do\n connection.post(path) do |req|\n req.body = Oj.dump(params)\n end\n end\n end",
"def json_create(resource_params, resource_model)\n resource_obj = resource_model.new(resource_params)\n if resource_obj.save\n return render json: resource_obj, status: :ok\n else\n return render json: resource_obj.errors, status: :unprocessable_entity\n end\n end",
"def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end",
"def create_wallet_key_using_post_with_http_info(wallet_key_params, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WalletKeyApi.create_wallet_key_using_post ...'\n end\n # verify the required parameter 'wallet_key_params' is set\n if @api_client.config.client_side_validation && wallet_key_params.nil?\n fail ArgumentError, \"Missing the required parameter 'wallet_key_params' when calling WalletKeyApi.create_wallet_key_using_post\"\n end\n # resource path\n local_var_path = '/wallet_key'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(wallet_key_params)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'WalletKeyResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WalletKeyApi#create_wallet_key_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params.to_xml, signature_params)\n end",
"def post(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('post')\n end\n end",
"def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end",
"def patch_resource_reservation_with_http_info(moid, resource_reservation, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourceApi.patch_resource_reservation ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling ResourceApi.patch_resource_reservation\"\n end\n # verify the required parameter 'resource_reservation' is set\n if @api_client.config.client_side_validation && resource_reservation.nil?\n fail ArgumentError, \"Missing the required parameter 'resource_reservation' when calling ResourceApi.patch_resource_reservation\"\n end\n # resource path\n local_var_path = '/api/v1/resource/Reservations/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(resource_reservation)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceReservation'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourceApi.patch_resource_reservation\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourceApi#patch_resource_reservation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def send_templated_push_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MessagingApi.send_templated_push ...\"\n end\n # resource path\n local_var_path = \"/messaging/templated-push\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'template_push_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagingApi#send_templated_push\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n status_unsupported_media_type && return unless content_type_header?\n\n # Parse in the FHIR::Patient\n contents = FHIR.from_contents(request.body.string)\n status_bad_request && return if contents.nil? || !contents.valid?\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n # Construct a Sara Alert Patient\n resource = Patient.new(Patient.from_fhir(contents))\n\n # Responder is self\n resource.responder = resource\n\n # Creator is authenticated user\n resource.creator = current_resource_owner\n\n # Jurisdiction is the authenticated user's jurisdiction\n resource.jurisdiction = current_resource_owner.jurisdiction\n\n # Generate a submission token for the new monitoree\n resource.submission_token = SecureRandom.hex(20) # 160 bits\n end\n\n status_bad_request && return if resource.nil?\n\n status_bad_request && return unless resource.save\n\n if resource_type == 'patient'\n # Send enrollment notification\n resource.send_enrollment_notification\n\n # Create a history for the enrollment\n History.enrollment(patient: resource, created_by: current_resource_owner.email, comment: 'User enrolled monitoree via API.')\n end\n status_created(resource.as_fhir) && return\n rescue StandardError\n render json: operation_outcome_fatal.to_json, status: :internal_server_error\n end",
"def txs_encode_post_with_http_info(tx, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.txs_encode_post ...'\n end\n # verify the required parameter 'tx' is set\n if @api_client.config.client_side_validation && tx.nil?\n fail ArgumentError, \"Missing the required parameter 'tx' when calling TransactionsApi.txs_encode_post\"\n end\n # resource path\n local_var_path = '/txs/encode'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tx)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2003')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#txs_encode_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post(params)\n self.class.post(url, body: params)\n end",
"def post(path, params = {})\n\t\trequest(path, :post, params)\n\tend",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params = nil)\n response = @connection.post do |req|\n req.headers = generate_headers\n req.url path\n req.body = params.to_json\n end\n Arke::Log.fatal(build_error(response)) if response.env.status != 201\n response\n end",
"def post_transactions_with_http_info(transaction_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.post_transactions ...'\n end\n # verify the required parameter 'transaction_request' is set\n if @api_client.config.client_side_validation && transaction_request.nil?\n fail ArgumentError, \"Missing the required parameter 'transaction_request' when calling TransactionsApi.post_transactions\"\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(transaction_request)\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#post_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def api_request method, params = nil\n\t\t\tconnection = ZenfolioAPI::HTTP.new()\n\t\t\t@response = connection.POST(method, params, @auth.token)\n\t\tend",
"def post(action, params = T.unsafe(nil), header = T.unsafe(nil), query = T.unsafe(nil)); end",
"def post(path, params={}, options={})\n request(:post, api_path(path), params, options)\n end",
"def post(path:, params: {})\n request(method: :post, path: path, params: params)\n end",
"def post(api_method, parameters = {})\n parameters.merge!({\"token\" => @token})\n\n body = {}\n body.merge!({:method => api_method})\n body.merge!({:params => parameters})\n\n self.class.post(@write_api_url, {:body => {:json => JSON.generate(body)}})\n end",
"def api_post(action, data)\n api_request(action, data, 'POST')\n end",
"def update_resource_reservation_with_http_info(moid, resource_reservation, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourceApi.update_resource_reservation ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling ResourceApi.update_resource_reservation\"\n end\n # verify the required parameter 'resource_reservation' is set\n if @api_client.config.client_side_validation && resource_reservation.nil?\n fail ArgumentError, \"Missing the required parameter 'resource_reservation' when calling ResourceApi.update_resource_reservation\"\n end\n # resource path\n local_var_path = '/api/v1/resource/Reservations/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(resource_reservation)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceReservation'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourceApi.update_resource_reservation\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourceApi#update_resource_reservation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post_resource_endpoint(mname, rname, body, opts = {})\n post_resource_endpoint_with_http_info(mname, rname, body, opts)\n nil\n end",
"def post(*args)\n super(*wrap_for_json_api(*args))\n end",
"def post(path, **args); end",
"def handle_post\n make_response(201, {message: 'New resource created'})\nend",
"def put(resource_name, id, params, locale = nil)\n params_name = resource_name.to_s.split('/').last.singularize\n\n query = { query: { params_name => params } }\n\n query[:query][:locale] = locale if locale\n\n response = Locomotive::Mounter::EngineApi.put(\"/#{resource_name}/#{id}.json\", query)\n data = response.parsed_response\n\n if response.success?\n self.raw_data_to_object(data)\n else\n message = data\n\n message = data.map do |attribute, errors|\n \" #{attribute} => #{[*errors].join(', ')}\" #.colorize(color: :red)\n end.join(\"\\n\") if data.respond_to?(:keys)\n\n raise WriterException.new(message)\n\n # data.each do |attribute, errors|\n # self.log \"\\t\\t #{attribute} => #{[*errors].join(', ')}\".colorize(color: :red)\n # end if data.respond_to?(:keys)\n # nil\n end\n end",
"def call_api(handler_path, params)\n req_url = \"#{rest_client.url}#{handler_path}\"\n req_formdata = auth_request_formdata(handler_path, clean_params(params))\n\n if $DEBUG\n STDERR.puts \"call_api()\\n\" + JSON.pretty_generate(\n path: req_url,\n req: JSON.parse(req_formdata[:req]),\n signature: req_formdata[:signature],\n nonce: req_formdata[:nonce]\n )\n end\n\n response = rest_client[handler_path].post(req_formdata)\n JSON.parse(response, symbolize_names: true)\n rescue RestClient::Exception => err\n err.message += \"\\n Request Path: #{req_url}\" \\\n \"\\n Request Data: #{req_formdata}\"\n raise err\n end",
"def payments_post_with_http_info(payment_data, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentsApi.payments_post ...'\n end\n # verify the required parameter 'payment_data' is set\n if @api_client.config.client_side_validation && payment_data.nil?\n fail ArgumentError, \"Missing the required parameter 'payment_data' when calling PaymentsApi.payments_post\"\n end\n # resource path\n local_var_path = '/payments'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(payment_data)\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Payment')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsApi#payments_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post_webhooks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WebhooksApi.post_webhooks ...'\n end\n # resource path\n local_var_path = '/webhooks'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'WebhookResponseModel'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"WebhooksApi.post_webhooks\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WebhooksApi#post_webhooks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def user_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.user_post ...'\n end\n # resource path\n local_var_path = '/user'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"UserApi.user_post\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#user_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def make_request(resource_name, method_name, params = {}, response_key = nil)\n end",
"def money_ins_pay_trail_init_post_with_http_info(parameters, authorization, psu_ip_address, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MoneyInsApi.money_ins_pay_trail_init_post ...'\n end\n # verify the required parameter 'parameters' is set\n if @api_client.config.client_side_validation && parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'parameters' when calling MoneyInsApi.money_ins_pay_trail_init_post\"\n end\n # verify the required parameter 'authorization' is set\n if @api_client.config.client_side_validation && authorization.nil?\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling MoneyInsApi.money_ins_pay_trail_init_post\"\n end\n # verify the required parameter 'psu_ip_address' is set\n if @api_client.config.client_side_validation && psu_ip_address.nil?\n fail ArgumentError, \"Missing the required parameter 'psu_ip_address' when calling MoneyInsApi.money_ins_pay_trail_init_post\"\n end\n # resource path\n local_var_path = '/v2/moneyins/paytrail/init'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Authorization'] = authorization\n header_params[:'PSU-IP-Address'] = psu_ip_address\n header_params[:'PSU-Accept-Language'] = opts[:'psu_accept_language'] if !opts[:'psu_accept_language'].nil?\n header_params[:'PSU-User-Agent'] = opts[:'psu_user_agent'] if !opts[:'psu_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(parameters)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'MoneyInPayTrailInitOutput')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MoneyInsApi#money_ins_pay_trail_init_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post(path, data, params = {}, request_options = {})\n request(:post, path, data, params)\n end",
"def payment_methods_post_with_http_info(create_payment_method_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentMethodsApi.payment_methods_post ...'\n end\n # verify the required parameter 'create_payment_method_request' is set\n if @api_client.config.client_side_validation && create_payment_method_request.nil?\n fail ArgumentError, \"Missing the required parameter 'create_payment_method_request' when calling PaymentMethodsApi.payment_methods_post\"\n end\n # resource path\n local_var_path = '/payment-methods'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Trace-Id'] = opts[:'trace_id'] if !opts[:'trace_id'].nil?\n header_params[:'User-Agent'] = opts[:'user_agent'] if !opts[:'user_agent'].nil?\n header_params[:'End-User-Device-Id'] = opts[:'end_user_device_id'] if !opts[:'end_user_device_id'].nil?\n header_params[:'End-User-Ip'] = opts[:'end_user_ip'] if !opts[:'end_user_ip'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(create_payment_method_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'PaymentMethod'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['BearerAuth']\n\n new_options = opts.merge(\n :operation => :\"PaymentMethodsApi.payment_methods_post\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentMethodsApi#payment_methods_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post_request(path, params={}, options={})\n request(:post, path, params, options)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(api_method, parameters = {})\n parameters.merge!({\"token\" => @token})\n\n body = {}\n body.merge!({:method => api_method})\n body.merge!({:params => parameters})\n\n result self.class.post(@write_api_url, {:body => {:json => JSON.generate(body)}})\n end",
"def outputs_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.outputs_post ...'\n end\n # resource path\n local_var_path = '/api/v1/outputs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'address'] = opts[:'address'] if !opts[:'address'].nil?\n query_params[:'hash'] = opts[:'hash'] if !opts[:'hash'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['csrfAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#outputs_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def v1_policy_activities_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyActivitiesApi.v1_policy_activities_post ...'\n end\n # resource path\n #\n local_var_path = '/v1/policy_activities'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/plain', 'application/octet-stream', 'application/json-patch+json', 'text/json', 'application/*+json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'central_ent_core_framework_service_library_api_model_policy_activity'])\n\n # return_type\n return_type = opts[:return_type] || 'CentralEntCoreFrameworkServiceLibraryApiModelPolicyActivity'\n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api_special(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyActivitiesApi#v1_policy_activities_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post_peertransfers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PeerTransfersApi.post_peertransfers ...'\n end\n # resource path\n local_var_path = '/peertransfers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'PeerTransferResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"PeerTransfersApi.post_peertransfers\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PeerTransfersApi#post_peertransfers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_resource(_params)\n resource_class.new(resource_params)\n end"
] | [
"0.75428265",
"0.70685315",
"0.6853991",
"0.68156886",
"0.6690143",
"0.65098995",
"0.6404931",
"0.63250756",
"0.6283927",
"0.6038787",
"0.6038787",
"0.5970068",
"0.59241366",
"0.5862658",
"0.58508605",
"0.5834396",
"0.5758661",
"0.5705562",
"0.56920415",
"0.5683019",
"0.5657372",
"0.5592918",
"0.5578083",
"0.5559866",
"0.55580366",
"0.55580366",
"0.55580366",
"0.55580366",
"0.55447894",
"0.552862",
"0.5522755",
"0.5517744",
"0.550881",
"0.5492918",
"0.54923046",
"0.5481535",
"0.54663056",
"0.54574597",
"0.54474545",
"0.54363364",
"0.5432484",
"0.53827107",
"0.53817976",
"0.5381736",
"0.5358918",
"0.5353471",
"0.5347376",
"0.5346903",
"0.5344363",
"0.5333183",
"0.5315027",
"0.5314391",
"0.53080803",
"0.5304694",
"0.529536",
"0.5294268",
"0.528878",
"0.5287323",
"0.52852404",
"0.52850276",
"0.52838486",
"0.52786416",
"0.52697784",
"0.52643895",
"0.52643895",
"0.52643895",
"0.5259267",
"0.52558607",
"0.52498317",
"0.5246721",
"0.5215026",
"0.52138025",
"0.5203532",
"0.520316",
"0.51919633",
"0.5185323",
"0.5184188",
"0.51786363",
"0.5175224",
"0.51692706",
"0.51688236",
"0.51676345",
"0.5167462",
"0.51627946",
"0.51627487",
"0.51624936",
"0.51521134",
"0.5150783",
"0.51438177",
"0.5142015",
"0.5137213",
"0.5137213",
"0.5137213",
"0.5137213",
"0.5137213",
"0.5136897",
"0.5135111",
"0.5131752",
"0.51314026",
"0.5130754"
] | 0.7740034 | 0 |
Generic TeleSign REST API GET handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the GET request with, as a hash. | def get(resource, **params)
execute(Net::HTTP::Get, 'GET', resource, **params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_path, params=nil, accept=\"*/*\")\n http_params = {:accept => accept}\n http_params = http_params.merge(params: params) if params\n response = @http_client[resource_path].get(http_params)\n Response.new(response)\n rescue => e\n log.error Howitzer::CommunicationError, e.message\n end",
"def get(api_version, resource, query_parameters = nil, headers = nil)\n make_rest_call(:get, uri_builder(api_version, resource,\n query_parameters), headers)\n end",
"def get(resource_url, params)\n headers = {'Authorization' => authorization('GET', resource_url, params)}\n url = resource_url + '?' + URI.encode_www_form(params)\n res = URI.open(url, headers)\n Response.new(res)\n end",
"def do_get(path, params={})\n login if need_login?\n\n # Resource id is a special param as it needs to be added to the path\n path = add_id_and_params_to_path(path, params)\n\n req, res, resource_type, body = nil\n\n begin\n retry_request(true) do\n # Return content type so the resulting resource object knows what kind of resource it is.\n resource_type, body = @rest_client[path].get(headers) do |response, request, result, &block|\n req, res = request, response\n update_cookies(response)\n update_last_request(request, response)\n\n case response.code\n when 200\n # Get the resource_type from the content_type, the resource_type\n # will be used later to add relevant methods to relevant resources\n type = if result.content_type.index('rightscale')\n get_resource_type(result.content_type)\n elsif result.content_type.index('text/plain')\n 'text'\n else\n ''\n end\n\n # work around getting ASCII-8BIT from some resources like audit entry detail\n charset = get_charset(response.headers)\n if charset && response.body.encoding != charset\n response.body.force_encoding(charset)\n end\n\n # raise an error if the API is misbehaving and returning an empty response when it shouldn't\n if type != 'text' && response.body.empty?\n raise EmptyBodyError.new(request, response)\n end\n\n [type, response.body]\n when 301, 302\n update_api_url(response)\n response.follow_redirection(request, result, &block)\n when 404\n raise UnknownRouteError.new(request, response)\n else\n raise ApiError.new(request, response)\n end\n end\n end\n rescue => e\n raise wrap(e, :get, path, params, req, res)\n end\n\n data = if resource_type == 'text'\n { 'text' => body }\n else\n JSON.parse(body, :allow_nan => true)\n end\n\n [resource_type, path, data]\n end",
"def get(resource, options = nil)\n params = options\n url = \"/#{resource}\"\n get_response(url, params)\n end",
"def get(resource)\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"GET request Url: #{url}\")\n @logger.debug(\"-- Headers: #{base_headers}\")\n\n HTTParty.get(url, headers: base_headers)\n end",
"def get(resource, headers = {})\n prepare_request(:get, resource, nil, headers)\n end",
"def get(resource, path, params = {})\n if config['security_token'].blank?\n raise 'Security token is not set'\n end\n MicroservicesEngine::Connection.get(resource, path, params, config['security_token'])\n end",
"def request(resource, method, params = nil) \n resource = Resources.get(resource, method, params)\n params = append_api_credentials(params)\n\n if method == :post\n payload = prepare_params(params)\n else\n payload = {}\n end\n\n headers = @options[:headers] || {}\n if method == :get \n resource.send(method, headers) do |response, request, result, &block| \n ZipMoney::Response.new(response)\n end\n else\n resource.send(method, payload, headers) do |response, request, result, &block|\n ZipMoney::Response.new(response)\n end\n end\n end",
"def get(route='', params = {}, filter = nil)\n url = base_url + route\n unless filter.nil?\n url << '/' + \"(#{ERB::Util.url_encode(filter)})\"\n end\n url << '.json'\n begin\n JSON.parse(RestClient.get(url, params: params))\n rescue RestClient::ResourceNotFound => e\n Object.new\n end\n end",
"def get(resource, id)\n Api.new.get(resource, id)\n end",
"def _http_get resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Get.new(path)\n _build_request resource, request\nend",
"def _http_get resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Get.new(path)\n _build_request resource, request\nend",
"def fetch(resource,identifier,params={})\n uri = '/api/' + resource.to_s + '/' + identifier\n http_get(uri,params)\n end",
"def get(resource)\n puts construct_url(@mode, resource)\n @agent.get construct_url(@mode, resource)\n end",
"def api_get(path, params = {})\n api_request(:get, path, :params => params)\n end",
"def get(resource_path, headers: {}, prefix: API_PREFIX)\n request(method: :get, resource_path: resource_path, headers: headers, prefix: prefix)\n end",
"def get(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :get,\n :url => \"#{self.uri}#{path}\",\n :headers => {\n :params => params\n },\n :verify_ssl=> @ssl_verify )\n end",
"def api(resource, parameters = {})\n res = self.client(resource, parameters).get\n raise \"No response from #{url}!\" if res.body.nil? && res.body.empty?\n Hpricot(res.body)\n end",
"def get(path, params={})\n RestClient.get request_base+path, {params: params}\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end",
"def get_resource\n execute(resource_path, method: :get)\n end",
"def get(params)\n request.method = :get\n execute(params)\n end",
"def get(path, params)\n parse_response @client[path].get(:params => params)\n end",
"def get(params={})\n rpc_call :get, params\n end",
"def get(path, params = {})\n\t\trequest(path, :get, params)\n\tend",
"def get_resource_with_http_info(resource_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resource ...'\n end\n # verify the required parameter 'resource_id' is set\n if @api_client.config.client_side_validation && resource_id.nil?\n fail ArgumentError, \"Missing the required parameter 'resource_id' when calling ResourcesApi.get_resource\"\n end\n # resource path\n local_var_path = '/resource_set/{resource_id}'.sub('{' + 'resource_id' + '}', CGI.escape(resource_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['token_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcesApi#get_resource\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get(params = {})\n request! do\n api[url.path + to_query(params)].get(API_HEADERS)\n end\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get_details(resource, id, **params)\n ops_hash = {\n id: id\n }\n ops_hash.merge! params\n resp = _make_request(resource, ops_hash)\n ComicVine::Resource.create_resource(resp['results'])\n end",
"def get(path:, params: {})\n request(method: :get, path: path, params: params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(resource, other_query = nil)\n raise NotImplementedError, \"#{self.class}#get not implemented\"\n end",
"def get(path, params={}, options={})\n request(:get, api_path(path), params, options)\n end",
"def send_get(resource)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Get.new(url.to_s)\n\n puts 'Sending GET request to ' + url.to_s\n\n send_request(url, req)\n end",
"def json_get(path, params={})\n json_request(:get, path, params)\n end",
"def get(path, params = {}, request_options = {})\n request(:get, path, params)\n end",
"def get(resource:, version: :v1)\n http = http_handle(version: version)\n\n req = Net::HTTP::Get.new(uri_path_for(resource: resource, version: version))\n SET_REQUEST_AUTH_TOKEN.call(req)\n\n handle_response(http.request(req))\n end",
"def get(path, params = {})\n request(:get, path, params)\n end",
"def get(path, params = {})\n request(:get, path, params)\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n JSON.parse(Typhoeus::Request.get(API_URL + path, :params => params).body)[\"response\"]\n end",
"def get(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Add parameters to URL query string\n get_params = {\n :method => \"get\", \n :verbose => DEBUG\n }\n get_params[:params] = data unless data.empty?\n # Create GET request\n get = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", get_params)\n # Send request\n do_request(get, format, :cache => true)\n end",
"def get(path, params = {})\n request(:get, path, params)\n end",
"def get(path, params = {})\n request(:get, path, params)\n end",
"def get_resource(url, resource_class, params={})\n resource_class.from_hash(get(url, params), client: self)\n end",
"def resource(*args)\n args << @request_params || {}\n Merb::Router.resource(*args)\n end",
"def get(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'get'}.merge(authentication))\n end",
"def api_get(function, params = {})\n\t\turi = URI.parse(api_endpoint + function + '?' + params.to_query)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\trequest = Net::HTTP::Get.new(uri.request_uri)\n\t\trequest.basic_auth(api_username, api_password)\n\t\tresponse = http.request(request)\n\t\tJSON.parse response.body\n\tend",
"def api_get(action, data)\n api_request(action, data, 'GET')\n end",
"def api_get(action, data)\n api_request(action, data, 'GET')\n end",
"def request(method: :get, path:, params: {})\n authenticate\n\n uri = \"#{@base_uri}/#{path}\"\n headers = {\n \"Authorization\" => \"Token token=\\\"#{@token}\\\"\",\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\"\n }\n\n RestClient::Request.execute(\n method: method, url: uri, payload: params.to_json, headers: headers\n ) { |response| handle_response(response) }\n end",
"def get path = \"\", payload = {}\n make_request(path, \"get\", payload)\n end",
"def get(action, params={}, options={})\n request(:get, action, params, options)\n end",
"def find_resource\n get params[:resource_path]\n end",
"def get(path, query_params={}, opts={})\n request(:get, path, query_params, opts)\n end",
"def get(path, params = {})\n @connection.get(path, params)\n end",
"def get(path, params, connection = CONNECTION)\n request = Net::HTTP::Get.new(to_url(path, params))\n process_request(request, connection)\nend",
"def get(*args)\n prepare_request(:get, args)\n @@client.add(:get, @path, *args)\n end",
"def get(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end",
"def get(path, data={})\n http_verb :get, path, data\n end",
"def resource(path, params={})\n r = Resource.process_detailed(self, *do_get(path, params))\n\n # note that process_detailed will make a best-effort to return an already\n # detailed resource or array of detailed resources but there may still be\n # legacy cases where #show is still needed. calling #show on an already\n # detailed resource is a no-op.\n r.respond_to?(:show) ? r.show : r\n end",
"def get(path, parameters = {})\n request(:get, path, parameters)\n end",
"def get(path, params = {})\n debug_log \"GET #{connection.build_url(\"#{@host}#{path}\", params)}\"\n res = connection.get path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def get endpoint\n do_request :get, endpoint\n end",
"def get(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('get')\n end\n end",
"def get\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.get do |req|\n req.url resource_uri\n resource_params.each { |key, value|\n req.params[key] = value\n }\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end",
"def get(params)\n bucket = params[:bucket]\n object = params[:object]\n content_type = params[:content_type]\n cb = params[:cb]\n date = generate_date\n sign_string = generate_signed_string('GET', nil, bucket, object, 'text/plain')\n signature = generate_signature(sign_string)\n auth = generate_auth(signature)\n headers = generate_get_headers(date, auth, 'text/plain')\n path = \"/\" << object\n\n @req_options = {:method => :get, :head => headers, :path => path}\n @cb = cb if cb\n @bucket = bucket\n try_request\n self\n end",
"def get_request(path, params={}, options={})\n request(:get, path, params, options)\n end",
"def get(path, params: {}, headers: nil)\n response = conn.get do |req|\n build_request(req, path: path, params: params, headers: headers)\n end\n response\n rescue StandardError => e\n puts e.inspect\n raise\n end",
"def resource_with_http_info(resource, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.resource ...\"\n end\n # verify the required parameter 'resource' is set\n fail ArgumentError, \"Missing the required parameter 'resource' when calling DefaultApi.resource\" if resource.nil?\n # resource path\n local_var_path = \"/{resource}.json\".sub('{format}','json').sub('{' + 'resource' + '}', resource.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basic']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Hash<String, String>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#resource\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get(path, params={})\n request(:get, params.merge(:path => path))\n end",
"def get\n @get ||= Verb.new do |verb|\n verb.entity :air, :lodging, :car, :rail, :transport, \\\n :cruise, :restaurant, :activity, :note, :map, :directions, \\\n :points_program \\\n do |entity, id|\n do_request('get', entity, {:id=>id}, nil)\n end\n\n verb.entity :profile do |*args|\n entity = args[0]\n do_request('get', entity, nil, nil)\n end\n\n verb.entity :trip do |*args|\n entity, id, filter = args\n if filter.nil?\n filter = {}\n end\n filter[:id] = id\n do_request('get', entity, filter, nil)\n end\n end\n end",
"def show_resource(resource, opts)\n debug \"i m in show resource\"\n unless about = opts[:req].path\n throw \"Missing 'path' declaration in request\"\n end\n path = opts[:path] || about\n\n case opts[:format]\n when 'xml'\n show_resources_xml(resource, path, opts)\n when 'ttl'\n self.class.omn_response_json(resource, opts)\n else\n show_resources_json(resource, path, opts)\n end\n end",
"def get(url, resource_name, options = {})\n build_response(resource_name) do\n connection.get do |req|\n req.url url\n req.params = options\n end\n end\n end",
"def get(path_part, additional_headers = {}, &block)\n api_request { @rest.get('/REST/' + path_part, nil, additional_headers, &block) }\n end",
"def get_resource(id, type)\n\t\t@client.method(type).call.get(id)\n\tend",
"def get(api, params={})\n url2json(:GET, \"#{@endpoint}#{api}\", params)\n end",
"def get_resources_with_http_info()\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DiagnosticsApi.get_resources ...\"\n end\n # resource path\n local_var_path = \"/v2.1\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourceInformation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DiagnosticsApi#get_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get(parameters = {}, headers = {}, &block)\n build_get(parameters, headers, &block).invoke\n end",
"def get(path, request_options = {}, resource_options = {})\n response(:get, resource(resource_options)[path], request_options)\n end",
"def get(path, params = {})\n execute :get, path, params\n end",
"def fetch(resource_type,identifier,params={})\n path = '/api/' + resource_type.to_s + '/' + slugify(identifier)\n hydrate(resource_type, http_get(path,params))\n end",
"def txs_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.txs_get ...'\n end\n # resource path\n local_var_path = '/txs'\n\n # query parameters\n query_params = {}\n query_params[:'message.action'] = opts[:'message_action'] if !opts[:'message_action'].nil?\n query_params[:'message.sender'] = opts[:'message_sender'] if !opts[:'message_sender'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'tx.minheight'] = opts[:'tx_minheight'] if !opts[:'tx_minheight'].nil?\n query_params[:'tx.maxheight'] = opts[:'tx_maxheight'] if !opts[:'tx_maxheight'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PaginatedQueryTxs')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#txs_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get resource=nil\n\n time = Time.now\n if @data.empty? || time > @last_update + @ttl\n ur = \"#{uri}#{resource || @resource}\"\n begin\n @data = JSON.parse Net::HTTP.get URI ur\n @last_update = time\n rescue => e \n print \"Cannot retrieve data: #{e.message} (URI: #{ur}) \"\n end\n end\n @data\n end",
"def get\n url = prefix + \"get\" + id_param\n return response(url)\n end",
"def get(uri, params = {})\n send_request(uri, :get, params)\n end",
"def get(api_route, url_params_hash={})\n @request_class = Net::HTTP::Get\n set_api_url(api_route, url_params_hash)\n send\n end",
"def _get\n http_method(:get)\n end",
"def get(path, params = {}, headers = {})\n request(:get, path, params, headers).body\n end",
"def txs_hash_get_with_http_info(hash, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.txs_hash_get ...'\n end\n # verify the required parameter 'hash' is set\n if @api_client.config.client_side_validation && hash.nil?\n fail ArgumentError, \"Missing the required parameter 'hash' when calling TransactionsApi.txs_hash_get\"\n end\n # resource path\n local_var_path = '/txs/{hash}'.sub('{' + 'hash' + '}', hash.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TxQuery')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#txs_hash_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get path, header={}, body_string_or_hash=\"\"\n env.http 'GET', path, header, body_string_or_hash\n end"
] | [
"0.7063598",
"0.69762707",
"0.6887614",
"0.68423516",
"0.66711134",
"0.66264284",
"0.6617485",
"0.6552251",
"0.64845777",
"0.6483327",
"0.6444215",
"0.64318323",
"0.64318323",
"0.6416487",
"0.63905346",
"0.6364933",
"0.63618934",
"0.6358219",
"0.62922496",
"0.6242217",
"0.6189914",
"0.61793643",
"0.6170884",
"0.6127323",
"0.6125921",
"0.60667235",
"0.6066304",
"0.6045785",
"0.60404104",
"0.603594",
"0.6028443",
"0.60248107",
"0.60248107",
"0.60248107",
"0.60248107",
"0.60248107",
"0.60248107",
"0.60248107",
"0.60248107",
"0.60248107",
"0.60248107",
"0.60217285",
"0.60053414",
"0.6003221",
"0.59951526",
"0.59489155",
"0.5934485",
"0.5926018",
"0.5926018",
"0.5923416",
"0.59110993",
"0.59089637",
"0.59089637",
"0.5904275",
"0.5891539",
"0.5878674",
"0.58588994",
"0.585196",
"0.585196",
"0.58367497",
"0.583311",
"0.58258003",
"0.581346",
"0.58044624",
"0.576307",
"0.57615054",
"0.57568353",
"0.575186",
"0.5747795",
"0.57383305",
"0.5731604",
"0.57296306",
"0.5726116",
"0.57244843",
"0.5711712",
"0.5705542",
"0.57036257",
"0.570074",
"0.5699972",
"0.5684061",
"0.56736976",
"0.5647364",
"0.56376505",
"0.56284285",
"0.562119",
"0.5610367",
"0.56092227",
"0.56058913",
"0.5598106",
"0.5570616",
"0.5567903",
"0.556495",
"0.556201",
"0.5551455",
"0.5533183",
"0.55284923",
"0.5514025",
"0.55119807",
"0.5502007",
"0.5497174"
] | 0.7988195 | 0 |
Generic TeleSign REST API PUT handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the PUT request with, as a hash. | def put(resource, **params)
execute(Net::HTTP::Put, 'PUT', resource, **params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(api_version, resource, payload, query_parameters = nil,\n headers = nil)\n make_rest_call(:put, uri_builder(api_version, resource,\n query_parameters), payload, headers)\n end",
"def put(resource, body = \"\", headers = {})\n prepare_request(:put, resource, body, headers)\n end",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def send_put(resource, data)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Put.new(url.to_s, initheader = {'Content-Type' => 'application/json'})\n req.body = data\n\n puts 'Sending PUT request to ' + url.to_s\n\n send_request(url, req)\n end",
"def put(resource_path, body:, headers: {}, prefix: API_PREFIX)\n request(method: :put, resource_path: resource_path, headers: headers, body: body, prefix: prefix)\n end",
"def update_resource(resource, params)\n check_id_uniformity(params)\n resource.assign_attributes(json_api_attributes(params))\n authorize resource, :update?\n resource.save!\n resource\n end",
"def put(resource_name, id, params, locale = nil)\n params_name = resource_name.to_s.split('/').last.singularize\n\n query = { query: { params_name => params } }\n\n query[:query][:locale] = locale if locale\n\n response = Locomotive::Mounter::EngineApi.put(\"/#{resource_name}/#{id}.json\", query)\n data = response.parsed_response\n\n if response.success?\n self.raw_data_to_object(data)\n else\n message = data\n\n message = data.map do |attribute, errors|\n \" #{attribute} => #{[*errors].join(', ')}\" #.colorize(color: :red)\n end.join(\"\\n\") if data.respond_to?(:keys)\n\n raise WriterException.new(message)\n\n # data.each do |attribute, errors|\n # self.log \"\\t\\t #{attribute} => #{[*errors].join(', ')}\".colorize(color: :red)\n # end if data.respond_to?(:keys)\n # nil\n end\n end",
"def on_put(resource_uri, opts)\n #resource = _get_resource(resource_uri, true, opts)\n \n #puts \"ON_PUT_OPTS: #{opts.inspect}\"\n body, format = parse_body(opts)\n case format\n # when :empty\n # # do nothing\n when :xml\n modifier_el = body.root\n resource = put_resource_xml(modifier_el, resource_uri, opts)\n else\n raise UnsupportedBodyFormatException.new(format)\n end\n show_resource(resource, opts)\n end",
"def update(params = {})\n raise \"Can't update a resource without a REST Client\" unless @client\n yield params if block_given?\n set_up_properties_from(@client.put(@path, params))\n self\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def put(path, params)\n parse_response @client[path].put(params)\n end",
"def put(path, params)\n request(:put, path, params)\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def put(path_part, payload, additional_headers = {}, &block)\n api_request { @rest.put('/REST/' + path_part, payload.to_json, additional_headers, &block) }\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update_resource(resource, params)\n # abort params.inspect\n resource.update_without_password(params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(*args)\n request :put, *args\n end",
"def update(resource, id, format=@default_format)\n options = { resource: resource.class, id: id, format: format }\n reply = put resource_url(options), resource, fhir_headers(options)\n reply.resource = parse_reply(resource.class, format, reply)\n reply.resource_class = resource.class\n reply\n end",
"def put(params)\n self.class.put(url, body: params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def update_resource(resource, params)\n resource.update_without_password(params)\n end",
"def put method, params={}\n Request.new(self, :put, method, params)\n end",
"def put(path: nil, payload:, headers: {}, query: {}, auth_method: nil)\n execute(\n method: :put,\n path: path,\n headers: headers,\n query: query,\n payload: payload,\n auth_method: auth_method\n )\n end",
"def base_update(resource, id, options, format = nil, headers = nil)\n headers ||= {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n headers[:content_type] = \"#{format}\"\n headers[:prefer] = @return_preference if @use_return_preference\n options = {} if options.nil?\n options[:resource] = resource.class\n options[:format] = format\n options[:id] = id\n reply = put resource_url(options), resource, fhir_headers(headers)\n reply.resource = parse_reply(resource.class, format, reply) if reply.body.present?\n reply.resource_class = resource.class\n reply\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end",
"def put(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('put')\n end\n end",
"def put(path, params = {}, env = {}, &block)\n env[:request_method] = \"PUT\"\n mock_request(path, params, env, &block)\n end",
"def put(path, data, params = {}, request_options = {})\n request(:put, path, data, params)\n end",
"def put(*args)\n request(:put, *args)\n end",
"def put(path, &block)\n route 'PUT', path, &block\n end",
"def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def poteti_put(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, 'PUT')\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def update_resource(resource, params)\n resource.update_with_password(params)\n end",
"def put endpoint, data\n do_request :put, endpoint, data\n end",
"def update\n begin\n @resource = Entity.find params[:id]\n @resource.update_attributes! params[:entity]\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def put(path, parameters = {})\n request(:put, path, parameters)\n end",
"def put(path, payload)\n req = Net::HTTP::Put.new(path)\n action(req, payload)\n end",
"def put(endpoint, params = {})\n\n path = build_connect_url(endpoint)\n headers = build_headers(endpoint, 'PUT', params)\n\n log \"PUT \" + path + \" \" + params.to_s\n log headers.to_s\n\n begin\n response = RestClient::Request.execute(method: :put, url: path, payload: params.to_json, headers: headers, timeout: 15)\n rescue RestClient::ExceptionWithResponse => e\n log e.http_code.to_s + \" \" + e.response.to_s\n return e.response\n end\n\n log response.code.to_s + \" \" + response.to_s\n\n response\n\n end",
"def fire_put(url_or_path, entity, options = {}, &block)\n url = absolute_url(url_or_path)\n headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON}.\n merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n body = encode_entity(entity)\n response = Typhoeus::Request.put(url, headers: headers, timeout: timeout, body: body)\n handle_response(response, method: :put, url: url, default_data: options[:default_data],\n raise_on_error: options[:raise_on_error], &block)\n end",
"def update(resource, id, format = nil)\n base_update(resource, id, nil, format)\n end",
"def put(path, request_options = {}, resource_options = {})\n response(:put, resource(resource_options)[path], request_options)\n end",
"def raw_put(path, body, options = {})\n # Allow format override\n format = options.delete(:format) || @format\n # Clear cache\n expire_matching \"#{parent_path(path)}.*\"\n # Create PUT request\n put = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", \n :verbose => DEBUG,\n :method => \"put\",\n :body => body,\n :headers => { :'Content-type' => options[:content_type] || content_type(format) }\n )\n # Send request\n do_request(put, format)\n end",
"def patch(resource, id, params)\n Api.new.patch(resource, id, params)\n end",
"def update_row_resource(resource, params)\n resource.attributes = params\n resource.save\n end",
"def put\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.put do |req|\n req.headers['Content-Type'] = \"application/json\"\n req.url resource_uri\n req.body = raw.to_json\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end",
"def put(uri, params = {})\n send_request(uri, :put, params)\n end",
"def put(path, headers: {}, query: {}, payload: {})\n (headers, query, payload) = preprocess(headers, query, payload)\n respond_with super(path, headers: headers, query: query, payload: payload)\n end",
"def put(action, params={}, options={})\n request(:put, action, params, options)\n end",
"def put(*args)\n request, adapter = request_and_adapter_from(args)\n\n with_adapter :put, request, adapter do |adapter|\n yield adapter.client if block_given?\n adapter.put request\n end\n end",
"def send_put_request endpoint, params={}, api_key=nil, ssl=false\n uri = URI.parse(endpoint)\n\n Net::HTTP.start(uri.host, uri.port) do |http|\n http.use_ssl = true if ssl\n request = Net::HTTP::Put.new(uri.request_uri)\n request['authorization'] = \"Token token=#{api_key}\" if api_key\n request.set_form_data(params)\n http.request request\n end\n end",
"def put(params)\n bucket = params[:bucket]\n object = params[:object]\n value = params[:value]\n content_type = params[:content_type]\n cb = params[:cb]\n date = generate_date\n sign_string = generate_signed_string('PUT', 'private', bucket, object, content_type)\n signature = generate_signature(sign_string)\n auth = generate_auth(signature)\n headers = generate_put_headers(date, auth, 'private', content_type, value.size)\n path = \"/\" << object\n\n @req_options = {:method => :put, :head => headers, :path => path, :body => value}\n @cb = cb if cb\n @bucket = bucket\n try_request\n self\n end",
"def update\n updated_resource = update_resource(resource, resource_params)\n if updated_resource.errors.blank?\n head :no_content\n else\n render json: serialize_invalid_attributes(updated_resource.errors),\n status: :unprocessable_entity\n end\n end",
"def update_consultation_using_put_with_http_info(consultation, consultation_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.update_consultation_using_put ...'\n end\n # verify the required parameter 'consultation' is set\n if @api_client.config.client_side_validation && consultation.nil?\n fail ArgumentError, \"Missing the required parameter 'consultation' when calling SupportApi.update_consultation_using_put\"\n end\n # verify the required parameter 'consultation_id' is set\n if @api_client.config.client_side_validation && consultation_id.nil?\n fail ArgumentError, \"Missing the required parameter 'consultation_id' when calling SupportApi.update_consultation_using_put\"\n end\n # resource path\n local_var_path = '/consultation/{consultation_id}'.sub('{' + 'consultation_id' + '}', consultation_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(consultation)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Consultation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#update_consultation_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def put(url, resource_name, options = {})\n build_response(resource_name) do\n connection.put do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def put(path, data=nil)\n request(:put, path, data)\n end",
"def update_resource_reservation_with_http_info(moid, resource_reservation, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourceApi.update_resource_reservation ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling ResourceApi.update_resource_reservation\"\n end\n # verify the required parameter 'resource_reservation' is set\n if @api_client.config.client_side_validation && resource_reservation.nil?\n fail ArgumentError, \"Missing the required parameter 'resource_reservation' when calling ResourceApi.update_resource_reservation\"\n end\n # resource path\n local_var_path = '/api/v1/resource/Reservations/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(resource_reservation)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceReservation'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourceApi.update_resource_reservation\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourceApi#update_resource_reservation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def puts_to(path,params,opts={},&block) #:nodoc: \n crud_to(:put,path,params,opts,&block)\n end",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def update(params = {})\n raise \"Can't update a resource without a REST Client\" unless @client\n set_up_properties_from(@client.post(@path, params))\n self\n end",
"def put!\n request! :put\n end",
"def put(path, params={}) # :nodoc:\n handle_response(@session.put(path, MultiJson.dump(params)))\n end",
"def put(path, body_params = {})\n debug_log \"PUT #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def put(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::PUT, path, to, as, constraints, &blk)\n end",
"def put(path, opts = {}, &block)\n request(:put, path, opts, &block)\n end",
"def put(path, opts = {}, &block)\n request(:put, path, opts, &block)\n end"
] | [
"0.70956933",
"0.70368356",
"0.6830302",
"0.6829505",
"0.6654068",
"0.65090257",
"0.6508298",
"0.63247776",
"0.62288934",
"0.6223546",
"0.62199175",
"0.6177819",
"0.6177819",
"0.61661243",
"0.6145439",
"0.61161745",
"0.6110584",
"0.60541165",
"0.60461867",
"0.60164374",
"0.5987497",
"0.59841585",
"0.5981237",
"0.59788",
"0.5978209",
"0.5978209",
"0.5978209",
"0.5978209",
"0.5978209",
"0.5978209",
"0.5978209",
"0.5978209",
"0.5977838",
"0.59566975",
"0.59485257",
"0.59485257",
"0.5940053",
"0.5940053",
"0.5940053",
"0.5937787",
"0.5937787",
"0.5937787",
"0.5937787",
"0.5937787",
"0.5937787",
"0.5937787",
"0.5937787",
"0.5934049",
"0.5928683",
"0.5920092",
"0.59138465",
"0.5910403",
"0.5901178",
"0.58748615",
"0.5833844",
"0.58287185",
"0.58081913",
"0.5802906",
"0.57933986",
"0.5787124",
"0.5743252",
"0.5743252",
"0.5743252",
"0.5743252",
"0.5743252",
"0.5743252",
"0.5743252",
"0.5718929",
"0.5692308",
"0.5684847",
"0.56744826",
"0.56677896",
"0.56589735",
"0.5653889",
"0.56489134",
"0.56365407",
"0.56281567",
"0.5624918",
"0.5598582",
"0.5597574",
"0.5567529",
"0.5559803",
"0.5559415",
"0.5553112",
"0.55526227",
"0.55423355",
"0.5528208",
"0.55163157",
"0.5505243",
"0.550446",
"0.55028903",
"0.5480618",
"0.5478248",
"0.54688585",
"0.5463209",
"0.5462891",
"0.5462589",
"0.54540247",
"0.545012",
"0.545012"
] | 0.80104744 | 0 |
Generic TeleSign REST API DELETE handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the DELETE request with, as a hash. | def delete(resource, **params)
execute(Net::HTTP::Delete, 'DELETE', resource, **params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(params = {})\n Client.current.delete(resource_url, params)\n end",
"def delete(api_version, resource, query_parameters = nil, headers = nil)\n make_rest_call(:delete, uri_builder(api_version, resource,\n query_parameters), headers)\n end",
"def delete(resource)\n headers = base_headers.merge('Content-Type' => 'application/json')\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"DELETE request Url: #{url}\")\n @logger.debug(\"-- Headers: #{headers}\")\n\n x = HTTParty.delete(url, headers: headers)\n puts x.inspect\n x\n end",
"def delete(resource)\n proxy(method: :delete, url: url_for(resource))\n end",
"def delete(resource_path, headers: {}, prefix: API_PREFIX)\n request(method: :delete, resource_path: resource_path, headers: headers, prefix: prefix)\n end",
"def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def delete_resource_with_http_info(resource_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcesApi.delete_resource ...'\n end\n # verify the required parameter 'resource_id' is set\n if @api_client.config.client_side_validation && resource_id.nil?\n fail ArgumentError, \"Missing the required parameter 'resource_id' when calling ResourcesApi.delete_resource\"\n end\n # resource path\n local_var_path = '/resource_set/{resource_id}'.sub('{' + 'resource_id' + '}', CGI.escape(resource_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['token_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcesApi#delete_resource\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\n end",
"def delete(resource_type,identifier)\n path = '/api/' + resource_type.to_s + '/' + slugify(identifier)\n http_delete(path)\n end",
"def delete(params, options={})\n request(\"#{base_uri(params)}/delete\", options.merge(method: :delete))\n .if_403_raise(Neutrino::Gateway::Exceptions::InvalidTenantOperation)\n .if_404_raise(Neutrino::Gateway::Exceptions::PatientNotFoundError)\n .with_general_exception_check('409', /has documents/, Neutrino::Gateway::Exceptions::PatientIdentityHasDocumentsError)\n .with_general_exception_check('409', /is not in Error/, Neutrino::Gateway::Exceptions::PatientIdentityNotInError)\n .to_hash['data_status']\n end",
"def delete(params = {})\n http_helper.send_delete_request(\"#{@url_prefix}/#{get_webhook_id!(params)}\", params)\n end",
"def hash_delete_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersManagementApi.hash_delete ...'\n end\n # resource path\n local_var_path = '/hash'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersManagementApi#hash_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('delete')\n end\n end",
"def delete_resource(resource_uri, opts)\n body, format = parse_body(opts)\n resource_type, resource_params = parse_uri(resource_uri, opts)\n authenticator = opts[:req].session[:authorizer]\n release_resource(body, resource_type, authenticator)\n end",
"def delete(resource,identifier)\n raise 'Not Yet Implemented'\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params = {}, request_options = {})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(endpoint, params = {})\n\n path = build_connect_url(endpoint)\n headers = build_headers(endpoint, 'DELETE', params)\n\n log \"DELETE \" + path + \" \" + params.to_s\n log headers.to_s\n\n begin\n response = RestClient::Request.execute(method: :delete, url: path, payload: params.to_json, headers: headers, timeout: 15)\n rescue RestClient::ExceptionWithResponse => e\n log e.http_code.to_s + \" \" + e.response.to_s\n return e.response\n end\n\n log response.code.to_s + \" \" + response.to_s\n\n response\n\n end",
"def delete(api, params)\n url2json(:DELETE, \"#{@endpoint}#{api}\", params)\n end",
"def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def delete(resource)\n finder_or_run(:delete, resource)\n end",
"def delete(params = {})\n case @api.version\n when 'v1'\n response = self.class.post(@api.delete_config[:url],\n :query => { :auth_token => @token }.merge(params),\n :headers => @api.headers\n )\n when 'v2'\n response = self.class.delete(@api.delete_config[:url],\n :query => { :auth_token => @token },\n :headers => @api.headers\n )\n end\n\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n true\n end",
"def delete_webhook_with_http_info(resource_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WebhooksApi.delete_webhook ...'\n end\n # verify the required parameter 'resource_id' is set\n if @api_client.config.client_side_validation && resource_id.nil?\n fail ArgumentError, \"Missing the required parameter 'resource_id' when calling WebhooksApi.delete_webhook\"\n end\n # resource path\n local_var_path = '/webhooks/{resourceId}'.sub('{' + 'resourceId' + '}', resource_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Token']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WebhooksApi#delete_webhook\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end",
"def delete(resource)\n unless id = @mappings[:id][:get].call(resource)\n raise ArgumentError, \"Attempted to delete a record without an ID\"\n end\n\n raw.delete(id)\n end",
"def delete(uri, params = {})\n send_request(uri, :delete, params)\n end",
"def delete(path, params = {}, env = {}, &block)\n env[:request_method] = \"DELETE\"\n mock_request(path, params, env, &block)\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def api_delete(action, data)\n api_request(action, data, 'DELETE')\n end",
"def delete(relative_path, request_headers, request_parameters, response_type, context)\n connection = @session.connection\n request_parameter_list = request_parameters &&\n request_parameters.to_request_parameters\n uri = to_absolute_uri(relative_path, request_parameter_list)\n request_headers = [] if request_headers.nil?\n add_generic_headers('DELETE', uri, request_headers, context)\n\n response_status_code, response_headers, response_body = nil\n connection.delete(uri, request_headers) do |status_code, headers, content|\n response_status_code = status_code\n response_headers = headers\n response_body = content.read.force_encoding('UTF-8')\n end\n process_response(response_body, response_status_code, response_headers, response_type, relative_path, context)\n end",
"def delete_route(resource_name)\n desc \"Deletes an existing #{resource_name}\"\n params do\n requires :query_parameter_id, type: String, desc: \"The id of the #{resource_name}\"\n end\n delete ':query_parameter_id' do\n delete_instance(find_instance(params[:query_parameter_id]))\n body false\n end\n end",
"def delete(path: nil, payload: nil, headers: {}, query: {}, auth_method: nil)\n execute(\n method: :delete,\n path: path,\n headers: headers,\n query: query,\n payload: payload,\n auth_method: auth_method\n )\n end",
"def fire_delete(url_or_path, options = {}, &block)\n params = options.fetch(:params, {})\n params.merge!(mapped_params(options))\n\n url = absolute_url(url_or_path, params: params)\n headers = {:Accept => MEDIA_TYPE_JSON}.merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n response = Typhoeus::Request.delete(url, headers: headers, timeout: timeout)\n handle_response(response, method: :delete, default_data: options[:default_data], url: url,\n raise_on_error: options[:raise_on_error], &block)\n end",
"def delete(path, params={}, args={})\n inject_token_auth_headers!(args)\n response = self.class.delete(request_url(path, params), args)\n update_token_auth_headers(response)\n return response\n end",
"def delete(url = nil, params = nil, headers = nil)\n run_request(:delete, url, nil, headers) { |request|\n # Original line from Faraday::Connection#delete method\n # request.params.update(params) if params\n\n # Monkey patch\n request.body = params if params\n\n yield(request) if block_given?\n }\n end",
"def delete(headers = {}, path = '', parameters = {})\n full_path = [path, URI.encode_www_form(parameters)].join(PARAM_STARTER)\n uri = URI.parse(\"#{@url}#{full_path}\")\n request = Net::HTTP::Delete.new(uri.request_uri)\n request.body = nil\n send_request(uri, request, headers)\n end",
"def delete(params: {}, headers: {})\n self.class.delete(id, params: params, headers: headers)\n true\n end",
"def on_delete(resource_uri, opts)\n debug \"on_delete: #{resource_uri}\"\n delete_resource(resource_uri, opts)\n show_resource(nil, opts) # epistrefei ena sketo \"OK\"\n end",
"def delete(path, params={}) # :nodoc:\n handle_response(@session.delete(path, MultiJson.dump(params)))\n end",
"def delete(parameters = {}, headers = {}, &block)\n build_delete(parameters, headers, &block).invoke\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete!\n @resource.delete!\n end",
"def delete(uri, parameters)\n response = Unirest.delete uri, parameters: parameters\n response.body\n end",
"def delete(path, payload = nil)\n req = Net::HTTP::Delete.new(path)\n action(req, payload)\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def webhook_delete_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: WebhookApi.webhook_delete ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling WebhookApi.webhook_delete\"\n end\n # resource path\n local_var_path = \"/webhook.delete.json\"\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key', 'store_key']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2004')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WebhookApi#webhook_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def del_entity_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.del_entity ...\"\n end\n # resource path\n local_var_path = \"/{uuid}\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#del_entity\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def template_delete_with_http_info(tmpl_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TemplatesApi.template_delete ...'\n end\n # verify the required parameter 'tmpl_id' is set\n if @api_client.config.client_side_validation && tmpl_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tmpl_id' when calling TemplatesApi.template_delete\"\n end\n pattern = Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n if @api_client.config.client_side_validation && tmpl_id !~ pattern\n fail ArgumentError, \"invalid value for 'tmpl_id' when calling TemplatesApi.template_delete, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/templates/{tmpl_id}'.sub('{' + 'tmpl_id' + '}', CGI.escape(tmpl_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'TemplateDeletion'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"TemplatesApi.template_delete\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TemplatesApi#template_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to @resource.host, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete(resource)\n resource.client = self\n resource.delete\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete(url, resource_name, options = {})\n build_response(resource_name) do\n connection.delete do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end",
"def delete(path_part, additional_headers = {}, &block)\n api_request { @rest.delete('/REST/' + path_part, \"\", additional_headers, &block) }\n end",
"def destroy\n destroy_resource(resource)\n head :no_content\n end",
"def webhooks_delete_with_http_info(owner, repo, identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: WebhooksApi.webhooks_delete ...\"\n end\n # verify the required parameter 'owner' is set\n if @api_client.config.client_side_validation && owner.nil?\n fail ArgumentError, \"Missing the required parameter 'owner' when calling WebhooksApi.webhooks_delete\"\n end\n # verify the required parameter 'repo' is set\n if @api_client.config.client_side_validation && repo.nil?\n fail ArgumentError, \"Missing the required parameter 'repo' when calling WebhooksApi.webhooks_delete\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling WebhooksApi.webhooks_delete\"\n end\n # resource path\n local_var_path = \"/webhooks/{owner}/{repo}/{identifier}/\".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s).sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apikey']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WebhooksApi#webhooks_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete_resource_reservation_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourceApi.delete_resource_reservation ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling ResourceApi.delete_resource_reservation\"\n end\n # resource path\n local_var_path = '/api/v1/resource/Reservations/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourceApi.delete_resource_reservation\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourceApi#delete_resource_reservation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def poteti_delete(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, 'DELETE')\n end",
"def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end",
"def delete_alert_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.delete_alert ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.delete_alert\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?\n query_params[:'user'] = opts[:'user'] if !opts[:'user'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#delete_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete(resource:)\n orm_object = resource_factory.from_resource(resource: resource)\n orm_object.delete\n resource\n end",
"def delete(action, params={}, options={})\n request(:delete, action, params, options)\n end",
"def delete(payload)\n post_like payload, Net::HTTP::Delete.new(@uri.path)\n end",
"def delete_consultation_using_delete_with_http_info(consultation_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.delete_consultation_using_delete ...'\n end\n # verify the required parameter 'consultation_id' is set\n if @api_client.config.client_side_validation && consultation_id.nil?\n fail ArgumentError, \"Missing the required parameter 'consultation_id' when calling SupportApi.delete_consultation_using_delete\"\n end\n # resource path\n local_var_path = '/consultation/{consultation_id}'.sub('{' + 'consultation_id' + '}', consultation_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#delete_consultation_using_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def api_v11_cm_service_delete_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_cm_service_delete ...\"\n end\n \n # resource path\n path = \"/api/v11/cm/service\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_cm_service_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete(user: nil, account_id: nil, service: nil, endpoint: nil, sort: nil, extra_path: nil, range: nil, ids: nil, query: {}, headers: {}, count: nil, entries: nil)\n get(user: user, account_id: account_id, service: service, endpoint: endpoint, sort: sort, extra_path: extra_path, range: range, ids: ids, query: query, headers: headers, count: count, entries: entries, method: :delete)\n end",
"def delete\n @resource.delete\n end",
"def delete(path, request_options = {}, resource_options = {})\n response(:delete, resource(resource_options)[path], request_options)\n end",
"def destroy(params = {})\n validate_id(params)\n submit(id_url(params.delete(:id)), :delete)\n end",
"def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end",
"def recording_delete_with_http_info(meeting_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.recording_delete ...'\n end\n # verify the required parameter 'meeting_id' is set\n if @api_client.config.client_side_validation && meeting_id.nil?\n fail ArgumentError, \"Missing the required parameter 'meeting_id' when calling CloudRecordingApi.recording_delete\"\n end\n if @api_client.config.client_side_validation && opts[:'action'] && !['trash', 'delete'].include?(opts[:'action'])\n fail ArgumentError, 'invalid value for \"action\", must be one of trash, delete'\n end\n # resource path\n local_var_path = '/meetings/{meetingId}/recordings'.sub('{' + 'meetingId' + '}', meeting_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'action'] = opts[:'action'] if !opts[:'action'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#recording_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def device_delete_with_http_info(device_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DevicesApi.device_delete ...'\n end\n # verify the required parameter 'device_id' is set\n if @api_client.config.client_side_validation && device_id.nil?\n fail ArgumentError, \"Missing the required parameter 'device_id' when calling DevicesApi.device_delete\"\n end\n # resource path\n local_var_path = '/h323/devices/{deviceId}'.sub('{' + 'deviceId' + '}', device_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesApi#device_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def delete_resource(resource_id, opts = {})\n delete_resource_with_http_info(resource_id, opts)\n nil\n end",
"def delete_with_binary_response(relative_path, request_headers, request_parameters, context)\n connection = @session.connection\n request_parameter_list = request_parameters &&\n request_parameters.to_request_parameters\n uri = to_absolute_uri(relative_path, request_parameter_list)\n request_headers = [] if request_headers.nil?\n add_generic_headers('DELETE', uri, request_headers, context)\n\n response_status_code, response_headers, response_body = nil\n connection.delete(uri, request_headers) do |status_code, headers, content|\n response_status_code = status_code\n response_headers = headers\n response_body = process_binary_response(status_code, content, headers, context) do |h, c|\n yield h, c\n end\n end\n throw_exception_if_necessary(response_body, response_status_code, response_headers, relative_path)\n end"
] | [
"0.7877372",
"0.7480377",
"0.72798955",
"0.7059302",
"0.68671685",
"0.6858565",
"0.67931414",
"0.6769459",
"0.668201",
"0.663129",
"0.66185176",
"0.6605539",
"0.6597864",
"0.6593301",
"0.6585191",
"0.65845305",
"0.65734565",
"0.65626556",
"0.65529925",
"0.65267724",
"0.65203655",
"0.6510989",
"0.6510989",
"0.6510989",
"0.6510989",
"0.6510989",
"0.6510989",
"0.6510989",
"0.6505781",
"0.6505781",
"0.6484622",
"0.6484622",
"0.6484622",
"0.64808416",
"0.64674234",
"0.64613396",
"0.64563936",
"0.6453332",
"0.6449032",
"0.6436889",
"0.641847",
"0.6356451",
"0.6321362",
"0.63149977",
"0.63017213",
"0.6282184",
"0.62798667",
"0.62766355",
"0.6274686",
"0.6270526",
"0.6263817",
"0.62622225",
"0.62533814",
"0.62444663",
"0.6234261",
"0.623083",
"0.6219616",
"0.6206399",
"0.62049675",
"0.618762",
"0.618762",
"0.6184761",
"0.61795413",
"0.61647576",
"0.61621326",
"0.61608464",
"0.6160457",
"0.61465555",
"0.61269635",
"0.6115687",
"0.61145586",
"0.6109949",
"0.61085224",
"0.61085224",
"0.61085224",
"0.61085224",
"0.6100619",
"0.60910463",
"0.6088089",
"0.6075644",
"0.60694784",
"0.6068812",
"0.6066692",
"0.60649145",
"0.6058179",
"0.6054513",
"0.60484254",
"0.60478497",
"0.60382295",
"0.6036982",
"0.60213834",
"0.6015178",
"0.60061634",
"0.6005099",
"0.6002997",
"0.5986957",
"0.59850246",
"0.5984213",
"0.59831876",
"0.5966267"
] | 0.8279141 | 0 |
Generic TeleSign REST API request handler. +method_function+ The net/http request to perform the request. +method_name+ The HTTP method name, as an upper case string. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the HTTP request with, as a hash. | def execute(method_function, method_name, resource, **params)
resource_uri = URI.parse("#{@rest_endpoint}#{resource}")
encoded_fields = ''
if %w[POST PUT].include? method_name
request = method_function.new(resource_uri.request_uri)
if content_type == "application/x-www-form-urlencoded"
unless params.empty?
encoded_fields = URI.encode_www_form(params, Encoding::UTF_8)
request.set_form_data(params)
end
else
encoded_fields = params.to_json
request.body = encoded_fields
request.set_content_type("application/json")
end
else
resource_uri.query = URI.encode_www_form(params, Encoding::UTF_8)
request = method_function.new(resource_uri.request_uri)
end
headers = RestClient.generate_telesign_headers(@customer_id,
@api_key,
method_name,
resource,
content_type,
encoded_fields,
user_agent: @@user_agent)
headers.each do |k, v|
request[k] = v
end
http_response = @http.request(resource_uri, request)
Response.new(http_response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_request(resource_name, method_name, params = {}, response_key = nil)\n end",
"def request(resource, method, params = nil) \n resource = Resources.get(resource, method, params)\n params = append_api_credentials(params)\n\n if method == :post\n payload = prepare_params(params)\n else\n payload = {}\n end\n\n headers = @options[:headers] || {}\n if method == :get \n resource.send(method, headers) do |response, request, result, &block| \n ZipMoney::Response.new(response)\n end\n else\n resource.send(method, payload, headers) do |response, request, result, &block|\n ZipMoney::Response.new(response)\n end\n end\n end",
"def make_request(method, resource, data = nil)\n\t\t\tresource = get_resource(resource, method, data)\n\n\t\t\tif [:post, :put, :patch].include?(method)\n\t\t\t\tdata[:test] = options[:test_mode] if options[:test_mode]\n\t\t\t\tpayload = data.to_json\n\t\t\telse\n\t\t\t\tpayload = {}\n\t\t\tend\n\n\t\t\theaders = options[:headers] || {}\n\n\t\t\tif method == :get\n\t\t\t\tresource.send(method, headers) do |response, request, result, &block|\n\t\t\t\t\thandle_response(response)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# Add in test flag is test mode...\n\t\t\t\tresource.send(method, payload, headers) do |response, request, result, &block|\n\t\t\t\t\thandle_response(response)\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def method_missing(method_name, *args)\n payload = Kauplus::Client.authenticate_payload(args.first)\n if method_name.match(/(get|post|multipart_post|put|delete|head)_(.*)/)\n Kauplus::Client.send($1, \"#{@resource}/#{$2}\", payload)\n else\n Kauplus::Client.get(\"#{@resource}/#{method_name}\", payload)\n end\n end",
"def handle_request(method, path, opts={})\n Amfetamine.logger.warn \"Making request to #{path} with #{method} and #{opts.inspect}\"\n case method\n when :get\n response = rest_client.get(path, opts)\n when :post\n response = rest_client.post(path, opts)\n when :put\n response = rest_client.put(path, opts)\n when :delete\n response = rest_client.delete(path, opts)\n else\n raise UnknownRESTMethod, \"handle_request only responds to get, put, post and delete\"\n end\n parse_response(response)\n end",
"def request(method, path, *arguments)\n method = method.to_s.upcase\n result = ActiveSupport::Notifications.instrument(\"request.active_resource\") do |payload|\n payload[:method] = method\n payload[:request_uri] = \"#{site.scheme}://#{site.host}:#{site.port}#{path}\"\n arguments.unshift(nil) if arguments.length == 1\n payload[:body] = arguments[0]\n payload[:result] = http.send_request(method, path, *arguments)\n end\n handle_response(result)\n rescue Timeout::Error => e\n raise TimeoutError.new(e.message)\n rescue OpenSSL::SSL::SSLError => e\n raise SSLError.new(e.message)\n end",
"def method_missing(method_id, *params)\n _request(method_id.to_s.sub('_api', ''), *params)\n end",
"def request(method, path, *arguments)\n result = ActiveSupport::Notifications.instrument(\"request.active_resource\") do |payload|\n payload[:method] = method\n payload[:request_uri] = \"#{site.scheme}://#{site.host}:#{site.port}#{path}\"\n payload[:request_arguments] = arguments\n payload[:result] = http.send(method, path, *arguments)\n end\n handle_response(result)\n rescue Timeout::Error => e\n raise TimeoutError.new(e.message)\n rescue OpenSSL::SSL::SSLError => e\n raise SSLError.new(e.message)\n end",
"def method_request( method, params )\n #merge auth params into our request querystring\n querystring = @auth.merge( params.is_a?(Hash) ? params : {} )\n resp = self.class.get(\"/#{@data_type}/#{method.to_s}\",{:query => querystring})\n if resp['error'] \n raise RuntimeError, resp['error']['error_message'], caller[1..-1]\n end\n return resp\n end",
"def request(method:, resource_path:, headers: {}, body: nil, prefix: API_PREFIX)\n body_json = body.is_a?(String) || body.nil? ? body : body.to_json\n url = ((api_url + prefix) + resource_path).to_s\n request_headers = default_headers.merge(headers)\n\n if verbose\n puts(\"Executing #{method} request to #{url}\")\n request_headers.each_pair do |k, v|\n puts(\"- Header: #{k}: #{v}\")\n end\n puts(\"- body: #{body_json.class}: #{body_json}\")\n end\n\n response = RestClient::Request.execute(\n method: method,\n url: url,\n headers: request_headers,\n payload: body_json\n )\n\n JSON.parse(response.body)\n end",
"def request(method, path, params)\n full_path = format_request_uri(path, params)\n request = VERB_MAP[method.to_sym].new(full_path)\n # TODO - Enable when supporting other HTTP Verbs\n # request.set_form_data(params) unless method == :get\n\n @logger.debug \"#{method.to_s.upcase} #{path}\"\n @http.request(request)\n end",
"def request(api_method, params = {}, request_method = :get)\n self.params = params.merge(method: api_method, format: 'json')\n self.request_method = request_method\n self.header = new_header\n self.typhoeus_request = new_typhoeus_request\n self.response = typhoeus_request.run\n self.body = Oj.load(response.body, OJ_OPTIONS)\n check_response!\n body\n end",
"def request(method, path, params = {})\n req = create_request path\n req.request method.upcase, params do |response|\n if (200..300).cover?(response.status)\n yield response.json if block_given?\n else\n warn response.json['error']\n end\n end\n end",
"def request(host, port, method, uri, params = {}, data = {}, headers = {}, auth = nil, timeout = nil) # rubocop:disable Metrics/MethodLength\n auth ||= @auth\n headers = generate_headers(method, headers)\n uri = build_uri(uri)\n\n if @logger\n @logger.debug('--BEGIN Twilio API Request--')\n @logger.debug(\"Request Method: <#{method}>\")\n\n headers.each do |key, value|\n @logger.debug(\"#{key}:#{value}\") unless key.downcase == 'authorization'\n end\n\n url = URI(uri)\n @logger.debug(\"Host:#{url.host}\")\n @logger.debug(\"Path:#{url.path}\")\n @logger.debug(\"Query:#{url.query}\")\n @logger.debug(\"Request Params:#{params}\")\n end\n\n response = @http_client.request(\n host,\n port,\n method,\n uri,\n params,\n data,\n headers,\n auth,\n timeout\n )\n\n if @logger\n @logger.debug(\"Response Status Code:#{response.status_code}\")\n @logger.debug(\"Response Headers:#{response.headers}\")\n @logger.debug('--END TWILIO API REQUEST--')\n end\n\n response\n end",
"def request(http_method, path, params = {})\n response = connection.send(http_method) do |request|\n case http_method\n when :get, :delete\n request.url(path, params)\n when :post, :put\n request.path = path\n request.body = params unless params.empty?\n end\n end\n\n response.body['response']\n end",
"def perform(arguments = {})\n case type.to_sym\n when :post, :get\n api.public_send(type, path, @arguments.merge(arguments))\n else\n raise ArgumentError, \"Unregistered request type #{request_type}\"\n end\n end",
"def request(http_method, url, params, schema = nil, required_root_key = nil)\n\n if params.is_a?(Hash)\n params = add_defaults!(params)\n end\n\n if schema\n validate_data_with_schema!(params, schema)\n end\n\n # perform request\n response = ::Hypercharge.config.faraday.send(http_method, url, params) do |req|\n\n if url.to_s[-4..-1] == 'json'\n req['Content-Type'] = 'application/json'\n req['Accept'] = 'application/json'\n else\n req['Content-Type'] = 'text/xml'\n req['Accept'] = 'text/xml'\n end\n end\n\n handle_response(response, required_root_key)\n rescue Faraday::Error::ClientError => e\n raise Errors.map_faraday_error(e), e\n end",
"def request(method, path, *arguments)\n puts \"REQUEST #{path} #{arguments.inspect}\"\n uri = URI.parse( path )\n request_http = http\n if uri.host\n path = uri.request_uri #includes params unlike path()\n request_http = Net::HTTP.new(uri.host, uri.port) #ignores @timeout and @proxy\n else\n uri = site\n end\n puts \"URI #{uri.inspect}\"\n result = ActiveSupport::Notifications.instrument(\"request.active_resource\") do |payload|\n payload[:method] = method\n payload[:request_uri] = \"#{uri.scheme}://#{uri.host}:#{uri.port}#{path}\"\n payload[:result] = request_http.send(method, path, *arguments)\n end\n handle_response(result)\n rescue Timeout::Error => e\n raise TimeoutError.new(e.message)\n rescue OpenSSL::SSL::SSLError => e\n raise SSLError.new(e.message)\n end",
"def request(method: :get, path:, params: {})\n authenticate\n\n uri = \"#{@base_uri}/#{path}\"\n headers = {\n \"Authorization\" => \"Token token=\\\"#{@token}\\\"\",\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\"\n }\n\n RestClient::Request.execute(\n method: method, url: uri, payload: params.to_json, headers: headers\n ) { |response| handle_response(response) }\n end",
"def make_request(method, path, params = {}, headers = {})\n if [:post, :put, :patch].include?(method) \n send(method) do |r|\n r.headers.merge!(headers)\n r.url path\n r.body = params.delete(:body).to_json\n end\n else\n send(method, path, params, headers)\n end\n end",
"def make_request(resource_name, method_name, params = {}, response_key = nil)\n raise(::Syncano::ConnectionError.new('Not connected to the Sync Server!')) unless connected?\n\n response_key ||= resource_name\n\n packet = ::Syncano::Packets::Call.new(resource_name: resource_name, method_name: method_name, data: params)\n\n connection.send_data(\"#{packet.to_json}\\n\")\n\n response_packet = nil\n timer = 600\n\n while timer > 0\n response_packet = connection.get_response(packet.message_id)\n if response_packet.nil?\n timer -= 1\n sleep 1.0 / 10.0\n else\n break\n end\n end\n\n raise(::Syncano::ApiError.new('Request timeout error!')) if timer == 0\n\n response = self.class.parse_response(response_key, response_packet.to_response)\n response.errors.present? ? raise(::Syncano::ApiError.new(response.errors)) : response\n end",
"def http verb, path, params={}\n\n to_header = params.delete(:to_header)\n case verb.to_s.downcase\n\n when 'get' # use URL-encoded params for GET requests only\n if to_header\n to_header['Accept'] = MIME_TYPE\n request_opts = {method: verb, headers: to_header, params: params}\n else\n request_opts = {method: verb, headers: {'Accept' => MIME_TYPE}, params: params}\n end\n else # for everything else encode as JSON in the body\n encoded_param = Yajl::Encoder.encode params\n if to_header\n to_header['Content-type'] = MIME_TYPE\n request_opts = {method: verb, headers: to_header, body: encoded_param }\n else\n request_opts = {method: verb, headers: { 'Content-type' => MIME_TYPE }, body: encoded_param }\n\n end\n end\n\n request = Typhoeus::Request.new @base_url+path, request_opts\n\n @hydra.queue request\n\n RequestPromise.new(request).then do |response|\n # we always expect JSON from successful responses\n response_meta(response).merge Yajl::Parser.parse(response.body, symbolize_keys: true)\n end\n end",
"def execute_http_request(http_method, path, payload = nil)\n response = RestClient::Request.execute(method: http_method, url: path, payload: payload, headers: DEFAULT_HEADERS)\n # handle response using helper\n handle_response(response)\n end",
"def route_request\n env.logger.debug \"#{self.class} ROUTING - #{env[Goliath::Request::PATH_INFO]}\"\n if has_path = ( env[Goliath::Request::PATH_INFO] =~ /^\\/(\\w+)(\\/\\w+)*/ )\n env.logger.debug \"#{self.class} route_request:\\t pathinfo = #{$1} extended = #{$2}\"\n path_info = $1\n extended_path_info = $2\n has_path = true #it will be a number or nil - let's just make it a bool\n elsif params[:id]\n has_path = true\n end\n \n method = env[Goliath::Request::REQUEST_METHOD]\n action = case method\n when 'GET'\n has_path ? 'show' : 'index'\n when 'POST'\n has_path ? ( raise BadRequestError, \"can't post to this resource\" ) : 'create'\n when 'PUT'\n !has_path ? ( raise BadRequestError, \"no resource to PUT to\" ) : 'update'\n when 'DELETE'\n !has_path ? ( raise BadRequestError, \"no resource to DELETE\" ) : 'delete'\n else\n raise MethodNotAllowedError, \"unknown request method\"\n end\n env.logger.info \"#{self.class} route_request:\\t attempting to call #{action} action\"\n if self.respond_to?(action, true) #second param includes private methods\n env['params']['id'] = params[:id] || (path_info if has_path)\n self.send(action)\n else\n error_on MethodNotAllowedError, \"#{action} not supported for this resource\"\n end\n end",
"def make_request url, parameters={}, method=:get, settings={}\n raise 'not implemented'\n end",
"def request(method, path, params, options)\n params = params.billyfy_keys!\n auth = {username: api_key, password: \"\"}\n case method.to_sym\n when :get\n response = HTTParty.get(endpoint + path, :query => params, :basic_auth => auth)\n when :post\n response = HTTParty.post(endpoint + path, :body => MultiJson.encode(params), :basic_auth => auth)\n when :delete\n response = HTTParty.delete(endpoint + path, :query => params, :basic_auth => auth)\n when :put\n response = HTTParty.put(endpoint + path, :body => MultiJson.encode(params), :basic_auth => auth)\n else\n end\n\n options[:raw] ? response : response.parsed_response.rubyify_keys!\n end",
"def request(method, path, params = {})\n self.class.debug_output($stderr) if @debug\n setup_http_body(method, params)\n \n uri = base_api_uri + path\n response = self.class.send(method.to_sym, uri, @default_params)\n parse(response)\n end",
"def create_request(method, uri, data = nil)\r\n method = method.upcase\r\n if(method == 'GET')\r\n return Net::HTTP::Get.new(uri)\r\n elsif(method == 'POST')\r\n request = Net::HTTP::Post.new(uri)\r\n request.body = data.to_json\r\n return request\r\n elsif(method == 'PUT')\r\n request = Net::HTTP::Put.new(uri)\r\n request.body = data.to_json\r\n return request\r\n elsif(method == 'DELETE')\r\n return Net::HTTP::Delete.new(uri)\r\n else\r\n raise CLXException, 'Unknown HTTP method'\r\n end\r\n end",
"def api_request method, params = nil\n\t\t\tconnection = ZenfolioAPI::HTTP.new()\n\t\t\t@response = connection.POST(method, params, @auth.token)\n\t\tend",
"def transactions_post_with_http_info(method, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_post ...'\n end\n # verify the required parameter 'method' is set\n if @api_client.config.client_side_validation && method.nil?\n fail ArgumentError, \"Missing the required parameter 'method' when calling DefaultApi.transactions_post\"\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'method'] = method\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'mobile'] = opts[:'mobile'] if !opts[:'mobile'].nil?\n query_params[:'holdername'] = opts[:'holdername'] if !opts[:'holdername'].nil?\n query_params[:'cardnumber'] = opts[:'cardnumber'] if !opts[:'cardnumber'].nil?\n query_params[:'cvv'] = opts[:'cvv'] if !opts[:'cvv'].nil?\n query_params[:'exp'] = opts[:'exp'] if !opts[:'exp'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'account'] = opts[:'account'] if !opts[:'account'].nil?\n query_params[:'reference'] = opts[:'reference'] if !opts[:'reference'].nil?\n query_params[:'genericmsg'] = opts[:'genericmsg'] if !opts[:'genericmsg'].nil?\n query_params[:'token'] = opts[:'token'] if !opts[:'token'].nil?\n query_params[:'bouquet'] = opts[:'bouquet'] if !opts[:'bouquet'].nil?\n query_params[:'payoption'] = opts[:'payoption'] if !opts[:'payoption'].nil?\n query_params[:'meternumber'] = opts[:'meternumber'] if !opts[:'meternumber'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apipassword', 'apiusername']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse200')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transactions_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def call_api_method(http_method, path, opts = {})\n connection = Faraday.new(:url => @config.base_path, ssl: { verify: @config.verify_ssl })\n case http_method\n when :GET\n response = connection.get do |req|\n build_request(req, http_method, path, opts)\n end\n when :POST\n response = connection.post do |req|\n build_request(req, http_method, path, opts)\n end\n when :PUT\n response = connection.put do |req|\n build_request(req, http_method, path, opts)\n end\n when :DELETE\n response = connection.delete do |req|\n build_request(req, http_method, path, opts)\n end\n end\n response\n end",
"def request(path, method=nil, vars={})\n if !path || path.length < 1\n raise ArgumentError, 'Invalid path parameter'\n end\n if method && !['GET', 'POST', 'DELETE', 'PUT'].include?(method)\n raise NotImplementedError, 'HTTP %s not implemented' % method\n end\n\n if path[0, 1] == '/'\n uri = TWILIO_API_URL + path\n else\n uri = TWILIO_API_URL + '/' + path\n end\n\n return _fetch(uri, vars, method)\n end",
"def method_missing(method_id, params = {})\n request(method_id.id2name.gsub(/_/, '.'), params)\n end",
"def request(\n method,\n path,\n headers = nil,\n body = nil,\n api_version = EasyPost::InternalUtilities::Constants::API_VERSION\n )\n # Remove leading slash from path.\n path = path[1..] if path[0] == '/'\n\n uri = URI.parse(\"#{@base_url}/#{api_version}/#{path}\")\n headers = @config[:headers].merge(headers || {})\n serialized_body = JSON.dump(EasyPost::InternalUtilities.objects_to_ids(body)) if body\n open_timeout = @config[:open_timeout]\n read_timeout = @config[:read_timeout]\n request_timestamp = Time.now\n request_uuid = SecureRandom.uuid\n\n if EasyPost::Hooks.any_subscribers?(:request)\n request_context = EasyPost::Hooks::RequestContext.new(\n method: method,\n path: uri.to_s,\n headers: headers,\n request_body: body,\n request_timestamp: request_timestamp,\n request_uuid: request_uuid,\n )\n EasyPost::Hooks.notify(:request, request_context)\n end\n\n # Execute the request, return the response.\n\n response = if @custom_client_exec\n @custom_client_exec.call(method, uri, headers, open_timeout, read_timeout, serialized_body)\n else\n default_request_execute(method, uri, headers, open_timeout, read_timeout, serialized_body)\n end\n response_timestamp = Time.now\n\n if EasyPost::Hooks.any_subscribers?(:response)\n response_context = {\n http_status: nil,\n method: method,\n path: uri.to_s,\n headers: nil,\n response_body: nil,\n request_timestamp: request_timestamp,\n response_timestamp: response_timestamp,\n client_response_object: response,\n request_uuid: request_uuid,\n }\n\n # If using a custom HTTP client, the user will have to infer these from the raw\n # client_response_object attribute\n if response.is_a?(Net::HTTPResponse)\n response_body = begin\n JSON.parse(response.body)\n rescue JSON::ParseError\n response.body\n end\n response_context.merge!(\n {\n http_status: response.code.to_i,\n headers: response.each_header.to_h,\n response_body: response_body,\n },\n )\n end\n\n EasyPost::Hooks.notify(:response, EasyPost::Hooks::ResponseContext.new(**response_context))\n end\n\n response\n end",
"def request(method, path, params)\n self.class.send(method, path, params)\n end",
"def call\n resource = base_resource\n\n response = (\n case request_method\n when :get\n resource.get fill do |req|\n (req.body = source) if source\n end\n when :head\n resource.head fill\n when :delete\n resource.delete(fill) do |req|\n req.body = source if source\n end\n when :post\n resource.post(fill, source)\n when :put\n resource.put(fill, source)\n end\n )\n \n response\n end",
"def request(*)\n raise 'HttpApiBuilder::BaseClient#request must be implemented, see documentation'\n end",
"def send_request(operation = 'GET', path = '', data = nil, headers = {}, search_path = {})\n request = nil\n encoded_search = ''\n\n vault_scheme = resource[:api_scheme]\n vault_server = resource[:api_server]\n vault_port = resource[:api_port]\n\n if URI.respond_to?(:encode_www_form)\n encoded_search = URI.encode_www_form(search_path)\n else\n # Ideally we would have use URI.encode_www_form but it isn't\n # available with Ruby 1.8.x that ships with CentOS 6.5.\n encoded_search = search_path.to_a.map do |x|\n x.map { |y| CGI.escape(y.to_s) }.join('=')\n end\n encoded_search = encoded_search.join('&')\n end\n uri = URI.parse '%s://%s:%d%s?%s' % [vault_scheme, vault_server, vault_port, path, encoded_search]\n\n case operation.upcase\n when 'POST'\n request = Net::HTTP::Post.new(uri.request_uri, headers)\n request.body = data.to_json\n when 'PUT'\n request = Net::HTTP::Put.new(uri.request_uri, headers)\n request.body = data.to_json\n when 'GET'\n request = Net::HTTP::Get.new(uri.request_uri, headers)\n when 'DELETE'\n request = Net::HTTP::Delete.new(uri.request_uri, headers)\n else\n raise Puppet::Error, 'Unsupported HTTP operation %s' % operation\n end\n\n request.content_type = 'application/json'\n\n resp = nil\n Net::HTTP.start(vault_server, vault_port,\n use_ssl: vault_scheme == 'https',\n verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|\n resp = http.request(request)\n end\n\n # check response for success, redirect or error\n case resp\n when Net::HTTPSuccess then\n return JSON.parse(resp.body) if resp.body\n resp\n when Net::HTTPRedirection then\n send_request(operation, resp['location'], data, headers)\n else\n message = 'code=' + resp.code\n message += ' message=' + resp.message\n message += ' body=' + resp.body\n raise resp.error_type.new(message, resp)\n end\n end",
"def request(method, path, **kwargs)\n verbs = %w(put get post delete options head move copy patch)\n method = method.to_s.downcase\n raise HTTPBadRequest(\"Unsupported HTTP method #{method}\") unless verbs.include?(method)\n resp = self.class.send(method.to_sym, path, **kwargs)\n if method == 'head'\n handle_response resp, head_instead: true\n else\n handle_response resp\n end\n end",
"def execute(http_method, path, params = nil, data = nil, headers = nil)\n # Prepare URL and params\n url = _make_url(path, params)\n if [:get, :delete].include? http_method\n unless data.nil?\n puts \"WARNING: #{http_method.to_s.upcase} method does not pass any data. Path '#{path}'\"\n data = nil\n end\n end\n\n # Setup the request\n rest_client_args = {}\n rest_client_args[:method] = http_method\n rest_client_args[:url] = url\n rest_client_args[:payload] = data\n rest_client_args[:user] = @user\n rest_client_args[:password] = @password\n rest_client_args[:headers] = _get_headers(headers)\n\n # Execute\n # TODO: add logger\n begin\n ::RestClient::Request.execute(rest_client_args)\n rescue => e\n raise @exc_class.new(e)\n end\n end",
"def request(method, parameters={})\n body = wrap_json(method, parameters)\n header = {'Content-Type' => \"text/json\"}\n \n # Clear retry cound here so it's fresh for each new request we make\n @retries = 0\n \n # Send the request\n send_request(body, header)\n\n end",
"def handle_request( * ) # :nodoc:\n\t\tself.log.debug \"[:restresources] handling request for REST resource.\"\n\t\tsuper\n\tend",
"def request(method, path, params)\n response = connection.send(method) do |request|\n case method\n when :get\n request.url(path, params)\n when :put\n params.merge!({\"_method\" => 'put'})\n request.url(path,params)\n when :post\n request.url(path)\n request.body = params\n when :delete\n params.merge!({\"_method\" => 'delete'})\n request.url(path, params)\n end\n end\n \n Response.create(response.body)\n end",
"def send_request(api_method, opts = {}, action = :get, endpoint = self.endpoint)\n\n opts.merge! method: api_method, api_key: key\n\n case action\n when :get\n url_string = endpoint + \"?\" + opts.collect{|k,v| \"#{k}=#{CGI.escape(v.to_s)}\"}.join('&')\n url = URI.parse(url_string)\n req = Net::HTTP::Get.new url.request_uri\n\n Net::HTTP.start(url.host, url.port, use_ssl: url.scheme == 'https') do |http|\n http.request req\n end\n when :post\n Net::HTTP.post_form URI.parse(endpoint), opts\n end\n end",
"def perform_request(method, path, params, body)\n CONNECTION.run_request \\\n method.downcase.to_sym,\n path,\n ( body ? MultiJson.dump(body): nil ),\n {'Content-Type' => 'application/json'}\n end",
"def http_request(action, data, method_type = 'POST', binary_key = nil)\n\n uri = \"#{@api_uri}/#{action}\"\n if method_type != \"POST\" && (!method_type.is_a? String)\n uri += \"?\" + data.map{ |key, value| \"#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}\" }.join(\"&\")\n end\n\n req = nil\n\n _uri = URI.parse(uri)\n\n headers = {\n \"Content-Type\": \"text/json\",\n \"Api-Key\":\"#{@api_key}\"\n }\n\n if method_type == 'POST'\n req = set_up_post_request(\n _uri, data, headers, binary_key\n )\n\n else\n request_uri = \"#{_uri.path}?#{_uri.query}\"\n if method_type == 'DELETE'\n req = Net::HTTP::Delete.new(request_uri, headers)\n else\n req = Net::HTTP::Get.new(request_uri, headers)\n end\n end\n\n begin\n http = Net::HTTP::Proxy(@proxy_host, @proxy_port).new(_uri.host, _uri.port)\n\n if _uri.scheme == 'https'\n http.ssl_version = :TLSv1\n http.use_ssl = true\n http.set_debug_output $stderr\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @verify_ssl != true # some openSSL client doesn't work without doing this\n http.ssl_timeout = @opts[:http_ssl_timeout] || 5\n end\n http.open_timeout = @opts[:http_open_timeout] || 5\n http.read_timeout = @opts[:http_read_timeout] || 10\n http.close_on_empty_response = @opts[:http_close_on_empty_response] || true\n\n\n response = http.start do\n http.request(req)\n end\n\n rescue Timeout::Error, Errno::ETIMEDOUT => e\n raise UnavailableError, \"Timed out: #{_uri}\"\n rescue => e\n raise ClientError, \"Unable to open stream to #{_uri}: #{e.message}\"\n end\n\n response.body || raise(ClientError, \"No response received from stream: #{_uri}\")\n end",
"def api_request(method, path, opts = {})\n request(method, path, opts)\n end",
"def request(function_name, *para)\n id_count = id\n para = {'method' => function_name, 'params' => para, 'id' => id_count}\n .to_json\n send_request(para)\n result = get_response\n if result.empty? or result == nil\n raise(RpcError.new(\"empty respons\"))\n end\n response = JSON.load(result)\n if response[\"error\"] != nil\n raise(RpcError.new(response[\"error\"]))\n elsif response[\"id\"] != id_count\n raise(RpcError.new(\"server send wrong data.\"))\n end\n response[\"result\"]\n end",
"def request(verb, resource, options = {})\n opts = {\n headers: version_header(options.delete(:type) || @api_type)\n }.merge(options)\n\n timeout(@processing_timeout) do\n @token.send(verb.to_sym, resource_to_location(resource).to_s , opts)\n end\n rescue OAuth2::Error => e\n raise Gini::Api::RequestError.new(\n \"API request failed: #{verb} #{resource} (code=#{e.response.status})\",\n e.response\n )\n rescue Timeout::Error => e\n raise Gini::Api::ProcessingError.new(\n \"API request timed out: #{verb} #{resource} (#{e.message})\"\n )\n end",
"def create_http_request(http_method,path,*arguments)\n http_method=http_method.to_sym\n if [:post,:put].include?(http_method)\n data=arguments.shift\n end\n headers=(arguments.first.is_a?(Hash) ? arguments.shift : {})\n case http_method\n when :post\n request=Net::HTTP::Post.new(path,headers)\n request[\"Content-Length\"]=0 # Default to 0\n when :put\n request=Net::HTTP::Put.new(path,headers)\n request[\"Content-Length\"]=0 # Default to 0\n when :get\n request=Net::HTTP::Get.new(path,headers)\n when :delete\n request=Net::HTTP::Delete.new(path,headers)\n when :head\n request=Net::HTTP::Head.new(path,headers)\n else\n raise ArgumentError, \"Don't know how to handle http_method: :#{http_method.to_s}\"\n end\n if data.is_a?(Hash)\n request.set_form_data(data)\n elsif data\n request.body=data.to_s\n request[\"Content-Length\"]=request.body.length\n end\n request\n end",
"def api_execute(path, method, options = {})\n params = options[:params]\n case method\n when :get\n req = build_http_request(Net::HTTP::Get, path, params)\n when :post\n req = build_http_request(Net::HTTP::Post, path, nil, params)\n when :put\n req = build_http_request(Net::HTTP::Put, path, nil, params)\n when :delete\n req = build_http_request(Net::HTTP::Delete, path, params)\n else\n fail \"Unknown http action: #{method}\"\n end\n timeout = options[:timeout] || @read_timeout\n http = Net::HTTP.new(host, port)\n http.read_timeout = timeout\n setup_https(http)\n req.basic_auth(user_name, password) if [user_name, password].all?\n Log.debug(\"Invoking: '#{req.class}' against '#{path}\")\n res = http.request(req)\n Log.debug(\"Response code: #{res.code}\")\n process_http_request(res, req, params)\n end",
"def initialize(user_context:, http_method:, route:, route_params: {}, query_params: {}, headers: {}, content_type: {}, payload: nil)\n @user_context = user_context\n @app_context = user_context.app_context\n @http_method = http_method.upcase\n @route = route\n @route_params = route_params\n @query_params = query_params\n @headers = headers\n @content_type = content_type\n @payload = payload\n\n raise \"HTTP Method #{@http_method} is unsupported\" unless %w(GET PUT POST DELETE).include? @http_method\n end",
"def call(method, params={})\n # Build path\n params[:apikey] = @api_key\n params = params.map { |p| p.join('=') }.join('&').gsub(/\\s/, '%20')\n path = [@uri.path, API_VERSION, method].compact.join('/') << '?' << params\n # Send request\n get = Net::HTTP::Get.new(path)\n response = @http.request(get)\n handleResult response.body\n end",
"def request(endpoint, method='get', file=nil, params={})\n scope 'default'\n method = method.downcase\n if file\n url = URI.parse(@api_url + endpoint)\n\n File.open(file) do |f|\n additional_params = params.merge({'file' => UploadIO.new(f, 'application/EDI-X12', file)})\n req = Net::HTTP::Post::Multipart.new(url.path, additional_params)\n\n req['Authorization'] = \"Bearer #{default_scope.token}\"\n req['User-Agent'] = user_agent\n\n @response = Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end\n JSON.parse(@response.body)\n end\n else\n # Work around to delete the leading slash on the request endpoint\n # Currently the module we're using appends a slash to the base url\n # so an additional url will break the request.\n # Refer to ...faraday/connection.rb L#404\n if endpoint[0] == '/'\n endpoint[0] = ''\n end\n self.send(method, endpoint, params)\n end\n end",
"def request(method, path, options, temp_api_endpoint=nil)\n if credentials?\n authentication = auth_query_hash\n connection.params.merge!(authentication)\n end\n\n connection.url_prefix = temp_api_endpoint || @endpoint\n response = connection.send(method) do |request|\n convert_hash_filter_params!(options)\n case method.to_sym\n when :get, :delete\n request.url(path, options)\n when :post, :put\n request.path = path\n request.body = options unless options.empty?\n end\n end\n\n response.body\n end",
"def request(http_method, path, body = '', headers = {})\n puts \"#{http_method}: #{path} - [#{body}]\" if @http_debug\n @request_client.request(http_method, path, body, headers)\n end",
"def call_api(method, resources)\n url_route = [@config.api_url, resources].flatten.join'/'\n result = HTTP.send(method, url_route)\n raise(result.to_s) if result.code >= 300\n result.to_s\n end",
"def request(method, *args)\n path, resource, options = extract_request_args!(*args)\n\n # Do we need the session endpoint?\n url = path =~ /^\\/?sessions/ ? session_endpoint : endpoint\n\n response = connection(url, resource).send(method) do |request|\n case method\n when :get, :delete\n request.url(path, options)\n when :post, :put\n request.path = path\n request.body = options unless options.empty?\n end\n end\n response.body\n end",
"def request(verb, url, payload=nil, headers={})\n url = api_base_url + \"/\" + url\n\n headers = {\n :user_agent => USER_AGENT,\n :accept => :json,\n :accept_encoding => enable_gzip ? :gzip : nil\n }.merge(headers)\n\n opts = {\n :method => verb.to_s,\n :url => url,\n :user => api_key,\n :password => \"\",\n :headers => headers,\n :payload => payload,\n :verify_ssl => ssl_verify,\n }\n begin\n response = RestClient::Request.execute(opts)\n rescue RestClient::Exception => e\n begin\n r = MultiJson.decode(e.response)\n msg = r['message']\n code = r['code']\n rescue\n raise e\n end\n raise VeritableError.new(\"HTTP Error #{e.message} -- #{code}: #{msg}\", {'http_code' => e.message, 'api_code' => code, 'api_message' => msg})\n end\n return MultiJson.decode(response)\n end",
"def http_methods(path, http_verb, data = '', content_type = 'application/json')\n uri = URI(path.to_s)\n headers = {\n 'Content-Type' => 'application/json'\n }\n case http_verb\n when :get\n http_method = Net::HTTP::Get.new(uri, headers)\n http = Net::HTTP.new(uri.host, uri.port)\n return http.request(http_method)\n # return Net::HTTP.get(uri)\n when :put\n http_method = Net::HTTP::Put.new(uri, headers)\n when :post\n http_method = Net::HTTP::Post.new(uri, headers)\n when :delete\n http_method = Net::HTTP::Delete.new(uri, headers)\n else\n # Throw / log exception\n end\n # Request with body for Post/Put verbs and return response\n http_method.body = data.to_json unless data.nil?\n http = Net::HTTP.new(uri.host, uri.port)\n http.request(http_method)\n end",
"def json_api_request(request_method, action, parameters = {}, session = nil, flash = nil)\n @request.headers['ACCEPT'] = 'application/vnd.api+json'\n @request.headers['CONTENT_TYPE'] = 'application/vnd.api+json'\n extra_headers = parameters[:headers] || {}\n extra_headers.each do |key, value|\n @request.headers[key] = value\n end\n parameters.delete :headers\n parameters[:format] = :json_api unless parameters&.key? :format\n __send__(request_method, action, params: parameters, session: session, flash: flash)\nend",
"def post(resource, **params)\n\n execute(Net::HTTP::Post, 'POST', resource, **params)\n\n end",
"def request(method, url, payload, format)\n opts = {\n :method => method,\n :url => url,\n :payload => payload,\n :headers => {:content_type => CONTENT_TYPES[format]},\n :timeout => TIMEOUT,\n :open_timeout => OPEN_TIMEOUT\n }\n \n RestClient::Request.execute(opts)\n end",
"def request(method, path, params = nil)\n uri = URI.parse(url_for(path))\n\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = uri.kind_of?(URI::HTTPS)\n client.verify_mode = OpenSSL::SSL::VERIFY_PEER\n client.ca_file = CA_FILE\n\n request = net_class(method).new(uri.request_uri)\n request.basic_auth Codeplane.username, Codeplane.api_key\n request[\"Content-Type\"] = \"application/x-www-form-urlencoded\"\n request[\"User-Agent\"] = \"Codeplane/#{Codeplane::Version::STRING}\"\n request.body = params.to_param if request.request_body_permitted? && params\n\n response = client.request(request)\n\n case response.code\n when \"401\"\n raise Codeplane::UnauthorizedError, \"Double check you username and API key\"\n when \"404\"\n raise Codeplane::NotFoundError\n else\n Codeplane::Response.new(response)\n end\n end",
"def perform_request(request_method, path, options = {})\n Teamsupport::REST::Request.new(self, request_method, path, options).perform\n end",
"def send_request method, params = nil\n if params.nil?\n raise ArgumentError, \"Invalid request params\"\n else\n required = { 'api_key' => @api_key }\n params = required.merge(params)\n params = URI.escape(params.collect{ |k,v| \"#{k}=#{v}\"}.join('&'))\n end\n url = @api_url + method + '/?' + params\n raise ArgumentError, \"Can't send request to the server\" if not url.is_a? String\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Get.new(uri.request_uri)\n res = http.request(req)\n data = res.body\n if not data.is_a? String or not data.is_json?\n raise RuntimeError, \"Server returned incorrect format data.\"\n end\n result = JSON.parse(data)\n end",
"def http_method(request)\n raise NotImplementedError\n end",
"def http_method(request)\n raise NotImplementedError\n end",
"def api_get(function, params = {})\n\t\turi = URI.parse(api_endpoint + function + '?' + params.to_query)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\trequest = Net::HTTP::Get.new(uri.request_uri)\n\t\trequest.basic_auth(api_username, api_password)\n\t\tresponse = http.request(request)\n\t\tJSON.parse response.body\n\tend",
"def call_api(handler_path, params)\n req_url = \"#{rest_client.url}#{handler_path}\"\n req_formdata = auth_request_formdata(handler_path, clean_params(params))\n\n if $DEBUG\n STDERR.puts \"call_api()\\n\" + JSON.pretty_generate(\n path: req_url,\n req: JSON.parse(req_formdata[:req]),\n signature: req_formdata[:signature],\n nonce: req_formdata[:nonce]\n )\n end\n\n response = rest_client[handler_path].post(req_formdata)\n JSON.parse(response, symbolize_names: true)\n rescue RestClient::Exception => err\n err.message += \"\\n Request Path: #{req_url}\" \\\n \"\\n Request Data: #{req_formdata}\"\n raise err\n end",
"def custom_request(data, uri, method, call_type, opts = {})\n if call_type == WRITE\n @transporter.write(method.to_sym, uri, data, opts)\n elsif call_type == READ\n @transporter.read(method.to_sym, uri, data, opts)\n end\n end",
"def request path, params={}, *extra\n opts = extra[-1].kind_of?(Hash) ? extra.pop : {}\n data = extra[0]\n # force a POST, use the query string as the POST body\n if opts[:method] == :post and data.to_s.empty?\n http_context = self.post(path, hash_to_query(params), {}, {'Content-Type' => 'application/x-www-form-urlencoded'})\n else\n if data\n # standard POST, using \"data\" as the POST body\n http_context = self.post(path, data, params, {\"Content-Type\" => 'text/xml; charset=utf-8'})\n else\n # standard GET\n http_context = self.get(path, params)\n end\n end\n raise RSolr::RequestError, \"Solr Response: #{http_context[:message]}\" unless http_context[:status_code] == 200\n http_context\n end",
"def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n req = HTTParty::Request.new http_method, path, req_options\n\n begin\n response = req.perform\n rescue => ex\n raise RequestError.new req, ex\n end\n \n if defined?(Rails.logger)\n Rails.logger.info req.to_curl\n else\n puts req.to_curl\n end\n \n if !response.parsed_response.is_a?(Hash)\n raise ResponseParseError.new req, response\n elsif response[\"errors\"]\n raise ResponseError.new req, response[\"errors\"], response\n elsif response[\"message\"] && response[\"message\"] == \"Invalid Token or Expired\"\n raise InvalidAuthToken.new\n else\n return CityGrid::API::Response.new response\n end\n \n rescue => ex\n raise ex if CityGrid.raise_errors?\n end",
"def raw_api(method,params=nil)\n debug(6,:var=>method,:msg=>\"method\")\n debug(6,:var=>params,:msg=>\"Parameters\")\n\n checkauth\n checkversion(1,1)\n params={} if params==nil\n obj=do_request(json_obj(method,params))\n return obj['result']\n end",
"def do_get(path, params={})\n login if need_login?\n\n # Resource id is a special param as it needs to be added to the path\n path = add_id_and_params_to_path(path, params)\n\n req, res, resource_type, body = nil\n\n begin\n retry_request(true) do\n # Return content type so the resulting resource object knows what kind of resource it is.\n resource_type, body = @rest_client[path].get(headers) do |response, request, result, &block|\n req, res = request, response\n update_cookies(response)\n update_last_request(request, response)\n\n case response.code\n when 200\n # Get the resource_type from the content_type, the resource_type\n # will be used later to add relevant methods to relevant resources\n type = if result.content_type.index('rightscale')\n get_resource_type(result.content_type)\n elsif result.content_type.index('text/plain')\n 'text'\n else\n ''\n end\n\n # work around getting ASCII-8BIT from some resources like audit entry detail\n charset = get_charset(response.headers)\n if charset && response.body.encoding != charset\n response.body.force_encoding(charset)\n end\n\n # raise an error if the API is misbehaving and returning an empty response when it shouldn't\n if type != 'text' && response.body.empty?\n raise EmptyBodyError.new(request, response)\n end\n\n [type, response.body]\n when 301, 302\n update_api_url(response)\n response.follow_redirection(request, result, &block)\n when 404\n raise UnknownRouteError.new(request, response)\n else\n raise ApiError.new(request, response)\n end\n end\n end\n rescue => e\n raise wrap(e, :get, path, params, req, res)\n end\n\n data = if resource_type == 'text'\n { 'text' => body }\n else\n JSON.parse(body, :allow_nan => true)\n end\n\n [resource_type, path, data]\n end",
"def api_request(method, uri, token, payload, options={})\n params = options.fetch('params', {})\n headers = options.fetch('headers', {})\n req_headers = headers.merge({params: params}).merge({'X-Auth-Token': token})\n RestClient::Request.execute(method: method.to_sym,\n url: uri,\n headers: req_headers,\n timeout: @timeout,\n payload: payload)\n end",
"def request(method, path, params = {}, body = {}, headers = {})\n meta_headers = { authorization: decide_authorization(params), user_agent: request_user_agent }\n headers = if !headers.is_a?(Hash)\n meta_headers\n else\n headers.merge(meta_headers)\n end\n\n @transport.perform_request(method.to_s.upcase, path, params, body, headers)\n end",
"def request(method, path, options)\n if credentials?\n connection.params.merge! api_key: credentials[:api_key]\n end\n\n connection.url_prefix = endpoint\n response = connection.send(method) do |request|\n case method.to_sym\n when :get, :delete\n request.url path, options\n when :post, :put\n request.path = path\n request.body = options\n end\n end\n\n response.body\n # It seems like Faraday should have a way to handle this. Oh, well.\n rescue Faraday::ParsingError\n raise Error.new(\"Server Error\", \"Unable to parse JSON response\")\n end",
"def send_request(method: required('method'), path: nil, url: nil, body: nil,\n content_type: nil, encoding: nil, auth_type: :basic)\n req_type = case method\n when 'GET'\n :get\n when 'POST'\n :post\n when 'PUT'\n :put\n when 'DELETE'\n :delete\n else\n fail 'Method was not \"GET\" \"POST\" \"PUT\" or \"DELETE\"'\n end\n\n raise ArgumentError.new(\"path and url can't be both nil\") if path.nil? && url.nil?\n\n headers = {'User-Agent' => 'UARubyLib/' + Urbanairship::VERSION + ' ' + @key}\n headers['Accept'] = 'application/vnd.urbanairship+json; version=3'\n headers['Content-Type'] = content_type unless content_type.nil?\n headers['Content-Encoding'] = encoding unless encoding.nil?\n\n if @token != nil\n auth_type = :bearer\n end\n\n if auth_type == :bearer\n raise ArgumentError.new('token must be provided as argument if auth_type=bearer') if @token.nil?\n headers['X-UA-Appkey'] = @key\n headers['Authorization'] = \"Bearer #{@token}\"\n end\n\n url = \"https://#{@server}/api#{path}\" unless path.nil?\n\n debug = \"Making #{method} request to #{url}.\\n\"+ \"\\tHeaders:\\n\"\n debug += \"\\t\\tcontent-type: #{content_type}\\n\" unless content_type.nil?\n debug += \"\\t\\tcontent-encoding: gzip\\n\" unless encoding.nil?\n debug += \"\\t\\taccept: application/vnd.urbanairship+json; version=3\\n\"\n debug += \"\\tBody:\\n#{body}\" unless body.nil?\n\n logger.debug(debug)\n\n params = {\n method: method,\n url: url,\n headers: headers,\n payload: body,\n timeout: Urbanairship.configuration.timeout\n }\n\n if auth_type == :basic\n raise ArgumentError.new('secret must be provided as argument if auth_type=basic') if @secret.nil?\n params[:user] = @key\n params[:password] = @secret\n end\n\n response = RestClient::Request.execute(params)\n\n logger.debug(\"Received #{response.code} response. Headers:\\n\\t#{response.headers}\\nBody:\\n\\t#{response.body}\")\n Response.check_code(response.code, response)\n\n self.class.build_response(response)\n end",
"def perform_request(method, path, params={}, body=nil, headers=nil)\n client.perform_request method, path, params, body, headers\n end",
"def post(resource, params)\n Api.new.post(resource, params)\n end",
"def make_request(method, endpoint, payload={})\n params = [\"#{API_URL_BASE}/#{endpoint}\", payload, @request_header]\n begin\n JSON.parse RestClient.send(method.to_sym, *params.reject { |p| p.empty? })\n rescue RestClient::Exception => e\n return { \"error\" => e.message }\n end\n end",
"def execute(method, path, **options)\n uri = URI(\"#{@base_url}/#{path}\")\n\n case method.to_sym\n when :get\n req = Net::HTTP::Get.new(uri)\n when :post\n req = Net::HTTP::Post.new(uri)\n when :put\n req = Net::HTTP::Put.new(uri)\n when :delete\n req = Net::HTTP::Delete.new(uri)\n else\n raise ARestException, \"Unknown method: #{method}\"\n end\n\n req.form_data = options[:form_data] if options[:form_data]\n\n headers = options[:headers] || @headers \n headers.each { |k,v| req[k] = v } if headers\n\n auth_user = options[:auth_user] || @auth_user\n auth_password = options[:auth_password] || @auth_password\n req.basic_auth auth_user, auth_password if auth_user && auth_password\n\n token = options[:token] || @auth_token\n if token\n req[\"Authorization\"] = \"Token token=#{token}\"\n end\n\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|\n http.request(req)\n end\n res\n end",
"def request(method, path, params)\n params ||= {}\n uri = full_url(path)\n\n Trubl.logger.info(\"Trubl::Client #{method}-ing #{uri} with params #{params.merge(headers: headers)}\")\n response = HTTMultiParty.send(method, uri, params.merge(headers: headers))\n\n if !response.code =~ /20[0-9]/\n Trubl.logger.fatal(\"Trubl::Client #{response.code} #{method}-ing #{uri.to_s} #{response.parsed_response}\")\n else\n Trubl.logger.debug(\"Trubl::Client #{uri} response: #{response.body}\")\n end\n response.body.force_encoding(\"utf-8\") if response.body and response.body.respond_to?(:force_encoding)\n response\n end",
"def endpoint_call(method, path, params)\n case method\n when :GET\n get(path, native_call: true).body\n when :POST\n post(path, native_call: true, body: params).body\n when :DELETE\n delete(path, native_call: true).body\n when :PUT\n put(path, native_call: true, body: params).body\n when :PATCH\n patch(path, native_call: true, body: params).body\n else\n raise AdapterRequestError, 'Unsupported adapter call method. Allowed are: GET, POST, PATCH, PUT, DELETE'\n end\n end",
"def request(method, path, params, options)\n params2 = prepare_params(params)\n url = URI::HTTP.build({:host => API_ENDPOINT, :path => path,\n :query => URI.encode_www_form(params2)})\n\n case method\n when :get\n req = Net::HTTP::Get.new url.request_uri\n when :post\n case options[:type]\n when :form\n req = Net::HTTP::Post.new url.path\n req.form_data = params\n when :multipart\n req = Net::HTTP::Post::Multipart.new url.path, params\n else\n # TODO: Revise\n req = Net::HTTP::Post.new url.request_uri\n end\n end\n\n res = Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end\n\n parse_response(res.body)\n end",
"def request(method, params = nil, id = false)\n http_response = @http_client.post(request_message(method, params, id))\n MmJsonClient::JsonRpcHttp::Response.new(http_response.body)\n end",
"def call(api_method, params={}, &request)\n path = \"/api/#{api_version}/#{api_method}\"\n\n begin\n result = api_method =~ /^(set|create|delete)/ ? post(path, params) : get(path, params)\n response = JSON.parse(result.to_s, :symbolize_names => true)\n rescue JSON::ParserError => e\n raise Error, \"Unable to parse JSON response: #{json}\"\n end\n\n case response[:code]\n when 0 then response[:data]\n when (1..4) then raise Error, response[:message]\n else raise Error, \"An unknown error ocurrced while handling the API response: #{response.to_s}\"\n end\n end",
"def make_batch_request(batch_client, resource_name, method_name, params = {})\n end",
"def raw_request(method, path, headers = {}, data = false)\n url = create_url(path)\n method, url, headers, data = Chef::HTTP::Authenticator.new(options).handle_request(method, url, headers, data)\n method, url, headers, data = Chef::HTTP::RemoteRequestID.new(options).handle_request(method, url, headers, data)\n response, rest_request, return_value = send_http_request(method, url, headers, data)\n response.error! unless success_response?(response)\n return_value\n rescue Exception => exception\n log_failed_request(response, return_value) unless response.nil?\n raise\n end",
"def make_request(method, url, params = {})\n path = \"#{EbanqApi.base_url}/#{url}\"\n response = case method\n when :get then get(path, headers, params)\n when :post then post(path, headers, params)\n when :put then put(path, headers, params)\n when :delete then delete(path, headers)\n else raise 'Error'\n end\n process_raw_response(response)\n rescue RestClient::ResourceNotFound, SocketError, Errno::ECONNREFUSED => e\n raise e\n end",
"def wrapped_request(method, path, expected_responses, parameters = {})\n _wrapped_request(method, path, expected_responses, parameters)\n end",
"def request(rpc_method, attributes)\n self.class.request(rpc_method, attributes)\n end",
"def method_missing(name, path, options={})\n options[:body] ||= ''\n options[:headers] ||= {}\n options[:parameters] ||= {}\n\n # Add token id to path and set headers\n path = \"#{@path_prefix}#{path}?tokenId=#{@token_id}\"\n options[:parameters].each do |k, v|\n path += \"&#{k}=#{v}\"\n end\n\n options[:headers].merge!({'Content-Type' => 'application/json'})\n\n # Set up message\n message = \"#{name.to_s.upcase} to #{@host}:#{@port}#{path} with headers (#{options[:headers].to_json })\"\n if options[:body]\n body = options[:body].to_json\n message += \" and body (#{body})\"\n end\n\n # Send request and get response\n begin\n request = Net::HTTP.const_get(name.to_s.capitalize).new(path)\n options[:headers].each { |k,v| request.add_field(k, v) }\n response = @conn.request(request, body)\n rescue StandardError => e\n message += \" failed (#{e})\"\n raise HttpResponseError.new(message, 500)\n end\n\n # Check HTTP status code\n if response.code.to_i != 200\n message += \" returned non-200 status (#{response.code}): #{response.inspect}\"\n raise HttpResponseError.new(message, response.code.to_i)\n end\n\n # Try parsing JSON response\n begin\n response_data = JSON.parse(response.body)\n rescue StandardError => e\n response_data = response.body\n if response_data.start_with?('\"') && response_data.end_with?('\"')\n response_data = response_data[1...-1]\n end\n end\n\n message += \" returned: #{response_data}\"\n\n response_data\n end",
"def custom_request(verb, uri, params = {}, env = {}, &block)\n uri = parse_uri(uri, env)\n env = env_for(uri, env.merge(method: verb.to_s.upcase, params: params))\n process_request(uri, env, &block)\n end",
"def call_softlayer_api_with_params(method_name, parameters, args)\n additional_headers = {};\n\n # The client knows about authentication, so ask him for the auth headers\n authentication_headers = self.client.authentication_headers\n additional_headers.merge!(authentication_headers)\n\n if parameters && parameters.server_object_filter\n additional_headers.merge!(\"#{@service_name}ObjectFilter\" => parameters.server_object_filter)\n end\n\n # Object masks go into the headers too.\n if parameters && parameters.server_object_mask\n object_mask = parameters.server_object_mask\n additional_headers.merge!(\"SoftLayer_ObjectMask\" => { \"mask\" => object_mask }) unless object_mask.empty?\n end\n\n # Result limits go into the headers\n if (parameters && parameters.server_result_limit)\n additional_headers.merge!(\"resultLimit\" => { \"limit\" => parameters.server_result_limit, \"offset\" => (parameters.server_result_offset || 0) })\n end\n\n # Add an object id to the headers.\n if parameters && parameters.server_object_id\n additional_headers.merge!(\"#{@service_name}InitParameters\" => { \"id\" => parameters.server_object_id })\n end\n\n # This is a workaround for a potential problem that arises from mis-using the\n # API. If you call SoftLayer_Virtual_Guest and you call the getObject method\n # but pass a virtual guest as a parameter, what happens is the getObject method\n # is called through an HTTP POST verb and the API creates a new VirtualServer that\n # is a copy of the one you passed in.\n #\n # The counter-intuitive creation of a new Virtual Server is unexpected and, even worse,\n # is something you can be billed for. To prevent that, we ignore the request\n # body on a \"getObject\" call and print out a warning.\n if (method_name == :getObject) && (nil != args) && (!args.empty?) then\n $stderr.puts \"Warning - The getObject method takes no parameters. The parameters you have provided will be ignored.\"\n args = nil\n end\n\n # Collect all the different header pieces into a single hash that\n # will become the first argument to the call.\n call_headers = {\n \"headers\" => additional_headers\n }\n\n begin\n call_value = xmlrpc_client.call(method_name.to_s, call_headers, *args)\n rescue XMLRPC::FaultException => e\n puts \"A XMLRPC Fault was returned #{e}\" if $DEBUG\n raise\n end\n\n return call_value\n end",
"def call(_method, _path, params = {})\n puts \"Aici?\"\n begin\n #path = \"https://login-test03.cloud.xirrus.com/api/v2#{_path}\"\n\n path = \"#{@xms_url}/api/v2#{_path}\"\n puts \"PATH = #{path}\"\n if (_method == :get || _method == :get_string || _method == :get_csv || _method == :get_csv_all_radios || _method == :put_with_query_params || _method == :post_with_query_params)\n query = build_query(params)\n path += \"?#{query}\"\n # Escape if anu spaces in url\n path = URI.escape(path)\n end\n success = false\n case _method\n\n when :get\n puts \"#{token}\"\n response_json_string = RestClient.get( path, :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :json,\n\n :accept => :json\n ) # RestClient get\n\n when :post\n\n response_json_string = RestClient.post( path , params.to_json , :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :json,\n\n :accept => :json\n ) # RestClient Post\n when :post_file\n\n response_json_string = RestClient.post( path , params , :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :text,\n\n :accept => :json\n ) # RestClient Post file\n\n\n\n when :put\n puts params.to_json\n response_json_string = RestClient.put( path , params.to_json , :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :json,\n\n :accept => :json\n ) # RestClient Post\n\n when :delete\n response_json_string = RestClient.delete( path , :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :json,\n\n :accept => :json\n ) # RestClient Post\n when :delete_with_args\n response_json_string = RestClient.delete( path ,params, :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :json,\n\n :accept => :json\n ) # RestClient Post\n else nil\n\n end\n\n puts \" ---------- \"\n pp response_json_string\n puts \" ---------- \"\n response = API::ApiClient::Response.new(response_json_string, path)\n # update_history(response)\n if response.cookie\n @all_cookies = response.cookie\n puts \"new cookie...\"\n end\n @history << [path,response.body]\n\n response\n\n rescue => e\n puts \" ---------- \"\n puts e.message\n puts \" ---------- \"\n #puts \"rescuing ng api client call - #{e.message}\"\n\n #puts \"NG::ApiClient.call rescued - path: #{_path}\"\n #puts \"e.message: #{e.message}\"\n #response = XMS::NG::ApiClient::Response.new(e.message, path)\n e.message\n end\n\n end",
"def method_missing(method, *args, &block)\n if actions(current_api).include? method\n self.class.send(:define_method, method) do |params|\n perform_soap_call(method, params) || perform_rest_call(params)\n end\n send method, *args, &block\n else\n super\n end\n end",
"def request_for(method, options = {})\n request = {}\n if options[:params]\n case method\n when :post, :put\n request[:body] = options[:params]\n else\n request[:query] = options[:params]\n end\n end\n request\n end",
"def make_request(method, endpoint, payload={})\n params = [\"#{API_URL_BASE}/#{endpoint}\", payload, @request_header]\n begin\n JSON.parse RestClient.send(method.to_sym, *params.reject { |p| p.empty? })\n rescue RestClient::Unauthorized => e\n # an authorization error is indicative that the configuration won't work,\n # not that an individual request errored, so raise instead of recovering\n raise \n rescue RestClient::Exception => e\n # attempt to handle other RestClient exceptions gracefully\n # return the erorr message and keep moving\n return { \"error\" => e.message }\n end\n end"
] | [
"0.6881146",
"0.6747781",
"0.6244243",
"0.6165793",
"0.61495125",
"0.60945827",
"0.60688543",
"0.60095716",
"0.6008411",
"0.5952333",
"0.59438866",
"0.5936315",
"0.58843195",
"0.5881889",
"0.584854",
"0.58376443",
"0.5790852",
"0.57417744",
"0.57381666",
"0.57350147",
"0.572976",
"0.5724508",
"0.5696521",
"0.56879795",
"0.56498903",
"0.56446636",
"0.5637105",
"0.5621829",
"0.56143314",
"0.5612057",
"0.55979216",
"0.559294",
"0.5590806",
"0.5590523",
"0.55833274",
"0.55787337",
"0.5543548",
"0.55408394",
"0.5538276",
"0.55202866",
"0.5518818",
"0.55171365",
"0.5496133",
"0.5496034",
"0.54920495",
"0.54847693",
"0.5481181",
"0.54702604",
"0.5465414",
"0.5463917",
"0.54606235",
"0.54378194",
"0.5431527",
"0.5429123",
"0.54170233",
"0.5409089",
"0.54000074",
"0.5395183",
"0.53872657",
"0.5386061",
"0.5385674",
"0.5381412",
"0.537626",
"0.5374337",
"0.5370868",
"0.53702414",
"0.5368919",
"0.5368919",
"0.53688365",
"0.53682506",
"0.5355388",
"0.53546435",
"0.53539217",
"0.5338779",
"0.53299594",
"0.5329153",
"0.5325112",
"0.53248125",
"0.5324692",
"0.5322544",
"0.53223455",
"0.5318461",
"0.53083557",
"0.53060514",
"0.53028786",
"0.52990144",
"0.5297669",
"0.52946544",
"0.52940637",
"0.529317",
"0.5284776",
"0.5283637",
"0.52822447",
"0.52803427",
"0.527129",
"0.5265391",
"0.52611196",
"0.526105",
"0.52601135",
"0.52567047"
] | 0.7453009 | 0 |
GET /thresholds GET /thresholds.json | def index
@thresholds = Threshold.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @threshold }\n end\n end",
"def twitterapp_ratelimits\n\t\tTwitter.get('/1.1/application/rate_limit_status.json')[:body][:resources]\n\tend",
"def create\n @threshold = Threshold.new(threshold_params)\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to thresholds_path, notice: 'Threshold was successfully created.' }\n format.json { render :show, status: :created, location: @threshold }\n else\n format.html { render :new }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate_limit_status\n get('/account/rate_limit_status.json')\n end",
"def change_thresholds *thresholds\n unless thresholds.first.is_a? Hash\n return change_thresholds LEVELS[0, thresholds.size].zip(thresholds).to_h\n end\n thresholds.first.each do |k, new_threshold|\n next unless (badge = @badge[k])\n @badge.delete badge.threshold\n badge.threshold = new_threshold\n @badge[new_threshold] = badge\n end\n end",
"def get_threshold\n d = self.vspecs.select(:value).where(name: 'threshold').first\n return d != nil ? d.value : d\n end",
"def check_thresholds(data:)\n if data > @options[:critical].to_i\n @critical << @message\n elsif data > @options[:warning].to_i\n @warning << @message\n else\n @okays << @message\n end\n # make the final step\n build_final_output\n end",
"def create\n @threshold = Threshold.new(params[:threshold])\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to @threshold, notice: 'Threshold was successfully created.' }\n format.json { render json: @threshold, status: :created, location: @threshold }\n else\n format.html { render action: \"new\" }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def threshold\n @threshold ||= Reputation::Threshold.lookup(self.action, self.sender, :tier => self.tier)\n end",
"def update\n respond_to do |format|\n if @threshold.update(threshold_params)\n format.html { redirect_to thresholds_path, notice: 'Threshold was successfully updated.' }\n format.json { render :show, status: :ok, location: @threshold }\n else\n format.html { render :edit }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def levels\n @json[\"sleep\"].map {|sleep_json| sleep_json[\"levels\"][\"data\"]} # TODO what does it mean if there are more than one of these?\n end",
"def threshold_params\n params.require(:threshold).permit(:sensor_id, :comparing_string, :comparing_value, :status, :action)\n end",
"def new\n @threshold = Threshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @threshold }\n end\n end",
"def rate_limit_status(params)\n get \"account/rate_limit_status\", params\n end",
"def get_board_data_by_json(board, threshold)\n result = []\n @agent.get(API_URL, {'board' => board}) do |response|\n syslog.info(\"#{response.uri.to_s} (#{response.code})\")\n if response.code == '200'\n json = response.body\n json.slice!(0, 9)\n json.slice!(-2, 2)\n result = JSON.parse(json)\n end\n end\n result\n end",
"def index\n @health_levels = HealthLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @health_levels }\n end\n end",
"def get_temperature_callback_threshold\n send_request(FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 5, 'k s s')\n end",
"def priorities\n Sifter.\n get(\"/api/priorities\").\n parsed_response[\"priorities\"]\n end",
"def set_threshold\n @threshold = Threshold.find(params[:id])\n end",
"def levels\n response = JSON.parse(@client.get(\"/api/v1/levels\").body)\n return response[\"levels\"] || response\n end",
"def abs_thresholds(scale, max_value)\n at = []\n scale.each { |v|\n at.push(v * max_value)\n }\n return at\n end",
"def threshold\n @threshold || 95\n end",
"def rate_limit_status\n\t\tresponse = access_token.get('/account/rate_limit_status.json')\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tstatus=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless status.is_a? Hash\n\t\t\tstatus\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in rate_limit_status: #{err}\"\n\t\traise err\n\tend",
"def index\n @regions = Region.more_than(ENV[\"FEEDBACK_THRESHOLD\"].to_i)\n end",
"def update\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n if @threshold.update_attributes(params[:threshold])\n format.html { redirect_to @threshold, notice: 'Threshold was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_permission_levels\n pls = []\n PermissionLevel.order(\"value DESC\").each{|pl| \n if pl.value <= @user.permission_level.value\n pls << pl\n end\n }\n render :json => pls\n end",
"def get_notification_type(threshold,current_runtime)\n th_hash = set_notification_threshold(threshold)\n ap th_hash if @debug\n case current_runtime\n when th_hash[0][:min] .. th_hash[0][:max]\n return {type: \"Notification\",color: \"#00CC00\"}\n when th_hash[1][:min] .. th_hash[1][:max]\n return {type: \"Warning\",color: \"#FFFF00\"}\n when th_hash[2][:min] .. th_hash[2][:max]\n return {type: \"Danger\",color: \"#FF8000\"}\n when th_hash[3][:min] .. th_hash[3][:max]\n return {type: \"Houston, We've got a Problem!\",color: \"#FF0000\"}\n else\n return \"There is no Notification for this User and Task\"\n end\n end",
"def call_rest_getlbvstats\n print \"get lb vserver stats\\n\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Get.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n\n if response.code == \"200\"\n result = JSON.parse(response.body)\n File.open(\"lbvserver-stats.json\", \"w\") do |file|\n file.write(JSON.pretty_generate(result))\n end\n end\n }\n\n end",
"def index\n @severity_levels = SeverityLevel.order(:created_at).page params[:page]\n end",
"def levels\n grant_id = params[:id]\n grant = Grant.find(grant_id)\n if grant == nil\n render :json => {}\n return\n end\n\n levels_array = []\n grant.funding_levels_csv.split(',').each do |token|\n limits = token.split(\"-\")\n if limits.length == 1\n limit = Integer(limits[0])\n levels_array.append([limit, limit])\n elsif limits.length == 2\n lower = Integer(limits[0])\n upper = Integer(limits[1])\n levels_array.append([lower, upper])\n end\n end\n\n # XXX: We're not supposed to be doing display formatting in the controller\n # like this.\n render :json => {\n pretty: funding_levels_pretty(grant),\n levels: levels_array\n }\n end",
"def check_threshold\n rate = lines.length.to_f / expiry\n if rate > threshold\n alert_status\n elsif rate < threshold\n normal_status\n end\n end",
"def find_tier_threshold_points\n @tier_threshold_points_cache ||= if tp = self.tier.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s])\n tp\n elsif self.tier.parent && (ptp = self.tier.parent.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s]))\n ptp\n end\n end",
"def get_limits\n # code\n end",
"def statuses\n api.get('status')\n end",
"def intervals\n rest.get instrument_path('activeIntervals')\n end",
"def levels(badge_name)\n badges.where(:name => badge_name).collect(&:level)\n end",
"def unavailable_threshold\n if organization.has_monitor_params?\n organization.monitor_param.unavailable_threshold.minutes\n else\n 3.minutes\n end\n end",
"def subsample_thresholds_required\n SUBSAMPLE_THRESHOLDS.select {|sample| sample < self.points}\n end",
"def weak_thresholds(*pvalues)\n thresholds_by_pvalues(*pvalues).each do |pvalue,(thresholds, counts)|\n threshold = thresholds.begin.to_f\n real_pvalue = counts.begin.to_f / vocabulary_volume\n yield pvalue, threshold, real_pvalue\n end\n end",
"def index\n @deadlift_data_points = DeadliftDataPoint.where(\"user_id = '#{current_user.id}'\")\n @max_deadlift = (@deadlift_data_points.map {|point| point['weight']}).max || 0\n @last_max_deadlift = (@deadlift_data_points == []) ? 0 : @deadlift_data_points.last['weight']\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deadlift_data_points }\n end\n end",
"def index\n \n @user = current_user\n @threshold = Threshold.last\n if @user.type == 'Committee'\n @approved_ideas = Idea.find(:all, :conditions => { :committee_id => @user.id, :archive_status => false, :approved => true})\n\n @approved_thresholds = Array.new\n @approved_ideas.each do |idea|\n user = idea.user\n if !user.banned && user.active\n @v = VoteCount.find(:first, :conditions => { :idea_id => idea.id})\n @approved_threshold = ((@v.prev_day_votes * 100) / @threshold.threshold)\n @approved_thresholds << @approved_threshold\n end\n end\n end\n @own_ideas = Idea.find(:all, :conditions => { :user_id => @user.id, :archive_status => false, :approved => true})\n @own_thresholds = Array.new\n @own_ideas.each do |idea|\n @v = VoteCount.find(:first, :conditions => { :idea_id => idea.id})\n @own_threshold = ((@v.prev_day_votes * 100) / @threshold.threshold)\n @own_thresholds << @own_threshold\n end\n @approved_counter = 0\n @own_counter = 0\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def list_cpu_mem_thresholds_profiles_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.list_cpu_mem_thresholds_profiles_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.list_cpu_mem_thresholds_profiles_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.list_cpu_mem_thresholds_profiles_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/settings/firewall/cpu-mem-thresholds-profiles'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyFirewallCpuMemThresholdsProfileListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#list_cpu_mem_thresholds_profiles_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_throughput_in(snmp = nil)\n @throughput_in_rate ||= { }\n report = { }\n snmp = snmp_manager unless snmp\n\n get_names(snmp) if @names.empty?\n res = gather_snmp_metrics_by_name(\"Pools/Throughput/In\", @names, OID_LTM_POOL_STAT_SERVER_BYTES_IN, snmp)\n NewRelic::PlatformLogger.debug(\"Pools: Got #{res.size}/#{@names.size} Inbound Throughput metrics\")\n\n unless res.nil?\n res.each_key do |metric|\n @throughput_in_rate[metric] ||= NewRelic::Processor::EpochCounter.new\n report[metric] = @throughput_in_rate[metric].process(res[metric] * 8)\n end\n\n sorted_report = report.sort_by { |k,v| v }.reverse\n sorted_report.each_with_index do |row, index|\n @f5_agent.report_metric row[0], \"bits/sec\", row[1]\n break if index >= (MAX_RESULTS - 1)\n end\n end\n end",
"def gather_threshold_totals\n rules.each{|field_to_validate, field_options|\n field_threshold = return_threshold(field_to_validate, field_options)\n if field_threshold\n gather_field_threshold_totals(field_to_validate, field_options)\n else\n gather_specific_validation_totals(field_to_validate, field_options)\n end\n }\n end",
"def students_with_low_grades_json\n safe_params = params.permit(:educator_id, :time_now, :limit)\n educator = current_educator_or_doppleganger(safe_params[:educator_id])\n time_now = time_now_or_param(safe_params[:time_now])\n limit = safe_params[:limit].to_i\n time_threshold = time_now - 45.days\n grade_threshold = 69\n\n insight = InsightStudentsWithLowGrades.new(educator)\n students_with_low_grades_json = insight.students_with_low_grades_json(time_now, time_threshold, grade_threshold)\n render json: {\n limit: limit,\n total_count: students_with_low_grades_json.size,\n students_with_low_grades: students_with_low_grades_json.first(limit)\n }\n end",
"def patient_score\n @@thresholds.keys.inject(0) do |accu, attribute|\n accu + self.send(\"#{attribute}_score\")\n end\n end",
"def limits\n return @opts['api_limits']\n end",
"def show\r\n @patient = current_doctor.patients.find(params[:id])\r\n @temperature_thresholds = current_doctor.temperature_thresholds.by_patient(@patient)\r\n @glucose_thresholds = current_doctor.glucose_thresholds.by_patient(@patient)\r\n @bloodpressure_thresholds = current_doctor.bloodpressure_thresholds.by_patient(@patient)\r\n @cardiogram_thresholds = current_doctor.cardiogram_thresholds.by_patient(@patient)\r\n\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => @patient }\r\n end\r\n end",
"def badges(options={})\n get('/user_badge', options)\n end",
"def sorted_threshold_problems\n # if there are no threshold problems, return nil\n threshold_problems = self.threshold_problems.all\n if threshold_problems.empty?\n return nil\n end\n sorted_problems = {}\n problem_types = ProblemType.all.map{|type| type.name}\n puts problem_types\n problem_count = 0\n # for each type\n problem_types.each do |type|\n puts type\n # get all the problems of that type and put the problems into an array\n types_problems = []\n problems_for_type = self.threshold_problems.select{|problem| problem.problem_type.name == type}\n problems_for_type.each do |prob|\n types_problems << prob.problem\n end\n # then make a key in the problems hash that maps to the array or problems\n sorted_problems[type] = types_problems\n end \n return sorted_problems\n end",
"def stats_at_scale(scale)\n statistic_klasses.reject {|stat| stat.poll_rate != scale}\n end",
"def statuses\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Available\", \"2\" => \"On Hold\", \"3\" => \"Borrowed\", \"4\" => \"Unavailable\"}}, :status => 200\n\t\treturn\n\tend",
"def stats\n request :get, \"_stats\"\n end",
"def stats\n request :get, \"_stats\"\n end",
"def index\n @crate_priorities = CratePriority.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_priorities }\n end\n end",
"def health_checks\n SERVICES.each do |service_name, service_info|\n puts \"Health Checking this service URL: #{service_info[:health_check_url]}\"\n response = RestClient::Request.execute(\n method: :get,\n url: service_info[:health_check_url]\n )\n puts JSON.parse(response)\n end\n end",
"def stats\n _get(\"/system/stats\") { |json| json }\n end",
"def read_cpu_mem_thresholds_profile_0_with_http_info(profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.read_cpu_mem_thresholds_profile_0 ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.read_cpu_mem_thresholds_profile_0\"\n end\n # resource path\n local_var_path = '/infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyFirewallCpuMemThresholdsProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#read_cpu_mem_thresholds_profile_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def priorities\n render :json => {:data => Project::Priorities}\n end",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def health_check\n JSON.parse(@client.get('status').body)\n end",
"def destroy\n @threshold = Threshold.find(params[:id])\n @threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to thresholds_url }\n format.json { head :no_content }\n end\n end",
"def get_restriction_levels\n get_restrictions_data['levels']\n end",
"def get_monitor_names\n (JSON.parse(get(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/monitors/\"))['monitor'] || []).map {|m| m['name']}\n end",
"def alert_threshold=(value)\n @alert_threshold = value\n end",
"def low_severity_count\n host_stats[:low].to_i\n end",
"def raw_high_risks\n\t\t\t\t\twhere(:severity => 3)\n\t\t\t\tend",
"def monitor_health\n find_features\n @results = @features.inject({}) do |results, feature_name|\n results[ feature_name ] = monitor_health_of( feature_name )\n results\n end\n healthy? ? on_healthy : on_unhealthy\n render_health\n end",
"def restriction_params\n params.require(:restriction).permit(:threshold)\n end",
"def get_metrics(path, query={}, headers={})\n url = Client::make_url(URI_TEMPLATE, {:path=>path} )\n response = get( url, query, headers )\n if block_given?\n yield response\n end\n validate_response(url, query, response) \n return JSON.parse( response.content ) \n end",
"def read_cpu_mem_thresholds_profile_with_http_info(profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.read_cpu_mem_thresholds_profile ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.read_cpu_mem_thresholds_profile\"\n end\n # resource path\n local_var_path = '/global-infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyFirewallCpuMemThresholdsProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#read_cpu_mem_thresholds_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def gauges\n metrics(Gauge)\n end",
"def get_balancer_decisions(args)\n if args.key? 'LIMIT'\n limit = args['LIMIT']\n else\n limit = 250\n end\n log_type = 'BALANCER_DECISION'\n log_dest = org.apache.hadoop.hbase.client.ServerType::MASTER\n balancer_decisions_responses = @admin.getLogEntries(nil, log_type, log_dest, limit, nil)\n balancer_decisions_resp_arr = []\n balancer_decisions_responses.each { |balancer_dec_resp|\n balancer_decisions_resp_arr << balancer_dec_resp.toJsonPrettyPrint\n }\n balancer_decisions_resp_arr\n end",
"def statistics\n JSON.parse @gapi.statistics.to_json\n end",
"def index\n @preference_criteria = PreferenceCriterium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preference_criteria }\n end\n end",
"def stats\n Client.current.get(\"#{resource_url}/stats\")\n end",
"def last_request_at_threshold(value = nil)\n if value.nil?\n read_inheritable_attribute(:last_request_at_threshold) || last_request_at_threshold(0)\n else\n write_inheritable_attribute(:last_request_at_threshold, value)\n end\n end",
"def list_cpu_mem_thresholds_profiles_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.list_cpu_mem_thresholds_profiles ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.list_cpu_mem_thresholds_profiles, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.list_cpu_mem_thresholds_profiles, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/settings/firewall/cpu-mem-thresholds-profiles'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyFirewallCpuMemThresholdsProfileListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#list_cpu_mem_thresholds_profiles\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def fetch\n http_request(url) do |body|\n incidents = JSON.parse body\n\n counts = {}\n total = incidents[\"resourceSets\"].first[\"estimatedTotal\"]\n resources = incidents[\"resourceSets\"].first[\"resources\"]\n resources.each do |resource|\n severity = resource[\"severity\"]\n counts[severity] = (counts.fetch severity, 0) + 1\n end\n\n @data = {}\n counts.each do |severity, count|\n @data[severity_label(severity)] = count\n end\n end\n end",
"def fetch_statistics\n user = AdminUser.find(get_logged_in_user_id)\n if user.designation == \"supervisor\"\n new_complaints = ComplaintStatus.where(admin_user_id: user.id, status: \"pending\").count\n pending_complaints = 0\n completed_complaints = ComplaintStatus.where(admin_user_id: user.id, status: \"completed\").count\n elsif user.designation == \"ward officer\"\n ward = WardOffice.find(user.municipal_id)\n new_complaints = ComplaintStatus.where(admin_user_id: user.id).count\n pending_complaints = ComplaintStatus.where(district_office_id: ward.district_office_id, ward_office_id: user.municipal_id,\n category: user.designation, status: \"pending\").count\n completed_complaints = ComplaintStatus.where(district_office_id: ward.district_office_id, ward_office_id: user.municipal_id,\n category: user.designation, status: \"completed\").count\n elsif user.designation == \"district officer\"\n new_complaints = ComplaintStatus.where(admin_user_id: user.id, status: \"new\").count\n pending_complaints = ComplaintStatus.where(district_office_id: user.municipal_id, status: \"pending\").count\n completed_complaints = ComplaintStatus.where(district_office_id: user.municipal_id, status: \"completed\").count\n end\n render json: {new_complaint: new_complaints, pending_complaint: pending_complaints, completed_complaint: completed_complaints}\n end",
"def get_throughput_in(snmp = nil)\n @throughput_in_rate ||= { }\n report = { }\n snmp = @snmp_manager unless snmp\n\n get_names(snmp) if @names.empty?\n res = gather_snmp_metrics_by_name(\"Virtual Servers/Throughput/In\", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_BYTES_IN, snmp)\n NewRelic::PlatformLogger.debug(\"Virtual Servers: Got #{res.size}/#{@names.size} Inbound Throughput metrics\")\n\n unless res.nil?\n res.each_key do |metric|\n @throughput_in_rate[metric] ||= NewRelic::Processor::EpochCounter.new\n report[metric] = @throughput_in_rate[metric].process(res[metric] * 8)\n end\n\n sorted_report = report.sort_by { |k,v| v }.reverse\n sorted_report.each_with_index do |row, index|\n @f5_agent.report_metric row[0], \"bits/sec\", row[1]\n break if index >= (MAX_RESULTS - 1)\n end\n end\n end",
"def accumulated_bandwidth(options = {})\n path = OpenStack.get_metering_query(options, [:project_id, :resource_id, :start, :end], :limit, \"#{@connection.service_path}/meters/bandwidth/statistics\")\n response = @connection.csreq('GET', @connection.service_host, path, @connection.service_port, @connection.service_scheme)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n bandwidth_list = JSON.parse(response.body)\n OpenStack.symbolize_keys bandwidth_list\n end",
"def statuses\n request(:get, \"applicant_tracking/statuses\")\n end",
"def index\n status = get_health_status( )\n response = make_response( status )\n render json: response, :status => response.is_healthy? ? 200 : 500\n end",
"def index\n status = get_health_status( )\n response = make_response( status )\n render json: response, :status => response.is_healthy? ? 200 : 500\n end",
"def health\n render json: { status: 'OK' }\n end",
"def throttle_data_of_interest(env)\n env[rack_attack_key].select { |k, _v| throttle.include?(k) }\n end",
"def list_policy_firewall_cpu_mem_thresholds_profile_binding_maps_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.list_policy_firewall_cpu_mem_thresholds_profile_binding_maps_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.list_policy_firewall_cpu_mem_thresholds_profile_binding_maps_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.list_policy_firewall_cpu_mem_thresholds_profile_binding_maps_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/settings/firewall/cpu-mem-thresholds-profile-binding-maps'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyFirewallCPUMemThresholdsProfileBindingMapListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#list_policy_firewall_cpu_mem_thresholds_profile_binding_maps_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_Threshold(value)\n set_input(\"Threshold\", value)\n end",
"def get_metrics_list\n\t\turi = \"#{@base_url}/data\"\n\t\tresults = json_metrics_list uri\n\t\tlist = []\n\t\tresults[:hosts][0..@hosts_limit].each {|h|\n\t\t\thost_results = json_metrics_list \"#{uri}/#{h}/\"\n\t\t\tlist << host_results[:metrics].map{|r| \"#{h}/#{r}\"}\n\t\t}\n\t\treturn list.flatten\n\tend",
"def sample_list(meter, options = {})\n path = OpenStack.get_metering_query(options, [:project_id, :resource_id, :start, :end], :limit, \"#{@connection.service_path}/meters/#{meter}\")\n response = @connection.csreq('GET', @connection.service_host, path, @connection.service_port, @connection.service_scheme)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n bandwidth_list = JSON.parse(response.body)\n OpenStack.symbolize_keys bandwidth_list\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @health_level }\n end\n end",
"def alert_threshold\n return @alert_threshold\n end",
"def index\n @reqpriorities = Reqpriority.all\n end",
"def rocket_job_evaluate_throttles\n rocket_job_throttles.each do |throttle|\n # Throttle exceeded?\n next unless send(throttle.method_name)\n logger.debug { \"Throttle: #{throttle.method_name} has been exceeded. #{self.class.name}:#{id}\" }\n filter = throttle.filter\n return filter.is_a?(Proc) ? filter.call(self) : send(filter)\n end\n nil\n end",
"def dash_bw\n\n statCounters = {\n \"internalIP\" => BandwidthDatatable.new(view_context, \"Internalipstat\", \"destip\"),\n \"externalIP\" => BandwidthDatatable.new(view_context, \"Externalipstat\", \"destip\"),\n \"byodIP\" => BandwidthDatatable.new(view_context, \"Intincomingipstat\", \"destip\"),\n \"internalAPP\" => BandwidthResourceDatatable.new(view_context, \"Internalresourcestat\", \"appid\", \"appidinternal\", \"appname\"),\n \"externalAPP\" => BandwidthResourceDatatable.new(view_context, \"Externalresourcestat\", \"appid\", \"appidexternal\", \"appname\"),\n \"external_urlcat\" => BandwidthResourceDatatable.new(view_context, \"Urlcatstat\", \"id\", \"urlcatid\", \"name\"),\n \"external_hlurlcat\"=> BandwidthResourceDatatable.new(view_context, \"Hlurlcatstat\", \"id\", \"hlurlcatid\", \"name\")\n }\n\n set_IPstatTypes_constants\n set_timeLine_constants\n\n #Set some defaults, in order to avoid crashes\n params['reportType'] = \"internalIP\" if !params['reportType'].present?\n params['reportTime'] = \"today\" if !params['reportTime'].present?\n params['dataType'] = \"dst\" if !params['dataType'].present? # return the list of servers\n\n respond_to do |format|\n format.html\n format.json { render json: statCounters[params['reportType']]}\n end\n\n end",
"def health_status\n data.health_status\n end",
"def index\n @health_statuses = HealthStatus.all\n end",
"def syntetic_step_thresholds(values_range)\n return ->(idx) { values_range[idx] } if values_range.count == GRADES.count\n\n max, min = values_range.map(&:to_i)\n step = ((max - min) / GRADES.count.to_f).round(2)\n max.step(min, -step).to_a\n end",
"def get_throughput_out(snmp = nil)\n @throughput_out_rate ||= { }\n report = { }\n snmp = snmp_manager unless snmp\n\n get_names(snmp) if @names.empty?\n res = gather_snmp_metrics_by_name(\"Pools/Throughput/Out\", @names, OID_LTM_POOL_STAT_SERVER_BYTES_OUT, snmp)\n NewRelic::PlatformLogger.debug(\"Pools: Got #{res.size}/#{@names.size} Outbound Throughput metrics\")\n\n unless res.nil?\n res.each_key do |metric|\n @throughput_out_rate[metric] ||= NewRelic::Processor::EpochCounter.new\n report[metric] = @throughput_out_rate[metric].process(res[metric] * 8)\n end\n\n sorted_report = report.sort_by { |k,v| v }.reverse\n sorted_report.each_with_index do |row, index|\n @f5_agent.report_metric row[0], \"bits/sec\", row[1]\n break if index >= (MAX_RESULTS - 1)\n end\n end\n end"
] | [
"0.59992146",
"0.58752257",
"0.5848886",
"0.5711196",
"0.5689826",
"0.56108534",
"0.5553224",
"0.55522025",
"0.5538886",
"0.5511574",
"0.54407936",
"0.53804755",
"0.53055227",
"0.5290292",
"0.52837574",
"0.524133",
"0.5188683",
"0.51577353",
"0.51183265",
"0.51137453",
"0.507154",
"0.5070836",
"0.5063463",
"0.5059635",
"0.5055447",
"0.50540406",
"0.5039753",
"0.5026751",
"0.50058997",
"0.49945408",
"0.4931425",
"0.49252743",
"0.49190575",
"0.48975945",
"0.4892391",
"0.48824632",
"0.4880387",
"0.48398778",
"0.48131514",
"0.48128933",
"0.4807584",
"0.48068762",
"0.47887653",
"0.47843465",
"0.4780067",
"0.4777023",
"0.47699597",
"0.47687894",
"0.47647005",
"0.47639057",
"0.4745642",
"0.4743656",
"0.4741179",
"0.4741179",
"0.47348753",
"0.4733623",
"0.47237056",
"0.47161353",
"0.47133517",
"0.47037348",
"0.47022316",
"0.46827993",
"0.46782824",
"0.46722296",
"0.46674722",
"0.4663389",
"0.4661478",
"0.46612036",
"0.4654889",
"0.46539375",
"0.46504828",
"0.4644457",
"0.46418908",
"0.46247482",
"0.46205276",
"0.46200934",
"0.46182838",
"0.46113205",
"0.46103182",
"0.46090537",
"0.4598946",
"0.45959356",
"0.45945525",
"0.45921543",
"0.45921543",
"0.45877165",
"0.4579386",
"0.45755157",
"0.45661572",
"0.45640084",
"0.45597127",
"0.45583886",
"0.45556274",
"0.45445064",
"0.45438272",
"0.4537091",
"0.45363414",
"0.45319846",
"0.4527461",
"0.45263565"
] | 0.7063734 | 0 |
GET /thresholds/1 GET /thresholds/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @thresholds = Threshold.all\n end",
"def show\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @threshold }\n end\n end",
"def get_threshold\n d = self.vspecs.select(:value).where(name: 'threshold').first\n return d != nil ? d.value : d\n end",
"def create\n @threshold = Threshold.new(threshold_params)\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to thresholds_path, notice: 'Threshold was successfully created.' }\n format.json { render :show, status: :created, location: @threshold }\n else\n format.html { render :new }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate_limit_status\n get('/account/rate_limit_status.json')\n end",
"def new\n @threshold = Threshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @threshold }\n end\n end",
"def update\n respond_to do |format|\n if @threshold.update(threshold_params)\n format.html { redirect_to thresholds_path, notice: 'Threshold was successfully updated.' }\n format.json { render :show, status: :ok, location: @threshold }\n else\n format.html { render :edit }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @threshold = Threshold.new(params[:threshold])\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to @threshold, notice: 'Threshold was successfully created.' }\n format.json { render json: @threshold, status: :created, location: @threshold }\n else\n format.html { render action: \"new\" }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def threshold\n @threshold ||= Reputation::Threshold.lookup(self.action, self.sender, :tier => self.tier)\n end",
"def set_threshold\n @threshold = Threshold.find(params[:id])\n end",
"def twitterapp_ratelimits\n\t\tTwitter.get('/1.1/application/rate_limit_status.json')[:body][:resources]\n\tend",
"def change_thresholds *thresholds\n unless thresholds.first.is_a? Hash\n return change_thresholds LEVELS[0, thresholds.size].zip(thresholds).to_h\n end\n thresholds.first.each do |k, new_threshold|\n next unless (badge = @badge[k])\n @badge.delete badge.threshold\n badge.threshold = new_threshold\n @badge[new_threshold] = badge\n end\n end",
"def call_rest_getlbvstats\n print \"get lb vserver stats\\n\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Get.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n\n if response.code == \"200\"\n result = JSON.parse(response.body)\n File.open(\"lbvserver-stats.json\", \"w\") do |file|\n file.write(JSON.pretty_generate(result))\n end\n end\n }\n\n end",
"def update\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n if @threshold.update_attributes(params[:threshold])\n format.html { redirect_to @threshold, notice: 'Threshold was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate_limit_status(params)\n get \"account/rate_limit_status\", params\n end",
"def index\n @health_levels = HealthLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @health_levels }\n end\n end",
"def threshold_params\n params.require(:threshold).permit(:sensor_id, :comparing_string, :comparing_value, :status, :action)\n end",
"def levels\n @json[\"sleep\"].map {|sleep_json| sleep_json[\"levels\"][\"data\"]} # TODO what does it mean if there are more than one of these?\n end",
"def check_thresholds(data:)\n if data > @options[:critical].to_i\n @critical << @message\n elsif data > @options[:warning].to_i\n @warning << @message\n else\n @okays << @message\n end\n # make the final step\n build_final_output\n end",
"def rate_limit_status\n\t\tresponse = access_token.get('/account/rate_limit_status.json')\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tstatus=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless status.is_a? Hash\n\t\t\tstatus\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in rate_limit_status: #{err}\"\n\t\traise err\n\tend",
"def index\n @severity_levels = SeverityLevel.order(:created_at).page params[:page]\n end",
"def show\r\n @patient = current_doctor.patients.find(params[:id])\r\n @temperature_thresholds = current_doctor.temperature_thresholds.by_patient(@patient)\r\n @glucose_thresholds = current_doctor.glucose_thresholds.by_patient(@patient)\r\n @bloodpressure_thresholds = current_doctor.bloodpressure_thresholds.by_patient(@patient)\r\n @cardiogram_thresholds = current_doctor.cardiogram_thresholds.by_patient(@patient)\r\n\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => @patient }\r\n end\r\n end",
"def get_board_data_by_json(board, threshold)\n result = []\n @agent.get(API_URL, {'board' => board}) do |response|\n syslog.info(\"#{response.uri.to_s} (#{response.code})\")\n if response.code == '200'\n json = response.body\n json.slice!(0, 9)\n json.slice!(-2, 2)\n result = JSON.parse(json)\n end\n end\n result\n end",
"def destroy\n @threshold = Threshold.find(params[:id])\n @threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to thresholds_url }\n format.json { head :no_content }\n end\n end",
"def last_request_at_threshold(value = nil)\n if value.nil?\n read_inheritable_attribute(:last_request_at_threshold) || last_request_at_threshold(0)\n else\n write_inheritable_attribute(:last_request_at_threshold, value)\n end\n end",
"def get_temperature_callback_threshold\n send_request(FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 5, 'k s s')\n end",
"def priorities\n Sifter.\n get(\"/api/priorities\").\n parsed_response[\"priorities\"]\n end",
"def find_tier_threshold_points\n @tier_threshold_points_cache ||= if tp = self.tier.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s])\n tp\n elsif self.tier.parent && (ptp = self.tier.parent.reputation_thresholds.find(:first, \n :conditions => [\"reward_rates.action = ?\", self.action.to_s]))\n ptp\n end\n end",
"def read_cpu_mem_thresholds_profile_0_with_http_info(profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.read_cpu_mem_thresholds_profile_0 ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.read_cpu_mem_thresholds_profile_0\"\n end\n # resource path\n local_var_path = '/infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyFirewallCpuMemThresholdsProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#read_cpu_mem_thresholds_profile_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stats\n request :get, \"_stats\"\n end",
"def stats\n request :get, \"_stats\"\n end",
"def health_check\n JSON.parse(@client.get('status').body)\n end",
"def health\n render json: { status: 'OK' }\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @health_level }\n end\n end",
"def stats\n _get(\"/system/stats\") { |json| json }\n end",
"def get_throughput_in(snmp = nil)\n @throughput_in_rate ||= { }\n report = { }\n snmp = snmp_manager unless snmp\n\n get_names(snmp) if @names.empty?\n res = gather_snmp_metrics_by_name(\"Pools/Throughput/In\", @names, OID_LTM_POOL_STAT_SERVER_BYTES_IN, snmp)\n NewRelic::PlatformLogger.debug(\"Pools: Got #{res.size}/#{@names.size} Inbound Throughput metrics\")\n\n unless res.nil?\n res.each_key do |metric|\n @throughput_in_rate[metric] ||= NewRelic::Processor::EpochCounter.new\n report[metric] = @throughput_in_rate[metric].process(res[metric] * 8)\n end\n\n sorted_report = report.sort_by { |k,v| v }.reverse\n sorted_report.each_with_index do |row, index|\n @f5_agent.report_metric row[0], \"bits/sec\", row[1]\n break if index >= (MAX_RESULTS - 1)\n end\n end\n end",
"def fetch\n http_request(url) do |body|\n incidents = JSON.parse body\n\n counts = {}\n total = incidents[\"resourceSets\"].first[\"estimatedTotal\"]\n resources = incidents[\"resourceSets\"].first[\"resources\"]\n resources.each do |resource|\n severity = resource[\"severity\"]\n counts[severity] = (counts.fetch severity, 0) + 1\n end\n\n @data = {}\n counts.each do |severity, count|\n @data[severity_label(severity)] = count\n end\n end\n end",
"def get_metrics(path, query={}, headers={})\n url = Client::make_url(URI_TEMPLATE, {:path=>path} )\n response = get( url, query, headers )\n if block_given?\n yield response\n end\n validate_response(url, query, response) \n return JSON.parse( response.content ) \n end",
"def threshold\n @threshold || 95\n end",
"def index\n @regions = Region.more_than(ENV[\"FEEDBACK_THRESHOLD\"].to_i)\n end",
"def index\n status = get_health_status( )\n response = make_response( status )\n render json: response, :status => response.is_healthy? ? 200 : 500\n end",
"def index\n status = get_health_status( )\n response = make_response( status )\n render json: response, :status => response.is_healthy? ? 200 : 500\n end",
"def health_status\n data.health_status\n end",
"def get_notification_type(threshold,current_runtime)\n th_hash = set_notification_threshold(threshold)\n ap th_hash if @debug\n case current_runtime\n when th_hash[0][:min] .. th_hash[0][:max]\n return {type: \"Notification\",color: \"#00CC00\"}\n when th_hash[1][:min] .. th_hash[1][:max]\n return {type: \"Warning\",color: \"#FFFF00\"}\n when th_hash[2][:min] .. th_hash[2][:max]\n return {type: \"Danger\",color: \"#FF8000\"}\n when th_hash[3][:min] .. th_hash[3][:max]\n return {type: \"Houston, We've got a Problem!\",color: \"#FF0000\"}\n else\n return \"There is no Notification for this User and Task\"\n end\n end",
"def index\n @crate_priorities = CratePriority.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_priorities }\n end\n end",
"def stats\n Client.current.get(\"#{resource_url}/stats\")\n end",
"def get_limits\n # code\n end",
"def full_level_progression_response\n return api_response(\"level-progression\")\n end",
"def levels\n response = JSON.parse(@client.get(\"/api/v1/levels\").body)\n return response[\"levels\"] || response\n end",
"def index\n @deadlift_data_points = DeadliftDataPoint.where(\"user_id = '#{current_user.id}'\")\n @max_deadlift = (@deadlift_data_points.map {|point| point['weight']}).max || 0\n @last_max_deadlift = (@deadlift_data_points == []) ? 0 : @deadlift_data_points.last['weight']\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deadlift_data_points }\n end\n end",
"def statuses\n api.get('status')\n end",
"def status\n get_json('status.json')\n end",
"def read_cpu_mem_thresholds_profile_with_http_info(profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.read_cpu_mem_thresholds_profile ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.read_cpu_mem_thresholds_profile\"\n end\n # resource path\n local_var_path = '/global-infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyFirewallCpuMemThresholdsProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#read_cpu_mem_thresholds_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_light_status(id)\n # TODO(dmiller): should be possible to init this on start?\n user_id = ENV[\"PHILLIPS_HUE_USER_ID\"]\n bridge_ip = ENV[\"PHILLIPS_HUE_BRIDGE_IP\"]\n\n url = \"http://#{bridge_ip}/api/#{user_id}/lights/#{id}\"\n resp = HTTP.get(url)\n if !resp.status.success?\n puts \"Error getting light status\"\n puts resp\n return\n end\n\n resp.parse\nend",
"def patient_score\n @@thresholds.keys.inject(0) do |accu, attribute|\n accu + self.send(\"#{attribute}_score\")\n end\n end",
"def get_throughput_in(snmp = nil)\n @throughput_in_rate ||= { }\n report = { }\n snmp = @snmp_manager unless snmp\n\n get_names(snmp) if @names.empty?\n res = gather_snmp_metrics_by_name(\"Virtual Servers/Throughput/In\", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_BYTES_IN, snmp)\n NewRelic::PlatformLogger.debug(\"Virtual Servers: Got #{res.size}/#{@names.size} Inbound Throughput metrics\")\n\n unless res.nil?\n res.each_key do |metric|\n @throughput_in_rate[metric] ||= NewRelic::Processor::EpochCounter.new\n report[metric] = @throughput_in_rate[metric].process(res[metric] * 8)\n end\n\n sorted_report = report.sort_by { |k,v| v }.reverse\n sorted_report.each_with_index do |row, index|\n @f5_agent.report_metric row[0], \"bits/sec\", row[1]\n break if index >= (MAX_RESULTS - 1)\n end\n end\n end",
"def healthcheck\n url = \"#{self.url}/healthcheck\"\n status, _ = rest_get( url )\n return( status )\n end",
"def healthcheck\n url = \"#{self.url}/healthcheck\"\n status, _ = rest_get( url )\n return( status )\n end",
"def show\n @load_balancer_check = LoadBalancerCheck.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @load_balancer_check }\n end\n end",
"def index\n @health_statuses = HealthStatus.all\n end",
"def raw_high_risks\n\t\t\t\t\twhere(:severity => 3)\n\t\t\t\tend",
"def destroy\n @threshold.destroy\n respond_to do |format|\n format.html { redirect_to thresholds_url, notice: 'Threshold was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def metric\n\t\tc = current_user.company\n\t\tm = Metric.find(params[:metric]).class\n\t\td = m.get_datum(c)\n\t\tif d.nil?\n\t\t\trender :nothing => true, :status => 404\n\t\telse\n\t\t\trender :json => { :timestamp => d.created_at, :value => d.value }\n\t\tend\n\tend",
"def list_permission_levels\n pls = []\n PermissionLevel.order(\"value DESC\").each{|pl| \n if pl.value <= @user.permission_level.value\n pls << pl\n end\n }\n render :json => pls\n end",
"def statistics\n JSON.parse @gapi.statistics.to_json\n end",
"def dash_bw\n\n statCounters = {\n \"internalIP\" => BandwidthDatatable.new(view_context, \"Internalipstat\", \"destip\"),\n \"externalIP\" => BandwidthDatatable.new(view_context, \"Externalipstat\", \"destip\"),\n \"byodIP\" => BandwidthDatatable.new(view_context, \"Intincomingipstat\", \"destip\"),\n \"internalAPP\" => BandwidthResourceDatatable.new(view_context, \"Internalresourcestat\", \"appid\", \"appidinternal\", \"appname\"),\n \"externalAPP\" => BandwidthResourceDatatable.new(view_context, \"Externalresourcestat\", \"appid\", \"appidexternal\", \"appname\"),\n \"external_urlcat\" => BandwidthResourceDatatable.new(view_context, \"Urlcatstat\", \"id\", \"urlcatid\", \"name\"),\n \"external_hlurlcat\"=> BandwidthResourceDatatable.new(view_context, \"Hlurlcatstat\", \"id\", \"hlurlcatid\", \"name\")\n }\n\n set_IPstatTypes_constants\n set_timeLine_constants\n\n #Set some defaults, in order to avoid crashes\n params['reportType'] = \"internalIP\" if !params['reportType'].present?\n params['reportTime'] = \"today\" if !params['reportTime'].present?\n params['dataType'] = \"dst\" if !params['dataType'].present? # return the list of servers\n\n respond_to do |format|\n format.html\n format.json { render json: statCounters[params['reportType']]}\n end\n\n end",
"def calc_uptime(api_key)\n urlUptime = \"https://api.uptimerobot.com/getMonitors?apiKey=#{api_key}&format=json&noJsonCallback=1&responseTimes=1&logs=1&customUptimeRatio=1-7-30-365\"\n response = RestClient.get(urlUptime)\n if response.code == 200\n responseUptime = JSON.parse(response.body, :symbolize_names => true)\n uptime = responseUptime[:monitors][:monitor][0][:customuptimeratio]\n return uptime.split('-')\n else\n puts 'Error: ' + response.code + ' ' + response.body\n return ['?','?','?','?']\n end\n \nend",
"def index\n \n @user = current_user\n @threshold = Threshold.last\n if @user.type == 'Committee'\n @approved_ideas = Idea.find(:all, :conditions => { :committee_id => @user.id, :archive_status => false, :approved => true})\n\n @approved_thresholds = Array.new\n @approved_ideas.each do |idea|\n user = idea.user\n if !user.banned && user.active\n @v = VoteCount.find(:first, :conditions => { :idea_id => idea.id})\n @approved_threshold = ((@v.prev_day_votes * 100) / @threshold.threshold)\n @approved_thresholds << @approved_threshold\n end\n end\n end\n @own_ideas = Idea.find(:all, :conditions => { :user_id => @user.id, :archive_status => false, :approved => true})\n @own_thresholds = Array.new\n @own_ideas.each do |idea|\n @v = VoteCount.find(:first, :conditions => { :idea_id => idea.id})\n @own_threshold = ((@v.prev_day_votes * 100) / @threshold.threshold)\n @own_thresholds << @own_threshold\n end\n @approved_counter = 0\n @own_counter = 0\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def intervals\n rest.get instrument_path('activeIntervals')\n end",
"def index\n @request_statuses = RequestStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_statuses }\n end\n end",
"def statuses\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Available\", \"2\" => \"On Hold\", \"3\" => \"Borrowed\", \"4\" => \"Unavailable\"}}, :status => 200\n\t\treturn\n\tend",
"def get_tier0_bgp_neighbors_status_0_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbors_status_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbors_status_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbors_status_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbors_status_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbors_status_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/status'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyBgpNeighborsStatusListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbors_status_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end",
"def index\n @requests = Request.where(status: -1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def response_time_metrics\n result = {}\n @urls.each do |url|\n result[url[:name]] = get_metrics(url[:path])\n end\n print result\n end",
"def get_request_status\n $test_logger.log(\"Get request status in integer\")\n get_tag_value_int(\"//#{VALUE_TAG}/#{REQ_STAT_TAG}\")\n end",
"def get_tier0_bgp_neighbors_status_with_http_info(tier_0_id, locale_service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbors_status ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbors_status\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbors_status\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbors_status, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbors_status, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/status'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyBgpNeighborsStatusListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbors_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def health_checks\n SERVICES.each do |service_name, service_info|\n puts \"Health Checking this service URL: #{service_info[:health_check_url]}\"\n response = RestClient::Request.execute(\n method: :get,\n url: service_info[:health_check_url]\n )\n puts JSON.parse(response)\n end\n end",
"def render_health_json\n render :text => @results.values.to_json, :status => health_response_code\n end",
"def show\n @prd_threshold = PrdThreshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end",
"def get_uptime_check_config config_name\n require \"google/cloud/monitoring\"\n\n client = Google::Cloud::Monitoring.uptime_check_service\n config = client.get_uptime_check_config name: config_name\n pp config.to_h\n config\nend",
"def stats_at_scale(scale)\n statistic_klasses.reject {|stat| stat.poll_rate != scale}\n end",
"def check_threshold\n rate = lines.length.to_f / expiry\n if rate > threshold\n alert_status\n elsif rate < threshold\n normal_status\n end\n end",
"def get_throughput_out(snmp = nil)\n @throughput_out_rate ||= { }\n report = { }\n snmp = snmp_manager unless snmp\n\n get_names(snmp) if @names.empty?\n res = gather_snmp_metrics_by_name(\"Pools/Throughput/Out\", @names, OID_LTM_POOL_STAT_SERVER_BYTES_OUT, snmp)\n NewRelic::PlatformLogger.debug(\"Pools: Got #{res.size}/#{@names.size} Outbound Throughput metrics\")\n\n unless res.nil?\n res.each_key do |metric|\n @throughput_out_rate[metric] ||= NewRelic::Processor::EpochCounter.new\n report[metric] = @throughput_out_rate[metric].process(res[metric] * 8)\n end\n\n sorted_report = report.sort_by { |k,v| v }.reverse\n sorted_report.each_with_index do |row, index|\n @f5_agent.report_metric row[0], \"bits/sec\", row[1]\n break if index >= (MAX_RESULTS - 1)\n end\n end\n end",
"def index\n @reqpriorities = Reqpriority.all\n end",
"def set_stats\n {\n \"projectId\": '1234',\n \"invalid\": 2,\n \"error\": 1,\n \"info\": 0,\n \"warning\": 2\n }\nend",
"def monitor_health\n find_features\n @results = @features.inject({}) do |results, feature_name|\n results[ feature_name ] = monitor_health_of( feature_name )\n results\n end\n healthy? ? on_healthy : on_unhealthy\n render_health\n end",
"def show\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gauge }\n end\n end",
"def get_health_check(id)\n request({\n :expects => 200,\n :parser => Fog::Parsers::AWS::DNS::HealthCheck.new,\n :method => 'GET',\n :path => \"healthcheck/#{id}\"\n })\n end",
"def priorities\n render :json => {:data => Project::Priorities}\n end",
"def show\n render json: @heartbeat\n end",
"def gauges\n metrics(Gauge)\n end",
"def getdifficulty\n @api.request 'getdifficulty'\n end",
"def show\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loadbalancer }\n end\n end",
"def http_statistics\n super\n end",
"def low_severity_count\n host_stats[:low].to_i\n end",
"def alert_threshold=(value)\n @alert_threshold = value\n end",
"def throughput\n return {}\n end",
"def show(id:)\n id_check('id', id)\n\n cf_get(path: \"/zones/#{zone_id}/rate_limits/#{id}\")\n end",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def index\n @scans = policy_scope(Scan)\n render json: @scans\n end"
] | [
"0.69760793",
"0.6465288",
"0.60399467",
"0.59047806",
"0.57203627",
"0.5694649",
"0.56749475",
"0.5667187",
"0.55897677",
"0.55240417",
"0.55198246",
"0.5513609",
"0.540041",
"0.5383369",
"0.53610665",
"0.53088",
"0.5257977",
"0.5254192",
"0.50990325",
"0.50986415",
"0.5069461",
"0.50690067",
"0.5055098",
"0.50462323",
"0.50009227",
"0.4991753",
"0.49874768",
"0.4972483",
"0.49630746",
"0.49496785",
"0.49496785",
"0.4936021",
"0.49302045",
"0.4890654",
"0.4880382",
"0.48792475",
"0.4871925",
"0.48646724",
"0.48575625",
"0.48409247",
"0.4835396",
"0.4835396",
"0.483077",
"0.48292607",
"0.4824057",
"0.48222816",
"0.4804515",
"0.4803885",
"0.4800613",
"0.4794547",
"0.47865844",
"0.47579873",
"0.47557518",
"0.47506514",
"0.47472596",
"0.47464353",
"0.47188002",
"0.47188002",
"0.47176826",
"0.4708184",
"0.47063217",
"0.47044072",
"0.47034284",
"0.47014314",
"0.4690468",
"0.4685808",
"0.46770716",
"0.46719185",
"0.46705773",
"0.46585557",
"0.4652762",
"0.46447548",
"0.46442214",
"0.46434635",
"0.46371323",
"0.4628341",
"0.46236068",
"0.46232724",
"0.46159813",
"0.46159077",
"0.46140414",
"0.46131834",
"0.4610126",
"0.4609219",
"0.46069407",
"0.460264",
"0.4602368",
"0.46020263",
"0.4600181",
"0.45990962",
"0.45977312",
"0.4585733",
"0.45841724",
"0.45813715",
"0.4581065",
"0.4580981",
"0.4580463",
"0.45765135",
"0.45734936",
"0.45717388",
"0.45711136"
] | 0.0 | -1 |
POST /thresholds POST /thresholds.json | def create
@threshold = Threshold.new(threshold_params)
respond_to do |format|
if @threshold.save
format.html { redirect_to thresholds_path, notice: 'Threshold was successfully created.' }
format.json { render :show, status: :created, location: @threshold }
else
format.html { render :new }
format.json { render json: @threshold.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @threshold = Threshold.new(params[:threshold])\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to @threshold, notice: 'Threshold was successfully created.' }\n format.json { render json: @threshold, status: :created, location: @threshold }\n else\n format.html { render action: \"new\" }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def threshold_params\n params.require(:threshold).permit(:sensor_id, :comparing_string, :comparing_value, :status, :action)\n end",
"def index\n @thresholds = Threshold.all\n end",
"def change_thresholds *thresholds\n unless thresholds.first.is_a? Hash\n return change_thresholds LEVELS[0, thresholds.size].zip(thresholds).to_h\n end\n thresholds.first.each do |k, new_threshold|\n next unless (badge = @badge[k])\n @badge.delete badge.threshold\n badge.threshold = new_threshold\n @badge[new_threshold] = badge\n end\n end",
"def check_thresholds(data:)\n if data > @options[:critical].to_i\n @critical << @message\n elsif data > @options[:warning].to_i\n @warning << @message\n else\n @okays << @message\n end\n # make the final step\n build_final_output\n end",
"def update\n respond_to do |format|\n if @threshold.update(threshold_params)\n format.html { redirect_to thresholds_path, notice: 'Threshold was successfully updated.' }\n format.json { render :show, status: :ok, location: @threshold }\n else\n format.html { render :edit }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_threshold\n @threshold = Threshold.find(params[:id])\n end",
"def restriction_params\n params.require(:restriction).permit(:threshold)\n end",
"def create(match:, threshold:, period:, action:, id: nil, disabled: nil, description: nil, bypass: nil)\n common_checks(match, action, threshold, period)\n\n data = {match: match, threshold: threshold, period: period, action: action}\n data[:id] = id unless id.nil?\n\n unless disabled.nil?\n valid_value_check(:disabled, disabled, [true, false])\n data[:disabled] = disabled\n end\n\n cf_post(path: \"/zones/#{zone_id}/rate_limits\", data: data)\n end",
"def new\n @threshold = Threshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @threshold }\n end\n end",
"def update\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n if @threshold.update_attributes(params[:threshold])\n format.html { redirect_to @threshold, notice: 'Threshold was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prd_threshold = PrdThreshold.new(params[:prd_threshold])\n\n respond_to do |format|\n if @prd_threshold.save\n format.html { redirect_to(@prd_threshold, :notice => 'PrdThreshold was successfully created.') }\n format.xml { render :xml => @prd_threshold, :status => :created, :location => @prd_threshold }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prd_threshold.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def threshold\n @threshold ||= Reputation::Threshold.lookup(self.action, self.sender, :tier => self.tier)\n end",
"def set_Threshold(value)\n set_input(\"Threshold\", value)\n end",
"def create\n\n score = params[:score].to_i\n recording = ActiveSupport::JSON.decode(params[:record])\n # One of the entries in the record has a greater time than the score they're trying to submit\n\t\trecording.each do |record|\n\t\t\tif record['t'].to_i > score\n\t\t\t\trender :json => ['notice' => 'Error 503', 'status' => false] and return\n\t\t\tend\n end\n\n # Made it far enough to count as valid, increment times completed\n\t\t@level = Level.find(params[:level_id])\n @level.update_attribute(:times_completed, @level.times_completed+1)\n\n\n\t\trender(:json => [\"notice\" => \"Not signed in\", \"status\" => false]) and return unless current_user\n\t\trender(:json => [\"notice\" => \"Error 504\", \"status\" => false]) and return unless current_user.ScoreHash != \"\"\n\n\t\tscore_hash = current_user.ScoreHash\n\n\t\t# Remove the hash from the user so they can't resubmit for this level\n\t\tcurrent_user.update_attribute(:ScoreHash, \"\")\n\n\t\t# Check that they have a valid hash - uses the current_user.ScoreHash to decrypt the string\n\t\tbegin\n\t\t\tkey = EzCrypto::Key.with_password(APP_CONFIG[\"SECRET\"][\"TOKEN\"], params[:level_id], :algorithm => 'blowfish')\n\t\t\trequest_time = key.decrypt64(score_hash)\n\t\t\tputs \"RequestTime\" << request_time\n\t\t\tlevel_request_time = Time.at(request_time.to_i)\n\t\trescue Exception=>e\n\t\t\trender :json => ['notice' => 'Error 501', 'status' => false] and return\n\t\tend\n\n\n\n\t\t# Only 3 or less recording states - this is pretty impossible co\n\t\trender(:json => [\"notice\" => \"Error 505\", \"status\" => false]) and return unless recording.length > 3\n\n\t\t# Check if the user already has a record for this level\n\t\tprevious_score = Highscore.order('score').find_by_user_id_and_level_id(current_user.id, params[:level_id]) # with dynamic finder\n\n\t\tbegin\n\t\t\t# They don't have a score for this level\n\t\t\tif previous_score.nil?\n\t\t\t\t# Save the score\n\t\t\t\t@highscore = @level.highscores.build\n\t\t\t\t@highscore.user_id = current_user.id\n\t\t\t\t@highscore.score = score\n\t\t\t\t@highscore.playerRecord = ActiveSupport::JSON.encode(recording)\n\t\t\t\t@highscore.save\n\t\t\telse # Update level entry\n\t\t\t\trender(:json => [\"notice\" => \"Previous score better\", \"status\" => false]) and return unless previous_score.score.to_i > score\n\t\t\t\tprevious_score.score = score.to_s\n\t\t\t\tprevious_score.playerRecord = ActiveSupport::JSON.encode(recording)\n\t\t\t\tprevious_score.save\n\t\t\tend\n\t\trescue Exception=>e\n\t\t\trender :json => [\"notice\" => e, \"status\" => false]\n\t\tend\n\n\n\t\t# Alright it worked!\n\t\trender :json => [\"notice\" => \"Score saved\", \"status\" => true]\n\tend",
"def threshold=(threshold)\n @threshold = threshold\n \n @threshold = 100 if threshold > 100\n @threshold = 1 if threshold < 1\n end",
"def probe_configuration_params\n params.require(:probe_configuration).permit(:name, :rule_ok, :rule_warning, :rule_error, :rule_assumed, :heartbeat_interval, :alarm_interval, :value1_threshold, :value2_threshold, :value3_threshold, :value4_threshold, :value5_threshold, :value6_threshold, :value7_threshold, :value8_threshold, :value9_threshold, :value10_threshold, :value11_threshold, :value12_threshold, :value13_threshold, :value14_threshold, :value15_threshold, :value16_threshold)\n end",
"def create\n @deposit_threshold = DepositThreshold.new(params[:deposit_threshold])\n\n respond_to do |format|\n if @deposit_threshold.save\n format.html { redirect_to(@deposit_threshold, :notice => 'DepositThreshold was successfully created.') }\n format.xml { render :xml => @deposit_threshold, :status => :created, :location => @deposit_threshold }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deposit_threshold.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @threshold.destroy\n respond_to do |format|\n format.html { redirect_to thresholds_url, notice: 'Threshold was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end",
"def report_metrics\n metadata = {\n 'sourcetype' => 'json',\n 'source' => 'chef-handler',\n 'host' => node.hostname,\n 'index' => @index,\n 'check-index' => false\n }\n\n # We're creating a new Hash b/c 'node' and 'all_resources' in run_status\n # are just TOO large.\n event = {\n :failed => run_status.failed?,\n :start_time => run_status.start_time,\n :end_time => run_status.end_time,\n :elapsed_time => run_status.elapsed_time,\n :exception => run_status.formatted_exception\n }.to_json\n\n splunk_post(event, metadata)\n end",
"def create(options)\n API::request(:post, 'background_checks', options)\n end",
"def create\n @severity_level = SeverityLevel.new(severity_level_params)\n\n respond_to do |format|\n if @severity_level.save\n format.html do\n redirect_to @severity_level,\n notice: 'Severity level was successfully created.'\n end\n format.json { render :show, status: :created, location: @severity_level }\n else\n format.html { render :new }\n format.json { render json: @severity_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @threshold = Threshold.find(params[:id])\n @threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to thresholds_url }\n format.json { head :no_content }\n end\n end",
"def health_condition_params\n params.require(:health_condition).permit(:name, :priority)\n end",
"def threshold_reached_value_type_count_xxx(value_type, threshold_type)\n # Used to prefix sender email to change it\n new_email_prefix = \"new_\"\n # This is ripped from email_bill_entry value_type_value\n sum_thus_far_curr_val = 0\n sum_thus_far_curr_code = nil\n sum_thus_far_str = nil\n email_elem = inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email)\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n # Get the new pii\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n meantItRel_hash = ControllerHelper.parse_meant_it_input(input_str)\n pii_value = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII]\n hk_pii = Pii.find_by_pii_value(pii_value)\n assert_equal(false, ControllerHelper.sellable_pii(hk_pii), \"newly created pii is not sellable since no pii_property_set\")\n # Now create pii_propery_set and fill in the \n # necessary properties to make pii sellable\n hk_pii.pii_property_set = PiiPropertySet.create\n hk_pii.pii_property_set.currency = nil\n # NOTE: We submit inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email_buy) \n # twice with the second time we increase by 1 unit currency\n # so we adjust threshold to the sum so that \n # threshold is exceeded after the 2nd buy\n email_elem = inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email_buy)\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n threshold = ControllerHelper.sum_currency_in_str(input_str)\n threshold_curr_code, threshold_curr_val = ControllerHelper.get_currency_code_and_val(threshold)\n one_unit_currency = \"#{threshold_curr_code}1\"\n threshold = ControllerHelper.sum_currency_in_str(\"#{threshold} #{threshold} #{one_unit_currency}\")\n threshold_curr_code, threshold_curr_val = ControllerHelper.get_currency_code_and_val(threshold)\n hk_pii.pii_property_set.threshold = 2\n hk_pii.pii_property_set.currency = nil\n hk_pii.pii_property_set.status = StatusTypeValidator::STATUS_ACTIVE\n hk_pii.pii_property_set.value_type = value_type\n hk_pii.pii_property_set.threshold_type = threshold_type\n hk_pii.pii_property_set.save\n assert_equal(true, ControllerHelper.sellable_pii(hk_pii), \"pii with appropriate fields filled in is sellable\")\n # Create a new mir by sending another mail\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 2], # for new sender and the nick for destination\n ['Pii.count', 1], # for new sender\n ['Tag.count', 1], # New tag, i.e., each price is a new tag\n ['EndPointTagRel.count', 1], # New tag to endpoint\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 1]\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n # Check the value of email_bill_entry.qty\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n assert_equal(1, hk_pii_email_bill_entries.size)\n assert_equal(1, hk_pii_email_bill_entries[0].meant_it_rels.size)\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n first_email_curr_str = ControllerHelper.sum_currency_in_str(input_str) #AAAAA\n first_email_curr_code, first_email_curr_val = ControllerHelper.get_currency_code_and_val(first_email_curr_str) #AAAAA\n # Assert that we have now one entry\n assert_equal(hk_pii_email_bill_entries.size, hk_pii_email_bill_entries[0].qty)\n assert_equal(nil, hk_pii_email_bill_entries[0].currency)\n # Check threshold\n assert(hk_pii_email_bill_entries[0].qty < hk_pii_email_bill_entries[0].pii_property_set.threshold)\n assert_nil(hk_pii_email_bill_entries[0].ready_date)\n # If a same email is resubmitted, but with different value!\n body_text = email_elem.body_text\n # Get pii and currency\n email_body_hash = ControllerHelper.parse_meant_it_input(body_text)\n pii_str = email_body_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII]\n curr_arr = ControllerHelper.get_currency_arr_from_str(body_text)\n # Just take one value\n prev_curr_curr_code, prev_curr_curr_val = ControllerHelper.get_currency_code_and_val(curr_arr[0])\n second_email_curr_code = prev_curr_curr_code\n second_email_curr_val = prev_curr_curr_val.to_f + 1.0\n second_email_curr_str = \"#{second_email_curr_code}#{second_email_curr_val}\"\n email_elem.body_text = \":#{pii_str} #{second_email_curr_str}\"\n p \"new email_elem.body_text:#{email_elem.body_text}\"\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 0], # no new sender and the nick for destination\n ['Pii.count', 0], # no new sender\n ['Tag.count', 1], # One more tag, i.e., the new curr value\n ['EndPointTagRel.count', 1], # One more tag => one more EndPointTagRel\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 0] # No new bill\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n assert_equal(1, hk_pii_email_bill_entries.size)\n if value_type == ValueTypeValidator::VALUE_TYPE_COUNT\n # Add one entry even tho' the sender is same \n # since value_type is VALUE_TYPE_VALUE\n assert_equal(2, hk_pii_email_bill_entries[0].meant_it_rels.size)\n src_ep_hash = ControllerHelper.parse_email(email_elem.from)\n src_ep_1 = src_ep_hash[ControllerHelper::EMAIL_STR]\n # The qty should be sum of 1st+2nd email if VALUE_TYPE_VALUE,\n sum_thus_far_curr_val = first_email_curr_val + second_email_curr_val\n else\n # No entry is added\n # since value_type is VALUE_TYPE_VALUE_UNIQ\n assert_equal(1, hk_pii_email_bill_entries[0].meant_it_rels.size)\n # Send another email\n email_addy_hash = ControllerHelper.parse_email(email_elem.from)\n email_addy = email_addy_hash[ControllerHelper::EMAIL_STR]\n email_elem.from = \"#{new_email_prefix}#{email_addy}\"\n src_ep_1 = email_elem.from\np \"!!!!!!!!!!!!!email_elem.attributes.inspect:#{email_elem.attributes.inspect}\"\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 2], # new sender and the nick for destination\n ['Pii.count', 1], # no new sender\n ['Tag.count', 0], # Zero new tag, since we're using same currency tag\n ['EndPointTagRel.count', 1], # One more tag => one more EndPointTagRel\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 0] # No new bill\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n # The qty should be sum of 2nd+3rd if VALUE_TYPE_VALUE_UNIQ\n # NOTE: 3rd email is just 2nd email with from changed\n sum_thus_far_curr_val = second_email_curr_val + second_email_curr_val\n end # end elsif value_type == ValueTypeValidator::VALUE_TYPE_VALUE_UNIQ\n hk_pii_mirs_id_desc = hk_pii_email_bill_entries[0].meant_it_rels.order(\"id desc\")\n mir_src_pii = hk_pii_mirs_id_desc[0].src_endpoint.pii\n assert_equal(src_ep_1, mir_src_pii.pii_value)\n assert_equal(2, hk_pii_email_bill_entries[0].qty)\n # Increase in the number of mirs\n assert_equal(2, hk_pii_email_bill_entries[0].meant_it_rels.size)\n assert_equal(nil, hk_pii_email_bill_entries[0].currency)\n # Check threshold\np \"!!!!!!sum_thus_far_curr_val:#{sum_thus_far_curr_val}\"\np \"!!!!!!hk_pii_email_bill_entries[0].pii_property_set.threshold:#{hk_pii_email_bill_entries[0].pii_property_set.threshold}\"\n assert_equal(hk_pii_email_bill_entries[0].pii_property_set.threshold, hk_pii_email_bill_entries[0].qty)\n assert_not_nil(hk_pii_email_bill_entries[0].ready_date)\n # Check price_final, threshold_final\n if (value_type == ValueTypeValidator::VALUE_TYPE_VALUE or value_type == ValueTypeValidator::VALUE_TYPE_COUNT_UNIQ)\n # For VALUE_TYPE_VALUE_xxx, there is no price_final\n assert_nil(hk_pii_email_bill_entries[0].price_final)\n else\n assert_equal(ControllerHelper.get_price_from_formula(hk_pii.pii_property_set.formula), hk_pii_email_bill_entries[0].price_final)\n end # end if (value_type == ValueTypeValidator::VALUE_TYPE_VALUE or value_type == ValueTypeValidator::VALUE_TYPE_UNIQ)\n assert_equal(hk_pii.pii_property_set.threshold, hk_pii_email_bill_entries[0].threshold_final)\n assert_equal(hk_pii.pii_property_set.currency, hk_pii_email_bill_entries[0].currency)\n if threshold_type == PiiPropertySetThresholdTypeValidator::THRESHOLD_TYPE_ONETIME\n # If threshold_type is onetime then pii becomes inactive\n assert_equal(StatusTypeValidator::STATUS_INACTIVE, hk_pii.pii_property_set.status)\n new_bill_ready_date = hk_pii.pii_property_set.email_bill_entries[0].ready_date\n assert_not_nil(new_bill_ready_date)\n # NOTE: For ONETIME, the active_date is <= ready_date since\n # active_date is set only when the pii is created when active state\n # is re-set\n new_active_date = ControllerHelper.get_bill_dates_by_pii(hk_pii)\n assert_not_nil(new_active_date)\n assert(new_bill_ready_date >= new_active_date)\n assert_in_delta(new_bill_ready_date, new_active_date, 2)\n else\n # If threshold_type is recur then check billing\n # Since this is recur, status should remain active\n assert_equal(StatusTypeValidator::STATUS_ACTIVE, hk_pii.pii_property_set.status)\n new_bill_ready_date = hk_pii.pii_property_set.email_bill_entries[0].ready_date\n assert_not_nil(new_bill_ready_date)\n new_start_bill_date = ControllerHelper.get_bill_dates_by_pii(hk_pii)\n # NOTE: For now new bill dates are created only when billed_date is\n # set, i.e., user contacts their customers through emails\n assert(new_bill_ready_date >= new_start_bill_date)\n assert_in_delta(new_bill_ready_date, new_start_bill_date, 2)\n end # end if threshold_type == PiiPropertySetThresholdTypeValidator::THRESHOLD_TYPE_ONETIME\n end",
"def create \n render json: Tuning.create(tuning_params)\n end",
"def gather_threshold_totals\n rules.each{|field_to_validate, field_options|\n field_threshold = return_threshold(field_to_validate, field_options)\n if field_threshold\n gather_field_threshold_totals(field_to_validate, field_options)\n else\n gather_specific_validation_totals(field_to_validate, field_options)\n end\n }\n end",
"def statistic_params\n params.require(:statistic).permit(:posts_scanned, :api_quota, :post_scan_rate)\n end",
"def severity_params\n params.require(:severity).permit(:severity_level)\n end",
"def threshold\n @threshold || 95\n end",
"def risk_plan_operation_params\n params.require(:risk_plan_operation).permit(\n :risk_plan_id,\n :operation_id,\n :is_enabled,\n :threshold_ids => [],\n :threshold_relation_symbols => [],\n :threshold_values => [],\n :threshold_removal_flags => [],\n :threshold_parameters => []\n )\n end",
"def alert_threshold=(value)\n @alert_threshold = value\n end",
"def threshold_reached_value_type_value_xxx(value_type, threshold_type)\n # Used to prefix sender email to change it\n new_email_prefix = \"new_\"\n # This is ripped from email_bill_entry value_type_value\n sum_thus_far_curr_val = 0\n sum_thus_far_curr_code = nil\n sum_thus_far_str = nil\n email_elem = inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email)\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n # Get the new pii\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n meantItRel_hash = ControllerHelper.parse_meant_it_input(input_str)\n pii_value = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII]\n hk_pii = Pii.find_by_pii_value(pii_value)\n assert_equal(false, ControllerHelper.sellable_pii(hk_pii), \"newly created pii is not sellable since no pii_property_set\")\n # Now create pii_propery_set and fill in the \n # necessary properties to make pii sellable\n hk_pii.pii_property_set = PiiPropertySet.create\n hk_pii.pii_property_set.currency = \"SGD\"\n # NOTE: We submit inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email_buy) \n # twice with the second time we increase by 1 unit currency\n # so we adjust threshold to the sum so that \n # threshold is exceeded after the 2nd buy\n email_elem = inbound_emails(:nick_n_xxx_y_yyy_n_tags_y_currency_sender_idable_inbound_email_buy)\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n threshold = ControllerHelper.sum_currency_in_str(input_str)\n threshold_curr_code, threshold_curr_val = ControllerHelper.get_currency_code_and_val(threshold)\n one_unit_currency = \"#{threshold_curr_code}1\"\n threshold = ControllerHelper.sum_currency_in_str(\"#{threshold} #{threshold} #{one_unit_currency}\")\n threshold_curr_code, threshold_curr_val = ControllerHelper.get_currency_code_and_val(threshold)\n hk_pii.pii_property_set.threshold = threshold_curr_val\n hk_pii.pii_property_set.currency = threshold_curr_code\n hk_pii.pii_property_set.status = StatusTypeValidator::STATUS_ACTIVE\n hk_pii.pii_property_set.value_type = value_type\n hk_pii.pii_property_set.threshold_type = threshold_type\n hk_pii.pii_property_set.save\n assert_equal(true, ControllerHelper.sellable_pii(hk_pii), \"pii with appropriate fields filled in is sellable\")\n # Create a new mir by sending another mail\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 2], # for new sender and the nick for destination\n ['Pii.count', 1], # for new sender\n ['Tag.count', 1], # New tag, i.e., each price is a new tag\n ['EndPointTagRel.count', 1], # New tag to endpoint\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 1]\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n # Check the value of email_bill_entry.qty\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n assert_equal(1, hk_pii_email_bill_entries.size)\n assert_equal(1, hk_pii_email_bill_entries[0].meant_it_rels.size)\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n#AAAAA sum_thus_far_str = ControllerHelper.sum_currency_in_str(input_str)\n first_email_curr_str = ControllerHelper.sum_currency_in_str(input_str)\n#AAAAA sum_thus_far_curr_code, sum_thus_far_curr_val = ControllerHelper.get_currency_code_and_val(sum_thus_far_str)\n first_email_curr_code, first_email_curr_val = ControllerHelper.get_currency_code_and_val(first_email_curr_str)\n#AAAAA assert_equal(sum_thus_far_curr_val.to_f, hk_pii_email_bill_entries[0].qty)\n assert_equal(first_email_curr_val.to_f, hk_pii_email_bill_entries[0].qty)\n#AAAAA assert_equal(sum_thus_far_curr_code, hk_pii_email_bill_entries[0].currency)\n assert_equal(first_email_curr_code, hk_pii_email_bill_entries[0].currency)\n # Check threshold\n#AAAAA assert(sum_thus_far_curr_val.to_f < hk_pii_email_bill_entries[0].pii_property_set.threshold)\n assert(first_email_curr_val.to_f < hk_pii_email_bill_entries[0].pii_property_set.threshold)\n assert_nil(hk_pii_email_bill_entries[0].ready_date)\n # If a same email is resubmitted, but with different value!\n body_text = email_elem.body_text\n # Get pii and currency\n email_body_hash = ControllerHelper.parse_meant_it_input(body_text)\n pii_str = email_body_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII]\n curr_arr = ControllerHelper.get_currency_arr_from_str(body_text)\n # Just take one value\n#AAAAA new_curr_curr_code, new_curr_curr_val = ControllerHelper.get_currency_code_and_val(curr_arr[0])\n prev_curr_curr_code, prev_curr_curr_val = ControllerHelper.get_currency_code_and_val(curr_arr[0])\n second_email_curr_code = prev_curr_curr_code\n#AAAAA new_curr_f = new_curr_curr_val.to_f + 1.0\n second_email_curr_val = prev_curr_curr_val.to_f + 1.0\n#AAAAA new_curr_str = \"#{new_curr_curr_code}#{new_curr_f}\"\n second_email_curr_str = \"#{second_email_curr_code}#{second_email_curr_val}\"\n#AAAAA email_elem.body_text = \":#{pii_str} #{new_curr_str}\"\n email_elem.body_text = \":#{pii_str} #{second_email_curr_str}\"\n p \"new email_elem.body_text:#{email_elem.body_text}\"\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 0], # no new sender and the nick for destination\n ['Pii.count', 0], # no new sender\n ['Tag.count', 1], # One more tag, i.e., the new curr value\n ['EndPointTagRel.count', 1], # One more tag => one more EndPointTagRel\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 0] # No new bill\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n assert_equal(1, hk_pii_email_bill_entries.size)\n if value_type == ValueTypeValidator::VALUE_TYPE_VALUE\n # Add one entry even tho' the sender is same \n # since value_type is VALUE_TYPE_VALUE\n assert_equal(2, hk_pii_email_bill_entries[0].meant_it_rels.size)\n src_ep_hash = ControllerHelper.parse_email(email_elem.from)\n src_ep_1 = src_ep_hash[ControllerHelper::EMAIL_STR]\n # The qty should be sum of 1st+2nd email if VALUE_TYPE_VALUE,\n sum_thus_far_curr_val = first_email_curr_val + second_email_curr_val\n else\n # No entry is added\n # since value_type is VALUE_TYPE_VALUE_UNIQ\n assert_equal(1, hk_pii_email_bill_entries[0].meant_it_rels.size)\n # Send another email\n email_addy_hash = ControllerHelper.parse_email(email_elem.from)\n email_addy = email_addy_hash[ControllerHelper::EMAIL_STR]\n email_elem.from = \"#{new_email_prefix}#{email_addy}\"\n src_ep_1 = email_elem.from\np \"!!!!!!!!!!!!!email_elem.attributes.inspect:#{email_elem.attributes.inspect}\"\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', 2], # new sender and the nick for destination\n ['Pii.count', 1], # no new sender\n ['Tag.count', 0], # Zero new tag, since we're using same currency tag\n ['EndPointTagRel.count', 1], # One more tag => one more EndPointTagRel\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', 1], # We create a link from MeantItRel to Tag\n ['EmailBillEntry.count', 0] # No new bill\n ]) do\n # Set the path so that the \"from:\" email is used\n # otherwise sender is anonymous\n @request.path = Constants::SENDGRID_PARSE_URL\n post :create, :inbound_email => email_elem.attributes\n end # end assert_differences\n hk_pii.reload\n hk_pii_email_bill_entries = hk_pii.pii_property_set.email_bill_entries\n # The qty should be sum of 2nd+3rd if VALUE_TYPE_VALUE_UNIQ\n # NOTE: 3rd email is just 2nd email with from changed\n sum_thus_far_curr_val = second_email_curr_val + second_email_curr_val\n end # end elsif value_type == ValueTypeValidator::VALUE_TYPE_VALUE_UNIQ\n hk_pii_mirs_id_desc = hk_pii_email_bill_entries[0].meant_it_rels.order(\"id desc\")\n#AAAAA mir_src_pii = hk_pii_email_bill_entries[0].meant_it_rels[0].src_endpoint.pii\n mir_src_pii = hk_pii_mirs_id_desc[0].src_endpoint.pii\n assert_equal(src_ep_1, mir_src_pii.pii_value)\n#AAAAA sum_thus_far_curr_val += new_curr_f\n assert_equal(sum_thus_far_curr_val, hk_pii_email_bill_entries[0].qty)\n # Increase in the number of mirs\n assert_equal(2, hk_pii_email_bill_entries[0].meant_it_rels.size)\n # The currency code of first email and second email value are the same\n#AAAAA assert_equal(sum_thus_far_curr_code, new_curr_curr_code)\n assert_equal(first_email_curr_code, second_email_curr_code)\n#AAAAA assert_equal(new_curr_curr_code, hk_pii_email_bill_entries[0].currency)\n assert_equal(second_email_curr_code, hk_pii_email_bill_entries[0].currency)\n # Check threshold\np \"!!!!!!sum_thus_far_curr_val:#{sum_thus_far_curr_val}\"\np \"!!!!!!hk_pii_email_bill_entries[0].pii_property_set.threshold:#{hk_pii_email_bill_entries[0].pii_property_set.threshold}\"\n assert(hk_pii_email_bill_entries[0].pii_property_set.threshold <= sum_thus_far_curr_val)\n assert_not_nil(hk_pii_email_bill_entries[0].ready_date)\n # Check price_final, threshold_final\n if (value_type == ValueTypeValidator::VALUE_TYPE_VALUE or value_type == ValueTypeValidator::VALUE_TYPE_VALUE_UNIQ)\n # For VALUE_TYPE_VALUE_xxx, there is no price_final\n assert_nil(hk_pii_email_bill_entries[0].price_final)\n else\n assert_equal(ControllerHelper.get_price_from_formula(hk_pii.pii_property_set.formula), hk_pii_email_bill_entries[0].price_final)\n end # end if (value_type == ValueTypeValidator::VALUE_TYPE_VALUE or value_type == ValueTypeValidator::VALUE_TYPE_UNIQ)\n assert_equal(hk_pii.pii_property_set.threshold, hk_pii_email_bill_entries[0].threshold_final)\n assert_equal(hk_pii.pii_property_set.currency, hk_pii_email_bill_entries[0].currency)\n if threshold_type == PiiPropertySetThresholdTypeValidator::THRESHOLD_TYPE_ONETIME\n # If threshold_type is onetime then pii becomes inactive\n assert_equal(StatusTypeValidator::STATUS_INACTIVE, hk_pii.pii_property_set.status)\n new_bill_ready_date = hk_pii.pii_property_set.email_bill_entries[0].ready_date\n assert_not_nil(new_bill_ready_date)\n # NOTE: For ONETIME, the active_date is <= ready_date since\n # active_date is set only when the pii is created when active state\n # is re-set\n new_active_date = ControllerHelper.get_bill_dates_by_pii(hk_pii)\n assert_not_nil(new_active_date)\n assert(new_bill_ready_date >= new_active_date)\n assert_in_delta(new_bill_ready_date, new_active_date, 2)\n else\n # If threshold_type is recur then check billing\n # Since this is recur, status should remain active\n assert_equal(StatusTypeValidator::STATUS_ACTIVE, hk_pii.pii_property_set.status)\n new_bill_ready_date = hk_pii.pii_property_set.email_bill_entries[0].ready_date\n assert_not_nil(new_bill_ready_date)\n new_start_bill_date = ControllerHelper.get_bill_dates_by_pii(hk_pii)\n # NOTE: For now new bill dates are created only when billed_date is\n # set, i.e., user contacts their customers through emails\n assert(new_bill_ready_date >= new_start_bill_date)\n assert_in_delta(new_bill_ready_date, new_start_bill_date, 2)\n end # end if threshold_type == PiiPropertySetThresholdTypeValidator::THRESHOLD_TYPE_ONETIME\n end",
"def create\n @blank_wall = BlankWall.new(blank_wall_params)\n budget_range = blank_wall_params[:budget_range].split(\",\")\n @blank_wall.min_budget = budget_range[0]\n @blank_wall.max_budget = budget_range[1]\n respond_to do |format|\n if @blank_wall.save\n format.html { redirect_to @blank_wall, notice: 'Blank wall was successfully created.' }\n format.json { render :show, status: :created, location: @blank_wall }\n else\n format.html { render :new }\n format.json { render json: @blank_wall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @heartbeat = Heartbeat.new(heartbeat_params)\n\n if @heartbeat.save\n render json: @heartbeat, status: :created, location: @heartbeat\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @threshold = args[:threshold] if args.key?(:threshold)\n @value = args[:value] if args.key?(:value)\n end",
"def request_score_params\n params.require(:request_score).permit(:ip, :request_count)\n end",
"def enable_threshold\n @enable_threshold = true\n end",
"def reputation_threshold_action\n :offer_reward\n end",
"def test_flapping_thresholds_order\n assert_nothing_raised {\n create_driver(%[\n check_low_flap_threshold 0\n check_high_flap_threshold 100\n ], 'ddos')\n }\n assert_raise(Fluent::ConfigError) {\n create_driver(%[\n check_low_flap_threshold -1\n check_high_flap_threshold 100\n ], 'ddos')\n }\n assert_raise(Fluent::ConfigError) {\n create_driver(%[\n check_low_flap_threshold 0\n check_high_flap_threshold 101\n ], 'ddos')\n }\n assert_nothing_raised {\n create_driver(%[\n check_low_flap_threshold 50\n check_high_flap_threshold 50\n ], 'ddos')\n }\n assert_raise(Fluent::ConfigError) {\n create_driver(%[\n check_low_flap_threshold 50\n check_high_flap_threshold 49\n ], 'ddos')\n }\n end",
"def hook_params\n params.require(:hook).permit(:threshold, :callback)\n end",
"def patch_cpu_mem_thresholds_profile_0_with_http_info(profile_id, policy_firewall_cpu_mem_thresholds_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile_0 ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile_0\"\n end\n # verify the required parameter 'policy_firewall_cpu_mem_thresholds_profile' is set\n if @api_client.config.client_side_validation && policy_firewall_cpu_mem_thresholds_profile.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_firewall_cpu_mem_thresholds_profile' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile_0\"\n end\n # resource path\n local_var_path = '/infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'override'] = opts[:'override'] if !opts[:'override'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_firewall_cpu_mem_thresholds_profile)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#patch_cpu_mem_thresholds_profile_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @priority_condition = PriorityCondition.new(priority_condition_params)\n\n respond_to do |format|\n if @priority_condition.save\n format.html { redirect_to @priority_condition, notice: 'Priority condition was successfully created.' }\n format.json { render :show, status: :created, location: @priority_condition }\n else\n format.html { render :new }\n format.json { render json: @priority_condition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def last_request_at_threshold(value = nil)\n if value.nil?\n read_inheritable_attribute(:last_request_at_threshold) || last_request_at_threshold(0)\n else\n write_inheritable_attribute(:last_request_at_threshold, value)\n end\n end",
"def create_status(name, description, level, image)\n response = @client.post(\"/api/v1/statuses\", { \"name\" => name, \"description\" => description, \"level\" => level, \"image\" => image })\n return JSON.parse(response.body)\n end",
"def params_for_monitor(\n name,\n message,\n query,\n threshold,\n options = {\n escalation_message: nil,\n alert_no_data: true,\n mon_type: 'metric alert',\n renotify_interval: 60,\n no_data_timeframe: 20,\n evaluation_delay: nil\n }\n )\n options[:alert_no_data] = true unless options.key?(:alert_no_data)\n options[:mon_type] = 'metric alert' unless options.key?(:mon_type)\n options[:renotify_interval] = 60 unless options.key?(:renotify_interval)\n options[:no_data_timeframe] = 20 unless options.key?(:no_data_timeframe)\n options[:evaluation_delay] = nil unless options.key?(:evaluation_delay)\n\n # handle threshold hash\n thresh = if threshold.is_a?(Hash)\n threshold\n else\n { 'critical' => threshold }\n end\n\n monitor_data = {\n 'name' => name,\n 'type' => options[:mon_type],\n 'query' => query,\n 'message' => message,\n 'tags' => [],\n 'options' => {\n 'notify_audit' => false,\n 'locked' => false,\n 'timeout_h' => 0,\n 'silenced' => {},\n 'thresholds' => thresh,\n 'require_full_window' => false,\n 'notify_no_data' => options[:alert_no_data],\n 'renotify_interval' => options[:renotify_interval],\n 'no_data_timeframe' => options[:no_data_timeframe]\n }\n }\n unless options[:escalation_message].nil?\n monitor_data['options']['escalation_message'] = \\\n options[:escalation_message]\n end\n unless options[:evaluation_delay].nil?\n monitor_data['options']['evaluation_delay'] = options[:evaluation_delay]\n end\n monitor_data\n end",
"def check_threshold\n rate = lines.length.to_f / expiry\n if rate > threshold\n alert_status\n elsif rate < threshold\n normal_status\n end\n end",
"def round_params\n params.require(:round).permit(:judge_id, :status)\n end",
"def patch_cpu_mem_thresholds_profile_with_http_info(profile_id, policy_firewall_cpu_mem_thresholds_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile\"\n end\n # verify the required parameter 'policy_firewall_cpu_mem_thresholds_profile' is set\n if @api_client.config.client_side_validation && policy_firewall_cpu_mem_thresholds_profile.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_firewall_cpu_mem_thresholds_profile' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile\"\n end\n # resource path\n local_var_path = '/global-infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'override'] = opts[:'override'] if !opts[:'override'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_firewall_cpu_mem_thresholds_profile)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#patch_cpu_mem_thresholds_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @threshold }\n end\n end",
"def create\n respond_to do |format|\n if @health_level.save\n format.html { redirect_to @health_level, notice: 'Health level was successfully created.' }\n format.json { render json: @health_level, status: :created, location: @health_level }\n else\n format.html { render action: \"new\" }\n format.json { render json: @health_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patient_score\n @@thresholds.keys.inject(0) do |accu, attribute|\n accu + self.send(\"#{attribute}_score\")\n end\n end",
"def create\n @interval_constraint = IntervalConstraint.new(interval_constraint_params)\n\n respond_to do |format|\n if @interval_constraint.save\n format.html { redirect_to @interval_constraint, notice: 'Interval constraint was successfully created.' }\n format.json { render :show, status: :created, location: @interval_constraint }\n else\n format.html { render :new }\n format.json { render json: @interval_constraint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gauge = Gauge.new(params[:gauge])\n\n respond_to do |format|\n if @gauge.save\n format.html { redirect_to @gauge, notice: 'Gauge was successfully created.' }\n format.json { render json: @gauge, status: :created, location: @gauge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gauge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def compare_threshold\n return unless mark_build_fail?\n\n print(\"Threshold: #{Config.threshold_score}\\n\")\n print(\"Difference: #{(Config.base_branch_score - Config.feature_branch_score).abs}\\n\")\n abort('The score difference between the two branches is over the threshold.')\n end",
"def create\n @severity = Severity.new(severity_params)\n\n respond_to do |format|\n if @severity.save\n format.html { redirect_to @severity, notice: 'Severity was successfully created.' }\n format.json { render :show, status: :created, location: @severity }\n else\n format.html { render :new }\n format.json { render json: @severity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def poset_params\n params.require(:poset).permit(:name, :pass_threshold, :fail_threshold)\n end",
"def create\n @criterion = Criterion.new(params[:criterion])\n\n if @criterion.save\n render json: @criterion, status: :created, location: @criterion\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end",
"def build_body(metric, timestamp, value)\n {\n \"metric\" => metric,\n \"timestamp\" => timestamp,\n \"value\" => value,\n \"tags\" => { \"status\" => \"test\" }\n }.to_json\nend",
"def run_values_to_ranges\n GRADES.each do |grade|\n classifier[grade].each_pair do |metric, value|\n classifier[grade][metric] = {\n threshold: value,\n range: ThresholdToRange.new(\n metric, value, grade, reversed: ->(m) { reversed_metrics.include?(m) }\n ).range\n }\n end\n end\n end",
"def weak_thresholds(*pvalues)\n thresholds_by_pvalues(*pvalues).each do |pvalue,(thresholds, counts)|\n threshold = thresholds.begin.to_f\n real_pvalue = counts.begin.to_f / vocabulary_volume\n yield pvalue, threshold, real_pvalue\n end\n end",
"def create\n @risk_level = RiskLevel.new(params[:risk_level])\n\t@risk_level.risk_configuration = current_risk_configuration\n respond_to do |format|\n if @risk_level.save\n format.html { redirect_to(current_risk_configuration, :notice => 'Risk level was successfully created.') }\n format.json { render :json => @risk_level, :status => :created, :location => @risk_level }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @risk_level.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_threshold\n d = self.vspecs.select(:value).where(name: 'threshold').first\n return d != nil ? d.value : d\n end",
"def threshold=(threshold_severity)\n\n\t\traise TypeError, \"threshold_severity must be a #{::Symbol}\" unless ::Symbol === threshold_severity\n\n\t\t@threshold_v = @value_lookup_map[threshold_severity] if @relativity_lookup_map[threshold_severity] or raise ArgumentError, \"unknown threshold severity level '#{threshold_severity}' (#{threshold_severity.class})\"\n\t\t@threshold = threshold_severity\n\n\t\tnil\n\tend",
"def severity_level_params\n params.require(:severity_level).permit(:name, :color)\n end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def create\n if params[:type] == \"Strategy::TopicThreshold\"\n @strategy = Strategy::TopicThreshold.create( :options => {:threshold => params[:options].to_f}, :mallet_run_id => params[:mallet_run_id] )\n elsif params[:type] == \"Strategy::TopNTopics\"\n @strategy = Strategy::TopNTopics.create( :options => {:n => params[:options].to_i}, :mallet_run_id => params[:mallet_run_id])\n else\n message = \"Invalid Strategy Type\"\n end\n\n respond_to do |format|\n if @strategy && @strategy.save\n format.html { redirect_to strategy_path(@strategy.id), notice: 'Strategy was successfully created.' }\n format.json { render json: @strategy, status: :created, location: @strategy }\n else\n format.html { redirect_to strategies_path, notice: message }\n format.json { render json: @strategy && @strategy.errors || message, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @health_status = HealthStatus.new(health_status_params)\n\n respond_to do |format|\n if @health_status.save\n format.html { redirect_to @health_status, notice: 'Health status was successfully created.' }\n format.json { render :show, status: :created, location: @health_status }\n else\n format.html { render :new }\n format.json { render json: @health_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def define_cutoffs\n @contest.bronze_cutoff = params[:bronze_cutoff].to_i\n @contest.silver_cutoff = params[:silver_cutoff].to_i\n @contest.gold_cutoff = params[:gold_cutoff].to_i\n if @contest.save\n compute_new_contest_rankings(@contest)\n flash[:success] = \"Les médailles ont été distribuées !\"\n else\n flash[:danger] = error_list_for(@contest)\n end\n redirect_to @contest\n end",
"def index\n @regions = Region.more_than(ENV[\"FEEDBACK_THRESHOLD\"].to_i)\n end",
"def post_bva_dta_decision_status_details\n issue_list = remanded_sc_decision_issues\n {\n issues: api_issues_for_status_details_issues(issue_list),\n bva_decision_date: decision_event_date,\n aoj_decision_date: remand_decision_event_date\n }\n end",
"def create\n @operations_check = OperationsCheck.find(params[:operations_check_id])\n @load_balancer_check = @operations_check.load_balancer_checks.create(load_balancer_check_params)\n\n respond_to do |format|\n if @load_balancer_check.save\n format.html { redirect_to operations_check_path(@operations_check, tab: \"load_balancers\"), \n notice: 'Load balancer check was successfully created.' }\n format.json { render json: @load_balancer_check, status: :created, location: @load_balancer_check }\n else\n format.html { redirect_to operations_check_path(@operations_check, tab: \"load_balancers\"),\n notice: 'Commit failed - you must give a ticket number if the check failed!' }\n format.json { render json: @load_balancer_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fine_scale_params\n params.require(:fine_scale).permit(:old_condition_id, :new_condition_id, :percentage)\n end",
"def vote_threshold\n vote_count = self.votes_for.count # Sets variable for tracking petition's vote count\n if vote_count >= 500 && self.filed == false && self.stage == 0 # Petition hit the goal threshold and hasn't already been filed\n self.update_attributes(pending: false, filed_at: Time.now, filed: true, stage: 1) # Updates petition to filed and the time it was filed and sets the stage to 1, setting the timer for days left\n return true\n elsif vote_count < 500\n return false \n else # Vote count is above 100\n return false\n end \n end",
"def subsample_thresholds_required\n SUBSAMPLE_THRESHOLDS.select {|sample| sample < self.points}\n end",
"def update_cpu_mem_thresholds_profile_0_with_http_info(profile_id, policy_firewall_cpu_mem_thresholds_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile_0 ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile_0\"\n end\n # verify the required parameter 'policy_firewall_cpu_mem_thresholds_profile' is set\n if @api_client.config.client_side_validation && policy_firewall_cpu_mem_thresholds_profile.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_firewall_cpu_mem_thresholds_profile' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile_0\"\n end\n # resource path\n local_var_path = '/infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'override'] = opts[:'override'] if !opts[:'override'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_firewall_cpu_mem_thresholds_profile)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyFirewallCpuMemThresholdsProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#update_cpu_mem_thresholds_profile_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n params[:kf_status][:status_type] = params[:status_type] unless params[:status_type].blank?\n params[:kf_status][:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n params[:kf_status][:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_status = Kf::Status.new(params[:kf_status])\n\n respond_to do |format|\n if @kf_status.save\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\",notice: 'Status was successfully created.' }\n format.json { render json: @kf_status, status: :created, location: @kf_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hit_value = HitValue.new(params[:hit_value])\n\n respond_to do |format|\n if @hit_value.save\n format.html { redirect_to @hit_value, notice: 'Hit value was successfully created.' }\n format.json { render json: @hit_value, status: :created, location: @hit_value }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hit_value.errors, status: :unprocessable_entity }\n end\n end\n end",
"def health_params\n params.require(:health).permit(:name, :number, :link, :email, :services, :about, :address, :latitude, :longitude, :accepted_documents, :status, images:[])\n end",
"def create\n @trace = Trace.new\n if @trace.save\n @trace.import_points(points_data)\n status = :created\n else\n status = :bad_request\n end\n\n render json: @trace, status: status\n end",
"def set_stats\n {\n \"projectId\": '1234',\n \"invalid\": 2,\n \"error\": 1,\n \"info\": 0,\n \"warning\": 2\n }\nend",
"def twitterapp_ratelimits\n\t\tTwitter.get('/1.1/application/rate_limit_status.json')[:body][:resources]\n\tend",
"def update\n @prd_threshold = PrdThreshold.find(params[:id])\n\n respond_to do |format|\n if @prd_threshold.update_attributes(params[:prd_threshold])\n format.html { redirect_to(@prd_threshold, :notice => 'PrdThreshold was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @prd_threshold.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n start_time = Time.now\n cpu_cores_number = check_cpu\n do_something(cpu_cores_number)\n end_time = Time.now\n @post = Post.new(body: end_time - start_time, title: \"cores were used: #{cpu_cores_number}\")\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_cpu_mem_thresholds_profile_with_http_info(profile_id, policy_firewall_cpu_mem_thresholds_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile\"\n end\n # verify the required parameter 'policy_firewall_cpu_mem_thresholds_profile' is set\n if @api_client.config.client_side_validation && policy_firewall_cpu_mem_thresholds_profile.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_firewall_cpu_mem_thresholds_profile' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile\"\n end\n # resource path\n local_var_path = '/global-infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'override'] = opts[:'override'] if !opts[:'override'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_firewall_cpu_mem_thresholds_profile)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyFirewallCpuMemThresholdsProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#update_cpu_mem_thresholds_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_notification_threshold(th,th_plus=th,i=0,asd=Hash.new,percent=th*0.25)\n asd[i] = {min: th_plus-percent,max: (th_plus+th)-percent}\n i == 3 ? (return asd) : (set_notification_threshold(th,th_plus*=2,i+=1,asd))\n end",
"def user_updated_query_threshold _user, query\n data = {\n category: 'Queries',\n action: 'Updated Query Threshold',\n label: query.query_text,\n value: nil,\n bounce: false,\n }\n\n create_event data\n end",
"def create\n @heartbeat = Heartbeat.new(params[:heartbeat])\n\n respond_to do |format|\n if @heartbeat.save\n format.html { redirect_to @heartbeat, notice: 'Heartbeat was successfully created.' }\n format.json { render json: @heartbeat, status: :created, location: @heartbeat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n metric = metrics.create(create_params)\n\n respond_with(metric)\n end",
"def status_params\n params.require(:status).permit(:counted)\n end",
"def syntetic_step_thresholds(values_range)\n return ->(idx) { values_range[idx] } if values_range.count == GRADES.count\n\n max, min = values_range.map(&:to_i)\n step = ((max - min) / GRADES.count.to_f).round(2)\n max.step(min, -step).to_a\n end",
"def relaxed_threshold(threshold)\n\t\tif threshold > @threshold_gap\n\t\t\trelaxed_threshold = threshold - @threshold_gap\n\t\telse\n\t\t\trelaxed_threshold = threshold\n\t\tend\n\t\trelaxed_threshold\n\tend",
"def create\n @throughput_metric = ThroughputMetric.new(throughput_metric_params)\n @throughput_metric.user_id = current_user.id\n\n respond_to do |format|\n if @throughput_metric.save\n format.html { redirect_to @throughput_metric, notice: 'Throughput metric was successfully created.' }\n format.json { render action: 'show', status: :created, location: @throughput_metric }\n else\n format.html { render action: 'new' }\n format.json { render json: @throughput_metric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n \t\t\t@penalty = Penalty.new penalty_params\n\n \t\t\tif @penalty.save\n\n \t\t\t\trender json: @penalty,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @penalty.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend",
"def value_metric_params\r\n params.require(:value_metric).permit(:min, :start, :max, :name , :description)\r\n end",
"def create\n battery = Battery.find(params[:battery_id])\n params[:cells].each_value do |test|\n test[:inserted_by] = current_user.full_name\n battery.battery_weekly_tests.build(test) unless test.values.all?(&:blank?)\n end\n \n respond_to do |format|\n if battery.save\n format.html { redirect_to station_batteries_path(battery.station), notice: 'Battery weekly test was successfully created.' }\n format.json { render json: @battery_weekly_test, status: :created, location: @battery_weekly_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @battery_weekly_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @neighborhood = Neighborhood.new(neighborhood_params)\n if @neighborhood.threshold.nil?\n @neighborhood.threshold = 100\n end\n @neighborhood.users << current_user\n @neighborhood.leads << current_user\n misc = Category.new()\n misc.name = 'Miscellaneous'\n misc.description = 'Default Category'\n @neighborhood.categories << misc\n if @neighborhood.save\n set_active\n else\n respond_to do |format|\n format.html { redirect_to neighborhoods_url }\n end\n end\n # respond_to do |format|\n # if @neighborhood.save\n # format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n # format.json { render :show, status: :created, location: @neighborhood }\n # else\n # format.html { render :new }\n # format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @grade_scale = GradeScale.new(params[:grade_scale])\n\n respond_to do |format|\n if @grade_scale.save\n format.json { render :json => @grade_scale, :status => :created, :location => @grade_scale }\n else\n format.json { render :json => @grade_scale.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def statistic_params\n params.require(:statistic).permit(:label,\n :percent_new_visit,\n :visit_bounce_rate, :avg_time_on_site, :page_views_per_visit,\n :hourly_daily_distribution0,\n :hourly_daily_distribution1,\n :hourly_daily_distribution2,\n :hourly_daily_distribution3,\n :hourly_daily_distribution4,\n :hourly_daily_distribution5,\n :hourly_daily_distribution6,\n :hourly_daily_distribution7,\n :hourly_daily_distribution8,\n :hourly_daily_distribution9,\n :hourly_daily_distribution10,\n :hourly_daily_distribution11,\n :hourly_daily_distribution12,\n :hourly_daily_distribution13,\n :hourly_daily_distribution14,\n :hourly_daily_distribution15,\n :hourly_daily_distribution16,\n :hourly_daily_distribution17,\n :hourly_daily_distribution18,\n :hourly_daily_distribution19,\n :hourly_daily_distribution20,\n :hourly_daily_distribution21,\n :hourly_daily_distribution22,\n :hourly_daily_distribution23)\n\n\n\n end"
] | [
"0.6966539",
"0.6436343",
"0.61232716",
"0.60181296",
"0.5961568",
"0.5955487",
"0.56774676",
"0.5563616",
"0.553094",
"0.55199975",
"0.5450079",
"0.541051",
"0.5317877",
"0.51938426",
"0.5158801",
"0.51015145",
"0.50843513",
"0.50095844",
"0.492647",
"0.492609",
"0.49013627",
"0.48936647",
"0.48776153",
"0.48529917",
"0.48224908",
"0.48091504",
"0.47917953",
"0.47888777",
"0.47843027",
"0.47829387",
"0.47735035",
"0.47652236",
"0.47642672",
"0.47583696",
"0.47479716",
"0.4732347",
"0.47238672",
"0.472378",
"0.47103128",
"0.4704853",
"0.47015357",
"0.46916005",
"0.4687611",
"0.4645924",
"0.4643868",
"0.46427765",
"0.46341595",
"0.4632716",
"0.46300465",
"0.46265724",
"0.46261215",
"0.4615769",
"0.46006927",
"0.45836535",
"0.4565854",
"0.4564775",
"0.4556735",
"0.4552798",
"0.45331907",
"0.45281276",
"0.45228544",
"0.45189327",
"0.45172924",
"0.45140183",
"0.45016828",
"0.44983658",
"0.44980544",
"0.44807503",
"0.44729954",
"0.4464165",
"0.44640878",
"0.44639394",
"0.44565976",
"0.44461438",
"0.44316995",
"0.44256246",
"0.44249958",
"0.4424778",
"0.44143972",
"0.44122723",
"0.4397484",
"0.43898642",
"0.43867955",
"0.43853205",
"0.4385204",
"0.43845865",
"0.43825722",
"0.43824723",
"0.43820378",
"0.4376037",
"0.43711886",
"0.43623078",
"0.43594342",
"0.43587816",
"0.43586838",
"0.43557352",
"0.43463466",
"0.4345535",
"0.43412742",
"0.43411717"
] | 0.71900964 | 0 |
PATCH/PUT /thresholds/1 PATCH/PUT /thresholds/1.json | def update
respond_to do |format|
if @threshold.update(threshold_params)
format.html { redirect_to thresholds_path, notice: 'Threshold was successfully updated.' }
format.json { render :show, status: :ok, location: @threshold }
else
format.html { render :edit }
format.json { render json: @threshold.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n if @threshold.update_attributes(params[:threshold])\n format.html { redirect_to @threshold, notice: 'Threshold was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_thresholds *thresholds\n unless thresholds.first.is_a? Hash\n return change_thresholds LEVELS[0, thresholds.size].zip(thresholds).to_h\n end\n thresholds.first.each do |k, new_threshold|\n next unless (badge = @badge[k])\n @badge.delete badge.threshold\n badge.threshold = new_threshold\n @badge[new_threshold] = badge\n end\n end",
"def update!(**args)\n @threshold = args[:threshold] if args.key?(:threshold)\n @value = args[:value] if args.key?(:value)\n end",
"def update(options={})\n data = Hash.new\n data[:type] = options[:type].upcase if options[:type]\n data[:delay] = options[:delay] if options[:delay]\n data[:timeout] = options[:timeout] if options[:timeout]\n data['attemptsBeforeDeactivation'] = options[:attempts_before_deactivation] if options[:attempts_before_deactivation]\n data[:type].upcase! if data[:type]\n if ['HTTP','HTTPS'].include?(data[:type])\n data[:path] = options[:path] if options[:path]\n data['statusRegex'] = options[:status_regex] if options[:status_regex]\n data['bodyRegex'] = options[:body_regex] if options[:body_regex]\n end\n response = @connection.lbreq(\"PUT\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/healthmonitor\",@lbmgmtport,@lbmgmtscheme,{},data.to_json)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n populate\n true\n end",
"def update!(**args)\n @confidence_threshold = args[:confidence_threshold] if args.key?(:confidence_threshold)\n end",
"def update\n @prd_threshold = PrdThreshold.find(params[:id])\n\n respond_to do |format|\n if @prd_threshold.update_attributes(params[:prd_threshold])\n format.html { redirect_to(@prd_threshold, :notice => 'PrdThreshold was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @prd_threshold.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @metric_requests = args[:metric_requests] if args.key?(:metric_requests)\n @time_range = args[:time_range] if args.key?(:time_range)\n end",
"def update!(**args)\n @metric_requests = args[:metric_requests] if args.key?(:metric_requests)\n @time_range = args[:time_range] if args.key?(:time_range)\n end",
"def set_threshold\n @threshold = Threshold.find(params[:id])\n end",
"def update!(**args)\n @severity_overrides = args[:severity_overrides] if args.key?(:severity_overrides)\n @threat_overrides = args[:threat_overrides] if args.key?(:threat_overrides)\n end",
"def update\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n if @heartbeat.update_attributes(params[:heartbeat])\n format.html { redirect_to @heartbeat, notice: 'Heartbeat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @heartbeat = Heartbeat.find(params[:id])\n\n if @heartbeat.update(heartbeat_params)\n head :no_content\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end",
"def update\n @deposit_threshold = DepositThreshold.find(params[:id])\n\n respond_to do |format|\n if @deposit_threshold.update_attributes(params[:deposit_threshold])\n format.html { redirect_to(@deposit_threshold, :notice => 'DepositThreshold was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @deposit_threshold.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n if @gauge.update_attributes(params[:gauge])\n format.html { redirect_to @gauge, notice: 'Gauge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gauge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attribution_score_drift_thresholds = args[:attribution_score_drift_thresholds] if args.key?(:attribution_score_drift_thresholds)\n @default_drift_threshold = args[:default_drift_threshold] if args.key?(:default_drift_threshold)\n @drift_thresholds = args[:drift_thresholds] if args.key?(:drift_thresholds)\n end",
"def update\n respond_to do |format|\n if @severity_level.update(severity_level_params)\n format.html do\n redirect_to @severity_level,\n notice: 'Severity level was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @severity_level }\n else\n format.html { render :edit }\n format.json { render json: @severity_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch(path, **args); end",
"def update\n metric.update_attributes(update_params)\n\n respond_with(metric)\n end",
"def patch_cpu_mem_thresholds_profile_0_with_http_info(profile_id, policy_firewall_cpu_mem_thresholds_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile_0 ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile_0\"\n end\n # verify the required parameter 'policy_firewall_cpu_mem_thresholds_profile' is set\n if @api_client.config.client_side_validation && policy_firewall_cpu_mem_thresholds_profile.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_firewall_cpu_mem_thresholds_profile' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile_0\"\n end\n # resource path\n local_var_path = '/infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'override'] = opts[:'override'] if !opts[:'override'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_firewall_cpu_mem_thresholds_profile)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#patch_cpu_mem_thresholds_profile_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end",
"def update(id:, match:, action:, threshold:, period:, disabled: nil, description: nil, bypass: nil)\n id_check('id', id)\n common_checks(match, action, threshold, period)\n\n data = {match: match, threshold: threshold, period: period, action: action}\n data[:id] = id unless id.nil?\n data[:description] = description unless description.nil?\n\n unless disabled.nil?\n valid_value_check(:disabled, disabled, [true, false])\n data[:disabled] = disabled\n end\n\n cf_put(path: \"/zones/#{zone_id}/rate_limits/#{id}\", data: data)\n end",
"def update \n if @tuning.update(tuning_params)\n render json: @tuning\n else\n render json: { error: \"Failed to update tuning\"}, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @severity.update(severity_params)\n format.html { redirect_to @severity, notice: 'Severity was successfully updated.' }\n format.json { render :show, status: :ok, location: @severity }\n else\n format.html { render :edit }\n format.json { render json: @severity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def threshold_params\n params.require(:threshold).permit(:sensor_id, :comparing_string, :comparing_value, :status, :action)\n end",
"def update!(**args)\n @is_bandwidth_throttle = args[:is_bandwidth_throttle] if args.key?(:is_bandwidth_throttle)\n @max_allowed_rate = args[:max_allowed_rate] if args.key?(:max_allowed_rate)\n end",
"def enable_alert_feature \n put(\"/globalsettings.json/alerts/enable\")\nend",
"def update\n respond_to do |format|\n if @health_level.update_attributes(params[:health_level])\n format.html { redirect_to @health_level, notice: 'Health level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @health_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n if @base_objective.update(base_objective_params)\n head 200\n end\n end",
"def update!(**args)\n @confidence_metrics = args[:confidence_metrics] if args.key?(:confidence_metrics)\n @iou_threshold = args[:iou_threshold] if args.key?(:iou_threshold)\n @mean_average_precision = args[:mean_average_precision] if args.key?(:mean_average_precision)\n end",
"def update\n @metric = Metric.find(params[:id])\n\n if @metric.update(params[:metric])\n head :no_content\n else\n render json: @metric.errors, status: :unprocessable_entity\n end\n end",
"def create\n @threshold = Threshold.new(threshold_params)\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to thresholds_path, notice: 'Threshold was successfully created.' }\n format.json { render :show, status: :created, location: @threshold }\n else\n format.html { render :new }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def disable_alert_feature \n put(\"/globalsettings.json/alerts/disable\")\nend",
"def update\n @feat = @person.feats.find(params[:id])\n level_old = @person.level\n\n if params[:feat][:completed] == '1'\n @feat.complete\n else\n @feat.uncomplete\n end\n sign = params[:feat][:completed] == '1' ? '+': '-'\n \n has_leveled = @person.level > level_old\n\n respond_to do |format|\n format.json { render :json => {\n :xpGained => \"#{sign}#{@feat.xp}\",\n :xpTotal => @person.xp,\n :next_level_ratio => @person.next_level_ratio,\n :extra_life => @person.level_to_string,\n :has_leveled => has_leveled,\n :completed => @feat.completed,\n :streak => @feat.calculate_streak}}\n \n end\n\n end",
"def update_cpu_mem_thresholds_profile_0_with_http_info(profile_id, policy_firewall_cpu_mem_thresholds_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile_0 ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile_0\"\n end\n # verify the required parameter 'policy_firewall_cpu_mem_thresholds_profile' is set\n if @api_client.config.client_side_validation && policy_firewall_cpu_mem_thresholds_profile.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_firewall_cpu_mem_thresholds_profile' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile_0\"\n end\n # resource path\n local_var_path = '/infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'override'] = opts[:'override'] if !opts[:'override'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_firewall_cpu_mem_thresholds_profile)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyFirewallCpuMemThresholdsProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#update_cpu_mem_thresholds_profile_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update!(**args)\n @confidence_metrics = args[:confidence_metrics] if args.key?(:confidence_metrics)\n @iou_threshold = args[:iou_threshold] if args.key?(:iou_threshold)\n @mean_bounding_box_iou = args[:mean_bounding_box_iou] if args.key?(:mean_bounding_box_iou)\n @mean_mismatch_rate = args[:mean_mismatch_rate] if args.key?(:mean_mismatch_rate)\n @mean_tracking_average_precision = args[:mean_tracking_average_precision] if args.key?(:mean_tracking_average_precision)\n end",
"def update\n @throughput_metric.user_id = current_user.id\n \n respond_to do |format|\n if @throughput_metric.update(throughput_metric_params)\n format.html { redirect_to @throughput_metric, notice: 'Throughput metric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @throughput_metric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_firewall_priority project:, name:, allowed:, priority:\n allowed_arr = allowed.map do |instance|\n {\n I_p_protocol: instance.I_p_protocol,\n ports: instance.ports.to_a\n }\n end.to_a\n\n rule = {\n priority: priority,\n allowed: allowed_arr\n }\n\n request = {\n project: project,\n firewall: name,\n firewall_resource: rule\n }\n\n # The patch operation doesn't require the full definition of a Firewall object. It will only update\n # the values that were set in it, in this case it will only change the priority.\n client = ::Google::Cloud::Compute::V1::Firewalls::Rest::Client.new\n operation = client.patch request\n\n wait_until_done operation: operation\nend",
"def patch_tier1_0_with_http_info(tier_1_id, tier1, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1_0\"\n end\n # verify the required parameter 'tier1' is set\n if @api_client.config.client_side_validation && tier1.nil?\n fail ArgumentError, \"Missing the required parameter 'tier1' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tier1)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#patch_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @categorical_threshold_config = args[:categorical_threshold_config] if args.key?(:categorical_threshold_config)\n @import_features_analysis = args[:import_features_analysis] if args.key?(:import_features_analysis)\n @numerical_threshold_config = args[:numerical_threshold_config] if args.key?(:numerical_threshold_config)\n @snapshot_analysis = args[:snapshot_analysis] if args.key?(:snapshot_analysis)\n end",
"def update\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n respond_to do |format|\n if @loadbalancer.update_attributes(params[:loadbalancer])\n format.html { redirect_to @loadbalancer, notice: 'Loadbalancer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @loadbalancer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_cpu_mem_thresholds_profile_with_http_info(profile_id, policy_firewall_cpu_mem_thresholds_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile\"\n end\n # verify the required parameter 'policy_firewall_cpu_mem_thresholds_profile' is set\n if @api_client.config.client_side_validation && policy_firewall_cpu_mem_thresholds_profile.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_firewall_cpu_mem_thresholds_profile' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.patch_cpu_mem_thresholds_profile\"\n end\n # resource path\n local_var_path = '/global-infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'override'] = opts[:'override'] if !opts[:'override'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_firewall_cpu_mem_thresholds_profile)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#patch_cpu_mem_thresholds_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @risk_level = RiskLevel.find(params[:id])\n\n respond_to do |format|\n if @risk_level.update_attributes(params[:risk_level])\n format.html { redirect_to(current_risk_configuration, :notice => 'Risk level was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @risk_level.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @request_status = RequestStatus.find(params[:id])\n\n respond_to do |format|\n if @request_status.update_attributes(params[:request_status])\n format.html { redirect_to @request_status, notice: 'Request status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_tier1_with_http_info(tier_1_id, tier1, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1\"\n end\n # verify the required parameter 'tier1' is set\n if @api_client.config.client_side_validation && tier1.nil?\n fail ArgumentError, \"Missing the required parameter 'tier1' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tier1)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#patch_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @operations_check = OperationsCheck.find(params[:operations_check_id])\n @load_balancer_check = @operations_check.load_balancer_checks.find(params[:id])\n\n respond_to do |format|\n if @load_balancer_check.update_attributes(load_balancer_check_params)\n format.html { redirect_to @load_balancer_check, notice: 'Load balancer check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @load_balancer_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @contexts = args[:contexts] if args.key?(:contexts)\n @status = args[:status] if args.key?(:status)\n @time_range = args[:time_range] if args.key?(:time_range)\n end",
"def update\n respond_to do |format|\n if @health_status.update(health_status_params)\n format.html { redirect_to @health_status, notice: 'Health status was successfully updated.' }\n format.json { render :show, status: :ok, location: @health_status }\n else\n format.html { render :edit }\n format.json { render json: @health_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @scale = args[:scale] if args.key?(:scale)\n @status = args[:status] if args.key?(:status)\n end",
"def patch_resource(payload)\n execute(resource_path, method: :patch, payload: payload.to_json)\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update!(**args)\n @desired_min_safe_trials_fraction = args[:desired_min_safe_trials_fraction] if args.key?(:desired_min_safe_trials_fraction)\n @safety_threshold = args[:safety_threshold] if args.key?(:safety_threshold)\n end",
"def create\n @threshold = Threshold.new(params[:threshold])\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to @threshold, notice: 'Threshold was successfully created.' }\n format.json { render json: @threshold, status: :created, location: @threshold }\n else\n format.html { render action: \"new\" }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @requirement_priority = RequirementPriority.find(params[:id])\n\n respond_to do |format|\n if @requirement_priority.update_attributes(params[:requirement_priority])\n format.html { redirect_to @requirement_priority, :notice => 'Requirement priority was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @requirement_priority.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def bump_patch\n @patch += 1\n self.save\n end",
"def update\n respond_to do |format|\n if @metric_speedtest.update(metric_speedtest_params)\n format.html { redirect_to @metric_speedtest, notice: 'Metric speedtest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @metric_speedtest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def modify\n debug(\"#{self.class}::modify\")\n\n\n #Retrieval of key\n if ((defined? $key) && !(($key.nil?) || ($key.empty?)))\n Puppet.debug('INFO: key already provided as a command parameter ' + $key)\n\n elsif (!($name.to_s.empty?) )\n\n #Retrieve key\n uriAttributeMap1 = {}\n uriAttributeMap1[:name] = $name\n resourceType = \"storage-service-levels\"\n $key = self.retrieveKeyOfObjectType('/api/1.0/slo/storage-service-levels', resourceType, uriAttributeMap1)\n end\n apiUri = '/api/1.0/slo/storage-service-levels/'+$key\n\n\n\n @payload = {}\n if !($description.to_s.empty?)\n @payload[:description] = $description\n end\n if !($peak_latency.to_s.empty?)\n @payload[:peak_latency] = $peak_latency\n end\n if !($peak_iops_per_tb.to_s.empty?)\n @payload[:peak_iops_per_tb] = $peak_iops_per_tb\n end\n if !($expected_iops_per_tb.to_s.empty?)\n @payload[:expected_iops_per_tb] = $expected_iops_per_tb\n end\n resourceType = \"storageservicelevel\"\n\n if(transport.http_put_request(apiUri , @payload.to_json , resourceType))\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully modified\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully modified\"\n end\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully modified\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully modified\"\n end\n else\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} modification failed\"\n\t\t else\n\t\t puts \" #{resourceType} modification failed\"\n end\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} modification failed\"\n\t\t else\n\t\t puts \" #{resourceType} modification failed\"\n end\n end\n\n end",
"def metric_update(statuspage_id, metric_id, day_avg, day_start, day_dates, day_values,\n week_avg, week_start, week_dates, week_values,\n month_avg, month_start, month_dates, month_values)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['metric_id'] = metric_id\n data['day_avg'] = day_avg\n data['day_start'] = day_start\n data['day_dates'] = day_dates\n data['day_values'] = day_values\n data['week_avg'] = week_avg\n data['week_start'] = week_start\n data['week_dates'] = week_dates\n data['week_values'] =week_values\n data['month_avg'] = month_avg\n data['month_start'] = month_start\n data['month_dates'] = month_dates\n data['month_values'] = month_values\n\n request :method => :post,\n :url => @url + 'metric/update',\n :payload => data\n end",
"def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @alert = Alert.find(params[:id])\n notifiers = Hash.new\n User.find(params[:notifiers]).each{|user| notifiers[user.id] = 0}\n @alert.notifiers = notifiers\n @alert.host = params[:host]\n @alert.trigger = params[:trigger]\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hit_value = HitValue.find(params[:id])\n\n respond_to do |format|\n if @hit_value.update_attributes(params[:hit_value])\n format.html { redirect_to @hit_value, notice: 'Hit value was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hit_value.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @metric_type = MetricType.find(params[:id])\n\n respond_to do |format|\n if @metric_type.update_attributes(params[:metric_type])\n format.html { redirect_to @metric_type, notice: 'Metric type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metric_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @confidence_threshold = args[:confidence_threshold] if args.key?(:confidence_threshold)\n @f1_score = args[:f1_score] if args.key?(:f1_score)\n @precision = args[:precision] if args.key?(:precision)\n @recall = args[:recall] if args.key?(:recall)\n end",
"def update!(**args)\n @confidence_threshold = args[:confidence_threshold] if args.key?(:confidence_threshold)\n @f1_score = args[:f1_score] if args.key?(:f1_score)\n @precision = args[:precision] if args.key?(:precision)\n @recall = args[:recall] if args.key?(:recall)\n end",
"def update!(**args)\n @confidence_threshold = args[:confidence_threshold] if args.key?(:confidence_threshold)\n @f1_score = args[:f1_score] if args.key?(:f1_score)\n @precision = args[:precision] if args.key?(:precision)\n @recall = args[:recall] if args.key?(:recall)\n end",
"def update\n @crate_priority = CratePriority.find(params[:id])\n\n respond_to do |format|\n if @crate_priority.update_attributes(params[:crate_priority])\n format.html { redirect_to @crate_priority, :notice => 'Crate priority was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crate_priority.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fligh_scale = FlighScale.find(params[:id])\n\n respond_to do |format|\n if @fligh_scale.update_attributes(params[:fligh_scale])\n format.html { redirect_to @fligh_scale, notice: 'Fligh scale was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fligh_scale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_cpu_mem_thresholds_profile_with_http_info(profile_id, policy_firewall_cpu_mem_thresholds_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile\"\n end\n # verify the required parameter 'policy_firewall_cpu_mem_thresholds_profile' is set\n if @api_client.config.client_side_validation && policy_firewall_cpu_mem_thresholds_profile.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_firewall_cpu_mem_thresholds_profile' when calling PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi.update_cpu_mem_thresholds_profile\"\n end\n # resource path\n local_var_path = '/global-infra/settings/firewall/cpu-mem-thresholds-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'override'] = opts[:'override'] if !opts[:'override'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(policy_firewall_cpu_mem_thresholds_profile)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyFirewallCpuMemThresholdsProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesCpuMemoryThresholdsProfilesApi#update_cpu_mem_thresholds_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def metric_update_params\n params.require(:metric).permit(:value)\n end",
"def update\n @task_metric = TaskMetric.find(params[:id])\n\n respond_to do |format|\n if @task_metric.update_attributes(params[:task_metric])\n format.html { redirect_to @task_metric, :notice => 'Task metric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task_metric.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update!(**args)\n @latency_percentiles = args[:latency_percentiles] if args.key?(:latency_percentiles)\n end",
"def index\n @thresholds = Threshold.all\n end",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update!(**args)\n @attribution_score_skew_thresholds = args[:attribution_score_skew_thresholds] if args.key?(:attribution_score_skew_thresholds)\n @default_skew_threshold = args[:default_skew_threshold] if args.key?(:default_skew_threshold)\n @skew_thresholds = args[:skew_thresholds] if args.key?(:skew_thresholds)\n end",
"def update\n authorize! :update, @impact_level\n respond_to do |format|\n if @impact_level.update(impact_level_params)\n format.html { redirect_to @impact_level, notice: 'Impact level was successfully updated.' }\n format.json { render :show, status: :ok, location: @impact_level }\n else\n format.html { render :edit }\n format.json { render json: @impact_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reqpriority.update(reqpriority_params)\n format.html { redirect_to @reqpriority, notice: 'Reqpriority was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reqpriority.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_tier0_with_http_info(tier_0_id, tier0, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.patch_tier0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.patch_tier0\"\n end\n # verify the required parameter 'tier0' is set\n if @api_client.config.client_side_validation && tier0.nil?\n fail ArgumentError, \"Missing the required parameter 'tier0' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.patch_tier0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tier0)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#patch_tier0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @interval_constraint.update(interval_constraint_params)\n format.html { redirect_to @interval_constraint, notice: 'Interval constraint was successfully updated.' }\n format.json { render :show, status: :ok, location: @interval_constraint }\n else\n format.html { render :edit }\n format.json { render json: @interval_constraint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @confidence_threshold = args[:confidence_threshold] if args.key?(:confidence_threshold)\n @max_predictions = args[:max_predictions] if args.key?(:max_predictions)\n @one_sec_interval_classification = args[:one_sec_interval_classification] if args.key?(:one_sec_interval_classification)\n @segment_classification = args[:segment_classification] if args.key?(:segment_classification)\n @shot_classification = args[:shot_classification] if args.key?(:shot_classification)\n end",
"def update\n @request = Request.find(params[:id])\n\n if params['approved']\n @request.status = Request.statuses[:approved]\n elsif params['denied']\n @request.status = Request.statuses[:denied]\n end\n\n if @request.update_attributes(update_params)\n Mailer.mail_status(@request).deliver_later\n redirect_to employee_requests_path\n else\n render 'show'\n end\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @cluster_id = args[:cluster_id] if args.key?(:cluster_id)\n @throttled = args[:throttled] if args.key?(:throttled)\n end",
"def update!(**args)\n @confidence_threshold = args[:confidence_threshold] if args.key?(:confidence_threshold)\n @max_predictions = args[:max_predictions] if args.key?(:max_predictions)\n end",
"def update!(**args)\n @confidence_threshold = args[:confidence_threshold] if args.key?(:confidence_threshold)\n @max_predictions = args[:max_predictions] if args.key?(:max_predictions)\n end",
"def update!(**args)\n @confidence_threshold = args[:confidence_threshold] if args.key?(:confidence_threshold)\n @max_predictions = args[:max_predictions] if args.key?(:max_predictions)\n end"
] | [
"0.6908464",
"0.6423047",
"0.6135383",
"0.5685925",
"0.5647299",
"0.5636884",
"0.5538382",
"0.5538382",
"0.55133283",
"0.54966605",
"0.5445029",
"0.5441752",
"0.5426735",
"0.5401405",
"0.53695375",
"0.53661764",
"0.5365714",
"0.5361594",
"0.53432304",
"0.53278357",
"0.5318644",
"0.5310164",
"0.5309999",
"0.5283055",
"0.52789605",
"0.5269297",
"0.5243126",
"0.52415776",
"0.52403045",
"0.5225045",
"0.52156734",
"0.5215202",
"0.5212012",
"0.5209775",
"0.51907027",
"0.518254",
"0.5181479",
"0.5179667",
"0.51715934",
"0.5165026",
"0.5163848",
"0.5153004",
"0.51489896",
"0.5145611",
"0.5144173",
"0.51412183",
"0.5137451",
"0.51299876",
"0.51193047",
"0.51193047",
"0.51193047",
"0.51193047",
"0.51144576",
"0.51091087",
"0.51090896",
"0.51047665",
"0.50903445",
"0.50787824",
"0.5060062",
"0.5054882",
"0.50463694",
"0.50445926",
"0.5043389",
"0.5039175",
"0.50373244",
"0.5033599",
"0.50329703",
"0.50322676",
"0.50303936",
"0.50303936",
"0.50303936",
"0.5029907",
"0.5027393",
"0.50220424",
"0.5016008",
"0.501266",
"0.50108105",
"0.5010305",
"0.5010305",
"0.5008121",
"0.5003021",
"0.50013304",
"0.49995127",
"0.49973854",
"0.49952897",
"0.4994489",
"0.49942282",
"0.4985678",
"0.49802214",
"0.49691984",
"0.4963748",
"0.4963748",
"0.4963748",
"0.4963748",
"0.4963748",
"0.4963748",
"0.49617815",
"0.4957645",
"0.4957645",
"0.4957645"
] | 0.7070543 | 0 |
DELETE /thresholds/1 DELETE /thresholds/1.json | def destroy
@threshold.destroy
respond_to do |format|
format.html { redirect_to thresholds_url, notice: 'Threshold was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @threshold = Threshold.find(params[:id])\n @threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to thresholds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prd_threshold = PrdThreshold.find(params[:id])\n @prd_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @configattribincl.destroy\n respond_to do |format|\n format.html { redirect_to configattribs_path, notice: 'Configattribincl Threshold is reset to default.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @throughput_metric.destroy\n respond_to do |format|\n format.html { redirect_to throughput_metrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @health_level.destroy\n\n respond_to do |format|\n format.html { redirect_to health_levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n head :no_content\n end",
"def destroy\n authorize! :manage, @vspec\n metric = @vspec.metric\n @vspec.destroy\n respond_to do |format|\n format.html { redirect_to [metric.service, metric] }\n format.json { head :no_content }\n end\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @metric_speedtest.destroy\n respond_to do |format|\n format.html { redirect_to metric_speedtests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_sub_metric.destroy\n respond_to do |format|\n format.html { redirect_to admin_sub_metrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heartbeat.destroy\n\n head :no_content\n end",
"def destroy\n @severity.destroy\n respond_to do |format|\n format.html { redirect_to severities_url, notice: 'Severity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to \"/dashboard\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health_record.destroy\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metric_type = MetricType.find(params[:id])\n @metric_type.destroy\n\n respond_to do |format|\n format.html { redirect_to metric_types_url }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check('id', id)\n\n cf_delete(path: \"/zones/#{zone_id}/rate_limits/#{id}\")\n end",
"def destroy\n @severity_level.destroy\n respond_to do |format|\n format.html do\n redirect_to severity_levels_url,\n notice: 'Severity level was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n metric.destroy\n\n respond_with(metric)\n end",
"def destroy\n @badge.destroy\n respond_to do |format|\n format.html { redirect_to(admin_badges_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted badge: #{@badge.name}\")\n end",
"def destroy\n @backend_stat = Backend::Stat.find(params[:id])\n @backend_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n Metric.find_by_metric_id(@value_metric.id).destroy\r\n #Metric.find(idx).destroy\r\n @value_metric.destroy\r\n respond_to do |format|\r\n format.html { redirect_to @game, notice: 'Value metric was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @hit_value = HitValue.find(params[:id])\n @hit_value.destroy\n\n respond_to do |format|\n format.html { redirect_to hit_values_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health_record = HealthRecord.find(params[:id])\n @health_record.destroy\n\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end",
"def maintenance_delete(statuspage_id, maintenance_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n\n request :method => :post,\n :url => @url + 'maintenance/delete',\n :payload => data\n end",
"def destroy\n operations_check = OperationsCheck.find(params[:operations_check_id])\n @load_balancer_check = LoadBalancerCheck.find(params[:id])\n @load_balancer_check.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_check_path(operations_check, tab: \"load_balancers\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health_status.destroy\n respond_to do |format|\n format.html { redirect_to health_statuses_url, notice: 'Health status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @task_metric = TaskMetric.find(params[:id])\n @task_metric.destroy\n\n respond_to do |format|\n format.html { redirect_to task_metrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end",
"def delete_uptime_check_config config_name\n require \"google/cloud/monitoring\"\n\n client = Google::Cloud::Monitoring.uptime_check_service\n client.delete_uptime_check_config name: config_name\n puts \"Deleted #{config_name}\"\nend",
"def destroy\n @metric_type = MetricType.find(params[:id])\n @metric_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(metric_types_url) }\n format.xml { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @bg_check.destroy\n respond_to do |format|\n format.html { redirect_to bg_checks_url }\n format.json { head :no_content }\n end\n end",
"def delete_all_metrics\n connection = Librato::Metrics.client.connection\n Librato::Metrics.list.each do |metric|\n #puts \"deleting #{metric['name']}...\"\n # expects 204\n connection.delete(\"metrics/#{metric['name']}\")\n end\n end",
"def destroy\n @risk_level = RiskLevel.find(params[:id])\n @risk_level.destroy\n\n respond_to do |format|\n format.html { redirect_to(current_risk_configuration) }\n format.json { head :ok }\n end\n end",
"def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to healths_url, notice: 'Health was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @logstash = Logstash.find(params[:id])\n @logstash.destroy\n\n respond_to do |format|\n format.html { redirect_to logstashes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @study.destroy\n\tStudy.adjustThreshold # readjust after destruction\n respond_to do |format|\n format.html { redirect_to studies_url, notice: 'Study was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_status = RequestStatus.find(params[:id])\n @request_status.destroy\n\n respond_to do |format|\n format.html { redirect_to request_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metric.destroy\n respond_to do |format|\n format.html { redirect_to metrics_url, notice: 'Metric was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reqpriority.destroy\n respond_to do |format|\n format.html { redirect_to reqpriorities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gateway_stat.destroy\n respond_to do |format|\n format.html { redirect_to gateway_stats_url, notice: 'Gateway stat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @statistic.destroy\n respond_to do |format|\n format.html { redirect_to statistics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kf_status = Kf::Status.find(params[:id])\n @kf_status.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n respond_to do |format|\n format.html { redirect_to metrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n @unidade_metrica.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cabinet_balancer.destroy\n respond_to do |format|\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_progress.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_progresses_url, notice: 'Progress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_request.destroy\n respond_to do |format|\n format.html { redirect_to status_requests_url, notice: 'Status request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end",
"def destroy\n @reqstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqstatuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sa_request_status.destroy\n respond_to do |format|\n format.html { redirect_to sa_request_statuses_url, notice: 'Sa request status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_monitor monitor_name\n response = RestClient.delete(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/monitors/#{monitor_name}\",\n :content_type => :json,\n :accept => :json,\n :'X-Auth-Token' => @keystone_token)\n raise LBModelException.new \"Expected HTTP 202 but got #{response.code} instead\" unless response.code == 202\n\n parse_jobids response\n end",
"def destroy\n @interval_constraint.destroy\n respond_to do |format|\n format.html { redirect_to interval_constraints_url, notice: 'Interval constraint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @key_metric = KeyMetric.find(params[:id])\n @key_metric.destroy\n\n respond_to do |format|\n format.html { redirect_to(key_metrics_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @user_reported_statistic = UserReportedStatistic.find(params[:id])\n @user_reported_statistic.destroy\n\n respond_to do |format|\n format.html { redirect_to user_reported_statistics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @therapy_budget.destroy\n respond_to do |format|\n format.html { redirect_to therapy_budgets_url, notice: 'Therapy budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n ensure_service!\n service.delete_metric name\n true\n end",
"def destroy\n @system_stat.destroy\n respond_to do |format|\n format.html { redirect_to system_stats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixturestat = Fixturestat.find(params[:id])\n @fixturestat.destroy\n\n respond_to do |format|\n format.html { redirect_to fixturestats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @load_balancer_policy = LoadBalancerPolicy.find(params[:id])\n @load_balancer_policy.destroy\n\n respond_to do |format|\n format.html { redirect_to(load_balancer_policies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n debug(\"#{self.class}::destroy\")\n\n #Retrieval of key\n if ((defined? $key) && !(($key.nil?) || ($key.empty?)))\n Puppet.debug('INFO: key already provided as a command parameter ' + $key)\n\n elsif (!($name.to_s.empty?) )\n\n #Retrieve key\n uriAttributeMap1 = {}\n uriAttributeMap1[:name] = $name\n resourceType = \"storage-service-levels\"\n $key = self.retrieveKeyOfObjectType('/api/1.0/slo/storage-service-levels', resourceType, uriAttributeMap1)\n\n end\n\n\n apiUri = '/api/1.0/slo/storage-service-levels/'+$key\n resourceType = \"storageservicelevel\"\n\n if(transport.http_delete_request(apiUri ,resourceType))\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully deleted\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully deleted\"\n\t\t\tend\n else\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} deletion failed\"\n\t\t else\n\t\t\t puts \" #{resourceType} deletion failed\"\n\t\t end\n end\n\nend",
"def destroy\n @level.destroy\n respond_to do |format|\n format.html { redirect_to levels_url }\n format.json { head :no_content }\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def destroy\n @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end",
"def delete_heartbeat(id)\n Record.with(collection: \"#{self.class.name.demodulize.downcase}_heartbeat\") do |m|\n m.where(id: id).delete\n end\n end",
"def destroy\n @badge.destroy\n respond_to do |format|\n format.html { redirect_to badges_url, notice: 'Badge was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n head :no_content\n end",
"def destroy\n @fligh_scale = FlighScale.find(params[:id])\n @fligh_scale.destroy\n\n respond_to do |format|\n format.html { redirect_to fligh_scales_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @agent_status = AgentStatus.find(params[:id])\n @agent_status.destroy\n\n respond_to do |format|\n format.html { redirect_to agent_statuses_url }\n format.json { head :no_content }\n end\n end",
"def DeleteTrigger id\n \n APICall(path: \"triggers/#{id}.json\",method: 'DELETE')\n \n end",
"def delete_status(id)\n delete(\"/statuses/#{id}\")\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @trap = Trap.find(params[:id])\n @trap.destroy\n\n respond_to do |format|\n format.html { redirect_to traps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @healthpro.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def delete; update(:status => 'DELETED'); end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @quantile_setting = QuantileSetting.find(params[:id])\n @quantile_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to quantile_settings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stat_misc = StatMisc.find(params[:id])\n @stat_misc.destroy\n\n respond_to do |format|\n format.html { redirect_to stat_miscs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @active_stat = ActiveStat.find(params[:id])\n @active_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to active_stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @gauge_graph.destroy\n respond_to do |format|\n format.html { redirect_to gauge_graphs_url, notice: 'Gauge graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @human_condition = HumanCondition.find(params[:id])\n @human_condition.destroy\n\n respond_to do |format|\n format.html { redirect_to human_conditions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heat_log = HeatLog.find(params[:id])\n @heat_log.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sampled_url = SampledUrl.find(params[:id])\n @sampled_url.destroy\n\n respond_to do |format|\n format.html { redirect_to sampled_urls_url }\n format.json { head :no_content }\n end\n end",
"def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end",
"def destroy\n @statistic.destroy\n respond_to do |format|\n format.html { redirect_to statistics_url, notice: 'Statistic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @statistic.destroy\n respond_to do |format|\n format.html { redirect_to statistics_url, notice: 'Statistic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @statistic.destroy\n respond_to do |format|\n format.html { redirect_to statistics_url, notice: 'Statistic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.7635639",
"0.6575579",
"0.64611566",
"0.6421593",
"0.63860756",
"0.62113523",
"0.6180906",
"0.61196035",
"0.61111253",
"0.6030906",
"0.6022729",
"0.5962589",
"0.5922817",
"0.59216017",
"0.5919271",
"0.58847916",
"0.58829063",
"0.58793896",
"0.58757776",
"0.58661294",
"0.58385813",
"0.58326626",
"0.5812762",
"0.579757",
"0.5794936",
"0.5791955",
"0.57919073",
"0.5790808",
"0.5783916",
"0.573958",
"0.57307166",
"0.5715009",
"0.57147413",
"0.5710192",
"0.57055515",
"0.56845707",
"0.5681065",
"0.56725043",
"0.56560487",
"0.5655012",
"0.5649484",
"0.56480503",
"0.56417537",
"0.56404924",
"0.5629206",
"0.5629206",
"0.5626455",
"0.5619441",
"0.56184876",
"0.5611285",
"0.5609982",
"0.5608622",
"0.56050473",
"0.5600013",
"0.55949986",
"0.55922973",
"0.5569081",
"0.5566926",
"0.5566402",
"0.55652666",
"0.5554001",
"0.55456775",
"0.5543766",
"0.55434906",
"0.554121",
"0.5538666",
"0.5538209",
"0.55378526",
"0.5537616",
"0.55280566",
"0.5527116",
"0.55131656",
"0.55117124",
"0.5507741",
"0.55066144",
"0.5502942",
"0.5501356",
"0.55013317",
"0.55003226",
"0.54998773",
"0.549643",
"0.5496045",
"0.5492074",
"0.54853714",
"0.54838026",
"0.548271",
"0.5473674",
"0.5470331",
"0.5469178",
"0.5466454",
"0.5464861",
"0.5463228",
"0.54614186",
"0.5457358",
"0.5456361",
"0.54558504",
"0.54538524",
"0.5450773",
"0.5450773",
"0.5450773"
] | 0.7300227 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_threshold
@threshold = Threshold.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def threshold_params
params.require(:threshold).permit(:sensor_id, :comparing_string, :comparing_value, :status, :action)
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
GET /presses/1 GET /presses/1.json | def show
@press = Press.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @press }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @presses = Press.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @presses }\n end\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end",
"def show\n user = User.find(params[:id])\n render json: user.address\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def index\n @ips = Ip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ips }\n end\n end",
"def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"def index\n @adresses = Adress.all\n end",
"def show\n @adress = Adresse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adress }\n end\n end",
"def show\n authorize @address\n\n @histories = History.where(\n address_id: @address.id).paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n authorize @histories\n\n respond_to do |format|\n format.html\n format.json { render json: {pk: @address.id,\n ip: @address.ip,\n locale: I18n.locale} }\n end\n end",
"def get_address\n booking = Booking.where(user_id: current_user.id).last\n pick_up_addr = PickupAddress.where(:booking_id => booking.id).last\n drop_off_addr = DropoffAddress.where(:booking_id => booking.id).last\n hash = {:pick_up_addr => pick_up_addr.address, :drop_off_addr => drop_off_addr.address}\n respond_to do |format|\n format.json { render :json => hash.to_json, :status => 200 }\n end\n end",
"def show\n @ip = Ip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ip }\n end\n end",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend",
"def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def show\n @ip = @customer.ips.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ip }\n end\n end",
"def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend",
"def index\n render json: reservations\n end",
"def index\n @phones = Phone.all\n json_response(@phones)\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def show\n render json: @iprange \n end",
"def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend",
"def show\n @host = Host.find_by(hostname: params[:id])\n\n render json: @host\n end",
"def index\n render json: Client.all\n end",
"def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end",
"def index\n @destinations = Destination.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @destinations }\n end\n end",
"def index\n @ripple_addresses = RippleAddress.all\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def show\n @click_thru = ClickThru.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @click_thru }\n end\n end",
"def index\n trips = Trip.all\n respond_with trips\n end",
"def get_address(street_number:, street:, city:, state:, zip:)\n response = RestClient.get \"https://geocoding.geo.census.gov/geocoder/locations/onelineaddress?address=#{street_number}+#{street}%2C+#{city}%2C+#{state}+#{zip}&benchmark=9&format=json\"\n json = JSON.parse(response.body)\n end",
"def index\n render json: @places\n end",
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n end",
"def index\n @clients = Client.all\n render json: @clients\n end",
"def show\n @address = Address.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end",
"def show\n @address = Address.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end",
"def show\n @address = Address.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end",
"def show\n @service = Service.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { \n render :json => @service.to_json(:methods => [:polyline],:only => [:shipment]) \n }\n end\n end",
"def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end",
"def show\n client = Client.retrieve_by_id(params[:id])\n\n render json: client, serializer: SingleClientSerializer\n end",
"def get_address_json\r\n address = @customer.addresses.find( params[:id] )\r\n render :text => address.attributes.to_json\r\n end",
"def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end",
"def addresses\n nodename = params[:node_id]\n @node = nodename == \"admin\" ? Node.admin.where(:available => true).first : Node.find_key(nodename)\n if params[:network]\n @net = Network.find_key(params[:network])\n res = {\n \"node\" => @node.name,\n \"network\" => @net.name,\n \"category\" => @net.category,\n \"addresses\" => @net.node_allocations(@node).map{|a|a.to_s}\n }\n render :json => res, :content_type=>cb_content_type(:addresses, \"object\")\n else\n res = []\n\n if params[:category]\n nets = Network.in_category(params[:category])\n else\n nets = Network.all\n end\n\n nets.each do |n|\n ips = n.node_allocations(@node)\n next if ips.empty?\n\n res << {\n \"node\" => @node.name,\n \"network\" => n.name,\n \"category\" => n.category,\n \"addresses\" => ips.map{|a|a.to_s}\n }\n end\n\n render :json => res, :content_type=>cb_content_type(:addresses, \"array\")\n end\n end",
"def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end",
"def index\n @pinns = Pinn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinns }\n end\n end",
"def show\n @dress = Dress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dress }\n end\n end",
"def show\n render json: @contact.address\n end",
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def show\n @host = Host.find(params[:id])\n\n render json: @host\n end",
"def show\n @drip = Drip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drip }\n end\n end",
"def index\n @coins = Coin.all\n render \"index.json.jbuilder\"\n end",
"def show_addresses(**params)\n get('addresses', params)\n end",
"def index\n @addresses = Address.all.map { |a| [a.latitude, a.longitude, a.magnitude] }.flatten\n render json: [[\"Connectivity\",[@addresses]],[\"Population\",[@addresses]]]\n end",
"def show\n render json: Server.where(name: params[:name]).first\n end",
"def show\n render json: @service\n end",
"def addresses\n message = { nodes: { item: resource[:name]}}\n transport[wsdl].get(:get_address, message)\n end",
"def show\n @trips_connect = TripsConnect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def show\n @client_number = ClientNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_number }\n end\n end",
"def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end",
"def show\n @serv = Serv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv }\n end\n end",
"def index\n @countries = Country.all\n\n render json: @countries\n end",
"def post_address\n postcode = params['value'].delete('- ')\n address = CoreService.get_address(postcode)\n\n respond_to do |format|\n format.json { render json: { success: true, address: address } }\n end\n end",
"def index\n # @checkpoints = Checkpoint.all\n @route = Route.find(params[:route_id])\n @checkpoints = @route.checkpoints\n # render json: {\n # checkpoints: @checkpoints.to_a\n # }\n end",
"def index\n @transfers = Transfer.all\n render json: @transfers\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def show\n id = params[:id].to_i - 1\n if (id < 0) or (id > @addresses.length)\n respond_to do |format|\n format.html { redirect_to \"/#{@user.name}\", alert: 'Address was not found.'}\n format.json { render json: @address }\n end\n else\n @address = @addresses[id]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end\n \n end",
"def index\n gateway_alive = GatewayAlive.all\n render json: gateway_alive.to_json(:except => [:id])\n end",
"def index\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_addresses = @subscriber.shipping_addresses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shipping_addresses }\n end\n end",
"def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end",
"def dresses\n render json: { collections: Collection.published_dresses }\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def index\n @api_v1_progresses = Api::V1::Progress.all\n end",
"def show\n @address = current_user.addresses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end",
"def show\n render json: @url\n end",
"def show\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customers_address }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def index\n\t\trespond_to do |format|\n limit_present = params[:limit].present?\n params[:limit] = IP_ADDRESSES_DEFAULT_LIMIT unless params[:limit].present?\n\n if params[:filter].present?\n params[:filter][:order] = 'updated_at' unless params[:filter][:order].present?\n params[:filter][:order_type] = 'desc' unless params[:filter][:order_type].present?\n else\n params[:filter] = { order: 'updated_at', order_type: 'desc' }\n end\n\n order_by = params[:filter][:order]\n\n @ip_addresses = IpAddress.includes(:country)\n .by_id(params[:id])\n .by_address(params[:address])\n .by_port(params[:port])\n .by_country_id(params[:country_id])\n .by_rating(params[:rating])\n .by_additional_use(params[:additional_use])\n .page(params[:page]).per(params[:limit])\n .order('ip_addresses.' + order_by + ' ' + params[:filter][:order_type] + ' NULLS LAST')\n .references(:country)\n\t\t\tformat.html {}\n\t\t\tformat.json {@ip_addresses = IpAddress.all if !limit_present}\n\t\tend\n end",
"def show_address(id)\n get(\"addresses/#{id}\")\n end",
"def index\n @urls = ShortenedUrl.order(\"updated_at ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end",
"def index\n @routes = Route.where(:verified => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routes }\n end\n end",
"def index\n\n @ipranges = Iprange.all\n\n render json: @ipranges\n\n end",
"def vips\n request :get, '/vips'\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show \n @route = Route.find(params[:id])\n \n respond_to do |format|\n format.html \n format.json { render json: @route }\n end\n end",
"def index\n @plans = Plan.all\n\n render json: @plans\n end",
"def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end",
"def show\n @client = Client.find(params[:id])\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def index\n @places = Place.all\n\n respond_to do |format|\n format.html\n format.json { render json: @places }\n end\n end",
"def show\n @beacon = Beacon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beacon }\n end\n end",
"def index\n @lights = Light.all\n\n render json: @lights\n end",
"def index\n @zones = Zone.all\n\n render json: @zones\n end",
"def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end",
"def index\n @zones = Zone.all\n render json: @zones\n #@zones\n end"
] | [
"0.5794374",
"0.5789249",
"0.5733543",
"0.5719755",
"0.5710735",
"0.5710735",
"0.5698288",
"0.5686241",
"0.5593689",
"0.5572644",
"0.5572264",
"0.5557893",
"0.5523328",
"0.5521964",
"0.5507844",
"0.54906106",
"0.54818",
"0.5479228",
"0.5461432",
"0.5451969",
"0.54513747",
"0.5449313",
"0.5449313",
"0.5448825",
"0.5438069",
"0.54354113",
"0.5408898",
"0.54011875",
"0.5392466",
"0.5384078",
"0.5383119",
"0.53758186",
"0.5374493",
"0.5372968",
"0.5370401",
"0.53701776",
"0.5369439",
"0.53675395",
"0.5366397",
"0.5366397",
"0.5366397",
"0.5360682",
"0.5359922",
"0.5352065",
"0.53487307",
"0.5335458",
"0.5330737",
"0.53304815",
"0.5330228",
"0.53300244",
"0.53197736",
"0.5309152",
"0.5307959",
"0.5307245",
"0.52968866",
"0.52887875",
"0.5279821",
"0.52738357",
"0.52734363",
"0.52659184",
"0.5258454",
"0.52554035",
"0.52548647",
"0.52539307",
"0.5246798",
"0.5246157",
"0.52450687",
"0.52356595",
"0.52335256",
"0.5232527",
"0.5225164",
"0.52241737",
"0.52178174",
"0.52160376",
"0.521265",
"0.51961166",
"0.5195765",
"0.51898956",
"0.5189509",
"0.51886165",
"0.5185857",
"0.51815075",
"0.518116",
"0.518116",
"0.5175389",
"0.51745176",
"0.5173688",
"0.51726866",
"0.51722604",
"0.5167391",
"0.5165874",
"0.51633036",
"0.51608044",
"0.51601505",
"0.5159236",
"0.5157178",
"0.5153733",
"0.5153487",
"0.51433784",
"0.51414317",
"0.5140424"
] | 0.0 | -1 |
GET /presses/new GET /presses/new.json | def new
@press = Press.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @press }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @origin = OriginAddr.new\n \n drop_breadcrumb('新增')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origin }\n end\n end",
"def new\n @ip = Ip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end",
"def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @ip = @customer.ips.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end",
"def new\n @gossip = Gossip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gossip }\n end\n end",
"def new\n @adress = Adresse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @adress }\n end\n end",
"def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end",
"def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end",
"def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end",
"def new\n @serving = Serving.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serving }\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def new\n @addresstype = Addresstype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @addresstype }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @route = Route.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n\n @pin = Pin.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end",
"def new\n @trips_connect = TripsConnect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def new\n @click = Click.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @click }\n end\n end",
"def new\n @pickup = Pickup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pickup }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @outgoing = Outgoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outgoing }\n end\n end",
"def new\n @dress = Dress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dress }\n end\n end",
"def new\n @pinglun = Pinglun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinglun }\n end\n end",
"def new_address\n @client.new_address(name)\n end",
"def new\n @drip = Drip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @drip }\n end\n end",
"def new\n place = Place.new\n\n render json: place\n end",
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def new\n @click_thru = ClickThru.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @click_thru }\n end\n end",
"def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end",
"def new\n @host = Host.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host }\n end\n end",
"def getnewaddress\n @api.request 'getnewaddress'\n end",
"def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end",
"def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end",
"def new\n @snp = Snp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snp }\n end\n end",
"def new\n @slot = Slot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slot }\n end\n end",
"def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phone }\n end\n end",
"def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phone }\n end\n end",
"def new\n @client_number = ClientNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client_number }\n end\n end",
"def new\n @ip_table = IpTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip_table }\n end\n end",
"def new\n @vessel = Vessel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vessel }\n end\n end",
"def new\n @road = Road.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @road }\n end\n end",
"def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @point }\n end\n end",
"def new\n @network = Network.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @network }\n end\n end",
"def new\n @pin = current_user.pins.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end",
"def new\n @green = Green.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @green }\n end\n end",
"def new\n @trip_item = TripItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip_item }\n end\n end",
"def new\n @node = Node.new\n @node.addresses.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def new\n @transport_route = TransportRoute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transport_route }\n end\n end",
"def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n end",
"def new\n @fixed_ip = FixedIp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fixed_ip }\n end\n end",
"def new\n @customers_address = CustomersAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customers_address }\n end\n end",
"def new\n @borrow_request = BorrowRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow_request }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end",
"def new\n @potluck = Potluck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potluck }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @destination = Destination.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end",
"def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end",
"def new\n @take = Take.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @take }\n end\n end",
"def new\n @cloud = Cloud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cloud }\n end\n end",
"def new\n @snip = Snip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snip }\n end\n end",
"def new\n @service = Service.new\n @vendors = Vendor.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end",
"def new\n @spawner = Spawner.new\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spawner }\n end\n end",
"def new\n @ptrack = Ptrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ptrack }\n end\n end",
"def new\n @delivery_address = DeliveryAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_address }\n end\n end",
"def new\n @supplysite = Supplysite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplysite }\n end\n end",
"def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end",
"def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end",
"def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end",
"def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end",
"def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end",
"def new\n @taddress = Taddress.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taddress }\n end\n end",
"def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end",
"def new\n @client = Client.new\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end",
"def new\n @clonet = Clonet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clonet }\n end\n end",
"def new\n @entry = Entry.new\n\n render json: @entry\n end",
"def new\n @destination = Destination.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end",
"def new\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price }\n end\n end",
"def new\n @points_history = PointsHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @points_history }\n end\n end",
"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 @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @routine = Routine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routine }\n end\n end",
"def new\n @reserf = Reserve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reserf }\n end\n end"
] | [
"0.67079496",
"0.65906537",
"0.6575844",
"0.6566156",
"0.6554919",
"0.6508564",
"0.6458875",
"0.6458875",
"0.6458875",
"0.6434747",
"0.64265895",
"0.6426355",
"0.64014393",
"0.64014393",
"0.64014393",
"0.64013696",
"0.64008164",
"0.64008164",
"0.6394448",
"0.63764095",
"0.6355253",
"0.6323657",
"0.632134",
"0.6273075",
"0.6266757",
"0.6266757",
"0.62469757",
"0.6231014",
"0.6213756",
"0.6207824",
"0.6179654",
"0.61792123",
"0.6177679",
"0.6167095",
"0.6167095",
"0.6167095",
"0.6167095",
"0.6162525",
"0.61622435",
"0.6136801",
"0.6127961",
"0.6117711",
"0.6108963",
"0.60972905",
"0.609284",
"0.6091559",
"0.6091559",
"0.60871106",
"0.60824263",
"0.60820746",
"0.60820746",
"0.60811645",
"0.607976",
"0.60655546",
"0.6062767",
"0.60531306",
"0.6052626",
"0.604328",
"0.6043089",
"0.60415614",
"0.6038566",
"0.6028156",
"0.6023461",
"0.60199493",
"0.60176516",
"0.6016246",
"0.60134375",
"0.6012674",
"0.60102385",
"0.60102385",
"0.60076725",
"0.6007669",
"0.6005883",
"0.60040015",
"0.60034823",
"0.6002524",
"0.60022885",
"0.5999558",
"0.59989053",
"0.59919494",
"0.5982527",
"0.5981252",
"0.5980888",
"0.5980888",
"0.5980888",
"0.5980888",
"0.5980888",
"0.59782976",
"0.5978053",
"0.5977458",
"0.5976466",
"0.5976394",
"0.597611",
"0.59741116",
"0.5972064",
"0.5970226",
"0.5970205",
"0.5970205",
"0.5967408",
"0.59659606"
] | 0.63527894 | 21 |
POST /presses POST /presses.json | def create
@press = Press.new(params[:press])
respond_to do |format|
if @press.save
format.html { redirect_to @press, notice: 'Press was successfully created.' }
format.json { render json: @press, status: :created, location: @press }
else
format.html { render action: "new" }
format.json { render json: @press.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def post_as_json(data)\n uri = URI.parse(LISTENER)\n http = Net::HTTP.new(uri.host, uri.port)\n http.read_timeout = 0.5\n begin\n request = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'})\n request.body = data.to_json\n http.request(request){|res| puts \"Post status: #{res.body}\" }\n rescue StandardError => e\n puts \"Failed sending data: #{e.message}\"\n end\nend",
"def post(*args)\n request(:post, *args)\n end",
"def post(*args)\n request :post, *args\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end",
"def post(path, **args); end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def transmit(path, data)\n http_post (host + path),\n {'Content-Type' => 'application/json'},\n [data.to_json]\n end",
"def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def call method, args = {}\n unless args.is_a? Hash\n raise ArgumentError.new \"argument must be a Hash\"\n end\n\n args.each_key do |key|\n if args[key].is_a?(Array) || args[key].is_a?(Hash)\n args[key] = JSON.dump(args[key])\n end\n end\n\n @faraday.post method, args\n end",
"def post(url, args = {})\r\n make_request(:post, url, args)\r\n end",
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, 'rack.input' => rack_input\nend",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend",
"def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend",
"def post(url, key)\n _request(url, :POST, key)\n end",
"def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end",
"def send_post(address, params = {})\n\t\t\turi = URI.parse create_url(address)\n\n\t\t\treq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' => 'application/json'})\n\t\t\treq.body = params.to_json\n\n\t\t\tcurrTime = ::Time.now.to_i\n\t\t\treq['Date'] = currTime.to_s\n\t\t\treq['Sig'] = Digest::MD5.hexdigest(\"#{params.to_json}--#{currTime}--#{GameServer.account_server_private_key}\")\n\n\t\t\tres = Net::HTTP.start(uri.hostname, uri.port) { |http| http.request(req) }\n\n\t\t\tdata = JSON.parse(res.body).deep_symbolize_keys\n\t\t\tp \"--- account server data ---\", data\n\t\t\tdata\n\t\tend",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def POST; end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def create_ping\n post 'ping'\n end",
"def post\n resource.post(request, response)\n end",
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, {\"rack.input\" => rack_input}\nend",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def api_post(action, data)\n api_request(action, data, 'POST')\n end",
"def post_route(route, message)\n raise TypeError unless route.is_a? Route\n @changeset = @api.create_changeset(message, tags={'created_by'=>'ITCR'})\n ways_list = []\n nodes_list = create_node_list(route.path)\n\n until nodes_list.empty? # For node's maximum limit of a way\n way_nodes = nodes_list.take(MAX_NODES)\n nodes_list = nodes_list.drop(MAX_NODES)\n way_id = create_way(way_nodes)\n ways_list << way_id\n end\n\n relation = create_relation(ways_list) # Link ways to relation\n relation = add_stops(relation, route.stops) # Add bus stops to relation\n\n @api.save(relation, @changeset) # Save relation using the API\n puts 'Relation created succesfuly.'\n @api.close_changeset(@changeset)\n @changeset.id\n end",
"def post(*args)\n super(*wrap_for_json_api(*args))\n end",
"def create\n # @route = Route.new(params[:route])\n \n waypoints = params[:waypoints]\n creator = params[:creator]\n updated_at = params[:updated_at]\n name = params[:name]\n\n @route = Route.new(waypoints: waypoints, creator: creator, updated_at: updated_at, name: name)\n \n @route.save\n\n render json: @route\n\n # @vote_creator = VoteCreator.new(vote_params)\n # @vote = @vote_creator.vote\n # if @vote_creator.save\n # render json: @vote, status: :created, location: @vote\n # else\n # render json: @vote.errors, status: :unprocessable_entity\n # end\n end",
"def send(key)\n HTTParty.post(@add_url, {\n :headers => {\n \"Content-Type\" => \"application/json; charset=UTF8\",\n \"X-Accept\" => \"application/json\"\n },\n :body => {\n #:url => formatted[:url],\n :url => \"https://www.engadget.com/2016/10/09/more-galaxy-note-7-replacement-fires/\",\n #:tags => formatted[:tags],\n :consumer_key => ENV['POCKET_CONSUMER_KEY'],\n :access_token => key\n }.to_json\n })\n end",
"def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend",
"def post(url, payload = {}, headers = {})\n http :post, \"#{url}.json\", payload.to_json, headers\n end",
"def post(attrs = nil)\n attrs ||= attributes\n execute_request do\n faraday_connection.post { |req| req.body = adapter.serialize(attrs) }\n end\n end",
"def post_to_url(conn, key, body)\n res = conn.post do | req |\n # req.headers['x-api-key'] = key\n req.body = body.to_json\n end\n JSON.parse(res.body)\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def post(action, **args); end",
"def send_post(resource, data)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Post.new(url.to_s, initheader = {'Content-Type' => 'application/json'})\n req.body = data\n\n puts 'Sending POST request to ' + url.to_s\n\n send_request(url, req)\n end",
"def post(path, options = {})\n nonce, signature = generate_signature\n options = options.merge(key: @api_key, nonce: nonce, signature: signature)\n result = @connection.post(\"#{path}/\", options).body\n JSON.parse(result)\n end",
"def post(*args)\n execute(:post, *args)\n end",
"def forward_json(reading_json)\n #uri = URI.parse(\"http://cmu-sensor-network.herokuapp.com/sensors\")\n uri = URI.parse(\"http://209.129.244.9/sensors\")\n post_json_request = Net::HTTP::Post.new(uri.request_uri)\n post_json_request.add_field(\"Content-Type\", \"application/json\")\n post_json_request.body = reading_json\n http = Net::HTTP::new(uri.host, uri.port)\n response = http.request(post_json_request)\n return response\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, &block)\n route 'POST', path, &block\n end",
"def http_post(url, data)\n\turi = URI(url)\n\treq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n req.body = data.to_json\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }\n return response\nend",
"def index\n @presses = Press.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @presses }\n end\n end",
"def post *args, &block\n handle @conn.post *args, &block\n end",
"def create\n items = params[:items]\n filtered_items = []\n items.each do |item|\n item[:quantity].times do |order|\n filtered_items << {\"apiKey\" => item[:item_api], \"customizationChoices\" => [], \"comments\" => item[:instruction]}\n end\n end\n token = ENV[\"REACT_APP_EAT_STREET_TOKEN\"]\n uri = URI.parse(\"https://api.eatstreet.com/publicapi/v1/send-order\")\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"X-Access-Token\"] = token\n request.body = JSON.dump({\n \"restaurantApiKey\" => processing_params[:restaurant_api_key],\n \"items\" => filtered_items,\n \"method\" => \"delivery\",\n \"payment\" => \"cash\",\n \"test\" => false,\n \"comments\" => processing_params[:comments],\n \"card\" => {\n \"apiKey\" => nil\n },\n \"address\" => {\n \"apiKey\" => nil,\n \"streetAddress\" => processing_params[:address],\n \"latitude\" => processing_params[:latitude],\n \"longitude\" => processing_params[:longitude]\n },\n \"recipient\" => {\n \"apiKey\" => nil,\n \"firstName\" => processing_params[:username],\n \"lastName\" => processing_params[:username],\n \"phone\" => processing_params[:phone],\n 'email' => processing_params[:email]\n }\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n message = ''\n if response.code == 200\n message = {error: false, details: 'You Order Has Been Processed'}\n items.each do |item|\n order = Order.find(item[:id])\n order.ordered = true\n end\n\n else\n message = response.body\n end\n\n render json: message\n end",
"def http_post(uri, data)\n RestClient.post uri, data\n end",
"def post(path, params = nil)\n response = @connection.post do |req|\n req.headers = generate_headers\n req.url path\n req.body = params.to_json\n end\n Arke::Log.fatal(build_error(response)) if response.env.status != 201\n response\n end",
"def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end",
"def http_post(path, request)\n @http.post(\n :body => JSON(:request => request.to_hash),\n :headers => headers,\n :path => \"/api/v2/#{path}\",\n :expects => [200, 201, 202]\n )\n end",
"def post_json(url, data)\n JSON.parse(post(url, data, :json, :json))\n end",
"def post(*args)\n Request.post(*args)\n end",
"def http_post(path, data, content_type = 'application/json')\n http_methods(path, :post, data, content_type)\n end",
"def post(api, params)\n url2json(:POST, \"#{@endpoint}#{api}\", params)\n end",
"def create\n params[:url_list].each do |url|\n WebUrl.new(:url => url).save\n end\n render :json=>params[:url_list].to_json\n end",
"def create\n @click_thru = ClickThru.new(params[:click_thru])\n\n respond_to do |format|\n if @click_thru.save\n format.html { redirect_to @click_thru, notice: 'Click thru was successfully created.' }\n format.json { render json: @click_thru, status: :created, location: @click_thru }\n else\n format.html { render action: \"new\" }\n format.json { render json: @click_thru.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_post(action, data, binary_key = nil)\n api_request(action, data, 'POST', binary_key)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end",
"def post(path, data = {}, params = {})\n body = data.to_json\n path = File.join(@prefix, path)\n\n response = @conn.post(path, body) do |req|\n req.params = params\n req.headers['Content-Type'] = 'application/json'\n end\n\n JSON.parse response.body\n end",
"def post(data = {})\n call data, method: :post\n end",
"def post payload, path = \"\" \n make_request(path, \"post\", payload)\n end",
"def post(path, params)\n with_monitoring do\n connection.post(path) do |req|\n req.body = Oj.dump(params)\n end\n end\n end",
"def post(url, params = {})\n client.post(url, params).body\n end",
"def post(path, headers = {})\n process :post, path, headers\n end",
"def post(attrs = nil)\n attrs ||= attributes\n\n execute_request('POST') do |uri, headers|\n HTTP.http_client.post(\n uri,\n body: adapter.serialize(attrs),\n header: headers.merge(CONTENT_TYPE_HEADERS)\n )\n end\n end",
"def make_post_request(route:, headers: nil, body: nil)\n post route, params: body, headers: headers\nend",
"def post\r\n end",
"def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"def post_request(secureNetId, secureKey, url)\n uri = URI.parse(url) # Parse the URI\n http = Net::HTTP.new(uri.host, uri.port) # New HTTP connection\n http.use_ssl = true # Must use SSL!\n req = Net::HTTP::Post.new(uri.request_uri) # HTTP POST request \n body = {} # Request body hash\n yield body # Build body of request\n req.body = body.to_json # Convert hash to json string\n req[\"Content-Type\"] = 'application/json' # JSON body\n req[\"Origin\"] = 'worldpay.com' # CORS origin\n req.basic_auth secureNetId, secureKey # HTTP basic auth\n res = http.request(req) # Make the call\n return JSON.parse(res.body) # Convert JSON to hashmap\nend",
"def post(path, *data, &block)\n map(path, R3::POST, *data, &block)\n end",
"def bridges_create(params = {})\n post \"bridges\", params\n end",
"def post(url, payload, headers={})\n payload = MultiJson.encode(payload)\n headers = headers.merge({:content_type => 'application/json'})\n request(:post, url, payload, headers)\n end",
"def post; end",
"def post(path, options={}, &b)\n event(:post, path, options, &b)\n end",
"def post(path, params)\n request(:post, path, params)\n end",
"def post(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :post,\n :url => \"#{self.uri}#{path}\",\n :headers=> {},\n :payload=> params,\n :verify_ssl=> @ssl_verify )\n end",
"def post_request(options, path, post_data)\n\n result = {}\n\n http = Net::HTTP.new(ENV['NESSUS_HOST'], options[:port])\n http.use_ssl = @use_ssl\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n http.start do |http|\n req = Net::HTTP::Post.new(path)\n\n req['X-ApiKeys'] = \"accessKey=#{ENV['NESSUS_ACCESS_KEY']}; secretKey=#{ENV['NESSUS_SECRET_KEY']}\"\n req.body = post_data\n \n resp, data = http.request(req)\n \n if resp.code.eql? '200'\n #print \"Data: \" + JSON.pretty_generate(JSON.parse(resp.body.to_s))\n result = JSON.parse(resp.body.to_s)\n else\n puts \"Error: \" + resp.code.to_s + \"\\n\" + resp.body\n end\n end\n\n return result\n end",
"def http_post(url, hash=nil, _port=nil, headers=nil)\n \n resp, data = http_request(url, \"post\", hash, _port, headers)\n\treturn [resp, data]\nend",
"def api_post(path, data = {})\n api_request(:post, path, :data => data)\n end",
"def postReadings(info, state)\r\n params = {\r\n :device_id => info.deviceId,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\",\r\n :value => state.temperature,\r\n :time => Time.now.to_i\r\n },\r\n {\r\n :type => \"Humidity\",\r\n :value => state.humidity,\r\n :time => Time.now.to_i\r\n }\r\n ]\r\n }\r\n res = apiPostJson(\"readings\", params)\r\n if res.status != 201\r\n $LOG.warn(\"Failed to post readings to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end",
"def create\n params[:traceroute].each do |tr|\n Traceroute.create(:server => tr[:server], :local_ip => tr[:local_ip], :stdout => tr[:stdout], :stderr => tr[:stderr], :exit_status => tr[:exit_status], :timestamp => tr[:timestamp])\n end\n\n\n\n #puts \"hello #{params}\"\n #@hello = params\n #@hello.map { |k,v| puts \"#{k} is #{v}\" }\n #traceroute_params.each do |v|\n # traceroute = Traceroute.create(v)\n #end\n\n respond_to do |format|\n format.all { render :nothing => true, :status => 200 }\n end\n #@traceroute = Traceroute.new(params)\n\n #respond_to do |format|\n # if @traceroute.save\n # format.html { redirect_to @traceroute, notice: 'Traceroute was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @traceroute }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def post(path, data={})\n request(:post, path, data)\n end",
"def post\n end",
"def post(url, data, headers = {})\n request(:post, url, headers, :data => data)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def balance_post(addrs, opts = {})\n data, _status_code, _headers = balance_post_with_http_info(addrs, opts)\n data\n end",
"def signed_post_request url, body\n body_json= body.to_json\n token = jwt_post_signature url, body_json\n HTTParty.post('http://localhost:5000'+url,\n {headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\",\n },\n body: body_json}\n )\n\n end",
"def post(path, options={})\n send_request 'post', path, options\n end",
"def post(endpoint, url, args, version = 'v1')\n qs = build_qs(args)\n req_url = \"#{url}/api/#{version}/#{endpoint}?#{qs}\"\n\n request(req_url, :POST)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post_request(url,args)\n uri = URI.parse(url)\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data(args)\n request(uri,req)\n end"
] | [
"0.5597015",
"0.55289644",
"0.550854",
"0.5499295",
"0.54722303",
"0.54300714",
"0.54295766",
"0.54105777",
"0.53515303",
"0.5304263",
"0.52809054",
"0.5245171",
"0.5240731",
"0.5238953",
"0.52295953",
"0.5222467",
"0.52157325",
"0.521449",
"0.5212442",
"0.5209957",
"0.5201164",
"0.5195623",
"0.51693165",
"0.5167476",
"0.5156961",
"0.5154036",
"0.5150803",
"0.51497287",
"0.51463073",
"0.51306635",
"0.5107165",
"0.51043826",
"0.5100686",
"0.50978273",
"0.50805587",
"0.5071746",
"0.5071203",
"0.5070038",
"0.5068637",
"0.50622386",
"0.5059313",
"0.5050807",
"0.5037878",
"0.5036652",
"0.50243956",
"0.5009478",
"0.5005799",
"0.49991608",
"0.49921727",
"0.49895978",
"0.49885598",
"0.4972532",
"0.4968551",
"0.49632308",
"0.49607813",
"0.495986",
"0.49597672",
"0.49557635",
"0.4940611",
"0.4939381",
"0.4938493",
"0.4938493",
"0.4938493",
"0.4929816",
"0.49252403",
"0.4921093",
"0.4920837",
"0.4920258",
"0.49095765",
"0.49017408",
"0.49010864",
"0.48962793",
"0.48954847",
"0.48947158",
"0.48938727",
"0.48875684",
"0.48854387",
"0.48853502",
"0.4881263",
"0.4881053",
"0.487177",
"0.4870237",
"0.48693597",
"0.4868172",
"0.48623613",
"0.48551843",
"0.48521626",
"0.48483816",
"0.48443326",
"0.48431453",
"0.48430887",
"0.48430887",
"0.48430887",
"0.48430887",
"0.48430887",
"0.48424298",
"0.48402175",
"0.48398694",
"0.48359478",
"0.4823419",
"0.48214877"
] | 0.0 | -1 |
PUT /presses/1 PUT /presses/1.json | def update
@press = Press.find(params[:id])
respond_to do |format|
if @press.update_attributes(params[:press])
format.html { redirect_to @press, notice: 'Press was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @press.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def put(*args)\n request :put, *args\n end",
"def put(*args)\n request(:put, *args)\n end",
"def put!\n request! :put\n end",
"def update_address(id, params)\n put(\"addresses/#{id}\", address: params, change_case: false)\n end",
"def update\n if @address.update(address_params)\n render json: @address\n else\n render json: @address.errors, status: :unprocessable_entity\n end\n end",
"def put endpoint, data\n do_request :put, endpoint, data\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def put(url, vars={})\n send_request url, vars, 'PUT'\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def put url, object = nil\n request url, HTTP::Put, object\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n put :update\n end",
"def update\n concat_phone_numbers params[:guest]\n @tablet_guest = Tablet::Guest.find(params[:id])\n\n respond_to do |format|\n if @tablet_guest.update_attributes(params[:guest])\n format.json { render :json => @tablet_guest }\n else\n format.json { render :json => @tablet_guest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_method\n :put_json\n end",
"def update\n authorize @address\n\n respond_to do |format|\n if @address.update(@pars)\n flash[:success] = \"Address was successfully updated. #{@pars.inspect}\"\n format.html { redirect_to addresses_path }\n format.json { render json: {locale: I18n.locale,\n user_id: @user_id,\n recyclable: @address.recyclable} }\n else\n flash[:danger] = \"There was a problem updating the address.\"\n format.html { render action: 'edit' }\n format.json { render json: @address.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ipaddress.update(ipaddress_params)\n format.html { redirect_to @ipaddress, notice: 'Ipaddress was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ipaddress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def update\n @address = @addressable.addresses.find_by_id(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to current_user, notice: 'address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(url, payload = {}, headers = {})\n http :put, \"#{url}.json\", payload.to_json, headers\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update number, routes\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PATCH',\r\n query_url:query_url,\r\n body:\"{\\\"routes\\\": #{routes.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def put(path, &block)\n route 'PUT', path, &block\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update\n trip = Trip.find_by_id(params[:trip_id])\n trip.title = params[:title]\n trip.city = params[:city]\n trip.state = params[:state]\n trip.country = params[:country]\n trip.start_date = params[:start_date]\n trip.end_date = params[:end_date]\n trip.description = params[:description]\n trip.link = params[:link]\n if params[:photo_base]\n trip.photo = params[:photo_base]\n end\n trip.save!\n render json: trip\n end",
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gossip = Gossip.find(params[:id])\n\n respond_to do |format|\n if @gossip.update_attributes(params[:gossip])\n format.html { redirect_to @gossip, notice: 'Gossip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gossip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @street.update(street_params)\n format.html { redirect_to @street, notice: 'Street was successfully updated.' }\n format.json { render :show, status: :ok, location: @street }\n else\n format.html { render :edit }\n format.json { render json: @street.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer\n @offer = @host.offers.find(params[:id])\n @offer.update(offer_params) if request.put?\n redirect_to offers_host_path if request.put?\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def update\n if @contact.address.update(address_params)\n render json: @contact.address\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n begin\n ActiveRecord::Base.transaction do\n @client.update!(client_params)\n @client.address.update!(address_params)\n end\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n rescue\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ripple_address.update(ripple_address_params)\n format.html { redirect_to @ripple_address, notice: 'Ripple address was successfully updated.' }\n format.json { render :show, status: :ok, location: @ripple_address }\n else\n format.html { render :edit }\n format.json { render json: @ripple_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def update!(**args)\n @ingress_port = args[:ingress_port] if args.key?(:ingress_port)\n @psc_uri = args[:psc_uri] if args.key?(:psc_uri)\n end",
"def update!(**args)\n @address = args[:address] if args.key?(:address)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def put(path, params)\n parse_response @client[path].put(params)\n end",
"def put_clone\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/clone\", { \n headers: {\"Fastly-Key\" => $key} \n })\n end",
"def put(path, opts = {})\n request(:put, path, opts).body\n end",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, :notice => 'Address was successfully updated.' }\n format.json { render :json => @address }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @address.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(url, resource_name, options = {})\n build_response(resource_name) do\n connection.put do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def put(path, params)\n request(:put, path, params)\n end",
"def put(*args, &block)\n self.client.put *args\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def put(uri, params = {})\n send_request(uri, :put, params)\n end",
"def update\n respond_to do |format|\n if @serving.update(serving_params)\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { render :show, status: :ok, location: @serving }\n else\n format.html { render :edit }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client.update(client_params)\n render json: @client\n end",
"def update\n respond_to do |format|\n if @mailaddress.update(mailaddress_params)\n format.html { redirect_to @mailaddress, notice: 'Mailaddress was successfully updated.' }\n format.json { render :show, status: :ok, location: @mailaddress }\n else\n format.html { render :edit }\n format.json { render json: @mailaddress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @adress = Adresse.find(params[:id])\n \n respond_to do |format|\n if @adress.update_attributes(params[:adresse])\n format.html { redirect_to @adress, notice: 'Adresse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @adress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n respond_to do |format|\n if @andress.update(andress_params)\n format.html { redirect_to @andress, notice: 'Andress was successfully updated.' }\n format.json { render :show, status: :ok, location: @andress }\n else\n format.html { render :edit }\n format.json { render json: @andress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n apartment = Apartment.find(params[:id])\n apartment.update_attributes(apartment_params)\n render json: apartment\n end",
"def update!(**args)\n @address = args[:address] if args.key?(:address)\n @phone_number = args[:phone_number] if args.key?(:phone_number)\n end",
"def put(object, url, headers={})\n do_request(\"put\", url, object, headers)\n end",
"def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def update\n @route = Route.find(params[:id])\n if user_signed_in?\n routeInfo = JSON.parse(params[:route_map_points].gsub(\"jb\",\"latitude\").gsub(\"kb\",\"longitude\"))\n \n \n @route.route_points = routeInfo['overview_path']\n @route.starting_point = routeInfo['overview_path'].first\n @route.end_point = routeInfo['overview_path'].last\n\n\n respond_to do |format|\n if @route.save(params[:route])\n if @route.schedule.update_attributes(\n departure: params[:route_schedule_departure], \n arrival: params[:route_schedule_arrival]) \n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end\nend\n # DELETE /routes/1\n # DELETE /routes/1.json\n def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end\nend",
"def update\n respond_to do |format|\n if @adress.update(adress_params)\n format.html { redirect_to @adress, notice: 'Adress was successfully updated.' }\n format.json { render :show, status: :ok, location: @adress }\n else\n format.html { render :edit }\n format.json { render json: @adress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ip_adress.update(ip_adress_params)\n format.html { redirect_to @ip_adress, notice: 'Ip adress was successfully updated.' }\n format.json { render :show, status: :ok, location: @ip_adress }\n else\n format.html { render :edit }\n format.json { render json: @ip_adress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end",
"def create_method\n :http_put\n end",
"def create_method\n :http_put\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @advertiser.update(advertiser_params)\n @advertiser.address.update(address_params)\n format.html { redirect_to @advertiser, notice: 'Advertiser was successfully updated.' }\n format.json { render :show, status: :ok, location: @advertiser }\n else\n format.html { render :edit }\n format.json { render json: @advertiser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end",
"def put(splat)\n bad_request if splat.empty?\n _put resolve_uri(splat[0]), request.body.read\n end",
"def update\n update_resource @ride, ride_params\n end",
"def make_put_request(url, data)\n headers = {\n \"Content-Type\" => \"application/json\",\n }\n\n response = HTTParty.put(url, body: data.to_json, headers: headers)\n\n if response.success?\n response\n else\n puts \"Request failed with response code: #{response.code}\"\n puts \"Response message: #{response.message}\"\n nil\n end\nend",
"def update_array_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/arrays/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n last_clip(@trip, trip_params[:clips_attributes].present?)\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully updated.', change: \"list\" }\n format.json { head :no_content }\n else\n format.html { redirect_to @trip.parent || @trip }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end"
] | [
"0.5961851",
"0.5745591",
"0.5745237",
"0.5573423",
"0.55692333",
"0.552148",
"0.54978657",
"0.5480543",
"0.54075634",
"0.53879905",
"0.5387464",
"0.5350518",
"0.5350518",
"0.53385293",
"0.53379124",
"0.5308354",
"0.52809674",
"0.527993",
"0.52536386",
"0.5235801",
"0.52289295",
"0.52272296",
"0.52180874",
"0.5217525",
"0.52147037",
"0.52113205",
"0.51994544",
"0.5194295",
"0.5183694",
"0.5179532",
"0.5174223",
"0.51646554",
"0.51646554",
"0.51646554",
"0.5164116",
"0.5161924",
"0.51517385",
"0.5138467",
"0.51295185",
"0.5121433",
"0.5121433",
"0.5121433",
"0.5121433",
"0.5121433",
"0.5121433",
"0.5121433",
"0.5121433",
"0.51211506",
"0.5115618",
"0.5106355",
"0.51034915",
"0.51030165",
"0.510255",
"0.5088938",
"0.5088938",
"0.5086478",
"0.5086452",
"0.50822383",
"0.5078995",
"0.50768185",
"0.50701815",
"0.5059439",
"0.5058382",
"0.5051874",
"0.50486034",
"0.5044274",
"0.5043152",
"0.5040154",
"0.50381255",
"0.503072",
"0.502808",
"0.5018201",
"0.5012947",
"0.49994734",
"0.4987549",
"0.49857298",
"0.49846885",
"0.49811307",
"0.497935",
"0.497935",
"0.497935",
"0.497935",
"0.49781346",
"0.4972708",
"0.49683172",
"0.49661636",
"0.49627504",
"0.49607596",
"0.49607596",
"0.4959837",
"0.49570295",
"0.4955721",
"0.49497846",
"0.4947967",
"0.49477017",
"0.4946485",
"0.49399364",
"0.49385417",
"0.49376374",
"0.49348995",
"0.49346003"
] | 0.0 | -1 |
DELETE /presses/1 DELETE /presses/1.json | def destroy
@press = Press.find(params[:id])
@press.destroy
respond_to do |format|
format.html { redirect_to presses_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete(path)\n request 'DELETE', path\n end",
"def delete\n request(:delete)\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete(url)\n do_request(\"delete\", url)\n end",
"def delete(address)\n \tMailgun.submit :delete, list_url(address)\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @adress = Adresse.find(params[:id])\n @adress.destroy\n\n respond_to do |format|\n format.html { redirect_to adresses_url }\n format.json { head :no_content }\n end\n end",
"def delete\n delete_from_server single_url\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def delete!\n request! :delete\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def delete(url, headers={})\n RestClient.delete url, headers\n end",
"def delete(_url)\n # do nothing since we can't find the key by url\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete(path)\n make_call(mk_conn(path), :delete)\n end",
"def destroy\n @tadress.destroy\n respond_to do |format|\n format.html { redirect_to tadresses_url }\n format.json { head :no_content }\n end\n end",
"def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end",
"def delete\n client.delete(url)\n @deleted = true\n end",
"def destroy\n @ip_address.destroy\n respond_to do |format|\n format.html { redirect_to ip_addresses_path }\n format.json { head :no_content }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def delete(name)\n request(uri = uri(name), Net::HTTP::Delete.new(uri.request_uri))\n end",
"def delete\n api_client.delete(url)\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @adress.destroy\n respond_to do |format|\n format.html { redirect_to adresses_url, notice: 'Adress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(url, vars={})\n send_request url, vars, 'DELETE'\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @ip_adress.destroy\n respond_to do |format|\n format.html { redirect_to ip_adresses_url, notice: 'Ip adress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end",
"def destroy\n @dress = Dress.find(params[:id])\n @dress.destroy\n\n respond_to do |format|\n format.html { redirect_to dresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dress = Dress.find(params[:id])\n @dress.destroy\n\n respond_to do |format|\n format.html { redirect_to dresses_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def destroy\n @ip_name.destroy\n respond_to do |format|\n format.html { redirect_to ip_names_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ripple_address.destroy\n respond_to do |format|\n format.html { redirect_to ripple_addresses_url, notice: 'Ripple address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def delete\n api(\"Delete\")\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def delete(name)\n\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete(url)\n call(url: url, action: :delete)\n end",
"def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(name, _options = {})\n exec(\"delete\", c: name, p: port)\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def delete(*args)\n Request.delete(*args)\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def delete(name); end",
"def delete(name); end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end",
"def delete(path)\n uri = build_uri(path)\n\n request = Net::HTTP::Delete.new(uri.request_uri)\n set_authorisation_header(request)\n\n response = https_client(uri).request(request)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def delete(uri)\r\n request(Net::HTTP::Delete.new(uri)) \r\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end",
"def delete(url, resource_name, options = {})\n build_response(resource_name) do\n connection.delete do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def destroy\n @ip = Ip.find(params[:id])\n @ip.destroy\n\n respond_to do |format|\n format.html { redirect_to ips_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.67486066",
"0.66400546",
"0.66270685",
"0.6605846",
"0.65531504",
"0.6523408",
"0.648347",
"0.6460676",
"0.645834",
"0.6412049",
"0.63988847",
"0.6394766",
"0.6391004",
"0.6391004",
"0.6383594",
"0.63824135",
"0.6370976",
"0.63537407",
"0.63390493",
"0.6329245",
"0.6308978",
"0.63077927",
"0.6278994",
"0.6278311",
"0.6261201",
"0.6239528",
"0.6226403",
"0.6221156",
"0.62145096",
"0.6206969",
"0.6205",
"0.6204254",
"0.6202904",
"0.6202904",
"0.6202904",
"0.6202904",
"0.6202661",
"0.61988056",
"0.6194784",
"0.61885345",
"0.61840504",
"0.6183583",
"0.6182096",
"0.6179664",
"0.6176462",
"0.61725956",
"0.6163309",
"0.61595464",
"0.61595464",
"0.6159418",
"0.6156047",
"0.6145106",
"0.6145106",
"0.6142377",
"0.61396897",
"0.61364776",
"0.6135972",
"0.6122827",
"0.61149144",
"0.6111725",
"0.6111725",
"0.6111725",
"0.6111725",
"0.6111725",
"0.6111725",
"0.6111725",
"0.6088904",
"0.6088904",
"0.6088904",
"0.60884523",
"0.60805315",
"0.6079755",
"0.6079388",
"0.60703236",
"0.60703236",
"0.60703236",
"0.60703236",
"0.60696346",
"0.60657334",
"0.60631484",
"0.6059758",
"0.6058992",
"0.60524344",
"0.6044865",
"0.60409826",
"0.60407686",
"0.60407686",
"0.6038689",
"0.6034927",
"0.6033377",
"0.60308427",
"0.60308427",
"0.6023504",
"0.6019066",
"0.6016813",
"0.6002421",
"0.5999564",
"0.59933215",
"0.59864455",
"0.5979969",
"0.5979199"
] | 0.0 | -1 |
ar = [1,2,3,4,5,5,100] puts sum ar | def max_2_sum arr
# YOUR CODE HERE
if arr.empty?
return 0
end
if arr.length == 1
return arr[0]
end
a = arr.sort
a[-2] + a[-1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total(arr)\n\tsum = 0\n\tarr.each do |i|\n\t\tsum = sum + i\n\tend\n\treturn sum\nend",
"def total(arr)\n\tsum\t= 0\n\tarr.each{|i| sum+= i}\n\treturn sum\nend",
"def simpleArraySum(ar)\n count = 0\n ar.each {|x| count += x}\n count\nend",
"def sum arr\n rtn = 0\n arr.each { |n| rtn += n }\n return rtn\nend",
"def total(array)\n sum = 0\n array.each { |i| sum += i}\n return sum\nend",
"def total (array)\n\tsum=0\n\tarray.each do |n| sum += n\n\tend\n\treturn sum\nend",
"def total(array)\n sum = 0\n array.each { |i| sum += i }\n return sum\nend",
"def total(array)\n\tsum = 0\n\tarray.each {|number| sum += number}\n\tsum\nend",
"def total(array)\n\tsum = 0\n\tarray.each { |x| sum += x }\t\n\tsum\nend",
"def total(array)\n\tsum = 0\n\tarray.each do |i|\n\t\tsum += i\n\tend\n\treturn sum\nend",
"def total(arr)\n total = 0\n arr.each {|i| total += i}\n return total\nend",
"def sum(array)\n\ttotal = 0\n\tfor number in array #could do each do instead of for loop\n\t\ttotal += number\n\tend\n\treturn total\nend",
"def total(array)\n\tsum = 0\n\tsum = array.inject {|sum, i| sum + i}\nend",
"def total (array)\n sum = 0\n array.each do |i|\n sum + i\n end\n return sum\nend",
"def sum arr\n #Just iterate through the array and add each element to the sum\n sum = 0\n for val in arr\n \tsum = sum + val\n end\n sum\nend",
"def total(array)\n sum = 0\n array.each do |n|\n sum += n\n end\n sum\nend",
"def total(array)\n\tsum = 0\n\tarray.each { |a| sum += a }\n\treturn sum\nend",
"def total(array)\n sum = 0\n array.each {|x| sum += x}\n return sum\nend",
"def total(array)\n\tsum = 0\n\tarray.each do |x|\n\t\tsum = sum + x\n\tend\n\tsum\nend",
"def sum arr\n res = 0\n arr.each {|i| res+=i}\n return res\nend",
"def total(array)\n \tsum = 0\n \tarray.each do |num|\n sum += num\n end\t\n return sum\n end",
"def sum(array)\n sum = 0\n array.each { |n| sum += n } \n sum\nend",
"def total(arr)\n\t output = 0\n\t arr.each do |x|\n\t output += x\n\t end\n\t output\nend",
"def total(arr)\n\t output = 0\n\t arr.each do |x|\n\t output += x\n\t end\n\t output\nend",
"def sum arr\n total = 0\n arr.each do |i|\n total += i\n end\n total\nend",
"def total(array)\n\ttotal = 0\n\tarray.each do |n|\n\t\ttotal += n \n\tend\n\treturn total\nend",
"def total (array)\n\tarray.inject { |sum, n| sum + n }\nend",
"def total (array)\n\tsum = 0\n\n\tarray.each {|x| sum = sum + x}\n\treturn sum\nend",
"def total(array)\n\tarray.inject do |sum, i| sum + i\n\tend\nend",
"def sum(array)\n sum = 0\n array.each do |a|\n sum += a\n end\n return sum\nend",
"def total(array)\nsum = 0 \n\tarray.each do |num|\n\tsum += num \n\tend \n\treturn sum\nend",
"def sum array\n\tsum = 0\n\tarray.each do |number|\n\t\tsum = sum + number\n\tend\n\tsum\nend",
"def array_sum(arr)\n\n sum = 0\n arr.each {|n| sum += n}\n\n sum\nend",
"def total(array)\n sum = 0\n array.each{ |x| sum += x }\nend",
"def total(array)\n sum = 0\n array.each{ |x| sum += x }\nend",
"def sum arr\n sum = 0\n arr.each { |a| sum += a }\n return sum\nend",
"def total(array)\n sum = 0\n array.each do |number|\n sum = sum += number\n end\n sum\nend",
"def total(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n return sum\nend",
"def arr_sum(array)\n sum = 0 # Declares initial value for variable 'sum' as 0\n array.each do |i| # Begin iterating each item of arr\n sum += i # add each number in array to the next item, continue until items exhausted\n end\n return sum # Returns new sum value\nend",
"def total(array)\n\tarray.inject {|sum,n| sum + n}\n\tend",
"def sum arr\n result = 0\n arr.each do |num|\n \tresult += num\n end\n result\nend",
"def sum(anArray)\n total = 0\n anArray.each{ | val | total = total + val}\n return total\nend",
"def array_sum(arr)\n\tsum = 0\n\n\t# an for each loop\n\tfor i in arr\n\t\tsum += i\n\tend\n\t\n\treturn sum\n\t\nend",
"def total(array)\n sum = 0\n array.each do |x|\n sum = sum + x\n end\n sum\nend",
"def total (array)\n\tindex = 0\n\tsum = 0\n\twhile index < array.length\n\t\tsum = sum + array[index]\n\t\tindex += 1\n\tend\n\treturn sum\nend",
"def sum arr\n sum = arr.sum\n return sum\nend",
"def total(array) \n\tsum = 0\n\tfor i in 0.. array.length\n\tarray.each { |i| sum += i}\n\treturn sum\nend\nend",
"def total(array)\n\ttotal = 0\n\tarray.each do |x|\n\t\ttotal += x\n\tend\n\treturn total\nend",
"def total (arr)\n sum = 0\n for i in 0...arr.length\n sum = sum + arr[i]\n end\n return sum\nend",
"def sum(array)\n s = 0\n\tarray.each {|x| s+= x}\n\ts\nend",
"def sum arr\n sum = 0\n arr.each do |n|\n sum+= n\n end\n return sum\nend",
"def total(array)\n sum = 0\n array.inject(0) {|sum, i|\n sum + i}\n end",
"def total array\n\tsum = 0\n\tarray.each do |x|\n\t\tsum = sum + x\n\tend\n\treturn sum\nend",
"def sum arr\n result = 0\n #Iterate through the length of the array to find the sum of the array elements\n if arr.length > 0 then\n arr.each do |index|\n\tresult += index\n end\n end\n return result\nend",
"def total(arr)\n\tarr.inject(0) { |x, y| x + y }\nend",
"def total(array)\n i = 0\n array.each { |a| i += a.to_i }\n return i\nend",
"def sum(arr)\n sum = 0;\n arr.each do |i|\n sum += i\n end\n sum\nend",
"def total(array) \n\tsum = 0\n\ti = 0\n\tfor i in 0.. array.length\n\tarray.each { |i| sum += i}\n\treturn sum\nend\nend",
"def total (array)\n sum = 0\n for x in array\n sum += x\n end\n return sum\nend",
"def total(array)\n\tarray.inject { |sum, x| sum + x }\nend",
"def total(array) \n number = 0\n array.each do |i|\n number += i\n end\n number\nend",
"def total(array)\n total = 0\n array.each do |number|\n total += number\n end\n total\nend",
"def sum(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n sum\nend",
"def total(array)\n\tarray.inject{|sum,x| sum + x }\nend",
"def total(array)\n\tarray.inject{|result, element|result+element}\nend",
"def sum(array)\n sum = 0\n\n array.each { |number|\n sum += number\n }\n\n return sum\nend",
"def total(array)\n\tlength = array.length\n\tsum = 0 \n\tfor i in 0...length\n\tsum = sum + array[i]\n\tend\n\tsum\nend",
"def total(array)\n sum = 0\n array.each do |x|\n sum += x\nend\nsum\nend",
"def sum_array(array)\n return array.sum\n\n # sum_total_of_array = 0\n # for number in array\n # sum_total_of_array += number\n # end\n # return sum_total_of_array\nend",
"def sum arr\n # YOUR CODE HERE\n sumTotal=0\n\nfor i in arr do\n\n sumTotal=sumTotal+i\n\nend\n\n return sumTotal\nend",
"def sum arr\n sum=0\n for x in arr\n sum+=x\n end\n return sum\nend",
"def total(array)\n a = 0\n for i in 0...array.length\n a = a + array[i]\n end\n return a\nend",
"def total(array)\n\tsum = array.inject(0, :+)\nend",
"def sum_array(array)\n total = 0\n array.each do |num|\n total += num\n end\n total\nend",
"def total(array)\n\tarray.inject {|sum, a| a + sum}\nend",
"def total(array)\n\tanswer=array.inject(0){\n\t\t|sum,i| sum+i\n\t}\n\treturn answer\nend",
"def sum arr\n # YOUR CODE HERE\n total = arr.sum\n \n return total\nend",
"def total(array)\n\tarray.inject(0) {|sum, num| sum += num}\nend",
"def total(array)\n array.inject { |sum, n| sum + n}\nend",
"def total(array)\n\treturn array.inject { |sum, x| sum + x }\nend",
"def sum_of_arr(arr)\n sum = 0\n arr.each do |i|\n sum = sum + i\n end\n sum\nend",
"def total(array)\n sum = array.inject(:+)\n sum\nend",
"def total(array)\n array.inject(0) {|sum, i| sum + i }\nend",
"def sum (arr)\n s=0\n arr.each{|a| s+=a}\n return s\nend",
"def sum_array (arr)\n result = 0\n arr.each do |value|\n result +=value\n end\n result\nend",
"def sum_array(array)\n sum = 0\n array.each do |element|\n sum += element\n end\n sum\nend",
"def sum(arr)\n output = 0\n arr.each do |num|\n output += num\n end\n return output\nend",
"def sum arr\n\ttotal = 0\n\tif arr.size > 0\n\t\ttotal = arr.reduce(:+)\n\tend\n\n\treturn total\nend",
"def total(array)\n\tarray.inject(0) {|sum,x| sum + x}\nend",
"def it_arr_sum(array)\r\n sum = 0\r\n array.each {|ele| sum += ele}\r\n return sum\r\nend",
"def sum arr\n arraySum = 0\n arr.each{|i|arraySum+=i}\n return arraySum\nend",
"def sumArr()\n ArrThing = [1, 2, 3, 4, 5, 6, 7, 8]\n sum = 0\n ArrThing.each { |a| sum+=a }\n print ArrThing\n print sum\nend",
"def total (array)\n total = 0\n array.each do |i|\n total += i\nend\nreturn total\nend",
"def sum (array)\n total = 0.0\n array.each { |elem| total += elem }\n total\nend",
"def total array\n array.inject(0){|sum,x| sum + x }\nend",
"def sum (arr)\n\treturn arr.inject(0, :+)\nend",
"def sum_items(array)\n # total = 0\n # array.each do |number|\n # total += number\n # end\n # total\n array.inject { |sum, num| sum + num }\nend",
"def arr_sum(arr)\r\n sum_arr = 0\r\n arr.each { |i| sum_arr+=i}\r\n sum_arr\r\nend",
"def total(arr)\n return arr.inject(:+)\nend",
"def my_sum(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n sum\nend",
"def sum arr\n sum = 0\n arr.each do |i|\n sum = sum + i\n end\n return sum\nend"
] | [
"0.8045934",
"0.8034174",
"0.7928271",
"0.7897545",
"0.78941095",
"0.78880334",
"0.788568",
"0.78678155",
"0.7865682",
"0.7861191",
"0.7845133",
"0.7841689",
"0.78385335",
"0.78199553",
"0.7819571",
"0.7815741",
"0.7802759",
"0.78018117",
"0.77977276",
"0.7795607",
"0.779311",
"0.7787553",
"0.77795154",
"0.77795154",
"0.77785885",
"0.77771676",
"0.77731496",
"0.77699524",
"0.7765431",
"0.7762149",
"0.77611595",
"0.77594304",
"0.7759175",
"0.77436805",
"0.77436805",
"0.774253",
"0.7739771",
"0.77376676",
"0.7732653",
"0.77282864",
"0.77263236",
"0.7723869",
"0.771344",
"0.771284",
"0.77125627",
"0.77110434",
"0.77033716",
"0.76955265",
"0.769151",
"0.7688569",
"0.76784486",
"0.767525",
"0.7674052",
"0.7673699",
"0.7672531",
"0.76701033",
"0.76619536",
"0.7659135",
"0.76558256",
"0.7652213",
"0.76510954",
"0.7640228",
"0.76384103",
"0.76375794",
"0.7631766",
"0.76289546",
"0.76224613",
"0.76223415",
"0.7622234",
"0.7621179",
"0.7618685",
"0.7617882",
"0.7616918",
"0.7614978",
"0.7612589",
"0.76105434",
"0.76097375",
"0.7606657",
"0.7603662",
"0.7602827",
"0.76019967",
"0.7600422",
"0.7600332",
"0.76003045",
"0.7600288",
"0.7598574",
"0.75919116",
"0.7588345",
"0.7583293",
"0.7582031",
"0.75771886",
"0.75718874",
"0.7571238",
"0.75684434",
"0.7562206",
"0.75621074",
"0.7561543",
"0.7561395",
"0.756062",
"0.7559686",
"0.7556258"
] | 0.0 | -1 |
ar = [12,1,2,3,7,2,6,11] puts max_2_sum ar | def sum_to_n? arr, n
# YOUR CODE HERE
unless arr.length > 1
return false
end
h=Hash.new
arr.each{|a|
if h.key? a
return true else h[n-a] = n end}
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_2_sum(ar)\n return 0 if ar.empty?\n return ar[0] if ar.length == 1\n sar = ar.sort {|x,y| y <=> x }\n return sar[0] + sar[1]\nend",
"def max_2_sum(array)\n sum array.sort.last(2)\nend",
"def max_2_sum(array)\n sum(array.sort.last(2))\nend",
"def max_2_sum arr\n sum(arr.sort.last(2))\nend",
"def max_2_sum arr\n sum(arr.sort.last(2)) \nend",
"def max_2_sum arr\n sorted_array = arr.sort { |a, b| b <=> a }\n sorted_array.slice(0, 2).reduce(0) { |memo, x| memo + x }\nend",
"def max_2_sum arr\n # arr.max(2).sum()\n return arr.sort.reverse[0,2].sum() # 내림차순 sort하고 2개 합\nend",
"def max_2_sum(arr)\n arr.max(2).reduce(0,:+)\nend",
"def max_2_sum(array)\n array.max(2).sum\nend",
"def max_2_sum(*n)\n\tn.sort[-1] + n.sort[-2] #sort sorts array items from small - large, [] gets the location of an item in an array\nend",
"def max_2_sum arr\n arr = arr.max(2).sum \nend",
"def max_2_sum arr\n return 0 if arr.empty?\n return arr.first if arr.size == 1\n arr.sort.pop(2).inject(:+)\nend",
"def max_2_sum arr\n arr.max(2).reduce(0, :+)\nend",
"def max_2_sum arr\n arr.max(2).reduce(0, :+)\nend",
"def max_2_sum arr\n # arr.empty? ? 0 : arr.sort.last(2).inject(:+)\n arr.sort.last(2).inject(0, :+)\nend",
"def max_2_sum arr\n # YOUR CODE HERE\n sortedarr = arr.sort.reverse\n total = sortedarr.take(2).sum\n \n return total\nend",
"def max_2_sum(a)\n a.length > 0 ? a.sort.pop(2).inject(:+) : 0\nend",
"def max_2_sum arr\n if arr.count > 1 \n arr_ord = arr.sort \n return arr_ord[-1] + arr_ord[-2]\n elsif arr.count == 1\n return arr[0]\n else\n return 0\n end\nend",
"def max_2_sum array\n # return 0 if array.empty?\n # return array[0] if array.length == 1\n # array.sort![-1] + array[-2]\n array.length > 0 ? array.sort.pop(2).inject(:+) : 0\nend",
"def sum_of_two_largest_numbers(arr)\n arr.max(2).reduce(:+)\nend",
"def max_2_sum(int_array)\n sum(int_array.sort {|a,b| b <=> a}[0,2])\nend",
"def max_2_sum arr\n larSum = 0\n if arr.length == 0\n larSum = 0\n elsif arr.length == 1\n larSum = arr[0]\n else\n newArr = arr.sort\n larSum = newArr[newArr.length-1]+newArr[newArr.length-2]\n end\n return larSum\nend",
"def max_2_sum arr\n sum = 0\n if arr.length == 0\n return 0\n end\n if arr.length == 1\n return arr[0]\n end\n sorted_arr = arr.sort\n maxa = sorted_arr.pop\n maxb = sorted_arr.pop\n sum = maxa+ maxb\n return sum\nend",
"def max_2_sum arr\n if arr.length == 0\n return 0\n elsif arr.length==1\n return arr[0]\n else arr.sort!\n return arr[-1]+arr[-2]\n end\nend",
"def max_2_sum arr\n if arr.empty?\n return 0\n elsif arr.size==1\n return arr[arr.size-1]\n else\n arr=arr.sort\n return arr[arr.size-1]+arr[arr.size-2]\n end\nend",
"def max_2_sum arr\n result = 0\n unless arr.empty?\n if arr.size == 1\n result = arr[0]\n else \n arr = arr.sort{|x,y| y<=>x}\n result = arr[0]+arr[1]\n end\n end\n return result\nend",
"def max_2_sum array\n return 0 if array.empty?\n return array.first if array.length == 1\n sum_of_two_largest_values = array.sort[-2] + array.sort[-1]\nend",
"def max_2_sum arr\n \n if arr.empty?\n 0\n else\n arr.max(2).reduce(:+)\n end\n \nend",
"def max_2_sum arr\n return 0 if arr.empty?\n return arr[0] if arr.length == 1\n sorted = arr.sort.reverse\n sorted[0] + sorted[1]\nend",
"def max_2_sum(array)\n # YOUR CODE HERE\n return 0 if array.empty?\n\treturn array[0] if array.length == 1\n\tar = array.sort\n\tar[-1] + ar[-2]\nend",
"def max_2_sum(array)\n array_size = array.size\n case array_size\n when 0\n 0\n when 1\n array[0]\n else\n array.sort!.last(2).inject(:+)\n\n end\nend",
"def max_2_sum arr\n # YOUR CODE HERE\n if arr.empty?\n return 0 \n end\n if arr.length == 1\n return arr[0] \n end\n a = arr.sort\n a[-2] + a[-1]\nend",
"def array_2_sum(array)\r\n array.max(2).inject(0, :+) # Sum for max 2 elements.\r\nend",
"def max_2_sum arr\n if arr.empty?\n 0\n else\n arr.max(2).reduce(:+)\n end\nend",
"def max_2_sum arr\n #If the array is empty return 0\n if arr.length == 0 then\n\treturn 0\n end\n #If the array has only one element return that element\n if arr.length == 1 then \n return arr[0]\n end\n #Sorts the array in increasing order to return the sum of the last two elements.\n return arr.sort.last(2).sum\nend",
"def max_2_sum arr\n size = arr.length\n case size\n when 0\n return 0\n when 1\n return arr[0]\n else\n return arr.sort!.last(2).inject(0){|s, r| s+r}#sorts arr in Asc. order and saves, takes the last 2, black accumulator on those last 2 e's returned\n end\nend",
"def largest_sum_arr_n2(arr)\n list = []\n i = 0\n while i < arr.length\n j = i\n while j < arr.length\n list.push arr[i..j]\n j += 1\n end\n i += 1\n end\n\n result = nil\n max = nil\n list.each do |a|\n current_sum = a.inject(:+)\n if max.nil? || current_sum > max\n result = a\n max = current_sum\n end\n end\n result\nend",
"def max_2_sum arr\n return 0 if arr.empty?\n return arr[0] if arr.length==1\n \n i=1\n \n arr.each do |c| \n if i== 1\n @a=c\n elsif i==2\n if c> @a\n @b=@a\n @a=c \n else\n @b=c\n end\n elsif c>@a and c>@b\n @b=@a\n @a=c \n elsif c>@b\n @b=c\n end\n i+=1\n end\n return @a+@b\nend",
"def max_2_sum arr\n arr.empty? ? 0 : arr.max(2).reduce(:+) \nend",
"def max_2_sum arr\n if arr.empty? \n \tsum = 0\n elsif arr.count == 1\n \tsum = arr[0]\n else\n arr = arr.sort.reverse\n sum = arr[0] + arr[1]\n end\n return sum\nend",
"def max_2_sum arr\n if arr.length == 0\n return 0\n elsif arr.length ==1\n return arr[0]\n else\n arr.sort!\n return arr[arr.length-1] + arr[arr.length-2]\n end\nend",
"def max_2_sum (arr)\n \n s=0\n if (arr.length == 1)\n return arr[0]\n end\n \n if (arr.length == 0)\n return 0\n end\n \n if (!arr.empty?)\n arr=arr.sort{ |x,y| y <=> x }\n end\n \n s= arr[0] + arr[1]\n \n return s\nend",
"def max_2_sum(array)\n\n raise 'array includes non integers' unless \n (array.empty? || array.length == 1 || array.all? { |x| x.integer?})\n\n case array.length\n when 0\n return 0\n when 1\n return array[0]\n else\n array_sorted = array.sort\n return array_sorted[array.length-2] + array_sorted[array.length-1]\n end\nend",
"def max_2_sum(ints)\n return 0 if ints.empty?\n return ints.first if ints.size == 1\n ints.sort.reverse[0,2].inject(0, :+)\nend",
"def max_2_sum arr\n s = 0\n\n return s if arr.empty?\n return arr[0] if arr.length==1\n \n arr.sort!\n arr[-1] + arr[-2] \nend",
"def max_2_sum(array)\n res= array.max.to_i\n (array.delete(array.max))\n res+=array.max.to_i\nend",
"def max_2_sum(array)\n if array.empty?\n 0\n elsif array.count ==1\n array[0]\n else\n array.sort! {|a,b| b <=> a}\n array[0] + array[1]\n end\nend",
"def max_2_sum(arr)\n return 0 if arr.empty?\n return arr[0] if arr.size == 1\n\n first_max = arr.max\n arr.delete_at arr.index first_max\n\n second_max = arr.max\n\n\n first_max + second_max\nend",
"def max_2_sum( arr )\n\n if arr.nil? or arr.empty?\n 0\n elsif arr.length == 1\n arr.first\n else\n max = arr.sort[-2..-1]\n max.first + max.last\n end\n\nend",
"def max_2_sum(numbers=[])\n\tif numbers.length == 0\n\t\treturn 0\n\telsif numbers.length == 1\n\t\treturn numbers[0]\n\telse\n\t\tmax = numbers.sort.reverse[0]\n\t\tmax2 = numbers.sort.reverse.drop(1)[0]\n\t\treturn max + max2\n\tend\nend",
"def max_2_sum(int_array)\n return 0 if int_array.size == 0\n return int_array[0] if int_array.size == 1\n\n int_array.sort!\n return (int_array[int_array.length - 2] + int_array[int_array.length - 1])\nend",
"def max_2_sum(int_array)\n # YOUR CODE HERE\n heyr=0\n if int_array.length == 0\n heyr=0\n return heyr\n elsif int_array.length == 1\n heyr=int_array[0]\n return heyr\n end\n int_array.sort!.reverse!\n heyr= int_array[0] + int_array[1] \n return heyr\nend",
"def miniMaxSum(arr)\n arr = arr.sort\n a = arr[1..-1].reduce(:+)\n b = arr[0..-2].reduce(:+)\n print b\n print \" \"\n print a\nend",
"def max_2_sum(int_array)\n return 0 if int_array.length == 0\n return int_array[0] if int_array.length == 1\n int_array.sort!.reverse!\n return int_array[0] + int_array[1] \nend",
"def max_2_sum(ints)\n\treturn 0 if ints.empty?\n\treturn ints[0] if ints.length == 1\n\tints.sort!.reverse!\n\treturn ints[0] + ints[1]\nend",
"def sub_sum_improved(array)\n max = array[0]\n current_sum = array[0]\n i = 0\n (1...array.length).each do |i|\n max = [array[i], array[i] + max].max\n current_sum = [current_sum, max].max\n end\n current_sum\n end",
"def max_sub_array(arr)\n current_sum = arr[0]\n max_sum = current_sum\n\n arr[1..-1].each do |num|\n current_sum = [num, current_sum + num].max\n max_sum = [max_sum, current_sum].max\n end\n\n return max_sum\nend",
"def miniMaxSum(arr)\n arr.sort!\n low_sum = arr[0..3].inject(0, :+)\n high_sum = arr[1..4].inject(0, :+)\n print \"#{low_sum} #{high_sum}\"\nend",
"def miniMaxSum(arr)\n arr.sort!\n sum = 0\n arr.each {|item| sum+=item}\n puts \"#{sum-arr[-1]} #{sum-arr[0]}\"\nend",
"def optimized_largest_subsum(arr)\n max = arr.first\n sum = arr.first \n arr.shift\n arr.each do |el|\n sum += el\n if el > max && el > sum \n max = el \n sum = el \n elsif sum > max\n max = sum\n end \n end \n max\nend",
"def max_sub_array3(nums)\n max_sum = nums[0]\n\n (1...nums.size).each do |i|\n # nums[i] 记录到该位置时,可能获得的最大和\n # 如果前面的一个是正的,那么就加上\n # 如果前面的是付的,那么就保留当前值\n nums[i] += nums[i - 1] if nums[i - 1] > 0\n max_sum = [nums[i], max_sum].max\n end\n p nums\n p nums.max\n max_sum\nend",
"def sum_of_two_largest_numbers(arr)\n sum = 0\n\n sum += arr.max\n arr.delete(arr.max)\n\n sum += arr.max\n\n return sum\nend",
"def max_sub_array(nums)\n current_sum = nil\n max_sum = nil\n \n nums.each do |n|\n if current_sum.nil?\n current_sum = n\n elsif current_sum + n < n\n current_sum = n\n else\n current_sum = current_sum + n\n end\n max_sum = current_sum if max_sum.nil? || current_sum > max_sum\n end\n max_sum\nend",
"def maximum_sum(arr)\n mid = arr.length / 2\n maximum_sum_helper(arr, mid)\nend",
"def max_sequence(arr)\n sum = arr.first ? arr.first : 0\n\n arr.each do |num|\n sum_to_here = [(num), (sum_to_here + num)].max\n sum = [sum, sum_to_here].max\n end\n\n sum\nend",
"def opt_max_sum(arr)\n result = -1000\n (0...arr.length).each do |start|\n sum = 0\n (1..arr.length).each do |size|\n if start + size > arr.length\n break\n end\n sum += arr[start + size - 1]\n if sum > result\n result = sum\n end\n end\n end\n return result\nend",
"def largest_sum_pair(array)\nend",
"def solution2(a)\n\n total_max, current_max = a[0], 0\n\n a.each do |int|\n current_max = [current_max + int, int].max\n total_max = [total_max, current_max].max\n end\n\n return max\n\nend",
"def min_max_sum(arr)\n sorted_array = arr.sort\n print \"#{sorted_array.first(4).sum} #{sorted_array.last(4).sum}\"\nend",
"def max_sub_array(array)\n max_sum = current_val = array[0]\n array.each_with_index do |num, i|\n if (i > 0)\n sum = current_val + num\n if (sum > num)\n current_val = sum\n else\n current_val = num\n end\n if current_val > max_sum\n max_sum = current_val\n end\n end\n end\n max_sum\nend",
"def max_slice_sum(a)\n n = a.length - 1\n result = nil\n\n (0..n).each do |p|\n sum = 0\n\n (p..n).each do |q|\n sum += a[q]\n result = result.nil? ? sum : [result, sum].max\n end\n end\n result\nend",
"def max_sum_linear(data)\n if data[0] > data[1]\n biggest = data[0]\n secondBiggest = data[1]\n else\n biggest = data[1]\n secondBiggest = data[0]\n end\n\n (2..data.length-1).each do |i|\n if data[i] > secondBiggest && data[i] < biggest\n secondBiggest = data[i]\n elsif data[i] >= biggest\n secondBiggest = biggest\n biggest = data[i]\n end\n end\n return biggest + secondBiggest\nend",
"def largest_contiguous_subsum_two(list)\n largest_sum = list[0]\n current_sum = 0\n # list.inject {|acc, ele| acc + ele}\n list.each do |ele|\n current_sum = [ele, current_sum + ele].max\n largest_sum = [largest_sum, current_sum].max\n end\n largest_sum\nend",
"def max_sum_of_subarray(arr)\n current_max = global_max = arr.first\n array_size = arr.size\n\n (1..(array_size-1)).each do |i|\n current_max = [arr[i], current_max + arr[i]].max\n\n if current_max > global_max\n global_max = current_max\n end\n end\n\n global_max\nend",
"def max_sequence(arr)\r\n sums = [arr.first]\r\n\r\n arr.each_with_index do |num, num_i|\r\n (num...arr.size).each do |i|\r\n sums << arr[num_i..i].sum\r\n end\r\n end\r\n\r\n arr.empty? ? 0 : sums.max\r\nend",
"def lcss_2(arr)\n largest_num = arr.max\n max_sum = 0\n current_sum = 0\n\n arr.each do |num|\n current_sum += num\n\n if current_sum < 0\n current_sum = 0\n elsif max_sum < current_sum\n max_sum = current_sum\n end\n end\n\n return largest_num if max_sum == 0\n max_sum\nend",
"def max_sum_non_adjacent(arr)\n return 0 if arr.empty?\n return arr[0] if arr.length == 1\n\n # base case, 1st element will be as it is\n sums = [arr[0]]\n\n # 2nd element will be max of 1st two numbers\n sums[1] = arr[0..1].max\n\n (2...arr.length).each do |i|\n # max of previous element and (current array element + 2nd previous element)\n sums[i] = [sums[i - 1], arr[i] + sums[i - 2]].max\n end\n\n sums[-1]\nend",
"def largest_sum_better(arr)\n largest_sum = arr.first\n current = arr.first\n\n (1...arr.length).each do |idx|\n if current < 0\n current = 0\n end\n\n current += arr[idx]\n \n if current > largest_sum\n largest_sum = current\n end\n end\n\n largest_sum\nend",
"def mini_max_sum(arr)\n arr = arr.sort\n max = arr.inject(0, :+) - arr[0]\n min = arr.inject(0, :+) - arr[-1]\n\n # [min, max]\n \"#{min}\" + \" \" + \"#{max}\"\nend",
"def max_sub_array(nums)\n max_sum = nums[0]\n\n for i in (0...nums.length) do\n sum_so_far = 0\n for j in (i...nums.length) do\n sum_so_far += nums[j]\n max_sum = [sum_so_far, max_sum].max\n end\n end\n\n return max_sum\nend",
"def max_subarray_sum(array)\n new_sum = max = array[0]\n (1...array.length).each do |i|\n new_sum = find_max(new_sum + array[i], array[i])\n max = find_max(max, new_sum)\n end\n return max\nend",
"def largest_cont_sum(array)\n return nil if array.empty?\n \n max_sum = 0\n current_max_sum = 0\n\n array.each do |number|\n current_max_sum = [current_max_sum + number, number].max\n max_sum = [current_max_sum, max_sum].max\n end\n\n max_sum\nend",
"def sum(max)\n new_term = 0\n sequence = [1, 2]\n while new_term < max\n new_term = sequence[-1] + sequence[-2]\n sequence << new_term\n end\n sequence.pop\n p sequence\n p sequence.select(&:even?).sum\nend",
"def maximum_sub_array2(arr)\n current = []\n max_sum = cur_sum = 0\n max = (0...arr.size).inject([]) do |max, i|\n current << arr[i]\n cur_sum += arr[i]\n if cur_sum > max_sum\n max << i\n max_sum = cur_sum\n end\n max\n end\n arr[max[0]..max[-1]]\nend",
"def find_sum(array)\n max = 0\n temp_array = array.clone\n (1...array.length).each do |i|\n (0...i).each do |j|\n if (array[i] > array[j] && temp_array[i] < temp_array[j] + array[i])\n temp_array[i] = temp_array[j] + array[i]\n end\n end\n end\n (0...array.length).each do |k|\n max = temp_array[k] if temp_array[k] > max\n end\n return max\nend",
"def largest_subsum_p2(arr)\n max_sum = 0\n arr.each do |el|\n temp = max_sum + el\n temp = 0 if temp < 0\n max_sum = temp if temp > max_sum\n end\n\n if max_sum == 0\n # all the nums are negative\n max_sum = arr[0]\n arr.each do |el|\n max_sum = el if el > max_sum\n end\n end\n\n max_sum\nend",
"def sub_array_sum(nums)\n greatest_sum = nums.first\n current_sum = 0\n nums.each do |num|\n current_sum += num\n greatest_sum = current_sum if current_sum > greatest_sum\n current_sum = 0 if current_sum < 0\n end\n greatest_sum\nend",
"def maxSubArray(a)\n return nil if a.empty?\n curr_sum = a[0]\n max_sum = a[0]\n (1...a.length).each do |i| \n if curr_sum <= 0\n curr_sum = a[i]\n else\n curr_sum += a[i]\n end\n max_sum = curr_sum if max_sum < curr_sum\n end\n max_sum\nend",
"def max_sub_array2(nums)\n ans = nums[0]\n\n (1..nums.size).each do |size|\n nums.each_cons(size) do |a|\n ans = [ans, a.sum].max\n end\n end\n\n ans\nend",
"def maximum_sum_subarray(nums)\n highest_seen = nums[0]\n lowest_seen = nums[0]\n highest_curr = nums[0]\n lowest_curr = nums[0]\n\n nums[1..-1].each do |num|\n temp = highest_curr\n highest_curr = [num, highest_curr + num, lowest_curr + num].max\n lowest_curr = [num, temp + num, lowest_curr + num].min\n\n highest_seen = [highest_seen, highest_curr].max\n lowest_seen = [lowest_seen, lowest_curr].max\n end\n highest_seen\nend",
"def better_largest_sub_sum(array)\n largest_sum = 0\n current_sum = 0\n array.each_with_index do |el, idx|\n current_sum += el\n current_sum = 0 if current_sum < 0\n largest_sum = current_sum if current_sum > largest_sum\n end\n largest_sum\nend",
"def max_sequence(arr)\n puts arr\n index = 0\n numIndexes = 0\n highestSum = arr.min\n \n length = arr.count\n \n highestNum = arr.max\n\n if arr != [] && highestNum < 0 \n return 0\n elsif arr == []\n return 0\n end\n \n arr.map.with_index do |n,i|\n\n for c in 0..i\n \n sum = arr.slice(c,length-i).inject(:+)\n\n if sum > highestSum\n highestSum = sum\n index = i\n numIndexes = length-i\n end\n \n end\n \n end\n \n highestSum\n \nend",
"def maxSubArraySum(a)\n maxint =(2**(0.size * 8 -2) -1)\n msf = -maxint - 1\n max_end = 0\n \n for i in (0..a.length-1)\n max_end = max_end + a[i] \n if (msf < max_end)\n msf = max_end\n end\n \n if (max_end < 0) \n max_end = 0 \n end\n end\n return msf\nend",
"def max_consecutive_sum(arr)\n #YOUR WORK HERE\nend",
"def largest_contiguous_subsum_2(arr)\n sum = 0\n max = 0\n arr.each do |num|\n sum += num\n if sum > 0\n max = sum if sum > max\n else\n sum = 0\n end\n end\n max\nend",
"def max_sub_array(numbers)\n max = numbers[0]\n\n (1...numbers.size).each do |idx|\n current_sum = numbers[idx] + numbers[idx - 1]\n numbers[idx] = current_sum if current_sum > numbers[idx]\n max = numbers[idx] if numbers[idx] > max\n end\n\n max\nend",
"def calc_max(arr)\n max_sum = 0\n arr.each do |line|\n (0..(line.size - 4)).each do |start|\n sum = line[start..(start + 3)].inject(:*)\n max_sum = sum if sum > max_sum\n end\n end\n max_sum\nend",
"def largest_contiguous_sub_sum1(list)\n max = list[0]\n (0...list.length).each do |i|\n (i...list.length).each do |j| \n sub_sum = list[i..j].sum \n max = sub if sub >= max \n end\n end\n max\nend",
"def miniMaxSum(arr)\n minimum = arr.sum\n maximum = 0\n arr.collect do |number|\n sum = arr.sum - number\n minimum = [minimum, sum].min\n maximum = [maximum, sum].max\n end\n puts minimum.to_s + \" \" + maximum.to_s\nend",
"def sub_max(array)\n so_far = array[0]\n max_point = array[0] # [0] -2 and [1] 1 sum -1, number 1\n\n array.each do |number|\n # to find the max between the two values:\n max_point = max((number + max_point), number)\n so_far = max(max_point, so_far)\n end\n\n return so_far\nend",
"def subset_sum(arr)\n max_so_far = 0\n max_ending_here = 0\n\n arr.each do |el|\n max_ending_here = max_ending_here + el\n if max_ending_here < 0\n max_ending_here = 0\n end\n if max_so_far < max_ending_here\n max_so_far = max_ending_here\n end\n end\n max_so_far\nend"
] | [
"0.88413167",
"0.86858577",
"0.868312",
"0.8633925",
"0.85873747",
"0.8563176",
"0.8540599",
"0.8530031",
"0.8479846",
"0.8455737",
"0.84409845",
"0.8435277",
"0.8435194",
"0.8435194",
"0.8398274",
"0.83772784",
"0.83700895",
"0.83585393",
"0.8349051",
"0.8303656",
"0.8262274",
"0.8223091",
"0.82174754",
"0.8216313",
"0.8191232",
"0.8187059",
"0.81795174",
"0.8155133",
"0.8146666",
"0.81413424",
"0.81390285",
"0.8109976",
"0.810558",
"0.81047004",
"0.81013036",
"0.80920285",
"0.80892575",
"0.8073122",
"0.806236",
"0.80518454",
"0.80194503",
"0.8000641",
"0.79811454",
"0.7974301",
"0.7952867",
"0.79323256",
"0.78865236",
"0.786572",
"0.7848962",
"0.77843225",
"0.77133167",
"0.76456743",
"0.76436895",
"0.7627004",
"0.76004225",
"0.75372696",
"0.74901116",
"0.7486554",
"0.745406",
"0.7451288",
"0.7439035",
"0.743647",
"0.7416869",
"0.74155647",
"0.73614144",
"0.7351805",
"0.732762",
"0.7308082",
"0.7281828",
"0.72625035",
"0.72429705",
"0.7242485",
"0.7238274",
"0.72349584",
"0.72225696",
"0.72155994",
"0.72137827",
"0.72044754",
"0.7204333",
"0.7194614",
"0.7188399",
"0.71838415",
"0.71795005",
"0.7168271",
"0.7167461",
"0.71670884",
"0.7138877",
"0.71265703",
"0.71167964",
"0.7106615",
"0.71012926",
"0.70981324",
"0.70922714",
"0.7092246",
"0.7079438",
"0.70719534",
"0.7068082",
"0.70656234",
"0.70632434",
"0.70581317",
"0.7049835"
] | 0.0 | -1 |
ar = [1,2,3,4,5,6,7,8] puts sum_to_n? ar , 100 Part 2 | def hello(name)
# YOUR CODE HERE
"Hello, #{name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_to_n? arr, n\n result = false\n sum = 0\n if arr.size>1\n arr.each {|num| result = true if num == n}\n end\n \n return result\nend",
"def sum_to_n? arr, n\n return false if arr.empty?#empty to 0\n i=0\n while i < arr.length do#goes throgh all elements\n e = arr.shift#returns the 1st element to e and removes it from array\n arr.each{ |x| return true if x + e == n }#add e and all the remaining elements to see if they add up to n\n i += 1\n end\n false\nend",
"def sum_to_n?(array,n)\n\n raise 'parameters include non integers' unless \n (array.empty? || array.length == 1 || n.integer? || array.all? { |x| x.integer?})\n\n array.length.times do \n y = array.shift\n if array.any? { |x| x + y == n } \n return true\n end\n end\n return false\nend",
"def sum_to_n? arr, n\n #arr.product(arr).any? {|c| sum(c) == n && c[0] != c[1] } ----1.3\n arr = arr.sort\n low = 0\n high = arr.length - 1\n while low < high\n if arr[low] + arr[high] == n\n return true\n end\n arr[low] + arr[high] < n ? low += 1 : high -= 1 \n end\n return false\nend",
"def sum_to_n?(arr, n)\n for x in arr\n if arr.include?(n - x)\n return true\n end\n end\n return n==0 && arr.empty?\nend",
"def sum_to_n?(a, n)\n result = false\n\n while a.length > 1\n e1 = a.slice!(0)\n a.each {|e2| e2 + e1 == n ? result = true : break }\n end\n\n result\nend",
"def sum_to_n?( arr, n )\n return false if arr.nil? or arr.empty? or arr.length == 1\n arr.each do |first|\n arr.each do |second|\n return true if (first + second == n) and first != second\n end\n end\n false\nend",
"def sum_to_n?(ar, n)\n return false if ar.empty? or ar.count == 1\n ar.uniq.permutation(2).any? { |a| a.first+a.last == n }\nend",
"def sum_to_n? arr, n\n if arr.nil? || arr.empty? || arr.size == 1\n return false\n else \n arr.each {|x| arr.each {|y| return true if x + y == n && x != y}}\n end\n return false\nend",
"def sum_to_n? arr, n\n len = arr.length\n\n #Returns false when the length of the array is 0.\n if len == 0 then\n return false\n end\n #Iterates through the array to find the first index\n i = 0\n while i < len-1 do\n #Iterate through the rest of the elements of the array\n j = i+1\n while j <= len-1 do\n if arr[i]+arr[j] == n then\n return true\n end\n j+=1\n end\n i+=1\n end\n return false\nend",
"def sum_to_n? arr, n\n return false if arr.empty? or arr.length == 1\n for i in 0...arr.length - 1\n for j in i + 1...arr.length\n if arr[i] + arr[j] == n\n return true\n end\n end\n end\n return false\nend",
"def sum_to_n?(array, n)\n\n array_size = array.size\n\n i = 0\n\n while i < array_size do\n argument = array.slice!(0)\n array.each{|x| return true if x + argument == n}\n i += 1\n end\n return false\nend",
"def sum_to_n?(array, n)\n # YOUR CODE HERE\n return false if array.empty? or array.length == 1\n\n\th = Hash.new\n\tarray.each{|x| \n\t\tif h.key? x\n\t\t\treturn true\n\t\telse\n\t\t\th[n - x] = n\t\n\t\tend\n\t}\n\treturn false\nend",
"def sum_to_n? arr, n\n\nreturn false if arr.empty? || arr.length==1\n\nfor i in 0...arr.length\n for j in 0...arr.length\n if i != j\n return true if arr[i] + arr[j] == n\n end\n end\nend\n\nreturn false\n\nend",
"def sum_to_n?(int_array, n)\n return true if int_array.length == 0 && n == 0\n int_array.each_with_index{ |val, index| \n return true if int_array.find_index(n - val) && int_array.find_index(n - val ) != index\n }\n return false # default return false\nend",
"def sum_to_n?(int_array,n)\n # YOUR CODE HERE\n return false if int_array.length == 0 \n int_array.each_with_index{ |val, index| \n return true if int_array.find_index(n - val) && int_array.find_index(n - val ) != index\n }\n return false # default return false\nend",
"def sum_to_n? arr, n\n if arr.length == 1\n return false\n end\n \n #sort arr and find head and tail indices\n sorted_arr = arr.sort\n head = 0\n tail = sorted_arr.length-1\n \n #iterating through arr to find the sum that equals n\n while head < tail\n current_sum = sorted_arr[head] + sorted_arr[tail]\n if current_sum == n\n return true\n elsif current_sum < n\n head = head + 1\n else\n tail = tail - 1\n end\n end\n return false\nend",
"def sum_to_n? arr, n\n # YOUR CODE HERE\n unless arr.length > 1\n return false\n end\n h=Hash.new\n arr.each{|a|\n if h.key? a \n return true else h[n-a] = n end}\n return false\nend",
"def sum_to_n? arr, n\n arr.each_with_index { |first, i1|\n arr.each_with_index { |sec, i2|\n return true if first + sec == n && i1 != i2\n }\n }\n return false\nend",
"def sum_to_n?(ints, n)\n return n == 0 if ints.size == 0\n (0...ints.size).each_with_index do |i|\n (i+1...ints.size).each do |j|\n return true if (ints[i]+ints[j]==n)\n end\n end\n return false\nend",
"def sum_to_n? arr, n\n hash = Hash.new\n arr.each do |val|\n if hash.key? val\n return true\n else\n hash[n-val] = val\n end\n end\n return false\nend",
"def sum_to_n? arr, n\n if arr.length > 1\n for i in arr do\n ndx = arr.find_index(i)\n x = arr.delete_at(ndx)\n if arr.include?(n - x)\n return true\n end\n arr.insert(ndx, x)\n end\n end\n return false\nend",
"def sum_to_n? arr, n\n if arr.size>=2\n for a in arr\n if arr.include?(n-a) and (a != n-a or arr.count(a) > 1)\n return true\n end\n end\n end\n false\nend",
"def sum_to_n?(array, num)\n return false if array.length < 2\n hash = Hash.new\n array.each do |val|\n if hash.key? val\n return true\n else \n hash[num-val] = val\n end\n end\n return false\nend",
"def sum_to_n?(array, n)\n array.product(array).any? {|couple| sum(couple) == n}\nend",
"def sum_to_n?(arr, n)\n # return false if arr.empty? - taken care of by spaceship operator et al\n left = 0\n right = arr.length - 1\n arr.sort!\n while left < right\n case arr[left] + arr[right] <=> n\n when 0\n return true\n when 1\n right -= 1\n when -1\n left += 1\n end\n end\n false\nend",
"def sum_to_n?(arr, n)\n return false if arr.empty?\n\n combinations = arr.combination(2).to_a # for [1, 2, 3] return [[1, 2], [1, 3], [2, 3]]\n sums = combinations.map { |combination| combination.reduce(0, :+) }\n\n sums.include? n\nend",
"def sum_to_n?(array, n)\n return false if array.length < 2\n\n for i in 0..array.length - 2\n for j in i+1..array.length - 1\n return true if array[i] + array[j] == n\n end\n end\n\n return false\nend",
"def sum_to_n? arr, n\n arr = [0] if (arr.nil? || arr.empty?)\n arr.combination(2).any? { |a,b| (a+b) == n }\nend",
"def sum_to_n (arr, n) \n\n if arr.length == 1 or arr.empty?\n \tfalse\n\n else\n \tarr.each do |el|\n \t\tnumber = el\n \t\tfor i in el...arr.length do\n \t\t\tif arr[i] + number == n\n \t\t\t\tputs \"in the loop\"\n \t\t\telse\n \t\t\t\tputs \"else\"\n \t\t\tend\n \t\tend\n \tend\n\n end\n\nend",
"def sum_to_n? arr, n\n\n if arr.empty? \n sum = false\n elsif arr.count == 1\n \tsum = false\n else\n x = arr.combination(2).each { |s| (s[0] + s[1]) }\n if x.include? n\n sum = true\n else\n sum = false\n end\n end\n\nend",
"def sum_to_n?(numbers, n)\n\tif numbers.length == 0\n\t\tif n == 0\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\telse\n\t\treturn numbers.permutation(2).any?{|pair| pair.inject(:+) == n}\n\tend\nend",
"def sum_to_n? arr, n\n \n if arr.size>=2\n for x in arr\n if arr.include?(n-x) and x != n-x or arr.count(x) > 1\n return true\n end\n end\n end\n \n false\nend",
"def sum_to_n? (arr, n)\n \n count=false\n \n if !(arr.empty? || arr.length == 1)\n count=!! arr.uniq.combination(2).detect{|a,b| a + b == n} \n end\n \n return count\nend",
"def sum_to_n? arr, n\n if arr.size>=2\n for x in arr\n target = n-x\n tmp = arr.dup\n tmp.delete_at(tmp.index(x))\n return true if tmp.include?(target)\n end\n end\n false\nend",
"def sum_to_n? arr, n\n arr = arr.combination(2).to_a\n arr.any? {|a| a.sum == n} ? true : false\nend",
"def sum_to_n?(array, n)\n if array.empty? and n==0 or (array.size==1 and array[0] == n)\n return true\nend\na=array.combination(2).to_a\na.map! { |row| row.reduce(:+) }\na.each { |e|\n if e==n\n return true\n end }\n false\n end",
"def sum_to_n? arr, n\n !!arr.uniq.combination(2).detect { |x, y| x + y == n }\nend",
"def sum arr\n rtn = 0\n arr.each { |n| rtn += n }\n return rtn\nend",
"def sum(n)\n end",
"def sum_eq_n?(arr, n)\n if arr == [] && n == 0\n return true\n end\n for i in 0..arr.length-2\n for j in i+1..arr.length-1\n if arr[i] + arr[j] == n\n return true\n end\n end\n end\n return false\nend",
"def sum_to_n?(array, n)\n return false if array.empty? || array.length == 1\n\n array.combination(2).any? { |x, y| x + y == n }\nend",
"def sum_to_n?(array,n)\n if array.empty? || array.count == 1\n false\nend\n if array.combination(2).detect {|a,b| a+b ==n}\n true\n end\nend",
"def sum_to_n? arr, n\n return false if arr.empty?\n combinations_found = arr.combination(2).to_a.select { |o| o.inject(:+) == n }\n combinations_found.size > 0\nend",
"def sum_to(n)\n n > 1 ? n + sum_to(n - 1) : n < 1 ? [].first : 1\n end",
"def array_sum_to_n?(array, n)\r\n array.combination(2).any?{ |x, y| x + y == n } # For any combination of two elements their sum must be equal to n.\r\nend",
"def sumNumbers(arr)\n arr.map{|i|\n i > 9 ? splittedSum(i) : i\n }.inject(0,:+)\n end",
"def canBeSum(n, array, cache)\n\ti = 0\n\twhile array[i] <= n / 2\n\t\tif cache[n-array[i]] # array.include?(n-array[i]) is OK, but very slow\n\t\t\treturn true\n\t\tend\n\n\t\ti += 1\n\tend\n\n\treturn false\nend",
"def sum_to_n? arr, n\n # YOUR CODE HERE\n pairs = arr.combination(2).to_a\n \n for p in pairs\n if p.sum == n \n return true\n end\n end\n \n return false\nend",
"def total(array)\n i = 0\n array.each { |a| i += a.to_i }\n return i\nend",
"def sum(array_of_integers)\n # TODO\nend",
"def total(array)\n array.inject { |sum, n| sum + n}\nend",
"def sum(array)\n sum = 0\n array.each { |n| sum += n } \n sum\nend",
"def sum_numbers(arr, n)\n sum = 0\n index = 0\n\n arr.each do |i|\n if index != n \n sum += i\n else\n return sum\n end\n\n index += 1\n end\nend",
"def sum_of_amicable_numbers(n)\r\n amicable_numbers(n).reduce(:+)\r\nend",
"def total(array)\n sum = 0\n array.each do |n|\n sum += n\n end\n sum\nend",
"def sum_numbers(arr, n)\n c = arr.n[0]+n[1]+n[2]+n[3].sum\nend",
"def two_number_sum array, n \n\tarray.sort!\n\treverse_index = array.size - 1 \n\tindex = 0\n\twhile index >= reverse_index\n\t\tif array[index] + array[reverse_index] > n\n\t\t\treverse_index -= 1\n\t\telsif array[index] + array[reveres_index] < n\n\t\t\tindex += 1\n\t\telse\n\t\t\tputs \"#{array[index]} + #{array[reverse_index]}\"\n\t\t\tindex += 1\n\t\tend\n\tend\nend",
"def sum arr\n sum = 0\n arr.each do |n|\n sum+= n\n end\n return sum\nend",
"def aVeryBigSum(ar)\n sum = ar.sum\nreturn sum\nend",
"def array_sum(arr)\n\n sum = 0\n arr.each {|n| sum += n}\n\n sum\nend",
"def sum arr\n arr.inject(0){|sum,n| sum + n }\nend",
"def sum arr\n result = 0\n #Iterate through the length of the array to find the sum of the array elements\n if arr.length > 0 then\n arr.each do |index|\n\tresult += index\n end\n end\n return result\nend",
"def sum_to_n? arr, n\n # Creates an array of every possible pair in arr and finds pair that sums n\n if arr.combination(2).find{|a,b| a + b == n}\n return true\n else\n return false\n end\nend",
"def sum_of_n(n)\n # your code here\n # result = []\n # if n >= 0\n # ary = (0..n).to_a\n # else\n # ary = (n..0).to_a.reverse\n # end\n # ary.each_with_index do |_numb, index|\n # somme = 0\n # result << somme += ary[0..index].sum + somme\n # end\n # result\n sum = 0\n (n.negative? ? 0.downto(n) : 0.upto(n)).map do |number|\n sum += number\n end\nend",
"def simpleArraySum(ar)\n count = 0\n ar.each {|x| count += x}\n count\nend",
"def test_sum_array\n array = [7,5,35,9,654,2,89]\n result = array_sum(array)\n\n assert_equal( 801, result )\n end",
"def arr_sum(array)\n sum = 0 # Declares initial value for variable 'sum' as 0\n array.each do |i| # Begin iterating each item of arr\n sum += i # add each number in array to the next item, continue until items exhausted\n end\n return sum # Returns new sum value\nend",
"def sum_of_big_numbers(array_of_integers)\n # TODO\nend",
"def solution(a)\n return 0 if a.uniq.size != a.size\n \n max = a.size \n sum = (1 + max) * max / 2\n \n array_sum = a.inject(0, &:+) \n sum == array_sum ? 1 : 0 \nend",
"def namerisuminarray arr \n len = arr.length\n sum = 0\n sum = sum.to_i\n broqch = 0\n \n while broqch <= len - 1\n sum = sum + arr[broqch].to_i\n broqch = broqch + 1\n end\n \n return sum \nend",
"def sum_to_n? arr, n\n match = arr.combination(2).find { |x, y| x + y == n }\n if match\n return true\n else\n return false\n end\nend",
"def sum(arr)\n output = 0\n arr.each do |num|\n output += num\n end\n return output\nend",
"def sum_to(n)\n (1..n).reduce(0) do |sum, value|\n sum + value\n end\nend",
"def solution(n)\n sum = 0\n (1...n).each do |elem|\n sum += elem if elem % 3 == 0 or elem % 5 == 0\n end\n sum\nend",
"def sum_to_n?(ints, n)\n\t# ints.each{|first|\n\t# \tints.each{|second|\n\t# \t\treturn true if first + second == n\n\t# \t}\n\t# }\n\t# return false\n\tif ints.empty?\n\t\tints[0,1] = 0,0\n\t\t# return n == 0 ? true : false\n\tend\n\n\tcombinations = ints.combination(2).to_a\n\tcombinations.each{|c|\n\t\treturn true if c[0] + c[1] == n\n\t}\n\treturn false\nend",
"def sum_array(array)\n array.inject {|sum, n| sum + n }\nend",
"def sum_array(array)\n array.inject {|sum, n| sum + n}\nend",
"def sum(array)\n array.inject(0){|sum, n| sum + n}\n end",
"def sumArray(array)\n sum = 0\n array.each do\n |n|\n sum += n.to_i\n end\n puts \"Somme : #{sum}\"\nend",
"def total(arr)\nnumber = 0\narr.each { |x| number += x}\n return number\nend",
"def sum(n)\n result = 0\n n.each do |number|\n result = result + number\n end\n return result\n end",
"def sum_of_sums(array)\n sequence_total = 0\n sum = 0\n array.each do |n|\n sequence_total += n\n sum += sequence_total\n end\n sum\nend",
"def array_num_total array\r\n i = 0\r\n\tnum_total = 0\r\n\tinteger_array = array.collect { |item| item.to_i }\r\n\twhile i < integer_array.length\r\n\t num_total = integer_array[i] + num_total\r\n\t\ti = i + 1\r\n\tend\r\n num_total\r\nend",
"def total(array) \n number = 0\n array.each do |i|\n number += i\n end\n number\nend",
"def total (array)\n\tarray.inject { |sum, n| sum + n }\nend",
"def total(array)\n\tarray.inject {|sum,n| sum + n}\n\tend",
"def sum(n=16) end",
"def aVeryBigSum(ar)\n ar.reduce(:+)\nend",
"def sum_of_sums(array)\n n = 1\n running_total = 0\n while n <= array.size\n running_total += array.first(n).reduce(:+)\n n += 1\n end\n running_total\nend",
"def sum_of_n(n)\n key = 0\n answer = (0..n.abs).to_a.map { |num| key += num }\n n < 0 ? (answer.map { |n| n * (-1) }) : answer\nend",
"def sum arr\n return 0 if arr.empty?\n arr.inject(:+)\nend",
"def count(n,ar)\r\n result = Array.new(100){|x| x = 0}\r\n ar.each { |x| result[x] = result[x]+1 }\r\n return result\r\nend",
"def sumCheck(array)\r\n arraySum = 0\r\n for i in array\r\n arraySum += i\r\n end\r\n return arraySum\r\nend",
"def sum_to_n?(arr, n)\n return false if arr.empty? or arr.length == 1\n # returns true at first pair that sum to n\n return true if arr.combination(2).find { |x, y| x + y == n }\n # returns true at first pair that sum to n\n return false\nend",
"def sum_to_n?(int_array, n)\n return false unless int_array.respond_to?(:combination)\n \n int_array.uniq.combination(2).detect {|arr| sum(arr) == n }\nend",
"def total(input_array)\n\tn = 0\n\tinput_array.each do |x|\n\t\tn += x\n\tend\n\treturn n\nend",
"def sum arr\n result = 0\n arr.each do |num|\n \tresult += num\n end\n result\nend",
"def sum(array)\n\ttotal = 0\n\tfor number in array #could do each do instead of for loop\n\t\ttotal += number\n\tend\n\treturn total\nend",
"def sum(array)\n\tanswer = 0\n\tif array.length > 0 then\n\t\tarray.each {|x| answer += x}\n\telse\n\t\treturn 0\n\tend\n\treturn answer\nend",
"def sum arr\n sum = arr.sum\n return sum\nend"
] | [
"0.76581335",
"0.76269585",
"0.75408334",
"0.74987227",
"0.74719393",
"0.7459591",
"0.7456765",
"0.74144167",
"0.73850226",
"0.7337382",
"0.73184174",
"0.72775155",
"0.72710407",
"0.7249368",
"0.7233714",
"0.72080904",
"0.7206499",
"0.7198432",
"0.71878934",
"0.7174599",
"0.7174019",
"0.7172872",
"0.71455055",
"0.7135216",
"0.7131622",
"0.7123197",
"0.71211445",
"0.711104",
"0.7091263",
"0.7078007",
"0.70264804",
"0.70199496",
"0.70048535",
"0.7002524",
"0.6994313",
"0.6991675",
"0.6989266",
"0.6970097",
"0.6933157",
"0.6928262",
"0.69191915",
"0.69090825",
"0.68735826",
"0.6869667",
"0.68637747",
"0.6846195",
"0.68204725",
"0.6801435",
"0.67899567",
"0.6748242",
"0.6739236",
"0.67145705",
"0.6711819",
"0.67012775",
"0.67010975",
"0.6697722",
"0.6696646",
"0.66921",
"0.66853374",
"0.66736555",
"0.6655766",
"0.6651439",
"0.66479886",
"0.6647167",
"0.6643868",
"0.6641014",
"0.6638518",
"0.6624996",
"0.662033",
"0.6616956",
"0.66024834",
"0.66007644",
"0.65969783",
"0.65862554",
"0.6583948",
"0.65822923",
"0.6571469",
"0.6567517",
"0.65672433",
"0.65571487",
"0.65545344",
"0.6553283",
"0.6549126",
"0.6547661",
"0.65471774",
"0.6546569",
"0.6544258",
"0.6542997",
"0.65382856",
"0.65327024",
"0.6531236",
"0.6519319",
"0.6518711",
"0.65124375",
"0.6494725",
"0.64916897",
"0.6488245",
"0.64858294",
"0.6485791",
"0.64843327",
"0.6484142"
] | 0.0 | -1 |
GET /surgeries GET /surgeries.json | def index
# Initialize the surgery
@surgery = Surgery.new
# adding the pagination for page with page limit 10 record
@surgeries = Surgery.where(user_type: "admin").paginate(page: params[:page],per_page: 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @surgeries = Surgery.all\n end",
"def index\n @surgeries = Surgery.all\n end",
"def surgery_name_list\n\t\tsurgeries = current_user.surgeries\n\t\tif surgeries.present?\n\t\t# response to the JSON\n \t render json: { success: true, response: {surgeries: surgeries.collect(&:name).as_json } },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"Surgeries are not present\" },:status=> 203\n\t end \n\tend",
"def allergies\n raise UserNotAuthenticated unless access_token\n\n get('records/allergies')\n end",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def search_surgery\n\t\t# Searching for surgery as per user entered term\n\t\tif Surgery.where(user_type: \"admin\").any_of({ :name => /^#{params[:term]}/i }).present?\n\t\t\t# if search show from the admin then the search term from surgery of admin\n\t\t\tsurgeries = Surgery.where(user_type: \"admin\").any_of({ :name => /^#{params[:term]}/i }).all.collect{|surgery| {label: surgery.name}}.uniq.to_json\n\t\telse\n\t\t\t# else the term is not equal to the admin surgery then that search from the user term\n\t\t\tsurgeries = current_user.surgeries.any_of({ :name => /^#{params[:term]}/i }).all.collect{|surgery| {label: surgery.name}}.uniq.to_json \n\t\tend\n\t\t# render to the surgery name page\n\t\trespond_to do |format|\n\t\t format.json { render :json => surgeries }\n\t\tend\n\tend",
"def show\n @surgery = Surgery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @surgery }\n end\n end",
"def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end",
"def show\n @badge = Badge.find(params[:id])\n @users = @badge.users\n respond_with @badge\n end",
"def index\n @specialties = Specialty.all\n\n render json: @specialties\n end",
"def surveys\n person_id = params[:person_id]\n \n surveys = SurveyService.findSurveysForPerson person_id\n \n render json: surveys.to_json, :content_type => 'application/json'\n end",
"def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end",
"def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\n end\n end",
"def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def surgery_name_list\n\t\t@surgeries = devise_current_user.surgeries.to_a.uniq {|surgery| surgery.name}\n\tend",
"def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end",
"def index\n\t\tsurgery_locations = SurgeryLocation.all\n\t\tif surgery_locations.present?\n\t # response to the JSON\n\t render json: { success: true, response: surgery_locations.map{ |f| SurgeryLocationSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Surgery Location is not present.\" },:status=> 203\n\t end \n\tend",
"def index\n @allergies = Allergy.all\n end",
"def index\n render json: Seller.all\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def index\n @universities = University.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @universities }\n end\n end",
"def show\n render json: Agent.find(params[:id]).buyers\n end",
"def show\n\t\trecords = University.where(['name LIKE ?', \"#{params[:name]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend",
"def index\n load_county or raise \"county not found\"\n\n breadcrumbs.add(:url=>@state.to_url, :title=>@state.name)\n breadcrumbs.add(:url=>@county.to_url, :title=>@county.name)\n self.page_title = \"#{@county.fancy_name_with_state} Cemetery Map\"\n\n @graveyards = @county.graveyards.includes(:main_photo).includes(:county)\n\n respond_to do |fmt|\n @visits=UserVisitsCollection.new(current_user)\n @visits.add_graveyards(@graveyards)\n fmt.json do\n render :json => {\n status: :success,\n locations: @graveyards.sort_by(&:name).map(&:map_data).map { |g|\n if v = @visits.visit_for(g[:id])\n g[:visit] = v.as_json(:only=> [\n :id, :status, :visited_on,\n :expedition_id, :ordinal, :quality\n ])\n end\n g\n },\n # visits: @visits\n }\n end\n fmt.html { render :action=>:index }\n end\n end",
"def index\n @guardianships = Guardianship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guardianships }\n end\n end",
"def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end",
"def index\n @blood_pressures = BloodPressure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blood_pressures }\n end\n end",
"def show\n @sundry_grn = SundryGrn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sundry_grn }\n end\n end",
"def uni_years\n @uni_years = UniYear.where(university_id: params[:university_id])\n \n respond_to do |format|\n format.json { render json: @uni_years }\n end\n end",
"def surgery_search\n # Search for the speciality names\n @surgeries = find_surgery_term(params[:surgeryterm])\n # respond to rendering the pages\n respond_to do |format|\n format.js\n end\n end",
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end",
"def badges(id)\n get(\"users/#{id}/badges\")\n end",
"def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end",
"def index\n @registries = Registry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registries }\n end\n end",
"def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end",
"def index\n @registrations = Tournament.find(params[:tournament_id]).registrations\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n @chargers = Charger.all\n render json: @chargers\n end",
"def index\n @surgery_supplies = SurgerySupply.all\n end",
"def index\n @injuries = Injury.all\n end",
"def index_single_gift\n render json: @gift, include: :ages, status: :ok\n end",
"def show\n render json: @grade\n end",
"def index\n @goods = Good.where(user: current_user.building.users)\n respond_to do |format|\n format.html\n format.json do\n render json: {\n goods: @goods.map{|g|g.attributes.merge(image: url_for(g.user.profile.pic), ownerId: g.user.id)}\n }\n end\n end\n end",
"def index\n @grannies = policy_scope(Granny)\n if params[:query].present?\n @grannies = Granny.where(district: params[:query])\n else\n @grannies = Granny.all\n end\n end",
"def show\n animal = Animal.find(params[:id])\n #return all the sightings for the animal\n render json: animal.to_json(include: :sightings)\nend",
"def index\n @uasgs = Uasg.all\n end",
"def index\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n WITH src AS (SELECT id, daughters(id)\n FROM kine WHERE owner_id = #{params[:search_owner]})\n SELECT json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n else\n @daughters = Daughter.all\n end\n end",
"def building_and_grounds\n bag = SuperSuperCategory.find_by(name: \"Facilities\")\n super_categories = bag.super_categories\n\n if params[:org]\n @data = build_from_super_super_categories(super_categories, params[:org].to_i)\n else\n @data = build_from_super_super_categories(super_categories, 0)\n end\n\n render json: @data\n end",
"def show\n render json: @sighting\n end",
"def index\n @upcoming_harvests = Harvest.upcoming\n @past_harvests = Harvest.past\n\n if params[:person_id]\n @person = Person.find(params[:person_id])\n @upcoming_harvests = @person.upcoming_harvests\n @past_harvests = @person.past_harvests\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvests }\n end\n end",
"def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end",
"def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end",
"def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end",
"def show\n @citation = Citation.find(params[:id])\n @galaxies = @citation.galaxies\n @citation.galaxy_ids_array\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :json => @citation.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key],\n :methods => [:galaxy_ids_array]\n )\n }\n end\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end",
"def index\n @user = User.find(session[:user_id])\n @schools = @user.schools\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schools }\n end\n end",
"def show\n render json: @weapon\n end",
"def index\n @ugroupes = Ugroupe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ugroupes }\n end\n end",
"def index\n @sponsorship_levels = SponsorshipLevel.all\n end",
"def show_location\n\t\trecords = University.where(['state LIKE ?', \"%#{params[:location]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def show\n @gastracker = Gastracker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gastracker }\n end\n end",
"def index\n @garrages = Garrage.all\n end",
"def index\n @gig_rosters = GigRoster.all\n end",
"def show\n @gage = Gage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gage }\n end\n end",
"def index\n @registrations = Registration.all\n \n render json: @registrations\n end",
"def index\n user_id = @user.id\n @auctions = Auction.where(\"seller_id = ?\", user_id)\n\n # get all belong auctions\n render json: @auctions\n end",
"def badges(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/badges.json\")\n end",
"def available_grade_levels_json\n params.require(:workspace_id)\n\n # schools\n school_ids = queries.supported_schools.map(&:id).select do |school_id|\n queries.is_authorized_for_school_id?(school_id)\n end\n schools_json = School.find(school_ids).as_json(only: [:id, :name])\n\n # grade levels (include if any of their schools would allow it)\n grade_levels_next_year = queries.supported_grade_levels_next_year.select do |grade_level_next_year|\n grade_level_now = GradeLevels.new.previous(grade_level_next_year)\n school_ids.any? {|school_id| queries.is_authorized_for_grade_level_now?(school_id, grade_level_now) }\n end\n\n render json: {\n schools: schools_json,\n grade_levels_next_year: grade_levels_next_year\n }\n end",
"def index\n @german_go_leagues = GermanGoLeague.all\n\t\t@title = \"Bundesliga Spiele\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @german_go_leagues }\n end\n end",
"def index\n @lounges = Lounge.all\n end",
"def index\n @riggings = Rigging.all\n end",
"def show\n render json: @championship\n end",
"def index\n @shipments = Shipment.all\n render json: @shipments\n end",
"def index\n @rogues = Rogue.all\n end",
"def index\n @rogues = Rogue.all\n end",
"def index\n @registrations = Registration.order(:last_name).where(\"created_at >= ?\", Date.today.beginning_of_year)\n\n respond_to do |format|\n format.html\n format.json { render json: @registrations, include: { students: { only: [:first_name, :last_name, :shirt_size]}} }\n end\n end",
"def index\n @warriors = Warrior.all\n render :json => @warriors, :include => [:skills, :equipment_lists,]\n\n end",
"def index\n\t\t@households = current_user.households\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @households }\n\t\tend\n\tend",
"def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end",
"def index_by_age_sorted_by_price\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def show\n survivor = Suvivor.find(params[:id])\n render json: {status: 'SUCCESS', message:'Survivor founded', data:survivor},status: :ok\n end",
"def index\n render :json => UserInterest.all\n end",
"def index\n @regiones = Region.all\n\n render json: @regiones\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def recipebook\n @levels = Level.all\n\n respond_to do |format|\n format.html # recipebook.html.erb\n format.json { render json: @levels }\n end\n end",
"def show\n sighting = Sighting.find(params[:id])\n #render json: sighting.to_json(:include => {:bird => {:only =>[:name, :species]}, :location => {:only =>[:latitude, :longitude]}}, :except => [:updated_at])\n end",
"def index\n check_authorization\n #@badges = Badge.find(:all, :conditions => [\"organization_id = ? and segment_id = ?\", @organization.id, @segment.id ] )\n @badges = Badge.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @badges }\n end\n end",
"def show\n render json: @endorsement\n end",
"def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def index\n @surprises = Surprise.all\n end",
"def badges(options={})\n get('/user_badge', options)\n end",
"def new\n @year_insurances = YearInsurance.active.joins(:family)\n @reimbursement = Reimbursement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reimbursement }\n end\n end",
"def index\n @guests = Guest.all.order(:last_name)\n respond_with(@guests) do |format|\n format.to_json { @guests.to_json(:include => [:party, :group]) }\n end\n end",
"def index\n @grades = Grade.all\n render json: {data: @grades, status: \"SUCCESS\"}, :status => 200\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end"
] | [
"0.70388985",
"0.70388985",
"0.69341296",
"0.59730726",
"0.59461135",
"0.59223783",
"0.5865941",
"0.5732964",
"0.5643951",
"0.56194353",
"0.5598398",
"0.5585932",
"0.55832285",
"0.5582528",
"0.55722",
"0.5571055",
"0.5565265",
"0.555195",
"0.5544764",
"0.55380434",
"0.5532715",
"0.5528889",
"0.55105096",
"0.55100226",
"0.55078065",
"0.54915524",
"0.54825264",
"0.54617935",
"0.5460594",
"0.54585314",
"0.54439",
"0.54393744",
"0.5438359",
"0.5425501",
"0.5413539",
"0.53966194",
"0.53889835",
"0.5376191",
"0.53748965",
"0.5370809",
"0.5368504",
"0.5367259",
"0.5366057",
"0.5365655",
"0.53586787",
"0.53519374",
"0.53450465",
"0.53421956",
"0.5339569",
"0.53296614",
"0.53279907",
"0.5326599",
"0.53228766",
"0.53140783",
"0.5303196",
"0.52998865",
"0.5295787",
"0.5295654",
"0.52925074",
"0.5290645",
"0.5287708",
"0.5287654",
"0.52865124",
"0.52805054",
"0.52790767",
"0.5274214",
"0.52733254",
"0.52686816",
"0.52656454",
"0.52639514",
"0.52634495",
"0.5260926",
"0.52448356",
"0.5244798",
"0.52414596",
"0.5230808",
"0.523055",
"0.5228407",
"0.5228407",
"0.52271366",
"0.52166814",
"0.52141047",
"0.52138835",
"0.5213607",
"0.5204124",
"0.5203016",
"0.5198398",
"0.5195076",
"0.5185183",
"0.51850134",
"0.5183546",
"0.51832455",
"0.51801103",
"0.51790714",
"0.5178665",
"0.51773626",
"0.51742536",
"0.5163548",
"0.515594",
"0.5151503",
"0.5151503"
] | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.