query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
POST /services POST /services.xml
def create submenu_item 'services-new' @service = Service.new(params[:service]) @service_type = @service.type service_param @service.tenant_id = current_user.tenant_id # service_params = Service.extract_params(params[:service]) # service_params = Service.extract_thresholds(service_params) # @service = Service.new(service_params) respond_to do |format| if @service.save flash[:notice] = "#{@service.name}创建成功" format.html { redirect_to(@service) } else dictionary format.html { render :action => "new" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_service(service={})\n request :post, '/services', service\n end", "def create\n\n @service = Service.new(params[:service])\n respond_to do |format|\n if @service.save\n\n format.html { }\n format.xml { render :xml => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service }\n end\n end\n end", "def add_to_services(name, type, description)\n data = {\n 'OS-KSADM:service' => {\n 'name' => name,\n 'type' => type,\n 'description' => description\n }\n }\n return post_request(address(\"/OS-KSADM/services\"), data, token())\n end", "def create\n @service = Service.new(params[:service])\n \n respond_to do |format|\n if @service.save\n flash[:notice] = 'Service was successfully created.'\n format.html { redirect_to(@service) }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to(admin_service_path(@service), :notice => 'Service was successfully created.') }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n flash[:notice] = 'Service was successfully created.'\n format.html { redirect_to(@service) }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to(@service, :notice => t(\"screens.notice.successfully_created\")) }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @service = @enterprise.services.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to edit_service_path(@service), notice: 'El servicio ha sido creado satisfactoriamente.' }\n format.json { render :edit, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def services\n\n end", "def reset_services(services=[])\n request :put, '/services', services\n end", "def create\n @service = Service.new(service_params)\n if @service.save\n render json: @service, status: :created, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end", "def create\n @service = @page.services.new(params[:service])\n @service.user = current_user\n \n respond_to do |format|\n if @service.save\n format.html { redirect_to service_url(@page, @service), notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def service_request(service); end", "def save_services(current_user)\n error_urls = []\n existing_services = []\n new_wsdls = []\n server_data = services_factory().values.flatten\n \n unless server_data.empty?\n server_data.each{ |datum|\n url = datum['location']\n soap_service = SoapService.new({:wsdl_location => url})\n success, data = soap_service.populate\n dup = SoapService.check_duplicate(url, data[\"endpoint\"])\n if success and dup != nil\n existing_services << dup\n unless dup.latest_version.service_versionified.description_from_soaplab\n dup.latest_version.service_versionified.update_description_from_soaplab!(true)\n end\n logger.info(\"This service exists in the database\")\n else\n transaction do\n begin\n if success \n c_success = soap_service.submit_service( data[\"endpoint\"], current_user, {} ) \n if c_success\n new_wsdls << url\n soap_service.update_description_from_soaplab!(true) if soap_service\n logger.info(\"Registered service - #{url}. SUCCESS:\")\n else\n error_urls << url\n logger.error(\"post_create failed for service - #{url}. \")\n end\n end\n rescue Exception => ex\n error_urls << url\n logger.error(\"failed to register service - #{url}. soaplab registration Exception:\")\n logger.error(ex)\n end\n end\n end\n }\n end\n create_relationships(new_wsdls)\n create_tags(find_services_in_catalogue(new_wsdls), current_user)\n self.update_descriptions_from_soaplab!\n return [new_wsdls, existing_services, error_urls]\n end", "def create\n @xservice = Xservice.new(xservice_params)\n\n respond_to do |format|\n if @xservice.save\n format.html { redirect_to @xservice, notice: 'Xservice was successfully created.' }\n format.json { render :show, status: :created, location: @xservice }\n else\n format.html { render :new }\n format.json { render json: @xservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def service(request, response)\n if @valid_ip\n raise WEBrick::HTTPStatus::Forbidden unless @valid_ip.any? { |ip| request.peeraddr[3] =~ ip }\n end\n\n if request.request_method != \"POST\"\n raise WEBrick::HTTPStatus::MethodNotAllowed,\n \"unsupported method `#{request.request_method}'.\"\n end\n\n raise WEBrick::HTTPStatus::BadRequest if parse_content_type(request['Content-type']).first != \"text/xml\"\n\n length = (request['Content-length'] || 0).to_i\n\n raise WEBrick::HTTPStatus::LengthRequired unless length > 0\n\n data = request.body\n\n raise WEBrick::HTTPStatus::BadRequest if data.nil? or data.size != length\n\n resp = process(data, client_request(request))\n raise WEBrick::HTTPStatus::InternalServerError if resp.nil? or resp.size <= 0\n\n response.status = 200\n response['Content-Length'] = resp.size\n response['Content-Type'] = \"text/xml; charset=utf-8\"\n response.body = resp\n end", "def create\n @request_service = RequestService.new(request_service_params)\n\n respond_to do |format|\n if @request_service.save\n format.html { redirect_to requests_path, notice: 'Request service was successfully created.' }\n format.json { render :show, status: :created, location: @request_service }\n else\n format.html { render :new }\n format.json { render json: @request_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to services_url, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def services\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def create\n @service = Service.create(service_params)\n end", "def create\n service = current_account.create_service(service_params)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n endpoint(get(services_url).body)\n end", "def services\n\tend", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def create\n @complex_service = ComplexService.new(params[:complex_service])\n\n respond_to do |format|\n if @complex_service.save\n format.html { redirect_to(@complex_service, :notice => 'ComplexService was successfully created.') }\n format.xml { render :xml => @complex_service, :status => :created, :location => @complex_service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @complex_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @service = @place.services.new(service_params)\n\n if @service.save\n redirect_to [@client, @place], notice: 'Service was successfully created.'\n else\n render :new\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n service = current_account.services.build\n create_service = ServiceCreator.new(service: service)\n create_service.call(service_params)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end", "def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n #format.html { redirect_to services_path, notice: 'Service was successfully created.' }\n\tflash[:notice]= 'Service was successfully created.'\n\tformat.html { redirect_to action: 'index'}\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n \n end\n end\n end", "def create\n service = current_account.services.build\n create_service = ServiceCreator.new(service: service)\n create_service.call(service_params.to_h)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end", "def create\n @event_service = EventService.new(event_service_params)\n\n respond_to do |format|\n if @event_service.save\n format.html { redirect_to @event_service, notice: 'Event service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event_service }\n else\n format.html { render action: 'new' }\n format.json { render json: @event_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def process(xml)\n timeout(TIMEOUT) do\n url = URI.parse(webservices_url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start {\n request = Net::HTTP::Post.new(url.to_s)\n request.body = xml\n response = http.request(request)\n response.body\n }\n end\n end", "def services\n params = { command: 'account_services' }\n get('/json.php', params)\n end", "def create\n @webservice = Webservice.find(params[:webservice_id])\n @rest_api = @webservice.rest_apis.create(rest_api_params)\n redirect_to webservice_path(@webservice)\n end", "def post_configure_edge_gateway_services(id, configuration)\n body = Fog::Generators::Compute::VcloudDirector::EdgeGatewayServiceConfiguration.new(configuration).generate_xml\n\n request(\n :body => body,\n :expects => 202,\n :headers => {'Content-Type' => 'application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml'},\n :method => 'POST',\n :parser => Fog::ToHashDocument.new,\n :path => \"admin/edgeGateway/#{id}/action/configureServices\"\n )\n end", "def post_configure_edge_gateway_services(id, configuration)\n body = Fog::Generators::Compute::VcloudDirector::EdgeGatewayServiceConfiguration.new(configuration).generate_xml\n\n request(\n :body => body,\n :expects => 202,\n :headers => {'Content-Type' => 'application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml'},\n :method => 'POST',\n :parser => Fog::ToHashDocument.new,\n :path => \"admin/edgeGateway/#{id}/action/configureServices\"\n )\n end", "def create\n @emt_service = EmtService.new(emt_service_params)\n\n respond_to do |format|\n if @emt_service.save\n format.html { redirect_to @emt_service, notice: 'Emt service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @emt_service }\n else\n format.html { render action: 'new' }\n format.json { render json: @emt_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_request(params, useSSL=false)\n # get a server handle\n port = (useSSL == true) ? 443 : 80\n http_server = Net::HTTP.new(API_HOST, port)\n http_server.use_ssl = useSSL\n \n # build a request\n http_request = Net::HTTP::Post.new(API_PATH_REST)\n http_request.form_data = params\n \n # get the response XML\n return http_server.start{|http| http.request(http_request)}.body\n end", "def create\n @service = Service.new(service_params)\n @service.published = false\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to [:admin,@service], notice: 'Feito! Empresa criada' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @em_service = EmService.new(em_service_params)\n\n respond_to do |format|\n if @em_service.save\n format.html { redirect_to list_em_services_path, notice: '创建成功.' }\n format.json { render :show, status: :created, location: @em_service }\n else\n drop_breadcrumb(\"员工服务管理\",em_services_path)\n drop_page_title(\"新增\")\n drop_breadcrumb\n flash.now[:alert] = \"操作失败 #{@em_service.errors.full_messages}\"\n format.html { render :new }\n format.json { render json: @em_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @approximate_service = ApproximateService.new(params[:approximate_service])\n\n respond_to do |format|\n if @approximate_service.save\n format.html { redirect_to(@approximate_service, :notice => 'ApproximateService was successfully created.') }\n format.xml { render :xml => @approximate_service, :status => :created, :location => @approximate_service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @approximate_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end", "def list_services\n response = @http_client.get(prefix_path('services'))\n Response.new(response)\n end", "def create\n @director = Director.find(params[:director_id])\n @soaps = @director.soaps.create(soap_params)\n redirect_to director_path(@director)\n\n\n end", "def create\n @idti_service = IdtiService.new(idti_service_params)\n\n respond_to do |format|\n if @idti_service.save\n format.html { redirect_to @idti_service, notice: 'Idti service was successfully created.' }\n format.json { render :show, status: :created, location: @idti_service }\n else\n format.html { render :new }\n format.json { render json: @idti_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Creation of a Service resource is not allowed. Must be created as part of the creation of a specific service type resource.\n flash[:error] = 'Select the type of service you would like to submit first'\n respond_to do |format|\n format.html { redirect_to(new_service_url) }\n format.xml { render :xml => '', :status => 404 }\n end\n end", "def send_action(service, action, param)\r\n param_str = \"\"\r\n param.each do |key, value|\r\n param_str << '<%{key}>%{value}</%{key}>'.%(key: key, value: value)\r\n end\r\n xmldata = ActionXML.%(type: service.type, action: action, arguments: param_str)\r\n req = Net::HTTP::Post.new(uri = URI(@igd_location + service.control_url))\r\n req.content_type = 'text/xml; charset=\"utf-8\"'\r\n req['SOAPAction'] = '\"%{type}#%{action}\"'.%(type: service.type, action: action)\r\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\r\n http.request(req, xmldata)\r\n end\r\n #res = Net::HTTP.request(req, xmldata)\r\n xml = REXML::Document.new(res.body).root\r\n if(res.is_a?(Net::HTTPSuccess))\r\n xml.each_element('s:Body/u:*') do |element|\r\n return {is_error: false, has_xml: true, xml: element}\r\n end\r\n else\r\n return {is_error: true, \r\n faultcode: xml.get_text('s:Body/s:Fault/faultcode').to_s,\r\n faultstring: xml.get_text('s:Body/s:Fault/faultstring').to_s,\r\n code: xml.get_text('s:Body/s:Fault/detail/UPnPError/errorCode').to_s.to_i,\r\n descr: xml.get_text('s:Body/s:Fault/detail/UPnPError/errorDescription').to_s\r\n }\r\n end\r\n return {is_error: false, has_xml: false}\r\n end", "def new\n @page_id = \"services\"\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "def create\n @tourist_site_app_service = TouristSiteAppService.new(tourist_site_app_service_params)\n\n respond_to do |format|\n if @tourist_site_app_service.save\n format.html { redirect_to @tourist_site_app_service, notice: 'Tourist site app service was successfully created.' }\n format.json { render :show, status: :created, location: @tourist_site_app_service }\n else\n format.html { render :new }\n format.json { render json: @tourist_site_app_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def service(id)\n request :get, \"/services/#{id}\"\n end", "def services\n services = @saloon.services\n\n render_success(data: services, each_serializer: ServiceSerializer)\n end", "def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return response.body if check_response(response, 201)\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @service = @customer.service.new(service_params)\n\n respond_to do |format|\n if @service.save\n \n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml\n end\n end", "def create\n @online_service = OnlineService.new(params[:online_service])\n\n respond_to do |format|\n if @online_service.save\n format.html { redirect_to @online_service, notice: 'Online service was successfully created.' }\n format.json { render json: @online_service, status: :created, location: @online_service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @online_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n @service.user = current_user\n \n respond_to do |format|\n if @service.save\n format.html { redirect_to root_path, notice: 'El servicios esta en revision, pronto sera subido :)' }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n \n #Cobro en el banco\n client = Savon::Client.new(\"http://localhost:3001/servicios/wsdl\")\n tdc = Tarjeta.where(\"id = ? AND cliente_id = ?\",params[:orden][:tarjeta_id],usuario_actual.id)\n total_pagar = params[:orden][:total]\n pago = '<Message>\n <Request>\n <numero_tdc>'+tdc.numero+'</numero_tdc>\n <nombre_tarjetahabiente>'+tdc.tarjetahabiente+'</nombre_tarjetahabiente>\n <fecha_vencimiento>'+tdc.mes_vencimiento+'/'+tdc.ano_vencimiento+'</fecha_vencimiento>\n <codigo_seguridad>'+tdc.codigo+'</codigo_seguridad>\n <tipo_tarjeta>'+tdc.tipo+'</tipo_tarjeta>\n <direccion_cobro>'+tdc.direccion+'</direccion_cobro>\n <total_pagar>'+total_pagar+'</total_pagar>\n <cuenta_receptora>'+cuenta_receptora+'</cuenta_receptora>\n </Request>\n </Message>'\n #response = client.request :verificar_pago, body: { \"value\" => pago } \n #if response.success?\n # data = response.to_hash[:verificar_pago_response][:value][:response].first\n # @respuesta = XmlSimple.xml_in(data)\n #end\n\n #NAMESPACE = 'pagotdc'\n #URL = 'http://localhost:8080/'\n #banco = SOAP::RPC::Driver.new(URL, NAMESPACE)\n #banco.add_method('verificar_pago', 'numero_tdc', 'nombre_tarjetahabiente', 'fecha_vencimiento', 'codigo_seguridad', 'tipo_tarjeta', 'direccion_cobro', 'total_pagar', 'cuenta_receptora')\n #\n \n #respuesta = banco.verificar_pago(tdc.numero, tdc.tarjetahabiente, tdc.mes_vencimiento.to_s+'/'+tdc.ano_vencimiento.to_s, tdc.codigo, tdc.tipo, params[:orden][:total], tdc.direccion)\n \n if true #respuesta.ack.eql?(0)\n params[:orden][:cliente_id] = usuario_actual.id\n params[:orden][:total] = Seleccion.precio_total(usuario_actual.id)\n params[:orden][:fecha_entrega] = \"0000-00-00\"\n @orden = Orden.new(params[:orden])\n \n if @orden.save\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @selecciones.each do |seleccion|\n p = Producto.find(seleccion.producto_id)\n @venta = Venta.new(:producto_id=>p.id, \n :orden_id=>@orden.id,\n :categoria_id=>p.categoria_id, \n :cantidad=>seleccion.cantidad,\n :costo=>p.precio)\n @venta.save\n end\n \n Seleccion.vaciar_carro(usuario_actual.id)\n respond_to do |format|\n format.html { redirect_to ver_ordenes_path, notice: 'Orden generada correctamente.' }\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n end\n end\n else\n respond_to do |format|\n format.html { render action: \"new\", notice: respuesta.mensaje }\n end\n end\n end", "def addservice\n\n @service = ServiceProvider.find_by(username: params[:serviceprovider][:username]);\n permitted = params[:serviceprovider].permit( :description, :category_id);\n @service.services.create(permitted);\n\n render json: @service\n\n\nend", "def test_service\n @options[:method] = 'testservice'\n response = ta_response(base_params)\n return response\n end", "def create\n @customerservice = Customerservice.new(customerservice_params)\n\n respond_to do |format|\n if @customerservice.save\n format.html { redirect_to @customerservice, notice: 'Customerservice was successfully created.' }\n format.json { render :show, status: :created, location: @customerservice }\n else\n format.html { render :new }\n format.json { render json: @customerservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_service_request\n # Geocode the address\n lat, long = Geocoder.coordinates(\"#{self.restaurant_address} , Chicago, IL\") \n\n HTTParty.post('http://311api.cityofchicago.org/open311/v2/requests.json', :body => { \n :api_key => SETTINGS[\"OPEN_311_KEY\"],\n :service_code => '4fd6e4ece750840569000019',\n :attribute => {\n :PLEASESE => 'FOODPOIS',\n :WHATISTH => self.restaurant_name,\n :ONWHATDA => self.date\n },\n :address_string => self.restaurant_address,\n :description => self.description,\n :lat => lat, \n :long => long, \n :first_name => self.first_name,\n :last_name => self.last_name,\n :email => self.email,\n :phone => self.phone\n })\n end", "def post\n response = HTTParty.post(servlet_url,\n :body => to_xml,\n :headers => { 'Content-Type' => 'application/xml' }\n ).response\n\n return Dhl::Shipment::Response.new(response.body)\n rescue Exception => e\n request_xml = if @to_xml.to_s.size>0\n @to_xml\n else\n '<not generated at time of error>'\n end\n\n response_body = if (response && response.body && response.body.to_s.size > 0)\n response.body\n else\n '<not received at time of error>'\n end\n\n log_level = if e.respond_to?(:log_level)\n e.log_level\n else\n :critical\n end\n\n log_request_and_response_xml(log_level, e, request_xml, response_body )\n raise e\n end", "def create\n @registro_servicio = Registro::Servicio.new(registro_servicio_params)\n\n respond_to do |format|\n if @registro_servicio.save\n format.html { redirect_to @registro_servicio, notice: 'Servicio was successfully created.' }\n format.json { render :show, status: :created, location: @registro_servicio }\n else\n format.html { render :new }\n format.json { render json: @registro_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def register_services(request)\n return unless request.is_a? RestfulRequest\n @active_requests[request.id][:arduino_responses][request.address[:name]].match /^(?:[A-Za-z].*\\n)*([\\[|\\{](?:.*\\n*)*)\\n/\n return unless services_json = $1\n\n JSON.parse(services_json).each do |services|\n services[\"resource_name\"].match /(^\\D*)(?:_\\d)*$/\n return unless service_type_name = $1\n puts_debug \"[Controller:register_services] current resource name matched '#{$1}'\"\n \n # get service id by finding existing service id, or adding a new service if needed \n service_id = get_service_id(service_type_name)\n new_instance = {name: services[\"resource_name\"], \n post_enabled: services[\"post_enabled\"],\n range_min: services[\"range\"][\"min\"],\n range_max: services[\"range\"][\"max\"],\n device_id: request.address[:device_id], service_type_id: service_id}\n ::ArduinoGateway::Model::ModelTemplates::ResourceInstance.new new_instance \n end\n end", "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n #create line_up\n @lineup = Lineup.create(service: @service, mc: \"MC\")\n format.html { redirect_to services_url, notice: \"Service was successfully created. #{@lineup.id}\" }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @bus_service = BusService.new(params[:bus_service])\n respond_to do |format|\n if @bus_service.save\n format.html { redirect_to(@bus_service, :notice => 'BusService was successfully created.') }\n format.xml { render :xml => @bus_service, :status => :created, :location => @bus_service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bus_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @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.xml { render :xml => @service }\n end\n end", "def create\n @masterservice = Masterservice.new(masterservice_params)\n\n respond_to do |format|\n if @masterservice.save\n format.html { redirect_to @masterservice, notice: 'Masterservice was successfully created.' }\n format.json { render :show, status: :created, location: @masterservice }\n else\n format.html { render :new }\n format.json { render json: @masterservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(url_variables:, body:)\n ensure_service_document\n\n end", "def create\r\n @service = Service.new(service_params)\r\n @service.user_id = current_user.id\r\n @service.create_nanny(nanny_params)\r\n\r\n respond_to do |format|\r\n if @service.save\r\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\r\n format.json { render :show, status: :created, location: @service }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def post_service_request(url, content_type, body)\n IMS::LTI::post_service_request(@consumer_key,\n @consumer_secret,\n url,\n content_type,\n body)\n end", "def create\n params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:services])\n @service = Service.new(params_map)\n @tenant = Tenant.find(session[:user_id])\n @property = Property.find(@tenant.property_id)\n @manager = Manager.find(@property.manager_id)\n @service.manager_id = @manager.id\n @service.property_id = @property.id\n @service.tenant_id = @tenant.id\n #sets resolved to false, only tenants have the ability to set these to completed\n @service.resolved = false\n if @service.save\n ServiceMailer.reminder(@service).deliver_now\n redirect_to '/tenants/show'\n else\n render \"new\"\n end\n end", "def create\n @admin_service = Admin::Service.new(admin_service_regex_params)\n\n respond_to do |format|\n if @admin_service.save\n format.html { redirect_to @admin_service, notice: 'Platform was successfully created.' }\n format.json { render :show, status: :created, location: @admin_service }\n else\n format.html { render :new }\n format.json { render json: @admin_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @final_service = FinalService.new(params[:final_service])\n\n respond_to do |format|\n if @final_service.save\n format.html { redirect_to(@final_service, :notice => 'FinalService was successfully created.') }\n format.xml { render :xml => @final_service, :status => :created, :location => @final_service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @final_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_config(url_prefix, xml)\n post_data(url_prefix, xml, 'application/xml;charset=UTF-8')\n end", "def create\n @customer_service = CustomerService.new(customer_service_params)\n\n respond_to do |format|\n if @customer_service.save\n format.html { redirect_to @customer_service, notice: 'Customer service was successfully created.' }\n format.json { render :show, status: :created, location: @customer_service }\n else\n format.html { render :new }\n format.json { render json: @customer_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @serviceordemservice = Serviceordemservice.new(serviceordemservice_params)\n\n respond_to do |format|\n if @serviceordemservice.save\n format.html { redirect_to @serviceordemservice, notice: 'Serviceordemservice was successfully created.' }\n format.json { render :show, status: :created, location: @serviceordemservice }\n else\n format.html { render :new }\n format.json { render json: @serviceordemservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @point_service = PointService.new(point_service_params)\n if (@point_service.adresse.present?)\n @point_service.adresse.point_service = @point_service\n @point_service.adresse.save\n end\n @organisme = Organisme.find(params[:organisme_id])\n params[:departements] ||= []\n @point_service.departements.delete_all\n @dep_table = params[:departements]\n logger.debug \"Departements table sent : #@dep_table\"\n @dep_table.each do |depid|\n @point_service.departements << Departement.find(depid)\n end\n @point_service.organisme = @organisme\n respond_to do |format|\n if @point_service.save\n format.html { redirect_to organisme_path(@organisme), notice: 'Point service was successfully created.' }\n format.json { render :index, status: :created, location: @organisme }\n else\n format.html { render :new }\n format.json { render json: @point_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sevice = Sevice.new(sevice_params)\n\n respond_to do |format|\n if @sevice.save\n format.html { redirect_to @sevice, notice: 'Sevice was successfully created.' }\n format.json { render :show, status: :created, location: @sevice }\n else\n format.html { render :new }\n format.json { render json: @sevice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = current_professional_user.services.build(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to meus_servicos_path }\n flash[:success] = 'Serviço adicionado com sucesso!'\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end", "def service_params\n params[:service]\n end", "def create_service(name, description)\n response = @client.post(\"/api/v1/services\", { \"name\" => name, \"description\" => description })\n return JSON.parse(response.body)\n end", "def create\r\n @service = Service.new(service_params)\r\n respond_to do |format|\r\n if @service.save #/enter/companies/:company_id/services/:id/add_stack\r\n format.html { redirect_to \"/enter/companies/#{@service.company_id}/services/#{@service.id}/add_stack\", notice: 'Service was successfully created.' }\r\n format.json { render :add_stack, status: :created, location: @service }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @port_service = PortService.new(port_service_params)\n\n respond_to do |format|\n if @port_service.save\n format.html { redirect_to @port_service, notice: 'Port service was successfully created.' }\n format.json { render :show, status: :created, location: @port_service }\n else\n format.html { render :new }\n format.json { render json: @port_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contract_service = ContractService.new(contract_service_params)\n\n respond_to do |format|\n if @contract_service.save\n format.html { redirect_to @contract_service, notice: 'Contract service was successfully created.' }\n format.json { render :show, status: :created, location: @contract_service }\n else\n format.html { render :new }\n format.json { render json: @contract_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @servicio = Servicio.new(params[:servicio])\n\n respond_to do |format|\n if @servicio.save\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully created.' }\n format.json { render :json => @servicio, :status => :created, :location => @servicio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @service = Service.new(service_params)\n @service.user_id = current_user.username\n @service.nombre = @service.nombre.upcase\n @service.tipo = @service.tipo.upcase\n @service.descripcion = @service.descripcion.upcase\n @service.ubicacion = @service.ubicacion.upcase\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to services_url, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_services\n reply = @client.call(:get_services)\n\n data = reply.body.dig(:get_services_response,\n :get_services_result,\n :array_of_string)\n data = check_if_data_exists(data)\n\n data.map do |attrs|\n {\n id: Integer(attrs[:string][0], 10),\n name: attrs[:string][1]\n }\n end\n end", "def create\n @service_request = ServiceRequest.new(service_request_params)\n\n respond_to do |format|\n if @service_request.save\n\n format.html { redirect_to tank_information_path(@service_request.id), notice: 'Service request was successfully created.' }\n format.json { render :show, status: :created, location: @service_request }\n else\n format.html { render :new }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7019069", "0.62797195", "0.6158375", "0.6121117", "0.6106566", "0.60866106", "0.6082971", "0.59980494", "0.5980973", "0.5943503", "0.593012", "0.5919196", "0.5866695", "0.585808", "0.5831464", "0.58228064", "0.5817531", "0.58162165", "0.5796376", "0.5792843", "0.5781072", "0.5749936", "0.5744572", "0.57359993", "0.57359993", "0.57359993", "0.57359993", "0.57359993", "0.57359993", "0.57321656", "0.5720272", "0.5719813", "0.5717667", "0.571333", "0.5684355", "0.5684355", "0.5680111", "0.56694055", "0.5659721", "0.56361246", "0.56252015", "0.5624041", "0.56220204", "0.5615837", "0.5615837", "0.56108016", "0.56044155", "0.55994713", "0.5587392", "0.55479145", "0.55390626", "0.5521243", "0.5519828", "0.5513931", "0.55025446", "0.5500207", "0.54989225", "0.5490618", "0.5474935", "0.5473093", "0.54695284", "0.5463038", "0.54435146", "0.5440627", "0.5437372", "0.5425737", "0.5425734", "0.54226565", "0.53933793", "0.53916675", "0.53864497", "0.5385707", "0.5384741", "0.5384619", "0.5371897", "0.5371589", "0.5371589", "0.5361602", "0.5358923", "0.53582406", "0.53562206", "0.53471017", "0.5343519", "0.53414583", "0.53370166", "0.5335715", "0.53356415", "0.533415", "0.533231", "0.5325421", "0.5325247", "0.53218466", "0.5319037", "0.5318834", "0.5314806", "0.53145146", "0.53137565", "0.5313388", "0.53005165", "0.5297061" ]
0.54802674
58
PUT /services/1 PUT /services/1.xml
def update @service = Service.find(params[:id], :conditions => conditions) params[:service].delete :serviceable_id params[:service].delete :ctrl_state params[:service].delete :type_id respond_to do |format| if @service.update_attributes(params[:service]) flash[:notice] = "#{@service.name}更新成功" format.html { redirect_to(@service) } format.xml { head :ok } else @service_type = @service.type dictionary format.html { render :action => "edit" } format.xml { render :xml => @service.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def reset_services(services=[])\n request :put, '/services', services\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n flash[:notice] = 'Service was successfully updated.'\n format.html { redirect_to(@service) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n flash[:notice] = 'Service was successfully updated.'\n format.html { redirect_to(@service) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update_attributes(params[:service])\n flash[:notice] = 'Service was successfully updated.'\n format.html { redirect_to(@service) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_service(id, options={})\n self.class.put(\"/services/#{id}.json?apikey=#{apikey}\", :query => {:service => options}, :body => {})\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n service.update(service_params)\n\n respond_with(service)\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def add_service(service={})\n request :post, '/services', service\n end", "def update\n @service.update(service_params)\n end", "def update\n @service.update(service_params)\n end", "def update\n service.update_attributes(service_params)\n\n respond_with(service)\n end", "def update\n if @service.update(service_params)\n render json: @service, status: :ok, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n @service.add_parts(params[:parts])\n format.html { redirect_to(admin_service_path(@service), :notice => 'Service was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @xservice.update(xservice_params)\n format.html { redirect_to @xservice, notice: 'Xservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @xservice }\n else\n format.html { render :edit }\n format.json { render json: @xservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def service(id)\n request :get, \"/services/#{id}\"\n end", "def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @complex_service = ComplexService.find(params[:id])\n\n respond_to do |format|\n if @complex_service.update_attributes(params[:complex_service])\n format.html { redirect_to(@complex_service, :notice => 'ComplexService was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @complex_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def update\n @service_request = ServiceRequest.find(params[:id])\n\n respond_to do |format|\n if @service_request.update_attributes(params[:service_request])\n format.html { redirect_to(@service_request, :notice => 'Service request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n respond_to do |format|\n if @service.update_attributes(params[:service])\n format.html { redirect_to service_url(@page, @service), notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_service\n @service = @enterprise.services.find(params[:id])\n end", "def put(id:, url_variables:, body:)\n ensure_service_document\n end", "def put!\n request! :put\n end", "def set_service\r\n @service = Service.find(params[:id])\r\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to services_url, notice: 'Serviço cadastrado com sucesso!' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_service(id, serviceid, options = nil)\n params = get_service(id, serviceid)\n params.update(options) if options\n post(ROOT_URI + '/a/configureservice', params)\n end", "def edit_service(id, serviceid, options = nil)\n params = get_service(id, serviceid)\n params.update(options) if options\n post(ROOT_URI + '/a/configureservice', params)\n end", "def set_service\r\n @service = Service.find(params[:id])\r\n end", "def set_service\r\n @service = Service.find(params[:id])\r\n end", "def update_service(service_name, new_value)\n self.services[service_name.to_s] = new_value\n self.update_attribute :services, self.services\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit, notice: 'Errors uploading the service.' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @soap.update(soap_params)\n format.html { redirect_to @soap, notice: 'Soap was successfully updated.' }\n format.json { render :show, status: :ok, location: @soap }\n else\n format.html { render :edit }\n format.json { render json: @soap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to services_url, notice: \"Service was successfully updated.\" }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def update\n @service_version = ServiceVersion.find(params[:id])\n\n respond_to do |format|\n if @service_version.update_attributes(params[:service_version])\n flash[:notice] = 'ServiceVersion was successfully updated.'\n format.html { redirect_to(@service_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service_version.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n #format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n\tflash[:notice]= 'Service was successfully updated.'\n\tformat.html { redirect_to action: 'index'}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def update\n @approximate_service = ApproximateService.find(params[:id])\n\n respond_to do |format|\n if @approximate_service.update_attributes(params[:approximate_service])\n format.html { redirect_to(@approximate_service, :notice => 'ApproximateService was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @approximate_service.errors, :status => :unprocessable_entity }\n end\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 @service.update(service_params)\n format.html { redirect_to services_url, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def create\n\n @service = Service.new(params[:service])\n respond_to do |format|\n if @service.save\n\n format.html { }\n format.xml { render :xml => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service }\n end\n end\n end", "def update!(**args)\n @services = args[:services] if args.key?(:services)\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def set_service\n @service = Service.find(params[:id])\n end", "def update_service(service_id, name, description)\n response = @client.post(\"/api/v1/services/#{service_id}\", { \"name\" => name, \"description\" => description })\n return JSON.parse(response.body)\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @service.update(service_params)\r\n format.html { redirect_to \"/enter/companies/#{@service.company_id}/services/#{@service.id}\",method: :get, notice: 'Service was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @service }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update_soaplab_server(url)\n soaplab = SoaplabServer.find_by_location(url)\n data = soaplab.services_factory().values.flatten\n wsdls_from_server = data.collect{ |item| item[\"location\"]}\n registered_soaps = SoapService.find_all_by_wsdl_location(wsdls_from_server).compact\n registered_wsdls = registered_soaps.collect{|s| s.wsdl_location}\n wsdls_from_relationships = soaplab.services.collect{|service| service.latest_version.service_versionified.wsdl_location}\n wsdls_to_add = registered_wsdls - wsdls_from_relationships \n submitter = nil\n unless soaplab.services.empty?\n submitter = User.find(soaplab.services.first.submitter_id)\n end\n \n \n soaps_to_add = SoapService.find_all_by_wsdl_location(wsdls_from_server).compact\n services_to_add = soaps_to_add.collect{|s| s.service}\n puts \"server : #{url}\"\n puts \"No of relationships to add #{wsdls_to_add.length}\"\n puts wsdls_to_add\n unless wsdls_to_add.empty?\n if submitter.nil?\n submitter = User.find(SoapService.find_by_wsdl_location(wsdls_to_add.first).service.submitter_id)\n end\n soaplab.create_relationships(wsdls_to_add)\n create_tags_if_not_exist(services_to_add, submitter)\n end\n if soaplab.endpoint.nil?\n proxy_info = get_endpoint_and_name(url)\n unless proxy_info.empty?\n soaplab.endpoint = proxy_info[0] \n soaplab.name = proxy_info[1]\n soaplab.save\n end\n end\n end", "def update\n @inventario = Inventario.find(params[:id])\n @foto = @inventario.foto\n \n @service = InventarioService.new(@inventario, @foto)\n respond_to do |format|\n\n if @inventario.update_attributes(params[:inventario],params[:foto_file])\n format.html { redirect_to(@inventario, :notice => 'Inventario was successfully updated.') }\n format.xml { head :ok }\n else\n\t @foto = @service.foto\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @idti_service.update(idti_service_params)\n format.html { redirect_to @idti_service, notice: 'Idti service was successfully updated.' }\n format.json { render :show, status: :ok, location: @idti_service }\n else\n format.html { render :edit }\n format.json { render json: @idti_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params.except(:counter))\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params)\n format.html { redirect_to edit_service_path(@service), notice: 'El servicio ha sido actualizado satisfactoriamente.' }\n format.json { render :edit, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service = Service.find(params[:id])\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n format.html { redirect_to [@wedding, @service], notice: 'Service was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event_service.update_attributes(event_service_params)\n format.html { redirect_to @event_service, notice: 'Event service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metadata => { 'xsi:type' => \"ins0:#{type}\" } }\n }\n }\n end\n end", "def set_xservice\n @xservice = Xservice.find(params[:id])\n end", "def add_to_services(name, type, description)\n data = {\n 'OS-KSADM:service' => {\n 'name' => name,\n 'type' => type,\n 'description' => description\n }\n }\n return post_request(address(\"/OS-KSADM/services\"), data, token())\n end", "def set_service\n @service = Service.find_by_id(params[:id])\n end", "def update\n @service = Service.find(params[:id])\n respond_to do |format|\n if @service.update_attributes(service_params)\n format.html { redirect_to @customer, success: 'Service was successfully updated.' }\n format.json { respond_with_bip(@service) }\n else\n format.html { render action: 'edit'}\n format.json { respond_with_bip(@service) }\n end\n end\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(path = '/files/', params = {})\n request :put, path, params\n end", "def servicio # :doc\n id = params[:service_id]\n if id.present?\n \t\tService.find(params[:service_id]) \n \tend \n end" ]
[ "0.66295433", "0.6348835", "0.61497", "0.6116656", "0.6116537", "0.60769606", "0.6001242", "0.60008645", "0.59863025", "0.59718204", "0.5936275", "0.588877", "0.588877", "0.5883784", "0.5804322", "0.5723139", "0.56858826", "0.56711096", "0.56468433", "0.56043905", "0.56043905", "0.55957156", "0.5584699", "0.55790025", "0.5572975", "0.5549676", "0.55477554", "0.5542404", "0.5511851", "0.5488272", "0.54840696", "0.5478104", "0.5478104", "0.5477335", "0.5477335", "0.5476414", "0.5463052", "0.54513156", "0.5446862", "0.5429556", "0.5425437", "0.5425437", "0.5425437", "0.5425437", "0.54230875", "0.54219705", "0.5418984", "0.5413536", "0.540431", "0.54017216", "0.53996694", "0.53881156", "0.53832626", "0.5378258", "0.5378258", "0.5378258", "0.5378258", "0.5378258", "0.5378258", "0.53781056", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5376307", "0.5370042", "0.5368272", "0.5365897", "0.53650725", "0.5351181", "0.5344856", "0.5343104", "0.53399605", "0.5312799", "0.5309532", "0.53085613", "0.52982306", "0.52944756", "0.5293028", "0.52856404", "0.52833134", "0.52793765", "0.52748555", "0.5268459" ]
0.0
-1
DELETE /services/1 DELETE /services/1.xml
def destroy @service = Service.find(params[:id], :conditions => conditions) #不能删除主控服务 if @service.is_ctrl? flash[:error] = "#{@service.name}删除失败,不能删除主控服务。" else @service.destroy flash[:notice] = "#{@service.name}删除成功。" end respond_to do |format| format.html { redirect_to(services_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to(services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to(services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to(services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @complex_service = ComplexService.find(params[:id])\n @complex_service.destroy\n\n respond_to do |format|\n format.html { redirect_to(complex_services_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete(id)\n @service.delete(id)\n end", "def destroy\n @approximate_service = ApproximateService.find(params[:id])\n @approximate_service.destroy\n\n respond_to do |format|\n format.html { redirect_to(approximate_services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_requests_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_services_url }\n format.json { head :ok }\n end\n end", "def destroy\n @service_version = ServiceVersion.find(params[:id])\n @service_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_versions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n respond_to do |format|\n if @service.destroy\n flash[:notice] = \"Service '#{@service.name}' has been deleted\"\n format.html { redirect_to services_url }\n format.xml { head :ok }\n else\n flash[:error] = \"Failed to delete service '#{@service.name}'\"\n format.html { redirect_to service_url(@service) }\n end\n end\n end", "def destroy\n @service.destroy\n end", "def destroy\n @service.destroy\n end", "def destroy\n @service.destroy\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :ok }\n end\n end", "def service_delete(name)\n\t\tif session_has_services_depend?\n\t\t\tmeterpreter_service_delete(name)\n\t\telse\n\t\t\tshell_service_delete(name)\n\t\tend\n\tend", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @service.destroy\n\n redirect_to services_url\n\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to admin_services_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @vip_service.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_services_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted a amx vip service: #{@vip_service.name}\")\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @bus_service = BusService.find(params[:id])\n @bus_service.destroy\n\n respond_to do |format|\n format.html { redirect_to(bus_services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@service is already loaded and authorized\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :ok }\n end\n end", "def delete\n @service.delete(self)\n end", "def destroy\n @service_line = ServiceLine.find(params[:id])\n @service_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_lines_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @xservice.destroy\n respond_to do |format|\n format.html { redirect_to xservices_url, notice: 'Xservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def service_group_delete(a10, name)\n a10.send(:axapi, 'slb.service_group.delete', 'post', {name: name, format: 'json'})\nend", "def destroy\n @final_service = FinalService.find(params[:id])\n @final_service.destroy\n\n respond_to do |format|\n format.html { redirect_to(final_services_url) }\n format.xml { head :ok }\n end\n end", "def delete(name)\n Win32::Service.delete(n(name))\n end", "def delete_service_files(resource)\n file get_service_script_name(resource) do\n action :delete\n only_if { get_service_script_name != nil }\n end\nend", "def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def destroy\n @service.destroy\n \n respond_to do |format|\n format.html { redirect_to services_url(@page) }\n format.json { head :no_content }\n end\n end", "def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end", "def delete\n @service.delete(self)\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'El servicio ha sido eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @end_service.destroy\n head :no_content\n end", "def destroy\n #@service = Service.find(params[:id])\n @service = current_user.pro.services.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n #format.html { redirect_to services_url }\n format.html { redirect_to(pros_services_path, :notice => 'Service mis &agrave; jour avec succ&egrave;s.')}\n format.json { head :ok }\n end\n end", "def destroy\n Service.find(params[:id]).destroy\n flash[:success] = \"A record add been successfully deleted\"\n redirect_to services_path\n end", "def destroy\n @service_check_detail = ServiceCheckDetail.find(params[:id])\n @service_check_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_check_details_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @emt_service.destroy\n respond_to do |format|\n format.html { redirect_to emt_services_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @idti_service.destroy\n respond_to do |format|\n format.html { redirect_to idti_services_url, notice: 'Idti service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n ensure_service!\n service.delete_instance path\n true\n end", "def destroy\n @nossos_servico = NossosServico.find(params[:id])\n @nossos_servico.destroy\n\n respond_to do |format|\n format.html { redirect_to(nossos_servicos_url) }\n format.xml { head :ok }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'El servicio ha sido destruido satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def delete\n self.class.delete_service_instance(@service_name, @name)\n end", "def destroy\n @service = current_professional_user.services.find(params[:id])\n @service.destroy\n redirect_to services_url\n flash[:success] = 'Serviço excluído com sucesso.'\n end", "def destroy\n @service_checker = ServiceChecker.find(params[:id])\n @service_checker.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_checkers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_center = ServiceCenter.find(params[:id])\n @service_center.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_centers_url) }\n format.xml { head :ok }\n end\n end", "def remove_service\n service = Service.find(params[:service_id])\n version = Version.find(params[:version_id])\n @deployment.versions.delete(version)\n render :edit\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: \"Service was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: 'Serviço cadastrado com sucesso!' }\n format.json { head :no_content }\n end\n end", "def del_service(wspace, address, proto, port, comm='')\n\n\t\thost = get_host(:workspace => wspace, :address => address)\n\t\treturn unless host\n\n\t\thost.services.all(:conditions => {:proto => proto, :port => port}).each { |s| s.destroy }\n\tend", "def destroy\n @soap.destroy\n respond_to do |format|\n format.html { redirect_to soaps_url, notice: 'Soap was successfully destroyed.' }\n format.json { head :no_content }\n\n end\n end", "def destroy\n @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to service_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tservicio = Tservicio.find(params[:id])\n @tservicio.destroy\n\n respond_to do |format|\n format.html { redirect_to(tservicios_url) }\n format.xml { head :ok }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n flash[:notice] = \"This service profile was successfully deleted!\"\n redirect_to root_path\n end", "def destroy\n @service_log = ServiceLog.find(params[:id])\n @service_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(truck_service_logs_path(params[:truck_id])) }\n format.xml { head :ok }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @service.destroy\n respond_to do |format|\n format.html { redirect_to user_services_url(@user), notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_service\n # Disable automatically destroys the service with Runit.\n directory \"/var/log/#{new_resource.service_name}\" do\n action :delete\n recursive true\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @additional_service = AdditionalService.find(params[:id])\n @additional_service.destroy\n\n respond_to do |format|\n format.html { redirect_to additional_services_url }\n format.json { head :no_content }\n end\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\n start { |connection| connection.request http :Delete }\n end", "def destroy\r\n authorize! :destroy, @service\r\n @service.destroy\r\n respond_to do |format|\r\n format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\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 @service.update_column(:deleted, true)\n respond_to do |format|\n format.html { redirect_to admin_services_url, notice: 'Service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_length = ServiceLength.find(params[:id])\n @service_length.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_lengths_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request_service.destroy\n respond_to do |format|\n format.html { redirect_to request_services_url, notice: 'Request service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @services_charger = ServicesCharger.find(params[:id])\n @services_charger.destroy\n\n respond_to do |format|\n format.html { redirect_to(services_chargers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @online_service = OnlineService.find(params[:id])\n @online_service.destroy\n\n respond_to do |format|\n format.html { redirect_to online_services_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.71936023", "0.7171704", "0.7171704", "0.7171704", "0.67564905", "0.6729424", "0.6722399", "0.665567", "0.66411704", "0.6615554", "0.6574227", "0.65718734", "0.65649456", "0.65440506", "0.65440506", "0.65440506", "0.65421736", "0.6507189", "0.650532", "0.650532", "0.650532", "0.64953715", "0.6479937", "0.6478088", "0.64708114", "0.64338213", "0.6432142", "0.6399301", "0.6380772", "0.6373263", "0.6366682", "0.63534933", "0.6351432", "0.63472265", "0.6346843", "0.63206404", "0.63180524", "0.63166416", "0.63111013", "0.62930495", "0.6277494", "0.6274327", "0.6267157", "0.6259087", "0.6227738", "0.6223461", "0.6217652", "0.6217261", "0.6213008", "0.6209562", "0.62083596", "0.620005", "0.61971813", "0.61963034", "0.618431", "0.618431", "0.618431", "0.618431", "0.618431", "0.618431", "0.618431", "0.618431", "0.618431", "0.618431", "0.618431", "0.618431", "0.618431", "0.61829823", "0.61812425", "0.6178163", "0.6177465", "0.61695886", "0.61657846", "0.6158314", "0.6155216", "0.6155085", "0.615369", "0.6153509", "0.61172926", "0.61115324", "0.60949814", "0.6087063", "0.6086766", "0.60797215", "0.60754967", "0.60720885", "0.60720885", "0.60720885", "0.60720885", "0.6068939", "0.6068892", "0.6062204", "0.6061645", "0.6061645", "0.6060348", "0.6055479", "0.6051616", "0.6051589", "0.60497165", "0.60476786" ]
0.6275244
41
index to hold the visions
def index @visions = Vision.all.order("created_at DESC") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visibilities; end", "def variants_idx; end", "def index\r\n @index ||= 0\r\n end", "def image idx=0\n @images[idx]\n end", "def index\n @images = get_approved\n @left_images = []\n @right_images = []\n @center_images = []\n counter = 0\n @images.each do |image|\n counter+=1\n if counter == 1\n @left_images << image\n elsif counter ==2\n @center_images << image\n elsif counter ==3\n counter = 0\n @right_images << image\n end\n end\n end", "def index\n @anchor.drawing.worksheet.workbook.images.index(self)\n end", "def index\n @index ||= 1\n end", "def visibilities=(_arg0); end", "def index\n @drawing.anchors.index(self)\n end", "def index\n @drawing.anchors.index(self)\n end", "def vision(row_offset, column_offset)\n vision_array[row_radius + row_offset][column_radius + column_offset]\n end", "def index(p0) end", "def index(p0) end", "def visual_index\n row = @current_index\n row - @prow\n end", "def get_scene_indexes\n sn = @scenes.size - 1\n ssn = @scenes[sn][:says].size - 1\n return [sn, ssn]\n end", "def index ; @index ; end", "def init_indexes\n @image_indexes = @conditions.collect.with_index { |condition, index| condition ? index : nil }\n @image_indexes.compact!\n end", "def look(spaces)\n \t#Here we have an array\n vision = {}\n\n spaces.each_with_index { |space, index|\n #instance variable\n distance = index.succ\n entity = OBJECTS.select { |type|\n space.send \"#{type.to_s}?\".to_sym\n }.first\n raise \"woah\" unless entity\n vision[:nearest] = entity unless vision[:nearest]\n if vision[entity]\n vision[entity] << distance\n else\n vision[entity] = [distance]\n end\n\n nearest_entity_key = \"nearest_#{entity.to_s}\".to_sym\n vision[nearest_entity_key] = distance unless vision[nearest_entity_key]\n \n #This adds the items that he sees to the array\n if vision[:view]\n vision[:view] << entity\n else\n vision[:view] = [entity]\n end\n }\n\n vision\n end", "def lttfindex\n end", "def index\n @array = [45, 6, 32, 0]\n end", "def all_indexes\n\t\tindex_list = []\n\t\tfor y_index in 0..7\n\t\t\tfor x_index in 0..7\n\t\t\t\tindex_list << [y_index, x_index]\n\t\t\tend\n\t\tend\n\t\tindex_list\n\tend", "def index frame\n n = -1\n @avi.process_movi do |indices, movi|\n indices.each_with_index do |m, i|\n movi.pos = m[:offset] + 8\n f = Frame.new(movi.read(m[:size]), m[:id], m[:flag]) \n if f == frame\n n = i\n break\n end\n end\n [indices, movi]\n end\n n\n end", "def huella\n\t\tindice1 = 0\n\t\t#dependiendo del vct de cada ingrediente, se le pone un indice\n\t\tif vct < 670\n\t\t\tindice1 = 1\n\t\t\t\n\t\telsif vct > 830\n\t\t\tindice1 = 3\n\t\telse \n\t\t\tindice1 = 2\n\t\tend \n\t\tindice2 = 0\n\t\t#dependiendo de los gases emitidos de cada ingrediente, \n\t\t#se le pone un indice\n\t\tif emisiones < 800\n\t\t\tindice2 = 1\n\t\telsif emisiones > 1200\n\t\t\tindice2 = 3\n\t\telse \n\t\t\tindice2 = 2\n\t\tend\n\t\t#hace la media de los indices sacados\n\t\tindiceres = (indice1+indice2)/2\n\t\t\n\n\tend", "def screen_z\n # ??????????? Z ?????????\n if self.index != nil\n return self.index\n else\n return 0\n end\nend", "def indices\n @data.keys\n end", "def [](index)\n self.pegs[index]\n end", "def indexes\n @indexes ||= []\n end", "def idx(x, y)\n tx = x % @width\n ty = y % @height\n idx = tx + ty * @width\n end", "def index\n logger.info 'Index of elements'\n end", "def setActiveIndex(i)\n @activeIndex = i;\n @activeImage = @imageArray[@activeIndex]\n end", "def draw_indexes(pdf, options={})\n dimensions[:horizontal].times do |x|\n draw_index(pdf, x+1, dimensions[:vertical] , x+1)\n end\n dimensions[:vertical].times do |y|\n draw_index(pdf, 0, dimensions[:vertical] - (y+1), y+1)\n end\n end", "def index(element); end", "def index\n @av_stream[:index]\n end", "def cursor_to_decision\n @index = 89\n end", "def at(index); end", "def scores_index\n @scores_idx\n end", "def _lex_index_offsets; end", "def _lex_index_offsets; end", "def _lex_index_offsets; end", "def _lex_index_offsets; end", "def collection_profile_indices\n i = [self.conservation_status,\n self.processing_state,\n self.container_condition,\n self.condition_of_labels,\n self.identification_level,\n self.arrangement_level,\n self.data_quality,\n self.computerization_level].compact\n i.size == 8 ? i : []\n end", "def indices(i)\n [(i/WIDTH),(i-1) % (WIDTH)]\n end", "def indices(i)\n [(i/WIDTH),(i-1) % (WIDTH)]\n end", "def idx\n @ob.get_idx\n end", "def index; @index; end", "def indexes\n indexes = []\n @attributes.each_with_index {|values,idx| indexes << idx if values}\n indexes\n end", "def afficherIndices(grid)\n\t\ti = 1\n\t\tgrid.each{|g|\n\t\t\tprint i,\" : \", g, \"\\n\"\n\t\t\ti += 1\n\t\t}\n\tend", "def action\n play_decision_se\n send(ACTION_LIST[@image_indexes[@index]])\n end", "def perspective_index\n return nil unless perspective\n PERSPECTIVES.index(perspective)\n end", "def fetch_neighbors index\n # CONFIG\n total_articles = data.case_studies.length\n neighbors = []\n # SCRIPT\n if index === 1\n previous_article = fetch_article(total_articles)\n next_article = fetch_article(2)\n elsif index === total_articles\n previous_article = fetch_article(total_articles - 1)\n next_article = fetch_article(1)\n else\n previous_article = fetch_article(index - 1)\n next_article = fetch_article(index + 1)\n end\n neighbors.push(previous_article, next_article)\n # RETURN\n neighbors\n end", "def swim(index)\n end", "def index\n unless @descriptor_index\n @descriptor_index = all.inject({}) do |hash,d|\n hash[d.index_key] = d\n hash\n end\n end\n @descriptor_index\n end", "def index\n @index ||= tree.all_data.index(entry)\n end", "def indexed\n self['indexed']\n end", "def index\n @visions = Vision.order(\"created_at DESC\").limit(1).where(:user == current_user)\n end", "def index_image\n query = find_or_create_query(:Image, by: params[:by])\n show_selected_images(query, id: params[:id].to_s, always_index: true)\n end", "def size\n @avi.indices.size\n end", "def index\n\n\n #@link_arr= []\n #(1..2).each do |i|\n # Five00px.new.five_px(i)\n # end\n @image = Unlimited.skip(rand(Unlimited.count)).first\n\n end", "def [](index); end", "def index\n @my_visas = MyVisa.all\n end", "def participantes_ativos(participantes)\n\t\tindexes = participantes_index(participantes,{:status=>\"Ativo\"})\t\n\tend", "def [](index)\n beam[index]\n end", "def index\n\t\tpool = []\n\t\t# this'll get expensive... try getting a random site?\n\t\tSite.find(:all,:conditions => {:active => true}).each do |site|\n\t\t\tpool = pool + site.voted_less_than(5,5) # five images with less than 5 votes\n\t\tend\n\n\t\t@image = pool[((pool.length-1)*rand).to_i]\n\t\t@image.thumb\n\tend", "def set_picture_index(number)\n @picture_index = number\n end", "def discover_points # step 1\r\n x = 0\r\n y = 0\r\n @image_arr.each do |row|\r\n x = 0\r\n row.each do |cell|\r\n if cell == 1 # discovered the cell is 1\r\n @ordinal_arr.push([y,x]) # this is where i push the ordinals.\r\n puts \"#{y},#{x}\"\r\n end\r\n x = x + 1\r\n end\r\n y = y + 1\r\n puts \"\" \r\n end\r\n end", "def getindicesLigne(i)\n\t\treturn @indicesLigne[i]\n\tend", "def getChildrenIdx(idx)\n [2 * idx + 1, 2 * idx + 2]\n end", "def indices\n { persona: persona_index,\n numerus: [0, 3],\n genus: [0],\n modus: [0, 6],\n tempus: [nil, nil, nil, 0, 12, 24],\n }\n end", "def index(g)\n\t\t\t@groups.index(g)\n\t\tend", "def instability_index\n @instability_index ||=\n begin\n instability_sum = 0.0\n i = 0\n while @seq[i+1] != nil\n aa, next_aa = [@seq[i].chr.to_sym, @seq[i+1].chr.to_sym]\n if DIWV.key?(aa) && DIWV[aa].key?(next_aa)\n instability_sum += DIWV[aa][next_aa]\n end\n i += 1\n end\n round((10.0/amino_acid_number.to_f) * instability_sum, 2)\n end\n end", "def index\n self.get_slide_index\n end", "def [](index)\r\n @colours[index]\r\n end", "def target_idx\n @target_idx\n end", "def mat_index_vein\n v = vein\n v.inorganic_mat if v\n end", "def cycle_index\n stats[:cycle_index]\n end", "def cycle_index\n stats[:cycle_index]\n end", "def index\n w_len = GameSettings.get \"WORLD_LENGTH\"\n wv_len = GameSettings.get \"WORLD_VIEW_LENGTH\"\n @pos = [0, 0]\n unless params[\"x\"].nil? || params[\"y\"].nil?\n @pos[0] = params[\"x\"].to_i\n @pos[1] = params[\"y\"].to_i\n end\n\n len = (wv_len - 1).to_i / 2\n @near = Array.new()\n for y in (@pos[1]-len)..(@pos[1]+len)\n y2 = y % w_len\n for x in (@pos[0]-len)..(@pos[0]+len)\n x2 = x % w_len\n g = Galaxy.calcX(x2,y2)\n unless g.nil? || g < 0 then\n @near.append(g)\n end\n end\n end\n\n @galaxies = Galaxy.where(x: @near)\n end", "def index_image # :nologin: :norobots:\n query = find_or_create_query(:Image, :by => params[:by])\n show_selected_images(query, :id => params[:id].to_s, :always_index => true)\n end", "def animation_index at\n at.idiv(3).mod(6)\n end", "def mat_index\n mat_index_vein or stone_layer.mat_index\n end", "def index\n @trees = Tree.all\n @single = false\n @new = false\n @width = 700\n @height = 1400\n @vx = 0\n @vy = 0\n @vw = 400\n @vh = 750\n end", "def index\r\n\t @imdb_ranking.to_i - 1\r\n\tend", "def index\r\n\t @imdb_ranking.to_i - 1\r\n\tend", "def get_all_index_links_to_each_vland_show\n \t\t# index link for shows\n \t\tresp = get_resp(self.url)\n \t\tshow_index_link = self.url + resp.match(/\"\\/([^\"]*\\/shows)/)[1]\n \t\t#should probbly store this on something but yolo\n \t\tresp_shows = get_resp(show_index_link)\n \t\t# create shows by urls\n \t\tresp_shows.scan(/href=\"([^\"]*show\\/[^\"]*)/).uniq.each do |show_url|\n \t\t\tshow=Show.find_or_initialize_by(url: \"https:\" + show_url.to_s.gsub(/[\"\\[\\]]/,\"\"))\n \t\t\tif show.new_record?\n \t\t\t\tshow.content_provider_id = self.id\n \t\t\t\tshow.save!\n \t\t\tend\n \t\tend\n \tend", "def initIndices\n #Generation des indices de colonne\n 0.upto(@taille-1) do |i|\n ind = GroupeIndice.creer(@solution.getIndicesV(i))\n button = Gtk::Button.new(:label =>ind.tabIndice.join(\"\\n\"))\n button.signal_connect(\"button_press_event\") do |eventBox,event|\n isTabDisplay = ind.toggle\n if(isTabDisplay)\n button.label=ind.tabIndice.join(\"\\n\")\n else\n button.label=ind.somme.to_s\n end\n end\n @boxIndiceCol.add(button)\n end\n @boxIndiceCol.show_all\n #Generation des indices de ligne\n 0.upto(@taille-1) do |i|\n ind = GroupeIndice.creer(@solution.getIndicesH(i))\n button = Gtk::Button.new(:label =>ind.tabIndice.join(\" \"))\n button.signal_connect(\"button_press_event\") do |eventBox,event|\n isTabDisplay = ind.toggle\n if(isTabDisplay)\n button.label=ind.tabIndice.join(\" \")\n else\n button.label=ind.somme.to_s\n end\n end\n @boxIndiceLig.add(button)\n end\n @boxIndiceLig.show_all\n end", "def ta_index\n end", "def index\n @isadiseaseneighbors = Isadiseaseneighbor.all\n end", "def sub_tile_index(sub_face_left)\n\t\tif sub_face_left\n\t\t\t0\n\t\telse\n\t\t\t1\n\t\tend\n\tend", "def index\n CARDs_RANKS[@face]\n end", "def index\n @definition.index\n end", "def construct_index\n end", "def index\n\t\t\t@definition.index\n\t\tend", "def index_of(kind)\n case kind\n when 'static'\n inc_static\n (@static_count - 1).to_s\n when 'field'\n inc_field\n (@field_count - 1).to_s\n when 'argument'\n inc_arg\n (@arg_count - 1).to_s\n when 'var'\n inc_var\n (@var_count - 1).to_s\n end\n end", "def get_selected_indices; @selected_indices; end", "def index\n @visitations = Visitation.all\n end", "def positions_of_agents\n positions = []\n @figures.each {|f| positions << f.position}\n positions.shift\n positions\n end", "def neighbor(num)\n @neighbors[num]\n end", "def index(entry)\n @index[entry]\n end", "def index\n # @things = Thing.all\n # indexarr = params[:indices]\n # # indexarr = [60, 59, 62, 61, 70, 94, 72, 71, 85, 32, 16, 6, 27, 38, 14, 90, 48, 39, 74, 66]\n # # mi = indexarr.map.with_index(0).to_a\n \n # res = Thing.joins(:model_version_images).where('model_version_images.index' => indexarr).group(\"things.id\")\n\n # mindex = indexarr.each_with_index.map {|m, i| \"(#{m},#{i})\" }.join(\",\")\n # # r = Thing.select(\"things.*, MIN(x.ordering) as imgorder\").joins(:model_version_images).joins(\"INNER JOIN ( values #{mindex}) as x (index, ordering) ON model_version_images.index = x.index\").group(\"things.id\").order(\"imgorder\").includes(:model_version_images).page(1).per(2)\n # r = Thing.select(\"things.*, MIN(x.ordering) as imgorder\").joins(\"model_version_images as images ON things.id = images.thing_id\").joins(:model_version_images).joins(\"INNER JOIN ( values #{mindex}) as x (index, ordering) ON model_version_images.index = x.index\").group(\"things.id\").order(\"imgorder\").includes(:model_version_images)\n # res = Thing.joins(:model_version_images).joins(\"INNER JOIN ( values #{mindex}) as x (index, ordering) ON model_version_images.index = x.index\").group(\"things.id\")\n end", "def index()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.SegmentHistoryElement_index(@handle.ptr)\n result\n end" ]
[ "0.66058105", "0.6506336", "0.6158692", "0.6155393", "0.60802233", "0.60663015", "0.60533136", "0.6051944", "0.6050882", "0.6050882", "0.6038882", "0.59581167", "0.59581167", "0.59258085", "0.5872099", "0.5845627", "0.5836286", "0.5789152", "0.5751594", "0.57469535", "0.5743516", "0.5733187", "0.5718633", "0.5701965", "0.570039", "0.5681145", "0.56654954", "0.566345", "0.56585515", "0.5649356", "0.56468976", "0.56366307", "0.5605964", "0.55949324", "0.55913055", "0.55820304", "0.5578404", "0.5578404", "0.5578404", "0.5578404", "0.557462", "0.5562539", "0.5562539", "0.5561419", "0.5557402", "0.55529517", "0.5545492", "0.55447567", "0.5537202", "0.55364317", "0.5530665", "0.55209816", "0.5492117", "0.54901206", "0.54863334", "0.5484535", "0.54795593", "0.54788554", "0.5455496", "0.5439356", "0.5435103", "0.5432929", "0.5427356", "0.54244816", "0.5423926", "0.5415677", "0.5409358", "0.54083717", "0.54083663", "0.54052687", "0.53810877", "0.5369801", "0.53669393", "0.5360709", "0.5353995", "0.5353995", "0.53507483", "0.53400487", "0.5332292", "0.53244483", "0.5317764", "0.53038913", "0.53038913", "0.5298124", "0.52954185", "0.5293174", "0.528682", "0.5283938", "0.528367", "0.5278666", "0.5270835", "0.52687156", "0.5262687", "0.52583456", "0.5257084", "0.5257036", "0.52465177", "0.52458096", "0.524549", "0.5240645" ]
0.55403805
48
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.friendships_mailer.accepted.subject
def accepted user_id, accepter_id @user = User.find user_id @accepter = User.find accepter_id mail to: @user.email, subject: I18n.t('friendships_mailer.accepted.subject') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end", "def subject\n self['subject'] || msg['subject']\n end", "def subject\n @options.fetch(:subject) { \"Invitation\" }\n end", "def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end", "def message_subject=(value)\n @message_subject = value\n end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def invite_subject\n \"Your invitation to #{org_name.possessive} Creative Difference Dashboard\"\n end", "def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end", "def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end", "def subject\n message.subject\n end", "def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def subject=(subject); @message_impl.setSubject subject; end", "def message_subject\n return @message_subject\n end", "def confirmed(assignment)\n setup_user_email(assignment)\n @subject += I18n.translate 'assignment_mailer.accepted.subject', :event => assignment.event.code\n end", "def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end", "def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end", "def subject_name\n subject_full_name\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def subject\n @mail.subject\n end", "def subject_name\n return @subject_name\n end", "def headers\n { subject: \"#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}\",\n to: Account.current.preferred_support_email,\n from: Account.current.preferred_support_email,\n reply_to: %(\"#{name}\" <#{email}>) }\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def subject\n self['subject']\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end", "def title_for_request_message_for_requester\n I18n.t(\"notification.received_a_travel_request_message_is_owner.title\")\n end", "def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end", "def headers\n {\n :subject => \"澄清:對於#{candidate_name}的#{record_type}\",\n # :to => \"wevote@watchout.tw\",\n :to => Setting.email.clarify,\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def subject_name=(value)\n @subject_name = value\n end", "def normalize_subject_name\n self.subject = subject.downcase.titleize\n end", "def set_subject(subject)\n\t\tend", "def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def set_title\n @title = t(:message_0, :scope => [:controller, :scholarships])\n end", "def subject(options)\n case [options[:person], options[:plurality]]\n when %i[first singular]\n 'I'\n when %i[first plural]\n 'we'\n when %i[second singular], %i[second plural]\n 'you'\n when %i[third singular]\n 'he'\n when %i[third plural]\n 'they'\n end\n end", "def subject=(string)\n set('Subject', string)\n end", "def translation_scope\n \"mailers.#{mailer_name.tr(\"/\", \".\").sub(\"_mailer\", \"\")}.#{action_name}\"\n end", "def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end", "def sender_email_to_title_and_name\n known_emails = [Notifier.help_email, Notifier.search_filter_email, Notifier.message_email, Notifier.signup_email,\n Notifier.newsletter_email, Notifier.admin_email, Notifier.contact_email, Notifier.info_email,\n Notifier.feedback_email, Notifier.press_email].map {|m| Notifier.unprettify(m)}\n if known_emails.include?(self.sender_email)\n \"kann-ich-klagen.de\"\n elsif ps = Person.find_by_email(self.sender_email)\n ps.title_and_name\n else\n self.sender_email\n end\n end", "def adhoc_test_subj_call\n ->(candidate) { I18n.t('email.test_adhoc_subject_initial_input', candidate_account_name: candidate.account_name) }\n end", "def subject_names\n @subject_names ||= sw_subject_names\n end", "def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end", "def subject; @message_impl.getSubject; end", "def application_approved(exam_candidate)\n @exam_candidate = exam_candidate\n \n using_locale @exam_candidate.language do\n mail :to => @exam_candidate.email_address_with_name\n end\n end", "def community_member_email(sender, recipient, email_subject, email_content, community)\n @email_type = \"email_from_admins\"\n set_up_layout_variables(recipient, community, @email_type)\n with_locale(recipient.locale, community.locales.map(&:to_sym), community.id) do\n @email_content = email_content\n @no_recipient_name = true\n premailer_mail(:to => recipient.confirmed_notification_emails_to,\n :from => community_specific_sender(community),\n :subject => email_subject,\n :reply_to => \"\\\"#{sender.name(community)}\\\"<#{sender.confirmed_notification_email_to}>\")\n end\n end", "def subject\n title \n end", "def subject_titles\n @subject_titles ||= sw_subject_titles\n end", "def get_subject\n\t\tend", "def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end", "def subject_for_recommand_friends(invited_user)\n return \"#{@referrer.name} vous invite à créer votre profil sur CoursAvenue\"\n end", "def subject_with_formatting\n (self.subject.blank?) ? 'N/A' : self.subject\n end", "def user_rejected_email(course, user)\n ActsAsTenant.without_tenant do\n @course = course\n end\n @recipient = user\n\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email, subject: t('.subject', course: @course.title))\n end\n end", "def prompt_message(pre)\n @greeting = \"Hi\"\n @pre = pre\n @prompt = pre.prompt\n\n mail to: \"#{@pre.user.email}\",\n subject: \"#{@prompt.name}\"\n end", "def title\r\n fail \"There are no messages yet\" if self.messages.size == 0\r\n\r\n @messages[0].subject.size == 0 ? \"No title\" : @messages[0].subject\r\n end", "def ezm_subject_and_status(message)\r\n if message.receiver_deleted?\r\n message.subject + \" (Deleted)\" \r\n elsif message.read_at.nil?\r\n message.subject + \" (Unread)\" \r\n else \r\n message.subject\r\n end\r\n end", "def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end", "def get_subject_name\n subject_name = subject_header.text.sub! 'Subject:', ''\n subject_name = subject_name.strip!\n subject_name\n end", "def headers\n {\n :subject => %(<#{subject}>),\n\t\t\t:to => %(#{to}),\n :from => \"info@dreamyourweb.nl\"\n }\n end", "def receive_subject\n subjects = @subjects.keys.\n map { |subject| button(subject) }.\n join(\"\\n\")\n subject = ask(\"Что сдавал?\\n#{subjects}\")\n check_exist_subject(subject)\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def subject_for(from_name, conversation_with, verb=\"sent\", suffix=\"video\")\n \n case conversation_with.count\n when 0 \n \"#{from_name} #{verb} you #{suffix}\"\n when 1\n \"#{from_name} #{verb} you and #{nickname_for_user_or_email(conversation_with[0])} #{suffix}\"\n when 2\n \"#{from_name} #{verb} you, #{nickname_for_user_or_email(conversation_with[0])} and #{nickname_for_user_or_email(conversation_with[1])} #{suffix}\"\n else\n others = conversation_with[0..1].map { |p| nickname_for_user_or_email(p) } .join(\", \")\n \"#{from_name} #{verb} you, #{others} and #{pluralize(conversation_with.count-2, 'other')} #{suffix}\"\n end\n end", "def default_sender_address\n address = Mail::Address.new(Gitlab.config.gitlab.email_from)\n address.display_name = \"GitLab\"\n address\n end", "def subject_for_recommand_friends_stage_1(invited_user)\n return \"#{@referrer.name} vous invite à créer votre profil sur CoursAvenue\"\n end", "def application_confirmed(exam_candidate)\n @exam_candidate = exam_candidate\n \n using_locale @exam_candidate.language do\n mail :to => @exam_candidate.email_address_with_name\n end\n end", "def invitation_instructions(resource, token, opts={})\n invited_by = resource.invited_by\n invited_by_email = invited_by.email\n invited_to_account = Account.joins(:memberships).where(memberships: {user_id: resource.id, created_by_id: invited_by.id}).limit(1).first.try(:name)\n opts[:subject] = \"#{invited_to_account} Invitation from #{invited_by_email}\"\n super\n end", "def conversation_subject user\n if user.musician?\n \"#{user.name} desea unirse al grupo\"\n else\n \"#{user.name} desea que te unas al grupo\"\n end\n end", "def subject_and_status(message)\n tag = ''\n if message.receiver_deleted?\n tag = \" (Deleted)\"\n elsif message.read_at.nil? and params[:action] != \"outbox\"\n \"&middot; <strong>#{message.subject}</strong>\".html_safe\n else\n message.subject\n end\n end", "def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end", "def default_i18n_subject(interpolations = {})\n ''\n end", "def headers\n {\n subject: \"[#{Setting.site_name}] Neue Quelle eingesendet\",\n to: Setting.email,\n reply_to: email,\n from: Setting.get('from'),\n }\n end", "def validate_subject\n if @subject.nil?\n puts \"No subject, skipping\"\n raise StandardError, \"No subject\"\n else\n @title.strip\n end\n end", "def tellafriend (titel, werkurl, naam, email, bericht, sender, sent_at = Time.now)\n @artwork_title, @artwork_url, @message, @receiver, @sender = titel, werkurl, bericht, naam, sender\n\n @mail_content = Intmail.find_by_id(5)\n subject = @mail_content.title.sub('<sender_username>', \"#{sender.voornaam} #{sender.achternaam}\")\n mail(to: email, bcc: 'info@xposers.nl', subject: subject)\n end", "def headers\n {\n :subject => \"Contact Form:#{subject}\",\n :to => Sufia::Engine.config.contact_email, \n :from => Sufia::Engine.config.from_email\n }\n end", "def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end", "def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end", "def broadcast(league,message,sender,subject=nil)\n @league = league\n @sender = sender\n @message = MARKDOWN.render(message)\n\n subject = subject.blank? ? \"Important information from #{@league.display_name}\" : subject\n @subject = \"[#{SITE_NAME}] #{subject}\"\n\n ids = @league.liga_users.approved.map(&:user_id)\n bcc = User.where(id: ids).notify_league_broadcast.map{|u| \"#{u.display_name} <#{u.email}>\" }\n\n mail(to: DEFAULT_FROM_ADDRESS, bcc: bcc, subject: @subject)\n end", "def raf_submitted(study_subject)\n#\t\t@greeting = \"Hi\"\n\t\t@study_subject = study_subject\n\n\t\tmail to: \"magee@berkeley.edu\"\n\t\tmail cc: [\"jakewendt@berkeley.edu\", \"notifyccls@berkeley.edu\"]\n\t\tmail subject: \"TEST [CCLS Patient Notification Received] Identifier: #{@study_subject.icf_master_id_to_s}\"\n\tend", "def question(member, subject, content)\n @content = content\n\n mail to: member.email, subject: subject\n end", "def subject\n 'Report a problem'.freeze\n end", "def text_message_default_sender\n current_params.fetch(:from)\n end", "def assign_canned_subject\n self.subject = canned_subject\n end", "def rejected(request)\n @request = request\n mail to: @request.user.email, subject: default_i18n_subject(id: @request.id)\n end", "def set_subject_and_message(form, subject, message)\n raise Impostor::MissingTemplateMethodError.new(\"set_subject_and_message must be implemented\")\n end" ]
[ "0.6812615", "0.67983675", "0.6794393", "0.65702283", "0.6542836", "0.65288997", "0.6282071", "0.6217708", "0.61898345", "0.6167793", "0.6153471", "0.6104842", "0.60931265", "0.60761005", "0.6069549", "0.6041583", "0.6017945", "0.5994741", "0.59892327", "0.59889954", "0.596291", "0.5938991", "0.59387934", "0.5929047", "0.5929047", "0.5929047", "0.5929047", "0.5929047", "0.5929047", "0.5929047", "0.5929047", "0.5923586", "0.5895667", "0.5895505", "0.5887728", "0.5883366", "0.58810073", "0.5816149", "0.5776907", "0.57718545", "0.57580215", "0.5746206", "0.5743784", "0.5743784", "0.5743784", "0.5743784", "0.5743784", "0.5743784", "0.5742484", "0.57419014", "0.5740546", "0.5730778", "0.57227284", "0.5719512", "0.571704", "0.57149947", "0.5704991", "0.5702073", "0.56972605", "0.5683235", "0.56738913", "0.5661555", "0.5647032", "0.5637668", "0.5606225", "0.5576998", "0.55407834", "0.5540448", "0.55286527", "0.55204004", "0.55089754", "0.54940265", "0.54822433", "0.54818773", "0.54656595", "0.54656595", "0.54656595", "0.54656595", "0.545762", "0.5452829", "0.5451468", "0.5443897", "0.5429122", "0.54239815", "0.5418724", "0.5413934", "0.54088116", "0.5405924", "0.53910977", "0.53872955", "0.53814274", "0.5377405", "0.5377405", "0.537624", "0.5376022", "0.53677946", "0.5359414", "0.5358246", "0.53491527", "0.53425807", "0.5339569" ]
0.0
-1
GET /apps/1 GET /apps/1.xml GET /apps/1.json
def show @app = App.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @app } format.json { render :json => @app } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def app data={}\n get '/app', data\n end", "def index\n @app = App.new\n @apps = App.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def applications_list\n get \"applications\"\n end", "def app_by_id(id)\n get(\"/apps/#{id}\")\n end", "def index\n @apps = current_user.apps.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @apps }\n end\n end", "def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def applist(options:)\n path = \"/query/apps\"\n response = nil\n multipart_connection(port: 8060) do |conn|\n response = conn.get path\n end\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def show\n @app = current_user.apps.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end", "def getApplications(ak)\n uri='https://api.newrelic.com/v2/applications.json'\n parseUrl=URI.parse(uri)\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend", "def show\n @app = App.find_by_id(params[:id])\n if (@app)\n Rabl.render(@app, 'api/apps/show', view_path: 'app/views')\n else\n render status: 401, json: {error: \"Invalid app\"}\n end\n end", "def index\n @user_apps = UserApp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_apps }\n end\n end", "def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applications }\n end\n end", "def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @applications }\n end\n end", "def show\n @app = Mms::App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end", "def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.description}\"\n puts \" Status: #{application.status}\"\n puts \" Href: #{application.href}\"\n end \nend", "def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def index\n @apps = App.all\n @groups = Group.all\n @groupprops = Groupprop.all\n @groupclients = Groupclient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end", "def index\n respond_with @applications = Application.all\n end", "def show\n @program_app = ProgramApp.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @program_app\n end\n end\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def list_apps\n check_scope!\n\n apps = App.accessible_by(@context).unremoved.includes(:app_series).order(:title)\n apps = apps.where(scope: params[:scopes]) if params[:scopes].present?\n\n # Filter by latest revisions or versions.\n # This is kinda tricky, but we need to handle the apps which revisions were moved to a space\n # before we migrated to the new way how app is published to a space.\n apps = apps.select(&:latest_accessible_in_scope?)\n\n result = apps.map do |app|\n describe_for_api(app, unsafe_params[:describe])\n end\n\n render json: result\n end", "def show\n @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @app }\n end\n end", "def show\n @user_app = UserApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_app }\n end\n end", "def filter_apps\n @apps = ThirdpartyService.get_app_version(@url, AUTH, @http)['list']\n filter_result = render_to_string(partial: 'home/app_list', layout: false)\n render json: { filter_result: filter_result }\n end", "def show\n if params[:export_xml] || params[:export_app]\n params[:export_app] = true\n @app = App.export(params[:id].to_i) rescue nil\n else\n @app = App.find(params[:id].to_i) rescue nil\n end\n respond_to do |format|\n if @app.present?\n if params[:export_xml] || params[:export_app]\n presenter = apps_presenter_detailed(params[:optional_components])\n format.xml { render xml: presenter }\n format.json do\n if params[:export_xml]\n render xml: presenter\n else\n render json: presenter\n end\n end\n else\n format.xml { render xml: app_presenter }\n format.json { render json: app_presenter }\n end\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end", "def find\n raise Zype::Client::NoAppKey if Zype.configuration.app_key.to_s.empty?\n\n client.execute(method: :get, path: '/app')\n end", "def list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n name = a.elements.to_a(\"name\").first\n owner = a.elements.to_a(\"owner\").first\n [name.text, owner.text]\n end\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def index\n @app_configs = AppConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @app_configs }\n end\n end", "def show\n @newapp = Newapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @newapp }\n end\n end", "def index # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\n end", "def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend", "def show\n submenu_item 'applications-index'\n @app = App.find(params[:id], query)\n @alerts = Alert.all({\n :conditions => [\"source_type = 2 and source_id = ? and severity <> 0\", @app.id]\n })\n @services = @app.services\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end", "def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end", "def index\n @app_requests = AppRequest.all\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def get(options = {})\n request_model = @request_model_factory.get_app_request_model(options)\n response = @network_client.perform_request(request_model)\n json = JSON.parse(response.body)\n Fabricio::Model::App.new(json)\n end", "def apps\n apps_search = []\n App.all.each do |app|\n apps_search << {\n title: app.name,\n description: app.package_id,\n url: app_path(id: app.id)\n }\n end\n gon.apps = apps_search\n end", "def show\n @app_version = @app.app_versions.find(params[:id])\n # @app_version = AppVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app_version }\n end\n end", "def applications\n get(PLURAL_PATH, RESOURCE)\n end", "def get_applications_of_project\n respond_to do |format|\n param = params[:payload]\n format.json {\n @project_applications = ProjectApplication.where(:project_id => Project.find_by_id(param[:id]))\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def index\n @apps = App.paginate :page => params[:page], :per_page => 25 \n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @apps }\n end\n end", "def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def index\n @user ||= current_user\n @apps = @user.apps.all\n # @app = @user.apps.find(params[:id]) \n\n end", "def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.json { render json: @application }\n end\n end", "def show\n render json: @app\n end", "def show\n @userapp = Userapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @userapp }\n end\n end", "def get_apps\n apps = @api_rate_limit.call.app.list.sort_by { |app| DateTime.parse(app[\"created_at\"]) }.reverse\n @app_count = apps.count\n @hatchet_apps = apps.select {|app| app[\"name\"].match(@regex) }\n end", "def index\n @app_servers = AppServer.all\n end", "def show\n respond_with @application = Application.find(params[:id])\n end", "def list_apps\n render :text => app_configs.keys\n end", "def index\n @applications = Application.all\n end", "def index\n @applications = Application.all\n end", "def index\n @applications = Application.all\n end", "def index\n @applications = Application.all\n end", "def index\n @apparels = Apparel.all\n json_response({success: true, data: @apparels}, :ok)\n end", "def fetch_app_by_id(id)\n page = request(app_url,{:id => id})\n raise StoreRequestError unless page.code == \"200\"\n plist = Plist::parse_xml(page.body)\n return nil if plist[\"status-code\"]\n app = App.new(plist[\"item-metadata\"])\n end", "def index\n @apps = @call.app_class.unscoped.all(:order => :id)\n end", "def index\n @apps = Application.order(:name).all\n end", "def response(app=nil)\n get_response(app)\n end", "def show\n @applications_application = ApplicationsApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applications_application }\n end\n end", "def show\n @web_app = WebApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_app }\n end\n end", "def index\n @apps = Addon.all\n end", "def all\n request_model = @request_model_factory.all_apps_request_model\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body).map do |app_hash|\n Fabricio::Model::App.new(app_hash)\n end\n end", "def get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end", "def show\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app_config }\n end\n end", "def get_app_spec\n # App should exist and be accessible\n app = App.accessible_by(@context).find_by_uid(unsafe_params[:id])\n fail \"Invalid app id\" if app.nil?\n\n render json: { spec: app.spec, assets: app.ordered_assets, packages: app.packages }\n end", "def show\n @app_resouces = @app_list.app_resouces.all\n end", "def index\n @applications = Application.find(:all,:conditions=>['user_id=?',current_user.id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @applications }\n end\n end", "def show\n params[:page_size] = params[:page_size] || PAGE_SIZE\n\t\t@mobile_apps = MobileApp.where(id: params[:id]).page(params[:page] || DEFAULT_PAGE).per(params[:page_size] || PAGE_SIZE)\n\t\trespond_to do |format|\n\t\t\tformat.json { render \"show\" }\n\t\tend\t\t\n\tend", "def new\n @app = current_user.apps.new\n @app.app_versions << AppVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app }\n end\n end", "def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n end", "def get id\n apps.select do |app|\n app.id == id\n end.first\n end", "def get_applications_of_user\n respond_to do |format|\n format.json {\n @project_applications = ProjectApplication.where(:user_id => @current_user.id)\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def stub_api_applications_get(request_params: default_applications_filter, response:, tenant_header: user_tenant_header)\n stub_api_common_get('applications', request_params, response, tenant_header)\n end", "def status\n\t\tbody = {\n\t\t\t'developerId' => $developer_id,\n\t\t\t'status' => params[:status]\n\t\t}\n\n\t\turl = URI.parse($base_url + '/v2/apps/' + params[:appId] + '/status')\n\t\thttp = Net::HTTP.new(url.host, url.port)\n\t\thttp.use_ssl = true\n\n\t\treq = Net::HTTP::Post.new(url.to_s, initheader = {'Content-Type' => 'application/json', 'Authorization' => $auth})\n\t\treq.body = ActiveSupport::JSON.encode(body)\n\t\tres = Net::HTTP.start(url.host, url.port) { |https|\n\t\t\thttp.request(req)\n\t\t}\n\t\t\n\t\tres = ActiveSupport::JSON.decode(res.body)\n\n\t\t# If error is retrieved, display error message and return\n\t\tif res['code'] != nil\n\t\t\tsession[:toast_type] = 'error'\n\t\t\tsession[:toast_message] = res['errors'][0]['message']\n\t\t\tredirect_to '/app/list'\n\t\t\treturn\n\t\tend\n\n\t\t# Display success message\n\t\tsession[:toast_type] = 'status'\n\t\tsession[:toast_message] = 'App ' + params[:status] + 'ed successfully'\n\tend", "def show\n #表示は誰でもできる\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end", "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend", "def index\n #@apps = App.all\n name = params[:name]\n platform = params[:platform]\n category = params[:category]\n @apps = App.search(name, platform, category)\n #@apps = App.search(params[:search])\n end", "def show\n @user ||= current_user\n @app = @user.apps.find(params[:id]) \n end", "def getAppsForDevice\n\n if !params.has_key?(:device_uid)\n render status: 400, text: \"\"\n end\n\n @apps = Array.new\n device = Device.find_by_uuid(params[:device_uid])\n downloads = Download.find_all_by_device_id(device.id)\n\n downloads.each do |d|\n app = App.find_by_id(d.app_download_id)\n\n if d.pending == false && app.accepted == true\n @apps << app\n end\n end\n\n @applist = Array.new\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n campaign_time_left = 0;\n campaign = device.getCampaignWithAppId(app.id)\n campaign_history = device.getCampaignHistoryWithAppId(app.id)\n if !campaign.nil? && !campaign_history.nil?\n if campaign.active && campaign.approved\n time_elapsed = Time.now - campaign_history.created_at\n if time_elapsed > (campaign.duration * 1.day)\n campaign_time_left = (campaign.duration * 1.day) - time_elapsed\n # campaign_time_left = 300\n end\n end\n end\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => campaign_time_left }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => campaign_time_left }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end", "def index\n @schedules = Schedule.paginate :page => params[:page], :order => \"created_at DESC\", :per_page => 10\n @apps = App.find(:all)\n \n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @schedules }\n end\n end", "def list\n get('/')\n end", "def index\n if current_user.is_admin\n @applications = Application.all\n puts @applications\n elsif current_user.is_seeker\n @applications = Application.where(jobseeker_id: Jobseeker.find_by(user_id: current_user.id).id)\n elsif current_user.is_biz\n @applications = Application.where(job_id: Job.where(bizowner_id: Bizowner.find_by(user_id: current_user.id).id))\n end\n end", "def index\n @mapps = Mapp.all\n end", "def show\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app_config }\n end\n end" ]
[ "0.7394064", "0.7196788", "0.70889664", "0.70800966", "0.7041119", "0.7013052", "0.69590694", "0.6893688", "0.68551886", "0.68551886", "0.68551886", "0.68122727", "0.6778694", "0.6753676", "0.6717287", "0.66659266", "0.6584758", "0.6565096", "0.6560866", "0.6526091", "0.6502336", "0.6480535", "0.6474038", "0.64643157", "0.64643157", "0.64515835", "0.64360046", "0.6419976", "0.6405021", "0.6405021", "0.6405021", "0.6405021", "0.6405021", "0.6381687", "0.63485336", "0.6319416", "0.63184565", "0.6300814", "0.62956434", "0.62896615", "0.6284148", "0.62775624", "0.626088", "0.62302285", "0.62280494", "0.6196748", "0.61572665", "0.61302376", "0.61173594", "0.61137277", "0.6098067", "0.6093213", "0.6091555", "0.60858727", "0.60801476", "0.60715276", "0.60715276", "0.606404", "0.6034245", "0.6027059", "0.6009717", "0.60072315", "0.5996242", "0.59940475", "0.5966777", "0.5962558", "0.5962558", "0.5962558", "0.5962558", "0.59624565", "0.59501994", "0.593649", "0.593625", "0.5932076", "0.5922997", "0.5918747", "0.59172", "0.5900868", "0.5891074", "0.58704627", "0.5855672", "0.58554494", "0.5854777", "0.58437866", "0.584117", "0.58399916", "0.582342", "0.5822804", "0.581877", "0.5806789", "0.578287", "0.5769897", "0.57694376", "0.5752848", "0.5741741", "0.5729026", "0.57245547", "0.5723827", "0.57226247", "0.57208806" ]
0.67858326
12
POST /apps POST /apps.xml POST /apps.json
def create @app = App.new(params[:app]) @app.rating = Rating.new(params[:rating]) respond_to do |format| if @app.save format.xml { render :xml => @app, :status => :created, :location => @app, :only => [:id]} format.json { render :json => @app, :status => :created, :location => @app, :only => [:id]} else format.xml { render :xml => @app.errors, :status => :unprocessable_entity } format.json { render :json => @app.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end", "def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(name=nil, options={})\n\t\toptions[:name] = name if name\n\t\txml(post('/apps', :app => options)).elements[\"//app/name\"].text\n\tend", "def create\n @app = App.new(app_params)\n @app.count = 0\n @app.uid = SecureRandom.uuid\n respond_to do |format|\n if @app.save\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to app_activities_path(@app) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # Receives a Facebook username and a list of Android package names.\n # The list of package names are delimited by newlines.\n \n @user = User.find_for_facebook_token(params[:token].strip)\n\n # List will be delimited by newlines\n packages_list = params[:apps].strip.split(\"\\n\")\n\n # Packages that were successfully associated created with user\n @apps = []\n @user_apps = []\n packages_list.each do |package_name|\n app = App.find(:first, :conditions => [ \"app_id = ?\", package_name ])\n valid_app = !app.nil?\n\n # If app doesn't exist on our system, add it\n if app.nil?\n app = App.new({ app_id: package_name })\n valid_app = app.save\n end\n\n if valid_app\n user_app = UserApp.where(:user_id => @user.id, :app_id => app.id)\n if user_app.size == 0\n user_app = UserApp.new({ user_id: @user.id, app_id: \n app.id, installed: true })\n else\n user_app = user_app[0]\n user_app.installed = true\n end\n if user_app.save\n @apps << app\n @user_apps << user_app\n end\n end\n end\n\n respond_to do |format|\n format.html { redirect_to user_apps_url }\n format.json { render json: { user: @user, apps: @apps }, \n status: :created }\n end\n end", "def create(name=nil, options={})\n\t\tparams = {}\n\t\tparams['app[name]'] = name if name\n\t\txml(post('/apps', params)).elements[\"//app/name\"].text\n\tend", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_appdefn(to_hash)\n end", "def create\n authorize! :create, @app\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_app app_name, dev_name, dev_email\n data[:app_name] = app_name\n data[:dev_name] = dev_name\n data[:dev_email] = dev_email\n end", "def create\n megam_rest.post_appreq(to_hash)\n end", "def update_app data={}\n put '/app', data\n end", "def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: \"Test app was successfully created.\" }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: 'Test app was successfully created.' }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n flash[:success] = 'App was successfully saved.'\n format.html { redirect_to @app }\n format.json { render :show, status: :created, location: @app }\n else\n flash[:danger] = 'There was a problem creating the App Catalog Page.'\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n manifest = JSON.parse(params[:manifest])\n manifest['provider'] = params[:provider]\n puts \"Repository type: #{params[:repository_type]}\"\n @client.app_create(params[:id], params[:repository_type])\n @client.app_add_manifest(params[:id], manifest)\n\n respond_to do |format|\n format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n #if @client.app_create(params[:id], manifest)\n # format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n # # FIXME format.json { render json: @app, status: :created, location: app_path(params[:id]) } \n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @app.errors, status: :unprocessable_entity } # FIXME\n #end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n session[:current_api_token] = @app.api_token\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { \n @apps = App.all\n render action: \"index\" \n }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new({\n :name => params[:name],\n :api_key => params[:api_key],\n :group_id => params[:group_id],\n :type_app => params[:type_app], \n :subgroup_id => params[:subgroup_id], \n :user_id => params[:user_id]\n\n})\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to '/agencias?group_id=' + params[:group_id], notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_app = App.new(admin_app_params)\n\n respond_to do |format|\n if @admin_app.save\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @admin_app] }\n else\n format.html { render :new }\n format.json { render json: [:admin, @admin_app].errors, status: :unprocessable_entity }\n end\n end\n end", "def app data={}\n get '/app', data\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def create(options)\n API::request(:post, 'escrow_service_applications', options)\n end", "def create\n #app_params.permit!\n #@app=App.find(params[:app_id])\n @service_in_app = @app.service_in_apps.build(serv_in_params)\n\n respond_to do |format|\n if @service_in_app.save\n format.html { redirect_to app_url(@service_in_app.app_id), :notice => 'App Service was successfully created.' }\n format.js { render :action => 'mesapps', :status => :created, :location => @user }\n else\n format.html { render :action => 'new' }\n format.js { render :action => @service_in_app.errors, :status => :unprocessable_entity }\n end\n end\n\n end", "def post_app_generate(application_id, type, opts={})\n # \n # default_options = {\n # \"name\" => \"\",\n # \"author\" => \"\",\n # \"description\" => \"\",\n # \"guid\" => \"\",\n # \"datasets\" => \"\",\n # \"env\" => \"prod\",\n # \"image_url\" => \"http://appresource.s3.amazonaws.com/apiappimages/missing_icard.jpg\",\n # \"runtime\" => \"\"\n # }\n # options = default_options.merge(opts)\n return post_response(\"app/#{application_id}/generate/#{type}\", opts,:json)\n end", "def index\n @app = App.new\n @apps = App.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def create\n @app = App.new(app_params)\n #added code for realizers list\n\t#@developers = Developer.where(:id => params[:realizers])\n #logger.debug \"DEVELOPER: #{@developers.inspect} \\n\"\n\t#@app.developers << @developers \n #logger.debug \"DEVELOPERS: #{@app.developers.inspect} \\n\"\n\t#end code\n\n respond_to do |format|\n if @app.save\n @app.developers << current_dev \n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_marketplaceapp(to_hash)\n end", "def create\n megam_rest.post_marketplaceapp(to_hash)\n end", "def create\n @registered_app = RegisteredApp.new(registered_app_params)\n\n respond_to do |format|\n if @registered_app.save\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @registered_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def register_application(app_name, namespace, public_hostname)\n # curl -X POST https://dnsapi.cn/Record.Create -d 'login_email=api@dnspod.com&login_password=password&format=json&domain_id=2317346&sub_domain=@&record_type=A&record_line=默认&value=1.1.1.1'\n\n # create an A record for the application in the domain\n hostname = \"#{app_name}-#{namespace}\"\n url = \"https://dnsapi.cn/Record.Create\"\n params = common_params.merge({\n :domain_id => @domain_id,\n :sub_domain => hostname,\n :record_type => 'A',\n :record_line => '默认',\n :value => public_hostname\n })\n\n res = @http.post(url, params)\n res = JSON.parse(res.content)\n puts res\n\n result = JSON.parse(response.body)\n result.status['message']\n #{\n # \"status\": {\n # \"code\":\"1\",\n # \"message\":\"Action completed successful\",\n # \"created_at\":\"2012-11-23 22:17:47\"\n #},\n # \"record\": {\n # \"id\":\"16894439\",\n # \"name\":\"@\",\n # \"status\":\"enable\"\n #}\n #}\n\n end", "def update(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\n end", "def create\n @phone_app = PhoneApp.new(phone_app_params)\n\n respond_to do |format|\n if @phone_app.save\n format.html { redirect_to @phone_app, notice: 'Phone app was successfully created.' }\n format.json { render :show, status: :created, location: @phone_app }\n else\n format.html { render :new }\n format.json { render json: @phone_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @userapp = Userapp.new(params[:userapp])\n\n respond_to do |format|\n if @userapp.save\n flash[:notice] = 'Userapp was successfully created.'\n format.html { redirect_to(@userapp) }\n format.xml { render :xml => @userapp, :status => :created, :location => @userapp }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @userapp.errors, :status => :unprocessable_entity }\n end\n end\n end", "def app_params\n params.require(:app).permit(:name, :platform, :openid_redirect_urls, :token_endpoint_auth_method, :openid_client_secret, :openid_client_id, :contacts, :client_uri, :policy_uri, :tos_uri, :logo_uri )\n end", "def create\n @app = App.new app_params\n @app.user = current_user\n \n if @app.valid?\n\n openid_client = Services::OpenIdConnectionService.new(@app).register\n\n\n if openid_client[\"client_id\"].present?\n @app.openid_client_id = openid_client[\"client_id\"]\n @app.openid_client_secret = openid_client[\"client_secret\"]\n @app.openid_client_access_token = openid_client[\"registration_access_token\"]\n @app.save\n end\n end\n\n respond_to do |format|\n if @app.persisted?\n format.html { redirect_to app_path(@app), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def create\n @app_request = AppRequest.new(app_request_params)\n @app_request.order_uid = SecureRandom.uuid\n\n tm_response = faraday.post do |req|\n req.url uri.path\n req.headers['Content-Type'] = 'application/json'\n req.headers['X-API-KEY'] = @app_request.public_key\n req.body = @app_request.to_json\n end\n\n if tm_response.success? && @app_request.save\n redirect_to tm_response.body\n else\n errors = JSON.parse(tm_response.body)['errors']\n errors.each do |e|\n @app_request.errors.add(:base, e)\n end\n\n respond_to do |format|\n format.html {\n render :new, error: tm_response.body\n }\n end\n end\n end", "def app_params\n params.require(:app).permit(:name, :api_key,:group_id,:type_app, :subgroup_id, :user_id)\n end", "def apps=(value)\n @apps = value\n end", "def create\n @app = App.new(params[:app])\n\n @group = Group.new\n @group.description = params[:app][:name]\n @group.save\n\n @groupprop = Groupprop.new\n @groupprop.groupName = params[:app][:name]\n @groupprop.name = 'sharedRoster.displayName'\n @groupprop.propValue = params[:app][:name]\n @groupprop.save\n @groupprop = Groupprop.new\n @groupprop.groupName = params[:app][:name]\n @groupprop.name = 'sharedRoster.groupList'\n @groupprop.propValue = ''\n @groupprop.save\n @groupprop = Groupprop.new\n @groupprop.groupName = params[:app][:name]\n @groupprop.name = 'sharedRoster.showInRoster'\n @groupprop.propValue = 'onlyGroup'\n @groupprop.save\n\n @groupclient = Groupclient.new\n @groupclient.groupName = params[:app][:name]\n @groupclient.username = ''\n @groupclient.administrator = 1\n @groupclient.save\n\n @role = Role.new\n @role.name = params[:app][:name]\n @role.save\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def ajax_mf_app_create\n\n domain = params[:domain] + \".myshopify.com\"\n from_email = params[:domain] + \"@custprotection.com\"\n\n digest = OpenSSL::Digest.new('sha256')\n token = Base64.encode64(OpenSSL::HMAC.digest(digest, ENV['SECRET_KEY_BASE'], params[:domain])).strip\n app = App.create(user_id: params[:user_id], name: domain, auth_token: token, from_email: from_email)\n\n response = {\n success: true,\n url: app.name,\n message: 'App Created!'\n }\n\n render json: response\n\n end", "def app_params\n params.require(:app).permit(:name, :description)\n end", "def create\n @app_server = AppServer.new(app_server_params)\n\n respond_to do |format|\n if @app_server.save\n format.html { redirect_to @app_server, notice: 'App server was successfully created.' }\n format.json { render :show, status: :created, location: @app_server }\n else\n format.html { render :new }\n format.json { render json: @app_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @app = current_user.apps.new\n @app.app_versions << AppVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app }\n end\n end", "def create\n params[:app][:user_id] = current_user.id\n @app = App.create(params[:app])\n if @app.save\n redirect_to source_app_path(@app), notice: 'app was successfully created.'\n else\n render :new\n end\n end", "def app_params\n params.require(:app).permit(:email, :name, :date, :phone, :employment, :currently, :looking_for, :experience, :ideas, :linkedin, :heard_from)\n end", "def create\n @todo_app = TodoApp.new(todo_app_params)\n\n respond_to do |format|\n if @todo_app.save\n format.html { redirect_to @todo_app, notice: 'Todo app was successfully created.' }\n format.json { render :show, status: :created, location: @todo_app }\n else\n format.html { render :new }\n format.json { render json: @todo_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_apps(apps_attrs)\n (apps_attrs || []).each do |app|\n AppEnvironment.from_hash(api, {'app' => app, 'environment' => self})\n end\n end", "def create\n @cotiz_app = CotizApp.new(cotiz_app_params)\n\n respond_to do |format|\n if @cotiz_app.save\n format.html { redirect_to cotiz_app_path(@cotiz_app), notice: 'Cotiz app was successfully created.' }\n format.json { render :show, status: :created, location: @cotiz_app }\n else\n format.html { render :new }\n format.json { render json: @cotiz_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n IO.popen([\"mail\", \"-s\", \"New Application request\", \"jon@railsclass.com\"], \"w\") {|f|\n f.puts @app.name;\n f.puts @app.email;\n f.puts @app.phone;\n f.puts @app.date;\n f.puts @app.employment;\n f.puts @app.currently;\n f.puts @app.looking_for;\n f.puts @app.experience;\n f.puts @app.ideas;\n f.puts @app.linkedin;\n f.puts @app.heard_from;\n f.close_write;\n }\n\n gb = Gibbon::API.new\n \n name_array = app_params[:name].split\n first_name = app_params[:name]\n last_name = \"\"\n if name_array.length > 1 && name_array[0].length > 0 && name_array[1].length > 0\n first_name = name_array[0]\n last_name = name_array[1]\n end\n puts \"subscribing new user to list\"\n \n gb.lists.subscribe({:id => \"75aba6bef3\", :email => {:email => app_params[:email]}, :merge_vars => {:FNAME => first_name, :LNAME => last_name}, :double_optin => true})\n\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to root_path, notice: \"A lovely application! We'll be in touch soon!\" }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @parent_app = ParentApp.new(parent_app_params)\n\n respond_to do |format|\n if @parent_app.save\n format.html { redirect_to @parent_app, notice: 'Parent app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @parent_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @parent_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @applist = Applist.new(applist_params)\n\n respond_to do |format|\n if @applist.save\n format.html { redirect_to @applist, notice: 'Applist was successfully created.' }\n format.json { render :show, status: :created, location: @applist }\n else\n format.html { render :new }\n format.json { render json: @applist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App::Gcm::App.find_by_name(params[:app_name])\n @app_user = @app.app_users.build(app_params)\n @app_user.app_id = @app.id\n @app_user.app_name = @app.name\n respond_to do |format|\n if @app_user.save\n format.html { redirect_to ({action:'show', id:@app_user.id}), notice: 'App user was successfully created.' }\n format.json { render json: @app_user, status: :created, location: {:action => 'show', id:@app_user.id} }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def app_params\n params.require(:app).permit(:key, :identifier, :environment, :password, :certificate, :sandbox)\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create\n @app_instance = AppInstance.new(app_instance_params)\n\n respond_to do |format|\n if @app_instance.save\n format.html { redirect_to @app_instance, notice: 'App instance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @app_instance }\n else\n format.html { render action: 'new' }\n format.json { render json: @app_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment_app = PaymentApp.new(payment_app_params)\n respond_to do |format|\n if @payment_app.save\n format.html { redirect_to @payment_app, notice: 'Payment app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @payment_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app_config = AppConfig.new(params[:app_config])\n\n respond_to do |format|\n if @app_config.save\n format.html { redirect_to @app_config, notice: 'App config was successfully created.' }\n format.json { render json: @app_config, status: :created, location: @app_config }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend", "def appstore_apps_message(app_id)\n response = connection.post(get_appstore_apps_message_url(app_id)) do |request|\n request.headers[CONTENT_TYPE] = APPLICATION_JSON\n request.params[:adminDeviceSpaceId] = \"1\"\n request.body = JSON.dump({ installIncluded: true, updateIncluded: true, pushApp: true })\n end\n\n if response.success?\n AppStoreAppsMessageResponse.new(response.body)\n end\n end", "def app_params\n params.require(:app).permit(:name, :platform, :category, :version, :picture)\n end", "def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end", "def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end", "def registered_app_params\n params.require(:registered_app).permit(:url, :name)\n end", "def update\n\n if @app.update_attributes(params[:app])\n respond_to do |format|\n format.html {\n redirect_to app_path(@app), notice: 'app was successfully updated.'\n }\n format.json { render :nothing => true}\n end\n else\n respond_to do |format|\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def app_params\n params.require(:app).permit(:title, :acronym, :description, :prod_mgr, :prod_owner, :lead_dev, :deploy_date, :link_to_app, :link_to_repo, :link_to_backlog, :user_1, :user_count_1, :user_2, :user_count_2, :user_3, :user_count_3, :user_4, :user_count_4, :user_5, :user_count_5, :user_6, :user_count_6, :user_7, :user_count_7, :user_8, :user_count_8, :responsive, :version, :prog_lang_1, :prog_lang_version, :prog_lang_eol_1, :framework_1, :framework_version, :framework_eol_1, :database, :database_version, :database_eol, :web_server, :web_server_version, :web_server_eol, :app_server, :app_server_version, :app_server_eol, :tech_stack_1, :tech_stack_eol_1, :tech_stack_2, :tech_stack_eol_2, :tech_stack_3, :tech_stack_eol_3, :sys_dep_1, :sys_dep_2, :sys_dep_3, :sys_dep_4, :sys_dep_5, :sys_dep_6, :app_priority)\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "def create\n @appdatainfo = Appdatainfo.new(appdatainfo_params)\n\n respond_to do |format|\n if @appdatainfo.save\n format.html { redirect_to @appdatainfo, notice: 'Appdatainfo was successfully created.' }\n format.json { render :show, status: :created, location: @appdatainfo }\n else\n format.html { render :new }\n format.json { render json: @appdatainfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)\n # First, we need to fetch the data from Apple, which we then modify with the user's values\n r = request(:get, 'ra/apps/create/?appType=ios')\n data = parse_response(r, 'data')\n\n # Now fill in the values we have\n data['versionString']['value'] = version\n data['newApp']['name']['value'] = name\n data['newApp']['bundleId']['value'] = bundle_id\n data['newApp']['primaryLanguage']['value'] = primary_language || 'English'\n data['newApp']['vendorId']['value'] = sku\n data['newApp']['bundleIdSuffix']['value'] = bundle_id_suffix\n data['companyName']['value'] = company_name if company_name\n\n # Now send back the modified hash\n r = request(:post) do |req|\n req.url 'ra/apps/create/?appType=ios'\n req.body = data.to_json\n req.headers['Content-Type'] = 'application/json'\n end\n\n data = parse_response(r, 'data')\n handle_itc_response(data)\n end", "def create\n @appdatum = Appdatum.new(appdatum_params)\n\n respond_to do |format|\n if @appdatum.save\n format.html { redirect_to @appdatum, notice: 'Appdatum was successfully created.' }\n format.json { render :show, status: :created, location: @appdatum }\n else\n format.html { render :new }\n format.json { render json: @appdatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n @application.status = Application.where(nursery_id: @application.nursery_id, date: @application.date, status: :appointed).count < @application.nursery.capacity ? :appointed : :waiting\n @application.save\n render :show, status: :created, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end", "def create\n @mobile_app = MobileApp.new(mobile_app_params)\n\n respond_to do |format|\n if @mobile_app.save\n format.html { redirect_to @mobile_app, notice: 'Mobile app was successfully created.' }\n format.json { render :show, status: :created, location: @mobile_app }\n else\n format.html { render :new }\n format.json { render json: @mobile_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mapp = Mapp.new(mapp_params)\n\n respond_to do |format|\n if @mapp.save\n format.html { redirect_to @mapp, notice: 'Subrcriber Created' }\n format.json { render :index, status: :created, location: @mapp }\n else\n format.html { render :new }\n format.json { render json: @mapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to \"/applications/#{@application.id}/step2\", notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def applist(options:)\n path = \"/query/apps\"\n response = nil\n multipart_connection(port: 8060) do |conn|\n response = conn.get path\n end\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def create\n @web_app = WebApp.new(params[:web_app])\n\n respond_to do |format|\n if @web_app.save\n format.html { redirect_to @web_app, notice: 'Web app was successfully created.' }\n format.json { render json: @web_app, status: :created, location: @web_app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @web_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name, attributes)\n deprecate # 07/26/2012\n put(\"/apps/#{name}\", :app => attributes).to_s\n end", "def create\n @app_appointment = AppAppointment.new(app_appointment_params)\n\n respond_to do |format|\n if @app_appointment.save\n format.html { redirect_to @app_appointment, notice: 'App appointment was successfully created.' }\n format.json { render :show, status: :created, location: @app_appointment }\n else\n format.html { render :new }\n format.json { render json: @app_appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @user_apps = UserApp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_apps }\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 update\n @app = @client.app(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app]) # FIXME\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer_app = CustomerApp.new(customer_app_params)\n @customer_app.auth_account_id = active_account.id\n\n if @customer_app.save\n render :show, status: :created, location: @customer_app\n else\n render json: @customer_app.errors, status: :unprocessable_entity\n end\n end", "def create\n @app_config = AppConfig.new(params[:app_config])\n\n respond_to do |format|\n if @app_config.save\n format.html { redirect_to(@app_config, :notice => 'App config was successfully created.') }\n format.xml { render :xml => @app_config, :status => :created, :location => @app_config }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "def registered_app_params\n params.require(:registered_app).permit(:name, :widget, :widget_endpoint)\n end", "def create\n @app_config = AppConfig.new(app_config_params)\n\n respond_to do |format|\n if @app_config.save\n format.html { redirect_to @app_config, notice: 'App config was successfully created.' }\n format.json { render :show, status: :created, location: @app_config }\n else\n format.html { render :new }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7001234", "0.6684904", "0.66720366", "0.6669351", "0.6620774", "0.65990245", "0.65990245", "0.65046954", "0.647889", "0.6468927", "0.6442003", "0.642065", "0.6420005", "0.6420005", "0.6415673", "0.6389441", "0.63139117", "0.6275622", "0.6253363", "0.623006", "0.62077874", "0.6207342", "0.618705", "0.61761636", "0.61285406", "0.6108821", "0.6102289", "0.60908216", "0.6040173", "0.59742785", "0.59631276", "0.59512454", "0.59385276", "0.5931508", "0.59210634", "0.5920764", "0.5920764", "0.590237", "0.5888708", "0.5888708", "0.58138883", "0.5811093", "0.580383", "0.5801243", "0.57908916", "0.578841", "0.5758523", "0.5753952", "0.5751563", "0.5728848", "0.5722279", "0.5713535", "0.571138", "0.5699213", "0.56793034", "0.5677394", "0.56768334", "0.5667548", "0.5662471", "0.566166", "0.5653961", "0.56265837", "0.5620376", "0.5619404", "0.5618078", "0.56015825", "0.56015825", "0.55995286", "0.55864936", "0.5586417", "0.5560008", "0.5558258", "0.55442065", "0.553281", "0.5518096", "0.5494119", "0.54882544", "0.5469014", "0.5467533", "0.5467533", "0.5467533", "0.5467533", "0.5465463", "0.5447319", "0.54425216", "0.54357594", "0.5434974", "0.54259014", "0.54210526", "0.54198223", "0.5401688", "0.5397541", "0.5394992", "0.53904766", "0.53852", "0.5382549", "0.53729033", "0.5370546", "0.53671855", "0.5366163" ]
0.5995883
29
PUT /apps/1 PUT /apps/1.xml PUT /apps/1.json
def update @app = App.find(params[:id]) respond_to do |format| if @app.update_attributes(params[:app]) and @app.rating.update_attributes(params[:rating]) format.xml { head :ok } format.json { head :ok } else format.xml { render :xml => @app.errors, :status => :unprocessable_entity } format.json { render :json => @app.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_app data={}\n put '/app', data\n end", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\n end", "def update\n @app = @client.app(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app]) # FIXME\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n if @app.update(app_params)\n head :no_content\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def update\n\n if @app.update_attributes(params[:app])\n respond_to do |format|\n format.html {\n redirect_to app_path(@app), notice: 'app was successfully updated.'\n }\n format.json { render :nothing => true}\n end\n else\n respond_to do |format|\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name, attributes)\n deprecate # 07/26/2012\n put(\"/apps/#{name}\", :app => attributes).to_s\n end", "def update \n if @app \n @app.update(app_params)\n\n if @app.valid?\n head :no_content\n else \n head :bad_request\n end\n else \n head :not_found\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to(@app, :notice => 'App was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html { redirect_to(@app, :notice => 'App was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n flash[:notice] = 'App was successfully updated.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to apps_path, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n\n Services::OpenIdConnectionService.new(@app).update \n end", "def update\n authorize! :update, @app\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:uid])\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @newapp = Newapp.find(params[:id])\n\n respond_to do |format|\n if @newapp.update_attributes(params[:newapp])\n format.html { redirect_to @newapp, notice: 'Newapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client_app = ClientApp.find(params[:id])\n\n respond_to do |format|\n if @client_app.update_attributes(params[:client_app])\n format.html { redirect_to(client_apps_path, :notice => 'Client app was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @seed.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user_app = UserApp.find(params[:id])\n\n respond_to do |format|\n if @user_app.update_attributes(params[:user_app])\n format.html { redirect_to @user_app, notice: 'User app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # TODO permissions\n if @app.user_id == current_user.id\n # @app.attributes = params[:app]\n @app.attributes = {'platform_ids' => []}.merge(params[:app] || {})\n # TODO Sanitize links\n # [:name, :website, :twitter, :facebook, :google_plus, :android, :itunes].each do |x|\n # @app.attributes[x] = Sanitize.clean(@app.attributes[x])\n # end\n if @app.save_update_by(current_user.id, request.remote_ip)\n flash[:notice] = \"Successfully updated.\"\n redirect_to app_path(@app)\n else\n render \"edit\"\n end\n else\n flash[:error] = \"You are not allowed to update the app.\"\n redirect_to app_path(@app)\n end\n end", "def update\n respond_to do |format|\n if @app.update(app_params)\n flash[:success] = 'App was successfully updated.'\n format.html { redirect_to @app }\n format.json { render :show, status: :ok, location: @app }\n else\n flash[:danger] = 'There was a problem updating the App Catalog Page.'\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n get_credentials\n begin\n response = resource[\"/update/#{app}\"].post(:apikey => @credentials[1], :frequency => options[:frequency])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def update\n authorize_action_for @app\n\n respond_to do |format|\n if app_params[:android_config].present? && app_params[:android_config][:bundle_id].present?\n if (@app.android_config['bundle_id'] != app_params[:android_config][:bundle_id]) && App.android_bundle_id?(app_params[:android_config][:bundle_id])\n @app.errors.add(:base, 'Android bundle id is invalid or already used')\n end\n end\n\n if app_params[:ios_config].present? && app_params[:ios_config][:bundle_id].present?\n if (@app.ios_config['bundle_id'] != app_params[:ios_config][:bundle_id]) && App.ios_bundle_id?(app_params[:ios_config][:bundle_id])\n @app.errors.add(:base, 'iOS bundle id is invalid or already used')\n end\n end\n\n if !@app.errors.full_messages.present? && @app.update(app_params)\n format.html { redirect_to request.referrer, notice: 'App was successfully updated.' }\n format.json { render json: @app, status: :ok, location: :edit }\n else\n format.html { render :settings }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_app.update(test_app_params)\n format.html { redirect_to @test_app, notice: \"Test app was successfully updated.\" }\n format.json { render :show, status: :ok, location: @test_app }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_app.update(test_app_params)\n format.html { redirect_to @test_app, notice: 'Test app was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_app }\n else\n format.html { render :edit }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "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 update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end", "def update_appdata(person_id, appId, key, value)\n @restv9.update_appdata(person_id, appId, key, value)\n end", "def update\n if @app.update(app_params)\n redirect_to @app, notice: 'App was successfully updated.' \n else\n render action: 'edit' \n end\n end", "def put!\n request! :put\n end", "def update\n @userapp = Userapp.find(params[:id])\n\n respond_to do |format|\n if @userapp.update_attributes(params[:userapp])\n flash[:notice] = 'Userapp was successfully updated.'\n format.html { redirect_to(@userapp) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @userapp.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_app.update(admin_app_params)\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_app }\n else\n format.html { render :edit }\n format.json { render json: @admin_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end", "def update\n respond_to do |format|\n if @todo_app.update(todo_app_params)\n format.html { redirect_to @todo_app, notice: 'Todo app was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo_app }\n else\n format.html { render :edit }\n format.json { render json: @todo_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @application.update(application_params)\n render json: @application, status: :ok, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def update\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n if @app_config.update_attributes(params[:app_config])\n format.html { redirect_to @app_config, notice: 'App config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update!(**args)\n @app = args[:app] if args.key?(:app)\n end", "def update\n @app = Mms::App.find(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:mms_app])\n flash[:notice] = '修改组件成功!'\n format.html { redirect_to(@app) }\n format.xml { head :ok }\n else\n flash[:notice] = '修改组件失败!'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_oauth_application(token, name, redirect_uris, description = '', icon = nil)\n request(\n __method__,\n :put,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris, description: description, icon: icon }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def update_oauth_application(token, name, redirect_uris, description = '', icon = nil)\n request(\n __method__,\n :put,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris, description: description, icon: icon }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def update\n @app = App.find(params[:id])\n\n if params[:cancel_edit_app_button]\n respond_to do |format|\n format.html do\n if request.xhr? \n render :partial => 'app', :locals => { :app => @app }\n else\n redirect_to apps_url\n end\n end\n \n format.xml { head :ok }\n end\n \n return\n end\n\n respond_to do |format|\n if @app.update_attributes(params[:app])\n format.html do\n if request.xhr?\n render :partial => 'app', :locals => {:app => @app}\n else\n flash[:notice] = 'App was successfully updated.'\n redirect_to app_activities_path(@app)\n end\n end\n format.xml { head :ok }\n else\n format.html do\n if request.xhr?\n render :partial => 'edit_horizontal', :locals => {:app => @app}\n else\n render :action => 'edit'\n end\n end\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registered_app.update(registered_app_params)\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def update!(**args)\n @app_id = args[:app_id] if args.key?(:app_id)\n @app_store = args[:app_store] if args.key?(:app_store)\n end", "def update\n respond_to do |format|\n if @parent_app.update(parent_app_params)\n format.html { redirect_to @parent_app, notice: 'Parent app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parent_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def app_update\n \tapi_detail = ApiDetail.find_by(api_version: 'v1', device_type: 0)\n render_success(api_detail_result(api_detail)) \n end", "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 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(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\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_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 app_update\n \tapi_detail = ApiDetail.find_by(api_version: 'v1', device_type: 0)\n render_success(api_detail_result(api_detail)) \n end", "def update\n @app_version = @app.app_versions.find(params[:id])\n # @app_version = AppVersion.find(params[:id])\n\n respond_to do |format|\n if @app_version.update_attributes(params[:app_version])\n format.html { redirect_to([@app, @app_version], :notice => 'App Version was successfully updated.') }\n # format.html { redirect_to(@app_version, :notice => 'App version was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app_version.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @visaapp = Visaapp.find(params[:id])\n\n respond_to do |format|\n if @visaapp.update_attributes(params[:visaapp])\n flash[:notice] = 'Visaapp was successfully updated.'\n format.html { redirect_to(@visaapp) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @visaapp.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n \n\n @client.redirect_urls << client_params[:add_redirect_url] if client_params[:add_redirect_url]\n \n @client.app_ids << BSON::ObjectId.new.to_s if client_params[:add_app_id]\n \n \n @client.versioned_update({\"redirect_urls\" => 1, \"app_ids\" => 1})\n\n if @client.op_success?\n render \"show\"\n else\n render \"edit\"\n end\n \n end", "def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend", "def put(request)\n error = validate(request)\n return error if error\n\n code =\n if data_store.exists?(request.rest_path)\n set_data(request, request.rest_path, request.body, :data_store_exceptions)\n 200\n else\n name = request.rest_path[4]\n data_store.create(request.rest_path[0..3], name, request.body, :create_dir)\n 201\n end\n already_json_response(code, request.body)\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to root_path, notice: 'Application was successfully submitted.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app_instance.update(app_instance_params)\n format.html { redirect_to @app_instance, notice: 'App instance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @app_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cotiz_app.update(cotiz_app_params)\n format.html { redirect_to @cotiz_app, notice: 'Cotiz app was successfully updated.' }\n format.json { render :show, status: :ok, location: @cotiz_app }\n else\n format.html { render :edit }\n format.json { render json: @cotiz_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @app_info = args[:app_info] if args.key?(:app_info)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def update\n respond_to do |format|\n if @appdatainfo.update(appdatainfo_params)\n format.html { redirect_to @appdatainfo, notice: 'Appdatainfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @appdatainfo }\n else\n format.html { render :edit }\n format.json { render json: @appdatainfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_app\n @app = App.find_by( token: params[:app_id])\n if !@app \n render json: { error: \"app not found\"}, status: :not_found\n end\n end", "def update\n @app = App.find(params[:id], :conditions => conditions)\n params[:app].delete :type_id\n respond_to do |format|\n if @app.update_attributes(params[:app])\n flash[:notice] = \"#{@app.name}更新成功。\"\n format.html { redirect_to(@app) }\n format.xml { head :ok }\n else\n dictionary\n @groups = Group.all :conditions=>{:tenant_id=>current_user.tenant_id},:order=>:name\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n @application = Application.find(params[:id])\n \n respond_to do |format|\n if @application.update_attributes(params[:application])\n flash[:notice] = 'Application was successfully updated.'\n format.html { redirect_to(@application) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @application.errors, :status => :unprocessable_entity }\n end\n end\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n @app.count = 0\n @app.uid = SecureRandom.uuid\n respond_to do |format|\n if @app.save\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@jobapp = Jobapp.find(params[:id])\n\n respond_to do |format|\n if @jobapp.update_attributes(params[:jobapp])\n format.html { redirect_to @jobapp, notice: 'Jobapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jobapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def updateAppBetaVersion(org_id, type, env, version)\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n begin\n # Making sure \"settings.apps is init correctly\"\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\"\n },\n expression_attribute_values: {\n \":null\" => nil,\n \":empty\" => {}\n },\n update_expression: \"SET #SETTINGS.#APPS = :empty\",\n condition_expression: \"#SETTINGS.#APPS = :null\"\n }\n )\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.important(\"Skipping setting 'settings.apps' in org object\")\n end\n\n begin\n # Making sure \"settings.apps.type is init correctly\"\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type\n },\n expression_attribute_values: {\n \":empty\" => {}\n },\n update_expression: \"SET #SETTINGS.#APPS.#TYPE = if_not_exists(#SETTINGS.#APPS.#TYPE, :empty)\"\n }\n )\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.important(\"Skipping setting 'settings.apps.#{type}' in org object\")\n end\n\n # updating the values\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type,\n \"#ENV\" => env,\n \"#ENV_VERSION\" => \"#{env}_version\",\n \"#ENV_DATE\" => \"#{env}_version_date\"\n },\n expression_attribute_values: {\n \":env\" => true,\n \":version\" => version,\n \":date\" => Time.now.strftime(\"%d/%m/%Y\")\n },\n update_expression: \"SET #SETTINGS.#APPS.#TYPE.#ENV = :env,\" \\\n \"#SETTINGS.#APPS.#TYPE.#ENV_VERSION = :version,\" \\\n \"#SETTINGS.#APPS.#TYPE.#ENV_DATE = :date\"\n }\n )\n\n return true\nrescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return false\nend", "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 put(*args)\n request(:put, *args)\n end", "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to dynamic_url(@application, action: :edit), notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @second_rails_app = SecondRailsApp.find(params[:id])\n\n respond_to do |format|\n if @second_rails_app.update_attributes(params[:second_rails_app])\n format.html { redirect_to @second_rails_app, notice: 'Second rails app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @second_rails_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @apks = args[:apks] unless args[:apks].nil?\n @kind = args[:kind] unless args[:kind].nil?\n end", "def update\n return unless admin?\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @applist.update(applist_params)\n format.html { redirect_to @applist, notice: 'Applist was successfully updated.' }\n format.json { render :show, status: :ok, location: @applist }\n else\n format.html { render :edit }\n format.json { render json: @applist.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7055544", "0.69823295", "0.69823295", "0.6745103", "0.6531843", "0.651689", "0.6496434", "0.63878524", "0.637245", "0.6318991", "0.6318991", "0.6299086", "0.6299086", "0.6299086", "0.6297548", "0.6297548", "0.628797", "0.6164732", "0.6164732", "0.6164732", "0.6164732", "0.6164732", "0.61461836", "0.61008984", "0.6077243", "0.6072707", "0.59853816", "0.59366393", "0.58721775", "0.5854053", "0.5845308", "0.5830885", "0.580571", "0.57930696", "0.57673097", "0.5749115", "0.5739748", "0.57299787", "0.5698975", "0.5668963", "0.56608725", "0.5660078", "0.5654775", "0.56196946", "0.5604236", "0.560086", "0.55997914", "0.5595353", "0.5591186", "0.55628073", "0.5561979", "0.5561979", "0.555248", "0.5550788", "0.55474186", "0.55472964", "0.5538911", "0.5537811", "0.5530612", "0.55199206", "0.5518729", "0.5505336", "0.5505247", "0.549028", "0.5471836", "0.5465878", "0.5463107", "0.5461298", "0.5451008", "0.54481876", "0.54434496", "0.54264575", "0.54209083", "0.541932", "0.54139984", "0.5413259", "0.54034674", "0.53887194", "0.538429", "0.537692", "0.537149", "0.5365091", "0.53587335", "0.53568846", "0.53551227", "0.53551054", "0.5354898", "0.534736", "0.5328017", "0.5318191", "0.53163034", "0.5313632", "0.5307947", "0.53069276", "0.5306452", "0.5303933", "0.5298008", "0.5289874", "0.52765214", "0.5276019" ]
0.5985732
26
DELETE /apps/1 DELETE /apps/1.xml DELETE /apps/1.json
def destroy @app = App.find(params[:id]) @app.destroy respond_to do |format| format.html { redirect_to(apps_url) } format.xml { head :ok } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy(name)\n delete(\"/apps/#{name}\").to_s\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def webhelper_delete_all_apps (username, password, base_url = @base_url)\r\n private_resource = RestClient::Resource.new base_url + \"/api/v1/apps\" , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.get :accept => :json\r\n json = JSON.parse(response)\r\n json['apps'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts response.to_str\r\n end\r\n end", "def destroy\n @app = current_user.apps.find(params[:id])\n @app.destroy\n flash[:notice] = \"The #{@app.name} app was successfully deleted\"\n respond_to do |format|\n format.html { redirect_to apps_path }\n format.xml { head :ok }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @userapp = Userapp.find(params[:id])\n @userapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(userapps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def admin_delete_app\n\n # Get Current App\n app = MailfunnelsUtil.get_app\n\n # If the User is not an admin redirect to error page\n if !app.is_admin or app.is_admin === 0\n response = {\n success: false\n }\n\n render json: response and return\n end\n\n # Get App to be deleted\n del_app = App.find(params[:app_id])\n\n unless del_app\n response = {\n success: false\n }\n\n render json: response and return\n end\n\n\n # Delete App\n del_app.destroy\n\n\n response = {\n success: true\n }\n\n render json: response and return\n\n\n end", "def destroy\n @app.destroy\n redirect_to apps_url, notice: 'app was successfully deleted.'\n end", "def destroy \n Services::OpenIdConnectionService.new(@app).destroy \n\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_application(client, options)\n if !options[:application].nil?\n application = client.applications.get options[:application]\n application.delete\n puts \"Application deleted.\"\n return\n else\n puts \"Missing arguments\"\n return\n end \nend", "def destroy\n @app_list.app_resouces.destroy\n @app_list.destroy\n respond_to do |format|\n format.html { redirect_to app_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to admin2017_apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_app = UserApp.find(params[:id])\n @user_app.destroy\n\n respond_to do |format|\n format.html { redirect_to user_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n\n head :no_content\n end", "def destroy\n @app = App.find(params[:id], :conditions => conditions)\n @app.destroy\n flash[:notice] = \"#{@app.name}删除成功\"\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @visaapp = Visaapp.find(params[:id])\n @visaapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(visaapps_url) }\n format.xml { head :ok }\n end\n end", "def delete(*uris); end", "def destroy\n @app.destroy\n respond_to do |format|\n flash[:success] = 'App was successfully destroyed.'\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_app.destroy\n respond_to do |format|\n format.html { redirect_to test_apps_url, notice: 'Test app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_app.destroy\n respond_to do |format|\n format.html { redirect_to test_apps_url, notice: \"Test app was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @app\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_app.destroy\n respond_to do |format|\n format.html { redirect_to admin_apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n @exists = apps.include?(params[:app])\n @app = params[:app] unless @exists == false\n\n if @exists\n `rm #{File.expand_path(\"~/.pow/#{@app}\")}`\n redirect_to root_path, :notice => \"Pow app deleted\"\n else\n render :text => \"Given app is not a Pow app\"\n end\n end", "def destroy(name)\n deprecate # 07/26/2012\n delete(\"/apps/#{name}\").to_s\n end", "def destroy\n @app_version = @app.app_versions.find(params[:id])\n # @app_version = AppVersion.find(params[:id])\n @app_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(app_app_versions_path(@app)) }\n # format.html { redirect_to(app_versions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @newapp = Newapp.find(params[:id])\n @newapp.destroy\n\n respond_to do |format|\n format.html { redirect_to newapps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @capp = Capp.find(params[:id])\n @capp.destroy\n\n respond_to do |format|\n format.html { redirect_to(capps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @parent_app.destroy\n respond_to do |format|\n format.html { redirect_to parent_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @papp = Rapns::Apns::App.find(params[:id])\n @papp.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @helocapp = Helocapp.find(params[:id])\n @helocapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocapps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @registered_app.destroy\n respond_to do |format|\n format.html { redirect_to registered_apps_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 delete(*rest) end", "def delete_appdata\n @restv9.delete_appdata(person_id, appId, field)\n end", "def destroy\n @app_instance.destroy\n respond_to do |format|\n format.html { redirect_to app_instances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dev = @app.developers.first.id\n @app.destroy\n respond_to do |format|\n format.html { redirect_to developer_path(@dev), notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n \n if params[:app_delete_cancel]\n redirect_to apps_url\n return\n end\n\n respond_to do |format|\n if @app.destroy\n format.html do\n flash[:notice] = \"App '#{@app}' successfully deleted\"\n redirect_to apps_url\n end\n format.xml { head :ok }\n else\n format.html { render :action => 'delete' }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\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\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(app_configs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @appsoft = Appsoft.find(params[:id])\n @appsoft.destroy\n\n respond_to do |format|\n format.html { redirect_to(appsofts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @memberapp = Memberapp.find(params[:id])\n @memberapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(memberapps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to app_configs_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @todo_app.destroy\n respond_to do |format|\n format.html { redirect_to todo_apps_url, notice: 'Todo app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_request.destroy\n respond_to do |format|\n format.html { redirect_to app_requests_url, notice: 'App request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @calmapp = Calmapp.find(params[:id])\n @calmapp.destroy\n tflash('delete', :success, {:model=>@@model, :count=>1})\n respond_to do |format|\n tflash('delete', :success, {:model=>@@model, :count=>1})\n format.html { redirect_to(calmapps_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @applist.destroy\n respond_to do |format|\n format.html { redirect_to applists_url, notice: 'Applist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_array_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/arrays/#{args[:arrayId]}\", args)\nend", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @clip_app = ClipApp.find(params[:id])\n @clip_app.destroy\n\n respond_to do |format|\n format.html { redirect_to(clip_apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @version.destroy\n respond_to do |format|\n format.html { redirect_to user_app_path(@user, @app), notice: 'Version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cotiz_app.destroy\n respond_to do |format|\n format.html { redirect_to cotiz_apps_url, notice: 'Cotiz app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @apparel = Apparel.find(params[:id])\n @apparel.destroy\n\n respond_to do |format|\n format.html { redirect_to(apparels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @wine_app.destroy\n respond_to do |format|\n format.html { redirect_to wine_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_server.destroy\n respond_to do |format|\n format.html { redirect_to app_servers_url, notice: 'App server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alapp.destroy\n respond_to do |format|\n format.html { redirect_to alapps_url, notice: 'Alapp was successfully destroyed.' }\n format.json { head :no_content }\n end\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 #@jobapp = Jobapp.find(params[:id])\n @jobapp.destroy\n\n respond_to do |format|\n format.html { redirect_to jobapps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @phone_app.destroy\n respond_to do |format|\n format.html { redirect_to phone_apps_url, notice: 'Phone app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @payment_app.destroy\n respond_to do |format|\n format.html { redirect_to payment_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @web_app = WebApp.find(params[:id])\n @web_app.destroy\n\n respond_to do |format|\n format.html { redirect_to web_apps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @appdatum.destroy\n respond_to do |format|\n format.html { redirect_to appdata_url, notice: 'Appdatum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n ELASTIC_SEARCH_CLIENT.delete index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id\n @mobile_app.destroy!\n respond_to do |format|\n format.html { redirect_to admin_mobile_apps_url, notice: 'Mobile Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile_app.destroy\n respond_to do |format|\n format.html { redirect_to mobile_apps_url, notice: 'Mobile app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manage_app_version.destroy\n respond_to do |format|\n format.html { redirect_to manage_app_versions_url, notice: 'App version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\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 api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @application = Application.find(params[:id])\n return unless appAccess?(@application.job.id)\n id = @application.job.id\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to show_apps_path(:id=>id) }\n format.json { head :no_content }\n end\n end" ]
[ "0.73132116", "0.73132116", "0.71195567", "0.71092236", "0.70344305", "0.70344305", "0.70344305", "0.6928899", "0.6928899", "0.6919953", "0.6919953", "0.6919953", "0.6907732", "0.6769033", "0.67417604", "0.67132974", "0.67062855", "0.67062855", "0.67062855", "0.67062855", "0.67015874", "0.6696983", "0.6680326", "0.6669058", "0.6652273", "0.6650619", "0.6627733", "0.6624085", "0.66127115", "0.660715", "0.6578624", "0.656139", "0.65592587", "0.6541938", "0.6535001", "0.65340835", "0.6520973", "0.6488989", "0.64827985", "0.64493394", "0.64247024", "0.64191777", "0.6419137", "0.6403381", "0.6402468", "0.64006644", "0.63998836", "0.6399692", "0.6387305", "0.6385981", "0.6383527", "0.6376784", "0.6336754", "0.6336754", "0.6336754", "0.6336754", "0.6325368", "0.6312604", "0.6295533", "0.6291488", "0.62850386", "0.6283884", "0.6260065", "0.62577504", "0.6255721", "0.62343925", "0.62227464", "0.62196535", "0.62169045", "0.6206246", "0.61997604", "0.61983156", "0.6194056", "0.61739606", "0.6173477", "0.617", "0.61646855", "0.6155452", "0.6155452", "0.61493206", "0.61373675", "0.6135007", "0.612809", "0.61222935", "0.6120633", "0.61146164", "0.6112391", "0.6110893", "0.6098905", "0.6085007", "0.6084768", "0.60815126", "0.607695", "0.6069517", "0.60672265", "0.6064517", "0.60597134", "0.6059248", "0.60583574", "0.6056456" ]
0.70474726
4
POST /apps/exists.xml POST /apps/exists.json
def exists @record = Record.new app = App.find_by_packageName(params[:packageName], :select => :id) if app.nil? @record.exists = false else @record.id = app.id @record.exists = true end respond_to do |format| format.xml {render :xml => @record} format.json {render :json => @record} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?\n json['exists']\n end", "def has_app_action\n validate :uuid, /^[a-zA-Z0-9]+$/\n validate :application, /^[a-zA-Z0-9]+$/\n uuid = request[:uuid]\n app_name = request[:application]\n if File.exist?(\"/var/lib/openshift/#{uuid}/#{app_name}\")\n reply[:output] = true\n else\n reply[:output] = false\n end\n reply[:exitcode] = 0\n end", "def check_exists_published\n filename = params[\"file\"] + \".xml\"\n if !valid_filename(filename, nil)\n Rails.logger.warn(\"check_exists_published: Invalid filename received (#{filename})\")\n render :json => {error: \"Invalid filename\"}, status: 400\n return\n end\n\n full_filename = ENV[\"EAD_XML_FILES_PATH\"] + \"/\" + filename\n exist = File.exist?(full_filename)\n render :json => {exist: exist}\n end", "def create\n # Receives a Facebook username and a list of Android package names.\n # The list of package names are delimited by newlines.\n \n @user = User.find_for_facebook_token(params[:token].strip)\n\n # List will be delimited by newlines\n packages_list = params[:apps].strip.split(\"\\n\")\n\n # Packages that were successfully associated created with user\n @apps = []\n @user_apps = []\n packages_list.each do |package_name|\n app = App.find(:first, :conditions => [ \"app_id = ?\", package_name ])\n valid_app = !app.nil?\n\n # If app doesn't exist on our system, add it\n if app.nil?\n app = App.new({ app_id: package_name })\n valid_app = app.save\n end\n\n if valid_app\n user_app = UserApp.where(:user_id => @user.id, :app_id => app.id)\n if user_app.size == 0\n user_app = UserApp.new({ user_id: @user.id, app_id: \n app.id, installed: true })\n else\n user_app = user_app[0]\n user_app.installed = true\n end\n if user_app.save\n @apps << app\n @user_apps << user_app\n end\n end\n end\n\n respond_to do |format|\n format.html { redirect_to user_apps_url }\n format.json { render json: { user: @user, apps: @apps }, \n status: :created }\n end\n end", "def check_exists\n filename = params[\"file\"]\n if !valid_filename(filename, nil)\n Rails.logger.warn(\"check_exists: Invalid filename received (#{filename})\")\n render :json => {error: \"Invalid filename\"}, status: 400\n return\n end\n\n full_filename = ENV[\"EAD_XML_PENDING_FILES_PATH\"] + \"/\" + filename\n exist = File.exist?(full_filename)\n render :json => {exist: exist}\n end", "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def create(name=nil, options={})\n\t\toptions[:name] = name if name\n\t\txml(post('/apps', :app => options)).elements[\"//app/name\"].text\n\tend", "def create\n @app = App.new(app_params)\n @app.count = 0\n @app.uid = SecureRandom.uuid\n respond_to do |format|\n if @app.save\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def check_if_deployment_exists\n @api.account_id = @options[:src]\n @old_deployment = @api.deployments(:id => @options[:deployment], :view => \"inputs_2_0\").show\n\n @api.account_id = @options[:dst]\n if @api.deployments.index(:filter => [\"name==#{@old_deployment.name}\"]).length != 0\n $stderr.puts \"ERROR: Deployment with name \\\"#{@old_deployment.name}\\\" already exists in account #{@options[:dst]}\\n\"\n exit 1\n end\nend", "def check_device_exists\n render json: { error: 'device not found' }, status: :internal_server_error unless Device.exists?(params[:device_id])\n end", "def create(name=nil, options={})\n\t\tparams = {}\n\t\tparams['app[name]'] = name if name\n\t\txml(post('/apps', params)).elements[\"//app/name\"].text\n\tend", "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end", "def exists(key)\n\n # FIXME: insert code that connects to the backend and affects the exists\n # operation\n #\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => nil, :err_msg => 'FIXME: not implemented' }\n end", "def event_app_not_found\n render json: 'Unregistered application', status: :unprocessable_entity\n end", "def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end", "def create\n @registered_app = RegisteredApp.new(registered_app_params)\n\n respond_to do |format|\n if @registered_app.save\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @registered_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def has_embedded_app_action\n validate :uuid, /^[a-zA-Z0-9]+$/\n validate :embedded_type, /^.+$/\n uuid = request[:uuid]\n embedded_type = request[:embedded_type]\n if File.exist?(\"/var/lib/openshift/#{uuid}/#{embedded_type}\")\n reply[:output] = true\n else\n reply[:output] = false\n end\n reply[:exitcode] = 0\n end", "def exist?\n request(:get)\n true\n rescue Stretcher::RequestError::NotFound\n false\n end", "def exists!\n @exists = true\n end", "def exists\n @record = Record.new\n visual = Visual.find_by_app_id_and_image_file_name(params[:app_id], params[:filename], :select => :id)\n \n if visual.nil?\n @record.exists = false\n else\n @record.id = visual.id\n @record.exists = true\n end\n\n respond_to do |format|\n format.xml {render :xml => @record}\n format.json {render :json => @record} \n end\n end", "def create \n\t \t\tif (AppSub.exists?(:sub_name => sub_params[:sub_name],:app_name => sub_params[:app_name]))\n render json: '{\"message\": \"app in this sub already exists\"}'\n else\n @appsubs = AppSub.new(sub_params)\n @appsubs.app_id=(App.find_by app_name: sub_params[:app_name]).id;\n @appsubs.sub_id=(Sub.find_by sub_name: sub_params[:sub_name]).id;\n if @appsubs.save\n render json: @appsubs\n\t\t\t else\n\t\t\t render json: @appsubs.errors, status: :unprocessable_entity\n\t\t\t end\n end \n\t\t end", "def resource_exists?\n ciudades\n end", "def create\n manifest = JSON.parse(params[:manifest])\n manifest['provider'] = params[:provider]\n puts \"Repository type: #{params[:repository_type]}\"\n @client.app_create(params[:id], params[:repository_type])\n @client.app_add_manifest(params[:id], manifest)\n\n respond_to do |format|\n format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n #if @client.app_create(params[:id], manifest)\n # format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n # # FIXME format.json { render json: @app, status: :created, location: app_path(params[:id]) } \n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @app.errors, status: :unprocessable_entity } # FIXME\n #end\n end\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n @application.status = Application.where(nursery_id: @application.nursery_id, date: @application.date, status: :appointed).count < @application.nursery.capacity ? :appointed : :waiting\n @application.save\n render :show, status: :created, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end", "def exists?\n if resource[:force] == true\n false\n else\n package = client(resource).package(resource[:group], resource[:name], resource[:version])\n package.is_installed.data\n end\n end", "def ensure_app_exists!\n return if app\n UI.user_error!(\"Could not find app with App Identifier '#{Precheck.config[:app_identifier]}'\")\n end", "def status\n\t\tbody = {\n\t\t\t'developerId' => $developer_id,\n\t\t\t'status' => params[:status]\n\t\t}\n\n\t\turl = URI.parse($base_url + '/v2/apps/' + params[:appId] + '/status')\n\t\thttp = Net::HTTP.new(url.host, url.port)\n\t\thttp.use_ssl = true\n\n\t\treq = Net::HTTP::Post.new(url.to_s, initheader = {'Content-Type' => 'application/json', 'Authorization' => $auth})\n\t\treq.body = ActiveSupport::JSON.encode(body)\n\t\tres = Net::HTTP.start(url.host, url.port) { |https|\n\t\t\thttp.request(req)\n\t\t}\n\t\t\n\t\tres = ActiveSupport::JSON.decode(res.body)\n\n\t\t# If error is retrieved, display error message and return\n\t\tif res['code'] != nil\n\t\t\tsession[:toast_type] = 'error'\n\t\t\tsession[:toast_message] = res['errors'][0]['message']\n\t\t\tredirect_to '/app/list'\n\t\t\treturn\n\t\tend\n\n\t\t# Display success message\n\t\tsession[:toast_type] = 'status'\n\t\tsession[:toast_message] = 'App ' + params[:status] + 'ed successfully'\n\tend", "def exists?\n true\n end", "def exists?\n false\n end", "def exists?\n false\n end", "def service_with_id_exists?(app, id)\n app = getTableValue(app)\n id = getTableValue(id)\n json = CC.CLI.get_json(\"%{serviced} service list -v\")\n json.each do |service|\n return true if service[\"Name\"] == app && service[\"DeploymentID\"] == id\n end\n return false\n end", "def exist?\n @resource.exist?\n end", "def has_app_info? itemdata\n itemdata.is_a?(Hash) && itemdata['docid']\n end", "def register_application(app_name, namespace, public_hostname)\n # curl -X POST https://dnsapi.cn/Record.Create -d 'login_email=api@dnspod.com&login_password=password&format=json&domain_id=2317346&sub_domain=@&record_type=A&record_line=默认&value=1.1.1.1'\n\n # create an A record for the application in the domain\n hostname = \"#{app_name}-#{namespace}\"\n url = \"https://dnsapi.cn/Record.Create\"\n params = common_params.merge({\n :domain_id => @domain_id,\n :sub_domain => hostname,\n :record_type => 'A',\n :record_line => '默认',\n :value => public_hostname\n })\n\n res = @http.post(url, params)\n res = JSON.parse(res.content)\n puts res\n\n result = JSON.parse(response.body)\n result.status['message']\n #{\n # \"status\": {\n # \"code\":\"1\",\n # \"message\":\"Action completed successful\",\n # \"created_at\":\"2012-11-23 22:17:47\"\n #},\n # \"record\": {\n # \"id\":\"16894439\",\n # \"name\":\"@\",\n # \"status\":\"enable\"\n #}\n #}\n\n end", "def does_title_exist(title_no)\n\n response = rest_get_call($SYSTEM_OF_RECORD_API_DOMAIN + '/titles/' + title_no)\n\n if (response.code == '404') then\n return false\n else\n return true\n end\n\nend", "def exists_bulk_method(states = [nil, :found])\n prepare_environment\n @item = @resource_type.new(@client, @data)\n return true if empty_data_check(states)\n @property_hash[:ensure] == :present\nend", "def exists?\n begin \n CouchDB.get uri\n true\n rescue\n false\n end \n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to app_activities_path(@app) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def exists?(app_name)\n File.exists? File.join(path, app_name)\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def exist?\n true\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def exists?\n begin \n CouchSpring.get uri\n true\n rescue\n false\n end \n end", "def check_app!(user)\n if !user['app_ids'].include?(@app['_id']) && @app['app_type'] == Apps::OPEN_APP\n UsersManager.update(user, {\n 'app_ids' => user['app_ids'] + [ @app['_id'] ]\n })\n end\n\n unless user['app_ids'].include?(@app['_id'])\n raise Uasthree::UserAppNoMatchError.new(params[:username], params[:app_uname])\n end\n end", "def exists_on_server?\n false\n end", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def exists?\n request :head\n true\n rescue Stretcher::RequestError::NotFound\n false\n end", "def exists\n @record = Record.new\n comment = Comment.find_by_app_id_and_authorId(params[:app_id], params[:authorId], :select => :id)\n\n if comment.nil?\n @record.exists = false\n else\n @record.id = comment.id\n @record.exists = true\n end\n\n respond_to do |format|\n format.xml {render :xml => @record}\n format.json {render :json => @record} \n end\n end", "def exist\n\treturn true\n end", "def exists?\n begin\n url_for(:resources_resource, credentials, id).head\n true\n rescue RestClient::Forbidden\n true\n rescue RestClient::ResourceNotFound\n false\n end\n end", "def create\n authorize! :create, @app\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:id])\n\n if @app.update(app_params)\n head :no_content\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def exists?\n name_exists? ? exact_deployment? : false\n end", "def on_exists_proc; end", "def show\n\t\t\t if (AppSub.exists?(params[:id]))\n @appsubs = AppSub.find(params[:id])\n \t\t\t render json: @appsubs\n else\n redirect_to :action => 'index'\n end \n end", "def check_entity_existence(entity)\n exists = entity.exists?(params[:id])\n\n if !exists\n return render :json => {\n errors: \"#{entity.name} not found\"\n }, status: 404\n end\n end", "def exists?\n data != {}\n end", "def exists\n\t\tres = {}\n\t\tif User.find_by_token(params[:token])\n\t\t\tres[:status] = \"1\"\n\t\telse\n\t\t\tres[:status] = \"0\"\n\t\tend\n\t\trender json: res\n\tend", "def create\n\t\tbegin\n\t\t\tActiveRecord::Base.transaction do\n\t\t\t\t@application = Application.create!(name: params[:name])\n end\n rescue => e #ActiveRecord::RecordNotUnique\n p e.message\n p e.backtrace\n\t\t\tActiveRecord::Rollback\n\t\t\trender plain: e.message, status: :unprocessable_entity and return\n end\n render json:\" Application created with token = #{@application.token}\", status: :created\n end", "def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def check_availability(business = {})\n xml = Builder::XmlMarkup.new\n query = xml.tag!(\"BPMSPost\", 'Edition' => \"1.1\") {\n xml.tag!(\"Record\") {\n xml.tag!(\"Bowser Autio\", business[:name])\n xml.tag!(\"Autio\", business[:department])\n xml.tag!(\"6675 rivertown rd\", business[:address])\n xml.tag!(\"Fairburn\", business[:city])\n xml.tag!(\"GA\", business[:state])\n xml.tag!(\"30213\", business[:zip])\n xml.tag!(\"7708460972\", business[:phone])\n }\n }\n body = build_request(3722, 1510, query)\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n xml_doc['ErrorCode'] == '1' # success (returns true/false)\n end", "def name_exists?\n ensure_data_loaded\n return false unless @exist\n unless @data['name'].nil?\n Puppet.debug \"Deployment found: #{@resource[:name]}\"\n return true\n end\n Puppet.debug \"No deployment matching #{@resource[:name]} found.\"\n false\n end", "def existing_item\n item = Item.find_by(name: params[:name])\n if item.present?\n render json: {status: 'SUCCESS', message: 'item already exists',data: item},status: :ok\n else\n render json: {status: 'FAILURE', message: 'item does not exists'},status: :ok\n end\n end", "def check_exists\n @unscraped = Unscraped.check_exists(unscraped_params)\n\n if @unscraped\n respond_to do |format|\n format.html { redirect_to @unscraped }\n #format.json { render json: @unscraped }\n format.json { render :show, location: @unscraped }\n end\n else\n respond_to do |format|\n format.html { render :nothing => true, :status => 200, :content_type => 'text/html' }\n format.json { render json: {}, :status => 200, :content_type => 'application/json' }\n end\n end\n end", "def ci_exists?(id)\n p __method__ if @debug == true\n xml = RestClient.get \"#{@base_url}/exists/#{id}\", {:accept => :xml, :content_type => :xml }\n return true if XmlSimple.xml_in(xml) == \"true\"\n return false\n end", "def list_exists(url, directory)\n unless File.file?(directory + 'list.json')\n update_list(url, directory)\n end\nend", "def valid_apps\n apps.select { |app| app.valid? }\n end", "def exist?\n @exists\n end", "def destroy\n @registered_app.destroy\n respond_to do |format|\n format.html { redirect_to registered_apps_url }\n format.json { head :no_content }\n end\n end", "def create\n megam_rest.post_appdefn(to_hash)\n end", "def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def create\n if params[:create] == 'existing'\n @app = App.new(app_params)\n origin = @apps.find(params[:origin])\n\n @app.runtime = origin.runtime.dup\n @app.android_config = origin.android_config.dup\n @app.ios_config = origin.ios_config.dup\n @app.android_icon = origin.android_icon.dup\n @app.ios_icon = origin.ios_icon.dup\n\n @app.splash = origin.splash.dup\n\n @app.android_config['origin'] = origin.id\n @app.ios_config['origin'] = origin.id\n @app.android_config.delete('bundle_id')\n @app.ios_config.delete('bundle_id')\n\n @app.duplicate_files(origin)\n else\n @app = App.new(app_params)\n end\n\n @app.user = current_user\n\n if @app.save\n if origin\n origin.assets.each do |item|\n asset = Asset.new\n asset.app_id = @app.id\n asset.slug = item.slug\n asset.duplicate_file(item)\n asset.save!\n end\n end\n end\n\n respond_modal_with @app, location: @app\n end", "def exists? force: false\n return resource_exists? if force\n # If we have a value, return it\n return @exists unless @exists.nil?\n # Always true if we have a gapi_json object\n return true if resource?\n resource_exists?\n end", "def exists?\n conf.has_key? 'api'\n end", "def create\n @app_user = AppUser.new(app_user_params)\n all = AppUser.all.map{|m|m.user_name}\n if all.include?params[\"app_user\"][\"user_name\"]\n redirect_to :back,:alert => \"User Already Exists Can't Create Duplicate User\" \n else\n respond_to do |format|\n if @app_user.save\n format.html { redirect_to @app_user, notice: 'App user was successfully created.' }\n format.json { render :show, status: :created, location: @app_user }\n else\n format.html { render :new }\n format.json { render json: @app_user.errors, status: :unprocessable_entity }\n end \n end\n end\n end", "def object_exists(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'ObjectExist')\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def oauth_applications_exists?\n ActiveRecord::Base.connection.table_exists? :oauth_applications\n end", "def metadata_any_app_get(name)\n app = node.apps.detect {|a| a.metadata?(name) } and app.metadata?(name)\n end", "def pending?\n response = rpc(action: :pending_exists, param_name: :hash)\n !response.empty? && response[:exists] == '1'\n end", "def create\n @app = App.new(params[:app])\n @app.rating = Rating.new(params[:rating])\n \n respond_to do |format|\n if @app.save\n format.xml { render :xml => @app, :status => :created, :location => @app, :only => [:id]}\n format.json { render :json => @app, :status => :created, :location => @app, :only => [:id]} \n else\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n format.json { render :json => @app.errors, :status => :unprocessable_entity } \n end\n end\n end", "def test_duplicate_user\n data = { 'email' => 'ace@base.se', 'password' => 'open1234' }\n post '/users', data.to_json\n assert last_response.status.eql?(400)\n json_data = JSON last_response.body\n assert json_data['errors'].present?\n end", "def created?\n @data[:status_code] == '201'\n end", "def exists?\n @exists == true\n end", "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_or_create_app(app_name)\n create_app(app_name)\n rescue\n @heroku.app.info(app_name)\n end", "def create\n @app_status = AppStatus.new(app_status_params)\n\n respond_to do |format|\n if @app_status.save\n format.html { redirect_to @app_status, notice: 'App status was successfully created.' }\n format.json { render :show, status: :created, location: @app_status }\n else\n format.html { render :new }\n format.json { render json: @app_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #app_params.permit!\n #@app=App.find(params[:app_id])\n @service_in_app = @app.service_in_apps.build(serv_in_params)\n\n respond_to do |format|\n if @service_in_app.save\n format.html { redirect_to app_url(@service_in_app.app_id), :notice => 'App Service was successfully created.' }\n format.js { render :action => 'mesapps', :status => :created, :location => @user }\n else\n format.html { render :action => 'new' }\n format.js { render :action => @service_in_app.errors, :status => :unprocessable_entity }\n end\n end\n\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n session[:current_api_token] = @app.api_token\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { \n @apps = App.all\n render action: \"index\" \n }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def exists?\n return false if resource[:force].eql? true\n\n authorizable_keystore = client(resource).authorizable_keystore(resource[:intermediate_path], resource[:authorizable_id])\n result = authorizable_keystore.exists\n\n result.data\n end", "def update(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def exists\n @client.call(self.class, __callee__.to_s, @call_params)\n end" ]
[ "0.6413426", "0.6083834", "0.57530457", "0.5716068", "0.55992895", "0.5566655", "0.5526369", "0.55217683", "0.5510037", "0.549786", "0.5477157", "0.5470329", "0.5452816", "0.544372", "0.54398584", "0.543484", "0.5399404", "0.5377472", "0.53333384", "0.5328893", "0.53184444", "0.5315571", "0.5279937", "0.52677214", "0.5239484", "0.523738", "0.52310526", "0.5230216", "0.5225043", "0.52220225", "0.52220225", "0.5205438", "0.5194876", "0.5192376", "0.5180676", "0.5155024", "0.5154491", "0.51479346", "0.51426977", "0.5135538", "0.5131611", "0.5131611", "0.51240706", "0.5123772", "0.5122017", "0.51155484", "0.5115255", "0.5115255", "0.5110011", "0.5104427", "0.510411", "0.50913364", "0.50913364", "0.50853366", "0.5071028", "0.50665575", "0.506429", "0.506211", "0.5060974", "0.50321305", "0.5031027", "0.50269634", "0.5025803", "0.50128", "0.50006384", "0.50001156", "0.4999975", "0.49932492", "0.4986626", "0.49863023", "0.49802914", "0.49758005", "0.49691695", "0.49662364", "0.49613833", "0.4957429", "0.49524596", "0.4950725", "0.49440527", "0.49428368", "0.49426967", "0.49406323", "0.49403426", "0.49394462", "0.49379957", "0.49324077", "0.49317694", "0.49298367", "0.49149317", "0.4913544", "0.4912889", "0.4904519", "0.490391", "0.48997903", "0.48980162", "0.4896104", "0.48874238", "0.48868218", "0.48859084", "0.48859084" ]
0.68885815
0
URI representing the type of packaging used for the original deposit represented by this record, such as CDR METS or BagIt.
def deposit_package_type 'https://sagepub.com' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deposit_package_subtype\n 'https://jats.nlm.nih.gov/publishing/'\n end", "def deposit_package_type\n 'http://proquest.com'\n end", "def location_string(type, id, version=nil)\n link = Conf.base_uri\n case type.downcase\n when \"workflow\"; link += \"/workflows/\"\n when \"blob\"; link += \"/files/\"\n when \"pack\"; link += \"/packs/\"\n else; return( link += \"/home\" )\n end\n \n link += id.to_s\n link += \"?version=#{version}\" if version\n \n return link\n end", "def full_type\n type_and_version.join(\"/\")\n end", "def type_url\n query_root_node(\"rdf:type/@rdf:resource\", @@NAMESPACES).to_s\n end", "def deposit_package_subtype\n 'ProQuest'\n end", "def item_type_as_uri\n code = ITEM_TYPE_TO_URI_CODE.fetch(type.name.to_sym)\n CONTROLLED_VOCABULARIES[:item_type].send(code)\n end", "def schema_org_type_url\n if format.kind_of? String\n \"http://schema.org/#{format}\"\n elsif mapped = @@format_to_schema_org[format]\n \"http://schema.org/#{mapped}\"\n else\n nil\n end\n end", "def item_type_as_uri\n code = ITEM_TYPE_TO_URI_CODE.fetch(type.name.to_sym)\n ControlledVocabulary.era.item_type.from_value(code)\n end", "def rdf_type_uri\n JERMVocab[rdf_type_entity_fragment]\n end", "def manifest_name(name, pack_type)\n name.chomp(\".#{pack_type}\")\n end", "def get_mirror_uri(id, type)\n # The path changes between what's in the catalog RDF and the mirror structure so it needs patching.\n # Note that mobi format is the same as kindle (their naming convention changed on miror)\n base = 'gutenberg.pglaf.org/cache/epub/'\n uri = base + id.to_s + '/'\n case type\n when /kindle.images/\n uri += \"pg#{id}-images.mobi\"\n when /kindle.noimages/\n uri += \"pg#{id}.mobi\"\n when /.txt/\n uri += \"pg#{id}.txt.utf8\"\n when /epub.images/\n uri += \"pg#{id}-images.epub\"\n when /epub.noimages/\n uri += \"pg#{id}.epub\"\n end\n\n # A return is unneeded since it is implied, but let's be explicit\n return uri\nend", "def to_uri\n build_uri\n end", "def url_type\n content_type.gsub(\"/\", \"_\")\n end", "def to_addressable_uri\n @uri\n end", "def full_uri\n\n return nil unless self.uri\n self.uri.index('/') ? self.uri : \"/defs/#{self.uri}\"\n end", "def base_uri\n attributes.fetch(:baseUri)\n end", "def package_link\n @attributes[:package_link]\n end", "def download_uri\n @attributes[:download_uri]\n end", "def download_uri\n @attributes[:download_uri]\n end", "def itemscope_itemtype\n url_from_map = blacklight_config[:itemscope][:itemtypes][@document['genre_ssim']]\n if url_from_map.nil?\n 'http://schema.org/CreativeWork'\n else\n url_from_map\n end\n end", "def to_s\n uri\n end", "def blob_in_package_ref_url\n return @children['blob-in-package-ref-url'][:value]\n end", "def uri\n\t\turi = self.directory.uri\n\t\turi.dn = self.dn\n\t\treturn uri\n\tend", "def export_url_for(export_type, uuid)\n \"#{@url}/exports/#{export_type}/#{uuid}\"\n end", "def dmg_package_source\n if %i(direct repo).include?(new_resource.source)\n return package_metadata[:url]\n end\n path = new_resource.source.to_s\n (path.start_with?('/') ? 'file://' : '') + path\n end", "def publishing_format\n :rdf\n end", "def uri\n attributes.fetch(:uri)\n end", "def uri\n attributes.fetch(:uri)\n end", "def direct_uri\n container_parent = container.parent_item\n return unless container_parent\n\n return if respond_to?(:archive_file) && archive_file&.include?('/')\n\n parent_id = container_parent.secondary_key || container_parent.id\n\n enc_path_parts = []\n enc_path_parts << archive_file if respond_to?(:archive_file) && archive_file.present?\n enc_path_parts << path if path.present?\n enc_path_parts << file_name\n enc_path = enc_path_parts.join('/')\n\n enc_path = URI::Parser.new.escape(enc_path)\n\n \"/nfs_store/downloads/in/#{container_parent.resource_item_name}/#{parent_id}/#{enc_path}\"\n end", "def zip_url\n @zip_url ||= Addressable::URI.new(\n :scheme => theme.scheme,\n :host => \"codeload.#{theme.host}\",\n :path => [theme.owner, theme.name, \"zip\", theme.git_ref].join(\"/\")\n ).normalize\n end", "def type_url\n connection.type_url(index_name_with_prefix, type_name)\n end", "def to_uri\n date_as_uri_or_empty_if_nil\n end", "def package_name\n @package_name ||=\n Pathname(\"#{cartage.final_name}.tar#{cartage.tar_compression_extension}\")\n end", "def type_to_uri(type)\n case type\n when ::RDF::URI\n type\n when String\n ::RDF::URI(type)\n else\n fail ArgumentError, 'Invalid file type. You must submit a URI or a symbol.'\n end\n end", "def uri\n @uri.to_s\n end", "def export(export_type)\n bio_reference.format(EXPORT_TYPES[export_type][:format])\n end", "def to_s\n @uri\n end", "def legacy_uri_for_content_blob(dataset)\n openbis_endpoint = dataset.openbis_endpoint\n \"openbis:#{openbis_endpoint.id}:dataset:#{dataset.perm_id}\"\n end", "def uri\n File.join(self.scope, self.to_param)\n end", "def uri\n uri_prefix + Digest::MD5.hexdigest(self.address)\n end", "def uri\n self + \"\"\n end", "def uri\n self + \"\"\n end", "def file_uri_scheme; end", "def uri\n\t\t# :scheme,\n\t\t# :host, :port,\n\t\t# :dn,\n\t\t# :attributes,\n\t\t# :scope,\n\t\t# :filter,\n\t\t# :extensions,\n\t\turi = self.branch.uri\n\t\turi.attributes = self.select.join(',')\n\t\turi.scope = SCOPE_NAME[ self.scope ]\n\t\turi.filter = self.filter_string\n\t\t# :TODO: Add extensions? Support extensions in Branchset?\n\n\t\treturn uri\n\tend", "def rel_type\n getType().name()\n end", "def package_download_url\n package_filename_url_safe = Info.release_version.gsub(\"+\", \"%2B\")\n \"https://#{Info.release_bucket}.#{Info.release_bucket_s3_endpoint}/ubuntu-focal/#{Info.package}_#{package_filename_url_safe}_amd64.deb\"\n end", "def retrieve_download_url(revision, type)\n # Download from export links as document\n download_url = revision['exportLinks'][DOCUMENT_LINK] if\n type == DOCUMENT\n # Otherwise download from export links as spreadsheet\n download_url = revision['exportLinks'][SHEETS_LINK] if\n type == SPREADSHEET\n # Otherwise download from export links as presentation\n download_url = revision['exportLinks'][PRES_LINK] if\n type == PRESENTATION\n download_url\n end", "def zip_url; end", "def itemtype\n format = self[:format_main_ssim] || []\n genre = self[:genre_ssim] || []\n case\n when genre.include?('Thesis/Dissertation')\n 'http://schema.org/Thesis'\n when genre.include?('Video games')\n 'http://schema.org/VideoGame'\n when format.include?('Equipment')\n 'http://schema.org/Thing'\n when format.include?('Book')\n 'http://schema.org/Book'\n when format.include?('Dataset')\n 'http://schema.org/Dataset'\n when format.include?('Image')\n 'http://schema.org/ImageObject'\n when format.include?('Journal/Periodical')\n 'http://schema.org/Periodical'\n when format.include?('Map')\n 'http://schema.org/Map'\n when format.include?('Music recording')\n 'http://schema.org/MusicRecording'\n when format.include?('Newspaper')\n 'http://bib.schema.org/Newspaper'\n when format.include?('Software/Multimedia')\n 'http://schema.org/SoftwareApplication'\n when format.include?('Sound recording')\n 'http://schema.org/AudioObject'\n when format.include?('Video')\n 'http://schema.org/VideoObject'\n else\n 'http://schema.org/CreativeWork'\n end\n end", "def remote_path_for(package)\n File.join(\n Config.artifactory_base_path,\n Config.artifactory_publish_pattern % package.metadata\n )\n end", "def to_uri\n URI(normalise)\n end", "def uri\n database.uri + '/_design/' + name\n end", "def get_package_link(params, mode=:edit)\n hardcoded_string = \"#{APP_CONFIG['site_prefix']}tasks/#{escape_url(self.task.name)}/packages/#{escape_url(self.name)}\"\n\n if mode == :create\n hardcoded_string\n elsif params[:request_path].blank?\n hardcoded_string\n else\n params[:request_path]\n end\n end", "def schema_ref\n base = @xbrl_content[\"schemaRef\"][0][\"xml:base\"]\n href = @xbrl_content[\"schemaRef\"][0][\"xlink:href\"]\n return base + href if base\n href\n end", "def outer_url\r\n \"http://#{HOST_DOMAIN}/debates/#{self.id}\"\r\n end", "def directory_uri\n template = Addressable::Template.new(\n \"https://{host}/discovery/v1/apis\"\n )\n return template.expand({\"host\" => self.host})\n end", "def kind\n @purchase.kind\n end", "def asset_type\n return self.class.to_s.gsub(/^.*::/,'').gsub(/AssetSet/,'').gsub(/([^^])([A-Z])/,'$1_$2').downcase.to_sym\n end", "def genURI(c_type)\n if c_type == 'BTC'\n c_uri = '/v1/ticker/bitcoin'\n elsif c_type == 'LTC'\n c_uri = '/v1/ticker/litecoin'\n elsif c_type == 'ETH'\n c_uri = '/v1/ticker/ethereum'\n elsif c_type == 'XRP'\n c_uri = '/v1/ticker/ripple'\n else\n c_uri = '/v1/ticker/notsupported'\n end\n return c_uri\nend", "def derivative_url_target\n if file_set.try(:file_set_id)\n file_set.file_set_id.to_s\n else\n file_set\n end\n end", "def package_name\n name = package_drop_last(slug_parts)\n name.empty? ? '_root_' : name\n end", "def to_resource_declaration(type)\n if type.respond_to?(:type_name) && type.respond_to?(:title)\n title = type.title\n type_name = type.type_name\n elsif type_result = /(\\w+)\\['?(\\w+)'?\\]/.match(type.to_s)\n # not all types have a type_name and title so we\n # output to a string and parse the results\n title = type_result[2]\n type_name = type_result[1]\n else\n return type\n end\n res = scope.catalog.resource(type_name, title)\n return res.to_ral if res\n # don't return anything or returns nil if item is not in the catalog\n end", "def canonical_repository_url\n \"https://#{@settings.host}/scm/#{attributes[:repository_namespace]}/#{attributes[:repository_name]}.git\"\n end", "def to_s\n self.uri.to_s\n end", "def share_media_url\n if share_representative_derivative\n url = share_representative_derivative.url(public: true)\n\n # Make sure it's absolute not relative, for /public files instead of S3\n parsed = Addressable::URI.parse(url)\n if parsed.relative?\n url = Addressable::URI.parse(main_app.root_url).join(parsed).to_s\n end\n\n url\n elsif work.is_oral_history?\n # if no representative, give em the generic OH thumb\n asset_url(\"scihist_oral_histories_thumb.jpg\")\n end\n end", "def type_str\n MARKETPLACEAPP_TYPES[type]\n end", "def get_uri(resource_type)\n refresh\n links.find { |link| link[:rel] == resource_type }[:uri]\n end", "def _type\n @link['type']\n end", "def uri\n @uri_parameters = {:s => @stock_symbol}\n @uri_parameters[:annual] = @annual if @annual\n super\n end", "def content_type\n self.name[/::(.*)$/, 1].underscore.gsub(/_/, '/')\n end", "def as_full\n \"#{scheme}-#{issuer}-#{release}-#{check}\"\n end", "def urn_base; \"urn:#{Settings.partition_name}:#{Settings.service.name}:#{Settings.region}\" end", "def urn_base; \"urn:#{Settings.partition_name}:#{Settings.service.name}:#{Settings.region}\" end", "def url\n deposit.ore_url.chomp('#aggregation').gsub('oremap', 'status')\n end", "def uri\n raise NotImplementedError\n end", "def to_s\n @uri\n end", "def uri\n Util.join_uri(self.class.uri, self.id)\n end", "def url\n if derivative\n derivative_url || regular_url\n elsif version\n version_url\n else\n regular_url\n end\n end", "def type_directory\n Pathname.new(puppet_lib) + 'type'\n end", "def uri\n @uri\n end", "def uri\n @uri\n end", "def export_url\n begin\n \"/instruments/#{self.id}/export/#{latest_export.try(:id)}\"\n rescue\n nil\n end\n end", "def __drburi\n @uri\n end", "def full_path\n typecast_clone.full_path\n end", "def ref_id\n URI.parse(self.archival_series_uri).path.split(\"/\").last unless self.archival_series_uri.nil?\n end", "def to_s\n uri.to_s\n end", "def archives_export_url params = {}, *_\n \"https://www.refworks.com/express/expressimport.asp?vendor=YUL&filter=RefWorks%20Tagged%20Format&encoding=65001\"+ ((\"&url=#{CGI.escape(params[:url])}\" if params[:url]) || \"\") #RIS\n end", "def uri\n uri_for({}, nil)\n end", "def to_s\n reconstruct_uri\n end", "def url\n @url ||= \"https://#{@host}/#{druid_without_prefix}.xml\"\n end", "def uri\n @uri_parameters = {:s => @stock_symbol, :annual => true}\n super\n end", "def to_s\n uri_string\n end", "def manifest_name(name, pack_type)\n return name if File.extname(name.to_s).empty?\n File.basename(name, \".#{pack_type}\")\n end", "def manifest_name(name, pack_type)\n return name if File.extname(name.to_s).empty?\n File.basename(name, \".#{pack_type}\")\n end", "def remote_path_for(package)\n File.join(\n Config.artifactory_base_path,\n package.metadata[:name],\n package.metadata[:version],\n publish_platform(package),\n publish_platform_version(package),\n package.metadata[:basename],\n )\n end", "def uri(db = database)\n \"#{db.root}/#{self['_id']}\"\n end", "def archive_download_url\n raise \"Not implemented yet!\"\n end", "def uri\n return @uri\n end", "def uri\n return @uri\n end" ]
[ "0.70184714", "0.68661696", "0.6044681", "0.59459037", "0.58869135", "0.5851393", "0.57971567", "0.577034", "0.5739009", "0.56879425", "0.5609115", "0.55804163", "0.55690694", "0.5559279", "0.55484146", "0.5535899", "0.55323404", "0.5527149", "0.5514766", "0.5514766", "0.5514629", "0.54916984", "0.5472302", "0.54607004", "0.5423538", "0.5386855", "0.5375344", "0.5367607", "0.5367607", "0.53675395", "0.5356134", "0.5352923", "0.5351933", "0.53511506", "0.53368783", "0.5329584", "0.53083956", "0.52804554", "0.52648664", "0.5261399", "0.5260304", "0.5235106", "0.5235106", "0.52159274", "0.5212937", "0.5212703", "0.52076805", "0.51957285", "0.5194149", "0.5186253", "0.5181732", "0.5181369", "0.5181189", "0.5177946", "0.5165807", "0.51654017", "0.5161924", "0.51546735", "0.51510113", "0.5148686", "0.5135928", "0.51306874", "0.5130488", "0.5127746", "0.51257503", "0.5117544", "0.5116562", "0.5116081", "0.51138765", "0.5107957", "0.5103762", "0.51013416", "0.50974554", "0.50974554", "0.5085458", "0.5080077", "0.5079328", "0.506874", "0.50686884", "0.50667566", "0.5066233", "0.5066233", "0.5065995", "0.50534", "0.503196", "0.5026598", "0.5015758", "0.50152683", "0.50120777", "0.50113606", "0.50091285", "0.5008789", "0.5007576", "0.50065756", "0.50065756", "0.50034136", "0.4996179", "0.49892914", "0.49889186", "0.49889186" ]
0.67867374
2
Subclassification of the packaging type for this deposit, such as a METS profile.
def deposit_package_subtype 'https://jats.nlm.nih.gov/publishing/' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deposit_package_subtype\n 'ProQuest'\n end", "def writeup_classification\n classification_label().split(\"-\").first\n end", "def sub_type\n @sub_type || parse_and_return(:@sub_type)\n end", "def writeup_classification\n classification_label.split(\"-\").first\n end", "def subtype\n return nil if @values[:subtype].nil?\n self.class.subtype @values[:subtype].to_sym\n end", "def rifcs_subtype\n subtype ? RIFCS_SUBTYPE[subtype[0]] : RIFCS_SUBTYPE.default\n end", "def type\n case namespace\n when /stix-\\d/, /cybox-\\d/\n :core\n when /common/\n :common\n when /vocabularies/\n :vocabularies\n when /cybox\\.mitre\\.org\\/objects#/\n :object\n when /\\.mitre\\.org\\/extensions\\//\n :extension\n when /stix\\.mitre\\.org/ # If it's STIX and not core, common, vocabs, or extensions, it's a component\n :component\n when 'http://data-marking.mitre.org/Marking-1'\n :marking\n else\n nil\n end\n end", "def subcontract_category; end", "def deposit_package_type\n 'https://sagepub.com'\n end", "def masterfile_klass\n MfProductCodeTargetMarket\n end", "def masterfile_klass\n MfProductCodeTargetMarket\n end", "def my_type(type)\n case type\n when /bond/i\n \"Bonds\"\n when /stock/i\n \"Stocks\"\n when /alternative/i\n \"Alternatives\"\n else\n \"Unclassified\"\n end\n end", "def resourceType\n 'Substance'\n end", "def deposit_package_type\n 'http://proquest.com'\n end", "def classification\n return @classification\n end", "def classification\n return @classification\n end", "def subcategory\n @manifest_options[:subcategory] || \"\"\n end", "def identifying_supertype\n ti = identifying_type_inheritance and ti.supertype\n end", "def masterfile_klass\n MfProductCode\n end", "def business_type\n if self[:business_type] == nil\n return nil\n end\n return BusinessLicense.business_types[self[:business_type]]\n end", "def is_subpart?\n case @raw_provider['organization_subpart']\n when 'yes'\n true\n when 'no'\n false\n else\n nil\n end\n end", "def subject_type(classification=nil)\n type = generates_subject_type\n config = sub_tool_config classification\n # If this task specifies an array of tools, look for tool-specific subject type:\n if config && config[:generates_subject_type]\n type = config[:generates_subject_type]\n end\n\n type\n end", "def resourceType\n 'SubstancePolymer'\n end", "def resourceType\n 'BiologicallyDerivedProduct'\n end", "def subject_type(classification=nil)\n type = generates_subject_type\n # If classification has subToolIndex and this task specifies a tools array, determine the tool-specific generates_subject_type\n if ! classification.nil? && ! (subToolIndex = classification.annotation[\"subToolIndex\"]).nil?\n type = find_tool_box(subToolIndex.to_i)[:generates_subject_type]\n end\n\n type\n end", "def subtype; end", "def container_type(product)\n if product.present?\n product.bottles? ? 'Bottles' : 'Cans'\n end\n end", "def resourceType\n 'Composition'\n end", "def supertype(node)\n type_line = node.search('span.typeLine').text.strip\n supertype = case type_line\n when /\\u2014/ then type_line.split(/\\u2014/)[0].strip\n when /\\r\\n/ then type_line.split(\"\\r\\n\")[0].strip\n else type_line.strip\n end\n end", "def supertype(node)\n type_line = node.search('span.typeLine').text.strip\n supertype = case type_line\n when /\\u2014/ then type_line.split(/\\u2014/)[0].strip\n when /\\r\\n/ then type_line.split(\"\\r\\n\")[0].strip\n else type_line.strip\n end\n end", "def type_category_string\n result = \"Manifestation\"\n result = \"Score\" if is_a_score?\n result = \"Recording\" if is_a_recording?\n result = \"Media on Demand\" if is_a_sounzmedia?\n result\n end", "def product_type_decode(type)\n return \"Workstation\" if type == 1\n\n \"Server\"\n end", "def subclass_assoc_name\n if type_name = send(self.type_attribute)\n type_name = type_name.underscore.to_sym\n subclass_types.include?(type_name) ? type_name : nil\n end\n end", "def sub_type\n has_content_type? ? header[:content_type].sub_type : nil rescue nil\n end", "def branch_type\n data['branch-type']\n end", "def org_type_label(professional_organization)\n professional_organization.org_type.capitalize\n end", "def catalog_type\n return @catalog_type\n end", "def category_produits?()\n return (self.category.code.eql?('produits_phyto')) \n end", "def caprese_type\n self.name.underscore\n end", "def final_committee_decision\n application_final_decision_type.title if application_final_decision_type\n end", "def sti_class_for(type_name)\n if store_full_sti_class && store_full_class_name\n type_name.constantize\n else\n compute_type(type_name)\n end\n rescue NameError\n raise SubclassNotFound,\n \"The single-table inheritance mechanism failed to locate the subclass: '#{type_name}'. \" \\\n \"This error is raised because the column '#{inheritance_column}' is reserved for storing the class in case of inheritance. \" \\\n \"Please rename this column if you didn't intend it to be used for storing the inheritance class \" \\\n \"or overwrite #{name}.inheritance_column to use another column for that information.\"\n end", "def packaging\n compiler && @compiler.class.packaging\n end", "def infer_specimen_class(klass=self.class)\n klass.to_s[/(\\w+?)(Specimen(Requirement)?)$/, 1] if klass\n end", "def subtype\n return unless media_type\n\n media_type.split('/').last\n end", "def cap? ; prod_type == 'cap' end", "def test_subclass_name\n bo1 = Pt::Boundary::MyA.new(\"\\n===\\n\")\n assert_equal \"Part::Boundary::MyA\", bo1.subclass_name\n assert_equal \"Boundary::MyA\", bo1.subclass_name(index_ini: 1)\n assert_equal \"MyA\", bo1.subclass_name(index_ini: 2)\n\n ss = PlainText::Part::Section::Subsection.new [\"abc\"]\n assert_equal \"Part::Section::Subsection\", ss.subclass_name\n assert_equal \"Section::Subsection\", ss.subclass_name(index_ini: 1)\n end", "def type\n # If we know for sure its a backup\n if self.p_s_b == \"B\"\n return \"Backup\"\n else\n pmr = self.pmr\n param = self.to_param\n # Otherwise, try and figure out\n case param\n when pmr.primary_param\n return \"Primary\"\n when pmr.secondary_1_param\n return \"Sec 1\"\n when pmr.secondary_2_param\n return \"Sec 2\"\n when pmr.secondary_3_param\n return \"Sec 3\"\n else\n return \"Backup\"\n end\n end\n end", "def get_symbol_using_type(type)\n case type\n when EducationOrganizationCategoryType.to_string(:STATE_EDUCATION_AGENCY); :seas\n when EducationOrganizationCategoryType.to_string(:LOCAL_EDUCATION_AGENCY); :leas\n when SchoolCategory.to_string(:ELEMENTARY); :elementary\n when SchoolCategory.to_string(:MIDDLE); :middle\n when SchoolCategory.to_string(:HIGH); :high\n end\n end", "def tool_label(classification=nil)\n config = sub_tool_config classification\n # If this task specifies an array of tools, look for tool-specific subject type:\n if config\n config[:label]\n end\n end", "def profit?\n %w(other_profit receipt).include? category\n end", "def get_base_price_tier_description\n\tcase self.base_price_tier.to_i\n\t\twhen 1\n\t\t return 'Unit' \n\t\twhen 2\n\t\t return 'Consumer Pk.'\n\t\twhen 3\n\t\t return 'Case'\n\t\twhen 4\n\t\t return 'Pallet'\n\t\tend\n\tend", "def type\n return :basic if @is_basic\n return :platinum if @is_platinum\n return :centurion if @is_centurion\n return :premium if @is_premium\n :unknown\n end", "def kind\n :piggy_bank\n end", "def asset_subtype_rule? asset_subtype\n asset_subtype_rule(asset_subtype).present?\n end", "def closud_type(part)\n if part.flex?\n :flexibles\n elsif part.user?\n :consumers\n else\n :producers\n end\n end", "def category_type\n object.category.main_cat\n end", "def type\n read_attribute(:type) || Figaro.env.meal_types.split.first\n end", "def type\n if self.institution?\n return \"Institution\"\n elsif self.funder?\n return \"Funder\"\n elsif self.organisation?\n return \"Organisation\"\n elsif self.research_institute?\n return \"Research Institute\"\n elsif self.project?\n return \"Project\"\n elsif self.school?\n return \"School\"\n end\n return \"None\"\n end", "def classification\n @line1[07]\n end", "def resourceType\n 'Provenance'\n end", "def resourceType\n 'Specimen'\n end", "def promotion_tier\n data[:promotion_tier]\n end", "def plan_type\n plan_type_config = facility.plan_type.to_s.downcase.gsub(' ', '_')\n if plan_type_config == 'payer_specific_only'\n output_plan_type = payer.plan_type.to_s if payer\n output_plan_type = 'ZZ' if output_plan_type.blank?\n else\n if eob.claim_information && !eob.claim_information.claim_type.blank?\n output_plan_type = eob.claim_information.plan_type\n elsif eob.claim_information.blank? && eob.claim_type == \"Secondary\"\n output_plan_type = \"CI\"\n else\n output_plan_type = eob.plan_type\n end\n end\n output_plan_type\n end", "def types\n classifications.collect() do |c|\n c[\"classificationTypeName\"]\n end\n end", "def resourceType\n 'MedicinalProduct'\n end", "def classification\n classifications = @data[\"spData\"][\"classifications\"]\n if classifications.empty?\n raise Holdings::Error, NO_CLASSIFICATIONS_ERROR\n end\n Classification.new(classifications.first)\n end", "def extension\n config['plantuml']['extension'] || begin\n ext = type.split(':', 2).first\n case ext\n when 'braille'\n ext = 'png'\n when 'txt'\n ext = 'atxt'\n end\n ext\n end\n end", "def presentation_unit_type_measurement\n packing_material.presentation_unit_type_measurement\n end", "def get_entity_type\n return 'county'\n end", "def type\n @klass.is_a?(Rubinius::ToolSets::Runtime::ToolSet::AST::Class) ? \"class\" : \"module\"\n end", "def presentation_unit_type_measure\n packing_material.presentation_unit_type_measure\n end", "def klass\n wtype=ENV.fetch('WORK_TYPE')\n if wtype==\"GraduateThesisOrDissertation\" then\n model=GraduateThesisOrDissertation\n elsif wtype==\"UndergraduateHonorsThesis\" then\n model=UndergraduateHonorsThesis \n elsif wtype==\"Article\" then\n model=Article\n elsif wtype==\"Book\" then\n model=Book\n elsif wtype==\"BookChapter\" then\n model=BookChapter\n elsif wtype == \"ConferenceProceeding\" then\n model=ConferenceProceeding\n elsif wtype == \"Presentation\" then\n model= Presentation\n elsif wtype == \"Report\"\n model= Report\n elsif wtype == \"Dataset\"\n model = Dataset\n elsif wtype == \"Default\"\n model= Default\n end\n model\n end", "def offering_type\n data.offering_type\n end", "def add_classification\n @bib.classification.each do |c|\n case c.type\n when \"type\" then @item[\"type\"] = c.value\n when \"mendeley\" then @item[\"mendeley-tags\"] = c.value\n end\n end\n end", "def card_type\n if course.present? and course_type == 'Course::Training'\n 'training'\n else\n 'course'\n end\n end", "def output_package(pkg_type)\n case pkg_type\n when 'makeself'\n Packager::Makeself.new(self).package_name\n when 'msi'\n Packager::MSI.new(self).package_name\n when 'bff'\n Packager::BFF.new(self).package_name\n when 'solaris'\n Packager::Solaris.new(self).package_name\n when 'pkg'\n Packager::PKG.new(self).package_name\n when 'mac_dmg'\n pkg = Packager::PKG.new(self)\n Packager::MacDmg.new(pkg).package_name\n when 'rpm'\n Packager::RPM.new(self).package_name\n when 'deb'\n Packager::DEB.new(self).package_name\n else\n raise RuntimeError, \"I do not know how to build a `#{pkg_type}'!\"\n end\n end", "def asset_type\n return self.class.to_s.gsub(/^.*::/,'').gsub(/AssetSet/,'').gsub(/([^^])([A-Z])/,'$1_$2').downcase.to_sym\n end", "def resourceType\n 'MedicinalProductContraindication'\n end", "def itemtype\n format = self[:format_main_ssim] || []\n genre = self[:genre_ssim] || []\n case\n when genre.include?('Thesis/Dissertation')\n 'http://schema.org/Thesis'\n when genre.include?('Video games')\n 'http://schema.org/VideoGame'\n when format.include?('Equipment')\n 'http://schema.org/Thing'\n when format.include?('Book')\n 'http://schema.org/Book'\n when format.include?('Dataset')\n 'http://schema.org/Dataset'\n when format.include?('Image')\n 'http://schema.org/ImageObject'\n when format.include?('Journal/Periodical')\n 'http://schema.org/Periodical'\n when format.include?('Map')\n 'http://schema.org/Map'\n when format.include?('Music recording')\n 'http://schema.org/MusicRecording'\n when format.include?('Newspaper')\n 'http://bib.schema.org/Newspaper'\n when format.include?('Software/Multimedia')\n 'http://schema.org/SoftwareApplication'\n when format.include?('Sound recording')\n 'http://schema.org/AudioObject'\n when format.include?('Video')\n 'http://schema.org/VideoObject'\n else\n 'http://schema.org/CreativeWork'\n end\n end", "def subtype\n self.numeric_type\n end", "def subtype\n self.numeric_type\n end", "def full_type\n type_and_version.join(\"/\")\n end", "def artwork_type_label\n at = ArtworkType.find_by_code(self.artwork_type)\n if at\n return at[:label]\n else\n return artwork_type\n end\n end", "def profile_types(prov_type)\n case prov_type.to_sym\n when :appstore\n return [\n Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_STORE,\n Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_STORE,\n Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_STORE,\n Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_STORE\n ]\n when :development\n return [\n Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_DEVELOPMENT,\n Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DEVELOPMENT,\n Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_DEVELOPMENT,\n Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DEVELOPMENT\n ]\n when :enterprise\n return [\n Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_INHOUSE,\n Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_INHOUSE\n ]\n when :adhoc\n return [\n Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_ADHOC,\n Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_ADHOC\n ]\n when :developer_id\n return [\n Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DIRECT,\n Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DIRECT\n ]\n else\n raise \"Unknown provisioning type '#{prov_type}'\"\n end\n end", "def type_hierarchy_provider\n attributes.fetch(:typeHierarchyProvider)\n end", "def type\n fetch('company.type')\n end", "def has?(bsubtype)\n backend_subtypes.include?(bsubtype)\n end", "def klass\n #byebug\n wtype=ENV.fetch('WORK_TYPE')\n #byebug\n puts \"HELLLLLLLOOOOOOOOOOOOOOOO\"\n if wtype==\"GraduateThesisOrDissertation\" then\n model=GraduateThesisOrDissertation\n elsif wtype==\"UndergraduateHonorsThesis\" then\n model=UndergraduateHonorsThesis \n elsif wtype==\"Article\" then\n model=Article\n end\n model\n end", "def type_to_klass(spring_type)\n without_project = spring_type.split(',')\n namespaced_type = without_project.first\n namespaced_type.split('.').last\n end", "def classification=(value)\n @classification = value\n end", "def classification=(value)\n @classification = value\n end", "def type\n %w[taxi PHV].sample\n end", "def extract_type_from_filename\n basename = File.basename(filename, File.extname(filename))\n basename.split('_')[1]\n end", "def get_bed_type(bed_type)\n BED_TYPES[bed_type]\n end", "def max_for_coding(type)\n case type.to_s\n when \"CodingBudget\", \"CodingBudgetDistrict\", \"CodingBudgetCostCategorization\"\n max = budget\n when \"CodingSpend\", \"CodingSpendDistrict\", \"CodingSpendCostCategorization\"\n max = spend\n end\n end", "def type\n @stanza.type\n end", "def get_filetype(partition) # by nelsongs\n\treturn `file -s \"#{partition}\" | awk '{print $2}'`.chomp\nend", "def sub_tool_config(classification=nil)\n if ! classification.nil? && ! (subToolIndex = classification.annotation[\"subToolIndex\"]).nil?\n find_tool_box(subToolIndex.to_i)\n\n elsif ! classification.nil? && ! (option_value = classification.annotation[\"value\"]).nil? && ! tool_config[\"options\"].nil? && ! (opt = tool_config[\"options\"].select { |c| c['value'].to_s == option_value }).empty?\n opt.first\n end\n end", "def per_facility?(account_type)\n facility_account_types.include?(account_type.to_s.classify)\n end", "def license_type\n return @license_type\n end" ]
[ "0.7367067", "0.59793675", "0.5879135", "0.58740616", "0.5836648", "0.5623186", "0.5592812", "0.5577389", "0.5480861", "0.541264", "0.541264", "0.54093224", "0.5404062", "0.53890365", "0.5334105", "0.5334105", "0.5327387", "0.5320731", "0.531167", "0.5271905", "0.5266696", "0.5204473", "0.519326", "0.518707", "0.51766354", "0.51707804", "0.51483", "0.5142633", "0.5111375", "0.5110949", "0.50877166", "0.5080789", "0.5077144", "0.5060117", "0.5041142", "0.5040058", "0.503132", "0.50135225", "0.5010774", "0.5010175", "0.49926442", "0.49918205", "0.49877635", "0.49866068", "0.49762413", "0.49715227", "0.49615926", "0.49579734", "0.49569553", "0.49470815", "0.49313605", "0.4913496", "0.49133727", "0.49103698", "0.49092403", "0.4905166", "0.489209", "0.48856235", "0.48830253", "0.48681274", "0.48579878", "0.48512807", "0.48504767", "0.484902", "0.48372364", "0.48365164", "0.48365155", "0.48180598", "0.48168522", "0.4815472", "0.48154217", "0.48090106", "0.48078874", "0.48042914", "0.48008144", "0.48007634", "0.47949782", "0.478993", "0.47898486", "0.47875646", "0.47875646", "0.4783274", "0.4765592", "0.47639275", "0.47626454", "0.475639", "0.4754375", "0.47543702", "0.47538054", "0.47434813", "0.47434813", "0.47367063", "0.473119", "0.47303152", "0.4726255", "0.47250605", "0.4724456", "0.47161117", "0.47089505", "0.47049135" ]
0.6812239
1
TODO: Make more assertions about what a completed ingest looks like and test here
def package_ingest_complete?(dir, file_names) return true if File.exist?(File.join(dir, file_names.first)) && File.exist?(File.join(dir, file_names.last)) logger.error("Package ingest not complete for #{file_names.first} and #{file_names.last}") false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingest_new_content( depositor, dirname, wsname, current, total )\n\n filename = File.join( dirname, wsname )\n _, asset_filenames = IngestHelpers.load_workset( filename )\n\n puts \"Ingesting #{current} of #{total}: #{filename} ...\"\n\n work_id = IngestHelpers.get_ingest_id( filename )\n if work_id.blank?\n puts \"ERROR: #{filename} has no ingest id, continuing anyway\"\n return false\n end\n\n work = TaskHelpers.get_work_by_id( work_id )\n if work.nil?\n puts \"ERROR: work #{work_id} does not exist, continuing anyway\"\n return false\n end\n\n asset_filenames.each_with_index do |f, ix|\n label = IngestHelpers.construct_file_label( ix + 1, f, work )\n puts \" asset #{ix + 1} of #{asset_filenames.length}: #{f} (#{label})\"\n\n # handle dry running\n next if ENV[ 'DRY_RUN' ]\n\n # and upload the file\n fileset = TaskHelpers.upload_file( depositor, work, File.join( dirname, f ), label )\n fileset.date_uploaded = DateTime.now\n fileset.save!\n end\n\n return true\n end", "def done?\n get_ingest_run.done?\n end", "def ingest_new_metadata( defaults, depositor, dirname, wsname, current, total )\n\n filename = File.join( dirname, wsname )\n metadata_file, _ = IngestHelpers.load_workset( filename )\n\n xml_doc = IngestHelpers.load_ingest_content( File.join( dirname, metadata_file ) )\n #id = solr_doc['id']\n\n puts \"Ingesting #{current} of #{total}: #{filename}...\"\n\n # create a payload from the document\n payload = create_new_ingest_payload( xml_doc )\n\n # merge in any default attributes\n payload = apply_defaults_for_new_item( defaults, payload )\n\n # some fields with embedded quotes need to be escaped; handle this here\n payload = IngestHelpers.escape_fields( payload )\n\n # dump the fields as necessary...\n IngestHelpers.dump_ingest_payload( payload ) if ENV[ 'DUMP_PAYLOAD' ]\n\n # validate the payload\n errors, warnings = IngestHelpers.validate_ingest_payload( payload )\n\n if errors.empty? == false\n puts \" ERROR(S) identified for #{filename}\"\n puts \" ==> #{errors.join( \"\\n ==> \" )}\"\n return false\n end\n\n if warnings.empty? == false\n puts \" WARNING(S) identified for #{filename}, continuing anyway\"\n puts \" ==> #{warnings.join( \"\\n ==> \" )}\"\n end\n\n # handle dry running\n return true if ENV[ 'DRY_RUN' ]\n\n # create the work\n ok, work = IngestHelpers.create_new_item( depositor, payload )\n if ok == true\n puts \"New work created; id #{work.id} (#{work.identifier || 'none'})\"\n else\n puts \" ERROR: creating new generic work for #{filename}\"\n return false\n end\n\n # create a record of the actual work id\n if work != nil\n ok = IngestHelpers.set_ingest_id( filename, work.id )\n puts \" ERROR: creating ingest id file\" unless ok\n end\n\n return ok\n end", "def test_oneshot_on_service\n jobs = @service.jobs\n stream = @service.create_oneshot(QUERY)\n results = ResultsReader.new(stream)\n assert_false(results.is_preview?)\n events = results.to_a()\n assert_equal(3, events.length())\n end", "def ingest_legacy_metadata( rt_overrides, defaults, default_depositor, dirname, current, total )\n\n solr_doc, fedora_doc = IngestHelpers.load_legacy_ingest_content(dirname )\n id = solr_doc['id']\n\n puts \"Ingesting #{current} of #{total}: #{File.basename( dirname )} (#{id})...\"\n\n # create a payload from the document\n payload = create_legacy_ingest_payload( rt_overrides, dirname, solr_doc, fedora_doc )\n\n # merge in any default attributes\n payload = apply_defaults_for_legacy_item( defaults, payload )\n\n # calculate embargo release date\n payload = add_embargo_release_date( payload )\n\n # some fields with embedded quotes need to be escaped; handle this here\n #payload = IngestHelpers.escape_fields( payload )\n\n # dump the fields as necessary...\n IngestHelpers.dump_ingest_payload( payload ) if ENV[ 'DUMP_PAYLOAD' ]\n\n # validate the payload\n errors, warnings = IngestHelpers.validate_ingest_payload( payload )\n\n if errors.empty? == false\n puts \" ERROR(S) identified for #{File.basename( dirname )} (#{id})\"\n puts \" ==> #{errors.join( \"\\n ==> \" )}\"\n return false\n end\n\n if warnings.empty? == false\n puts \" WARNING(S) identified for #{File.basename( dirname )} (#{id}), continuing anyway\"\n puts \" ==> #{warnings.join( \"\\n ==> \" )}\"\n end\n\n # handle dry running\n return true if ENV[ 'DRY_RUN' ]\n\n # determine the appropriate depositor\n depositor = identify_and_create_depositor( payload[ :authors ], default_depositor )\n\n # create the work\n ok, work = IngestHelpers.create_new_item( depositor, payload )\n if ok == true\n puts \"New work created; id: #{work.id} (#{work.doi || 'none'})\"\n else\n #puts \" ERROR: creating new generic work for #{File.basename( dirname )} (#{id})\"\n #return false\n puts \" WARNING: while creating generic work for #{File.basename( dirname )} (#{id})\"\n end\n\n # create a record of the actual work id\n if work != nil\n ok = IngestHelpers.set_legacy_ingest_id(dirname, work.id )\n end\n\n return ok\n end", "def metadata\n get_ingest_run.metadata\n end", "def run_succeeded; end", "def test_scenario1\n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\",\n \"params\" => {\"tags\" => [\"my tag\", \"my second tag\"], \n \"project\" => @project[\"resource\"]}},\n {\"filename\" => \"./data/iris.csv\",\n \"params\" => {\"name\" => \"Testing unicode names: áé\",\n \"project\" => @project[\"resource\"]}}]\n\n puts\n puts \"Scenario: Uploading source with structured args\" \n\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a \" + item[\"filename\"] + \" file\"\n source = @api.create_source(item[\"filename\"], item[\"params\"].clone)\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"Then the source exists and has args #{JSON.generate(item['params'])}\"\n \n item['params'].each do |param, value|\n assert_equal(source[\"object\"][param], value)\n end\n\n end\n\n end", "def poll_for_completion(run_at: 1.minute.from_now)\n if done? && !failed?\n Rails.logger.info \"IngestJob poller: #{pipeline_name} is done!\"\n Rails.logger.info \"IngestJob poller: #{pipeline_name} status: #{current_status}\"\n unless special_action?\n study_file.update(parse_status: 'parsed')\n study_file.bundled_files.each { |sf| sf.update(parse_status: 'parsed') }\n end\n study.reload # refresh cached instance of study\n study_file.reload # refresh cached instance of study_file\n set_study_state_after_ingest\n study_file.invalidate_cache_by_file_type # clear visualization caches for file\n log_to_mixpanel\n subject = \"#{study_file.file_type} file: '#{study_file.upload_file_name}' has completed parsing\"\n message = generate_success_email_array\n if special_action?\n # don't email users for 'special actions' like DE or image pipeline, instead notify admins\n qa_config = AdminConfiguration.find_by(config_type: 'QA Dev Email')\n email = qa_config.present? ? qa_config.value : User.find_by(admin: true)&.email\n SingleCellMailer.notify_user_parse_complete(email, subject, message, study).deliver_now unless email.blank?\n elsif action != :ingest_anndata # don't email users on \"extract\" AnnData jobs\n SingleCellMailer.notify_user_parse_complete(user.email, subject, message, study).deliver_now\n end\n elsif done? && failed?\n Rails.logger.error \"IngestJob poller: #{pipeline_name} has failed.\"\n # log errors to application log for inspection\n log_error_messages\n log_to_mixpanel # log before queuing file for deletion to preserve properties\n # don't delete files or notify users if this is a 'special action', like DE or image pipeline jobs\n subject = \"Error: #{study_file.file_type} file: '#{study_file.upload_file_name}' parse has failed\"\n unless special_action?\n create_study_file_copy\n study_file.update(parse_status: 'failed')\n DeleteQueueJob.new(study_file).delay.perform\n unless persist_on_fail\n ApplicationController.firecloud_client.delete_workspace_file(study.bucket_id, study_file.bucket_location)\n study_file.bundled_files.each do |bundled_file|\n ApplicationController.firecloud_client.delete_workspace_file(study.bucket_id, bundled_file.bucket_location)\n end\n end\n user_email_content = generate_error_email_body\n SingleCellMailer.notify_user_parse_fail(user.email, subject, user_email_content, study).deliver_now\n end\n admin_email_content = generate_error_email_body(email_type: :dev)\n SingleCellMailer.notify_admin_parse_fail(user.email, subject, admin_email_content).deliver_now\n else\n Rails.logger.info \"IngestJob poller: #{pipeline_name} is not done; queuing check for #{run_at}\"\n delay(run_at: run_at).poll_for_completion\n end\n end", "def running_test_step; end", "def ingest_status(...)\n IngestService.active_status\n end", "def ingest_new_content( depositor, work, file_str, asset_dir, current, total )\n file_names = file_str.split('|')\n\n puts \"Ingesting row #{current} of #{total}: #{work.title.join} (#{file_names.length} assets)...\"\n\n # handle dry running\n return true if ENV[ 'DRY_RUN' ]\n\n # and upload each file\n file_names.each do |file_name|\n\n # Clamav can't handle file names with space, (, or )\n # Assume they have been removed, but keep them in the label\n adjusted_file_name = file_name.gsub(/[() ]/, '_')\n file_path = File.join( asset_dir, adjusted_file_name )\n\n # remove spaces in filename\n #file_no_spaces = file_path.gsub(' ', '_')\n #File.rename(file_path, file_no_spaces)\n #file_path = file_no_spaces\n\n # Check for existing asset\n if work.file_sets.any? {|fs| fs.title.first == file_name }\n puts \"Skipping existing file: #{file_name}\"\n next\n end\n\n if File.exist?(file_path)\n fileset = TaskHelpers.upload_file( depositor, work, file_path, file_name, work.visibility )\n else\n puts \"File does not exist: #{file_path}\"\n end\n # Upload very slowly...\n sleep(30)\n\n end\n\n return true\n end", "def process_steps(should_harvest)\n bump_version\n\n simple_validations\n\n # All of the simple validations are basic requirements for processing a file.\n # Does it exist? Does it have more than 0 bytes? Is it a file included in our target extensions?\n # No point advancing if these conditions are not met.\n return move_to_failed unless valid?\n\n # I didn't want to mutate files in the information gathering stage.\n # However, unless fixes are applied it is really hard to gather\n # correct metadata for the file - which is needed for validating.\n # Lastly, EMU is meant to be safe and fault tolerant so we're just\n # Hoping it is up to the task.\n apply_fixes\n\n # EMU can detect some unfixable problems\n return move_to_failed unless valid?\n\n extract_metadata\n\n validate\n\n mark_status(HarvestItem::STATUS_METADATA_GATHERED)\n\n # stop here if we're only gathering metadata\n return unless should_harvest\n\n # we're trying to do an actual harvest but there are still validation errors; fail time\n return move_to_failed unless valid?\n\n # fix any errors or manipulate the files before harvest\n pre_process\n\n # create the audio recording in the database\n return move_to_failed unless create_audio_recording\n\n # harvest the file ( move the file on disk)\n return move_to_failed unless harvest_file\n\n post_process\n\n mark_status(HarvestItem::STATUS_COMPLETED)\n rescue StandardError => e\n move_to_error(e)\n\n # Two cases here:\n # 1. Truly exceptional behaviour, such as a bug in the code. Raise and send an error notification.\n # 2. Some kind of domain/logical/transient error. Timeouts are a good example.\n # - Do not send a notification.\n # - Maybe it can be retried?\n\n # here we detect exceptions that should trigger a retry\n raise if should_retry?(e)\n\n # raise will mark the job tracker as :errored\n raise unless one_of_our_exceptions(e)\n\n # otherwise, set the job-tracker to :failed indicating retry is possible\n failed!(e.message)\n ensure\n save_state\n end", "def test_scenario2\n data = [[File.dirname(__FILE__)+'/data/iris_missing.csv', {\"fields\" => {\"000000\" => {\"optype\" => \"numeric\"}}}, {\"000000\" => 1}]]\n\n puts\n puts \"Scenario: Successfully obtaining parsing error counts\"\n\n data.each do |filename, params, missing_values|\n puts\n puts \"Given I create a data source uploading a %s file\" % filename \n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I update the source with params <%s>\" % JSON.generate(params)\n source = @api.update_source(source, params)\n assert_equal(BigML::HTTP_ACCEPTED, source[\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"I ask for the error counts in the fields\"\n step_results = @api.error_counts(dataset)\n puts \"Then the error counts dict is <%s>\" % missing_values \n\n assert_equal(missing_values, step_results) \n \n end\n\n end", "def ingest_book\n first_page = File.join @directory_path, @page_filenames.first\n @image = File.read(first_page)\n\n thumbnail, thumbnail_error_messages = nil\n\n ingestor = Ingestor.new(@config, @namespace, @manifest) do |ingestor|\n\n boilerplate(ingestor)\n\n thumbnail, thumbnail_error_messages = Utils.image_resize(@config, first_page, @config.thumbnail_geometry, 'jpeg')\n\n ingestor.datastream('TN') do |ds|\n ds.dsLabel = 'Thumbnail'\n ds.content = thumbnail\n ds.mimeType = 'image/jpeg'\n end\n\n ingestor.datastream('DT-METS') do |ds|\n ds.dsLabel = 'Archived METS for future reference'\n ds.content = @mets.text\n ds.mimeType = 'text/xml'\n end\n\n ingestor.datastream('TOC') do |ds|\n ds.dsLabel = 'Table of Contents'\n ds.content = @table_of_contents.to_json(@mets.label)\n ds.mimeType = 'application/json'\n end\n end\n\n @bytes_ingested += ingestor.size\n\n if not Utils.request_index_update_for_pid(@config, @pid)\n error \"Problem updating index for #{pid}.\"\n end\n\n ensure\n warning ingestor.warnings if ingestor and ingestor.warnings?\n error ingestor.errors if ingestor and ingestor.errors?\n warning [ 'Issues creating Thumbnail datastream' ] + thumbnail_error_messages if thumbnail_error_messages and not thumbnail_error_messages.empty?\n\n safe_close(@image, thumbnail)\n\n @updator.post_ingest\n end", "def determine_loads_state\n\n loads = @marketo.loads(:user => GOODDATA_USER,\n :pass => GOODDATA_PASSWORD,\n :project => GOODDATA_PROJECT,\n :marketo_client => @marketo)\n\n if loads.available?\n\n file = loads.available.first\n load = loads.create :name => file\n\n load.execute\n\n # Data from the job can now be accessed ARRAY load.storage\n # load.storage\n\n # Increment the load by one day if it is time related.\n\n case load.json[:method]\n\n when 'get_changes'\n\n one_day = (24*60*60)\n oca = load.arguments[:oldest_created_at]\n lca = load.arguments[:latest_created_at]\n\n load.arguments[:oldest_created_at] = (Time.parse(oca) + one_day).to_s\n load.arguments[:latest_created_at] = (Time.parse(lca) + one_day).to_s\n\n # If the latest time is later then today kill the load.\n if Time.parse(lca) > Time.now\n\n load.terminate\n\n determine_loads_state\n\n # Otherwise save the load and resume additional loads.\n else\n\n load.save\n\n determine_loads_state\n\n end\n\n when 'get_multiple'\n\n determine_loads_state\n\n else\n raise 'Unable to determine lead type (\"get_multiple\"/\"get_changes\")!'\n\n end\n\n else\n\n load = @queue.pop\n loads.create load\n\n determine_loads_state\n\n end\n\nend", "def step_result; end", "def post_setup_test_run(test_run, data)\n parsed_data = nil\n begin\n parsed_data = JSON.parse(data)\n rescue\n test_run.setup_error = \"Could not parse the worker's setup data\"\n test_run.status = TestStatus::ERROR\n test_run.save!\n return\n end\n\n if parsed_data[\"error\"]\n test_run.setup_error = parsed_data[\"error\"]\n test_run.status = TestStatus::ERROR\n test_run.save!\n else\n test_run.commit_message = parsed_data[\"subject\"]\n test_run.commit_author_name = parsed_data[\"author_name\"]\n test_run.commit_author_email = parsed_data[\"author_email\"]\n test_run.commit_committer_name = parsed_data[\"commiter_name\"]\n test_run.commit_committer_email = parsed_data[\"commiter_email\"]\n test_run.sha_history = parsed_data[\"sha_history\"]\n\n test_run.commit_timestamp =\n Time.at(parsed_data[\"committer_date_unix\"].to_i).utc\n\n parsed_data[\"jobs\"].each do |job_data|\n test_run.test_jobs.build(\n job_name: job_data[\"job_name\"],\n command: job_data[\"command\"],\n before: job_data[\"before\"],\n after: job_data[\"after\"])\n end\n Katanomeas.new(test_run).assign_chunk_indexes_to_test_jobs\n test_run.status = TestStatus::QUEUED\n\n return nil if test_run.db_status_is_cancelled?\n test_run.save!\n end\n end", "def run_completed\n end", "def test_scenario1\n data = [[File.dirname(__FILE__)+'/data/iris_missing.csv', {\"fields\" => {\"000000\" => {\"optype\" => \"numeric\"}}}, {\"000000\" => 1}]]\n\n puts \n puts \"Scenario: Successfully obtaining missing values counts\"\n\n data.each do |filename, params, missing_values|\n puts \n puts \"Given I create a data source uploading a %s file\" % filename \n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I update the source with params <%s>\" % JSON.generate(params)\n source = @api.update_source(source, params)\n assert_equal(BigML::HTTP_ACCEPTED, source[\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n puts \"When I ask for the missing values counts in the fields\"\n fields = BigML::Fields.new(dataset)\n\n puts \"Then the missing values counts dict is <%s>\" % missing_values\n assert_equal(missing_values, fields.missing_counts())\n\n end\n\n end", "def process checkup\n ##\n # => Load seed.\n #\n begin\n rescue Exception => e\n \tServices::Slog.exception e\n end\n \n ## this should be simpler!!!\n begin\n \ti = 0\n \t#AgentMapping.where(:agent_id => id).each do |mapping|\n \t\t#Integration.where(:id => mapping.integration_id).each do |integration|\n self.integrations.each do |integration|\n \t\t\tintegration.templates.each do |t|\n \t\t\t\tServices::Slog.debug({:message => \"Sending #{identifier} for delivery by #{t.identifier}\", :module => \"Agent\", :task => \"process\", :extra => {:agent => identifier, :template => t.identifier, :payload => checkup[:payload].to_s, :destination => \"#{ENV[\"APP_HOST\"]}postman/deliver/#{t.identifier}.js\"}})\n \t\t\t\tcheckup[:payload].each do |payload|\n \t\t\t\t\tresponse = RestClient.post \"#{ENV[\"APP_HOST\"]}postman/deliver/#{t.identifier}.js\", payload\n \t\t\t\t\tcase response.code\n \t\t\t\t\twhen 200\n \t\t\t\t\t\ti = i + 1\n \t\t\t\t\t\t@event = Event.new({:payload => payload, :status => 100, :agent => self})\n \t\t\t\t\t\t@event.save\n \t\t\t\t\telse\n \t\t\t\t\t\tServices::Slog.warn({:message => \"Delivery failed for #{identifier} in #{t.identifier}\", :module => \"Agent\", :task => \"process\", :extra => {:agent => identifier, :template => t.identifier}})\n \t\t\t\t\tend \n \t\t\t\tend\n \t\t\tend\n \t\t#end\n \tend\n \tRestClient.post(\"#{ENV[\"APP_HOST\"]}fluxcapacitor/agents/#{id}/update_meta\", {:events_count => events_count + i, :last_check_at => Time.now}) if i > 1\n rescue Exception => e\n \tServices::Slog.exception e\n end\n \nend", "def can_launch_ingest?\n case study_file.file_type\n when /Matrix/\n # expression matrices currently cannot be ingested in parallel due to constraints around validating cell names\n # this block ensures that all other matrices have all cell names ingested and at least one gene entry, which\n # ensures the matrix has validated\n other_matrix_files = study.expression_matrices.where(:id.ne => study_file.id)\n # only check other matrix files of the same type, as this is what will be checked when validating\n similar_matrix_files = other_matrix_files.select {|matrix| matrix.is_raw_counts_file? == study_file.is_raw_counts_file?}\n similar_matrix_files.each do |matrix_file|\n if matrix_file.parsing?\n matrix_cells = study.expression_matrix_cells(matrix_file)\n matrix_genes = Gene.where(study_id: study.id, study_file_id: matrix_file.id)\n if !matrix_cells || matrix_genes.empty?\n # return false if matrix hasn't validated, unless the other matrix was uploaded after this file\n # this is to prevent multiple matrix files queueing up and blocking each other from initiating PAPI jobs\n # also, a timeout 24 hours is added to prevent all matrix files from queueing infinitely if one\n # fails to launch an ingest job for some reason\n if matrix_file.created_at < study_file.created_at && matrix_file.created_at > 24.hours.ago\n return false\n end\n end\n end\n end\n true\n else\n # no other file types currently are gated for launching ingest\n true\n end\n end", "def read_completed()\n from_hash({})\n end", "def test_get_completed_eobs\n batch=Batch.find(2)\n eob=batch.eob\n Job.create(:batch=>batch,:tiff_number=>123,:check_number=>121313,:count=>12, :estimated_eob => 12)\n assert_equal(12, batch.get_completed_eobs)\n end", "def test_introspects_properly\n i = Tracksperanto::Import::SyntheyesAllTrackerPaths\n assert_equal \"Syntheyes \\\"All Tracker Paths\\\" export .txt file\", i.human_name\n assert !i.autodetects_size?\n assert_not_nil i.known_snags\n assert !i.known_snags.empty?\n end", "def error\n get_ingest_run.error\n end", "def upload_data_file(upload, current_user_guid, options = {})\n self.init_uploaded_file(upload, 'Upload', current_user_guid, options)\n stixish = is_file_upload ? is_stix_file?(@file_path) : is_stix?(upload)\n\n if stixish\n if options[:human_review_approved]\n raw_xml = upload\n IngestUtilities.add_warning(self, \"Human Review approved, full ingestion starting at #{Time.now}\")\n oi = self.original_inputs.active.first\n else\n if is_file_upload\n oi = XmlSaving.store_original_file(@file_path, self.guid, @input_category, @mime_type)\n source_oi = XmlSaving.store_original_file(@file_path, self.guid, 'SOURCE', @mime_type)\n else\n oi = XmlSaving.store_original_input(upload, self.guid, @input_category, @mime_type)\n source_oi = XmlSaving.store_original_input(upload, self.guid, 'SOURCE', @mime_type)\n end\n\n # This is not \"Sanitization\" per se...it's fixing invalid ID's, so it\n # gets run every time\n s = Sanitization.new\n s.sanitize_id_format_raw_xml(oi) unless\n Stix::Stix111::PackageInfo.is_ciscp?(oi.raw_content,\n Setting.CISCP_ID_PATTERNS) \n \n raw_xml = oi.utf8_raw_content\n IngestUtilities.add_warning(self, s.get_warnings, true) if s.get_warnings\n if s.get_errors\n IngestUtilities.add_error(self, s.get_errors, true)\n end\n end\n\n if self.validate_only || self.overwrite || self.read_only || !IngestUtilities.already_loaded?(self)\n parse_and_load_stix(raw_xml, options)\n \n package=self.stix_packages.first\n\n unless package.nil?\n \n # Store the the source feed received from FLARE if FLARE sent this\n # information with the file. This ultimately comes from a string\n # property in the AMQP message received from FLARE. For HR files,\n # this is stored in the uploaded_file and added to the package\n # upon full ingestion after HR approval.\n package.src_feed = self.src_feed if self.src_feed.present?\n audit = Audit.basic\n audit.message = \"Package created from STIX upload: #{self.file_name}.\"\n audit.details = \"#{package.uploaded_file.guid}\"\n audit.item = package\n audit.audit_type = :upload\n package.audits << audit\n package.updated_at = Time.now\n package.save\n end\n else\n IngestUtilities.add_error(self, \"STIX Package has already been successfully loaded.\")\n end\n else\n IngestUtilities.add_error(self, \"Not a STIX XML File: #{self.file_name}\")\n end\n\n # if its an api upload, try and set the name to the name of the package title\n if self.file_name == 'API Upload'\n if self.stix_packages.first.present?\n self.file_name = \"API Upload (#{self.stix_packages.first.title})\"\n else\n if [\n OriginalInput::XML_DISSEMINATION_ISA_FILE,\n OriginalInput::XML_DISSEMINATION_AIS_FILE,\n OriginalInput::XML_DISSEMINATION_CISCP_FILE,\n OriginalInput::XML_DISSEMINATION_TRANSFER,\n OriginalInput::XML_AIS_XML_TRANSFER\n ].include?(oi.input_sub_category)\n stix_id = options[:stix_id] ||\n /id=[\"'](.+?)[\"']/.match(oi.raw_content)\n stix_id = \"#{stix_id} - #{oi.input_sub_category}\"\n else\n stix_id = /id=[\"'](.+?)[\"']/.match(oi.raw_content)\n end\n\n self.file_name = \"API Upload (#{stix_id})\"\n end\n end\n\n # set the uploaded files portion marking when all done.\n self.set_portion_marking\n\n self.save\n IngestUtilities.cleanup(self, @file_path)\n rescue Exception => e\n ExceptionLogger.debug(\"exception: #{e}, message: #{e.message}, backtrace: #{e.backtrace}\")\n IngestUtilities.add_error(self, \"#{e.backtrace.first}: #{e.message} (#{e.class})\")\n self.save\n IngestUtilities.cleanup(self, @file_path)\n end", "def import_job\n return nil if completed?\n logger.info '** SieImport start'\n parse_and_import = Services::ImportSie.new(self)\n logger.info '** SieImport start - 1'\n if parse_and_import.read_and_save(sie_type)\n logger.info \"** SieImport #{id} parse/import returned ok, marking complete\"\n complete\n else\n logger.info \"** SieImport #{id} parse/import did NOT return ok, not marking complete\"\n end\n end", "def extract_metadata; end", "def test_scenario1\n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\",\n \"local_file\" => File.dirname(__FILE__)+\"/tmp/exported_iris.csv\"}] \n\n puts\n puts \"Scenario: Successfully exporting a dataset:\"\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a \" + item[\"filename\"] + \" file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I download the dataset file to #{item['local_file']} \"\n filename = @api.download_dataset(dataset, item[\"local_file\"])\n assert_not_nil(filename)\n\n puts \"Then the download dataset file is like #{item['filename']}\"\n assert_equal(FileUtils.compare_file(item[\"filename\"], item[\"local_file\"]), true)\n\n end\n\n end", "def test_run_completed(test_run)\n report_results test_run\n end", "def completed\n end", "def ingest_file(file)\n working_file = copy_file_to_working_directory(file, file_set.id)\n mime_type = file.respond_to?(:content_type) ? file.content_type : nil\n IngestFileJob.perform_later(file_set, working_file, mime_type, user, relation)\n true\n end", "def ingest\n raise PackageError, 'Attempt to ingest an invalid package.' unless valid?\n end", "def ingest\n raise PackageError, 'Attempt to ingest an invalid package.' unless valid?\n end", "def after_source_extraction(extracted_source)\n end", "def test_scenario6\n data = [[File.dirname(__FILE__)+'/data/iris.csv', \n false, \n File.dirname(__FILE__)+'/tmp/anomaly.json']]\n puts\n puts \"Scenario 6: Successfully creating a local anomaly from an exported file\"\n\n data.each do |filename, pmml, exported_file|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And the source is in the project\"\n assert_equal(source[\"object\"]['project'], @project[\"resource\"])\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And the dataset is in the project\"\n assert_equal(dataset[\"object\"]['project'], @project[\"resource\"])\n \n puts \"An I create a anomaly\"\n anomaly = @api.create_anomaly(dataset)\n\n puts \"And I wait until the anomaly is ready\"\n assert_equal(BigML::HTTP_CREATED, anomaly[\"code\"])\n assert_equal(1, anomaly[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(anomaly), true)\n \n puts \"And I export the <%s> anomaly to <%s>\" % [pmml, exported_file]\n @api.export(anomaly[\"resource\"], exported_file)\n \n puts \"When I create a local anomaly from the file <%s>\" % exported_file\n local_anomaly= BigML::Anomaly.new(exported_file)\n \n puts \"Then the anomaly ID and the local model ID match\"\n assert_equal(local_anomaly.resource_id, anomaly[\"resource\"])\n \n end\n end", "def done; end", "def test_asynchronous_job_has_segmentation_when_forced\n omit_if(@service.splunk_version[0] == 4)\n job = @service.jobs.create(\"search index=_internal GET | head 3\")\n until job.is_done?()\n sleep(0.1)\n end\n assert_true(job.events(:segmentation => \"raw\").include?(\"<sg\"))\n assert_true(job.preview(:segmentation => \"raw\").include?(\"<sg\"))\n end", "def push_to_epic_complete?\n %w(complete failed).include? last_epic_push_status\n end", "def on_finish_batch; end", "def setup\n @last_import_data = { string_field: \"import four\", integer_field: 4, extra_field: \" extra\" }\n end", "def test_scenario5\n data = [{'filename' => File.dirname(__FILE__)+'/data/tiny_kdd.csv',\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv', \n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_a.csv'}]\n\n puts \n puts \"Scenario: Successfully creating a batch anomaly score from an anomaly detector\"\n\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a #{item['filename']} file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create an anomaly detector\"\n anomaly=@api.create_anomaly(dataset)\n \n puts \"And I wait until the anomaly detector is ready\"\n assert_equal(BigML::HTTP_CREATED, anomaly[\"code\"])\n assert_equal(1, anomaly[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(anomaly), true)\n \n puts \"When I create a batch anomaly score\"\n batch_anomaly_score=@api.create_batch_anomaly_score(anomaly, dataset)\n \n puts \"And I check the batch anomaly score is ok\"\n assert_equal(BigML::HTTP_CREATED, batch_anomaly_score[\"code\"])\n assert_equal(1, batch_anomaly_score[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(batch_anomaly_score), true)\n \n puts \"And I download the created anomaly score file to #{item['local_file']}\"\n filename = @api.download_batch_anomaly_score(batch_anomaly_score, item[\"local_file\"])\n assert_not_nil(filename)\n \n puts \"Then the batch anomaly score file is like #{item['predictions_file']}\"\n assert_equal(FileUtils.compare_file(item[\"local_file\"], item[\"predictions_file\"]), true)\n \n end\n end", "def finished(inspected_files); end", "def test_scenario7\n data = [[File.dirname(__FILE__)+'/data/iris.csv', \n false, \n File.dirname(__FILE__)+'/tmp/association.json']]\n puts\n puts \"Scenario 7: Successfully creating a local association from an exported file\"\n\n data.each do |filename, pmml, exported_file|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And the source is in the project\"\n assert_equal(source[\"object\"]['project'], @project[\"resource\"])\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And the dataset is in the project\"\n assert_equal(dataset[\"object\"]['project'], @project[\"resource\"])\n \n puts \"An I create a association\"\n association = @api.create_association(dataset)\n\n puts \"And I wait until the association is ready\"\n assert_equal(BigML::HTTP_CREATED, association[\"code\"])\n assert_equal(1, association[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(association), true)\n \n puts \"And I export the <%s> association to <%s>\" % [pmml, exported_file]\n @api.export(association[\"resource\"], exported_file)\n \n puts \"When I create a local association from the file <%s>\" % exported_file\n local_association= BigML::Association.new(exported_file)\n \n puts \"Then the association ID and the local association ID match\"\n assert_equal(local_association.resource_id, association[\"resource\"])\n \n end\n end", "def processing_completed\n completed if @__handler_called__\n rescue Exception\n Beetle::reraise_expectation_errors!\n end", "def begin_investigation(processed_source); end", "def completed_text_extraction\n end", "def ingest\n json = self.result.deep_dup.with_indifferent_access\n JsonUtilities.strip_uri_type!(json)\n JsonUtilities.clean_uris!(json)\n client = HTTPClient.new\n # fire & forget\n client.put_async(\"#{INGEST_BASE_URL}?api_key=#{ENV['RC_API_KEY']}&doi=#{URI.encode_www_form_component(doi)}\",\n MultiJson.dump(json),\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json')\n end", "def completed()\n end", "def dump_tasks_harvest\n tasks = pull_tasks_harvest()\n harvest_user_id = get_user_id_harvest()\n tasks.each do |task|\n task_id = task[\"id\"]\n same_task = FetchData.where(resource_original_id: task_id, source: 'harvest', resource: 'task').to_a\n if same_task.length == 0\n FetchData.create!(user_id: user_id, source_user_id: harvest_user_id, payload: task, resource_original_id: task_id, source: 'harvest', resource: 'task')\n else\n FetchData.where(resource_original_id: task_id, source: 'harvest', resource: 'task').update(payload: task)\n end\n end\n end", "def event_processing_succeeded(event_name, event_version, payload)\n # do nothing\n end", "def batch_finished\n end", "def test_insert_file\n job1 = @fq.insert_file(@tmp_name1)\n assert(job1, 'invalid job1: false : ' + @fq.read_log)\n\n assert_equal({:que => 1}, @fq.all_lengths)\n\n assert_equal(1, @fq.length)\n end", "def migrate_lots_of_ug_papers(path_to_fox, path_to_foxdone, content_server_url, collection_mapping_doc_path, user)\r\nputs \"doing a bulk migration from \" + path_to_fox\r\n\r\nfname = \"tally.txt\"\r\ntallyfile = File.open(fname, \"a\")\r\nDir.foreach(path_to_fox)do |item|\t\r\n\t# we dont want to try and act on the current and parent directories\r\n\tnext if item == '.' or item == '..'\r\n\t# trackingfile.puts(\"now working on \" + item)\r\n\tputs \"found\" + item.to_s\r\n\titempath = path_to_fox + \"/\" + item\r\n\tresult = 9 # so this wont do the actions required if it isnt reset\r\n\tbegin\r\n\t\tresult = migrate_undergraduate_paper(itempath, content_server_url, collection_mapping_doc_path, user)\r\n\trescue\r\n\t\tresult = 1\t\r\n\t\ttallyfile.puts(\"rescue says FAILED TO INGEST \"+ itempath) \r\n\tend\r\n\tif result == 0\r\n\t\ttallyfile.puts(\"ingested \" + itempath)\r\n\t\t#sleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\t\tFileUtils.mv(itempath, path_to_foxdone + \"/\" + item) # move files once migrated\r\n\telsif result == 1 # this may well not work, as it may stop part way through before it ever gets here. rescue block might help?\r\n\t\ttallyfile.puts(\"FAILED TO INGEST \"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 2 # apparently some records may not have an actual resource paper of any id!\r\n\t\ttallyfile.puts(\"ingested metadata but NO MAIN RESOURCE DOCUMENT IN \"+ itempath)\r\n\t\t#sleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 3 # couldnt identify parent collection in mappings\r\n\t\ttallyfile.puts(\"FAILED TO INGEST \" + itempath + \" because couldnt identiy parent collection mapping\")\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 4 # this may well not work, as it may stop part way through before it ever gets here. \r\n\t\ttallyfile.puts(\"FAILED TO INGEST RESOURCE DOCUMENT IN\"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telse\r\n tallyfile.puts(\" didnt return expected value of 0 or 1 \")\t\r\n\tend\r\nend\r\ntallyfile.close\r\nputs \"all done\"\r\nend", "def after_test_step(test_step, result)\n #puts test_step.to_yaml\n puts \"after #{test_step.class} result is #{result}\"\n puts result.to_yaml\n #p result.kind_of? Cucumber::Core::Test::Result::Passed\n #p result.kind_of? Cucumber::Core::Test::Result::Skipped\n end", "def converge_complete\n detect_unprocessed_resources\n end", "def finish_import(success)\n relinquish_claim(success)\n end", "def complete?; end", "def test_scenario1\n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\"}] \n\n puts\n puts \"Scenario: Successfully creating and reading a public dataset\"\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a \" + item[\"filename\"] + \" file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"I make the dataset public\"\n dataset = @api.update_dataset(dataset, {'private'=> false})\n assert_equal(BigML::HTTP_ACCEPTED, dataset[\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"When I get the dataset status using the dataset's public url\";\n dataset = @api.get_dataset(\"public/#{dataset['resource']}\")\n\n puts \"Then the dataset's status is FINISHED\";\n assert_equal(BigML::FINISHED, dataset[\"object\"][\"status\"][\"code\"])\n\n puts \"And I make the dataset private again\"\n dataset = @api.update_dataset(dataset, {'private'=> true})\n assert_equal(BigML::HTTP_ACCEPTED, dataset[\"code\"])\n\n end\n\n end", "def ingest\n return \"filename is blank\" if @taxonomy_file == \"\"\n taxonomy_doc = read_taxonomy\n\n xpath = find_deepest_node(taxonomy_doc)\n destinations_lookup = {}\n get_place_info_and_parent_place_info_from_node_xpath(taxonomy_doc,xpath).each do |data_object|\n destinations_lookup = build_data_objects_from_place_info_data(destinations_lookup,data_object)\n end\n destinations_lookup\n end", "def test_scenario4\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-setosa', {\"kind\" => \"probability\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-virginica', {\"kind\" => \"probability\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\"=> 2.4}, 'Iris-setosa', {\"kind\" => \"confidence\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\"=> 2.4}, 'Iris-versicolor', {\"kind\" => \"confidence\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"]\n ]\n puts\n puts \"Successfully comparing predictions in operating points for ensembles\"\n\n data.each do |filename, data_input, prediction_result, operating_point, objective|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create an ensemble\"\n ensemble = @api.create_ensemble(dataset, {\"number_of_models\"=> 2, \"seed\" => 'BigML', 'ensemble_sample'=>{'rate' => 0.7, 'seed' => 'BigML'}, 'missing_splits' => false})\n \n puts \"And I wait until the ensemble is ready\"\n assert_equal(BigML::HTTP_CREATED, ensemble[\"code\"])\n assert_equal(1, ensemble[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(ensemble), true)\n \n puts \"And I create a local ensemble\"\n local_ensemble = BigML::Ensemble.new(ensemble, @api)\n local_model = BigML::Model.new(local_ensemble.model_ids[0], @api)\n \n puts \" When I create a prediction for <%s>\" % [JSON.generate(data_input)]\n prediction = @api.create_prediction(ensemble['resource'], data_input, {\"operating_point\" => operating_point})\n \n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n assert_equal(@api.ok(prediction), true)\n \n \n puts \"Then the prediction for <%s> is <%s>\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end \n \n puts \"And I create a local prediction for <%s>\" % JSON.generate(data_input)\n local_prediction = local_ensemble.predict(data_input, {\"operating_point\" => operating_point})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n \n if (local_ensemble.regression) or \n (local_ensemble.is_a?(BigML::MultiModel) and local_ensemble.models[0].regression)\n assert_equal(local_prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(local_prediction, prediction_result)\n end \n \n end\n end", "def process(output_queue)\n # Get the blobs that are matching the prefix declared\n blobs = list_blobs\n\n # If there is a sincedb table\n if (@sincedb)\n existing_entities = list_sinceDbContainerEntities\n\n # For each blob that is validated for processing (due to prefix)\n blobs.each do |blob_name, blob_info|\n @logger.info(\"[#{storage_account_name}] Blob attempt on: [#{blob_info.name}]\")\n # Extract its path\n basepath = blob_info.name.split(File::SEPARATOR)[0]\n\n # Find in the sincedb entries and init the ENTITY STATE\n blob_name_encoded = Base64.strict_encode64(blob_info.name)\n entityIndex = existing_entities.find_index {|entity| entity.properties[\"RowKey\"] == blob_name_encoded }\n entity = { \n \"PartitionKey\" => @container, \n \"RowKey\" => blob_name_encoded, \n \"ByteOffset\" => 0, # First contact, start_position is beginning by default\n \"ETag\" => NIL,\n \"BlobName\" => blob_info.name\n }\n\n # If we have a match in the sincedb, update the ENTITY STATE with this info\n if (entityIndex)\n foundEntity = existing_entities.to_a[entityIndex];\n entity[\"ByteOffset\"] = foundEntity.properties[\"ByteOffset\"]\n entity[\"ETag\"] = foundEntity.properties[\"ETag\"] \n @logger.info(\"[#{storage_account_name} - #{basepath}] Blob is now #{blob_info.properties[:etag]}:#{blob_info.properties[:content_length]} - sincedb is: #{entity[\"ETag\"]}:#{entity[\"ByteOffset\"]}\")\n # If not then it means that either we just started (logstash) or new rotated file created\n elsif (@start_position === \"end\")\n @logger.info(\"[#{storage_account_name} - #{basepath}] Blob not in sincedb (mode #{@start_position}) so: Starting at #{blob_info.properties[:content_length]}\")\n entity[\"ByteOffset\"] = blob_info.properties[:content_length]\n entity[\"ETag\"] = blob_info.properties[:etag]\n @azure_table.insert_or_merge_entity(@sincedb, entity)\n elsif (@start_position === \"beginning\")\n @logger.info(\"[#{storage_account_name} - #{basepath}] Blob not in sincedb (mode #{@start_position}) so: Starting at 0\")\n entity[\"ByteOffset\"] = 0\n entity[\"ETag\"] = \"\"\n @azure_table.insert_or_merge_entity(@sincedb, entity)\n end\n\n # If blob has changed, read it\n if entity[\"ByteOffset\"] < blob_info.properties[:content_length]\n @logger.info(\"[#{storage_account_name} - #{basepath}] Blob processing started\")\n count = 0\n blob, content = @azure_blob.get_blob(@container, blob_info.name, { :start_range => entity[\"ByteOffset\"], :end_range => blob_info.properties[:content_length] })\n @codec.decode(content) do |event|\n decorate(event)\n event.set(\"file\", blob_info.name)\n output_queue << event\n count = count + 1\n end \n @logger.info(\"[#{storage_account_name} - #{basepath}] Submitting #{count} events [#{blob_info.name}]\")\n\n # Update sincedb with the latest informations we used while processing the blob.\n entity[\"ByteOffset\"] = blob_info.properties[:content_length]\n entity[\"ETag\"] = blob_info.properties[:etag]\n @azure_table.insert_or_merge_entity(@sincedb, entity)\n else\n @logger.info(\"[#{storage_account_name} - #{basepath}] Blob already up to date\")\n end\n \n end # For each blob\n end # if sincedb\n \n # Shutdown signal for graceful shutdown in LogStash\n rescue LogStash::ShutdownSignal => e\n raise e\n rescue => e\n @logger.error(\"#{DateTime.now} Oh My, An error occurred.\", :exception => e)\n end", "def test_scenario7\n\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2.46}, 'Iris-versicolor', \"probability\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2}, 'Iris-setosa', \"probability\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2.46}, 'Iris-versicolor', \"confidence\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2}, 'Iris-setosa', \"confidence\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2.46}, 'Iris-versicolor', \"votes\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 1}, 'Iris-setosa', \"votes\", \"000004\"]\n ]\n puts\n puts \"Successfully comparing predictions in operating points for ensembles\"\n\n data.each do |filename, data_input, prediction_result, operating_kind, objective|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create an ensemble\"\n ensemble = @api.create_ensemble(dataset, {\"number_of_models\"=> 2, \"seed\" => 'BigML', 'ensemble_sample'=>{'rate' => 0.7, 'seed' => 'BigML'}, 'missing_splits' => false})\n \n puts \"And I wait until the ensemble is ready\"\n assert_equal(BigML::HTTP_CREATED, ensemble[\"code\"])\n assert_equal(1, ensemble[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(ensemble), true)\n \n puts \"And I create a local ensemble\"\n local_ensemble = BigML::Ensemble.new(ensemble, @api)\n local_model = BigML::Model.new(local_ensemble.model_ids[0], @api)\n \n puts \"When I create a prediction for <%s>\" % [JSON.generate(data_input)]\n prediction = @api.create_prediction(ensemble['resource'], data_input, {\"operating_kind\" => operating_kind})\n \n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n assert_equal(@api.ok(prediction), true)\n\n puts \"Then the prediction for <%s> is <%s>\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end \n \n puts \"And I create a local prediction for <%s>\" % JSON.generate(data_input)\n local_prediction = local_ensemble.predict(data_input, {\"operating_kind\" => operating_kind})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n \n if (local_ensemble.regression) or \n (local_ensemble.is_a?(BigML::MultiModel) and local_ensemble.models[0].regression)\n assert_equal(local_prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(local_prediction, prediction_result)\n end \n \n end\n end", "def test_scenario6\n data = [{'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv', \n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_lr.csv'}]\n\n puts \n puts \"Scenario: Successfully creating a batch anomaly score from an anomaly detector\"\n\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a #{item['filename']} file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create a logistic regression\"\n logistic=@api.create_logisticregression(dataset)\n \n puts \"And I wait until the logistic regression is ready\"\n assert_equal(BigML::HTTP_CREATED, logistic[\"code\"])\n assert_equal(1, logistic[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(logistic), true)\n \n puts \"When I create a batch prediction for the dataset with the logistic regression\"\n batch_prediction=@api.create_batch_prediction(logistic, dataset)\n \n puts \"And I check the batch prediction is ok\"\n assert_equal(BigML::HTTP_CREATED, batch_prediction[\"code\"])\n assert_equal(1, batch_prediction[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(batch_prediction), true)\n \n puts \"And I download the created anomaly score file to #{item['local_file']}\"\n filename = @api.download_batch_prediction(batch_prediction, item[\"local_file\"])\n assert_not_nil(filename)\n \n puts \"Then the batch anomaly score file is like #{item['predictions_file']}\"\n assert_equal(FileUtils.compare_file(item[\"local_file\"], item[\"predictions_file\"]), true)\n \n end\n \n end", "def metadata_ingest_files\n return if params[:metadata_ingest_files].blank?\n params[:metadata_ingest_files].map do |metadata|\n metadata = JSON.parse(metadata, symbolize_names: true)\n file = Valkyrie::StorageAdapter.find_by(id: metadata[:id])\n PendingUpload.new(\n id: SecureRandom.uuid,\n storage_adapter_id: file.id,\n created_at: Time.current,\n file_name: metadata[:filename],\n type: metadata[:type]\n )\n rescue\n nil\n end.compact\n end", "def completed_text_extraction\n @found_completed_text_extraction = true\n end", "def test_scenario1\n data = [[File.dirname(__FILE__)+'/data/iris.csv', 'my new association name']]\n\n puts \n puts \"Scenario: Successfully creating associations from a dataset:\"\n\n data.each do |filename, association_name|\n puts\n puts \"Given I create a data source uploading a \" + filename+ \" file\"\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create an association from a dataset\"\n association = @api.create_association(dataset, {'name'=> 'new association'})\n puts \"And I wait until the association is ready\"\n assert_equal(BigML::HTTP_CREATED, association[\"code\"])\n assert_equal(1, association[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(association), true)\n\n puts \"And I update the association name to <%s>\" % association_name\n association = @api.update_association(association, {'name' => association_name})\n\n puts \"When I wait until the association is ready\"\n assert_equal(BigML::HTTP_ACCEPTED, association[\"code\"])\n assert_equal(@api.ok(association), true)\n\n puts \"Then the association name is <%s>\" % association_name\n assert_equal(association[\"object\"][\"name\"], association_name)\n \n end\n\n end", "def test_scenario4\n data = [{'filename' => File.dirname(__FILE__)+'/data/iris.csv'}]\n\n puts \n puts \"Scenario: Successfully creating a source from a batch prediction\"\n\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a #{item['filename']} file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create model\"\n model=@api.create_model(dataset)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n \n puts \"And I create a batch prediction\";\n batch_prediction=@api.create_batch_prediction(model,dataset)\n\n puts \"And I wait until the batch prediction is ready\"\n assert_equal(BigML::HTTP_CREATED, batch_prediction[\"code\"])\n assert_equal(@api.ok(batch_prediction), true)\n \n puts \"Then I create a source from the batch prediction\" \n source = @api.source_from_batch_prediction(batch_prediction)\n \n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n end\n end", "def complete\n raise NotImplementedError\n end", "def run(fs)\n @expected_files_collection = fs.database['expected.files']\n @expected_chunks_collection = fs.database['expected.chunks']\n act(fs)\n prepare_expected_collections(fs)\n result\n end", "def test_scenario13\n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal width'=> 0.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-setosa\",\n \"pathfile\" => File.dirname(__FILE__)+\"/tmp/my_model.json\",\n \"namefile\" => \"my_test\"},\n {\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal length'=> 6, 'petal width'=> 2},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-virginica\",\n \"pathfile\" => File.dirname(__FILE__)+\"/tmp/my_model.json\",\n \"namefile\" => \"my_test\"},\n {\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal length' => 4, 'petal width'=> 1.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-versicolor\",\n \"pathfile\" => File.dirname(__FILE__)+\"/tmp/my_model.json\",\n \"namefile\" => \"my_test\"}, \n {\"filename\" => File.dirname(__FILE__)+\"/data/iris_sp_chars.csv\",\n \"data_input\" => {\"pétal.length\" => 4, \"pétal&width\\u0000\" => 1.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-versicolor\",\n \"pathfile\" => File.dirname(__FILE__)+\"/tmp/my_model.json\",\n \"namefile\" => \"my_test\"}\n\t ]\n \n puts \n puts \"Scenario: Successfully comparing predictions\" \n \n data.each do |item|\n puts \n puts \"Given I create a data source uploading a <%s> file\" % item[\"filename\"]\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create a model\"\n model=@api.create_model(dataset, {\"tags\" => [\"%s\" % item[\"namefile\"]]})\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n puts \"And I export the model\"\n @api.export(model[\"resource\"], item[\"pathfile\"])\n\n puts \"And I create a local model from file %s\" % item[\"pathfile\"] \n local_model = BigML::Model.new(item[\"pathfile\"], @api)\n \n puts \"When I create a prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = @api.create_prediction(model, item[\"data_input\"])\n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n \n puts \"Then the prediction for <%s> is <%s>\" % [item[\"objective\"], item[\"prediction\"]]\n assert_equal(item[\"prediction\"], prediction[\"object\"][\"prediction\"][item[\"objective\"]]) \n\n puts \"And I create a local prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = local_model.predict(item[\"data_input\"])\n\n puts \"Then the local prediction is <%s>\" % item[\"prediction\"]\n assert_equal(prediction, item[\"prediction\"]) \n\n puts \"I Export the tags model\"\n @api.export_last(item[\"namefile\"], item[\"pathfile\"])\n \n puts \"And I create a local model from file %s\" % item[\"pathfile\"] \n local_model = BigML::Model.new(item[\"pathfile\"], @api)\n \n puts \"And I create a local prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = local_model.predict(item[\"data_input\"])\n \n puts \"Then the local prediction is <%s>\" % item[\"prediction\"]\n assert_equal(prediction, item[\"prediction\"]) \n \n end\n end", "def handle_success(payload, with_start)\n begin\n if payload[:result] && !payload[:result].is_a?(Hash)\n # keeping the error format the same as Membrane errors\n raise MalformedDiegoResponseError.new('{ result => unexpected format }')\n end\n\n payload[:result][:process_types] ||= {} if payload[:result]\n self.class.success_parser.validate(payload)\n rescue Membrane::SchemaValidationError, MalformedDiegoResponseError => e\n logger.error(logger_prefix + 'success.invalid-message', staging_guid: build.guid, payload: payload, error: e.to_s)\n\n payload[:error] = { message: 'Malformed message from Diego stager', id: DEFAULT_STAGING_ERROR }\n handle_failure(payload, with_start)\n raise CloudController::Errors::ApiError.new_from_details('InvalidRequest')\n end\n\n raise CloudController::Errors::ApiError.new_from_details('InvalidRequest') if build.in_final_state?\n\n app = droplet.app\n no_process_types = payload[:result][:process_types].blank?\n no_app_command = app.newest_web_process&.command.blank?\n\n if no_process_types && no_app_command\n payload[:error] = { message: 'Start command not specified', id: DEFAULT_STAGING_ERROR }\n handle_failure(payload, with_start)\n else\n begin\n save_staging_result(payload)\n rescue => e\n logger.error(logger_prefix + 'saving-staging-result-failed',\n staging_guid: build.guid,\n response: payload,\n error: e.message,\n build: build.inspect,\n droplet: droplet.inspect\n )\n return\n end\n\n begin\n if with_start\n start_process\n else\n Repositories::AppUsageEventRepository.new.create_from_build(build, 'BUILDPACK_SET')\n end\n rescue SidecarSynchronizeFromAppDroplet::ConflictingSidecarsError => e\n payload[:error] = { message: e.message, id: DEFAULT_STAGING_ERROR }\n handle_failure(payload, with_start)\n return\n rescue => e\n logger.error(logger_prefix + 'starting-process-failed', staging_guid: build.guid, response: payload, error: e.message)\n return\n end\n\n BitsExpiration.new.expire_droplets!(app)\n end\n end", "def complete_investigation; end", "def test_scenario2\n data = [[File.dirname(__FILE__)+'/data/iris.csv', \n false, \n File.dirname(__FILE__)+'/tmp/ensemble.json']]\n puts\n puts \"Scenario 2: Successfully creating a local ensemble from an exported file\"\n\n data.each do |filename, pmml, exported_file|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And the source is in the project\"\n assert_equal(source[\"object\"]['project'], @project[\"resource\"])\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And the dataset is in the project\"\n assert_equal(dataset[\"object\"]['project'], @project[\"resource\"])\n \n puts \"An I create a model\"\n ensemble = @api.create_ensemble(dataset, {\"seed\" => 'BigML', 'ensemble_sample'=>{'rate' => 0.7, 'seed' => 'BigML'}})\n\n puts \"And I wait until the ensemble is ready\"\n assert_equal(BigML::HTTP_CREATED, ensemble[\"code\"])\n assert_equal(1, ensemble[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(ensemble), true)\n \n puts \"And I export the <%s> ensemble to <%s>\" % [pmml, exported_file]\n @api.export(ensemble[\"resource\"], exported_file)\n \n puts \"When I create a local ensemble from the file <%s>\" % exported_file\n local_ensemble = BigML::Ensemble.new(exported_file)\n \n puts \"Then the ensemble ID and the local ensemble ID match\"\n assert_equal(local_ensemble.resource_id, ensemble[\"resource\"])\n \n end\n end", "def process\n uploaded_workbook = Spreadsheet.open self.path\n @records_matched = 0\n @records_updated = 0\n @records_failed = 0\n @failed_queries = 0\n @skipped_records = 0\n\n product_sheet = uploaded_workbook.worksheet(0)\n perform(product_sheet)\n\n if not uploaded_workbook.worksheet(1).nil?\n variant_sheet = uploaded_workbook.worksheet(1)\n perform(variant_sheet)\n end\nend", "def process_elasticsearch(target)\n {\n :schema => 'iglu:com.snowplowanalytics.snowplow.storage/elastic_config/jsonschema/1-0-0',\n :data => {\n :name => target['name'],\n :host => target['host'],\n :index => target['database'],\n :port => target['port'],\n :type => target['table'],\n :nodesWanOnly => target['es_nodes_wan_only'],\n :purpose => 'FAILED_EVENTS'\n }\n }\nend", "def test_introspects_properly\n i = Tracksperanto::Import::Syntheyes\n assert_equal 'Syntheyes \"Tracker 2-D paths\" file', i.human_name\n assert !i.autodetects_size?\n assert_not_nil i.known_snags\n assert !i.known_snags.empty?\n end", "def launch_anndata_subparse_jobs\n # reference AnnData uploads don't have extract parameter so exit immediately\n return if params_object.extract.blank?\n\n params_object.extract.each do |extract|\n case extract\n when 'cluster'\n params_object.obsm_keys.each do |fragment|\n Rails.logger.info \"Launching AnnData #{fragment} cluster ingest for #{study_file.upload_file_name}\"\n action = :ingest_cluster\n matcher = { data_type: :cluster, obsm_key_name: fragment }\n cluster_data_fragment = study_file.ann_data_file_info.find_fragment(**matcher)\n name = cluster_data_fragment&.[](:name) || fragment # fallback if we can't find data_fragment\n cluster_gs_url = RequestUtils.data_fragment_url(study_file, 'cluster', file_type_detail: fragment)\n domain_ranges = study_file.ann_data_file_info.get_cluster_domain_ranges(name).to_json\n cluster_params = AnnDataIngestParameters.new(\n ingest_cluster: true, name:, cluster_file: cluster_gs_url, domain_ranges:, ingest_anndata: false,\n extract: nil, obsm_keys: nil\n )\n job = IngestJob.new(study:, study_file:, user:, action:, params_object: cluster_params)\n job.delay.push_remote_and_launch_ingest\n end\n when 'metadata'\n Rails.logger.info \"Launching AnnData metadata ingest for #{study_file.upload_file_name}\"\n action = :ingest_cell_metadata\n metadata_gs_url = RequestUtils.data_fragment_url(study_file, 'metadata')\n metadata_params = AnnDataIngestParameters.new(\n ingest_cell_metadata: true, cell_metadata_file: metadata_gs_url,\n ingest_anndata: false, extract: nil, obsm_keys: nil, study_accession: study.accession\n )\n job = IngestJob.new(study:, study_file:, user:, action:, params_object: metadata_params)\n job.delay.push_remote_and_launch_ingest\n when 'processed_expression'\n Rails.logger.info \"Launching AnnData processed expression ingest for #{study_file.upload_file_name}\"\n action = :ingest_expression\n file_types = %w[matrix features barcodes]\n matrix_gs_url, features_gs_url, barcodes_gs_url = file_types.map do |file_type|\n RequestUtils.data_fragment_url(study_file, file_type, file_type_detail: 'processed')\n end\n exp_params = AnnDataIngestParameters.new(\n matrix_file: matrix_gs_url, matrix_file_type: 'mtx', gene_file: features_gs_url, barcode_file: barcodes_gs_url,\n ingest_anndata: false, extract: nil, obsm_keys: nil\n )\n job = IngestJob.new(study:, study_file:, user:, action:, params_object: exp_params)\n job.delay.push_remote_and_launch_ingest\n end\n end\n end", "def test_scenario5\n data = [ {\"filename\" => File.dirname(__FILE__)+\"/data/diabetes.csv\",\n \"data_input\" => {\"pregnancies\" => 0, \"plasma glucose\" => 118, \"blood pressure\" => 84, \"triceps skin thickness\" => 47, \"insulin\" => 230, \"bmi\" => 45.8, \"diabetes pedigree\" => 0.551, \"age\" => 31, \"diabetes\" => \"true\"}, \n \"centroid\" => \"Cluster 3\"}\n ]\n\n puts\n puts \"Scenario: Successfully creating a centroid and the associated dataset\"\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a \" + item[\"filename\"] + \" file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true) \n\n puts \"And I create cluster\"\n cluster=@api.create_cluster(dataset, {'seed'=>'BigML tests', 'k' => 8, 'cluster_seed' => 'BigML'})\n\n puts \"And I wait until the cluster is ready\"\n assert_equal(BigML::HTTP_CREATED, cluster[\"code\"])\n assert_equal(1, cluster[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(cluster), true)\n\n puts \" When I create a centroid for #{item[\"data_input\"]}\"\n centroid = @api.create_centroid(cluster[\"resource\"], item[\"data_input\"])\n\n puts \" And I check the centroid is ok \"\n assert_equal(BigML::HTTP_CREATED, centroid[\"code\"])\n assert_equal(@api.ok(centroid), true)\n\n puts \"Then the centroid is \" + item[\"centroid\"]\n assert_equal(item[\"centroid\"], centroid[\"object\"][\"centroid_name\"])\n end\n\n end", "def process\n save_as(:processed)\n end", "def imported?\n import_progress[:status] == IMPORT_COMPLETE\n end", "def test_failure_during_process_events_does_not_block_other_processors_from_processing_events\n good_processor_1 = DummyAbstractNoRetryProcessor.new\n exploding_processor = DummyAbstractNoRetryProcessor.new\n def exploding_processor.process_events(events)\n events.each do |event|\n process_event(event)\n end\n events\n end\n def exploding_processor.process_event(event)\n if event.entry_id == 'http://example.com/entry/29'\n raise \"Blowing up on 29!\"\n else\n super(event)\n end\n end\n good_processor_2 = DummyAbstractNoRetryProcessor.new\n \n feed = DummyFeed.new(3)\n log_stream = StringIO.new\n event_broadcaster = ProjectEventBroadcaster.new(\n feed, [good_processor_1, exploding_processor, good_processor_2], \n temp_file, 25, Logger.new(log_stream))\n event_broadcaster.run_once\n \n assert(log_stream.string.index('Unable to complete event processing'))\n assert_equal(\n ['http://example.com/entry/28', 'http://example.com/entry/29', 'http://example.com/entry/30'], \n good_processor_1.processed_events.map(&:entry_id)) \n assert_equal(\n ['http://example.com/entry/28'], \n exploding_processor.processed_events.map(&:entry_id)) \n assert_equal(\n ['http://example.com/entry/28', 'http://example.com/entry/29', 'http://example.com/entry/30'], \n good_processor_2.processed_events.map(&:entry_id)) \n end", "def done?; end", "def test_scenario8\n data = [[File.dirname(__FILE__)+'/data/spam.csv', \n false, \n File.dirname(__FILE__)+'/tmp/topic_model.json',\n {\"fields\" => {\"000001\" => {\"optype\" => \"text\", \"term_analysis\" => {\"case_sensitive\" => true, \"stem_words\" => true, \"use_stopwords\" => false, \"language\" => \"en\"}}}}]]\n puts\n puts \"Scenario 8: Successfully creating a local topic model from an exported file\"\n\n data.each do |filename, pmml, exported_file, options|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I update the source with params <%s>\" % JSON.generate(options)\n source = @api.update_source(source, options)\n assert_equal(BigML::HTTP_ACCEPTED, source[\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And the source is in the project\"\n assert_equal(source[\"object\"]['project'], @project[\"resource\"])\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And the dataset is in the project\"\n assert_equal(dataset[\"object\"]['project'], @project[\"resource\"])\n \n puts \"An I create a topic model\"\n topic_model = @api.create_topic_model(dataset)\n\n puts \"And I wait until the topic model is ready\"\n assert_equal(BigML::HTTP_CREATED, topic_model[\"code\"])\n assert_equal(1, topic_model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(topic_model), true)\n \n puts \"And I export the <%s> topic model to <%s>\" % [pmml, exported_file]\n @api.export(topic_model[\"resource\"], exported_file)\n \n puts \"When I create a local topic model from the file <%s>\" % exported_file\n local_topic_model= BigML::TopicModel.new(exported_file)\n \n puts \"Then the topic model ID and the local topic model ID match\"\n assert_equal(local_topic_model.resource_id, topic_model[\"resource\"])\n \n end\n end", "def test_scenario9\n data = [[File.dirname(__FILE__)+'/data/iris.csv', \n false, \n File.dirname(__FILE__)+'/tmp/time_series.json']]\n puts\n puts \"Scenario 9: Successfully creating a local time series from an exported file\"\n\n data.each do |filename, pmml, exported_file|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And the source is in the project\"\n assert_equal(source[\"object\"]['project'], @project[\"resource\"])\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And the dataset is in the project\"\n assert_equal(dataset[\"object\"]['project'], @project[\"resource\"])\n \n puts \"An I create a topic model\"\n time_series = @api.create_time_series(dataset)\n\n puts \"And I wait until the time series is ready\"\n assert_equal(BigML::HTTP_CREATED, time_series[\"code\"])\n assert_equal(1, time_series[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(time_series), true)\n \n puts \"And I export the <%s> time series to <%s>\" % [pmml, exported_file]\n @api.export(time_series[\"resource\"], exported_file)\n \n puts \"When I create a local time series from the file <%s>\" % exported_file\n local_time_series= BigML::TimeSeries.new(exported_file)\n \n puts \"Then the time_series ID and the local time series ID match\"\n assert_equal(local_time_series.resource_id, time_series[\"resource\"])\n \n end\n end", "def on_end_document()\n\n\t\tif ['PostgreSQL','MySQL'].include?(@source.connection.adapter_name) then\n\t\t\tresolve_ids_sql\n\t\t\t#resolve_ids_activerecord\n\t\telse\n\t\t\tresolve_ids_activerecord\n\t\tend\n\t\t\n\t\tputs UnresolvedId.count(:conditions => {:source_id => @source.id}).to_s + \" unresolved IDs\" if Debug > 3\n\n\t\t# add state_id to streets. this eases later lookup\n\t\t# We use a shortcut when we can, rails convention if we're not sure\n\t\tif ['PostgreSQL','MySQL'].include?(@source.connection.adapter_name) then\n\t\t\tadd_state_to_addresses_sql\n\t\telse\n\t\t\tadd_state_to_addresses_activerecord\n\t\tend\n\n\t\t@source.import_completed_at = Time.now\n\t\t@source.contrib = @contrib unless @contrib.nil?\n\t\t@source.activate!\n\t\t@source.save\n\n\tend", "def done?; true end", "def did_finish\n collector.did_finish\n end", "def start_import(expected_indices)\n claim()\n for index in 0 ... expected_indices.size\n puts @payload[\"collection_count_\" + expected_indices[index]] = 0\n puts @payload[\"collection_finished_\" + expected_indices[index]] = false\n end\n @version = update_with_version(@index_name, @version, [@payload])\n @payload\n end", "def test_scenario3\n data = [{'filename' => File.dirname(__FILE__)+'/data/diabetes.csv',\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions_c.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_c.csv'}]\n\n puts \n puts \"Scenario: Successfully creating a batch prediction for an ensemble\"\n\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a #{item['filename']} file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create cluster\"\n cluster=@api.create_cluster(dataset, {'seed'=>'BigML tests', 'k' => 8, 'cluster_seed' => 'BigML'})\n \n puts \"And I wait until the cluster is ready\"\n assert_equal(BigML::HTTP_CREATED, cluster[\"code\"])\n assert_equal(1, cluster[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(cluster), true)\n\n puts \"When I create a batch centroid for the dataset\"\n batch_prediction = @api.create_batch_centroid(cluster, dataset)\n\n puts \"And I wait until the batch centroid is ready\"\n assert_equal(BigML::HTTP_CREATED, batch_prediction[\"code\"])\n assert_equal(@api.ok(batch_prediction), true)\n \n puts \"And I download the created centroid file to #{item['local_file']}\"\n filename = @api.download_batch_centroid(batch_prediction, item[\"local_file\"])\n assert_not_nil(filename)\n\n puts \"Then the batch centroid file is like #{item['predictions_file']}\"\n assert_equal(FileUtils.compare_file(item[\"local_file\"], item[\"predictions_file\"]), true)\n\n\n end\n end", "def process_loaded_data(_result)\n true\n end", "def ingest_object(row)\n\n @touch = File.join(\"/tmp\", row[\"exportedAs\"])\n \n unless File.exists?(@touch)\n obj = File.join(@directory, File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n sourceFile = File.join(obj,File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n \n if File.exists?(obj)\n # Gets a new PID\n pid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n #testing stuff\n #pid = \"druid:1\"\n \n fedora_obj = AimsDocument.new(:pid => pid)\n fedora_obj.label = File.basename(obj)\n fedora_obj.save\n print obj + \" ===> \"\n # now glob the object directory and makes datastreams for each of the files and add them as datastream to the fedora object.\n # fedora_obj.save\n \n dsid = 'rightsMetadata'\n xml_content = fedora_obj.datastreams_in_memory[dsid].content\n ds = Hydra::RightsMetadata.from_xml(xml_content)\n pid = fedora_obj.pid\n ds.pid = pid\n ds.dsid = dsid\n fedora_obj.datastreams_in_memory[dsid] = ds\n permissions = {\"group\"=>{\"public\"=>\"read\", \"archivist\" => \"edit\", \"researcher\" => \"read\", \"patron\" => 'read', \"donor\" => 'edit' }, \"person\" => {\"archivist1\" => \"edit\"}}\n ds.update_permissions(permissions)\n permissions = {\"group\" => {\"public\"=>\"read\"}}\n ds.update_permissions(permissions)\n \n fedora_obj.save\n \n Dir[\"#{obj}/**/**\"].each do |f|\n \n #damn OS X spotlight. \n unless f.include?('DS_Store')\n \n # text files and jp2000s get added as datastreams in the object. the wordperfect files get added as their own objects\n if f =~ /(.*)\\.(txt)/\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n \n elsif f =~ /(.*)\\.(pdf)/\n fedora_obj.add_datastream(create_file_ds(f, 'pdf', \"#{File.basename(f)}.pdf\"))\n elsif f =~ /(.*)\\.(jp2)/\n # Below is if you want to not have the jp2 imported into fedora. it will just move them to a directory.\n #jp2_dir = File.join('/tmp', fedora_obj.pid.gsub(\"druid:\", \"druid_\"))\n #FileUtils.mkdir_p(jp2_dir) unless File.directory?(jp2_dir)\n #FileUtils.cp(f, jp2_dir, :verbose => true)\n # Below this adds the jp2000s into fedora.\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n\t\t elsif f == sourceFile #source file gets its own fedora object. \n cpid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n child_obj = FileAsset.new(:pid => cpid)\n child_obj.label = File.basename(f)\n dc = child_obj.datastreams['descMetadata']\n dc.extent_values << File.size(f)\n \n \n fedora_obj.add_relationship(:has_part, child_obj )\n fedora_obj.add_relationship(:has_collection_member, child_obj)\n puts \"processing:#{f} for objectID #{cpid}\"\n ext = File.extname(f)\n id = \"DS1\"\n label = File.basename(f)\n child_obj.add_datastream(create_file_ds(f, id, label ))\n child_obj.save\n print f + \"\\n\"\n else\n puts \"not a file to ingest ==> #{f}\"\n end #if\n end #unless\n end #dir\n \n dm = fedora_obj.datastreams[\"descMetadata\"]\n prop = fedora_obj.datastreams[\"properties\"]\n \n labels = row[\"labels\"].split(',')\n \n loutput = {\"subjects\" => [], \"access\" => []}\n doc_values = { \"D\" => \"Document\", \"S\" => \"Spreadsheet\", \"E\" => \"Email\", \"IM\" => \"Image\", \"V\" => \"Video\", \"SO\" => \"Sound\"} \n comp_values = {\"CM:5.25\" => \"5.25 inch. floppy diskettes\", \"CM:3.5\" => \"3.5 inch. floppy diskettes\", \"CM:P\" => \"Punch cards\", \"CM:T\" => \"Tape\" }\n access_values = {\"O\" => \"owner\", \"A\" => \"Archivists\", \"I\" => \"Invited\", \"P\" =>\"Public\", \"M\"=>\"Reading\"}\n \n \n labels.each do |l|\n if doc_values.has_key?(l)\n loutput[\"doctype\"] = doc_values[l]\n elsif comp_values.has_key?(l)\n loutput[\"mediatype\"] = comp_values[l]\n elsif access_values.has_key?(l)\n loutput[\"access\"] << access_values[l]\n elsif l.include?(\"S:\")\n loutput[\"subjects\"] << l.gsub(\"S:\", '') \n end #if\n end #do\n \n pp(loutput)\n prop.collection_values << \"Steven J. Gould\"\n prop.pages_values << number_of_pages(fedora_obj)\n prop.path_values << row['path']\n prop.file_size_values << row['size']\n prop.md5_values << row['md5']\n prop.sha1_values << row['sha1']\n prop.file_type_values << row['type']\n prop.filename_values << File.basename(obj)\n \n dm.isPartOf_values = row[\"subseries\"].gsub(/[0-9]|Bookmark:|\\./,\"\").strip\n dm.source_values << row['filename']\n dm.type_values << loutput['doctype']\n dm.format_values << loutput[\"mediatype\"]\n \n \n \n loutput['subjects'].each { |s| dm.subject_values << s.gsub(\"S:\", \"\") }\n \n dm.save\n prop.save\n fedora_obj.save\n\n solr_doc = fedora_obj.to_solr\n solr_doc << Solr::Field.new( :discover_access_group_t => \"public\" )\n ActiveFedora::SolrService.instance.conn.update(solr_doc)\n FileUtils.mkdir_p(@touch)\n end #unless\n end #if exists? \n rescue Exception => e \n puts e.backtrace\n\tputs \"erroring....\"\n sleep(300)\n return nil\n rescue Timeout::Error => e\n puts \"timeout error ....\" \n sleep(350)\n\n \n end", "def test_batch_hooks\n assert_equal(false, Job.batch_exist?(@batch_id))\n\n assert_nothing_raised do\n 5.times { Resque.enqueue(Job, @batch_id, \"arg#{rand(100)}\") }\n end\n\n assert_equal(false, $batch_complete)\n assert_equal(false, Job.batch_complete?(@batch_id))\n assert(Job.batch_exist?(@batch_id))\n\n assert_nothing_raised do\n 4.times { Resque.reserve(:test).perform }\n end\n\n assert_equal(false, $batch_complete)\n assert_equal(false, Job.batch_complete?(@batch_id))\n assert(Job.batch_exist?(@batch_id))\n\n assert_nothing_raised do\n Resque.reserve(:test).perform\n end\n\n assert($batch_complete)\n assert(Job.batch_complete?(@batch_id))\n assert_equal(false, Job.batch_exist?(@batch_id))\n end", "def test_result_download\n T2Server::Run.create($uri, WKF_PASS, $creds, $conn_params) do |run|\n assert_nothing_raised(T2Server::AttributeNotFoundError) do\n file = run.upload_file(FILE_STRS)\n run.input_port(\"IN\").remote_file = file\n run.generate_provenance(true)\n end\n\n if run.server.version >= \"2.5.4\"\n assert(run.generate_provenance?)\n else\n refute(run.generate_provenance?)\n end\n\n run.start\n run.wait\n\n # Get total data size (without downloading the data).\n assert_equal(run.output_port(\"OUT\").total_size, 100)\n assert_equal(run.output_port(\"OUT\").size, 100)\n\n # Stream just the first 10 bytes.\n stream = \"\"\n run.output_port(\"OUT\").value(0...10) do |chunk|\n stream += chunk\n end\n assert_equal(stream, \"123456789\\n\")\n\n # Get just the second 10 bytes.\n assert_equal(run.output_port(\"OUT\").value(10...20),\n \"223456789\\n\")\n\n # Stream the first 20 bytes.\n stream = \"\"\n run.output_port(\"OUT\").value(0...20) do |chunk|\n stream += chunk\n end\n assert_equal(stream, \"123456789\\n223456789\\n\")\n\n # Get a bad range - should return the first 10 bytes.\n assert_equal(run.output_port(\"OUT\").value(-10...10),\n \"123456789\\n\")\n\n # Stream the lot and check total length. There should be two chunks.\n stream = \"\"\n run.output_port(\"OUT\").value do |chunk|\n stream += chunk\n end\n assert_equal(stream.length, 100)\n\n # Now get the lot and check its size.\n out = run.output_port(\"OUT\").value\n assert_equal(out.length, 100)\n\n # test streaming provenance data\n if run.server.version >= \"2.5.4\"\n assert_nothing_raised(T2Server::AccessForbiddenError) do\n prov_cache = TestCache.new\n prov_size = run.provenance(prov_cache)\n assert_not_equal(prov_size, 0)\n assert_not_equal(prov_cache.data, \"\")\n end\n else\n assert_raise(T2Server::AccessForbiddenError) do\n prov_cache = TestCache.new\n prov_size = run.provenance(prov_cache)\n assert_equal(prov_size, 0)\n assert_equal(prov_cache.data, \"\")\n end\n end\n\n assert(run.delete)\n end\n end", "def process tweet, *_\n @aggregator << tweet.to_hash\n if @aggregator.size == options.buffered_docs\n response = @indexer.index_array(@aggregator)\n raise \"Your motherfucking bulk request failed.\" if response.has_failures?\n warn(\"Success\")\n @aggregator = []\n end\n end", "def test_oneshot_has_forced_segmentation\n omit_if(@service.splunk_version[0] == 4)\n stream = @service.create_oneshot(\"search index=_internal GET | head 3\",\n :segmentation => \"raw\")\n assert_true(stream.include?(\"<sg\"))\n end", "def done\n get_stories_by_iteration(\"done\")\n end", "def file_finished(file, offenses); end", "def done\n raise NotImplementedError\n end", "def test_update_status\n batch = batches(:batch4)\n job_one = Job.create(:batch=>batch,:tiff_number=>1234,:check_number=>12131,:count=>12, :job_status => 'Complete', :estimated_eob => 12)\n job_two = Job.create(:batch=>batch,:tiff_number=>1231,:check_number=>12135,:count=>12, :job_status => 'Allocated', :estimated_eob => 12)\n\n # Check for complete\n job_two.job_status = 'Complete'\n job_two.update\n\n batch.update_status\n assert_equal 'Complete', batch.status\n assert_in_delta(batch.completion_time.to_i, Time.now.to_i,1)\n\n # Check for processing\n job_one.job_status = 'Processing'\n job_one.update\n batch.update_status\n assert_equal('Processing', batch.status)\n assert_nil batch.completion_time\n\n # Check for new\n job_one.job_status = 'New'\n job_one.update\n job_two.job_status = 'New'\n job_two.update\n batch.update_status\n assert_equal 'New', batch.status\n assert_nil batch.completion_time\n\n # one new and one complete\n job_one.job_status = 'New'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'Processing', batch.status\n assert_nil batch.completion_time\n\n # QA Rejected\n job_one.job_status = 'QA Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'Processing', batch.status\n assert_nil batch.completion_time\n\n # one HLSC Rejected and the other Complete\n job_one.job_status = 'HLSC Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Rejected', batch.status\n job_one.job_status = 'Complete'\n job_one.update\n batch.update_status\n assert_equal 'Complete', batch.status\n\n # All HLSC Verified\n job_one.job_status = 'HLSC Verified'\n job_one.update\n job_two.job_status = 'HLSC Verified'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Verified', batch.status\n\n # One HLSC Rejected and one processor allocated\n job_one.job_status = 'HLSC Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Rejected', batch.status\n end" ]
[ "0.63798815", "0.6270631", "0.6208013", "0.5848671", "0.577947", "0.5632209", "0.562226", "0.54872626", "0.5420143", "0.5402963", "0.53982854", "0.53874266", "0.53650314", "0.5339857", "0.53220147", "0.529509", "0.5269367", "0.5266903", "0.52645147", "0.52600604", "0.52368826", "0.52113694", "0.5161623", "0.51579016", "0.5142534", "0.5131534", "0.5127077", "0.51147735", "0.51144946", "0.5103231", "0.50901157", "0.5087615", "0.50843745", "0.50777495", "0.50777495", "0.50728", "0.50634634", "0.50408727", "0.50398034", "0.5038469", "0.5025871", "0.5017288", "0.4993893", "0.49928427", "0.49913567", "0.49856994", "0.4965204", "0.49647868", "0.49640957", "0.4954834", "0.49531466", "0.49109238", "0.49063084", "0.49056166", "0.49052984", "0.49045154", "0.49022177", "0.48863843", "0.4878305", "0.4878106", "0.48749173", "0.48704016", "0.48552868", "0.48534787", "0.48505464", "0.48481354", "0.48463166", "0.48266032", "0.48229578", "0.4811398", "0.4809622", "0.4801983", "0.47991782", "0.4791419", "0.47908464", "0.47830343", "0.47743514", "0.47695053", "0.47689447", "0.4763718", "0.47634923", "0.47633561", "0.47608143", "0.47603965", "0.47587964", "0.47562888", "0.4755787", "0.47555053", "0.47553834", "0.4753799", "0.47526938", "0.47489366", "0.47428346", "0.47413152", "0.47356564", "0.47336254", "0.4731199", "0.47311383", "0.47283536", "0.47262457", "0.47261572" ]
0.0
-1
an empty variable for all methods
def print_menu puts "\n1. Input the students" puts "2. Show the students" puts "3. Save the list to file" puts "4. Load the list from file" puts "9. Exit" # '9' beacuse we'll be adding more. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nothing; end", "def empty()\n \n end", "def nothing\nend", "def methods() end", "def empty!; end", "def methods=(_arg0); end", "def empty_function\nend", "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 methods; end", "def methods; end", "def methods; end", "def methods; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def unused\n end", "def variable; end", "def variable; end", "def method_one; end", "def []=(*) end", "def meth x = nil\nend", "def method_missing(*)\n invertable nil\n end", "def anonymous?; end", "def noop\n -> { }\n end", "def incomplete\r\n\r\n end", "def ___\n Blank.()\n end", "def main_variable ; end", "def private; end", "def -@()\n #This is a stub, used for indexing\n end", "def method=(_); end", "def reset!; end", "def reset!; end", "def reset!; end", "def reset!; end", "def clear!; end", "def clear!; end", "def clear!; end", "def null\n end", "def -@; end", "def final; end", "def global; end", "def ignores; end", "def suivre; end", "def method_one\n end", "def method_one\n end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def nothing(_)\n end", "def method_undefined(*) end", "def result=(_); end", "def isolated; end", "def isolated; end", "def initialize\n empty!\n end", "def initialize\n empty!\n end", "def variables; end", "def variables; end", "def reset()\n \n end", "def instance_variables() end", "def clear; end", "def clear; end", "def clear; end", "def clear; end", "def clear; end", "def clear; end", "def clear; end" ]
[ "0.69905114", "0.6975272", "0.67242306", "0.6712875", "0.670391", "0.6679789", "0.6642516", "0.65114075", "0.65114075", "0.65114075", "0.65114075", "0.65114075", "0.65114075", "0.65114075", "0.65114075", "0.65114075", "0.65114075", "0.65114075", "0.65114075", "0.6484146", "0.6484146", "0.6484146", "0.6484146", "0.6480549", "0.6480549", "0.6480549", "0.6480549", "0.6480549", "0.6480549", "0.6480549", "0.6480549", "0.6480549", "0.6480549", "0.6480549", "0.6480549", "0.644354", "0.6417092", "0.6417092", "0.6416616", "0.6395492", "0.63638043", "0.63515294", "0.6336432", "0.6316378", "0.6313989", "0.6311882", "0.62998086", "0.62921464", "0.62902546", "0.62830275", "0.6279571", "0.6279571", "0.6279571", "0.6279571", "0.6276911", "0.6276911", "0.6276911", "0.62592316", "0.62530947", "0.6250603", "0.62478405", "0.6245632", "0.6237369", "0.62333584", "0.62333584", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62105197", "0.62099534", "0.62010705", "0.61684746", "0.6165979", "0.6165979", "0.61587113", "0.61587113", "0.61575943", "0.61575943", "0.61526334", "0.61508304", "0.61426", "0.61426", "0.61426", "0.61426", "0.61426", "0.61426", "0.61426" ]
0.0
-1
Locates a record according to the current scope. Returns the record if found. If not found, creates a new record with the attributes of the current scope and the provided attributes.
def find_or_create(*args, &block) find_or_initialize_and_do :save, *args, &block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_existing_record\n @record = record_class.find(@locator)\n end", "def find_existing_record\n @record = record_class.find(@locator)\n end", "def replicate_find_existing_record(attributes)\n return if replicate_natural_key.empty?\n conditions = {}\n replicate_natural_key.each do |attribute_name|\n conditions[attribute_name] = attributes[attribute_name.to_s]\n end\n if ::ActiveRecord::VERSION::MAJOR >= 4\n where(conditions).first\n else\n find(:first, :conditions => conditions)\n end\n end", "def find_or_create_by!(attributes, &block)\n find_by(attributes) || create!(attributes, &block)\n end", "def create_or_update_by_some( attrs={} )\n attrs = extract_ar_object_ids( attrs )\n conditions = attrs.delete( :find_by )\n raise 'You must provide a :find_by hash of attributes to search with, ie. :find_by => {:id => 1}' unless conditions\n attrs.merge!( conditions )\n record = find( :first, :conditions => conditions ) || self.new\n record.attributes = attrs\n record.save!\n record\n end", "def find_or_create_by(attributes, &block)\n find_by(attributes) || create(attributes, &block)\n end", "def find_or_create_by(attrs = {}, &block)\n find_or(:create, attrs, &block)\n end", "def first_or_create!(attributes)\n remote = self.search(attributes).first\n remote ||= self.create!(attributes)\n remote\n end", "def find_or_create_by(attributes)\n find_by(attributes) || create(attributes)\n end", "def find_or_create_by(attributes, &block)\n result = find_or_initialize_by(attributes, &block)\n result.save! unless result.persisted?\n result\n end", "def create_or_find_by(attributes, &block)\n transaction(requires_new: true) { create(attributes, &block) }\n rescue ::ActiveRecord::RecordNotUnique\n find_by!(attributes)\n end", "def first_or_create(attributes)\n remote = self.search(attributes).first\n remote ||= self.create(attributes)\n remote\n end", "def find_record\n @record ||= model.find_by_id(params[:id])\n end", "def find_record\n if record\n self.new_session = false\n return record\n end\n \n find_with.each do |find_method|\n if send(\"valid_#{find_method}?\")\n self.new_session = false\n return record\n end\n end\n nil\n end", "def find_single(scope, options, instantiate=true)\n prefix_options, query_options = split_options(options[:params])\n path = element_path(scope, prefix_options, query_options)\n record = format.decode(connection.get(path, headers).body)\n if instantiate\n instantiate_record(record, prefix_options)\n else\n record\n end\n end", "def set_record(id = nil, pid = nil)\n unless id.to_i > 0 && self.record = resource_model.includes(includes).find(id.to_i)\n self.record = resource_model.where((pid && where) ? where.call(pid) : {}).new\n self.record.attributes = create_attributes\n end\n end", "def update_or_create(attributes = {})\n id = attributes.delete(:id)\n conditions = attributes.delete(:conditions)\n\n returning (id && find_by_id(id)) || find(:first, :conditions => conditions) || new do |record|\n attributes.each_pair { |key, value| record[key] = value }\n record.save\n end\n end", "def first_or_new(conditions = {}, attributes = {})\n first(conditions) || new(conditions.merge(attributes))\n end", "def first_or_new(conditions, attributes = {})\n first(conditions) || new(conditions.merge(attributes))\n end", "def first_or_create(conditions = {}, attributes = {})\n first(conditions) || create(conditions.merge(attributes))\n end", "def first_or_create(conditions, attributes = {})\n first(conditions) || create(conditions.merge(attributes))\n end", "def find_entry\n ms = model_scope\n result = nil\n if params[:id]\n # Requests that retrieve existing records (e.g. show, edit, update, destroy) set an 'id' param\n # The +find+ method raises ActiveRecord::RecordNotFound if no database item has this primary key\n result = ms.find(params[:id])\n elsif params[ms.primary_key]\n # Primary key is a single value provided in the params hash\n # This modification allows the create action to succeed even if the item already exists\n # The +where...first+ methods returns the item from the database or nil if not found\n result = ms.where(ms.primary_key => params[ms.primary_key]).first\n elsif ms.primary_key.instance_of? CompositePrimaryKeys::CompositeKeys\n # primary key is composed of multiple values\n if (ms.primary_key - params.keys).empty?\n # param values are present for all the primary keys\n pk_values = ms.primary_key.map{|k| params[k]}\n result = ms.find(pk_values)\n end\n end\n result\n end", "def retrieve_record(key, attributes = {})\n unless fetch = @stubs[key]\n raise ActiveRecord::RecordNotFound, \"Could not find the record defined by '#{key}'.\"\n end\n fetch.record(attributes)\n end", "def find_single(scope, options)\n context = options[:context] || {}\n reload_fields_definition(false)\n fields = options[:fields] || options[:only] || fast_fields(options)\n fields += options[:include] if options[:include]\n \n if scope\n is_collection, records = read_scope(context, fields, scope)\n else\n is_collection, records = read_domain(context, fields, options)\n end\n active_resources = []\n records.each { |record| active_resources << new(record, [], true)}\n if is_collection\n active_resources\n else\n active_resources[0]\n end\n end", "def find_record\n if @zone.nil?\n if @resource[:zoneid] != 'absent' then\n @zone = zone_by_id @resource[:zoneid]\n if @zone.nil? then\n self.fail \"No zone with id: #{@resource[:zoneid]}\"\n end\n else\n @zone = zone_by_name @resource[:zone]\n if @zone.nil? then\n self.fail \"No such zone: #{@resource[:zone]}\"\n end\n end\n end\n @records = @zone.records\n @records.each do |record|\n if record.name == @resource[:record]\n return record\n end\n end\n return nil\n end", "def first_or_create(attrs = {})\n fetch.first || create(attrs)\n end", "def find_or_initialize_by(attrs = {}, &block)\n find_or(:new, attrs, &block)\n end", "def first_or_initialize(attributes)\n remote = self.search(attributes).first\n remote ||= self.new(attributes)\n remote\n end", "def first_or_create!(attributes={}, &block)\n result = first\n unless result\n attributes = @options[:hash].merge(attributes) if @options[:hash]\n result = create!(attributes, &block)\n end\n result\n end", "def find_model(attributes)\n model.find(:first, :conditions => { key => attributes[key] })\n end", "def get_record\n recordset = self.get_recordset\n find_by_fields = self.get_find_by_fields\n find_by_key = self.get_model.primary_key\n\n # Find by another column if it's permitted.\n if find_by_query_param && params[find_by_query_param].in?(find_by_fields)\n find_by_key = params[find_by_query_param]\n end\n\n # Filter recordset, if configured.\n if self.filter_recordset_before_find\n recordset = self.get_filtered_data(recordset)\n end\n\n # Return the record.\n if find_by_value = params[:id] # Route key is always :id by Rails convention.\n return self.get_recordset.find_by!(find_by_key => find_by_value)\n end\n return nil\n end", "def create_record(attribute_names = nil)\n record_timestamps!\n attribute_names ||= keys_for_partial_write\n attributes_values = arel_attributes_with_values_for_create(attribute_names)\n\n new_id = self.class.unscoped.insert attributes_values\n self.id = new_id if self.class.primary_key\n\n @new_record = false\n id\n end", "def find_record\n if @zone.nil?\n if @resource[:zoneid] != 'absent' then\n @zone = @resource[:zoneid]\n else\n @zone = zone_by_name @resource[:zone]\n if @zone.nil? then\n self.fail \"No such zone: #{@resource[:zone]}\"\n end\n end\n end\n connection.list_resource_record_sets(hosted_zone_id: @zone, start_record_name: @resource[:record], start_record_type: @resource[:type]).resource_record_sets.each do |record|\n if record.name == @resource[:record] && record.type == @resource[:type]\n return record\n end\n end\n return nil\n end", "def set_record\n @record = params[:id] ? Record.friendly.find(params[:id]) : Record.new(record_params)\n end", "def create(attributes = {})\n resource = repository.scope { model.create(default_attributes.update(attributes)) }\n self << resource unless resource.new_record?\n resource\n end", "def find_record\n record_id = params[:record_id] || params[:id]\n @record = Record.where(medical_record_number: record_id).first\n not_found if @record.nil?\n end", "def get_record(identifier)\n find_by(**id_term(identifier))\n end", "def find_record(relation = nil)\n if locate_id.nil? || (locate_id.is_a?(::Numeric) && locate_id == 0) || (locate_id.to_s == '')\n return -1\n end\n\n dataset = load_records(relation, false)\n return -1 if dataset.blank?\n\n first_item = dataset.first\n klass = first_item.class\n\n id_field = klass.respond_to?('primary_key') ? klass.primary_key : nil\n id_field ||= first_item.respond_to?('id') ? 'id' : nil\n\n return -1 unless id_field\n if locate_id.is_a?(::Numeric)\n dataset.index{|item| item.send(id_field) == locate_id} || -1\n else\n loc_id = locate_id.to_s.downcase\n dataset.index{|item| item.send(id_field).to_s.downcase == loc_id} || -1\n end\n\n end", "def find_or_create(model, hash)\n model.send(:where, hash).last || model.send(:create, hash)\n end", "def find_by_attributes\n Hash[@ucrm_local_id_field, id]\n end", "def first_or_create!(attributes = nil, options = {}, &block)\n first || create!(attributes, options, &block)\n end", "def get_person\n if params[:id]\n p = @scope.find(params[:id])\n elsif params[:padma_id]\n p = @scope.find_by_padma_id(params[:padma_id])\n if p.nil?\n current_user.padma.person(params[:padma_id])\n p = @scope.build(:name => pp[\"name\"], :surname => pp[\"surname\"], :padma_id => pp[\"id\"], :synced_at => Time.now)\n if !p.save\n p = nil\n end\n end\n end\n # TODO if p.nil? raise 404 ?\n return p\n end", "def first_or_create(query_attrs = {}, resource_attrs = {})\n conditions(query_attrs)\n klass = Parse::Model.find_class self.table\n if klass.blank?\n raise ArgumentError, \"Parse model with class name #{self.table} is not registered.\"\n end\n hash_constraints = constraints(true)\n klass.first_or_create(hash_constraints, resource_attrs)\n end", "def create_record(attribute_names = @attributes.keys)\n # ****** BEGIN PARTITIONED PATCH ******\n if self.id.nil? && self.class.respond_to?(:prefetch_primary_key?) && self.class.prefetch_primary_key?\n self.id = self.class.connection.next_sequence_value(self.class.sequence_name)\n attribute_names |= [\"id\"]\n end\n\n if self.class.respond_to?(:partition_keys)\n attribute_names |= self.class.partition_keys.map(&:to_s)\n end\n # ****** END PARTITIONED PATCH ******\n\n attributes_values = arel_attributes_with_values_for_create(attribute_names)\n\n new_id = self.class.unscoped.insert attributes_values\n self.id ||= new_id if self.class.primary_key\n\n @new_record = false\n id\n end", "def find_or_create_by_name(name_to_find)\n found = self.find_by_name(name_to_find)\n if found == nil\n found = self.new(name_to_find)\n found.save\n end\n found\n end", "def create(attributes = {})\n # remove method reference symbol\n key = attributes[:as]\n attributes.except! :as\n\n # alternate syntax to define attributes\n if block_given?\n klass_instance = @klass.new\n yield klass_instance\n attributes = klass_instance.attributes\n end\n\n # finder criteria\n criteria = @finder || attributes.keys.first\n\n # okey, let's do it\n entry = @klass.send(\"find_or_create_by_#{criteria}\", attributes)\n @base.entries[key] = entry if key\n entry\n end", "def create(params = {}, attributes = {})\n raise ArgumentError.new(\"Record already exists for '#{params[:id]}'\") if self.is_exist?(params[:id])\n if self.validates_presence\n self.validates_presence.each do |field|\n raise ArgumentError.new(\"Missing required field '#{field}'\") unless params[field]\n end\n end\n o = self.new\n o.id = params[:id].nil? ? o.next_id : params[:id]\n params[:rho__id] = params[:id]\n populate_model(o,params)\n populate_attributes(o,attributes)\n end", "def first_or_create!(attrs = nil, &block)\n first_or(:create!, attrs, &block)\n end", "def find_record\n self.class.resource_model.find(params[:id])\n end", "def _create_record(&block)\n attributes_values = changes.map{|k, v| [k.to_sym, v.last]}.to_h\n attributes_values.delete(:Id)\n\n new_id = self.class.unscoped.insert attributes_values\n self.id ||= new_id if self.class.primary_key\n\n @new_record = false\n\n yield(self) if block_given?\n\n id\n end", "def find_record(item, no_raise: false, meth: nil, **opt)\n # noinspection RubyMismatchedReturnType\n return item if item.nil? || item.is_a?(record_class)\n meth ||= __method__\n record = error = id = nil\n\n id_key = opt.key?(:id_key) ? opt[:id_key] : id_column\n if id_key\n opt.merge!(item) if item.is_a?(Hash)\n opt.reverse_merge!(id_term(item, **opt))\n id = opt[id_key] || opt[alt_id_key(opt)]\n if id && (id_key == id_column)\n record = record_class.find(id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif id\n record = record_class.find_by(id_key => id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n else\n error = \"#{id_key} value given\"\n end\n error &&= \"No #{record_name} #{error}\"\n else\n error = \"#{record_name}: :id_key set to nil\"\n end\n\n if record\n record\n elsif !id\n Log.info { \"#{meth}: #{error} (no record specified)\" }\n raise_failure(:file_id) unless no_raise\n elsif no_raise\n # noinspection RubyMismatchedReturnType\n Log.warn { \"#{meth}: #{error} (skipping)\" }\n else\n Log.error { \"#{meth}: #{error}\" }\n raise_failure(:find, item) unless no_raise\n end\n end", "def first_or_create(attrs = nil, &block)\n first_or(:create, attrs, &block)\n end", "def _create_record(attribute_names = self.attribute_names)\n attribute_names = attributes_for_create(attribute_names)\n\n new_id = self.class._insert_record(\n attributes_with_values(attribute_names)\n )\n\n self.id ||= new_id if @primary_key\n @new_record = false\n @previously_new_record = true\n \n yield(self) if block_given?\n \n if self.class.connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter)\n new_id\n else\n id\n end\n end", "def load_by(attrs)\n record = Persister.for(@decorated.class).find(attrs)\n\n unless record\n raise Dirt::MissingRecordError.new(\"No record matches #{attrs.collect { |pair| pair.join(' == ') }.join(', ')}.\")\n end\n\n chameleonize(record)\n\n self\n end", "def _create_record(attribute_names = self.attribute_names)\n attribute_names = attributes_for_create(attribute_names)\n\n returning_columns = self.class._returning_columns_for_insert\n\n returning_values = self.class._insert_record(\n attributes_with_values(attribute_names),\n returning_columns\n )\n\n returning_columns.zip(returning_values).each do |column, value|\n _write_attribute(column, value) if !_read_attribute(column)\n end if returning_values\n\n @new_record = false\n @previously_new_record = true\n\n yield(self) if block_given?\n\n id\n end", "def find_single(scope, options)\n return nil if scope.nil?\n old_find_single(scope, options)\n end", "def find(model, id)\n key = model.primary_key\n condition = {\"#{key}\" => id}\n data = store.read(condition, table: table_name).first\n fail RecordNotFound.new(condition, table_name) unless data\n\n model.new data\n end", "def build(attributes = {})\n Record.new(self, attributes)\n end", "def create_rec(attrs = {})\n create_card_recommendation(offer_id: offer.id, person_id: person.id).tap do |rec|\n rec.update!(attrs)\n end\n end", "def find_record\n record_id = params[:record_id] || params[:id]\n @record = Record.where(medical_record_number: record_id).first\n raise RequestError.new(404) if @record.nil?\n end", "def find_record\n @record = reply_address.record\n end", "def nested_attributes_with_existing_records_for(*args)\n existing_args = args.last.is_a?(Hash) ? args[0...-1] : args.dup\n accepts_nested_attributes_for *args\n add_existing_records_to_nested_attributes_for *existing_args\n end", "def find_record(name, type = 'A')\n # Find the record\n response = @route53.client.list_resource_record_sets({\n :hosted_zone_id => @hosted_zone_id,\n :start_record_name => name,\n :start_record_type => type,\n :max_items => 1\n })\n\n record = nil\n if response && response.data\n if response.data[:resource_record_sets] && response.data[:resource_record_sets].size > 0\n response_record = response.data[:resource_record_sets][0]\n if (response_record[:name] == name || response_record[:name] == \"#{name}.\") && response_record[:type] == type\n record = Route53Record.new(response_record[:name], response_record[:type], response_record[:ttl], response_record[:resource_records][0][:value])\n end\n end\n end\n\n record\n end", "def find_record(item, no_raise: false, meth: nil, **opt)\n return item if item.nil? || item.is_a?(record_class)\n meth ||= __method__\n record = error = id = sid = nil\n id_key = opt.key?(:id_key) ? opt[:id_key] : id_column\n sid_key = opt.key?(:sid_key) ? opt[:sid_key] : sid_column\n if id_key || sid_key\n opt.merge!(item) if item.is_a?(Hash)\n opt.reverse_merge!(id_term(item, **opt))\n id = id_key && (opt[id_key] || opt[alt_id_key(opt)])\n sid = sid_key && opt[sid_key]\n if valid_sid?(id)\n if sid && (id != sid)\n Log.warn { \"#{meth}: id: #{id.inspect}, but sid: #{sid.inspect}\" }\n end\n id, sid = [nil, id]\n elsif id && sid\n Log.debug do\n \"#{meth}: choosing id: #{id.inspect} over sid: #{sid.inspect}\"\n end\n end\n if id && (id_key == id_column)\n record = record_class.find(id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif id\n record = record_class.find_by(id_key => id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif sid\n record = record_class.find_by(sid_key => sid)\n error = \"for #{sid_key} #{sid.inspect}\" unless record\n else\n error = '%s value given' % [id_key, sid_key].compact.join(' or ')\n end\n error &&= \"No #{record_name} #{error}\"\n else\n error = \"#{record_name}: both :id_key and :sid_key set to nil\"\n end\n if record\n record\n elsif !id && !sid\n Log.info { \"#{meth}: #{error} (no record specified)\" }\n raise_failure(:file_id) unless no_raise\n elsif no_raise\n # noinspection RubyMismatchedReturnType\n Log.warn { \"#{meth}: #{error} (skipping)\" }\n else\n Log.error { \"#{meth}: #{error}\" }\n raise_failure(:find, item) unless no_raise\n end\n end", "def find_existing_record_after_reassociating(klass, obj_hash)\n obj_hash_clone = update_association_fields(klass, obj_hash.clone)\n existing_record = find_record_by_unique_index(klass, obj_hash_clone)\n if existing_record\n # Since existing_record was found, update original obj_hash\n update_association_fields(klass, obj_hash)\n existing_record\n end\n end", "def find_first(options = {})\n construct_scope(options).first\n end", "def existing\n return self.class.find_by_unique_id(unique_id)\n end", "def add_evidence!(attributes)\n self.evidence = Evidence.where(name: attributes[1]).first_or_create! \n self.save!\n end", "def find_or_create(*args)\n result = find(*args)\n result.empty? ? create!(*args) : result.first\n end", "def find_single(scope)\n path = element_path(scope)\n self.new(connection.get(path))\n end", "def get_record(item, **opt)\n find_by(**id_term(item, **opt))\n end", "def set_record\n begin\n found_record = Record.find(params[:id])\n @record = found_record\n rescue\n raise ActionController::RoutingError.new('Not Found')\n end\n end", "def lookup(arg)\n instance = lookup_without_default(arg)\n instance ||= build_default(arg)\n\n instance.send(\"#{owner_class_sym}=\", @owner) if @owner.new_record?\n\n instance\n end", "def read(attrs)\n new(attrs).instance_eval do\n @new_record = false\n @dirty = false\n self\n end\n end", "def find(class_or_classname, record_id)\n class_or_classname = find_or_materialize(class_or_classname)\n result = http_get(\"/services/data/v#{self.version}/sobjects/#{class_or_classname.sobject_name}/#{record_id}\")\n response = JSON.parse(result.body)\n new_record = class_or_classname.new\n class_or_classname.description[\"fields\"].each do |field|\n set_value(new_record, field[\"name\"], response[key_from_label(field[\"label\"])] || response[field[\"name\"]], field[\"type\"])\n end\n new_record\n end", "def _create_record(attribute_names = self.attribute_names)\n # ****** BEGIN PARTITIONED PATCH ******\n if self.id.nil? && self.class.respond_to?(:prefetch_primary_key?) && self.class.prefetch_primary_key?\n self.id = self.class.connection.next_sequence_value(self.class.sequence_name)\n attribute_names |= [\"id\"]\n end\n\n if self.class.respond_to?(:partition_keys)\n attribute_names |= self.class.partition_keys.map(&:to_s)\n end\n # ****** END PARTITIONED PATCH ******\n\n attributes_values = arel_attributes_with_values_for_create(attribute_names)\n\n new_id = self.class.unscoped.insert attributes_values\n self.id ||= new_id if self.class.primary_key\n\n @new_record = false\n id\n end", "def find_record\n self.class.model_klass.find(params[:id])\n end", "def find_single_record zone, name, content, type = 'A'\n get_records(zone, name).values.each do |rec|\n if rec['zone_name'] == zone \\\n && rec['display_name'] == name \\\n && rec['content'] == content \\\n && rec['type'] == type\n return rec\n end\n end\n nil\n end", "def new(attributes = {})\n resource = repository.scope { model.new(default_attributes.update(attributes)) }\n self << resource\n resource\n end", "def find_or_create\n cc = ConditionsConstructor.new([\"unique_id = ? and name = ?\", unique_id, name])\n cc.add([\"ticker = ?\", ticker]) unless ticker.blank?\n if security = self.class.find(:first, :conditions => cc.conditions)\n return security\n else\n save!\n return self\n end\n end", "def find_existing_record(klass, obj_hash, importer: nil)\n if klass == User\n # The index for css_id has an odd column name plus find_by_css_id is faster.\n User.find_by_css_id(obj_hash[\"css_id\"])\n elsif klass == Organization\n # The url may need to be converted into a clean url\n Organization.unscoped.find_by_url(obj_hash[\"url\"])\n elsif klass == Appeal\n # uuid is not a uniq index, so can't rely on importer to do it automatically\n Appeal.find_by(uuid: obj_hash[\"uuid\"])\n elsif [Organization, Veteran, Person].include?(klass)\n # Let importer find it using the fallback: klass.unscoped.find_by(unique_field: obj_hash[unique_field])\n nil\n end\n end", "def create(attrs = {})\n record = new(attrs)\n record.save\n record\n end", "def _find_record(options)\n if options && options[:lock]\n self.class.preload(strict_loaded_associations).lock(options[:lock]).find_by!(hid: hid)\n else\n self.class.preload(strict_loaded_associations).find_by!(hid: hid)\n end\n end", "def find(conditions = EMPTY_HASH)\n new(restricted_relation(conditions))\n end", "def find(record_id)\n result = DATABASE.execute(\"SELECT * FROM #{table} WHERE id = #{record_id}\").first\n\n self.new(result)\n end", "def record(record_id, params = {})\n Record.new(record_id, params).get\n end", "def record(record_id, params = {})\n Record.new(record_id, params).get\n end", "def find_or_create_for(application:, resource_owner:, scopes:, **token_attributes)\n if Doorkeeper.config.reuse_access_token\n access_token = matching_token_for(application, resource_owner, scopes, include_expired: false)\n\n return access_token if access_token&.reusable?\n end\n\n create_for(\n application: application,\n resource_owner: resource_owner,\n scopes: scopes,\n **token_attributes,\n )\n end", "def save\n response = perform_save(nil)\n response_data = ActiveSupport::HashWithIndifferentAccess.new(response.data)\n\n if new_record?\n created_object = self.class.new(client, self.class.map_to_scope_parameters(attributes).merge(response_data))\n\n self.id = created_object.id\n self.attributes.merge!(created_object.attributes)\n else\n self[:updated_at] = response_data[:updated_at]\n end\n\n mark_as_saved!\n self\n end", "def create_associated_details(attribute, attribute_id, create=false)\n attribute_model = attribute.to_s.camelize.constantize # e.g. Status or PersonnelData\n return attribute_id if attribute_model.find_by_id(attribute_id) # Corresponding detail record found, return id\n # raise error if there is no corresponding detail record and one is not to be created\n raise \"Unable to create needed #{attribute}=#{attribute_id}, \\n\" +\n \"\\t(specify true for create option if you want to create automatically). (create_associated_details).\" unless create\n # if the attribute id is nil, e.g. :status=>nil, use first existing record if there is one \n if attribute_id.nil? \n return attribute_model.first.id if attribute_model.first # Return id of existing record\n end \n # Create new detail record if attribute value is specified or it's nil and there are no existing records\n f = Factory(attribute, :id => attribute_id || UNSPECIFIED)\n if attribute_id == UNSPECIFIED\n f.update_attribute(:description, 'Unspecified') if f.respond_to? :description\n f.update_attribute(:name, 'Unspecified') if f.respond_to? :name\n end\n raise unless f.valid? \n return f.id\n end", "def find(id)\n response = get(\"/domains/#{@@parent_id}/records/#{id}\")[\"record\"]\n response or return nil\n Record.new response\n end", "def create_record(init)\n subject.transaction(requires_new: true) do\n InternalId.create!(\n **scope,\n usage: usage_value,\n last_value: init.call(subject) || 0\n )\n end\n rescue ActiveRecord::RecordNotUnique\n lookup\n end", "def record(id, attrs = {})\n unless [Symbol, String, Fixnum, NilClass].include? id.class\n raise ArgumentError, \"id must be symbol, string, integer or nil\"\n end\n\n record = new\n record.send \"id=\", id\n attrs.each do |k, v|\n unless attributes.include? k\n raise ArgumentError, \"Atrribute '#{k}' not found\"\n end\n\n record.send \"#{k}=\", v.freeze\n end\n\n if id == nil\n @null_record = record\n else\n @id_class ||= id.class\n ids << id\n all << record\n end\n end", "def create_or_update record\n db_name = database_name_for(record)\n coll_name = collection_name_for(record)\n id = id_for(record)\n pointer = \"/#{db_name}/#{coll_name}/#{id}\"\n if id\n res = collection_for(record).update({:_id => id}, interpret(record), :upsert => true)\n case\n when res['error']\n log.error(res['error'])\n when res['updatedExisting']\n log.debug(\"Updated #{pointer}\")\n else\n log.debug(\"Inserted #{pointer}\")\n end\n else\n res = collection_for(record).insert(interpret(record))\n log.info(\"Inserted #{pointer}#{res}\")\n end\n end", "def find_or_create_provider!(attrs)\n provider = Provider.find_by(name: attrs[:name])\n if provider.blank?\n provider = Provider.create!(\n name: attrs[:name],\n firm_agfs_supplier_number: attrs[:firm_agfs_supplier_number],\n api_key: attrs[:api_key],\n provider_type: attrs[:provider_type],\n vat_registered: attrs[:vat_registered],\n roles: attrs[:roles],\n lgfs_supplier_numbers: attrs[:lgfs_supplier_numbers] || []\n )\n end\n provider\n end", "def create(attributes)\n id = commit(\"create\", attributes)\n record = self.class.new(connection, attributes)\n record.id = id\n record\n end", "def person\n @person ||= Person.find_or_create_by(name: short_name)\n end", "def reload\n fresh_object = self.class.find(scope_key_hash)\n @attributes = fresh_object.instance_variable_get(\"@attributes\")\n self\n end", "def with(name)\r\n @attributes.find { |attr| attr.name == name }\r\n end", "def locate(params)\n get params.is_a?(String) ? {:loc => params} : map_attributes(location_from_params(params))\n end" ]
[ "0.66697276", "0.66697276", "0.61919004", "0.6107912", "0.6105047", "0.6052528", "0.6003502", "0.59510815", "0.5907279", "0.58934265", "0.58772117", "0.5833222", "0.5774199", "0.5683193", "0.5659311", "0.56541806", "0.5625775", "0.55967027", "0.5586025", "0.55542266", "0.5519613", "0.549935", "0.54898745", "0.5437931", "0.5419104", "0.540568", "0.53825617", "0.5345029", "0.5340976", "0.53198695", "0.5306968", "0.53046733", "0.52880186", "0.5214698", "0.5211493", "0.5197598", "0.518686", "0.5176066", "0.5151879", "0.5139149", "0.51387006", "0.51332295", "0.51235116", "0.5109857", "0.510786", "0.50921327", "0.5081265", "0.50802076", "0.50751007", "0.5069051", "0.50527906", "0.503364", "0.50296867", "0.5028278", "0.50058955", "0.5004273", "0.5002565", "0.49997833", "0.499884", "0.49665126", "0.49589458", "0.49496016", "0.4948531", "0.49465853", "0.49299687", "0.49281612", "0.49210024", "0.49153465", "0.4905956", "0.4901437", "0.4896721", "0.4892335", "0.48892495", "0.4886465", "0.48723996", "0.4871234", "0.4867911", "0.48614347", "0.4858252", "0.48565587", "0.48545533", "0.48447418", "0.48412108", "0.48399588", "0.48349875", "0.48290724", "0.48290724", "0.48258", "0.48154643", "0.48095468", "0.48084906", "0.48049182", "0.47983852", "0.47971922", "0.4794252", "0.47874066", "0.4777049", "0.4766789", "0.47602922", "0.47602364" ]
0.48612761
78
Locates a record according to the current scope. Updates the record with the provided attributes if found. If not found, creates a new record with the current scope's attributes and the provided attributes.
def create_or_update(*args, &block) create_or_update_and_do :save, *args, &block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_or_update_by_some( attrs={} )\n attrs = extract_ar_object_ids( attrs )\n conditions = attrs.delete( :find_by )\n raise 'You must provide a :find_by hash of attributes to search with, ie. :find_by => {:id => 1}' unless conditions\n attrs.merge!( conditions )\n record = find( :first, :conditions => conditions ) || self.new\n record.attributes = attrs\n record.save!\n record\n end", "def update_or_create(attributes = {})\n id = attributes.delete(:id)\n conditions = attributes.delete(:conditions)\n\n returning (id && find_by_id(id)) || find(:first, :conditions => conditions) || new do |record|\n attributes.each_pair { |key, value| record[key] = value }\n record.save\n end\n end", "def update(attributes)\n response = perform_update(nil, attributes)\n response.data.delete('id')\n self.attributes = scope_parameters.merge(response.data)\n mark_as_saved!\n end", "def find_existing_record\n @record = record_class.find(@locator)\n end", "def find_existing_record\n @record = record_class.find(@locator)\n end", "def set_record(id = nil, pid = nil)\n unless id.to_i > 0 && self.record = resource_model.includes(includes).find(id.to_i)\n self.record = resource_model.where((pid && where) ? where.call(pid) : {}).new\n self.record.attributes = create_attributes\n end\n end", "def find_and_update_attributes(id, attr)\n object = find(id)\n object.update_attributes( attr ) if object\n end", "def find_or_create_by!(attributes, &block)\n find_by(attributes) || create!(attributes, &block)\n end", "def update_record\n record = Query.new(table)\n .index(primary_index[:name])\n .index_segments(primary_index_segments)\n .eq\n\n record.with_write_lock! do\n @dirty_attributes.each do |key, _|\n record.set_field(key, @attributes[key])\n end\n record.write!\n end\n\n @new_record, @dirty_attributes = false, {}\n return true\n end", "def update\n upsert do\n # NOTE:\n # 1. update ++then++ valid to set new values in @record to draw form.\n # 1. user_scoped may have joins so that record could be\n # ActiveRecord::ReadOnlyRecord so that's why access again from\n # model.\n @record = model.find(user_scoped.find(params[:id]).id)\n #upsert_files\n if !@record.update_attributes(permitted_params(:update))\n raise ActiveRecord::RecordInvalid.new(@record)\n end\n end\n end", "def find_or_create_by(attributes, &block)\n find_by(attributes) || create(attributes, &block)\n end", "def find_or_create_by(attributes)\n find_by(attributes) || create(attributes)\n end", "def replicate_find_existing_record(attributes)\n return if replicate_natural_key.empty?\n conditions = {}\n replicate_natural_key.each do |attribute_name|\n conditions[attribute_name] = attributes[attribute_name.to_s]\n end\n if ::ActiveRecord::VERSION::MAJOR >= 4\n where(conditions).first\n else\n find(:first, :conditions => conditions)\n end\n end", "def update_attributes(attributes = {})\n raise ArgumentError.new(\"Cannot set attributes on new record\") if @label.to_s.empty?\n \n attributes.each do |k,v|\n if [\"status\", \"sync_period\", \"service_level\", \"password\", \"provider_token\", \"provider_token_secret\", \"provider_consumer_key\"].include? k\n send(\"#{k}=\", v)\n end\n end\n update_record\n end", "def create_or_find_by(attributes, &block)\n transaction(requires_new: true) { create(attributes, &block) }\n rescue ::ActiveRecord::RecordNotUnique\n find_by!(attributes)\n end", "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "def find_or_create_by(attributes, &block)\n result = find_or_initialize_by(attributes, &block)\n result.save! unless result.persisted?\n result\n end", "def create_or_update record\n db_name = database_name_for(record)\n coll_name = collection_name_for(record)\n id = id_for(record)\n pointer = \"/#{db_name}/#{coll_name}/#{id}\"\n if id\n res = collection_for(record).update({:_id => id}, interpret(record), :upsert => true)\n case\n when res['error']\n log.error(res['error'])\n when res['updatedExisting']\n log.debug(\"Updated #{pointer}\")\n else\n log.debug(\"Inserted #{pointer}\")\n end\n else\n res = collection_for(record).insert(interpret(record))\n log.info(\"Inserted #{pointer}#{res}\")\n end\n end", "def find_and_update_atomically(id, attrs, opts = {})\n find_and_save_atomically(id, opts) {|r| r.assign_attributes attrs }\n end", "def update_with(attributes)\n assign_attributes(attributes)\n end", "def update!(**args)\n @record = args[:record] if args.key?(:record)\n end", "def first_or_create!(attributes)\n remote = self.search(attributes).first\n remote ||= self.create!(attributes)\n remote\n end", "def find_or_create_by(attrs = {}, &block)\n find_or(:create, attrs, &block)\n end", "def update_attributes(_params)\n assign_attributes _params\n save\n end", "def update_or_create_records o_class, set: {}, where: {}, **args, &b\n logger.progname = 'RestCreate#UpdateOrCreateRecords'\n if where.blank?\n [create_record(o_class, attributes: set)]\n else\n \t set.extract!(where.keys) # removes any keys from where in set\n \t possible_records = get_records from: classname(o_class), where: where, **args\n \tif possible_records.empty?\n \t if block_given?\n \t more_where = yield # do Preparations prior to the creation of the dataset\n # if the block returns a Hash, it is merged into the insert_query.\n \t where.merge! more_where if more_where.is_a?(Hash)\n \t end\n \t [create_record(o_class, attributes: set.merge(where))]\n \telse\n \t possible_records.map{|doc| doc.update(set: set)}\n \tend\n end\n end", "def update(id, attributes)\n object = find(id)\n object.attributes = attributes\n object.save\n object\n end", "def first_or_create(attributes)\n remote = self.search(attributes).first\n remote ||= self.create(attributes)\n remote\n end", "def reload!(conditions = {})\n unless new_record?\n reloaded_object = self.class.find(client, primary_key, scope_parameters, conditions)\n self.attributes.clear\n self.attributes = reloaded_object.attributes\n mark_as_saved!\n end\n\n self\n end", "def update(attributes = {})\n self.attributes = attributes\n self.save\n end", "def nested_attributes_with_existing_records_for(*args)\n existing_args = args.last.is_a?(Hash) ? args[0...-1] : args.dup\n accepts_nested_attributes_for *args\n add_existing_records_to_nested_attributes_for *existing_args\n end", "def update!(attributes)\n # The following transaction covers any possible database side-effects of the\n # attributes assignment. For example, setting the IDs of a child collection.\n # with_transaction_returning_status do\n # assign_attributes(attributes)\n # save!\n # end\n send_log \"#{self.class}(#{self.id})\\n -update!(attributes=#{attributes}) - new_record? #{self.new_record?}\", BLUE, WHITE_BG\n super\n end", "def update!(**args)\n @has_referenced_entity_at_creation = args[:has_referenced_entity_at_creation] if args.key?(:has_referenced_entity_at_creation)\n @record_id = args[:record_id] if args.key?(:record_id)\n end", "def find_existing_record_after_reassociating(klass, obj_hash)\n obj_hash_clone = update_association_fields(klass, obj_hash.clone)\n existing_record = find_record_by_unique_index(klass, obj_hash_clone)\n if existing_record\n # Since existing_record was found, update original obj_hash\n update_association_fields(klass, obj_hash)\n existing_record\n end\n end", "def _update_record(attribute_names = self.attribute_names)\n # ****** BEGIN PARTITIONED PATCH ******\n # NOTE(hofer): This patch ensures the columns the table is\n # partitioned on are passed along to the update code so that the\n # update statement runs against a child partition, not the\n # parent table, to help with performance.\n if self.class.respond_to?(:partition_keys)\n attribute_names.concat self.class.partition_keys.map(&:to_s)\n attribute_names.uniq!\n end\n # ****** END PARTITIONED PATCH ******\n attributes_values = arel_attributes_with_values_for_update(attribute_names)\n if attributes_values.empty?\n 0\n else\n self.class.unscoped._update_record attributes_values, id, id_was\n end\n end", "def new_or_update!(hash={}, options = {:hard_update => true})\n hash.symbolize_keys!\n if hash[:id].blank?\n self.new(hash)\n else\n rec = self.find(hash[:id])\n if options[:hard_update]\n rec.update_attributes!(hash.except(:id))\n else\n rec.update_attributes(hash.except(:id))\n end\n rec\n end\n end", "def update(attributes)\n assign_attributes(attributes)\n save\n end", "def update\n record.assign_attributes(data)\n record.save! if record.changed?\n end", "def set_record\n @record = params[:id] ? Record.friendly.find(params[:id]) : Record.new(record_params)\n end", "def update(attributes)\n self.class.new(GeoIQ.put(\"#{path}.json\", attributes).parsed_response)\n end", "def update_attributes(attributes = nil)\r\n self.attributes = attributes\r\n save\r\n end", "def update_attributes(attributes)\n assign_attributes attributes\n save\n end", "def update_attributes(new_attributes = {})\n new_attributes.all? do |name, value|\n self[name] = value\n end && save\n end", "def _update_record(*args, &block)\n attributes_values = changes.map{|k, v| [k.to_sym, v.last]}.to_h\n\n if attributes_values.empty?\n rows_affected = 0\n else\n rows_affected = self.class.unscoped._update_record attributes_values, id, id_was\n end\n\n yield(self) if block_given?\n\n rows_affected\n end", "def update_record(attribute_names = attributes.keys)\n \n # Build a payload hash, but silently skip this operation if they are empty.\n payload_hash = attributes_for_update(attribute_names)\n return unless payload_hash.present?\n \n # Perform the operation and save the attributes returned by the remote.\n self.remote_attributes = self.class.identify(self).update_instance(payload_hash)\n \n # Return success.\n true\n end", "def save(attrs)\n if attrs[:id].present?\n data = @resource.update(attrs, @customer_id)\n else\n attrs.delete(:id) \n if resource_name == :customers\n data = @resource.create(attrs)\n else\n data = @resource.create(attrs, @customer_id)\n end\n end\n\n data.merge({\"open_pay_id\" => data[\"id\"]})\n end", "def save\n response = perform_save(nil)\n response_data = ActiveSupport::HashWithIndifferentAccess.new(response.data)\n\n if new_record?\n created_object = self.class.new(client, self.class.map_to_scope_parameters(attributes).merge(response_data))\n\n self.id = created_object.id\n self.attributes.merge!(created_object.attributes)\n else\n self[:updated_at] = response_data[:updated_at]\n end\n\n mark_as_saved!\n self\n end", "def before_update_save(record)\n @record.attributes = params[:record]\n end", "def before_update_save(record)\n @record.attributes = params[:record]\n end", "def update_record!(record, hash, inventory_object)\n record.assign_attributes(hash.except(:id))\n if !inventory_collection.check_changed? || record.changed?\n record.save\n inventory_collection.store_updated_records(record)\n end\n\n inventory_object.id = record.id\n end", "def update(record)\n result = self.class.put(worksheet_url + \"/\" + record.id,\n :body => { \"fields\" => record.fields_for_update }.to_json,\n :headers => { \"Content-type\" => \"application/json\" }).parsed_response\n if result.present? && result[\"id\"].present?\n record.override_attributes!(result_attributes(result))\n record\n else # failed\n false\n end\n end", "def find_and_update_resource\n model = class_name.find(params[:id])\n model.tap do |m|\n m.update get_secure_params\n set_resource_ivar m\n end\n end", "def reload\n fresh_object = self.class.find(scope_key_hash)\n @attributes = fresh_object.instance_variable_get(\"@attributes\")\n self\n end", "def update_attributes!(attributes)\n assign_attributes attributes\n save!\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @scope = args[:scope] if args.key?(:scope)\n end", "def set_record\n begin\n found_record = Record.find(params[:id])\n @record = found_record\n rescue\n raise ActionController::RoutingError.new('Not Found')\n end\n end", "def find_record\n if record\n self.new_session = false\n return record\n end\n \n find_with.each do |find_method|\n if send(\"valid_#{find_method}?\")\n self.new_session = false\n return record\n end\n end\n nil\n end", "def update!(attributes)\n assign_attributes(attributes)\n save!\n end", "def update\n @person = Roxiware::Person.find(params[:id])\n _create_or_update(@person)\n end", "def first_or_create(conditions, attributes = {})\n first(conditions) || create(conditions.merge(attributes))\n end", "def update\n @record = find_record\n\n respond_to do |format|\n if @record.update_attributes(params[:record])\n format.html { redirect_to [@record.patient, @record],\n notice: 'Record was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'show' }\n format.json { render json: @record.errors, status: :unprocessable_entity }\n end\n end\n end", "def first_or_create(conditions = {}, attributes = {})\n first(conditions) || create(conditions.merge(attributes))\n end", "def update_attributes!(attributes = nil)\r\n self.attributes = attributes\r\n save!\r\n end", "def update_attributes!(attributes)\n self.attributes = attributes\n save!\n end", "def update_attributes!(attributes)\n self.attributes = attributes\n save!\n end", "def update_attributes!(attributes)\n self.attributes = attributes\n save!\n end", "def update_attributes!(attributes)\n self.attributes = attributes\n save!\n end", "def update(attributes)\n raise TypeError, 'attributes must respond to #to_hash or #to_h' unless attributes.respond_to?(:to_hash) || attributes.respond_to?(:to_h)\n attributes = attributes.to_hash rescue attributes.to_h\n \n # TODO: Raise error if Hash is empty =(\n # TODO: Set attributes on this instance to new attributes, clear changed_attributes\n \n query = \"UPDATE #{table_name} SET \"\n query << attributes.keys.collect { |name| \"#{name} = ?\" }.join(' AND ')\n query << \" WHERE #{self.class.primary_key} = ?\"\n \n query_values = attributes.values\n query_values << primary_key\n \n self.class.database.execute_batch( query, *query_values )\n \n self\n end", "def update_resource(resource, attributes)\n resource.attributes = attributes\n resource.save\n resource\n end", "def update(attrs, opts={})\n update_attributes(attrs)\n save(opts)\n end", "def update_attributes(attributes)\n self.attributes = attributes\n save\n end", "def update_attributes(attributes)\n self.attributes = attributes\n save\n end", "def update_attributes(attributes)\n self.attributes = attributes\n save\n end", "def create_rec(attrs = {})\n create_card_recommendation(offer_id: offer.id, person_id: person.id).tap do |rec|\n rec.update!(attrs)\n end\n end", "def find_record\n @record ||= model.find_by_id(params[:id])\n end", "def update_or_create_address(attributes)\n if attributes[:id]\n # TODO: Delete this part of the IF? It never gets called during tests.\n address = Spree::Address.find(attributes[:id])\n if address.editable?\n address.update_attributes(attributes)\n else\n address.errors.add(:base, I18n.t(:address_not_editable, scope: [:address_book]))\n end\n else\n address = Spree::Address.new(attributes)\n end\n address\n end", "def update_attributes(attrs)\n self.attributes = attrs\n save\n end", "def update\n fail_on_type_mismatch(data_params[:type])\n\n assign_record_attributes(queried_record, permitted_params_for(:update), data_params)\n\n execute_before_update_callbacks(queried_record)\n execute_before_save_callbacks(queried_record)\n\n fail RecordInvalidError.new(queried_record, engaged_field_aliases) if queried_record.errors.any?\n\n queried_record.save!\n\n execute_after_update_callbacks(queried_record)\n execute_after_save_callbacks(queried_record)\n\n render(\n json: queried_record,\n fields: query_params[:fields],\n include: query_params[:include]\n )\n end", "def update_personal_record\r\n attributes = {\r\n user_id: self.workout_session.user_id,\r\n exercise_id: self.exercise_id\r\n }\r\n pr = PersonalRecord.where(attributes).first_or_initialize\r\n\r\n pr.resistance ||= self.resistance\r\n\r\n pr.resistance = self.resistance unless pr.resistance > self.resistance\r\n\r\n pr.save\r\n end", "def update_for(existing_record:, update_record:)\n updater = case csv_import_detail.update_actor_stack\n when 'HyraxMetadataOnly'\n Zizia::HyraxMetadataOnlyUpdater.new(csv_import_detail: csv_import_detail,\n existing_record: existing_record,\n update_record: update_record,\n attrs: process_attrs(record: update_record))\n when 'HyraxDelete'\n Zizia::HyraxDeleteFilesUpdater.new(csv_import_detail: csv_import_detail,\n existing_record: existing_record,\n update_record: update_record,\n attrs: process_attrs(record: update_record))\n when 'HyraxOnlyNew'\n return unless existing_record[deduplication_field] != update_record.try(deduplication_field)\n Zizia::HyraxDefaultUpdater.new(csv_import_detail: csv_import_detail,\n existing_record: existing_record,\n update_record: update_record,\n attrs: process_attrs(record: update_record))\n end\n updater.update\n end", "def add_evidence!(attributes)\n self.evidence = Evidence.where(name: attributes[1]).first_or_create! \n self.save!\n end", "def replace(new_attributes)\n @attributes = new_attributes\n load_ab_person\n end", "def update(scope, options = {}, additional_index_options = {})\n bulk options do |indexer|\n each_record(scope, index_scope: true) do |object|\n indexer.update record_id(object), { doc: serialize(object) }, index_options(object).merge(additional_index_options)\n end\n end\n\n scope\n end", "def update(attributes)\n update_attributes(attributes)\n save\n end", "def _update_record(values, id, id_was) # :nodoc:\n substitutes, binds = substitute_values values\n\n scope = @klass.unscoped\n\n if @klass.finder_needs_type_condition?\n scope.unscope!(where: @klass.inheritance_column)\n end\n\n # ****** BEGIN PARTITIONED PATCH ******\n if @klass.respond_to?(:dynamic_arel_table)\n using_arel_table = @klass.dynamic_arel_table(Hash[*values.inject([]) { |result, (k, v)| result += [k.name, v] }])\n relation = scope.where(using_arel_table[@klass.primary_key].eq(id_was || id))\n bvs = binds + relation.bind_values\n um = relation\n .arel\n .compile_update(substitutes, @klass.primary_key)\n\n # NOTE(hofer): The um variable got set up using\n # klass.arel_table as its arel value. So arel_table.name is\n # what gets used to construct the update statement. Here we\n # set it to the specific partition name for this record so\n # that the update gets run just on that partition, not on the\n # parent one (which can cause performance issues).\n begin\n @klass.arel_table.name = using_arel_table.name\n @klass.connection.update(\n um,\n 'SQL',\n bvs)\n ensure\n @klass.arel_table.name = @klass.table_name\n end\n else\n # Original lines:\n relation = scope.where(@klass.primary_key => (id_was || id))\n bvs = binds + relation.bind_values\n um = relation\n .arel\n .compile_update(substitutes, @klass.primary_key)\n\n @klass.connection.update(\n um,\n 'SQL',\n bvs)\n end\n # ****** END PARTITIONED PATCH ******\n end", "def update(id, record, zone)\n record_fqdn = record.fqdn.sub(/\\.$/, '')\n\n existing_record = client.record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n must_exist: true,\n )\n\n # Identify the answer in this record with the matching ID, and update it\n updated = false\n existing_record['answers'].each do |existing_answer|\n existing_answer_id = ApiAnswer.from_full_api_answer(\n record_id: existing_record['id'],\n type: existing_record['type'],\n answer: existing_answer,\n ).id\n\n next if existing_answer_id != id\n\n updated = true\n existing_answer['answer'] = build_api_answer_from_record(record)\n end\n\n unless updated\n error = +'while trying to update a record, could not find answer with fqdn: '\n error << \"#{record.fqdn}, type; #{record.type}, id: #{id}\"\n raise RecordStore::Provider::Error, error\n end\n\n client.modify_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: { answers: existing_record['answers'], ttl: record.ttl }\n )\n end", "def update_resource object, attributes\n object.update attributes\n end", "def fill_mandatory_attributes(record, new_record)\n record[:usr_id] = $DB[\"SELECT nextval('users_usr_id_seq') as id\"].first[:id] if new_record\n record[:usr_screen_name] ||= \"userX#{$cntr+=1}\"\n\n if new_record\n [:usr_firstname, :usr_lastname].each do |col|\n record[col] = \"tmp_placeholder\"\n LOGGER.warn \"No #{col} for existing record: #{record[:usr_id]}\"\n end\n end\nend", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end" ]
[ "0.65203243", "0.62778926", "0.6178753", "0.60669404", "0.60669404", "0.5907997", "0.58912694", "0.58410513", "0.58184624", "0.57878697", "0.5764894", "0.5757926", "0.57100385", "0.56683683", "0.56166995", "0.55867493", "0.5567204", "0.556713", "0.55598974", "0.55597705", "0.55595106", "0.5540239", "0.5504899", "0.5470426", "0.54349434", "0.54211694", "0.5411755", "0.5386451", "0.5371246", "0.53518", "0.5331374", "0.53298163", "0.53277147", "0.5288706", "0.5283206", "0.52717286", "0.5270225", "0.5259963", "0.5255944", "0.52342135", "0.5219846", "0.5211546", "0.5210805", "0.5201156", "0.5197807", "0.5192376", "0.51896465", "0.51896465", "0.5186724", "0.51866955", "0.5176551", "0.5164011", "0.515545", "0.5155035", "0.5137175", "0.51316696", "0.51300687", "0.5128524", "0.5127038", "0.51174885", "0.5108771", "0.5106534", "0.50988173", "0.50988173", "0.50988173", "0.50988173", "0.50984627", "0.5098108", "0.50888246", "0.5087619", "0.5087619", "0.5087619", "0.5084995", "0.50815964", "0.50785416", "0.50761527", "0.50578487", "0.5051733", "0.50418174", "0.50254655", "0.50212127", "0.5021078", "0.5017262", "0.50137717", "0.50135547", "0.5007192", "0.5005931", "0.50044554", "0.50044554", "0.50044554", "0.50044554", "0.50044554", "0.50044554", "0.50044554", "0.50044554", "0.50044554", "0.50044554", "0.50044554", "0.50044554", "0.50044554", "0.50044554" ]
0.0
-1
Create a new server connection FluidDB::Connection.new(:test) will use the sandbox Params: __username__ __password__ __server__ __schema__ Could be 'http' or 'https' __port__ Change default port (443 for https and 80 for http)
def initialize(args) @params = args == :test ? SANDBOX : DEFAULT.merge(args) @params[:port] ||= @params[:scheme] == 'https' ? 443 : 80 connect end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_test_server\n {\n 'name' => 'test_db',\n 'address' => '172.19.108.5',\n 'database' => 'MigrationTest',\n 'username' => 'jenkins',\n 'password' => 'QDfVkyVn8tk6'\n }\nend", "def initialize(host, port, password, type=HLDS)\n @host = host\n @port = port\n @password = password\n @server_type = type\n end", "def test_default_connection_settings\n driver = create_driver('')\n assert_equal 'localhost', driver.instance.instance_eval{ @server }\n assert_equal 3030, driver.instance.instance_eval{ @port }\n end", "def new_connection(params)\n Pod4.logger.info(__FILE__){ \"Connecting to DB\" }\n client = TinyTds::Client.new(params)\n raise \"Bad Connection\" unless client.active?\n\n client.execute(\"use [#{self.class.db}]\").do\n\n client\n\n rescue => e\n handle_error(e)\n end", "def initialize(host, port = 389, login_dn, base_dn, password)\n @host = host\n @port = port\n @login_dn = login_dn\n @base_dn = base_dn\n @password = password\n\n return connect\n end", "def initialize(\n printable_name:,\n host:,\n port: '3306',\n database_name:,\n username:,\n password:,\n sslca: nil\n )\n @printable_name = printable_name\n @username = username\n @password = password\n @host = host\n @database_name = database_name\n @port = port\n @sslca = sslca\n end", "def initialize(server_url)\n uri = URI.parse(server_url)\n @host = uri.host\n @port = uri.port\n @username = uri.user\n @password = uri.password\n @use_ssl = (uri.scheme == \"https\")\n end", "def initialize(host: nil, port: 5433, username: nil, password: nil, database: nil, interruptable: false, ssl: false, read_timeout: 600, debug: false, role: nil, search_path: nil, timezone: nil, autocommit: false, skip_startup: false, skip_initialize: false, user: nil)\n reset_state\n @notice_handler = nil\n\n @options = {\n host: host,\n port: port.to_i,\n username: username || user,\n password: password,\n database: database,\n debug: debug,\n ssl: ssl,\n interruptable: interruptable,\n read_timeout: read_timeout,\n role: role,\n search_path: search_path,\n timezone: timezone,\n autocommit: autocommit,\n }\n\n boot_connection(skip_initialize: skip_initialize) unless skip_startup\n end", "def connect\n PG::Connection.new(:host => host, :port => port, :user => user, :password => password, :sslmode => sslmode, :dbname => dbname)\n end", "def initialize(type, user, pass, app, instance, port = 3306)\n @type = type\n @user = user\n @pass = pass\n @app = app\n @instance = instance\n @port = port\n end", "def initialize(server, user, password, options = {})\n @server = server\n @user = user\n @password = password\n @connection = nil\n @ignore = options[:ignore]\n @recursion_level = 0\n @verbose = options[:verbose] || false\n @passive = options[:passive] || false\n @port = options[:port] || false\n\n end", "def initialize(params = {})\n @host = params[:host] || 'localhost'\n @port = (params[:port] || 3306).to_i\n @user = params[:username] || 'root'\n @password = params[:password] || 'pwd'\n @database = params[:database] || 'ithingy'\n @adapter = params[:adapter] || 'mysql'\n self.connect\n end", "def initialize(servers = nil, options = {}, thrift_options = {})\n @servers = servers || '127.0.0.1:9160'\n @options = options.merge(cql_version: '3.0.0')\n @thrift_options = thrift_options.dup\n @instrumenter = @options.delete(:instrumenter)\n @retry_strategy = @options.delete(:retry_strategy)\n\n @driver = CassandraCQL::Database.new(@servers, @options, @thrift_options)\n\n @executor = Cassanity::Executors::CassandraCql.new({\n driver: @driver,\n instrumenter: @instrumenter,\n retry_strategy: @retry_strategy,\n })\n\n @connection = Cassanity::Connection.new({\n executor: @executor,\n })\n end", "def connect(*args)\n @@connection = FluidDB::Connection.new(*args)\n end", "def initialize\n @database = Sequel.connect(ENV['DATABASE_URL'])\n end", "def test_server_port\n 3000\n end", "def initialize(host = \"localhost\", port = 1717, username = \"admin\", password = \"admin\", environment = \"\", **kwargs)\n size = kwargs.fetch(:size, @@default_size)\n timeout = kwargs.fetch(:timeout, @@default_timeout)\n super(size:size, timeout:timeout) do\n Concourse.connect(host:host, port:port, username:username, password:password, environment:environment, **kwargs)\n end\n end", "def initialize(host_name = 'localhost', port = 20000)\n @host_name = host_name\n @port = port\n end", "def initialize(options = {})\n @connections =\n if options.key?(:puppetdb_url)\n urls = options[:puppetdb_url].is_a?(Array) ? options[:puppetdb_url] : [options[:puppetdb_url]]\n urls.map { |url| parse_url(url) }\n elsif options.key?(:puppetdb_host)\n is_ssl = options.fetch(:puppetdb_ssl, true)\n default_port = is_ssl ? URI::HTTPS::DEFAULT_PORT : URI::HTTP::DEFAULT_PORT\n port = options.fetch(:puppetdb_port, default_port).to_i\n [{ ssl: is_ssl, host: options[:puppetdb_host], port: port }]\n elsif ENV['PUPPETDB_URL'] && !ENV['PUPPETDB_URL'].empty?\n [parse_url(ENV['PUPPETDB_URL'])]\n elsif ENV['PUPPETDB_HOST'] && !ENV['PUPPETDB_HOST'].empty?\n # Because environment variables are strings...\n # This will get the env var and see if it equals 'true'; the result\n # of this == comparison is the true/false boolean we need.\n is_ssl = ENV.fetch('PUPPETDB_SSL', 'true') == 'true'\n default_port = is_ssl ? URI::HTTPS::DEFAULT_PORT : URI::HTTP::DEFAULT_PORT\n port = ENV.fetch('PUPPETDB_PORT', default_port).to_i\n [{ ssl: is_ssl, host: ENV['PUPPETDB_HOST'], port: port }]\n else\n []\n end\n @timeout = options.fetch(:timeout, 10)\n @options = options\n end", "def initialize(options = {})\n requires!(options, :login, :password)\n \n @options = {\n :strict_ssl => true,\n :crypt_type => 7\n }.update(options)\n \n @url = test? ? TEST_URL : LIVE_URL \n \n super \n end", "def initialize(servers = [], opts = {})\n @servers = servers\n @servers << \"#{DEFAULT_HOST}:#{DEFAULT_PORT}\" if servers.empty?\n @logger = opts[:logger] || CrateRuby.logger\n @http_options = opts[:http_options] || { read_timeout: 3600 }\n @schema = opts[:schema] || 'doc'\n @username = opts[:username]\n @password = opts[:password]\n @ssl = opts[:ssl] || false\n end", "def create_client_connection(host, port, db)\n Connection.new(host, port, db, @handle)\n end", "def initialize(username, password, host, port='8089', index='main',\n scheme='https')\n @username = username\n @password = password\n @splunk_url = URI::HTTP.new(\n scheme, nil, host, port, nil, nil, nil, nil, nil).to_s\n @index = index\n end", "def test_server\n TEST_SERVER\n end", "def start_server(host = T.unsafe(nil), port = T.unsafe(nil)); end", "def prepare_tcp_server(host: T.unsafe(nil), port: T.unsafe(nil), adapter: T.unsafe(nil)); end", "def connection\n v = ENV.fetch(@var, nil)\n raise \"The environment variable #{@var.inspect} is not set\" if v.nil?\n uri = URI(v)\n Pgtk::Wire::Direct.new(\n host: uri.host,\n port: uri.port,\n dbname: uri.path[1..-1],\n user: uri.userinfo.split(':')[0],\n password: uri.userinfo.split(':')[1]\n ).connection\n end", "def connect(username=DEFAULT_USERNAME, password=DEFAULT_PASSWORD, lang=DEFAULT_LANG, host=DEFAULT_HOST, port=DEFAULT_PORT, db_name=DEFAULT_DATABASE, auth_type=DEFAULT_AUTHTYPE)\n # TODO: handle pools of connections\n \n @username = username\n @password = password\n @lang = lang\n @host = host\n @port = port\n @db_name = db_name\n @auth_type = auth_type\n \n @connection = MonetDBConnection.new(user = @username, passwd = @password, lang = @lang, host = @host, port = @port)\n @connection.connect(@db_name, @auth_type)\n end", "def initialize(name, server)\n @name = name\n @server = server\n @uri = \"/#{name.gsub('/','%2F')}\"\n create_database_unless_exists\n end", "def connect(server)\n opts = server_opts(server)\n\n connection_params = if opts[:host].nil? && opts[:port].nil? && opts[:database]\n # use a cataloged connection\n opts.values_at(:database, :user, :password)\n else\n # use uncataloged connection so that host and port can be supported\n 'Driver={IBM DB2 ODBC DRIVER};' \\\n \"Database=#{opts[:database]};\" \\\n \"Hostname=#{opts[:host]};\" \\\n \"Port=#{opts[:port] || 50000};\" \\\n 'Protocol=TCPIP;' \\\n \"Uid=#{opts[:user]};\" \\\n \"Pwd=#{opts[:password]};\" \\\n end \n\n Connection.new(connection_params)\n end", "def initialize options\n host = options['host'] || 'localhost'\n port = options['port'] || 5432\n database = options['database']\n username = options['username']\n\n # always reuse an existing connection if it matches on these connection options\n conn_options = {:host => host, :port => port, :database => database, :username => username}\n existing_connection = self.class.persisted_connection(conn_options)\n\n if existing_connection.nil?\n # create and persist a new connection\n @connection = PG::Connection.new(\n host,\n port,\n nil,\n nil,\n database,\n username,\n options['password'] || ''\n )\n @connection.set_notice_processor do |msg|\n if msg =~ /^ERROR:/\n LOG.error('psql') { msg.gsub(/\\n/,'; ') }\n else\n LOG.info('psql') { msg.gsub(/\\n/,'; ') }\n end\n end\n self.class.persist_connection(@connection, conn_options)\n else\n # reuse an existing connection\n @connection = existing_connection\n end\n\n # set up trackig if it isn't set up already\n set_up_tracking if !tracking_tables?\n end", "def test_connection\n end", "def initialize(port = 80, listen_host = '0.0.0.0', ssl = false, context = {},\n comm = nil, ssl_cert = nil, ssl_compression = false,\n ssl_cipher = nil)\n self.listen_host = listen_host\n self.listen_port = port\n self.ssl = ssl\n self.context = context\n self.comm = comm\n self.ssl_cert = ssl_cert\n self.ssl_compression = ssl_compression\n self.ssl_cipher = ssl_cipher\n self.listener = nil\n self.resources = {}\n self.server_name = DefaultServer\n end", "def conn\n unless @conn\n # open the database config file\n db_config = YAML.load(ERB.new(File.read(\"config/ourstage_database.yml\")).result )\n database = db_config[environment]['database']\n @conn = EventMachine::Postgres.new(:database => database)\n @conn.setnonblocking(true) # may not be needed? \n end\n @conn\n end", "def initialize(dbname = Namey.db_path) \n @db = Sequel.connect(dbname)\n end", "def connect(server)\n opts = server_opts(server)\n opts[:database] = ':memory:' if blank_object?(opts[:database])\n db = ::Amalgalite::Database.new(opts[:database])\n db.busy_handler(::Amalgalite::BusyTimeout.new(opts.fetch(:timeout, 5000)/50, 50))\n db.type_map = SequelTypeMap.new(self)\n connection_pragmas.each{|s| log_connection_yield(s, db){db.execute_batch(s)}}\n db\n end", "def startup\n Mysql2::Client.new(host: '127.0.0.1', username: 'root', port: '3307', database: 'management_gateway_development')\nend", "def create_connection\n self.setup\n RfmAdaptor::Connection.new(self.server_name)\n end", "def initialize\n engine_uri = URI(ENV.fetch 'ENGINE_URL')\n @conn = Rserve::Simpler.new hostname: engine_uri.host\n end", "def connect(username=DEFAULT_USERNAME, password=DEFAULT_PASSWORD, lang=DEFAULT_LANG, host=DEFAULT_HOST, port=DEFAULT_PORT, db_name=DEFAULT_DATABASE, auth_type=DEFAULT_AUTHTYPE)\n\t\t# TODO: handle pools of connections\n\n\t\t@username = username\n\t\t@password = password\n\t\t@lang = lang\n\t\t@host = host\n\t\t@port = port\n\t\t@db_name = db_name\n\t\t@auth_type = auth_type\n\n\t\t@connection = MonetDBConnection.new(user = @username, passwd = @password, lang = @lang, host = @host, port = @port)\n\t\t@connection.connect(@db_name, @auth_type)\n\tend", "def make_connection database=nil\n \n self.sql ||= Mysql2::Client.new(:host => \"#{self.url}\", :username => \"username#{self.user_id}\", :password => \"cis400\", :port => 3306, :database=>\"#{database}\")\n end", "def with_target_connection\n config = get_test_config\n conn_hash = config.target.dup\n database = conn_hash.delete(:database)\n client = PG::Connection.new(host: conn_hash[:host], user: conn_hash[:username])\n begin\n yield client, database\n ensure\n client.close\n end\n end", "def connect(options = {})\n conn = self.connection(options[:handler])\n conn.container = self.container_id || generate_uuid\n connector = Connector.new(conn)\n conn.overrides = connector\n if !options[:url].nil?\n connector.address = URLs.new([options[:url]])\n elsif !options[:urls].nil?\n connector.address = URLs.new(options[:urls])\n elsif !options[:address].nil?\n connector.address = URLs.new([Qpid::Proton::URL.new(options[:address])])\n else\n raise ::ArgumentError.new(\"either :url or :urls or :address required\")\n end\n\n connector.heartbeat = options[:heartbeat] if !options[:heartbeat].nil?\n if !options[:reconnect].nil?\n connector.reconnect = options[:reconnect]\n else\n connector.reconnect = Backoff.new()\n end\n\n connector.ssl_domain = SessionPerConnection.new # TODO seems this should be configurable\n\n conn.open\n\n return conn\n end", "def initialize(server, username, password)\n @connection = Connection.new(server, username, password)\n end", "def initialize(connect_options)\n connect_options = keys_to_symbol(connect_options)\n\n raise ArgumentError, 'database adapter is required' unless connect_options.has_key?(:adapter)\n raise ArgumentError, 'database host is required' unless connect_options.has_key?(:host)\n raise ArgumentError, 'database port is required' unless connect_options.has_key?(:port)\n raise ArgumentError, 'database username is required' unless connect_options.has_key?(:username)\n raise ArgumentError, 'database password is required' unless connect_options.has_key?(:password)\n raise ArgumentError, 'database database is required' unless connect_options.has_key?(:database)\n\n if connect_options[:adapter].eql? \"mysql2\"\n @client = Mysql2::Client.new(\n host: connect_options[:host],\n port: connect_options[:port],\n username: connect_options[:username],\n password: connect_options[:password],\n database: connect_options[:database]\n )\n else\n raise ArgumentError, 'for a while only mysql2 adapter is supported'\n end\n \n end", "def initialize(host: 'localhost', port: 9200)\n @host = host\n @port = port\n @port_s = port.to_s\n end", "def dbCon(host, user, pass, port, database)\n\n\t@host = host\n\t@user = user\n\t@pass = pass\n\t@port = port\n\t@database = database\n\n\tdb = Mysql2::Client.new(\n\t\t:host => @host,\n\t\t:username => @user,\n\t\t:password => @pass,\n\t\t:port => @port,\n\t\t:database => @database\n\t\t)\n\n\tdb\nend", "def connect\r\n db = Sequel.connect(:adapter => 'mysql',\r\n :host => 'localhost', \r\n :user => 'root', \r\n :password => 'password',\r\n :database => 'space_ship')\r\n \r\n \r\n #client = Mysql2::Client.new(:host => \"localhost\", \r\n # :database => \"space_ship\",\r\n # :username => \"root\", \r\n # :password => \"password\")\r\n end", "def setup\n DBHandler.establish_test_connection\n end", "def initialize(options = {})\n reset_values\n\n @options = {}\n options.each { |key, value| @options[key.to_s.to_sym] = value }\n @options[:port] ||= 5433\n\n @row_style = @options[:row_style] ? @options[:row_style] : :hash\n unless options[:skip_startup]\n startup_connection\n initialize_connection\n end\n end", "def initialize(username, password, host=HOST_PRODUCTION)\n @username = username\n @password = password\n @host = host\n end", "def connect\n Alf::Tools::friendly_require('sequel')\n @db ||= ::Sequel.connect(@uri, @options)\n end", "def connect(dbname, user, auth, attr)\n connection = factory.create_connection\n connection.connection_string = dbname\n connection.open\n return create_database(connection, attr);\n rescue RuntimeError, System::Data::SqlClient::SqlException => err\n raise DBI::DatabaseError.new(err.message)\n end", "def initialize options\n self.db_host, self.db_port = options[:uri].to_s.split(':')\n super options\n end", "def connect_local\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :encoding => 'unicode',\n :database => ENV['DB_NAME'], # accessmon\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => 'localhost')\n end", "def sequel_url\n\n return '' unless db_type\n\n # Start our connection string\n connect_string = db_type + '://'\n\n # Add user:password if supplied\n unless db_user.nil?\n connect_string += db_user\n\n # Add either a @ or / depending on if a host was provided too\n connect_string += db_host ? '@' : '/'\n\n # Add host:port if supplied\n connect_string += db_host + '/' if db_host\n end\n\n connect_string + db_name\n end", "def initialize(server)\n @server = server\n @connection = Excon.new(\"http://#{server.ip}:#{server.execution_environment_port}/api/v1\")\n end", "def connect\n PG::Connection.new(:host => host, :port => port, :user => user, :password => password, :dbname => dbname)\n end", "def test_conn_with_named_parameters \n db = MonetDB.new()\n \n db.conn({ :user => \"monetdb\", :passwd => \"monetdb\", :port => 50000, :host => \"localhost\", :database => \"ruby_test\"})\n assert_equal(true, db.is_connected?)\n db.close\n end", "def initialize_server(port)\r\n set :port, port # Specify Port For Sinatra Server\r\n set :bind, \"0.0.0.0\" # Allow Ping From External Devices\r\n set :environment, :production # Allow External Nodes To Query Websocket\r\n set :run, true # Start Sinatra Server\r\nend", "def allow_remote_database_url=(_arg0); end", "def initialize(user_options)\n\n # configure default options\n @options = {\n :project => user_options[:project] || \"default\",\n :port => user_options[:port] || 55553,\n :user => user_options[:rpc_user],\n :pass => user_options[:rpc_pass],\n :db_host => user_options[:db_host] || \"localhost\",\n :db_user => user_options[:db_user],\n :db_pass => user_options[:db_pass],\n :db_name => user_options[:db_name] || \"msf\"\n }\n\n @options.merge!(user_options)\n\n #\n # Connect to the RPC daemon using the default client\n #\n @client = Msf::RPC::Client.new(@options)\n\n # connect to the database \n _connect_database\n end", "def server(options)\n @auth = Base64.b64encode(\"#{options[:user]}:#{options[:pass]}\")\n @host = options[:host]\n @protocol = options[:protocol]\n end", "def connect(opts={})\n\n\t\treturn false if not @usable\n\n\t\tnopts = opts.dup\n\t\tif (nopts['port'])\n\t\t\tnopts['port'] = nopts['port'].to_i\n\t\tend\n\n\t\tnopts['pool'] = 256\n\n\t\tbegin\n\t\t\tcreate_db(nopts)\n\n\t\t\t# Configure the database adapter\n\t\t\tActiveRecord::Base.establish_connection(nopts)\n\n\t\t\t# Migrate the database, if needed\n\t\t\tmigrate\n\n\t\t\t# Set the default workspace\n\t\t\tframework.db.workspace = framework.db.default_workspace\n\t\trescue ::Exception => e\n\t\t\tself.error = e\n\t\t\telog(\"DB.connect threw an exception: #{e}\")\n\t\t\tdlog(\"Call stack: #{$@.join\"\\n\"}\", LEV_1)\n\t\t\treturn false\n\t\tensure\n\t\t\t# Database drivers can reset our KCODE, do not let them\n\t\t\t$KCODE = 'NONE' if RUBY_VERSION =~ /^1\\.8\\./\n\t\tend\n\n\tend", "def connect\n config = @connection_options\n @connection = case config[:mode]\n when :dblib\n appname = config[:appname] || configure_application_name || Rails.application.class.name.split('::').first rescue nil\n login_timeout = config[:login_timeout].present? ? config[:login_timeout].to_i : nil\n timeout = config[:timeout].present? ? config[:timeout].to_i/1000 : nil\n encoding = config[:encoding].present? ? config[:encoding] : nil\n TinyTds::Client.new({\n :dataserver => config[:dataserver],\n :host => config[:host],\n :port => config[:port],\n :username => config[:username],\n :password => config[:password],\n :database => config[:database],\n :appname => appname,\n :login_timeout => login_timeout,\n :timeout => timeout,\n :encoding => encoding,\n :azure => config[:azure]\n }).tap do |client|\n if config[:azure]\n client.execute(\"SET ANSI_NULLS ON\").do\n client.execute(\"SET CURSOR_CLOSE_ON_COMMIT OFF\").do\n client.execute(\"SET ANSI_NULL_DFLT_ON ON\").do\n client.execute(\"SET IMPLICIT_TRANSACTIONS OFF\").do\n client.execute(\"SET ANSI_PADDING ON\").do\n client.execute(\"SET QUOTED_IDENTIFIER ON\")\n client.execute(\"SET ANSI_WARNINGS ON\").do\n else\n client.execute(\"SET ANSI_DEFAULTS ON\").do\n client.execute(\"SET CURSOR_CLOSE_ON_COMMIT OFF\").do\n client.execute(\"SET IMPLICIT_TRANSACTIONS OFF\").do\n end\n client.execute(\"SET TEXTSIZE 2147483647\").do\n end\n when :odbc\n if config[:dsn].include?(';')\n driver = ODBC::Driver.new.tap do |d|\n d.name = config[:dsn_name] || 'Driver1'\n d.attrs = config[:dsn].split(';').map{ |atr| atr.split('=') }.reject{ |kv| kv.size != 2 }.inject({}){ |h,kv| k,v = kv ; h[k] = v ; h }\n end\n ODBC::Database.new.drvconnect(driver)\n else\n ODBC.connect config[:dsn], config[:username], config[:password]\n end.tap do |c|\n begin\n c.use_time = true\n c.use_utc = ActiveRecord::Base.default_timezone == :utc\n rescue Exception => e\n warn \"Ruby ODBC v0.99992 or higher is required.\"\n end\n end\n end\n @spid = _raw_select('SELECT @@SPID', fetch: :rows).first.first\n configure_connection\n rescue\n raise unless @auto_connecting\n end", "def server\n @_server ||= case options.fetch(:type, :tcp)\n when :tcp\n TCPServer.new options.fetch(:host, \"127.0.0.1\"),\n options.fetch(:port, 2010)\n when :unix\n UNIXServer.new options.fetch(:path)\n when :pipe\n FakeServer.new options.fetch(:pipe)\n end\n end", "def setup_server\n @port = 0\n begin\n @port = rand(40_000)\n @server = TCPServer.new(@port)\n rescue\n retry\n end\n end", "def initialize(user,pass,host,port)\n @username = user\n @password = pass\n @host = host\n @port = port\n @server = AllegroGraph::Server.new :username => @username, :password => @password, :host => @host, :port => @port\n end", "def test_local_core_connection\n \n # Change username, password, host and port in order to test the connection with a different Ensembl db server\n assert_nothing_raised do \n Ensembl::Core::DBConnection.connect('Homo sapiens',56,:username => \"anonymous\",:host => \"ensembldb.ensembl.org\", :port => 5306)\n end\n end", "def get_legacy_db_conn\n Mysql2::Client.new(:host => ENV[\"SDBMSS_LEGACY_DB_HOST\"],\n :username => ENV[\"SDBMSS_LEGACY_DB_USER\"],\n :database => ENV[\"SDBMSS_LEGACY_DB_NAME\"],\n :password => ENV[\"SDBMSS_LEGACY_DB_PASSWORD\"],\n )\n end", "def initialize(host = 'localhost', port = 21_420)\n @host = host || 'localhost'\n @port = port || 21_420\n end", "def connect(server)\n opts = server_opts(server)\n if USES_PG\n connection_params = {\n :host => opts[:host],\n :port => opts[:port] || 5432,\n :dbname => opts[:database],\n :user => opts[:user],\n :password => opts[:password],\n :connect_timeout => opts[:connect_timeout] || 20,\n :sslmode => opts[:sslmode],\n :sslrootcert => opts[:sslrootcert]\n }.delete_if { |key, value| blank_object?(value) }\n connection_params.merge!(opts[:driver_options]) if opts[:driver_options]\n conn = Adapter.connect(connection_params)\n\n conn.instance_variable_set(:@prepared_statements, {})\n\n if receiver = opts[:notice_receiver]\n conn.set_notice_receiver(&receiver)\n end\n else\n unless typecast_value_boolean(@opts.fetch(:force_standard_strings, Postgres.instance_variable_get(:@force_standard_strings))) # , true)) # SEQUEL5\n raise Error, \"Cannot create connection using postgres-pr unless force_standard_strings is set\"\n end\n\n conn = Adapter.connect(\n (opts[:host] unless blank_object?(opts[:host])),\n opts[:port] || 5432,\n nil, '',\n opts[:database],\n opts[:user],\n opts[:password]\n )\n end\n\n conn.instance_variable_set(:@db, self)\n\n if encoding = opts[:encoding] || opts[:charset]\n if conn.respond_to?(:set_client_encoding)\n conn.set_client_encoding(encoding)\n else\n conn.async_exec(\"set client_encoding to '#{encoding}'\")\n end\n end\n\n connection_configuration_sqls.each{|sql| conn.execute(sql)}\n conn\n end", "def initialize(client, session, server, port)\n url = build_url(API, server || Puppet[:server], port || Puppet[:serverport])\n super(client, session, url)\n end", "def initialize(client, session, server, port)\n url = build_url(API, server || Puppet[:server], port || Puppet[:serverport])\n super(client, session, url)\n end", "def initialize(client, session, server, port)\n url = build_url(API, server || Puppet[:server], port || Puppet[:serverport])\n super(client, session, url)\n end", "def server_url\n \"http://#{server_host}:#{server_port}\"\n end", "def allow_remote_database_url; end", "def connect!(in_user, in_password, in_host)\n begin\n @sa_connection=OpswareClient\n @sa_connection.connect(\"https\".to_java, in_host, port, in_user, in_password, true)\n require 'sasync/hpsa_tools/hpsa_tools'\n extend Sasync::HpsaTools\n rescue NativeException => e\n puts \"Error during connection with error: #{e}\"\n return\n end\n\n self.initialize_framework\n #puts @sa_connection.isConnected\n #puts connection_info\n end", "def connect\n @connection.create\n end", "def initialize(options={})\n @host = options[:host] || ENV['OT_HOST']\n @user = options[:user] || ENV['OT_USER']\n @password = options[:password] || ENV['OT_PASSWORD']\n end", "def db_connect\n database_connect_options = @options['database']\n db_connector = DatabaseConnector.new(database_connect_options)\n return db_connector.client\n end", "def open_connection\n if @sslca then\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name,\n sslca: @sslca)\n else\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name)\n end\n end", "def connect(username, password, options = {})\n server = options[:server] || Helpers::AuthHelper.read_server\n @server = RestClient::Resource.new server, DEFAULT_LOGIN_PAYLOAD\n\n super\n end", "def initialize(ip='192.168.120.249', base='abnet_db', port='2300')\n @ip = ip\n @base = base\n @port = port\n @url = @ip + ':' + @port + '/' + @base\n end", "def configured_db_server_connection(server = nil)\n shelly.configured_db_server(code_name, server)\n end", "def connect_local_admin\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :schema_search_path => 'public',\n :encoding => 'unicode',\n :database => 'postgres',\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => 'localhost')\n end", "def new_connection; end", "def start_client(host = T.unsafe(nil), port = T.unsafe(nil)); end", "def connect\n if (@type == \"db2\")\n @config\n Models::Databases::SiteDatabase::Base.setup_connection(@config)\n elsif (@type == \"bops\")\n @config\n Models::Databases::Bops::Base.setup_connection(@config)\n else\n Models::Databases::Dyces::Base.setup_connection(@config)\n end\n\n @connection = @type\n\n Log.instance.debug \"Connected to #@db_url\"\n self\n end", "def initialize(port=9999)\n\t\t@port = port\n\t\t@server = TCPServer.new(@port)\n\tend", "def setup_mongrel2_config\n\t\tserver 'test-server' do\n\t\t\tchroot Dir.tmpdir\n\t\t\tport 8080\n\t\t\tdefault_host 'test-host'\n\n\t\t\thost 'test-host' do\n\t\t\t\troute '/handler', handler( TEST_RECV_SPEC, 'test-handler' )\n\t\t\tend\n\t\tend\n\tend", "def initialize(db, server, opts)\n @db = db\n @server = server\n @opts = opts\n end", "def get_testrail_connection()\n @tr_con = nil\n @tr_case_types = nil\n @tr_case_fields = nil\n\n print \"Connecting to TestRail system at:\\n\"\n print \"\\tURL : #{$my_testrail_url}\\n\"\n print \"\\tUser : #{$my_testrail_user}\\n\"\n\n # ------------------------------------------------------------------\n # Set up a TestRail connection packet.\n #\n @tr_con = TestRail::APIClient.new($my_testrail_url)\n @tr_con.user = $my_testrail_user\n @tr_con.password = $my_testrail_password\n\n print \"\\nValidated by TestRail system:\\n\"\n print \"\\tUser : #{@tr_con.user}\\n\"\nend", "def initialize( port )\n # Setup the server:\n @server = TCPServer.new port\n end", "def connect\n \n require \"sequel\"\n require \"sequel_model\"\n\n if File.exists?(config_file)\n Merb.logger.info!(\"Connecting to the '#{config[:database]}' database on '#{config[:host]}' using '#{config[:adapter]}' ...\")\n connection = ::Sequel.connect(config_options(config))\n Merb.logger.error!(\"Connection Error: #{e}\") unless connection\n connection\n else\n copy_sample_config\n Merb.logger.set_log(STDERR)\n Merb.logger.error! \"No database.yml file found in #{Merb.root}/config.\"\n Merb.logger.error! \"A sample file was created called config/database.sample.yml for you to copy and edit.\"\n exit(1)\n end\n \n end", "def initialize *args\n opts = args.last.is_a?(Hash) ? args.last : {}\n @host = opts[:host] || \"localhost\"\n @port = opts[:port] || 8086\n @username = opts[:username] || \"root\"\n @password = opts[:password] || \"root\"\n @database = args.first\n @http = Net::HTTP.new(@host, @port)\n @queue = InfluxDB::MaxQueue.new\n spawn_threads!\n end", "def db\r\n @db ||= PG.connect(\r\n host: ENV['HOST'],\r\n user: ENV['USER_NAME'],\r\n password: ENV['PASSWORD'],\r\n dbname: ENV['DATABASE']\r\n )\r\nend", "def start(host = T.unsafe(nil), port = T.unsafe(nil)); end", "def connect(args)\n begin\n # sensible? defaults\n args[:host] ||= 'localhost'\n args[:port] ||= 3306\n args[:user] ||= 'root'\n args[:password] ||= ''\n \n db = Mysql.connect(args[:host], args[:user], args[:password], args[:name], args[:port])\n @debug and puts \"-- #{args[:host]} #{args[:name]} server version: \" + db.get_server_info\n return db\n rescue Mysql::Error => e\n $stderr.puts \"Error code: #{e.errno}\"\n $stderr.puts \"Error message: #{e.error}\"\n $stderr.puts \"Error SQLSTATE: #{e.sqlstate}\" if e.respond_to?(\"sqlstate\")\n exit\n end\n end", "def initialize (host, port)\n\n @db = lib.tcrdbnew\n\n @host = host\n @port = port\n\n (lib.tcrdbopen(@db, host, port) == 1) ||\n raise(\"couldn't connect to tyrant at #{host}:#{port}\")\n\n if self.stat['type'] == 'table'\n\n self.close\n\n raise ArgumentError.new(\n \"tyrant at #{host}:#{port} is a table, \" +\n \"use Rufus::Tokyo::TyrantTable instead to access it.\")\n end\n end" ]
[ "0.6575973", "0.63804036", "0.62315804", "0.61822844", "0.6164898", "0.6145027", "0.61370987", "0.6126241", "0.6084073", "0.60745937", "0.6043617", "0.60184824", "0.59785104", "0.5972319", "0.59659743", "0.5921441", "0.5912027", "0.5903905", "0.58972245", "0.5890872", "0.5845635", "0.5832998", "0.58303833", "0.58256334", "0.57883626", "0.57871944", "0.578387", "0.5780889", "0.5768416", "0.57618904", "0.5754489", "0.5748485", "0.5743229", "0.574178", "0.5727081", "0.572677", "0.5721291", "0.5719125", "0.57162076", "0.5709647", "0.5696892", "0.56953174", "0.5683296", "0.5672805", "0.56698215", "0.56648964", "0.56566226", "0.56549716", "0.5649868", "0.5643699", "0.56324303", "0.5631709", "0.56287956", "0.56253374", "0.56231165", "0.56202817", "0.5618597", "0.56172353", "0.5616519", "0.56126744", "0.56104356", "0.5609628", "0.56041145", "0.56040496", "0.5594889", "0.5591102", "0.559078", "0.55866563", "0.55855405", "0.55844486", "0.5581504", "0.5581342", "0.5580787", "0.5580787", "0.5580787", "0.55749875", "0.5573019", "0.5568975", "0.55654436", "0.5564889", "0.5562848", "0.55597925", "0.5544446", "0.5540051", "0.5527257", "0.5524569", "0.5523612", "0.5515668", "0.5513199", "0.55071247", "0.55049497", "0.54967535", "0.5493452", "0.5485983", "0.5485914", "0.54816425", "0.54808885", "0.54738075", "0.54724026", "0.5467228" ]
0.69465876
0
Reconnect to the server FluidDB::Connection use http 1.1. If you don't use the connection for a while, probably the server will disconnect
def connect @connection = Net::HTTP.new(@params[:server], @params[:port]) @connection.use_ssl = true if @params[:scheme] == 'https' @connection.start end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconnect\n end", "def reconnect!\n end", "def reconnect!\n @connection.reset_connection\n end", "def reconnect\n @mutex.synchronize do\n if @db.opts[:conn]\n @jdbc_loaded = true\n @conn = @db.opts.fetch(:conn)\n else\n com.mysql.cj.jdbc.Driver\n @conn = java.sql::DriverManager.getConnection(jdbc_connect_command)\n end\n\n query_no_result_set(\"SET SQL_MODE = ''\")\n query_no_result_set(\"SET NAMES '#{esc(@encoding)}'\") if @encoding\n end\n end", "def reconnect\n end", "def reconnect\n end", "def reconnect!\n disconnect!\n @connection = Fb::Database.connect(@config)\n end", "def without_reconnect(&block); end", "def reconnect\n\t\tif @connection != nil\n\t\t\tself.close\n\n\t\t\t@connection = MonetDBConnection.new(user = @username, passwd = @password, lang = @lang, host = @host, port = @port)\n\t\t\t@connection.connect(db_name = @db_name, auth_type = @auth_type)\n\t\tend\n\tend", "def reconnect\n @mutex.synchronize do\n require \"mysql2\" unless ::Object.const_defined?(:Mysql2)\n\n args = {\n host: @db.opts[:host],\n username: @db.opts[:user],\n password: @db.opts[:pass],\n database: @db.opts[:db],\n port: @port,\n symbolize_keys: true,\n cache_rows: false,\n encoding: encoding\n }\n\n # Symbolize keys should also be given here, else table-data wont be symbolized for some reason - knj.\n @query_args = {symbolize_keys: true}\n @query_args[:cast] = false unless @db.opts[:type_translation]\n @query_args.merge!(@db.opts[:query_args]) if @db.opts[:query_args]\n\n pos_args = [:as, :async, :cast_booleans, :database_timezone, :application_timezone, :cache_rows, :connect_flags, :cast]\n pos_args.each do |key|\n args[key] = @db.opts[key] if @db.opts.key?(key)\n end\n\n args[:as] = :array\n\n if @db.opts[:conn]\n @conn = @db.opts[:conn]\n else\n @conn = ::Mysql2::Client.new(args)\n end\n\n query(\"SET NAMES '#{esc(encoding)}'\") if encoding\n end\n end", "def reconnect\n close_connection\n with_retries do\n open_connection\n end\n end", "def reconnect\n @subject.reconnect!\n logger.info \"Connection #{connection_uri} reconnected.\"\n end", "def reconnect\n if @connection != nil\n self.close\n \n @connection = MonetDBConnection.new(user = @username, passwd = @password, lang = @lang, host = @host, port = @port)\n @connection.connect(db_name = @db_name, auth_type = @auth_type)\n end\n end", "def reconnect!\n disconnect\n connect!\n end", "def reconnect!\n disconnect!\n connect\n end", "def reconnect!\n disconnect!\n connect\n end", "def _maybe_reconnect()\r\n\t\tif @request_count >= @reconnect_interval\r\n\t\t\t$LOG.debug(\"Completed #{@request_count} requests using this connection, reconnecting...\")\r\n\t\t\t_close_socket(@connection)\r\n\t\t\t@node_id, @connection = _reconnect()\r\n end\r\n end", "def reconnect!\n close\n connect!\n @on_reconnect.call(self) if @on_reconnect.respond_to?(:call)\n end", "def reconnect!\n @active = true\n end", "def reconnect!\n @socket.close\n connect\n end", "def reconnect!\n clear_cache!\n reset_transaction\n end", "def reconnect\n disconnect\n connect\n end", "def reconnect\n # reuse existing connection driver\n # to prevent race condition between fibers\n conn = (self.conn||= @driver.new)\n conn.disconnect if connected?\n @pid = Process.pid\n puts \"connecting: #@host:#@port $$#@pid\" if @debug\n conn.connect(@host, @port, @timeout)\n self\n end", "def reconnect\n @sock.close rescue nil\n sleep 1\n @sock = TCPSocket.open(@server, @port)\n sleep 1\n end", "def attempt_reconnect\n #The reconnect method called below is provided by EventMachine\n reconnect HOST, PORT\n end", "def reconnect(uri = nil)\n configure(uri) if uri\n @connection_manager.reconnect\n end", "def reconnect\n @read_replica.reconnect\n @primary.reconnect\n end", "def reconnect\n disconnect rescue nil\n @connected = true\n end", "def reconnect!\n if active?\n disconnect\n end\n connect\n end", "def close_connection; end", "def reconnect?\r\n reconnect.to_s.to_i != 0\r\n end", "def mysql_keepalive\n ping_mysql\n end", "def open()\n begin\n @my = Mysql.connect(@host, @user, @pw, @db)\n # Set the MySQL 'reconnect' flag -> Connection to the database will be \n # automatically maintained even if the Server closes it due to timed-out idle period\n @my.reconnect = true\n debug \" - Open Connection to MYSQL server - reconnect=#{@my.reconnect}\"\n rescue MysqlError => e\n debug \"SQL error message: #{e.error}.\"\n end\t\n end", "def retry_request(http, *args)\n 5.times do\n begin\n return http.send(:send_request, *args)\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n Chef::Log.debug('couchdb connection failed')\n end\n sleep 1\n end\n Chef::Log.debug('failed to connect to couchdb after 5 tries ... failing chef run')\n fail 'unable to connect to couchdb'\n end", "def ensure_db_connection\n conn = ActiveRecord::Base.connection\n begin\n try ||= 3\n conn.reconnect!\n rescue\n try -= 1\n # There is a issue where connection closed unexpectedly, need retry\n retry if try > 0\n end\n end", "def reconnect! # :nodoc:\n super\n @raw_connection.reset!\n rescue OracleEnhanced::ConnectionException => e\n @logger.warn \"#{adapter_name} automatic reconnection failed: #{e.message}\" if @logger\n end", "def legacy_reconect\n\t\tputs \"Reconectando...\"\n\t\tif @arry_ips.length == 0\n\t\t\t@arry_ips = Connections::SERVER_IP\n\t\telsif @arry_ips.length != Connections::SERVER_IP.length && @ip_integrity != \"m\"\n\t\t\t@arry_ips = Connections::SERVER_IP\n\t\tend\n\t\tre_reconect = false\n\t\t@server.close\n\t\tloop do\n\t\t\t@ip_pos += 1\n\t\t\t@ip_pos = 0 if @ip_pos >= @arry_ips.length\n\t\t\tbegin\n\t\t\t\t@server = TCPSocket.new(@arry_ips[@ip_pos], Connections::SERVER_PORT)\n\t\t\t\tre_reconect = false\n\t\t\trescue Errno::ECONNREFUSED => e\n\t\t\t\tre_reconect = true\n\t\t\t\tsleep(1)\n\t\t\tend\n\t\t\tbreak unless re_reconect \n\t\tend\n\t\tputs \"Reconectado!\"\n\tend", "def reconnect_if_needed\n reconnect if @concurrent_id != concurrent_id\n end", "def increase_reconnect_delay\n\n @reconnect_delay *= @parameters[:back_off_multiplier] if @parameters[:use_exponential_back_off]\n @reconnect_delay = @parameters[:max_reconnect_delay] if @reconnect_delay > @parameters[:max_reconnect_delay]\n\n @reconnect_delay\n end", "def reexecute_connections?\n return true\n end", "def _reconnect()\r\n num_nodes = @nodes.size\r\n attempts = 0\r\n new_node_id = @node_id\r\n while attempts < num_nodes\r\n new_node_id = (new_node_id + 1) % num_nodes\r\n new_node = @nodes[new_node_id]\r\n connection = nil\r\n begin\r\n connection = _make_connection(new_node.host, new_node.socket_port)\r\n @request_count = 0\r\n return new_node_id, connection\r\n rescue SocketError => message\r\n _close_socket(connection)\r\n connection.close\r\n $LOG.warn(\"Error connecting to node #{new_node_id}: #{message}\")\r\n attempts += 1\r\n end\r\n end\r\n\r\n # If we get here all nodes have failed us, explode\r\n raise VoldemortException.new('Connections to all nodes failed.')\r\n end", "def connect_reset_safe\n\t\tbegin\n\t\t\tconnect\n\t\trescue Rex::ConnectionRefused\n\t\t\treturn :refused\n\t\tend\n\t\treturn :connected\n\tend", "def setup_reconnect\n delay = @reconnect_manager.get_next_reconnect_delay(@last_status_code)\n\n if delay == -1\n execute_callback(@maxiumum_reconnects_reached_callback)\n terminate_connection\n elsif delay == 0\n execute_callback(@reconnect_callback, 0)\n attempt_reconnect\n else\n execute_callback(@reconnect_callback, delay.to_f/1000)\n EventMachine.add_timer(delay.to_f/1000) do\n attempt_reconnect\n end\n end\n end", "def reconnect!\n @connection.reset!\n rescue OracleEnhancedConnectionException => e\n @logger.warn \"#{adapter_name} automatic reconnection failed: #{e.message}\"\n end", "def connection_stale!\n log(:debug, :socket, 'connection is stale.')\n close_connection\n end", "def connection_closed\n end", "def reconnect(new_user=false)\n @user = (new_user == true ? Jetpants.app_credentials[:user] : new_user) if new_user\n if @db\n @db.disconnect rescue nil\n @db = nil\n end\n init_db_connection_pool\n end", "def reconnect server, port\n\t\tEventMachine::reconnect server, port, self\n\tend", "def open()\n begin\n @my = Mysql.connect(@host, @user, @pw, @db)\n # Set the MySQL 'reconnect' flag -> Connection to the database will be\n # automatically maintained even if the Server closes it due to timed-out idle period\n @my.reconnect = true\n debug \" - Open Connection to MYSQL server - reconnect=#{@my.reconnect}\"\n @connected = true\n rescue MysqlError => e\n debug \"SQL error message: #{e.error}.\"\n end\n end", "def reconnect\n tries = 0\n begin\n backend.client.reconnect\n rescue Redis::BaseConnectionError\n tries += 1\n\n if tries == 3\n logger.info \"Error reconnecting to Redis; quitting\"\n raise ConnectionError\n end\n\n logger.info \"Error reconnecting to Redis; retrying\"\n sleep(tries)\n retry\n end\n end", "def connect_to_webserver(drb_uri, options, web_server_uri)\n try_counter=0; try_max= 30\n\n loop do\n begin\n puts \"#{Time.now} *** try connecting to : #{web_server_uri}\"\n sleep(5+rand*2)\n RestClient.post web_server_uri+'/connectors', {:connector => {:service => options[:service], :uri => drb_uri, :uid => options[:uid], :prio => options[:prio]}}, :content_type => :json, :accept => :json\n puts \"*** connection succesfully established\"\n $stdout.flush \n return true\n rescue => e\n try_counter=try_counter+1\n puts \"Failed with error:#{e.message} and try number:#{try_counter}\"\n\n if try_counter==try_max\n puts \"Disconnected from Service: #{web_server_uri}\"\n $stdout.flush \n return false\n end\n\n end\n end\nend", "def hijack_db\n ActiveRecord::Base.establish_connection(\n :adapter => ENV['YAPTESTFE_DBTYPE'],\n :host => ENV['YAPTESTFE_DBIP'],\n :port => ENV['YAPTESTFE_DBPORT'].to_i,\n :username => ENV['YAPTESTFE_DBUSER'],\n :password => ENV['YAPTESTFE_DBPASS'],\n :database => ENV['YAPTESTFE_DBNAME']\n ) \n begin # catch db connection errors\n if not ActiveRecord::Base.connection.active?\n render :template => 'help/dberror', :layout => false\n end\n rescue PGError => msg\n logger.info \"DBERROR: #{msg}\"\n render :template => 'help/dberror', :layout => false\n end\n end", "def reconnect=(p1)\n #This is a stub, used for indexing\n end", "def new_connection; end", "def reset!\n reconnect!\n end", "def reconnect!(restore_transactions: false)\n retries_available = connection_retries\n deadline = retry_deadline && Process.clock_gettime(Process::CLOCK_MONOTONIC) + retry_deadline\n\n @lock.synchronize do\n reconnect\n\n enable_lazy_transactions!\n @raw_connection_dirty = false\n @verified = true\n\n reset_transaction(restore: restore_transactions) do\n clear_cache!(new_connection: true)\n configure_connection\n end\n rescue => original_exception\n translated_exception = translate_exception_class(original_exception, nil, nil)\n retry_deadline_exceeded = deadline && deadline < Process.clock_gettime(Process::CLOCK_MONOTONIC)\n\n if !retry_deadline_exceeded && retries_available > 0\n retries_available -= 1\n\n if retryable_connection_error?(translated_exception)\n backoff(connection_retries - retries_available)\n retry\n end\n end\n\n @verified = false\n\n raise translated_exception\n end\n end", "def dbreq(method,server,path,port,scheme,headers = {},data = nil,attempts = 0) # :nodoc:\n if data\n unless data.is_a?(IO)\n headers['Content-Length'] = data.respond_to?(:lstat) ? data.stat.size : data.size\n end\n else\n headers['Content-Length'] = 0\n end\n hdrhash = headerprep(headers)\n url = \"#{scheme}://#{server}#{path}\"\n print \"DEBUG: Data is #{data}\\n\" if (data && ENV['DATABASES_VERBOSE'])\n request = Typhoeus::Request.new(url,\n :body => data,\n :method => method.downcase.to_sym,\n :headers => hdrhash,\n :user_agent => \"Cloud Databases Ruby API #{VERSION}\",\n :verbose => ENV['DATABASES_VERBOSE'] ? true : false)\n CloudDB.hydra.queue(request)\n CloudDB.hydra.run\n \n response = request.response\n print \"DEBUG: Body is #{response.body}\\n\" if ENV['DATABASES_VERBOSE']\n raise CloudDB::Exception::ExpiredAuthToken if response.code.to_s == \"401\"\n response\n rescue Errno::EPIPE, Errno::EINVAL, EOFError\n # Server closed the connection, retry\n raise CloudDB::Exception::Connection, \"Unable to reconnect to #{server} after #{attempts} attempts\" if attempts >= 5\n attempts += 1\n @http[server].finish if @http[server].started?\n start_http(server,path,port,scheme,headers)\n retry\n rescue CloudDB::Exception::ExpiredAuthToken\n raise CloudDB::Exception::Connection, \"Authentication token expired and you have requested not to retry\" if @retry_auth == false\n CloudDB::Authentication.new(self)\n retry\n end", "def _reconn_prep()\n close_socket()\n if @parameters\n change_host()\n end\n @st.kill if @st # Kill ticker thread if any\n @rt.kill if @rt # Kill ticker thread if any\n @socket = nil\n end", "def raw_connection; end", "def reconnect\n handle_action_exceptions(__method__) do\n priv_close\n load_winrm_ps\n load_toolshck\n @json ? { 'result' => 'Success' } : true\n end\n end", "def session_reconnect_state\n super\n end", "def disconnect\n @conn.close\nend", "def reconnect(*client_names)\n return unless connection\n\n connection.client.reconnect\n\n unless narrow?\n clients_from(*client_names).each { |client_name|\n redis = @clients[client_name]\n redis.client.reconnect if redis\n }\n end\n\n connection\n end", "def postgres_keep_alive\n stat = @connection.status()\n rescue PGError => e\n @logger.info(\"Postgresql connection lost: #{e}\")\n @connection = postgres_connect\n if (stat = PGconn.CONNECTION_BAD) then\n @logger.info(\"Postgresql connection lost. Reconnect.\")\n @connection = postgres_connect\n end\n end", "def retry! request\n return if request[:retry] > 40\n\n @request.defer!(publisher, CnsBase::HttpClient::HttpRequestSignal.new(publisher, request.method, request.uri, request.query, request.body, request.header, request.name, request.params.merge!({:retry => request[:retry]+1})))\n raise CnsDb::SimpleDb::Errors::RetryError.new\n end", "def reconnect\n\t\tself.log.info \"Reconnecting to %s...\" % [ self.uri ]\n\t\t@conn = self.connect\n\t\tself.log.info \"...reconnected.\"\n\n\t\treturn true\n\trescue LDAP::ResultError => err\n\t\tself.log.error \"%s while attempting to reconnect to %s: %s\" %\n\t\t\t[ err.class.name, self.uri, err.message ]\n\t\traise \"Couldn't reconnect to %s: %s: %s\" %\n\t\t\t[ self.uri, err.class.name, err.message ]\n\tend", "def on_reconnect(&callback)\n @reconnect_cb = callback\n end", "def disconnect; @connection.close end", "def close\n @conn.close\n super\n end", "def reset_connection\n #close if \n @socket_server = nil\n connect\n end", "def dbreq(method, server, path, port, scheme, headers = {}, data = nil, attempts = 0) # :nodoc:\n if data\n unless data.is_a?(IO)\n headers['Content-Length'] = data.respond_to?(:lstat) ? data.stat.size : data.size\n end\n else\n headers['Content-Length'] = 0\n end\n hdrhash = headerprep(headers)\n url = \"#{scheme}://#{server}#{path}\"\n print \"DEBUG: Data is #{data}\\n\" if (data && ENV['DATABASES_VERBOSE'])\n request = Typhoeus::Request.new(url,\n :body => data,\n :method => method.downcase.to_sym,\n :headers => hdrhash,\n :verbose => ENV['DATABASES_VERBOSE'] ? true : false)\n CloudDB.hydra.queue(request)\n CloudDB.hydra.run\n\n response = request.response\n print \"DEBUG: Body is #{response.body}\\n\" if ENV['DATABASES_VERBOSE']\n raise CloudDB::Exception::ExpiredAuthToken if response.code.to_s == \"401\"\n response\n rescue Errno::EPIPE, Errno::EINVAL, EOFError\n # Server closed the connection, retry\n raise CloudDB::Exception::Connection, \"Unable to reconnect to #{server} after #{attempts} attempts\" if attempts >= 5\n attempts += 1\n @http[server].finish if @http[server].started?\n start_http(server,path,port,scheme,headers)\n retry\n rescue CloudDB::Exception::ExpiredAuthToken\n raise CloudDB::Exception::Connection, \"Authentication token expired and you have requested not to retry\" if @retry_auth == false\n CloudDB::Authentication.new(self)\n retry\n end", "def reconnect_ivl=(new_value)\n Zsock.set_reconnect_ivl(@zocket, new_value)\n end", "def reopen\n close\n @socket = UDPSocket.new\n host, port = server.split(\":\")\n @socket.connect(host, port.to_i)\n end", "def reconnect\n tries = 0\n begin\n redis.synchronize do |client|\n client.reconnect\n end\n rescue Redis::BaseConnectionError\n if (tries += 1) <= 3\n log \"Error reconnecting to Redis; retrying\"\n sleep(tries)\n retry\n else\n log \"Error reconnecting to Redis; quitting\"\n raise\n end\n end\n end", "def connection_status_server; end", "def connect config\n @db = ::Sequel.connect config\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end", "def open_conn(global = true, set_wait = true, host = DBHOST, user = DBUSER, pass = DBPASS, name = DBNAME)\n LOGGER.debug \"Opening db connection\"\n conn = nil\n\n #use global connection\n if global \n LOGGER.debug \"Using global database connection\"\n \n # global connection is already defined\n if is_global_db_connected?\n LOGGER.debug \"Global connection is set, just giving it back\"\n conn = $global_db_conn\n \n # global connection is not defined or not set\n else\n \n # open new global connection \n LOGGER.debug \"Global connection isn't defined or isn't set; attempting to reconnect...\"\n begin\n $global_db_conn = Mysql::new(host, user, pass, name)\n conn = $global_db_conn\n \n if set_wait && defined?(DBWAIT)\n LOGGER.debug \"Settign wait time for db connection to #{DBWAIT}\"\n sql = \"SET SESSION WAIT_TIMEOUT = #{DBWAIT};\" \n dbres = conn.query(sql)\n end\n\n rescue Mysql::Error => err\n LOGGER.error \"Error making db connection: #{$1}\"\n raise err\n end\n end\n \n # don't use global connection\n else\n LOGGER.debug \"Not using global connection, creating anew...\"\n # open new global connection \n\n begin\n conn = Mysql::new(host, user, pass, name)\n \n if set_wait && defined?(DBWAIT)\n LOGGER.debug \"Settign wait time for db connection to #{DBWAIT}\"\n sql = \"SET SESSION WAIT_TIMEOUT = #{DBWAIT};\" \n dbres = conn.query(sql)\n end\n rescue Mysql::Error => err\n LOGGER.error \"Error making db connection: #{$1}\"\n raise err\n end\n end\n \n conn\nend", "def close\n\t\t@conn.disconnect\n\tend", "def test_conn_1p_0015\n @conn.disconnect\n #\n cha = {:host => \"localhost\"}\n hash = { :hosts => [ \n {:login => user, :passcode => passcode, :host => host, :port => port, :ssl => nil},\n ],\n :reliable => true, # Note, issue #57 discussion\n :connect_headers => cha,\n :stompconn => get_stomp_conn(),\n :usecrlf => get_crlf(),\n :initial_reconnect_delay => 0.1,\n :max_reconnect_delay => 30,\n :use_exponential_back_off => true,\n :back_off_multiplier => 2,\n :max_reconnect_attempts => 10,\n }\n assert_raise Stomp::Error::ProtocolErrorConnect do\n conn = Stomp::Connection.open(hash)\n end\n hash[:connect_headers] = {\"accept-version\" => \"1.1\"}\n assert_raise Stomp::Error::ProtocolErrorConnect do\n conn = Stomp::Connection.open(hash)\n end\n end", "def reconnect lost_connection = false\n unless lost_connection\n send_command 'QUIT', [], 'Reconnecting'\n else\n $log.warn(\"IRCConnection.reconnect #{@name}\") { \"Lost connection.\" }\n end\n\n @reconnecting = true\n Events.delete_for @channels\n Events.delete_for @users\n\n EM.add_timer(Bot::Conf[:core][:reconwait]) do\n $log.warn(\"IRCConnection.reconnect #{@name}\") { \"Attempting to reconnect.\" }\n\n @config = Bot::Conf[:servers][name]\n super @config[:address], @config[:port]\n end\n end", "def connect_timeout; end", "def connect_timeout; end", "def mysql_keep_alive\n @connection.ping()\n rescue Mysql::Error => e\n @logger.info(\"MySQL connection lost: [#{e.errno}] #{e.error}\")\n @connection = mysql_connect\n end", "def set_reconnection(enable)\n @enable_reconnection = enable\n end", "def connection_status_handshake; end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def connection_status_done; end", "def attempt_reconnect\n @disconnect_cb.call(@last_err) if @disconnect_cb\n\n # Clear sticky error\n @last_err = nil\n\n # Do reconnect\n srv = nil\n begin\n srv = select_next_server\n\n # Establish TCP connection with new server\n @io = create_socket\n @io.connect\n @stats[:reconnects] += 1\n\n # Set hostname to use for TLS hostname verification\n @hostname = srv[:hostname]\n\n # Established TCP connection successfully so can start connect\n process_connect_init\n\n # Reset reconnection attempts if connection is valid\n srv[:reconnect_attempts] = 0\n srv[:auth_required] ||= true if @server_info[:auth_required]\n\n # Add back to rotation since successfully connected\n server_pool << srv\n rescue NoServersError => e\n raise e\n rescue => e\n # In case there was an error from the server check\n # to see whether need to take it out from rotation\n srv[:auth_required] ||= true if @server_info[:auth_required]\n server_pool << srv if can_reuse_server?(srv)\n\n @last_err = e\n\n # Trigger async error handler\n @err_cb.call(e) if @err_cb\n\n # Continue retrying until there are no options left in the server pool\n retry\n end\n\n # Clear pending flush calls and reset state before restarting loops\n @flush_queue.clear\n @pings_outstanding = 0\n @pongs_received = 0\n\n # Replay all subscriptions\n @subs.each_pair do |sid, sub|\n @io.write(\"SUB #{sub.subject} #{sub.queue} #{sid}#{CR_LF}\")\n end\n\n # Flush anything which was left pending, in case of errors during flush\n # then we should raise error then retry the reconnect logic\n cmds = []\n cmds << @pending_queue.pop until @pending_queue.empty?\n @io.write(cmds.join) unless cmds.empty?\n @status = CONNECTED\n @pending_size = 0\n\n # Reset parser state here to avoid unknown protocol errors\n # on reconnect...\n @parser.reset!\n\n # Now connected to NATS, and we can restart parser loop, flusher\n # and ping interval\n start_threads!\n\n # Dispatch the reconnected callback while holding lock\n # which we should have already\n @reconnect_cb.call if @reconnect_cb\n end", "def connect_to_drb()\n @drb_mutex.synchronize do\n if !@have_retried_connection\n begin\n @have_retried_connection = true\n uri_location = \"http://revtr.cs.washington.edu/vps/failure_isolation/spoof_only_rtr_module.txt\"\n uri = Net::HTTP.get_response(URI.parse(uri_location)).body\n @rtrSvc = DRbObject.new nil, uri\n @rtrSvc.respond_to?(:anything?)\n rescue DRb::DRbConnError\n # Email only gets sent to Dave for now\n Emailer.isolation_warning(\"Revtr Service is down!\", \"choffnes@cs.washington.edu\").deliver\n end \n end\n end\n end", "def upgrade\n fail ProtocolError unless @stream_id == 1\n send_connection_preface\n new_stream(state: :half_closed_local)\n end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end" ]
[ "0.70318574", "0.6847359", "0.68375975", "0.6749706", "0.67421275", "0.67421275", "0.6638965", "0.6516056", "0.6495502", "0.64952815", "0.6471527", "0.6380864", "0.63248515", "0.62904626", "0.6206614", "0.6206614", "0.6204935", "0.61641645", "0.61454904", "0.60938793", "0.60888225", "0.6083448", "0.60699534", "0.60543764", "0.60453504", "0.6034562", "0.6029022", "0.60140574", "0.5992807", "0.5989655", "0.59589136", "0.5932362", "0.5920746", "0.59205234", "0.5908653", "0.58468866", "0.5827952", "0.58007336", "0.57622385", "0.57586604", "0.57523507", "0.5745207", "0.5742348", "0.57181096", "0.5686752", "0.56816304", "0.56791365", "0.5673187", "0.5628789", "0.5600605", "0.5585726", "0.55686486", "0.55685014", "0.55616343", "0.5557179", "0.55562747", "0.55554014", "0.5527013", "0.5520375", "0.5511405", "0.54964966", "0.54860854", "0.5459916", "0.5459335", "0.54364353", "0.54229534", "0.54203534", "0.5418236", "0.54174966", "0.5399065", "0.5395478", "0.5391613", "0.53505015", "0.5350277", "0.5344704", "0.53374714", "0.53344154", "0.5319603", "0.5318785", "0.53098863", "0.52947044", "0.52947044", "0.5291078", "0.5284573", "0.52833915", "0.5275911", "0.5275911", "0.5275911", "0.5275911", "0.526375", "0.5252794", "0.5252262", "0.5251626", "0.5250106", "0.5250106", "0.5250106", "0.5250106", "0.5250106", "0.5250106", "0.5250106", "0.5250106" ]
0.0
-1
Query to the server Options: headers => Special headers payload => Data query => Query arguments
def query(method, path, options = {}) headers = DEFAULT_HEADERS.merge(options[:headers] || {}) uri = URI.parse(path) uri.query = URI.encode((options[:query] || {}).map {|k,v| "#{k}=#{v}"}.join('&')) payload = [:post,:put].include?(method) ? Yajl::Encoder.encode(options[:payload].nil? ? {} : options[:payload]) : nil $stderr << "#{method.to_s.upcase}: #{uri.to_s} (#{payload.inspect}, #{headers.inspect})\n" if $debug req = Net::HTTP.const_get(method.to_s.capitalize).new(uri.to_s, headers) req.basic_auth(@params[:username],@params[:password]) res = @connection.request(req,payload) data = res.body || "" data = Yajl::Parser.parse(data) if MIME::Type.simplified(res['content-type']) == 'application/json' data = symbolize_keys(data) if data.is_a?(Hash) $stderr << "#{res.code}: #{data.inspect}\n" if $debug raise FluidDB::Error.new(data) unless [200,201,204].include?(res.code.to_i) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query\n start do |connection|\n request = HTTP::Get.new \"#{ @uri.path }?#{ @uri.query }\"\n @headers.each { |header, value| request[header] = value }\n connection.request request\n end\n end", "def custom_query(options)\n form_data = {}\n options.each {|k,v| form_data[k.to_s] = v.to_s }\n form_data['action'] = 'query'\n make_api_request(form_data).first.elements['query']\n end", "def query_options; end", "def query(query=nil, options={})\n options = options.symbolize_keys\n query_params = query ? options.merge({ql: query}) : options\n self.get({params: query_params })\n self\n end", "def dh_api_query(command, params = ''); end", "def query(action, hash = {})\n # uri = URI.parse(\"https://130.59.10.31\")\n # http = Net::HTTP.new(uri.host, uri.port)\n # http.use_ssl = true\n # http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n #\n # request = Net::HTTP::Get.new(uri.request_uri)\n #\n # response = http.request(request)\n # response.body\n # response.status\n # response[\"header-here\"] # All headers are lowercase\n uri = URI.parse(@url + \"/api/xml?action=#{action}\")\n hash.each_pair do |key, val|\n if val\n if key == \"filter\" or key == \"sort\"\n uri.query += val.query\n else\n uri.query += \"&\" + key + \"=\" + CGI::escape(\"#{val}\")\n end\n end\n end\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 # logger = Logger.new('log/development.log')\n # logger.info(url.path + \"?\" + url.query)\n if @sessionid\n request.add_field(\"Cookie\", \"BREEZESESSION=\"+@sessionid)\n end\n puts \"ACS query - request: \" + request.path\n response = http.request(request)\n puts \"ACS query - response: \" + response.body.inspect\n return response\n end", "def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end", "def query\n socket.request[\"Query\"] || {}\n end", "def request_query(query)\n query[:token] = configuration[:token]\n query[:version] = configuration[:version] if query[:version].nil?\n query[:cv] = configuration[:cache_version] if query[:cache_version].nil?\n query\n end", "def query\n @options[:query].presence\n end", "def query_params\n {\n name:,\n q: query,\n api_key:\n }\n end", "def query_options\n @query_options\n end", "def search(query, options = {}, remote_ip = nil)\n (headers 'X-Forwarded-For' => remote_ip.to_s) unless remote_ip.nil?\n self.parameters = { 'q' => query }\n options[:page] ||= 1\n options[:count] ||= 5\n parameters['filter'] = options[:filter] if options[:filter]\n parameters['startIndex'] = options[:count] * (options[:page] - 1)\n parameters['maxResults'] = options[:count]\n parameters['key'] = options[:api_key] if options[:api_key]\n parameters['orderBy'] = 'newest' if options[:order_by].eql?('newest')\n parameters['country'] = options[:country] if options[:country]\n Response.new(get(url.to_s))\n end", "def query(query, apikey, endpoint, accept = \"application/json\")\n\tjson = open(\"#{endpoint}?query=#{CGI.escape(query)}&apikey=#{apikey}\", \"Accept\" => accept).read\n\tJSON.parse(json)\n\nend", "def query q, params={}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"q\" => q,\n \"Call_ID\" => params[:call_id],\n \"format\" => params[:format]\n }\n }\n get 'query.php', params\n end", "def get_data(custom_query)\n qopts = {\n token: token,\n from: from, \n output: :json, \n mode: mode,\n target: :'ahrefs.com'\n }.merge(custom_query)\n \n response = self.class.get('/', {query: qopts})\n \n raise \"HTTP error: #{response.code}\", response unless (200..299).include? response.code\n json = JSON.parse response.body\n unless json['error'].nil?\n error = json['error']\n raise \"API error: #{error}\" \n \n end\n return json\n end", "def query_options\n opts = options.merge(:input => input)\n session ? session.query_options.merge(opts) : opts\n end", "def query_params\n {\n affiliate:,\n access_key:,\n query:,\n offset:,\n limit:\n }\n end", "def query_param\n {\n query: ::Kahn::JSON.decode(params.fetch('query', '{}')),\n fields: ::Kahn::JSON.decode(params.fetch('fields', '{}')),\n limit: params.fetch(:limit, 10),\n skip: params.fetch(:skip, 0)\n }\n end", "def query_params\n raise(\"missing query_params stub!\")\n end", "def query(options = {})\n options.each_pair do |key, value|\n self.send(\"#{key}=\", value)\n end\n \n raise 'No API base URL provided.' unless @@base_url\n raise 'No API key provided.' unless @@api_key\n raise 'No resource specified.' unless @resource\n raise 'No format specified.' unless @format\n \n return do_get\n end", "def query(query, options = {})\n GRel::Debugger.debug \"QUERYING DESCRIBE...\"\n GRel::Debugger.debug query\n GRel::Debugger.debug \"** LIMIT #{@last_query_context.limit}\" if @last_query_context.limit\n GRel::Debugger.debug \"** OFFSET #{@last_query_context.offset}\" if @last_query_context.offset\n GRel::Debugger.debug \"----------------------\"\n args = {:describe => true}\n #args = {}\n args[:accept] = options[:accept] if options[:accept]\n args[:offset] = @last_query_context.offset if @last_query_context.offset\n args[:limit] = @last_query_context.limit if @last_query_context.limit\n @connection.query(@db_name,query, args).body\n end", "def query_options\n # todo: support more options?\n options = {}\n options.merge!({:limit => limit_value.to_json}) if limit_value\n options.merge!({:skip => @options[:skip].to_json}) if @options[:skip]\n options.merge!({:reversed => reversed?.to_json}) if reversed?\n options.merge!({:order => @options[:order]}) if @options[:order]\n options.merge!({:cursor => @options[:cursor]}) if @options[:cursor]\n options\n end", "def http_query(verb, uri, opts)\n JSON.parse RestClient.send(verb, uri.to_s, opts)\n end", "def query ; @request.params ; end", "def key_in_query_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsageApi.key_in_query ...'\n end\n # resource path\n local_var_path = '/query'\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] || 'Object'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['api_key_query']\n\n new_options = opts.merge(\n :operation => :\"UsageApi.key_in_query\",\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: UsageApi#key_in_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def query\n @query || params[:q] || params[:tq]\n end", "def index\n @querylists = HTTParty.post(\"http://66.175.217.67:3020/argames/getQuery\", :body => { :checkFilter => '' }, :headers => {\"Authorization\" => \"Bearer \" + ENV[\"API_KEY\"] })\n end", "def build_get_options( params={}, user_headers={})\n get_options = {}\n query ={}\n\n query.merge!(params)\n\n # pass any headers\n headers ={}\n headers.merge!( user_headers )\n\n get_options[:query] = query\n get_options[:headers] = headers\n get_options[:basic_auth] = { username: Edelements.options[:api_key], password: ''}\n get_options\n end", "def query_parameters; end", "def query options\n from = options.fetch :start\n to = options.fetch :end\n\n query = @history.objects.find { |o| o.name == \"query\" }\n\n filter = OBIX::Builder.new do\n obj do\n abstime name: \"start\", val: from.iso8601\n abstime name: \"end\", val: to.iso8601\n end\n end.object\n\n history = query.invoke filter\n\n history.objects.find { |o| o.name == \"data\" }\n end", "def query(queryString)\n \t \tcheck_login\n \t\t\tquery = @client.request :query do\n \t \t\t\tsoap.header = { \"SessionHeader\" => { \"session\" => \"#{self.session}\" }}\n \t\t \t\tsoap.body = {\"queryString\" => queryString }\n \t\t\tend\n \t\t\t#query.to_hash\n \t\t\tqr = Zapi::QueryResponse.new(query.to_hash, self)\n \t\t\tqr.objects\n \tend", "def query(params)\n request(Resources::RESOURCE_QUERY, HTTP_METHOD_POST, params)\n end", "def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end", "def query_params\n validate_params!\n \n qargs = {\n Ebay::Search::Api::OPERATION_NAME[:key] => Ebay::Search::Api::OPERATION_NAME[:value],\n Ebay::Search::Api::SERVICE_VERSION[:key] => Ebay::Search::Api::SERVICE_VERSION[:value],\n Ebay::Search::Api::SECURITY_APPNAME[:key] => self.app_name,\n Ebay::Search::Api::GLOBAL_ID[:key] => self.global_id,\n Ebay::Search::Api::RESPONSE_DATA_FORMAT[:key] => Ebay::Search::Api::RESPONSE_DATA_FORMAT[:value],\n Ebay::Search::Api::PER_PAGE[:key] => self.per_page,\n Ebay::Search::Api::KEYWORDS[:key] => self.keywords\n }\n \n query_formatter(qargs) do |params|\n params.join(\"&\")\n end\n end", "def query_params; end", "def get\n request_object.get_query\n end", "def query_options\n @query_options ||= @connection.query_options\n end", "def search(options = {})\n self.date = options[:date] || date\n self.hd = options[:hd] || hd\n response = HTTParty.get(DEFAULT_URL, query: attributes)\n handle_response(response)\n end", "def request_search(options, format = :xml)\r\n\t\t\turi = URI \"#{API_URL}edsapi/rest/Search?#{options}\"\r\n\t\t\t@log << uri.to_s << \" -- \"\r\n\t\t\t#return uri.request_uri\r\n\t\t\treq = Net::HTTP::Get.new(uri.request_uri)\r\n\r\n\t\t\treq['x-authenticationToken'] = @auth_token\r\n\t\t\treq['x-sessionToken'] = @session_token\r\n\t\t\treq['Accept'] = 'application/json' #if format == :json\r\n\r\n\t\t\tNet::HTTP.start(uri.hostname, uri.port, :read_timeout => 10) { |http|\r\n \t\t\tbegin\r\n\t\t\t return http.request(req).body\r\n\t\t\trescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\r\n\t\t\t raise \"No response from server\"\r\n\t\t\tend\r\n\t\t\t}\r\n end", "def build_query(options)\n array = []\n\n options.each do |key, value|\n next if key == :all\n if [:filter, :select, :top].include?(key)\n array << \"$#{key}=#{value}\" if value\n elsif key == :continuation_token\n value.each { |k, token| array << \"#{k}=#{token}\" if token }\n else\n array << \"#{key}=#{value}\" if value\n end\n end\n\n array.join('&')\n end", "def search(query, options = {}); end", "def query(query, options={})\n logger.debug(\"Ruby-Sesame querying:\\n#{ query }\\n\\nOptions: #{ options.pretty_inspect }\")\n\n options = {\n :result_type => DATA_TYPES[:JSON],\n :method => :get,\n :query_language => \"sparql\",\n }.merge(options)\n\n easy = Curl::Easy.new\n easy.headers[\"Accept\"] = options[:result_type]\n\n if options[:method] == :get\n easy.url = (self.uri + \"?\" +\n \"query=#{ easy.escape(query) }&\"+\n \"queryLn=#{ easy.escape(options[:query_language]) }&\" +\n (!options[:infer] ? \"infer=false&\" : \"\" ) +\n if options[:variable_bindings]\n options[:variable_bindings].keys.map {|name|\n \"$<#{ easy.escape(name) }>=#{ easy.escape(options[:variable_bindings][name]) }\"\n }.join(\"&\")\n else\n \"\"\n end\n ).chop\n\n\n easy.http_get\n\n else # POST.\n easy.url = self.uri\n\n fields = [\"query=#{ easy.escape(query) }\",\n \"queryLn=#{ easy.escape(options[:query_language]) }\"\n ]\n\n fields.push(\"infer=false\") unless options[:infer]\n\n options[:variable_bindings].keys.map {|name|\n field.push(\"$<#{ easy.escape(name) }>=#{ easy.escape(options[:variable_bindings][name]) }\")\n } if options[:variable_bindings]\n\n easy.http_post(fields)\n end\n\n raise(SesameException.new(easy.body_str)) unless easy.response_code == 200\n\n easy.body_str\n end", "def request_query_params\n {}\n end", "def query(options)\n run_command('query', options)\n end", "def populate_options\n \tself.results = HTTP.auth(self.bearer_token).get(search_url, params: search_params).parse\n\tend", "def query(query)\n url = \"query?query=#{URI.encode(query)}\"\n api_get(url).body\n end", "def conditional_query(opts = {})\n data, _status_code, _headers = conditional_query_with_http_info(opts)\n data\n end", "def query_parameters\n params = {}\n params['filter'] = @optional['filter'] if @optional['filter']\n params\n end", "def query(soql)\n response = api_get 'query', :q => soql\n mashify? ? response.body : response.body['records']\n end", "def default_query\n {\n 'authtoken' => ZohoReports.configuration.auth_token,\n 'ZOHO_OUTPUT_FORMAT' => 'JSON',\n 'ZOHO_ERROR_FORMAT' => 'JSON',\n 'ZOHO_API_VERSION' => self.api_version,\n }\n end", "def query(options) # :nodoc:\n @next_token = options[:next_token]\n query_expression = build_conditions(options[:query_expression])\n # add sort_options to the query_expression\n if options[:sort_option]\n sort_by, sort_order = sort_options(options[:sort_option])\n sort_query_expression = \"['#{sort_by}' starts-with '']\"\n sort_by_expression = \" sort '#{sort_by}' #{sort_order}\"\n # make query_expression to be a string (it may be null)\n query_expression = query_expression.to_s\n # quote from Amazon:\n # The sort attribute must be present in at least one of the predicates of the query expression.\n if query_expression.blank?\n query_expression = sort_query_expression\n elsif !query_attributes(query_expression).include?(sort_by)\n query_expression += \" intersection #{sort_query_expression}\"\n end\n query_expression += sort_by_expression\n end\n # request items\n query_result = self.connection.query(domain, query_expression, options[:max_number_of_items], @next_token)\n @next_token = query_result[:next_token]\n items = query_result[:items].map do |name|\n new_item = self.new('id' => name)\n new_item.mark_as_old\n reload_if_exists(record) if options[:auto_load]\n new_item\n end\n items\n end", "def query_statistics(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'QueryStatistics'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :dimensions\n\t\t\targs[:query]['Dimensions'] = optional[:dimensions]\n\t\tend\n\t\tif optional.key? :end_time\n\t\t\targs[:query]['EndTime'] = optional[:end_time]\n\t\tend\n\t\tif optional.key? :extend\n\t\t\targs[:query]['Extend'] = optional[:extend]\n\t\tend\n\t\tif optional.key? :function\n\t\t\targs[:query]['Function'] = optional[:function]\n\t\tend\n\t\tif optional.key? :metric\n\t\t\targs[:query]['Metric'] = optional[:metric]\n\t\tend\n\t\tif optional.key? :period\n\t\t\targs[:query]['Period'] = optional[:period]\n\t\tend\n\t\tif optional.key? :project\n\t\t\targs[:query]['Project'] = optional[:project]\n\t\tend\n\t\tif optional.key? :start_time\n\t\t\targs[:query]['StartTime'] = optional[:start_time]\n\t\tend\n\t\tif optional.key? :target_period\n\t\t\targs[:query]['TargetPeriod'] = optional[:target_period]\n\t\tend\n\t\tself.run(args)\n\tend", "def _query(*params)\n fail 'not implemented'\n end", "def request_authorized_query query_string\n query query_string\nend", "def execute!\n query_params = {}\n query_params[:skip_header] = true if config[:skip_column_names]\n Request.new(resources_path, :query_params => query_params, :sign => config[:my]).get(headers).print(config)\n end", "def do_query(params) \n link = @api_url + \"/brief/json/\" + params\n return MultiJson.load( open(link).read )\n end", "def query\n begin\n response = resource[\"/query/#{app}\"].post(:days => options[:days], :url => options[:url], :mode => options[:mode])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def parse_options(options) # :nodoc\n options[:max_results] ||= 25\n options[:order_by] ||= 'startTime' # other option is 'updated'\n options[:expand_recurring_events] ||= true\n query_string = \"&orderBy=#{options[:order_by]}\"\n query_string << \"&maxResults=#{options[:max_results]}\"\n query_string << \"&singleEvents=#{options[:expand_recurring_events]}\"\n query_string << \"&q=#{options[:query]}\" unless options[:query].nil?\n query_string\n end", "def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end", "def query_parameters\n end", "def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end", "def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end", "def query\n params.sort.map { |k, v| \"#{k}=\" + escape(v) }.join('&')\n end", "def do_query(endpoint, query)\n url = compile_query_url(endpoint, query)\n Net::HTTP::get_response(URI.parse(url))\n end", "def query\n @query ||= Waves::Request::Query.new( \n Waves::Request::Utilities.destructure( request.query ) )\n end", "def query(query_string)\n restforce_client.query(query_string)\n end", "def query(query, args = {})\n args[:q] = query\n args[:qt] = 'standard'\n conn = ActiveFedora::SolrService.instance.conn\n result = conn.post('select', data: args)\n result.fetch('response').fetch('docs')\n end", "def query(query_hash, options = {})\n\t \tget_records('-findquery', query_hash, options)\n\t end", "def query_params\n params[:query]\n end", "def query_params\n params.fetch(:query, {})\n end", "def apiQuery(query, vars = {}, privileged = false)\n if vars.empty?\n query = \"query { #{query} }\"\n else\n query = \"query(#{vars.map{|name, pair| \"$#{name}: #{pair[0]}\"}.join(\", \")}) { #{query} }\"\n end\n varHash = Hash[vars.map{|name,pair| [name.to_s, pair[1]]}]\n headers = { 'Content-Type' => 'application/json' }\n privKey = ENV['ESCHOL_PRIV_API_KEY'] or raise(\"missing env ESCHOL_PRIV_API_KEY\")\n privileged and headers['Privileged'] = privKey\n response = HTTParty.post($api_url, :headers => headers, :body => { variables: varHash, query: query }.to_json)\n response.code == 200 or raise(\"Internal error (graphql): HTTP code #{response.code}\")\n response['errors'] and raise(\"Internal error (graphql): #{response['errors'][0]['message']}\")\n response['data']\nend", "def query(query, args = {})\n args.merge!(q: query, qt: 'standard')\n conn = ActiveFedora::SolrService.instance.conn\n result = conn.post('select', data: args)\n result.fetch('response').fetch('docs')\n end", "def request_headers(opts)\n headers = {\n accept: 'application/sparql-results+json',\n content_type: 'text/plain'\n }\n\n unless opts[:reasoning].blank?\n unless REASONING_LEVELS.member?(opts[:reasoning])\n fail \"Invalid reasoning level: #{opts[:reasoning]}\"\n end\n headers['SD-Connection-String'] = \"reasoning=#{opts[:reasoning]}\"\n end\n\n headers\n end", "def query(query, params={})\n query_url = \"#{API_URL}/query.json?#{query}\"\n perform_get_request(query_url, params)\n end", "def query options\n from = options.fetch :start\n to = options.fetch :end\n\n query = @alarms.objects.find { |o| o.name == \"query\" }\n\n filter = OBIX::Builder.new do\n obj do\n abstime name: \"start\", val: from.iso8601\n abstime name: \"end\", val: to.iso8601\n end\n end.object\n\n alarms = query.invoke filter\n\n alarms.objects.find { |o| o.name == \"data\" }\n end", "def query_string \n headers[\"QUERY_STRING\"]\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query_options(options)\n options.each_with_object({}) do |(key, val), hash|\n case key\n when :date\n hash[:ShowDate] = val.to_ShowDate\n when :movie_id\n hash[:movie_id] = val\n when :movie_source\n # Set both movie_id and ShowDate.\n movie_source = val\n hash.merge! query_options(movie_id: movie_source.external_id)\n hash.merge! query_options(date: movie_source.released_on) if movie_source.released_on\n when :postal_code\n hash[:SearchZip] = val.to_s.gsub(' ', '')\n else\n raise \"unknown option: #{key}\"\n end\n end\n end", "def combined_options(options)\n resp = @options\n resp[:query].merge! options\n resp\n end", "def query_parameters\n request.GET\n end", "def fetch_query args={}\n query(args.clone)\nend", "def fetch_query args={}\n query(args.clone)\nend", "def query(query, params={})\n query *= '+' if query.is_a? Array\n request '', params.merge(:query => query)\n end", "def query\n { \"page\" => page,\n \"page_size\" => page_size,\n \"phrase\" => phrase }\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def json_query_headers\n headers = Hash.new\n offset = self.offset.to_i\n limit = self.limit.nil? ? nil : self.limit.to_i + offset - 1\n\n if offset != 0 || !limit.nil?\n headers.merge!( {\"Range\" => \"items=#{offset}-#{limit}\"} )\n end\n return headers\n end", "def get_queries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.get_queries ...\"\n end\n # resource path\n local_var_path = \"/server/queries/definitions\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', '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 => 'QueryDefinitions')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomQueriesBPMApi#get_queries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def detail_search(opts={})\r\n opts[:version] = '2011-07-14' unless opts.key?(:version)\r\n opts[:operation] = 'ProductDetail' unless opts.key?(:operation)\r\n opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)\r\n Rakuten::Request.get(\"http://api.rakuten.co.jp/rws/3.0/json\", Rakuten::Api.merge(opts))\r\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query_metric(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'QueryMetric'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :dimensions\n\t\t\targs[:query]['Dimensions'] = optional[:dimensions]\n\t\tend\n\t\tif optional.key? :end_time\n\t\t\targs[:query]['EndTime'] = optional[:end_time]\n\t\tend\n\t\tif optional.key? :extend\n\t\t\targs[:query]['Extend'] = optional[:extend]\n\t\tend\n\t\tif optional.key? :length\n\t\t\targs[:query]['Length'] = optional[:length]\n\t\tend\n\t\tif optional.key? :metric\n\t\t\targs[:query]['Metric'] = optional[:metric]\n\t\tend\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :period\n\t\t\targs[:query]['Period'] = optional[:period]\n\t\tend\n\t\tif optional.key? :project\n\t\t\targs[:query]['Project'] = optional[:project]\n\t\tend\n\t\tif optional.key? :start_time\n\t\t\targs[:query]['StartTime'] = optional[:start_time]\n\t\tend\n\t\tself.run(args)\n\tend", "def conditional_query_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConditionalApi.conditional_query ...'\n end\n # resource path\n local_var_path = '/v2/private/stop-order'\n\n # query parameters\n query_params = {}\n query_params[:'stop_order_id'] = opts[:'stop_order_id'] if !opts[:'stop_order_id'].nil?\n query_params[:'order_link_id'] = opts[:'order_link_id'] if !opts[:'order_link_id'].nil?\n query_params[:'symbol'] = opts[:'symbol'] if !opts[:'symbol'].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', 'application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey', 'apiSignature', 'timestamp']\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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConditionalApi#conditional_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def headers\r\n # give access to helpers to opts with a different name\r\n @opts\r\n end", "def query_params\n\t\t\t\t{}\n\t\t\tend" ]
[ "0.7025024", "0.69391894", "0.67741704", "0.6513036", "0.63895476", "0.6340665", "0.6310358", "0.62826514", "0.62426656", "0.6236473", "0.6227796", "0.6180938", "0.6177872", "0.61531353", "0.6143883", "0.61168987", "0.6097822", "0.60848093", "0.6076635", "0.6069289", "0.60510117", "0.605087", "0.6038896", "0.60186327", "0.59951174", "0.5986693", "0.5981037", "0.5979914", "0.5974011", "0.597086", "0.5970439", "0.5958945", "0.5946471", "0.5937473", "0.5927063", "0.59239185", "0.5921623", "0.5917656", "0.5909188", "0.5904335", "0.59041846", "0.58978426", "0.58921283", "0.58862257", "0.58858854", "0.5875612", "0.58734655", "0.5872404", "0.58685935", "0.586637", "0.58616436", "0.5859247", "0.5841723", "0.5838689", "0.5834086", "0.58271974", "0.5810881", "0.5783659", "0.5771502", "0.5753405", "0.5745279", "0.5731278", "0.5731278", "0.5722546", "0.5722187", "0.57210827", "0.57139456", "0.570657", "0.5705965", "0.5701808", "0.56996214", "0.568509", "0.56780875", "0.56746536", "0.56719935", "0.5670496", "0.56694597", "0.5669319", "0.5669319", "0.5669319", "0.5669319", "0.5661873", "0.56618047", "0.5661069", "0.5657286", "0.5657286", "0.56551266", "0.56538683", "0.5649479", "0.5649479", "0.56468546", "0.5635834", "0.5623723", "0.5616124", "0.5616124", "0.5616124", "0.56150633", "0.5607884", "0.56071603", "0.5606613" ]
0.58953935
42
Alternative to the instance variable Use a method. The implicit return immediately spits out the hash you create You can read this within methods.
def nucleotide_score { A: 0, C: 0, G: 0, T: 0 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash()\n #This is a stub, used for indexing\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n @hash || calculate_hash!\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash\n @hash\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def hash\n @hash.hash\n end", "def hash(*) end", "def hash\r\n @_hash ||= _hash\r\n end", "def hash()\n #This is a stub, used for indexing\nend", "def get\n\t\t\t@hash\n\t\tend", "def get_hash()\n return @@hash;\n end", "def __hash\n @hash\n end", "def hash\n code.hash\n end", "def hash\n if @_hash.nil?\n @_hash = {}\n run\n end\n @_hash\n end", "def hash_code; end", "def hash\n @hash ||= self.to_a.hash\n end", "def output_hash; end", "def hash\n code.hash\n end", "def hash\n value.hash\n end", "def hash\n 0\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n\t\tvalue.hash\n\tend", "def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\n end", "def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\n end", "def hash=(_arg0); end", "def hash\r\n return to_s.hash\r\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n\t\treturn self.name.to_s.hash\n\tend", "def hash\n self.class.name.hash ^ @key.hash\n end", "def hash\n guid.hash\n end", "def hash\n data.hash\n end", "def new_hash\nHash.new\nend", "def hash\n return to_s.hash\n end", "def hash(key); end", "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def create_hash(&block); end", "def create_hash(&block); end", "def hash\n self.class.name.hash\n end", "def hash\n state.hash\n end", "def hash\n state.hash\n end", "def hash\n\n self.h.fei.hash\n end", "def hash\n self.state.hash\n end", "def hash\n @value.hash\n end", "def hash\n name.hash\n end", "def hash\n name.hash\n end", "def to_hash() end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash\n fullname.hash\n end", "def hash\n to_h.hash ^ self.class.hash\n end", "def hash\r\n id.hash\r\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n name.hash ^ provider.hash\n end", "def hash\n hash_args.hash\n end", "def hash\n self.to_f.hash\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def get_hash(input)\n return $hasher.reset.update(input).to_s\nend", "def hash\n swap\n scatter\n completed_string\n end", "def hash\n return @id.hash\n end", "def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end", "def digest_hash_function\n decode[:hash_function]\n end", "def get_hash()\n\t\t\treturn @config.clone()\n\t\tend", "def hash\n to_s.hash\n end", "def hash\n @hash ||= @client.get_hash(path)\n @hash\n end", "def hash\n @hash ||= @client.get_hash(path)\n @hash\n end", "def hash\n @symbols.hash + 37*positive?.hash\n end", "def hash\n @vbits.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 hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end" ]
[ "0.80561984", "0.7926657", "0.7926657", "0.7926657", "0.7926657", "0.7926657", "0.7926657", "0.7926657", "0.7892501", "0.78740686", "0.78740686", "0.78740686", "0.78740686", "0.78740686", "0.78740686", "0.78740686", "0.78740686", "0.78740686", "0.78740686", "0.7807299", "0.77515703", "0.77515703", "0.77515703", "0.7673091", "0.7621465", "0.7485377", "0.74660546", "0.7460492", "0.7429999", "0.7410234", "0.73677444", "0.73519766", "0.73489755", "0.73173237", "0.727915", "0.72331285", "0.7196688", "0.7176602", "0.7155021", "0.71531546", "0.71531546", "0.71531546", "0.71518415", "0.7127707", "0.7104658", "0.709731", "0.7066117", "0.7053784", "0.70452595", "0.7027734", "0.69975626", "0.6972316", "0.69538754", "0.6925128", "0.6922971", "0.6921772", "0.69105923", "0.69105923", "0.6907959", "0.69062394", "0.69062394", "0.690584", "0.6904878", "0.68880093", "0.68846977", "0.68838215", "0.68780595", "0.68776906", "0.68776906", "0.68750453", "0.686777", "0.6832675", "0.68300056", "0.6818251", "0.6818251", "0.679142", "0.6769884", "0.6760937", "0.6755214", "0.67506826", "0.67435825", "0.67228645", "0.67064345", "0.6683262", "0.66745967", "0.66735", "0.6657595", "0.6657595", "0.66520864", "0.6649853", "0.6649614", "0.66393536", "0.6637755", "0.6637755", "0.6637755", "0.6637755", "0.6637755", "0.6637755", "0.6637755", "0.6637755", "0.6637755" ]
0.0
-1
def stringy num test_arr = [] counter = 0 loop do test_arr << "1" break if num == test_arr.size test_arr << "0" break if num == test_arr.size counter += 1 end test_arr.join('') end p stringy 11 puts stringy(6) == '101010' puts stringy(9) == '101010101' puts stringy(4) == '1010' puts stringy(7) == '1010101' Further Exploration
def stringy(int, int1 = 1) if int && int1 != 0 Array.new(int) { |i| i.even? ? '1' : '0' }.join elsif int1 == 0 Array.new(int) { |i| i.even? ? '0' : '1' }.join end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringy(num)\n arr = []\n\n num.times do |idx|\n digit = idx.odd? ? '0' : '1'\n arr << digit\n end\n\n arr.join\nend", "def stringy2(int, *zero)\n str = ''\n if zero == [0] then str += '0' else str += '1' end\n int.times do |n|\n if n > 0\n array = str.chars\n if array[n - 1] == '0' then str += '1' else str += '0' end\n end\n end\n p str\nend", "def stringy(num = 1)\n ones_zeros = []\n counter = 0\n \n loop do\n # break if num == 1\n if ones_zeros == []\n ones_zeros << 1\n end\n\n ones_zeros[counter] == 1 ? ones_zeros << 0 : ones_zeros << 1\n counter += 1\n break if counter == num -1\n end\n string_num = ones_zeros.join\nend", "def stringy(num)\n str = ''\n num.times do |indx|\n indx % 2 == 0 ? str += '1' : str += '0'\n end\n return str\nend", "def stringy(num)\n str = ''\n 1.upto(num) do |index|\n if index.odd?\n str << '1'\n else\n str << '0'\n end\n end\n str\nend", "def stringy(num)\n binary = ''\n loop do\n binary << '1'\n break if binary.length == num\n binary << '0'\n break if binary.length == num\n end\n binary\nend", "def stringy(input)\n result = []\n counter = 0\n\n result << '1'\n \n until result.size == input\n result[counter] == '1'? result << '0' : result << '1'\n counter += 1\n end\n \n result.join('')\nend", "def stringy(number)\n result = []\n\n number.times do |num|\n numbers = num.even? ? '1' : '0'\n result << numbers\n end\n \n result.join\nend", "def stringy(number)\n result = ''\n number.times do |idx|\n result << (idx.even? ? '1' : '0')\n end\n result\nend", "def stringy(num)\n str = ''\n char = '1'\n\n loop do\n str += char\n\n char = char == '1' ? '0' : '1'\n break if str.size == num\n end\n\n str\nend", "def stringy(number)\n result = []\n\n 1.upto(number) do |num|\n numbers = num.even? ? '0' : '1'\n result.push(numbers)\n end\n result.join\nend", "def stringy(number)\n arr = []\n (1..number).each { |num| arr << num }\n\n string = \"\"\n arr.each do |num|\n string << \"0\" if num % 2 == 0\n string << \"1\" if num % 2 == 1\n end\n\n string\nend", "def stringy(number)\n stringy = []\n number.times do |index|\n n = index.even? ? 1 : 0\n stringy << n\n end\n stringy.join\nend", "def stringy(number)\n digits = []\n counter = 0\n while counter < number do\n digits[counter] = counter.odd? ? 0 : 1\n counter += 1\n end\n digits.join\nend", "def stringy(num)\n (1..num).map { |idx| idx.odd? ? '1' : '0' }.join\nend", "def stringy(number)\n result = ''\n number.times {|i| i.even? ? result << '1' : result << '0'}\n result\nend", "def stringy(int)\n\ncounter = int\narr = []\n\n while counter > 0\n if !arr.empty? && counter % 2 ==0\n arr << 0\n elsif counter % 2 !=0 && arr.last != 1 || arr.empty?\n arr << 1\n else\n next\n end\n counter -= 1\n end\n arr.join()\nend", "def stringy(number)\n result = ''\n 1.upto(number) do |num|\n answer = num.odd? ? '1' : '0'\n result << answer\n end\n\n result\nend", "def stringy(number)\n string = \"\"\n number.times do |n|\n n.even? ? string << \"1\" : string << \"0\"\n end\n string\nend", "def stringy(num)\n str = ''\n num.times do |i|\n str << '1' if i.even?\n str << '0' if i.odd?\n end\n str\nend", "def stringy(len)\n str = ''\n len.times do |n|\n n.even? ? str << '1' : str << '0'\n end\n str\nend", "def stringy(size)\n i, string = 0, \"\"\n while i < size do\n string[-1] == \"1\" ? string << \"0\" : string << \"1\"\n i += 1\n end\n return string\nend", "def stringy(int)\n string = \"\"\n int.times do |x|\n x.even? ? string += \"1\" : string += \"0\"\n end\n string\nend", "def stringy(number, optional = 1)\n result = '' # initialize empty string instead of array\n number.times do |num|\n if optional == 1\n numbers = num.even? ? '1' : '0' # initializing numbers variable to store results\n result << numbers\n else numbers = num.odd? ? '1' : '0'\n result << numbers\n end\n end\n result # no need for join here since this is a string, not an array.\nend", "def stringy(int)\n ones_and_zeros = []\n int.times do\n if ones_and_zeros.empty?\n ones_and_zeros << '1'\n elsif ones_and_zeros[-1] == '1'\n ones_and_zeros << '0'\n else\n ones_and_zeros << '1'\n end\n end\n ones_and_zeros.reduce(:+)\nend", "def stringy(integer)\n ones_and_zeroes = []\n\n integer.times do |index|\n number = index.even? ? 1 : 0\n ones_and_zeroes << number\n end\n\n ones_and_zeroes.join\nend", "def stringy(int)\n stringy = \"\"\n odd = false\n int.times do\n if odd == true\n stringy << \"0\"\n odd = false\n else \n stringy << \"1\"\n odd = true\n end\n end\n return stringy\nend", "def stringy(num, bit = 1)\n bin_arr = []\n num.times { |n| n.even? ? bin_arr << (0 + bit) : bin_arr << (1 - bit) }\n bin_arr.join\nend", "def stringy(length)\n string = ''\n length.times do |index|\n number_str = index.even? ? '1' : '0'\n string << number_str\n end\n string\nend", "def stringy(int)\n arr_digits = (1..int).to_a\n arr10 = []\n arr_digits.each do |num|\n num % 2 == 1 ? arr10 << 1 : arr10 << 0\n end\n arr10.join\nend", "def stringy(number)\n string = \"\"\n counter = 0\n state = 0\n\n loop do\n if state == 0\n string << \"1\"\n state = 1\n else\n string << \"0\"\n state = 0\n end\n\n counter += 1\n\n break if counter == number\n end\n\n string\nend", "def stringy(num)\n zero_array = []\n one_array = []\n\n (num / 2).times do\n zero_array << 0\n one_array << 1\n end\n\n if num.odd?\n one_array << 1\n end\n\n one_array.zip(zero_array).flatten.join(\"\")\nend", "def stringy(num, b = 1)\n string = ''\n if b = 0\n num.times { |v| v.odd? ? string.concat('1') : string.concat('0') }\n return string\n else \n num.times { |v| v.odd? ? string.concat('0') : string.concat('1') }\n return string\n end \nend", "def stringy(number)\n number_range = (1..number)\n binary = []\n number_range.each do |num|\n if num % 2 == 1\n binary << 1\n elsif num % 2 == 0\n binary << 0\n end\n end\n binary.join(\"\")\nend", "def stringy(integer)\n i = 1\n output = ''\n while i <= integer\n output += '1' if i.odd?\n output += '0' if i.even?\n i += 1\n end\n output\nend", "def stringy(integer)\n numbers = []\n\n integer.times do |index|\n number = index.even? ? 1 : 0 # ternary operator if/then, number captures new value\n numbers << number\nend\n\n # numbers.join\nend", "def stringy(number, optional = 1)\n result = ''\n\n number.times do |num|\n if optional == 1\n result << ( numbers = num.even? ? '1' : '0' )\n else\n result << ( numbers = num.even? ? '0' : '1' )\n end\n end\n result\nend", "def stringy_string (int)\n true_var = true\n new_str = \"\"\n int.times do \n true_var ? new_str << '1' : new_str << '0'\n true_var = !true_var\n end\n new_str\nend", "def stringy(num, val=1)\n str = ''\n if val == 1\n num.times do |x|\n str += \"1\" if x % 2 == 0\n str += \"0\" if x % 2 != 0\n end\n else\n num.times do |x|\n str += \"0\" if x % 2 == 0\n str += \"1\" if x % 2 != 0\n end\n end\n str\nend", "def stringy(input_integer)\n chunks = [] # => [], [], [], []\n (input_integer/2).times do # => 3, 4, 2, 3\n chunks << '10' # => [\"10\"], [\"10\", \"10\"], [\"10\", \"10\", \"10\"], [\"10\"], [\"10\", \"10\"], [\"10\", \"10\", \"10\"], [\"10\", \"10\", \"10\", \"10\"], [\"10\"], [\"10\", \"10\"], [\"10\"], [\"10\", \"10\"], [\"10\", \"10\", \"10\"]\n end # => 3, 4, 2, 3\n\n if input_integer.even? # => true, false, true, false\n chunks.join('') # => \"101010\", \"1010\"\n else\n chunks.join('') + '1' # => \"101010101\", \"1010101\"\n end # => \"101010\", \"101010101\", \"1010\", \"1010101\"\nend", "def stringy(number, optional = 1)\n result = ''\n 1.upto(number) do |num|\n if optional == 1\n answer = num.odd? ? '1' : '0'\n result << answer\n else\n answer = num.even? ? '1' : '0'\n result << answer\n end\n end\n\n result\nend", "def stringy number, count = 1\n binary_string = ''\n\n if count == 1\n (number / 2).times {binary_string << '10'}\n binary_string << '1' if number % 2 == 1\n elsif count == 0\n (number / 2).times {binary_string << '01'}\n binary_string << '0' if number % 2 == 1\n end\n\n binary_string\n end", "def stringy(num, start_with=0)\n numbers = []\n\n num.times do |index|\n if start_with == 1\n number = index.even? ? 1 : 0\n numbers << number\n else \n number = index.even? ? 0 : 1\n numbers << number\n end \n end\n numbers.join\nend", "def q7_1_and_0(num)\n str_out = ''\n num.times {|num_here|\n num_here.even? ? str_out += '1' : str_out += '0'\n }\n str_out\nend", "def stringy(size, digit = 1)\n words = []\n size.times do\n words << digit\n digit = digit == 1 ? 0 : 1\n end\n words.join\nend", "def stringy(num, switch = 1)\n output = []\n if switch == 1\n num.times do |index|\n number = index.even? ? 1 : 0\n output << number\n end\n return output.join\n elsif switch == 0\n num.times do |index|\n number = index.even? ? 0 : 1\n output << number\n end\n return output.join\n end\nend", "def stringy(size)\n numbers = []\n\n size.times do |index|\n number = index.even? ? 1 : 0\n numbers << number\n end\n\n numbers.join\nend", "def stringy(size)\n numbers = []\n\n size.times do |index|\n number = index.even? ? 1 : 0\n numbers << number\n end\n\n numbers.join\nend", "def stringy(length)\n count = 0\n stringy_string = ''\n while count < length\n if count % 2 == 0\n stringy_string << '1'\n else\n stringy_string << '0'\n end\n count += 1\n end\n stringy_string\nend", "def stringy(number, optional = 1)\n result = ''\n number.times do |num|\n if optional # dont need the == 1 here, just optional.\n num.even? ? result << '1' : result << '0'\n else num.odd? ? result << '1' : result << '0'\n end\n end\n result\nend", "def stringy(int1, int2 = 1)\n numbers = []\n\n int1.times do |int| \n number = int.even? ? 0 : 1\n numbers << number\n end\n\n numbers.join\nend", "def stringy2(length, start_with = 1)\n string = ''\n length.times do |index|\n index += 1 if start_with == 0\n number_str = index.even? ? '1' : '0'\n string << number_str\n end\n string\nend", "def stringy(number, start_with = 1)\n if start_with != 1 && start_with != 0\n puts 'Invalid value for start. Only 1 and 0 allowed'\n return\n end\n\n number_string = start_with.to_s\n iterations = number - 1\n\n iterations.times do |previous_number|\n number_string[previous_number] == '1' ? number_string << '0' : number_string << '1'\n end\n\n number_string\nend", "def stringy(size)\n numbers = []\n\n size.times do |index|\n number = index.even? 1 : 0\n numbers << number\n end\n\n numbers.join\nend", "def stringy(num, option = 1)\n str = ''\n first_char = option.to_s\n second_char = (option == 1 ? '0' : '1')\n num.times { |ndx| str << (ndx.even? ? first_char : second_char) }\n str\nend", "def stringy(int)\n new_string = \"\"\n (int / 2).times { new_string << \"10\" }\n new_string << \"1\" if int.odd? \n new_string\nend", "def bi(i)\n string = []\n i.times do |n|\n if n.even?\n string << \"1\"\n else\n string << \"0\"\n end\n end\n string.join\nend", "def stringy(int)\n str = ''\n int.times { |i| str += ((i + 1) % 2).to_s }\n str\nend", "def stringy(size, switch = 1)\n numbers = []\n\n size.times do |index|\n number = index.even? ? 1 : 0 if switch == 1\n number = index.even? ? 0 : 1 if switch == 0\n numbers << number\n end\n numbers.join\nend", "def stringy(pos_int)\n result = ''\n pos_int.times do |ind|\n ind%2 == 0 ? result<<'1' : result<<'0'\n end\n result\nend", "def stringy(num)\n string = '10' * (num/2)\n num.even? ? string : string + '1'\nend", "def stringy(integer, optional = 1)\n return_string = ''\n if optional == 1\n integer.times { |idx| idx.even? ? return_string << '1' : return_string << '0' }\n elsif optional == 0\n integer.times { |idx| idx.even? ? return_string << '0' : return_string << '1' }\n end\n return_string\nend", "def stringy(num, start=1)\n string = '10' * (num/2)\n if start == 1\n num.even? ? string : string + '1'\n else\n num.even? ? string.reverse : string.reverse + '0'\n end\nend", "def stringy(int, first_num = 1)\n first_num == 0 ? second_num = 1 : second_num = 0\n\n arr = Array(1..int)\n arr.map! { |n| n.odd? ? first_num : second_num }\n arr.join\nend", "def stringy(size, option = 1)\n numbers = []\n\n size.times do |index|\n if option == 1\n number = index.even? ? 1 : 0\n numbers << number\n else\n number = index.even? ? 0 : 1\n numbers << number\n end\n end\n\n numbers.join\nend", "def binary(num)\n result = []\n\n until num == 0\n result.unshift(num % 2)\n num /= 2\n end\n\n result.empty? ? \"0\" : result.join\nend", "def stringy2(size,opt1=1)\n numbers = []\n if opt1 == 0\n opt2 = 1\n else\n opt2 = 0\n end\n\n size.times do |index|\n number = index.even? ? opt1 : opt2\n numbers << number\n end\n\n numbers.join\nend", "def fake_bin(s)\n nums = s.split('')\n outcome = nums.map do |num|\n if num.to_i >= 5\n num = 1\n else\n num = 0\n end\n end\n outcome.join()\nend", "def stringy(num, start = 1)\n return 'Positive integer only' unless num.is_a?(Integer) && num > 0\n return 'Invalid starting number' unless start == 1 || start == 0\n\n string = ''\n num.times do\n string << start.to_s\n start = 1 - start\n end\n string\nend", "def stringy(size, start = 1)\n numbers = []\n\n size.times do |index|\n if start = 1\n number = index.even? ? 1 : 0\n elsif start = 0\n number = index.even? ? 0 : 1\n end\n numbers << number\n end\n\n numbers.join\nend", "def look_and_say(n)\n prev = \"1\"\n curr = \"\"\n\n while(n > 1)\n i = 0\n\n while(i < prev.length)\n\n char = prev[i]\n count = count_digits(i, prev)\n i += count\n\n curr << count.to_s << char\n end\n\n prev = curr.dup\n curr = \"\"\n n -= 1\n end\n\n prev\nend", "def increment_string(input)\n nums = \"0123456789\"\n return input + \"1\" if input == \"\" || !nums.include?(input[-1]) \n end_zero = -1 \n end_nine = -1\n \n if input[end_zero] == \"0\"\n num_all_zero = true\n while num_all_zero\n num_all_zero = false\n end_zero -= 1\n if !nums.include?(input[end_zero])\n input[-1] = \"1\"\n return input\n elsif input[end_zero] == \"0\"\n puts \"zero\"\n num_all_zero = true\n end\n end\n end\n \n if input[end_nine] == \"9\"\n num_all_nine = true\n while num_all_nine\n num_all_nine = false\n input[end_nine] = \"0\"\n end_nine -= 1\n if input[end_nine] == \"9\"\n num_all_nine = true\n next\n elsif !nums.include?(input[end_nine]) \n return input[0..end_nine] + \"1\" + input[end_nine + 1..-1]\n end \n input[end_nine..end_nine + 1] = (input[end_nine].to_i + 1).to_s + \"0\"\n return input\n end\n end\n\n input.succ\nend", "def stringy(int)\n (int/2).times { print 10 }\n 1 if int.odd?\nend", "def stringy(size, start=1)\n numbers = []\n\n size.times do |index|\n if start == 1\n number = index.even? ? 1 : 0\n numbers << number\n elsif start == 0\n number = index.odd? ? 1 : 0\n numbers << number\n end\n end\n\n numbers.join\nend", "def test_19\n expected = [\"11001\", \"11001\", \"11001\", \"11001\", \"11001\", \" 11001\",\n \" 11001\", \" 11001\", \" 11001\", \" 11001\", \" 11001\"]\n 0.upto(10) do |i|\n assert_equal(expected[i], '~#b'.format(0b11001, *Array.new(i)))\n end\n end", "def crunch(string)\n array = string.chars\n no_repeats = []\n no_repeats.push(array[0])\n for i in 0..(array.size - 1)\n no_repeats.push(array[i+1]) if array[i] != array[i+1]\n end\n\n no_repeats.join\nend", "def stringy_options(size, beginning=1)\n numbers = ''\n size.times do |index|\n if beginning == 1\n index.even? ? numbers << '1' : numbers << '0'\n else\n index.even? ? numbers << '0' : numbers << '1'\n end\n end\n numbers\nend", "def string_to_binary(str)\n zero_array = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\"]\n one_array = [\"n\" , \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\n def check_if_in_array(check, array)\n array.each do |i|\n if check.upcase == i.upcase\n return true\n end\n end\n\n return false\n end\n\n return_word = \"\"\n\n for char in str.chars\n if check_if_in_array(char, zero_array)\n return_word = return_word + \"0\"\n elsif check_if_in_array(char, one_array)\n return_word = return_word + \"1\"\n end\n end\n\n return return_word\nend", "def fake_bin(s)\ns = s.split(\"\")\ns = s.map {|x| x.to_i }\ns.collect! {|e| (e<5) ? 0 : e || (e>5) ? 1 : e}\ns.join\nend", "def stringy(length, reverse = 1)\n counter = 1 \n return_string = ''\n while counter <= length\n if counter % 2 == 0\n return_string << '0'\n else\n return_string << '1'\n end\n counter += 1\n end\n\n reverse == 1 ? return_string : return_string.reverse\nend", "def random_bitstring(num_bits)\n return (0...num_bits).inject(\"\"){|s,i| s<<((rand<0.5) ? \"1\" : \"0\")}\nend", "def solution(value)\n answer = \"\"\n number_string = value.to_s\n ( 5 - number_string.length).times do\n answer += \"0\"\n end\n answer = answer + number_string\n \"Value is #{answer}\"\nend", "def Bitwise(arr)\n output_num = ''\n arr[0].split(//).each_with_index {|char,idx| char == arr[1][idx] ? output_num << '0' : output_num << '1'}\n output_num.to_i\nend", "def number_counting_seq(n)\n count = 0\n result = ''\n while count < n\n if count == 0\n result = '1'\n else\n result = translate(result)\n end\n count += 1\n end\n result\nend", "def random_bitstring(num_bits)\n return ( 0..num_bits ).inject(\"\"){ |s,i| s << ( ( rand < 0.5 ) ? \"1\" : \"0\" ) }\n end", "def BitwiseOne(strArr)\n first = strArr[0]\n second = strArr[1]\n third = \"\"\n \n i = 0 \n while i < first.length\n # When i change this line to first[i] == \"0\" &&\n # second[i] == \"0\"\n # all tests passes. Why????????????????????????\n if first[i] == second[i]\n \t third << \"0\"\n else\n \t third << \"1\"\n end\n \n i += 1\n end\n third \nend", "def no_boring_zeros(num)\n num_str = num.to_s\n x = -1\n\n while x > 0 do \n if num_str[x] != '0'\n break\n end\n x -= 1\n end\n num_str[0...x].to_i\nend", "def change a\n a = a.downcase\n end_string = ''\n ('a'..'z').each { |let| a.include?(let) ? end_string << '1' : end_string << '0' }\n end_string\nend", "def string_expansion(str)\n result = []\n multiple = 1\n str.each_char do |char|\n if (char.to_i == 0) && (char != \"0\")\n result << (char * multiple)\n else multiple = char.to_i\n end\n end\n result.join\nend", "def number_counting_seq(n)\n return \"\" if n == 0\n a = \"11\"\n return a[0...n] if n <= 2\n\n res = \"11\"\n (n-2).times do\n new_piece = res.split(\"\").chunk_while { |a, b| a == b }.to_a if res.length > 1\n res = \"\"\n new_piece.each { |chunk| res += \"#{chunk.length}#{chunk[0]}\" }\n end\n res\nend", "def repeater(string)\n doubled_arr = []\n string.each_char{ |char| doubled_arr << char *= 2} \n p doubled_arr.join\nend", "def string_increment(string)\n result = string.split(/[a-z]/i)\n new_str = ''\n if string[-1] =~ /[a-z]/i || string == \"\"\n new_str = string + \"1\"\n else\n digits_size = result.last.size\n if ((result.last.to_i + 1).to_s).size < digits_size # means 0 doestn't matter\n new_str = string[0, string.size-result.last.to_i.to_s.size]+(result.last.to_i + 1).to_s\n else\n new_str = string[0, string.size - digits_size] + (result.last.to_i + 1).to_s\n end\n end\n new_str\nend", "def RunLength(str)\n # convert str into array\n chars = str.split('') \n new_str = \"\"\n counter = 1\n # loop through the str array\n (0..(chars.length-1)).each do |idx|\n \t# find the repeating chars\n \tif chars[idx] == chars[idx+1]\n \t\t# increment the counter\n \t\tcounter += 1\n \t\tp counter\n \telse\n \t\t# if no repeating chars, \n \t\t# push number and chars to the new_str\n \t\t# if else condition scope????? why push everything in\n \t\t# else condition?????????????????\n \t\tnew_str << counter.to_s + chars[idx] # why this line is here????\n \t\tcounter = 1\n \t\tp new_str\n \tend\n end\n new_str\n end", "def plus_one(digits)\n arr = digits.join.to_i + 1\n arr.to_s.split(\"\").map(&:to_i)\nend", "def crunch(str)\n new_string = ''\n counter = 0\n while counter <= str.length - 1\n new_string << str[counter] unless str[counter] == str[counter + 1]\n counter += 1\n end\n new_string\nend", "def monkey_count(n)\n str = []\n i = 1\n while i <= n\n str.push(i)\n i += 1\n end\n return str\nend", "def encode_repeating(my_string)\n puts my_string\n\n if my_string == \"\" || my_string == nil || my_string.length == 0\n return my_string\n end\n\n\n new_arr = []\n hash = {}\n i = 0\n while i < my_string.length\n\n char = my_string[i]\n print char\n\n if hash[char]\n hash[char] += 1\n else\n hash[char] = 1\n end\n\n i += 1\n\n end\n\n puts hash\n\n\n hash.each do |k, v|\n if v <= 2\n v.times do\n new_arr << k\n end\n elsif v > 2\n new_arr << k\n new_arr << v\n end\n end\n\n puts new_arr\n puts new_arr.join\n\n my_string = new_arr.join\n return my_string\n # raise NotImplementedError\nend", "def crunch(str)\n if str == '' \n return ''\n end\n \n new_arr = str.split('')\n str_out = new_arr[0]\n \n (1..new_arr.size-1).each {|n|\n new_arr[n] != new_arr[n-1] ? \n str_out << new_arr[n]\n : n\n }\n \n str_out\nend", "def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend", "def leading_zeroes(max_num_length)\n 101.times do |i|\n num_of_zeroes = max_num_length - i.digits.length\n puts \"0\" * num_of_zeroes + i.to_s\n end\nend" ]
[ "0.83429146", "0.82513034", "0.82389313", "0.8171739", "0.8153618", "0.81305486", "0.8121433", "0.81042135", "0.808339", "0.8071928", "0.80312777", "0.80308896", "0.8008519", "0.7981671", "0.79604447", "0.7953095", "0.7929839", "0.79243046", "0.7923863", "0.79161626", "0.7906991", "0.78967804", "0.78922355", "0.78756845", "0.78356874", "0.7832314", "0.7800209", "0.7774602", "0.7673834", "0.7661665", "0.7654053", "0.76340514", "0.7575586", "0.7552005", "0.75501287", "0.74961233", "0.74921435", "0.745273", "0.74365723", "0.7408822", "0.73772305", "0.7339241", "0.7332541", "0.7328452", "0.731271", "0.73045635", "0.7290037", "0.7290037", "0.72848874", "0.72427773", "0.72381335", "0.72329", "0.7226984", "0.7219135", "0.7179183", "0.7164418", "0.7157145", "0.7078688", "0.7025118", "0.6996491", "0.69648445", "0.6963552", "0.6913971", "0.68194526", "0.67959994", "0.67717505", "0.6771374", "0.676447", "0.67419577", "0.6676425", "0.6649052", "0.65878546", "0.65589213", "0.65584844", "0.652317", "0.6479958", "0.64561176", "0.64150697", "0.6411156", "0.63988185", "0.639793", "0.6362726", "0.6342818", "0.6338115", "0.6328401", "0.6314176", "0.63051385", "0.6269868", "0.6244962", "0.62226963", "0.6205754", "0.62048584", "0.6204199", "0.6197867", "0.61901826", "0.6184021", "0.6179176", "0.61432844", "0.6142464", "0.6133924" ]
0.75884503
32
GET /uang_masuks GET /uang_masuks.json
def index @cari_uang_masuk = UangMasuk.where(["keterangan iLIKE ?","%#{params[:keterangan]}%"]).order(id: :desc) @a_masuk = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_uang_masuk\n @uang_masuk = UangMasuk.find(params[:id])\n end", "def index\n @makanans = Makanan.all\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 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 index\n @mencions = Mencion.order(\"escuela_id\").paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mencions }\n end\n end", "def index\n @mangas = Manga.all.page(params[:page]).per(5)\n if params[:search]\n @mangas = Manga.search(params[:search]).order(\"created_at DESC\").page(params[:page]).per(5)\n else\n @mangas = Manga.all.order(\"created_at DESC\").page(params[:page]).per(5)\n end\n end", "def index\n @municaos = Municao.page(params['page']).per(5);\n end", "def show\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def index\n @mouzas = @block.mouzas\n @mouzas = @mouzas.map{|d| {id: d.id, name: d.name[@language]}}\n end", "def index\n @mata_mata = MataMatum.all\n end", "def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end", "def new\n @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end", "def show\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jamaat }\n end\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end", "def index\n @minumen = Minuman.all\n end", "def show\n @mercado_metum = MercadoMetum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mercado_metum }\n end\n end", "def index\n @mantenis = Manteni.all\n end", "def index\n @malings = Maling.all\n end", "def index\n @minnpakus = Minnpaku.all\n end", "def show\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musique }\n end\n end", "def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end", "def create\n @uang_masuk = UangMasuk.new(uang_masuk_params)\n\n respond_to do |format|\n if @uang_masuk.save\n format.html { redirect_to uang_masuks_path, notice: 'Uang masuk was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @uang_masuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @mesasredondas = Mesasredonda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mesasredondas }\n end\n end", "def index\n @midias = Midia.all\n end", "def index\n @mangas = Manga.order :updated_at=>:desc\n end", "def index\n @materias = Materia.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @materias }\n end\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def index\n @mahasiswas = Mahasiswa.all\n end", "def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relaciones_articulos_medida }\n end\n end", "def show\n @mencion = Mencion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mencion }\n end\n end", "def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @modelos\n\n end", "def index\n @marcas = Marca.all\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @kishangarh_marbles = KishangarhMarble.all\n end", "def new\n @jamaat = Jamaat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jamaat }\n end\n end", "def show\n @mutacao = Mutacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mutacao }\n end\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def index\n @mascota = Mascotum.all\n end", "def index\n @mascota = Mascotum.all\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: @maudio}\n end\n end", "def show\n @metum = Metum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metum }\n end\n end", "def uang_masuk_params\n params.require(:uang_masuk).permit(:jumlah, :tanggal, :keterangan)\n end", "def index\n @kifus = Kifu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kifus }\n end\n end", "def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end", "def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def show\n @kansei_buhin = KanseiBuhin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kansei_buhin }\n end\n end", "def show\n @bahan = Bahan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bahan }\n end\n end", "def msau\n render json: get_msau(@visits)\n end", "def index\n @unidad_medidas = UnidadMedida.all\n end", "def index\n if params[:estado]\n @municipios = Uf.find(params[:estado]).municipios\n else\n @municipios = Uf.first.municipios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def index\n @sifat_surat_masuk = SifatSuratMasuk.all\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def index\n @mamals = Mamal.all\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end", "def index\n @aboutshetuans = Aboutshetuan.order(\"created_at desc\").page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @aboutshetuans }\n end\n end", "def show\n @unidade_medida = UnidadeMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unidade_medida }\n end\n end", "def show\r\n render json: @registro_medicion.to_json, status: :ok\r\n end", "def show\n @anuncio= set_anuncio\n render json: @anuncio, status: :ok\n end", "def show\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minicurso }\n end\n end", "def index\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.order(\"created_at DESC\").page(params[:daftar_laporan_guru_agama_katolik_page]).per(6)\n end", "def show\n @medicamento = Medicamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medicamento }\n end\n end", "def set_manga\n @manga = Manga.find(params[:id])\n end", "def set_manga\n @manga = Manga.find(params[:id])\n end", "def index\n @marcas = Marca.order(\"name_marca\").page(params[:page]).per_page(5)\n end", "def mostra_tudo\n apius.mostra_resumo\n apide.mostra_resumo\n apifr.mostra_resumo\n apimt.mostra_resumo\n apies.mostra_resumo\n apigm.mostra_resumo\n apibc.mostra_resumo\n end", "def show\n @penjualan_bahan = PenjualanBahan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @penjualan_bahan }\n end\n end", "def index\n @medicinas = Medicina.all\n end", "def index\n @municipio_de_la_preparatoria_o_universidad_de_origens = MunicipioDeLaPreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origens }\n end\n end", "def show\n @buchung = Buchung.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buchung }\n end\n end", "def show\n @imp_raman = ImpRaman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp_raman }\n end\n end", "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\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 @mesasredonda = Mesasredonda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mesasredonda }\n end\n end", "def index\n @mtypes = Mtype.order(:code)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mtypes }\n end\n end", "def index\n @muestras = Muestra.all\n end", "def index\n @tuiguangs = Tuiguang.all\n end", "def show\n render json: @testmonial\n end", "def show\n @imp2_raman = Imp2Raman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp2_raman }\n end\n end", "def show\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mill }\n end\n end", "def index\n # if we have plan to use paginate\n # @kinofilms = Kinofilm.paginate :page => params[:page], :order => 'id DESC'\n @kinofilms = Kinofilm.all\n @kinofilm = Kinofilm.new\n respond_with(@kinofilms, :location=>kinofilms_path )\n end", "def show\n @pengeluaran_bulanan = PengeluaranBulanan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pengeluaran_bulanan }\n end\n end", "def index\n @informasi_pengumuman = InformasiPengumuman.order(\"created_at DESC\").page(params[:daftar_informasi_pengumuman_page]).per(6)\n end", "def index\n @mantenimientos = Mantenimiento.all\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n @mundos = Mundo.all\n end", "def index\n @maquinats = Maquinat.all\n end", "def index\n @futboladas = Futbolada.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @futboladas }\n end\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end", "def index\n @munecos = Muneco.all\n end", "def index\n @messies = Messy.all\n\n render json: @messies\n end", "def show\n @turma = Turma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turma }\n end\n end", "def show\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall }\n end\n end", "def index\n @bakusokukuns = Bakusokukun.all\n end", "def show\n @materia = Materia.find(params[:id])\n\n render json: @materia\n end", "def show\n @m_keep_month = MKeepMonth.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_keep_month }\n end\n end", "def index\n @malaria = Malarium.all\n end" ]
[ "0.6560736", "0.6529683", "0.6488961", "0.6302812", "0.6289363", "0.6280052", "0.6269392", "0.62378204", "0.6229503", "0.62005544", "0.61642164", "0.61461586", "0.61443377", "0.6141813", "0.6141049", "0.6125693", "0.61210275", "0.6082039", "0.60736835", "0.6059679", "0.6050183", "0.60220546", "0.60035956", "0.6001032", "0.5965184", "0.595886", "0.59256554", "0.591712", "0.59039485", "0.5901599", "0.5901547", "0.58998317", "0.5899342", "0.58931583", "0.58851784", "0.58790684", "0.5873711", "0.5865523", "0.58615977", "0.58614624", "0.5860718", "0.5860718", "0.58577913", "0.58552283", "0.58502185", "0.58432615", "0.5832822", "0.582363", "0.58201236", "0.58153117", "0.5809501", "0.5809451", "0.58093315", "0.5806281", "0.5806216", "0.5805566", "0.5795958", "0.57837224", "0.578292", "0.57799035", "0.5778216", "0.57756335", "0.57727474", "0.5769903", "0.57692057", "0.57692057", "0.57683104", "0.5765073", "0.5763684", "0.5761588", "0.57611567", "0.57544905", "0.57484704", "0.57466197", "0.57446647", "0.57355565", "0.5724261", "0.57239705", "0.57221186", "0.571375", "0.57133126", "0.57100827", "0.57095355", "0.5707368", "0.57048684", "0.56976", "0.5695253", "0.5691842", "0.5689985", "0.56864583", "0.56832683", "0.5681015", "0.567954", "0.5678231", "0.5675564", "0.56728554", "0.5664101", "0.566276", "0.5658194", "0.56483895" ]
0.58548
44
GET /uang_masuks/1 GET /uang_masuks/1.json GET /uang_masuks/new
def new @uang_masuk = UangMasuk.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end", "def new\n @jamaat = Jamaat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jamaat }\n end\n end", "def new\n @motivobaja = MotivoBaja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def new\n @minicurso = Minicurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @minicurso }\n end\n end", "def new\n @mutacao = Mutacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mutacao }\n end\n end", "def create\n @uang_masuk = UangMasuk.new(uang_masuk_params)\n\n respond_to do |format|\n if @uang_masuk.save\n format.html { redirect_to uang_masuks_path, notice: 'Uang masuk was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @uang_masuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @marina = Marina.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @marina }\n end\n end", "def new\n @mencion = Mencion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mencion }\n end\n end", "def new\n @musique = Musique.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @musique }\n end\n end", "def new\n @mi = Mi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi }\n end\n end", "def new\n @kansei_buhin = KanseiBuhin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kansei_buhin }\n end\n end", "def new\n @medicamento = Medicamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medicamento }\n end\n end", "def new\n @mill = Mill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mill }\n end\n end", "def new \n @buchung = Buchung.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @buchung }\n end\n end", "def new\n @mapeamento = Mapeamento.new\n @professors = Professor.all\n @cursos = Curso.all\n @disciplinas = Disciplina.all\n @turmas = Turma.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mapeamento }\n end\n end", "def new\n @sotrudniki = Sotrudniki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sotrudniki }\n end\n end", "def new\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @juzgado }\n end\n end", "def new\n @turma = Turma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @turma }\n end\n end", "def new\n @monit = Monit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monit }\n end\n end", "def new\n @ministerio = Ministerio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ministerio }\n end\n end", "def new\n @mall = Mall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mall }\n end\n end", "def create\n @municao = Municao.new(municao_params)\n\n respond_to do |format|\n if @municao.save\n format.html { redirect_to @municao, notice: 'A Munição foi criada com sucesso!' }\n format.json { render :show, status: :created, location: @municao }\n else\n format.html { render :new }\n format.json { render json: @municao.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @sala = Sala.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sala }\n end\n end", "def new\n @slam = Slam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slam }\n end\n end", "def new\n @unidade_medida = UnidadeMedida.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unidade_medida }\n end\n end", "def new\n @metodo = Metodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @metodo }\n end\n end", "def new\n @natulang = Natulang.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @natulang }\n end\n end", "def new\n @penjualan_bahan = PenjualanBahan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @penjualan_bahan }\n end\n end", "def new\n @momsg = Momsg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @momsg }\n end\n end", "def new\n @sm = Sm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sm }\n end\n end", "def create\n @admin_mural = Admin::Mural.new(admin_mural_params)\n\n respond_to do |format|\n if @admin_mural.save\n format.html { redirect_to @admin_mural, notice: 'Mural was successfully created.' }\n format.json { render :show, status: :created, location: @admin_mural }\n else\n format.html { render :new }\n format.json { render json: @admin_mural.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @jugadore = Jugadore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jugadore }\n end\n end", "def new\n @municipio = Municipio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @municipio }\n end\n end", "def new\n @municipio = Municipio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @municipio }\n end\n end", "def new\n usuario = Usuario.find(params[:usuario_id])\n semana = Semana.find(params[:semana_id])\n \n @planificacion_semanal = PlanificacionSemanal.new(:usuario => usuario, :semana => semana)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planificacion_semanal }\n end\n end", "def new\n @publicidad = Publicidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publicidad }\n end\n end", "def new\n @spiel = Spiel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spiel }\n end\n end", "def new\n @unp = Unp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unp }\n end\n end", "def new\n @laundromat = Laundromat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @laundromat }\n end\n end", "def new\n @manpack = Manpack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manpack }\n end\n end", "def new\n @jam = Jam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jam }\n end\n end", "def new\n @sistema = Sistema.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sistema }\n end\n end", "def new\n @meuble = Meuble.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meuble }\n end\n end", "def new\n @monnaie = Monnaie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monnaie }\n end\n end", "def new\n @materia = Materia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @materia }\n end\n end", "def new\n @sezione = Sezione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sezione }\n end\n end", "def new\n unless possui_acesso?()\n return\n end\n @matricula = Matricula.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @matricula }\n end\n end", "def new\n @asignatura = Asignatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asignatura }\n end\n end", "def new\n @pengeluaran_bulanan = PengeluaranBulanan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pengeluaran_bulanan }\n end\n end", "def new\n @humanidades1 = Humanidades1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @humanidades1 }\n end\n end", "def new\n @pun = Pun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pun }\n end\n end", "def new\n @nabe = Nabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nabe }\n end\n end", "def new\n @zoneamento = Zoneamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @zoneamento }\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 create\n @mata_matum = MataMatum.new(mata_matum_params)\n\n respond_to do |format|\n if @mata_matum.save\n format.html { redirect_to @mata_matum, notice: 'Mata matum was successfully created.' }\n format.json { render :show, status: :created, location: @mata_matum }\n else\n format.html { render :new }\n format.json { render json: @mata_matum.errors, status: :unprocessable_entity }\n end\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\n @optimu = Optimu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @optimu }\n end\n end", "def new\n @missionmaker = Missionmaker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @missionmaker }\n end\n end", "def new\n @requerimiento = Requerimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def new\n @imp_raman = ImpRaman.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @imp_raman }\n end\n end", "def new\n @sugerencia = Sugerencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sugerencia }\n end\n end", "def new\n @humanidades3 = Humanidades3.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @humanidades3 }\n end\n end", "def new\n @mecanicacomplejo = Mecanicacomplejo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mecanicacomplejo }\n end\n end", "def create\n @manteni = Manteni.new(manteni_params)\n\n respond_to do |format|\n if @manteni.save\n format.html { redirect_to @manteni, notice: 'Manteni was successfully created.' }\n format.json { render :show, status: :created, location: @manteni }\n else\n format.html { render :new }\n format.json { render json: @manteni.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @imp2_raman = Imp2Raman.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @imp2_raman }\n end\n end", "def new\n @pasien2 = Pasien2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pasien2 }\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end", "def new\n @hasil = Hasil.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hasil }\n end\n end", "def new\n @mlp = Mlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mlp }\n end\n end", "def new\n @mini_pago = MiniPago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mini_pago }\n end\n end", "def new\n @pagamento = Pagamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pagamento }\n end\n end", "def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end", "def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end", "def new\n @mrj = Mrj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mrj }\n end\n end", "def new\n @marmita = Marmita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @marmita }\n end\n end", "def new\n @seguidore = Seguidore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguidore }\n end\n end", "def new\n @museum = Museum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @museum }\n end\n end", "def new\n @lieu = Lieu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lieu }\n end\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 new\n @kullanici = Kullanici.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kullanici }\n end\n end", "def new\n @m_keep_month = MKeepMonth.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m_keep_month }\n end\n end", "def new\n @lich_su_binh_bau = LichSuBinhBau.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lich_su_binh_bau }\n end\n end", "def new\n @microposst = Microposst.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @microposst }\n end\n end", "def new\n @uset = Uset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uset }\n end\n end", "def new\n @mision = Mision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mision }\n end\n end", "def new\n @repuestum = Repuestum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repuestum }\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @premio }\n end\n end", "def new\n @humanidades2 = Humanidades2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @humanidades2 }\n end\n end", "def new\n @prepagada = Prepagada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prepagada }\n end\n end", "def new\n @huati = Huati.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @huati }\n end\n end", "def new\n @matricula = Matricula.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @matricula }\n end\n end", "def new\r\n @salle = Salle.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @salle }\r\n end\r\n end", "def new\n @m_oil = MOil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m_oil }\n end\n end", "def new\n @medida = Medida.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medida }\n end\n end", "def new\n @kraj = Kraj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kraj }\n end\n end", "def new\n @lugar = Lugar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lugar }\n end\n end", "def new\n @tipo_pensum = TipoPensum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_pensum }\n end\n end", "def new\n @medio_pago = MedioPago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medio_pago }\n end\n end", "def new\n @deuda = Deuda.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deuda }\n end\n end", "def new\n @detalle = Detalle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @detalle }\n end\n end" ]
[ "0.74359715", "0.72972745", "0.72335505", "0.71722674", "0.7165662", "0.715485", "0.71110934", "0.70961934", "0.7043198", "0.7035463", "0.6986085", "0.69837177", "0.6966193", "0.69611734", "0.6947536", "0.6927173", "0.6924353", "0.69206536", "0.69088465", "0.68979883", "0.6864089", "0.6856198", "0.6835154", "0.6810165", "0.6809436", "0.68079066", "0.68067575", "0.67990965", "0.6790502", "0.67767656", "0.67766815", "0.6764909", "0.6761306", "0.6761306", "0.67572427", "0.67567503", "0.67566365", "0.67502916", "0.6748522", "0.6747526", "0.6742853", "0.6738943", "0.67367035", "0.67242676", "0.6723591", "0.6720721", "0.67174107", "0.67169714", "0.6712781", "0.6706687", "0.6704853", "0.66977286", "0.6695556", "0.6692914", "0.6692681", "0.6692583", "0.6684644", "0.6684373", "0.6679944", "0.6676825", "0.66760683", "0.66731024", "0.6670981", "0.66703886", "0.6664564", "0.6663712", "0.6661793", "0.66616136", "0.6661576", "0.6659013", "0.6657982", "0.6655838", "0.6655838", "0.66534054", "0.6652459", "0.6648529", "0.6645898", "0.664463", "0.66435313", "0.66350275", "0.6627522", "0.66266865", "0.66259676", "0.66196555", "0.6618077", "0.6614104", "0.66115296", "0.6607874", "0.66072047", "0.66070783", "0.6606239", "0.6601259", "0.6593665", "0.65934473", "0.6589877", "0.6588645", "0.65851223", "0.6584661", "0.6582943", "0.65814626" ]
0.73136866
1
POST /uang_masuks POST /uang_masuks.json
def create @uang_masuk = UangMasuk.new(uang_masuk_params) respond_to do |format| if @uang_masuk.save format.html { redirect_to uang_masuks_path, notice: 'Uang masuk was successfully created.' } else format.html { render :new } format.json { render json: @uang_masuk.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uang_masuk_params\n params.require(:uang_masuk).permit(:jumlah, :tanggal, :keterangan)\n end", "def create\n @mata_matum = MataMatum.new(mata_matum_params)\n\n respond_to do |format|\n if @mata_matum.save\n format.html { redirect_to @mata_matum, notice: 'Mata matum was successfully created.' }\n format.json { render :show, status: :created, location: @mata_matum }\n else\n format.html { render :new }\n format.json { render json: @mata_matum.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_uang_masuk\n @uang_masuk = UangMasuk.find(params[:id])\n end", "def create\n @manga = Manga.new(manga_params)\n\n respond_to do |format|\n if @manga.save\n format.html { redirect_to @manga, notice: 'Manga was successfully created.' }\n format.json { render :show, status: :created, location: @manga }\n else\n format.html { render :new }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @municao = Municao.new(municao_params)\n\n respond_to do |format|\n if @municao.save\n format.html { redirect_to @municao, notice: 'A Munição foi criada com sucesso!' }\n format.json { render :show, status: :created, location: @municao }\n else\n format.html { render :new }\n format.json { render json: @municao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sifat_surat_masuk = SifatSuratMasuk.new(sifat_surat_masuk_params)\n\n respond_to do |format|\n if @sifat_surat_masuk.save\n format.html { redirect_to @sifat_surat_masuk, notice: 'Sifat surat masuk was successfully created.' }\n format.json { render :show, status: :created, location: @sifat_surat_masuk }\n else\n format.html { render :new }\n format.json { render json: @sifat_surat_masuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @minnpaku = Minnpaku.new(minnpaku_params)\n\n respond_to do |format|\n if @minnpaku.save\n format.html { redirect_to @minnpaku, notice: 'Minnpaku was successfully created.' }\n format.json { render :show, status: :created, location: @minnpaku }\n else\n format.html { render :new }\n format.json { render json: @minnpaku.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @masut_assay = MasutAssay.new(params[:masut_assay])\n\n respond_to do |format|\n if @masut_assay.save\n format.html { redirect_to masut_assays_url, notice: 'Данные нового анализа мазута успешно записаны.' }\n format.json { render json: @masut_assay, status: :created, location: @masut_assay }\n else\n format.html { render action: \"new\" }\n format.json { render json: @masut_assay.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @makanan = Makanan.new(makanan_params)\n\n respond_to do |format|\n if @makanan.save\n format.html { redirect_to @makanan, notice: 'Makanan was successfully created.' }\n format.json { render :show, status: :created, location: @makanan }\n else\n format.html { render :new }\n format.json { render json: @makanan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @marca = Marca.new(marca_params)\n if @marca.save\n render json: @marca\n else\n render json: @marca.errors, status: :unprocessable_entity \n end\n end", "def create\n @maquinat = Maquinat.new(maquinat_params)\n\n respond_to do |format|\n if @maquinat.save\n format.html { redirect_to @maquinat, notice: 'Maquinat was successfully created.' }\n format.json { render :show, status: :created, location: @maquinat }\n else\n format.html { render :new }\n format.json { render json: @maquinat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jamaat = Jamaat.new(params[:jamaat])\n\n respond_to do |format|\n if @jamaat.save\n format.html { redirect_to @jamaat, notice: 'Jamaat was successfully created.' }\n format.json { render json: @jamaat, status: :created, location: @jamaat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jamaat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @minuman = Minuman.new(minuman_params)\n\n respond_to do |format|\n if @minuman.save\n format.html { redirect_to @minuman, notice: 'Minuman was successfully created.' }\n format.json { render :show, status: :created, location: @minuman }\n else\n format.html { render :new }\n format.json { render json: @minuman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_mural = Admin::Mural.new(admin_mural_params)\n\n respond_to do |format|\n if @admin_mural.save\n format.html { redirect_to @admin_mural, notice: 'Mural was successfully created.' }\n format.json { render :show, status: :created, location: @admin_mural }\n else\n format.html { render :new }\n format.json { render json: @admin_mural.errors, status: :unprocessable_entity }\n end\n end\n end", "def sifat_surat_masuk_params\n params.require(:sifat_surat_masuk).permit(:nama)\n end", "def create\n @mapeamento = Mapeamento.new(params[:mapeamento])\n\n respond_to do |format|\n if @mapeamento.save\n format.html { redirect_to @mapeamento, notice: 'Mapeamento was successfully created.' }\n format.json { render json: @mapeamento, status: :created, location: @mapeamento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mapeamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @manga = Manga.new(manga_params)\n @manga.tags = @params_tags\n @manga.author = @author\n\n respond_to do |format|\n if @manga.save\n format.html { redirect_to @manga, notice: 'Manga was successfully created.' }\n format.json { render :show, status: :created, location: @manga }\n else\n format.html { render :new }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @amu = Amu.new(amu_params)\n\n respond_to do |format|\n if @amu.save\n format.html { redirect_to @amu, notice: 'Amu was successfully created.' }\n format.json { render action: 'show', status: :created, location: @amu }\n else\n format.html { render action: 'new' }\n format.json { render json: @amu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bakusokukun = Bakusokukun.new(bakusokukun_params)\n\n respond_to do |format|\n if @bakusokukun.save\n format.html { redirect_to @bakusokukun, notice: 'Bakusokukun was successfully created.' }\n format.json { render :show, status: :created, location: @bakusokukun }\n else\n format.html { render :new }\n format.json { render json: @bakusokukun.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @manteni = Manteni.new(manteni_params)\n\n respond_to do |format|\n if @manteni.save\n format.html { redirect_to @manteni, notice: 'Manteni was successfully created.' }\n format.json { render :show, status: :created, location: @manteni }\n else\n format.html { render :new }\n format.json { render json: @manteni.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @motivobaja = MotivoBaja.new(motivo_baja_params)\n\n respond_to do |format|\n if @motivobaja.save\n format.html { redirect_to @motivobaja, notice: 'Motivo Baja was successfully created.' }\n format.json { render json: @motivobaja, status: :created, location: @motivobaja }\n else\n format.html { render action: \"new\" }\n format.json { render json: @motivobaja.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def create\n\n @mascotum = Mascotum.new(mascotum_params)\n\n respond_to do |format|\n if @mascotum.save\n format.html { redirect_to @mascotum, notice: 'Mascotum was successfully created.' }\n format.json { render :show, status: :created, location: @mascotum }\n else\n format.html { render :new }\n format.json { render json: @mascotum.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @uang_masuk = UangMasuk.new\n end", "def create\n @tuiguang = Tuiguang.new(tuiguang_params)\n\n respond_to do |format|\n if @tuiguang.save\n format.html { redirect_to @tuiguang, notice: 'Tuiguang was successfully created.' }\n format.json { render :show, status: :created, location: @tuiguang }\n else\n format.html { render :new }\n format.json { render json: @tuiguang.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @informasi_pengumuman = InformasiPengumuman.new(informasi_pengumuman_params)\n @informasi_pengumuman.pengguna_id = current_pengguna.id\n \n respond_to do |format|\n if @informasi_pengumuman.save\n format.html { redirect_to @informasi_pengumuman, notice: 'Informasi pengumuman was successfully created.' }\n format.json { render :show, status: :created, location: @informasi_pengumuman }\n else\n format.html { render :new }\n format.json { render json: @informasi_pengumuman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #raise penduduk_params.to_yaml\n @penduduk = Penduduk.new(penduduk_params)\n @golongan_darahs = GolonganDarah.all\n @agamas = Agama.all\n @pekerjaans= Pekerjaan.all\n @status_keluargas = StatusKeluarga.all\n @pendidikans = Pendidikan.all\n @kelurahans = Kelurahan.all\n @kecamatans = Kecamatan.all\n @kabupatens = Kabupaten.all\n @penghasilans = Penghasilan.all \n respond_to do |format|\n if @penduduk.save\n format.html { redirect_to @penduduk, notice: 'Penduduk was successfully created.' }\n format.json { render :show, status: :created, location: @penduduk }\n else\n format.html { render :new }\n format.json { render json: @penduduk.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 @mercado_metum = MercadoMetum.new(params[:mercado_metum])\n\n respond_to do |format|\n if @mercado_metum.save\n format.html { redirect_to @mercado_metum, notice: 'Mercado metum was successfully created.' }\n format.json { render json: @mercado_metum, status: :created, location: @mercado_metum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mercado_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @maapp = Maapp.new(maapp_params)\n\n respond_to do |format|\n if @maapp.save\n format.html { render :successful }\n # format.html { redirect_to action: :index }\n format.json { render :show, status: :created, location: @maapp }\n else\n format.html { render :new }\n format.json { render json: @maapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_metum = TestMetum.new(test_metum_params)\n\n respond_to do |format|\n if @test_metum.save\n format.html { redirect_to @test_metum, notice: 'Test metum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_metum }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transakcje_jaskula = TransakcjeJaskula.new(transakcje_jaskula_params)\n\n respond_to do |format|\n if @transakcje_jaskula.save\n format.html { redirect_to @transakcje_jaskula, notice: 'Transakcje jaskula was successfully created.' }\n format.json { render :show, status: :created, location: @transakcje_jaskula }\n else\n format.html { render :new }\n format.json { render json: @transakcje_jaskula.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @midia = Midia.new(midia_params)\n\n respond_to do |format|\n if @midia.save\n format.html { redirect_to @midia, notice: 'Um novo tipo de mídia foi criado com sucesso.' }\n format.json { render json: @midia, status: :created, location: @midia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @midia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jabatan = Jabatan.new(jabatan_params)\n\n respond_to do |format|\n if @jabatan.save\n format.html { redirect_to @jabatan, notice: 'Jabatan berhasil tersimpan.' }\n format.json { render :show, status: :created, location: @jabatan }\n else\n format.html { render :new }\n format.json { render json: @jabatan.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end", "def create\n @metum = Metum.new(params[:metum])\n\n respond_to do |format|\n if @metum.save\n format.html { redirect_to @metum, notice: 'Metum was successfully created.' }\n format.json { render json: @metum, status: :created, location: @metum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def mascotum_params\n params.require(:mascotum).permit(:id_Mas, :nombre, :dueño, :entrada, :salida, :vacunas, :raza, :edad, :estado)\n end", "def create\n @unidad_medida.user_id = current_user.id\n respond_to do |format|\n if @unidad_medida.save\n format.html { redirect_to @unidad_medida, notice: 'Unidad medida was successfully created.' }\n format.json { render :show, status: :created, location: @unidad_medida }\n else\n format.html { render :new }\n format.json { render json: @unidad_medida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @unidad_medida.user_id = current_user.id\n respond_to do |format|\n if @unidad_medida.save\n format.html { redirect_to @unidad_medida, notice: 'Unidad medida was successfully created.' }\n format.json { render :show, status: :created, location: @unidad_medida }\n else\n format.html { render :new }\n format.json { render json: @unidad_medida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turma = Turma.new(turma_params)\n @turma.usuario = current_usuario\n @turma.turma_ativa = true\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to turmas_path, notice: 'Turma salva com sucesso.' }\n format.json { render :show, status: :created, location: @turma }\n else\n format.html { render :new }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@post_metum = PostMetum.new(post_metum_params)\n\n\t\trespond_to do |format|\n\t\t\tif @post_metum.save\n\t\t\t\tformat.html { redirect_to @post_metum, notice: 'Post metum was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @post_metum }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @post_metum.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @marca = Marca.new(marca_params)\n\n respond_to do |format|\n if @marca.save\n format.html { redirect_to @marca, notice: \"Marca was successfully created.\" }\n format.json { render :show, status: :created, location: @marca }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @marca.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mamal = Mamal.new(mamal_params)\n\n respond_to do |format|\n if @mamal.save\n format.html { redirect_to @mamal, notice: 'Mamal was successfully created.' }\n format.json { render :show, status: :created, location: @mamal }\n else\n format.html { render :new }\n format.json { render json: @mamal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kishangarh_marble = KishangarhMarble.new(kishangarh_marble_params)\n\n respond_to do |format|\n if @kishangarh_marble.save\n format.html { redirect_to kishangarh_marbles_url, notice: 'Kishangarh marble was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kishangarh_marble }\n else\n format.html { render action: 'new' }\n format.json { render json: @kishangarh_marble.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @moussaillon = Moussaillon.new(moussaillon_params)\n\n respond_to do |format|\n if @moussaillon.save\n format.html { redirect_to @moussaillon, notice: 'Moussaillon was successfully created.' }\n format.json { render :show, status: :created, location: @moussaillon }\n else\n format.html { render :new }\n format.json { render json: @moussaillon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @maling = Maling.new(maling_params)\n\n respond_to do |format|\n if @maling.save\n format.html { redirect_to @maling, notice: 'Maling was successfully created.' }\n format.json { render :show, status: :created, location: @maling }\n else\n format.html { render :new }\n format.json { render json: @maling.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mencion = Mencion.new(params[:mencion])\n\n respond_to do |format|\n if @mencion.save\n format.html { redirect_to @mencion, notice: 'Mencion creada' }\n format.json { render json: @mencion, status: :created, location: @mencion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mencion.errors, status: :unprocessable_entity }\n end\n end\n end", "def manga_params\n params.require(:manga).permit(:nombre)\n end", "def create\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.new(laporan_guru_agama_katolik_params)\n @laporan_guru_agama_katolik.pengguna_id = current_pengguna.id\n\n respond_to do |format|\n if @laporan_guru_agama_katolik.save\n format.html { redirect_to @laporan_guru_agama_katolik, notice: 'Laporan guru agama katolik was successfully created.' }\n format.json { render :show, status: :created, location: @laporan_guru_agama_katolik }\n else\n format.html { render :new }\n format.json { render json: @laporan_guru_agama_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @metum = Metum.new(metum_params)\n\n respond_to do |format|\n if @metum.save\n format.html { redirect_to @metum, notice: 'Metum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @metum }\n else\n format.html { render action: 'new' }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @uang_masuk.update(uang_masuk_params)\n format.html { redirect_to @uang_masuk, notice: 'Uang masuk was successfully updated.' }\n format.json { render :show, status: :ok, location: @uang_masuk }\n else\n format.html { render :edit }\n format.json { render json: @uang_masuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ulasan = Ulasan.new(ulasan_params)\n\n if @ulasan.save\n render :show, status: :created, location: @ulasan\n else\n render json: @ulasan.errors, status: :unprocessable_entity\n end\n end", "def create\n @mantenimiento = Mantenimiento.new(mantenimiento_params)\n\n respond_to do |format|\n if @mantenimiento.save\n format.html { redirect_to @mantenimiento, notice: 'Mantenimiento was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mantenimiento }\n else\n format.html { render action: 'new' }\n format.json { render json: @mantenimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mk_puntuacio = MkPuntuacio.new(mk_puntuacio_params)\n\n respond_to do |format|\n if @mk_puntuacio.save\n format.html { redirect_to @mk_puntuacio, notice: 'Mk puntuacio was successfully created.' }\n format.json { render :show, status: :created, location: @mk_puntuacio }\n else\n format.html { render :new }\n format.json { render json: @mk_puntuacio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ujumbe = current_user.ujumbes.build(ujumbe_params)\n @user = current_user\n\n respond_to do |format|\n if @ujumbe.save\n format.html { redirect_to edit_ujumbe_path(@ujumbe), notice: 'Ujumbe was successfully created. You can now complete it' }\n format.json { render action: 'show', status: :created, location: @ujumbe }\n else\n format.html { render action: 'new' }\n format.json { render json: @ujumbe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mdistantmetastasi = Mdistantmetastasi.new(mdistantmetastasi_params)\n\n respond_to do |format|\n if @mdistantmetastasi.save\n format.html { redirect_to @mdistantmetastasi, notice: 'Mdistantmetastasi was successfully created.' }\n format.json { render :show, status: :created, location: @mdistantmetastasi }\n else\n format.html { render :new }\n format.json { render json: @mdistantmetastasi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kumo = Kumo.new(kumo_params)\n\n respond_to do |format|\n if @kumo.save\n format.html { redirect_to kumos_path, notice: 'Kumo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kumo }\n else\n format.html { render action: 'new' }\n format.json { render json: @kumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kontoumsatz = Kontoumsatz.new(kontoumsatz_params)\n\n respond_to do |format|\n if @kontoumsatz.save\n format.html { redirect_to @kontoumsatz, notice: 'Kontoumsatz was successfully created.' }\n format.json { render :show, status: :created, location: @kontoumsatz }\n else\n format.html { render :new }\n format.json { render json: @kontoumsatz.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mascotum = Mascotum.new(mascotum_params)\n @mascotum.entrada = \"\"+ params[:entrada][:day] +'/' +params[:entrada][:month] +'/' +params[:entrada][:year]\n @mascotum.salida = \"\"+ params[:salida][:day] +'/' +params[:salida][:month] +'/' +params[:salida][:year]\n respond_to do |format|\n if @mascotum.save\n format.html { redirect_to @mascotum, notice: 'Mascota creada exitosamente' }\n format.json { render :show, status: :created, location: @mascotum }\n else\n format.html { render :new }\n format.json { render json: @mascotum.errors, status: :unprocessable_entity }\n end\n end\n end", "def mata_matum_params\n params.require(:mata_matum).permit(:nome_camp, :modalidade, :competidores)\n end", "def mascotum_params\n params.require(:mascotum).permit(:nombre, :tipo, :raza)\n end", "def create\n @tangazo = Tangazo.new(tangazo_params)\n\n respond_to do |format|\n if @tangazo.save\n format.html { redirect_to @tangazo, notice: 'Tangazo was successfully created.' }\n format.json { render :show, status: :created, location: @tangazo }\n else\n format.html { render :new }\n format.json { render json: @tangazo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pautum = Pautum.new(pautum_params)\n\n respond_to do |format|\n if @pautum.save\n format.html { redirect_to @pautum, notice: 'Pautum was successfully created.' }\n format.json { render :show, status: :created, location: @pautum }\n else\n format.html { render :new }\n format.json { render json: @pautum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asama_tanim = AsamaTanim.new(asama_tanim_params)\n\n respond_to do |format|\n if @asama_tanim.save\n format.html { redirect_to @asama_tanim, notice: 'Asama tanim was successfully created.' }\n format.json { render :show, status: :created, location: @asama_tanim }\n else\n format.html { render :new }\n format.json { render json: @asama_tanim.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p \"## TESTE #\" \n @mural_post = MuralPost.new( user_id: params[:user_id], \n latitude: params[:latitude], \n longitude: params[:longitude], \n message: params[:message],\n anonymous: params[:anonymous]\n )\n \n respond_to do |format|\n if @mural_post.save\n format.html { redirect_to @mural_post, notice: 'Mural post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mural_post }\n else\n p \"## ERRO #\" \n format.html { render action: 'new' }\n format.json { render json: @mural_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mensagem = Mensagem.new(params[:mensagem])\n @mensagem.autor = session[:current_user]\n id_to_post = String.new\n \n case @mensagem.recebedor_type\n when \"Turma\"\n aux = Turma.find(@mensagem.recebedor_id)\n id_to_post = aux.group_id\n end\n \n @mensagem.post_id = api_client.put_wall_post(@mensagem.conteudo, {}, id_to_post)['id']\n\n respond_to do |format|\n if @mensagem.save\n #format.html { redirect_to(@mensagem, :notice => 'Mensagem was successfully created.') }\n format.xml { render :xml => @mensagem, :status => :created, :location => @mensagem }\n format.js {}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mensagem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @unidade_medida = UnidadeMedida.new(params[:unidade_medida])\n\n respond_to do |format|\n if @unidade_medida.save\n format.html { redirect_to @unidade_medida, notice: 'Unidade medida foi criado com sucesso.' }\n format.json { render json: @unidade_medida, status: :created, location: @unidade_medida }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unidade_medida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ma_table = MaTable.new(ma_table_params)\n\n respond_to do |format|\n if @ma_table.save\n format.html { redirect_to @ma_table, notice: 'Ma table was successfully created.' }\n format.json { render :show, status: :created, location: @ma_table }\n else\n format.html { render :new }\n format.json { render json: @ma_table.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @jamaat = Jamaat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jamaat }\n end\n end", "def manutencao_params\n params.require(:manutencao).permit(:nome, :serie, :razao, :modelo, :email, :telefone, :estado, :cidade, :solicitacao)\n end", "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "def create\n @marmita = Marmita.new(params[:marmita])\n\n respond_to do |format|\n if @marmita.save\n format.html { redirect_to(@marmita, :notice => 'Marmita was successfully created.') }\n format.xml { render :xml => @marmita, :status => :created, :location => @marmita }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @marmita.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @minicurso = Minicurso.new(params[:minicurso])\n\n respond_to do |format|\n if @minicurso.save\n format.html { redirect_to @minicurso, notice: 'Minicurso was successfully created.' }\n format.json { render json: @minicurso, status: :created, location: @minicurso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @minicurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @crew_mun = Crew::Mun.new(crew_mun_params)\n\n respond_to do |format|\n if @crew_mun.save\n format.html { redirect_to @crew_mun, notice: 'Mun was successfully created.' }\n format.json { render :show, status: :created, location: @crew_mun }\n else\n format.html { render :new }\n format.json { render json: @crew_mun.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\n\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 create\n @turma = Turma.new(params[:turma])\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'Turma criada com sucesso.' }\n format.json { render json: @turma, status: :created, location: @turma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @apertura_moneda = AperturaMoneda.new(apertura_moneda_params)\n\n respond_to do |format|\n if @apertura_moneda.save\n format.html { redirect_to @apertura_moneda, notice: 'Apertura moneda was successfully created.' }\n format.json { render :show, status: :created, location: @apertura_moneda }\n else\n format.html { render :new }\n format.json { render json: @apertura_moneda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mutacao = Mutacao.new(params[:mutacao])\n\n respond_to do |format|\n if @mutacao.save\n format.html { redirect_to mutacaos_path, notice: 'Mutacao was successfully created.' }\n format.json { render json: @mutacao, status: :created, location: @mutacao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mutacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @setum = Setum.new(setum_params)\n\n respond_to do |format|\n if @setum.save\n format.html { redirect_to @setum, notice: 'Setum was successfully created.' }\n format.json { render :show, status: :created, location: @setum }\n else\n format.html { render :new }\n format.json { render json: @setum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medicamento = Medicamento.new(params[:medicamento])\n\n respond_to do |format|\n if @medicamento.save\n format.html { redirect_to @medicamento, notice: 'Medicamento was successfully created.' }\n format.json { render json: @medicamento, status: :created, location: @medicamento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medicamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quinto = Quinto.new(quinto_params)\n \n @quinto.anio = params[:anio]\n @quinto.mes = params[:mes]\n \n \n respond_to do |format|\n if @quinto.save\n format.html { redirect_to @quinto, notice: 'Quinto was successfully created.' }\n format.json { render :show, status: :created, location: @quinto }\n else\n format.html { render :new }\n format.json { render json: @quinto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @metum = Metum.new(metum_params)\n @meta.user = current_user\n\n respond_to do |format|\n if @metum.save\n format.html { redirect_to @metum, notice: 'Metum was successfully created.' }\n format.json { render :show, status: :created, location: @metum }\n else\n format.html { render :new }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @meibo = Meibo.new(meibo_params)\n\n respond_to do |format|\n if @meibo.save\n format.html { redirect_to @meibo, notice: '名簿は正常に作成されました。' }\n format.json { render :show, status: :created, location: @meibo }\n else\n format.html { @meibos = Meibo.page(params[:page]).per(@@kensu) ; render :index }\n format.json { render json: @meibo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @postavka = Postavka.new(postavka_params)\n\n respond_to do |format|\n if @postavka.save\n format.html { redirect_to @postavka, notice: 'Postavka was successfully created.' }\n format.json { render action: 'show', status: :created, location: @postavka }\n else\n format.html { render action: 'new' }\n format.json { render json: @postavka.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacuna = Vacuna.new(vacuna_params)\n @vacuna.mascota_id = @mascota.id\n respond_to do |format|\n if @vacuna.save\n format.html { redirect_to @vacuna, notice: 'Vacuna Agregada exitosamente' }\n format.json { render :show, status: :created, location: @vacuna }\n else\n format.html { render :new }\n format.json { render json: @vacuna.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @m_titular = MTitular.new(m_titular_params)\n\n respond_to do |format|\n if @m_titular.save\n format.html { redirect_to @m_titular, notice: 'M titular was successfully created.' }\n format.json { render :show, status: :created, location: @m_titular }\n else\n format.html { render :new }\n format.json { render json: @m_titular.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @moresmalltrial = Moresmalltrial.new(params[:moresmalltrial])\n\n respond_to do |format|\n if @moresmalltrial.save\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully created.' }\n format.json { render json: @moresmalltrial, status: :created, location: @moresmalltrial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @minha_pagina = MinhaPagina.new(minha_pagina_params)\n\n respond_to do |format|\n if @minha_pagina.save\n format.html { redirect_to @minha_pagina, notice: 'Minha pagina was successfully created.' }\n format.json { render :show, status: :created, location: @minha_pagina }\n else\n format.html { render :new }\n format.json { render json: @minha_pagina.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reuniao = Reuniao.new(reuniao_params)\n @pautum=Pautum.new\n @reuniao.pautum =@pautum\n @reuniao.atum=Atum.new\n @reuniao.status=\"Preparação\"\n @pautum.status=\"Preparação\"\n \n respond_to do |format|\n if @reuniao.save\n @pautum.titulo=@reuniao.titulo\n @pautum.save\n format.html { redirect_to @reuniao, notice: 'Reuniao was successfully created.' }\n format.json { render :show, status: :created, location: @reuniao }\n else\n format.html { render :new }\n format.json { render json: @reuniao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medalha = Medalha.new(medalha_params)\n\n respond_to do |format|\n if @medalha.save\n format.html { redirect_to @medalha, notice: 'Medalha was successfully created.' }\n format.json { render :show, status: :created, location: @medalha }\n else\n format.html { render :new }\n format.json { render json: @medalha.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @musico = Musico.new(musico_params)\n\n respond_to do |format|\n if @musico.save\n format.html { redirect_to @musico, notice: 'Musico was successfully created.' }\n format.json { render :show, status: :created, location: @musico }\n else\n format.html { render :new }\n format.json { render json: @musico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @musica = Musica.new(musica_params)\n\n respond_to do |format|\n if @musica.save\n format.html { redirect_to @musica, notice: 'Álbum publicada com sucesso!' }\n format.json { render :show, status: :created, location: @musica }\n else\n format.html { render :new }\n format.json { render json: @musica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @klienci_jaskula = KlienciJaskula.new(klienci_jaskula_params)\n\n respond_to do |format|\n if @klienci_jaskula.save\n format.html { redirect_to @klienci_jaskula, notice: 'Klienci jaskula was successfully created.' }\n format.json { render :show, status: :created, location: @klienci_jaskula }\n else\n format.html { render :new }\n format.json { render json: @klienci_jaskula.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bahan = Bahan.new(params[:bahan])\n\n respond_to do |format|\n if @bahan.save\n format.html { redirect_to @bahan, notice: 'Bahan was successfully created.' }\n format.json { render json: @bahan, status: :created, location: @bahan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bahan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @imobiliaria = Imobiliaria.new(imobiliaria_params)\r\n\r\n respond_to do |format|\r\n if @imobiliaria.save\r\n format.json { render json: @imobiliaria, status: :created }\r\n else \r\n format.json { render json: @imobiliaria.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def fuliza_mpesa_params\n params.require(:fuliza_mpesa).permit(:description, :mpesa_id)\n end", "def create\n @muneco = Muneco.new(muneco_params)\n\n respond_to do |format|\n if @muneco.save\n format.html { redirect_to @muneco, notice: 'Muneco was successfully created.' }\n format.json { render :show, status: :created, location: @muneco }\n else\n format.html { render :new }\n format.json { render json: @muneco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @penjualan_bahan = PenjualanBahan.new(params[:penjualan_bahan])\n\n respond_to do |format|\n if @penjualan_bahan.save\n format.html { redirect_to @penjualan_bahan, notice: 'Penjualan bahan was successfully created.' }\n format.json { render json: @penjualan_bahan, status: :created, location: @penjualan_bahan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @penjualan_bahan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @basico_marca = Basico::Marca.new(basico_marca_params)\n\n respond_to do |format|\n if @basico_marca.save\n format.html { redirect_to @basico_marca, notice: 'Marca was successfully created.' }\n format.json { render :show, status: :created, location: @basico_marca }\n else\n format.html { render :new }\n format.json { render json: @basico_marca.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inquilino = Inquilino.new(inquilino_params)\n respond_to do |format|\n if @inquilino.save\n #@pagamento = Pagamento.create(mes: @inquilino.dataVencimento.to_s, pago: @inquilino.pago, inquilino_id: @inquilino.id)\n #@mensalidade = Mensalidade.create(inquilino_id: @inquilino.id, pagamento_id: @pagamento.id)\n #@mensalidade = Mensalidade.create(pago: @inquilino.pago, inquilino_id: @inquilino.id)\n @mesa = @inquilino.dataVencimento\n @cont = 0\n 12.times do\n @cont += 1\n @mes = @mesa + @cont.month\n @mensalidades = Mensalidade.create(inquilino_id: @inquilino.id, mes: @mes, pago: false)\n end\n #\n @whatsapp = Whatsapp.create(inquilino_id: @inquilino.id, numero: \" \", endereco: \" \")\n\n format.html {redirect_to @inquilino, notice: 'Inquilino criado com sucesso!.'}\n format.json {render :show, status: :created, location: @inquilino}\n else\n format.html {render :new}\n format.json {render json: @inquilino.errors, status: :unprocessable_entity}\n end\n end\n end" ]
[ "0.6765135", "0.6558367", "0.64361453", "0.64069957", "0.6372077", "0.63490796", "0.6300831", "0.62534034", "0.6252394", "0.6232137", "0.62242776", "0.6219938", "0.61723536", "0.61279565", "0.61261934", "0.6087251", "0.607512", "0.6014324", "0.5990471", "0.5990286", "0.5973664", "0.5972193", "0.5919268", "0.59014875", "0.58823895", "0.58659756", "0.5860155", "0.58265096", "0.5824972", "0.58160716", "0.57787055", "0.5776544", "0.5771087", "0.57674354", "0.57657135", "0.57574725", "0.57494444", "0.57473767", "0.57473767", "0.57445323", "0.57391286", "0.573714", "0.57319796", "0.5723395", "0.5722164", "0.5718525", "0.5716597", "0.5706347", "0.5701264", "0.5698584", "0.5696199", "0.5695356", "0.5687178", "0.5677553", "0.5675969", "0.5671974", "0.5669473", "0.56669545", "0.5666384", "0.56575274", "0.56545925", "0.5648387", "0.5647475", "0.56455314", "0.5644801", "0.56420064", "0.5639535", "0.5638825", "0.5637571", "0.56353635", "0.56277084", "0.5623446", "0.56215876", "0.5619303", "0.5618619", "0.5612227", "0.5608512", "0.5602703", "0.558559", "0.55793816", "0.5573818", "0.55691725", "0.5568536", "0.5566491", "0.5561683", "0.5561095", "0.55564207", "0.55495703", "0.5543976", "0.5542405", "0.553249", "0.552711", "0.55270815", "0.5520115", "0.5517563", "0.5517216", "0.55161387", "0.55109286", "0.5507359", "0.55043125" ]
0.74192625
0
PATCH/PUT /uang_masuks/1 PATCH/PUT /uang_masuks/1.json
def update respond_to do |format| if @uang_masuk.update(uang_masuk_params) format.html { redirect_to @uang_masuk, notice: 'Uang masuk was successfully updated.' } format.json { render :show, status: :ok, location: @uang_masuk } else format.html { render :edit } format.json { render json: @uang_masuk.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @municao.update(municao_params)\n format.html { redirect_to @municao, notice: 'A Munição foi editada com sucesso!' }\n format.json { render :show, status: :ok, location: @municao }\n else\n format.html { render :edit }\n format.json { render json: @municao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n if @jamaat.update_attributes(params[:jamaat])\n format.html { redirect_to @jamaat, notice: 'Jamaat was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jamaat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @minuman.update(minuman_params)\n format.html { redirect_to @minuman, notice: 'Minuman was successfully updated.' }\n format.json { render :show, status: :ok, location: @minuman }\n else\n format.html { render :edit }\n format.json { render json: @minuman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mou.update(mou_params)\n format.html { redirect_to @mou, notice: 'Mou was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mou.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mata_matum.update(mata_matum_params)\n format.html { redirect_to @mata_matum, notice: 'Mata matum was successfully updated.' }\n format.json { render :show, status: :ok, location: @mata_matum }\n else\n format.html { render :edit }\n format.json { render json: @mata_matum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kumo.update(kumo_params)\n format.html { redirect_to kumos_path, notice: 'Kumo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @manga = Manga.find(params[:id])\n\n respond_to do |format|\n if @manga.update_attributes(params[:manga])\n format.html { redirect_to @manga, notice: 'Manga was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sifat_surat_masuk.update(sifat_surat_masuk_params)\n format.html { redirect_to @sifat_surat_masuk, notice: 'Sifat surat masuk was successfully updated.' }\n format.json { render :show, status: :ok, location: @sifat_surat_masuk }\n else\n format.html { render :edit }\n format.json { render json: @sifat_surat_masuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @minnpaku.update(minnpaku_params)\n format.html { redirect_to @minnpaku, notice: 'Minnpaku was successfully updated.' }\n format.json { render :show, status: :ok, location: @minnpaku }\n else\n format.html { render :edit }\n format.json { render json: @minnpaku.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_metum.update(test_metum_params)\n format.html { redirect_to @test_metum, notice: 'Test metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @metum.update(metum_params)\n format.html { redirect_to @metum, notice: 'Metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @maquinat.update(maquinat_params)\n format.html { redirect_to @maquinat, notice: 'Maquinat was successfully updated.' }\n format.json { render :show, status: :ok, location: @maquinat }\n else\n format.html { render :edit }\n format.json { render json: @maquinat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kishangarh_marble.update(kishangarh_marble_params)\n format.html { redirect_to @kishangarh_marble, notice: 'Kishangarh marble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kishangarh_marble.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @amu.update(amu_params)\n format.html { redirect_to @amu, notice: 'Amu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @amu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @manutencao.update(manutencao_params)\n format.html { redirect_to ajudas_path, notice: 'Manutencao was successfully updated.' }\n format.json { render :show, status: :ok, location: @manutencao }\n else\n format.html { render :edit }\n format.json { render json: @manutencao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @manga.update(manga_params)\n format.html { redirect_to @manga, notice: 'Manga was successfully updated.' }\n format.json { render :show, status: :ok, location: @manga }\n else\n format.html { render :edit }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n if @mapeamento.update_attributes(params[:mapeamento])\n format.html { redirect_to @mapeamento, notice: 'Mapeamento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mapeamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @metum = Metum.find(params[:id])\n\n respond_to do |format|\n if @metum.update_attributes(params[:metum])\n format.html { redirect_to @metum, notice: 'Metum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @metum.update(metum_params)\n format.html { redirect_to @metum, notice: 'Metum was successfully updated.' }\n format.json { render :show, status: :ok, location: @metum }\n else\n format.html { render :edit }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @makrana_marble.update(makrana_marble_params)\n format.html { redirect_to @makrana_marble, notice: 'Marble product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @makrana_marble.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 respond_to do |format|\n if @musing.update(musing_params)\n format.html { redirect_to @musing, notice: 'Musing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @musing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @setum.update(setum_params)\n format.html { redirect_to @setum, notice: 'Setum was successfully updated.' }\n format.json { render :show, status: :ok, location: @setum }\n else\n format.html { render :edit }\n format.json { render json: @setum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mutacao = Mutacao.find(params[:id])\n\n respond_to do |format|\n if @mutacao.update_attributes(params[:mutacao])\n format.html { redirect_to @mutacao, notice: 'Mutacao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mutacao.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 respond_to do |format|\n if @tubuyaki.update(tubuyaki_params)\n format.html { redirect_to @tubuyaki, notice: 'Tubuyaki was successfully updated.' }\n format.json { render :show, status: :ok, location: @tubuyaki }\n else\n format.html { render :edit }\n format.json { render json: @tubuyaki.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @metodologia.update(metodologia_params)\n format.html { redirect_to @metodologia, notice: 'Metodologia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @metodologia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @makanan.update(makanan_params)\n format.html { redirect_to @makanan, notice: 'Makanan was successfully updated.' }\n format.json { render :show, status: :ok, location: @makanan }\n else\n format.html { render :edit }\n format.json { render json: @makanan.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 @admin_mural.update(admin_mural_params)\n format.html { redirect_to @admin_mural, notice: 'Mural was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_mural }\n else\n format.html { render :edit }\n format.json { render json: @admin_mural.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n if @momsg.update_attributes(params[:momsg])\n format.html { redirect_to @momsg, notice: 'Momsg was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @momsg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n head :no_content\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n if @motivobaja.update(motivo_baja_params)\n format.html { redirect_to @motivobaja, notice: 'Motivo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @motivobaja.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bakusokukun.update(bakusokukun_params)\n format.html { redirect_to @bakusokukun, notice: 'Bakusokukun was successfully updated.' }\n format.json { render :show, status: :ok, location: @bakusokukun }\n else\n format.html { render :edit }\n format.json { render json: @bakusokukun.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @midia.update_attributes(midia_params)\n format.html { redirect_to @midia, notice: 'O tipo de mídia foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @midia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mascotum.update(mascotum_params)\n format.html { redirect_to @mascotum, notice: 'Mascotum was successfully updated.' }\n format.json { render :show, status: :ok, location: @mascotum }\n else\n format.html { render :edit }\n format.json { render json: @mascotum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @business_metum.update(business_metum_params)\n format.html { redirect_to @business_metum, notice: 'Business metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @business_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kalo.update(kalo_params)\n format.html { redirect_to @kalo, notice: 'Kalo was successfully updated.' }\n format.json { render :show, status: :ok, location: @kalo }\n else\n format.html { render :edit }\n format.json { render json: @kalo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @muneco.update(muneco_params)\n format.html { redirect_to @muneco, notice: 'Muneco was successfully updated.' }\n format.json { render :show, status: :ok, location: @muneco }\n else\n format.html { render :edit }\n format.json { render json: @muneco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tangazo.update(tangazo_params)\n format.html { redirect_to @tangazo, notice: 'Tangazo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tangazo }\n else\n format.html { render :edit }\n format.json { render json: @tangazo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @manteni.update(manteni_params)\n format.html { redirect_to @manteni, notice: 'Manteni was successfully updated.' }\n format.json { render :show, status: :ok, location: @manteni }\n else\n format.html { render :edit }\n format.json { render json: @manteni.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @matome.update(matome_params)\n format.html { redirect_to @matome, notice: 'Matome was successfully updated.' }\n format.json { render :show, status: :ok, location: @matome }\n else\n format.html { render :edit }\n format.json { render json: @matome.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @matome.update(matome_params)\n format.html { redirect_to @matome, notice: 'Matome was successfully updated.' }\n format.json { render :show, status: :ok, location: @matome }\n else\n format.html { render :edit }\n format.json { render json: @matome.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kontum.update(kontum_params)\n format.html { redirect_to @kontum, notice: 'Kontum was successfully updated.' }\n format.json { render :show, status: :ok, location: @kontum }\n else\n format.html { render :edit }\n format.json { render json: @kontum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n if @minicurso.update_attributes(params[:minicurso])\n format.html { redirect_to @minicurso, notice: 'Minicurso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @minicurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @klasa.update(klasa_params)\n format.html { redirect_to @klasa, notice: 'Klasa was successfully updated.' }\n format.json { render :show, status: :ok, location: @klasa }\n else\n format.html { render :edit }\n format.json { render json: @klasa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @m1.update(m1_params)\n format.html { redirect_to @m1, notice: 'M1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @m1 }\n else\n format.html { render :edit }\n format.json { render json: @m1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @klienci_jaskula.update(klienci_jaskula_params)\n format.html { redirect_to @klienci_jaskula, notice: 'Klienci jaskula was successfully updated.' }\n format.json { render :show, status: :ok, location: @klienci_jaskula }\n else\n format.html { render :edit }\n format.json { render json: @klienci_jaskula.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kata.update(kata_params)\n format.html { redirect_to @kata, notice: 'Kata was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kata.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mantenimiento.update(mantenimiento_params)\n format.html { redirect_to @mantenimiento, notice: 'Mantenimiento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mantenimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @moussaillon.update(moussaillon_params)\n format.html { redirect_to @moussaillon, notice: 'Moussaillon was successfully updated.' }\n format.json { render :show, status: :ok, location: @moussaillon }\n else\n format.html { render :edit }\n format.json { render json: @moussaillon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tamire.update(tamire_params)\n format.html { redirect_to @tamire, notice: 'Tamire was successfully updated.' }\n format.json { render :show, status: :ok, location: @tamire }\n else\n format.html { render :edit }\n format.json { render json: @tamire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format|\n if @giang_vien.update_attributes(params[:giang_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @imakoko.update(imakoko_params)\n format.html { redirect_to @imakoko, notice: 'Imakoko was successfully updated.' }\n format.json { render :show, status: :ok, location: @imakoko }\n else\n format.html { render :edit }\n format.json { render json: @imakoko.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tuiguang.update(tuiguang_params)\n format.html { redirect_to @tuiguang, notice: 'Tuiguang was successfully updated.' }\n format.json { render :show, status: :ok, location: @tuiguang }\n else\n format.html { render :edit }\n format.json { render json: @tuiguang.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mensagem.update(mensagem_params)\n format.html { redirect_to @mensagem, notice: 'Mensagem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mensagem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mario.update(mario_params)\n format.html { redirect_to @mario, notice: 'Mario was successfully updated.' }\n format.json { render :show, status: :ok, location: @mario }\n else\n format.html { render :edit }\n format.json { render json: @mario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @mundo.update(mundo_params)\n format.html { redirect_to @mundo, notice: 'Mundo was successfully updated.' }\n format.json { render :show, status: :ok, location: @mundo }\n else\n format.html { render :edit }\n format.json { render json: @mundo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mercado_metum = MercadoMetum.find(params[:id])\n\n respond_to do |format|\n if @mercado_metum.update_attributes(params[:mercado_metum])\n format.html { redirect_to @mercado_metum, notice: 'Mercado metum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mercado_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mueble.update(mueble_params)\n format.html { redirect_to @mueble, notice: 'Mueble was successfully updated.' }\n format.json { render :show, status: :ok, location: @mueble }\n else\n format.html { render :edit }\n format.json { render json: @mueble.errors, status: :unprocessable_entity }\n end\n end\n end", "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n respond_to do |format|\n if @data_ukt.update(data_ukt_params)\n format.html { redirect_to @data_ukt, notice: 'Data ukt was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_ukt }\n else\n format.html { render :edit }\n format.json { render json: @data_ukt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mamal.update(mamal_params)\n format.html { redirect_to @mamal, notice: 'Mamal was successfully updated.' }\n format.json { render :show, status: :ok, location: @mamal }\n else\n format.html { render :edit }\n format.json { render json: @mamal.errors, status: :unprocessable_entity }\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\n @mencion = Mencion.find(params[:id])\n\n respond_to do |format|\n if @mencion.update_attributes(params[:mencion])\n format.html { redirect_to @mencion, notice: 'Mencion actualizada' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mencion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @aplikasi.update(aplikasi_params)\n format.html { redirect_to @aplikasi, notice: \"Aplikasi was successfully updated.\" }\n format.json { render :show, status: :ok, location: @aplikasi }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @aplikasi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @muscle_mass.update(muscle_mass_params)\r\n format.html { redirect_to @muscle_mass, notice: 'Muscle mass was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @muscle_mass.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bonu.update(bonu_params)\n format.html { redirect_to @bonu, notice: 'Bonu was successfully updated.' }\n format.json { render :show, status: :ok, location: @bonu }\n else\n format.html { render :edit }\n format.json { render json: @bonu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kontoumsatz.update(kontoumsatz_params)\n format.html { redirect_to @kontoumsatz, notice: 'Kontoumsatz was successfully updated.' }\n format.json { render :show, status: :ok, location: @kontoumsatz }\n else\n format.html { render :edit }\n format.json { render json: @kontoumsatz.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 respond_to do |format|\n if @asama_tanim.update(asama_tanim_params)\n format.html { redirect_to @asama_tanim, notice: 'Asama tanim was successfully updated.' }\n format.json { render :show, status: :ok, location: @asama_tanim }\n else\n format.html { render :edit }\n format.json { render json: @asama_tanim.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 @meuble = Meuble.find(params[:id])\n\n respond_to do |format|\n if @meuble.update_attributes(params[:meuble])\n format.html { redirect_to @meuble, notice: 'Meuble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meuble.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kansei_buhin = KanseiBuhin.find(params[:id])\n\n respond_to do |format|\n if @kansei_buhin.update_attributes(params[:kansei_buhin])\n format.html { redirect_to @kansei_buhin, notice: 'Kansei buhin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kansei_buhin.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 respond_to do |format|\n if @tipo_maguey.update(tipo_maguey_params)\n format.html { redirect_to @tipo_maguey, notice: 'Tipo maguey actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @tipo_maguey }\n else\n format.html { render :edit }\n format.json { render json: @tipo_maguey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n if @sistema.update_attributes(params[:sistema])\n format.html { redirect_to @sistema, notice: 'Sistema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sistema.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @basico_marca.update(basico_marca_params)\n format.html { redirect_to @basico_marca, notice: 'Marca was successfully updated.' }\n format.json { render :show, status: :ok, location: @basico_marca }\n else\n format.html { render :edit }\n format.json { render json: @basico_marca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_ministerio.update(sivic_ministerio_params)\r\n format.html { redirect_to @sivic_ministerio, 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_ministerio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @ambit.update(ambit_params)\n format.html { redirect_to @ambit, notice: 'Ambit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ambit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transakcje_jaskula.update(transakcje_jaskula_params)\n format.html { redirect_to @transakcje_jaskula, notice: 'Transakcje jaskula was successfully updated.' }\n format.json { render :show, status: :ok, location: @transakcje_jaskula }\n else\n format.html { render :edit }\n format.json { render json: @transakcje_jaskula.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @slam = Slam.find(params[:id])\n \n respond_to do |format|\n if @slam.update_attributes(params[:slam])\n format.html { redirect_to @slam, notice: 'Fixed up!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slam.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipe_simpanan.update(tipe_simpanan_params)\n format.html { redirect_to @tipe_simpanan, notice: 'Tipe simpanan was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipe_simpanan }\n else\n format.html { render :edit }\n format.json { render json: @tipe_simpanan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @musico.update(musico_params)\n format.html { redirect_to @musico, notice: 'Musico was successfully updated.' }\n format.json { render :show, status: :ok, location: @musico }\n else\n format.html { render :edit }\n format.json { render json: @musico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usuario = Usuario.find_by_id(params[:id])\n if @usuario.nil?\n render :json => {:error => \"Usuario no encontrado\"}.to_json, :status => 404\n\n #render :json => {:error => \"id no es modificable\"}.to_json, :status => 400\n else\n if usuario_params.count==1\n respond_to do |format|\n # format.json { render json: usuario_params.count}\n if @usuario.update(usuario_params)\n #format.json { render json: @usuario}\n\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n #el segundo\n format.json { render :show, status: :ok, location: @usuario }\n end\n end\n elsif usuario_params.count==0\n # JSON.parse(usuario_params)\n respond_to do |format|\n format.json { render :json => {:error => \"id no es modificable\"}.to_json, :status => 400 }\n end\n else\n respond_to do |format|\n format.json { render :json => {:error => \"La modificación ha fallado\"}.to_json, :status => 500 }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @megalith.update(megalith_params)\n format.html { redirect_to @megalith, notice: \"Megalith was successfully updated.\" }\n format.json { render :show, status: :ok, location: @megalith }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @megalith.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n mk = connect_mikrotik\n respond_to do |format|\n\n \n @plan_old = @plan.as_json # Guarda os parâmetros antigos do registro para retornar caso não consiga mudar no mikrotik\n \n id = mk.get_reply(\"/ppp/profile/print\", \"?name=#{@plan.profile_name}\")[0][\".id\"]\n puts \"Id do registro a ser mudado\"\n puts id\n\n if @plan.update(plan_params)\n \n result = mk.get_reply(\"/ppp/profile/set\",\n \"=name=#{plan_params[\"profile_name\"]}\",\n \"=rate-limit=#{plan_params[\"rate_limit\"]}\",\n \"=.id=#{id}\")[0][\"message\"]\n\n @notice = 'Plan was successfully updated.'\n if result != nil\n @notice = \"It wasn't possible to update mikrotik\"\n @plan.update(@plan_old)\n end\n\n format.html { redirect_to @plan, notice: @notice }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end", "def update\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n if @mi.update_attributes(params[:mi])\n format.html { redirect_to @mi, notice: 'Mi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @voluntario.update(voluntario_params) and @voluntario.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @voluntario, notice: 'Voluntario was successfully updated.' }\n format.json { render :show, status: :ok, location: @voluntario }\n else\n format.html { render :edit }\n format.json { render json: @voluntario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n respond_to do |format|\n if @ujumbe.update(ujumbe_params)\n format.html { redirect_to @ujumbe, notice: 'Ujumbe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ujumbe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @municipio.update(municipio_params) and @municipio.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @municipio, notice: 'Municipio was successfully updated.' }\n format.json { render :show, status: :ok, location: @municipio }\n else\n format.html { render :edit }\n format.json { render json: @municipio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @m_titular.update(m_titular_params)\n format.html { redirect_to @m_titular, notice: 'M titular was successfully updated.' }\n format.json { render :show, status: :ok, location: @m_titular }\n else\n format.html { render :edit }\n format.json { render json: @m_titular.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mural_post.update(mural_post_params)\n format.html { redirect_to @mural_post, notice: 'Mural post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mural_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @johari.update(johari_params)\n format.html { redirect_to @johari, notice: 'Johari was successfully updated.' }\n format.json { render :show, status: :ok, location: @johari }\n else\n format.html { render :edit }\n format.json { render json: @johari.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6621979", "0.66182715", "0.6617474", "0.6602954", "0.6565074", "0.6554986", "0.65191126", "0.6513416", "0.65086436", "0.65006024", "0.6457103", "0.6387565", "0.63814646", "0.63745594", "0.6361265", "0.6346211", "0.6342107", "0.63342166", "0.6324423", "0.6323482", "0.63093865", "0.6306055", "0.6278557", "0.6264174", "0.62634444", "0.6256878", "0.62458295", "0.6244642", "0.6243552", "0.6241236", "0.62389696", "0.62378037", "0.6237269", "0.6234877", "0.6231747", "0.6221393", "0.6203168", "0.6199484", "0.61806405", "0.61771196", "0.61760795", "0.6171861", "0.61660624", "0.61660624", "0.61654156", "0.61625504", "0.6157266", "0.6157125", "0.61565036", "0.61490506", "0.61429167", "0.6140774", "0.6139558", "0.61382896", "0.6136639", "0.61294216", "0.61215264", "0.6117141", "0.6114037", "0.61099625", "0.6098057", "0.6094379", "0.60831624", "0.6077134", "0.6074354", "0.60742205", "0.60712826", "0.6069817", "0.60682064", "0.6057099", "0.6054181", "0.6054058", "0.60524935", "0.6051738", "0.60502374", "0.60475177", "0.6045804", "0.60386455", "0.6034975", "0.6033195", "0.6033072", "0.6031807", "0.6031308", "0.60298914", "0.60278493", "0.6026599", "0.6026153", "0.60252756", "0.6017691", "0.60131043", "0.601225", "0.6010704", "0.60100424", "0.6008079", "0.60028", "0.6002411", "0.60018224", "0.60004765", "0.5994737", "0.59946287" ]
0.6941636
0
DELETE /uang_masuks/1 DELETE /uang_masuks/1.json
def destroy @uang_masuk.destroy respond_to do |format| format.html { redirect_to uang_masuks_url, notice: 'Uang masuk was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @jamaat = Jamaat.find(params[:id])\n @jamaat.destroy\n\n respond_to do |format|\n format.html { redirect_to jamaats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @manga = Manga.find(params[:id])\n @manga.destroy\n\n respond_to do |format|\n format.html { redirect_to mangas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sifat_surat_masuk.destroy\n respond_to do |format|\n format.html { redirect_to sifat_surat_masuk_index_url, notice: 'Sifat surat masuk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ujumbe.destroy\n respond_to do |format|\n format.html { redirect_to ujumbes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mata_matum.destroy\n respond_to do |format|\n format.html { redirect_to mata_mata_url, notice: 'Mata matum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mou.destroy\n respond_to do |format|\n format.html { redirect_to mous_url }\n format.json { head :no_content }\n end\n end", "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 @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 @kumo.destroy\n respond_to do |format|\n format.html { redirect_to kumos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @midia.destroy\n\n respond_to do |format|\n format.html { redirect_to midias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kansei_buhin = KanseiBuhin.find(params[:id])\n @kansei_buhin.destroy\n\n respond_to do |format|\n format.html { redirect_to kansei_buhins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_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 @amu.destroy\n respond_to do |format|\n format.html { redirect_to amus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @minuman.destroy\n respond_to do |format|\n format.html { redirect_to minumen_url, notice: 'Minuman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @kishangarh_marble.destroy\n respond_to do |format|\n format.html { redirect_to kishangarh_marbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tubuyaki.destroy\n respond_to do |format|\n format.html { redirect_to tubuyakis_url, notice: 'Tubuyaki was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bakusokukun.destroy\n respond_to do |format|\n format.html { redirect_to bakusokukuns_url, notice: 'Bakusokukun was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mascotum.destroy\n respond_to do |format|\n format.html { redirect_to mascota_url, notice: 'Mascota borrada exitosamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n @municao.destroy\n respond_to do |format|\n format.html { redirect_to municaos_url, notice: 'A Munição foi deletada com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @unidad_medida.destroy\n respond_to do |format|\n format.html { redirect_to unidad_medidas_url, notice: 'Unidad medida was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tuiguang.destroy\n respond_to do |format|\n format.html { redirect_to tuiguangs_url, notice: 'Tuiguang 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 delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @minnpaku.destroy\n respond_to do |format|\n format.html { redirect_to minnpakus_url, notice: 'Minnpaku was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manteni.destroy\n respond_to do |format|\n format.html { redirect_to mantenis_url, notice: 'Manteni was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ra_khoi_dang.destroy\n respond_to do |format|\n format.html { redirect_to ra_khoi_dangs_url, notice: 'Ra khoi dang was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @malarium.destroy\n respond_to do |format|\n format.html { redirect_to malaria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @makrana_marble.destroy\n respond_to do |format|\n format.html { redirect_to makrana_marbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @minicurso = Minicurso.find(params[:id])\n @minicurso.destroy\n\n respond_to do |format|\n format.html { redirect_to minicursos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @miscellaneou.destroy\n respond_to do |format|\n format.html { redirect_to miscellaneous_url, notice: 'Accessory was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @zakaz = Zakaz.find(params[:id])\n @zakaz.destroy\n\n respond_to do |format|\n format.html { redirect_to zakazs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sotrudniki = Sotrudniki.find(params[:id])\n @sotrudniki.destroy\n\n respond_to do |format|\n format.html { redirect_to sotrudnikis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mi = Mi.find(params[:id])\n @mi.destroy\n\n respond_to do |format|\n format.html { redirect_to mis_url }\n format.json { head :ok }\n end\n end", "def destroy\n \t @motivobaja = MotivoBaja.find(params[:id])\n @motivobaja.destroy\n respond_with(@motivobaja)\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 @laporan_guru_agama_katolik.destroy\n respond_to do |format|\n format.html { redirect_to laporan_guru_agama_katolik_index_url, notice: 'Laporan guru agama katolik was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n @imobiliaria.destroy\r\n\r\n respond_to do |format|\r\n format.json { head :no_content }\r\n end\r\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 @makanan.destroy\n respond_to do |format|\n format.html { redirect_to makanans_url, notice: 'Makanan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bahan = Bahan.find(params[:id])\n @bahan.destroy\n\n respond_to do |format|\n format.html { redirect_to bahans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kontum.destroy\n respond_to do |format|\n format.html { redirect_to konta_url, notice: 'Kontum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nguoi_dung = NguoiDung.find(params[:id])\n @nguoi_dung.destroy\n\n respond_to do |format|\n format.html { redirect_to nguoi_dungs_url }\n format.json { head :ok }\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 @mantenimiento.destroy\n respond_to do |format|\n format.html { redirect_to mantenimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mutacao = Mutacao.find(params[:id])\n @mutacao.destroy\n\n respond_to do |format|\n format.html { redirect_to mutacaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @adres_kontr.destroy\n respond_to do |format|\n format.html { redirect_to adres_kontr_index_url, notice: 'Adres kontr was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mapeamento = Mapeamento.find(params[:id])\n @mapeamento.destroy\n\n respond_to do |format|\n format.html { redirect_to mapeamentos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kecamatan.destroy\n respond_to do |format|\n format.html { redirect_to kecamatans_url, notice: 'Kecamatan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mision.destroy\n respond_to do |format|\n format.html { redirect_to misions_url, notice: 'La misión se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\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 @farmacium.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 @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 @sabre_de_luz.destroy\n respond_to do |format|\n format.html { redirect_to sabre_de_luzs_url, notice: 'Sabre de luz was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manga.destroy\n respond_to do |format|\n format.html { redirect_to mangas_url, notice: 'Manga was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manga.destroy\n respond_to do |format|\n format.html { redirect_to mangas_url, notice: 'Manga was successfully destroyed.' }\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 @moussaillon.destroy\n respond_to do |format|\n format.html { redirect_to moussaillons_url, notice: 'Moussaillon was successfully destroyed.' }\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 @kai2_tuan7.destroy\n respond_to do |format|\n format.html { redirect_to kai2_Kai2Tuan7s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shujukujiaoben.destroy\n respond_to do |format|\n format.html { redirect_to shujukujiaobens_url, notice: 'Shujukujiaoben was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tangazo.destroy\n respond_to do |format|\n format.html { redirect_to tangazos_url, notice: 'Tangazo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @duda.destroy\n respond_to do |format|\n format.html { redirect_to dudas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @receita_medica = ReceitaMedica.find(params[:id])\n @receita_medica.destroy\n\n respond_to do |format|\n format.html { redirect_to receita_medicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @novedad_mecanica.destroy\n respond_to do |format|\n format.html { redirect_to unidad_url(@unidad), notice: 'Novedad mecanica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @musique = Musique.find(params[:id])\n @musique.destroy\n\n respond_to do |format|\n format.html { redirect_to musiques_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unidade_medida = UnidadeMedida.find(params[:id])\n @unidade_medida.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_medidas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mundo.destroy\n respond_to do |format|\n format.html { redirect_to mundos_url, notice: 'Mundo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @amministrazione.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Amministrazione was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kullanici = Kullanici.find(params[:id])\n @kullanici.destroy\n\n respond_to do |format|\n format.html { redirect_to kullanicis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kontoumsatz.destroy\n respond_to do |format|\n format.html { redirect_to kontoumsatzs_url, notice: 'Kontoumsatz was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sistema = Sistema.find(params[:id])\n @sistema.destroy\n\n respond_to do |format|\n format.html { redirect_to sistemas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kegiatan.destroy\n respond_to do |format|\n format.html { redirect_to kegiatans_url, notice: 'Kegiatan 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 @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 @data_keagamaan_katolik.destroy\n respond_to do |format|\n format.html { redirect_to data_keagamaan_katolik_index_url, notice: 'Data keagamaan katolik was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mensagem = Mensagem.find(params[:id])\n api_client.delete_object(@mensagem.post_id)\n @mensagem.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.js { head :ok }\n end\n end", "def destroy\n @jabatan.destroy\n respond_to do |format|\n format.html { redirect_to jabatans_url, notice: 'Jabatan berhasil terhapus.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @surah.destroy\n respond_to do |format|\n format.html { redirect_to surahs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_pendidikan_agama_katolik.destroy\n respond_to do |format|\n format.html { redirect_to data_pendidikan_agama_katolik_index_url, notice: 'Data pendidikan agama katolik was successfully destroyed.' }\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 @buchung = Buchung.find(params[:id])\n @buchung.destroy\n\n respond_to do |format|\n format.html { redirect_to buchungs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dhokebaaz.destroy\n respond_to do |format|\n format.html { redirect_to dhokebaazs_url, notice: 'Dhokebaaz was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @setum.destroy\n respond_to do |format|\n format.html { redirect_to seta_url, notice: 'Setum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @muscle_mass.destroy\r\n respond_to do |format|\r\n format.html { redirect_to muscle_masses_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\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 @mdistantmetastasi.destroy\n respond_to do |format|\n format.html { redirect_to mdistantmetastasis_url, notice: 'Mdistantmetastasi was successfully destroyed.' }\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 @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\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 @lich_su_binh_bau = LichSuBinhBau.find(params[:id])\n @lich_su_binh_bau.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_lich_su_binh_baus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\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" ]
[ "0.7298238", "0.72319317", "0.72173846", "0.7208355", "0.71664023", "0.7165098", "0.71593475", "0.71474856", "0.71457386", "0.7130274", "0.71219695", "0.7111745", "0.7110901", "0.7098837", "0.70826423", "0.7076899", "0.7068214", "0.70646155", "0.7061949", "0.7060429", "0.7059552", "0.7059164", "0.704073", "0.7024437", "0.7022478", "0.7021227", "0.7021227", "0.70162076", "0.7011878", "0.7011284", "0.7006423", "0.7002336", "0.7000818", "0.70005465", "0.6994652", "0.69942224", "0.6982511", "0.69807297", "0.697947", "0.6977019", "0.6966354", "0.6957834", "0.69488937", "0.6947738", "0.6947172", "0.69459695", "0.6945775", "0.69454455", "0.69453937", "0.6944827", "0.69437176", "0.6937025", "0.6936066", "0.69293183", "0.69293183", "0.6927073", "0.6926365", "0.6926086", "0.69256014", "0.69232273", "0.69232273", "0.69217414", "0.6920214", "0.69192374", "0.6915298", "0.6914516", "0.691404", "0.69128186", "0.69050395", "0.6901625", "0.6896436", "0.6894926", "0.6893945", "0.68919003", "0.689158", "0.6891527", "0.6890632", "0.68868846", "0.6886456", "0.688641", "0.68859833", "0.68847346", "0.68824065", "0.68810993", "0.68784803", "0.68783206", "0.6877832", "0.68777037", "0.68750083", "0.68746024", "0.6874445", "0.68742794", "0.6873388", "0.6872956", "0.68702203", "0.6869903", "0.68684894", "0.686469", "0.6864459", "0.6863773" ]
0.74981093
0
Use callbacks to share common setup or constraints between actions.
def set_uang_masuk @uang_masuk = UangMasuk.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 uang_masuk_params params.require(:uang_masuk).permit(:jumlah, :tanggal, :keterangan) 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 valid_params_request?; 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 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 safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 url_whitelist; 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 admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "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 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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.6291174", "0.62905735", "0.6283171", "0.6242344", "0.62403613", "0.6218049", "0.62143815", "0.62104696", "0.61949855", "0.6178671", "0.6176147", "0.6173327", "0.6163395", "0.6153005", "0.6151833", "0.6147288", "0.61224324", "0.6118827", "0.61075264", "0.61054534", "0.6092497", "0.6080082", "0.60710967", "0.60627776", "0.60219413", "0.60175914", "0.60153484", "0.60107356", "0.60081726", "0.60081726", "0.60013986", "0.6000165", "0.59978646", "0.59936947", "0.59925723", "0.5992084", "0.59796256", "0.5967569", "0.5960056", "0.59589803", "0.5958441", "0.5958401", "0.5952607", "0.5952406", "0.5944409", "0.59391016", "0.593842", "0.593842", "0.5933845", "0.59312123", "0.5926475", "0.59248453", "0.59179676", "0.59109294", "0.59101623", "0.5908172", "0.59058356", "0.5899052", "0.5897749", "0.5896101", "0.58942914", "0.58939576", "0.5892063", "0.5887407", "0.588292", "0.58797663", "0.587367", "0.58681566", "0.5868038", "0.5866578", "0.58665025", "0.58655846", "0.58640826", "0.5863465", "0.5862226", "0.586065", "0.58581287", "0.5854443", "0.5854172", "0.58507544", "0.5849934" ]
0.0
-1
Return lowercase 'untitled', to comply with HIG
def displayName fileURL ? super : super.sub(/^[[:upper:]]/) {|s| s.downcase} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title\n name.gsub(/_/, ' ')\n end", "def wikified_name\n self.name.slice(0,1).capitalize + self.name.slice(1..-1).gsub(/ /, '_')\n end", "def wikiname(title)\n title.gsub(\" \",\"_\").downcase\nend", "def quick_title(song)\n File.basename(song, File.extname(song)).gsub(/^[^A-Za-z]+\\s+(\\w)/, \"\\\\1\")\n end", "def title\n title_raw.downcase\n end", "def name\n return '_untitled_' if self[:name].blank?\n self[:name]\n end", "def name\n\t\t\t\t@name ||= title.downcase.gsub(/\\s+/, UNDERSCORE).gsub(/[^a-z0-9_]/i, BLANK_STRING).to_sym\n\t\t\tend", "def titlecase!\n replace(titlecase)\n end", "def title\n\t\tlowers = %w(a an and but in of the)\n\t\ttitle_array = @title.split\n\t\ttitle_array.each do |word|\n\t\t\tif lowers.include?(title_array[0])\n\t\t\t\tword.capitalize!\n\t\t\telsif lowers.include?(word)\n\t\t\t\tword\n\t\t\telse\n\t\t\t\tword.capitalize!\n\t\t\tend\n\t\tend\n\t\ttitle_array.join(\" \")\n\tend", "def titlecase()\r\n ignore_list = %w{of etc and by the for on is at to but nor or a via}\r\n capitalize_all_ex(ignore_list)\r\n end", "def titleize\n#\t\thumanize(underscore(self)).gsub(/\\b('?[a-z])/) { $1.capitalize }\n#\t\thumanize(self.underscore).gsub(/\\b('?[a-z])/) { $1.capitalize }\n\t\tself.underscore.humanize.gsub(/\\b('?[a-z])/) { $1.capitalize }\n\tend", "def title\n name.capitalize.bold.sub('_', ' ')\n end", "def upcased_title\n title.upcase\n end", "def upcased_title\n title.upcase\n end", "def text_name\n title.to_s.t.html_to_ascii\n end", "def short_title(title)\n return \"\" unless title.present?\n case title\n when \"IM\" then \"m\"\n when \"WIM\" then \"wm\"\n else title.sub(/M$/, \"\").downcase\n end\n end", "def titleize!\n replace titleize\n end", "def smart_titlecase\n small_re = %w( is a an and as at but by en for if in of on or the to v[.]? via vs[.]? ).join('|')\n\n # Original Perl version by: John Gruber (daringfireball.net) 2008-05-10\n # Adapted to Ruby by: Marshall Elfstrand (vengefulcow.com/ 2008-05-21\n # Improved and customized: Jacob Duffy (duffy.jp) 2011-01-25\n # License: http://www.opensource.org/licenses/mit-license.php\n\n # if source is all uppercase, use all lowercase instead. -- jpd\n string = (self.upcase == self)? self.downcase : self\n\n result = \"\"\n string.gsub('_', ' ').split(/( [:.;?!][ ] | (?:[ ]|^)[\"\"] )/x).each do |s|\n s.gsub!(/ \\b( [[:alpha:]] [[:lower:].'']* )\\b /x) do |w|\n # Skip words with inresult dots, e.g. \"del.icio.us\" or \"example.com\"\n (w =~ / [[:alpha:]] [.] [[:alpha:]] /x) ? w : w.capitalize\n end\n\n # Lowercase our list of small words:\n s.gsub!(/\\b(#{small_re})\\b/io) { |w| w.downcase }\n\n # If the first word in the title is a small word, then capitalize it:\n s.gsub!(/\\A([[:punct:]]*)(#{small_re})\\b/io) { |w| $1 + $2.capitalize }\n\n # If the last word in the title is a small word, then capitalize it:\n s.gsub!(/\\b(#{small_re})([[:punct:]]*)\\Z/io) { |w| $1.capitalize + $2 }\n\n # Append current substring to output\n result += s\n end #each\n\n # Special Cases:\n upcase_re = (Array(Duffy.configuration.upcase_custom) + Array(Duffy.configuration.upcase_default)).uniq.join(\"|\")\n\n # Names with apostrophes; O'Brian, De'Wayne. 3+ Skips \"I've\" \"Haven't\" etc.\n result.gsub!(/([A-Z][a-z]*)'([a-z]{3,})/) { \"#{$1}'#{$2.capitalize}\" }\n\n result.gsub!(/ V(s?)\\. /, ' v\\1. ') # \"v.\" and \"vs.\"\n\n result.gsub!(/([''])S\\b/, '\\1s') # 'S (otherwise you get \"the SEC'S decision\")\n\n result.gsub!(/\\b(#{upcase_re})\\b/i) { |w| w.upcase } unless upcase_re.blank?\n\n # Squash repeated whitespace characters\n result.gsub!(/\\s+/, ' ')\n\n # Strip leading / tailing whitespace and return\n result.strip\n end", "def title\n Sanitize.clean(name).strip\n end", "def transform_control_title (title)\n title.gsub(/^\\(L1\\) /, '').gsub(/[()',.&:]/, '').gsub(/.scr/, '').gsub(/\\s+/, '_').gsub(/[\\\\%-]/, '_').gsub(/_+/,'_').downcase\nend", "def title\n @basename.wikify\n end", "def titlecase_title\n self.title = self.title.titlecase\n end", "def titleize\n self.underscore.humanize.gsub(/\\b(?<!['’`])[a-z]/) { $&.capitalize }\n end", "def name\n self.title.downcase.split(' ').join(\"_\")\n end", "def titleize_a_string(string)\nend", "def titleize_a_string(string)\nend", "def titleize(word)\n humanize(underscore(word)).gsub(/\\b('?[a-z])/){ $1.capitalize }\n end", "def titlecase\n\t\tsplit(/(\\W)/).map(&:capitalize).join\n\tend", "def titlecase_title\n self.title=(title().titlecase())\n end", "def regulate_title\n self.title = self.title.strip\n self.title.downcase!\n end", "def title_tag(slides = nil)\n controller, desy = controller_path, SETTINGS['application_name']\n return t('captions.titles.admin', :desy => desy) if controller.start_with? 'admin/'\n case controller\n when 'documents'\n t('captions.titles.documents', :desy => desy)\n when 'lessons', 'lesson_editor'\n t('captions.titles.lessons', :desy => desy)\n when 'audio_editor', 'image_editor', 'video_editor', 'media_elements'\n t('captions.titles.media_elements', :desy => desy)\n when 'users'\n t('captions.titles.profile', :desy => desy)\n when 'virtual_classroom'\n t('captions.titles.virtual_classroom', :desy => desy)\n when 'lesson_viewer', 'lesson_export'\n case action_name\n when 'index', 'archive'\n t('captions.titles.single_lesson', :desy => desy, :lesson => slides.first.lesson.title)\n else\n t('captions.titles.virtual_classroom', :desy => desy)\n end\n else\n t('captions.titles.default', :desy => desy)\n end\n end", "def to_title(file_slug)\n file_slug.gsub(/[^\\p{Word}+]/u, ' ').gsub(/\\b\\w/){$&.upcase}\n end", "def titlecase\n title_case = []\n # titleize first word in title separately \n #(might contain exception words)\n title_case.push titleize_word @title.split[0], true \n\n @title.split.drop(1).each do |word|\n title_case.push titleize_word(word)\n end \n\n title_case.join(\" \")\n end", "def titleize str\n\t\treturn str\n\tend", "def first( )\n\t\t@title[/[A-Za-z0-9]/].downcase\n\tend", "def replace_prefix(title)\n\t\ttitle =title.gsub(\"til that\",\"\")\n\t\ttitle =title.gsub(\"til of\", \"\")\n\t title =title.gsub(\"til\",\"\")\n\t title =title.gsub(\"til,\",\"\")\n\t title = title.strip.capitalize\n\tend", "def shout (maj)\n maj.upcase\nend", "def title_folded_to_filename\n self[:title].gsub(/[^a-z0-9-]/) do |c|\n case c\n when /\\s+|\\./ then '-'\n when /[A-Z]+/ then c.downcase\n else ''\n end\n end.gsub(/\\-+/,'-')\n end", "def titleize(title) \r\n title.en.titlecase\r\nend", "def titlecase\n gsub(/\\b\\w/){ $`[-1,1] == \"'\" ? $& : $&.upcase }\n end", "def nice_name\n name.gsub(/\\..+/, '').wikify\n end", "def capitalize!() end", "def title\n return @gallery.gsub(/[_]+/, ' ').capitalize\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def titleize\n MotionSupport::Inflector.titleize(self)\n end", "def titlecase(input)\n Octopress::Utils.titlecase!(input)\n end", "def proper_name(name)\n return name if name =~ /[[:upper:]]/\n\n name.gsub(/\\b[[:alpha:]]+/) { |w| w =~ PARTICLE_REGEX ? w : w.capitalize }\n end", "def titleize(word)\n humanize(underscore(word)).gsub(/\\b('?[a-z])/) { $1.capitalize }\n end", "def titleize(word)\n humanize(underscore(word)).gsub(/\\b('?[a-z])/) { $1.capitalize }\n end", "def title\n name.demodulize.titleize\n end", "def display_name\n title.present? && title || _('Untitled')\n end", "def short_name \r\n name.gsub(/([A-Z])[^A-Z]+/, '\\1')\r\n end", "def titlecase(input)\n input.titlecase\n end", "def title_name; end", "def titleize\n arr = %w(a an the by to)\n upcase_arr = %w(DX EDA AEDG LPD COP)\n r = gsub('_', ' ').gsub(/\\w+/) do |match|\n match_result = match\n if upcase_arr.include?(match.upcase)\n match_result = upcase_arr[upcase_arr.index(match.upcase)]\n elsif arr.include?(match)\n match_result = match\n else\n match_result = match.capitalize\n end\n match_result\n end\n\n r\n end", "def gen_title(page_title)\n puts @me.valid_user?\n if !@me.valid_user?\n site_title=\"Delta Kappa Epsilon - Sigma Tau\"\n else\n site_title=\"DKE Server\"\n end\n if (page_title!=\"\")\n return \"#{site_title} | #{page_title}\" \n else\n return site_title\n end\n end", "def title\n #Flip off the part after the last dot, including that dot: find the filename without extensions\n fragments = @filename.split('.')\n fragments.pop\n title = fragments.join('.')\n\n return title.gsub(/[_]/, ' ').capitalize\n end", "def title_of(post_name)\n post_name[9..-1].gsub('_',' ').titleize\n end", "def title\n CGI::unescape(self.file_name).gsub(/\\.\\w+$/, '').titleize\n end", "def shortname\n name.downcase.gsub(/[^a-z]/, \"\")\n end", "def get_base_name( title_sym = :receipt )\n get_title_names( title_sym ).join(\"_\").gsub(/[òàèùçé^!\"'£$%&?.,;:§°<>]/,'').gsub(/[\\s|]/,'_').gsub(/[\\\\\\/=]/,'-')\n end", "def title\n base_title = \"StkUp - Simple, Purposeful Comparisons\"\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end", "def indefinite_personal_subjective_pronoun\n return \"it\"\n end", "def titleize(title)\n\ttitle_split = title.split(\" \")\n\ttitle_split.map do |word|\n\t\tif word == \"over\"\n\t\t\t#word = word\n\t\t\treturn word\n\t\telsif word == \"and\"\n\t\t\t#word = word\n\t\t\treturn word\n\t\telsif word == \"the\" && title_split[0] != word\n\t\t\t#word = word\n\t\t\treturn word\n\t\telse\n\t\t\treturn word.capitalize\n\t\tend\n\tend\nend", "def shout (s)\n s.upcase\nend", "def cleanTitle(str)\n str.nil? and return str\n r = Sanitize.clean(str).strip\n str.empty? and return str\n r = (r[0].match(/[^\\w]/)) ? r[1..-1].strip : r\n r.sub(/^(The|A|An) /i, '').capitalize\nend", "def human_from_name; end", "def human_name\n Helpers.underscore(@name)\n end", "def full_title(page_title)\n\t\tbase_title=\"StemLoops\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title+\" | \"+page_title\n\t\tend\n\tend", "def titleize(s)\n\ttitle = s.capitalize\n\ttitle = title.split.map {|x| ((x != \"the\") && (x != \"and\") && (x != \"over\")) ?\n\t\t\tx.capitalize : x}.join(\" \")\nend", "def senpai_title\n \"Senpai\" if grade.senpai?\n end", "def titleize\n # TODO\n # Inflector.titleize(self)\n end", "def file_title(title)\n title.downcase.gsub(/\\s+/, '-').gsub(/-{2,}/, '-').gsub(':', '')\nend", "def basename_to_title(basename)\n basename.gsub(/[\\-_]/, \" \").capitalize\n end", "def full_title(page_title)\n base_title = \"Scirate\"\n if page_title.empty?\n base_title\n else\n sanitize(\"#{base_title} | #{page_title}\")\n end\n end", "def snake_case(name); end", "def humanize\n\t\tself.gsub('_',' ').titlecase\n\tend", "def title_for_search\n (title || \"\").strip.sub(/\\Athe\\s+/i, \"\").sub(/\\Aan?\\s+/i, \"\")\n end", "def suggest_def_name(how)\n how.gsub!(/_+/,'_') # double underscores to one\n how.gsub!(/^_/, '') # if it begins with undrscore kill it.\n how.gsub!(/\\s+/, '_') # kill spaces if for some strange reason exist\n how = how[0,1].downcase << how[1,how.size] #downcase firs char\n end", "def name() title; end", "def name() title; end", "def titleize(name)\n lowercase_words = %w{a an the and but or for nor of over}\n name.split.each_with_index.map{|x, index| lowercase_words.include?(x) && index > 0 ? x : x.capitalize }.join(\" \")\nend", "def titleify(t)\n t = t.tr('_', ' ')\n t = t.lstrip\n t = t.split.map(&:capitalize).join(' ')\nend", "def pretty_title!\n str = self\n str.downcase!\n str = str.split(\" \").map { |word| word.capitalize! }.join(\" \")\n str.gsub! /\\sVs/, ' vs'\n str.gsub! /\\sMd/, ' MD'\n str.gsub! /\\sVersus/, ' versus'\n str.gsub! /\\sLlc/, ' LLC'\n str.gsub! /\\sPc/, ' PC'\n str.gsub! /\\sPa/, ' PA'\n\n # I can't get this to work.. I want Mcfoo to be McFoo but for some reason this wont work -- it does work in rails console\n #str.gsub! /(\\sMc)(.)/, \"#{$1}#{$2.upcase}\"\n str\n end", "def unmiga_name\n gsub(/_(str|sp|subsp|pv)__/,\"_\\\\1._\").tr('_', ' ')\n end", "def titleize_wow(name)\n lowercase_words = %w{a an the and but or for nor of}\n name.split.each_with_index.map{|x, index| lowercase_words.include?(x) && index > 0 ? x : x.capitalize }.join(\" \")\nend", "def name; (page.title rescue ''); end", "def name; (page.title rescue ''); end", "def say_goodnight(name)\r\n \"Dobranoc #{ name.capitalize }\"\r\nend", "def display_title\n \"**#{title}**\"\n end", "def titleize(object)\n object.to_s.split('_').each{ |word| word.capitalize! }.join(' ')\n end", "def to_title(file_slug)\n if file_slug == 'index' && !@pointer['id'].index('/').nil?\n file_slug = @pointer['id'].split('/')[-2]\n end\n\n file_slug.gsub(/[^\\p{Word}+]/u, ' ').gsub(/\\b\\w/){$&.upcase}\n end", "def titleize(word)\n Geode::FastInflector.titleize(word)\n end", "def display_name\n titre\n end", "def title\n @tagline unless name?\n end", "def titleize(s)\n#Nous créons un tableau avec tous les petits mots “end” ‘and’ ‘the’\nl_w = %w(end and the)\n\n#On met en majuscule chaque première lettre des mots entrées\nreturn s.capitalize.gsub(/(\\w+)/) do |word|\n#Met en maj les mots qui ne sont pas dans le tableau l_w\n l_w.include?(word) ? word : word.capitalize\n end\n end", "def three_word_name; end", "def titleize(x)\n arr = \"#{x}\".split('_')\n caps = arr.map { |i| i.capitalize }\n caps.join\nend", "def short_title\n title\n end" ]
[ "0.7231389", "0.7142952", "0.7133862", "0.7060653", "0.70403767", "0.7037739", "0.6999924", "0.6961202", "0.6958249", "0.6884209", "0.6880593", "0.6877515", "0.68573695", "0.68573695", "0.6833635", "0.6829837", "0.6824174", "0.6819142", "0.67633533", "0.67549527", "0.6732342", "0.6717107", "0.6715943", "0.67034876", "0.6668198", "0.6668198", "0.66539395", "0.66445726", "0.6640715", "0.6626325", "0.66233176", "0.66228706", "0.6613746", "0.6607841", "0.6597886", "0.6580394", "0.65750843", "0.65656585", "0.65631706", "0.65616196", "0.6533091", "0.65308475", "0.6527518", "0.6522506", "0.6522506", "0.6522506", "0.6522047", "0.6521176", "0.65182894", "0.6508025", "0.6508025", "0.65053606", "0.6499366", "0.6493634", "0.6492189", "0.6489906", "0.6485301", "0.64762974", "0.6471003", "0.64681375", "0.6466346", "0.6465562", "0.6453586", "0.64497155", "0.6443021", "0.6442911", "0.6430596", "0.64294434", "0.6429036", "0.64287925", "0.64208305", "0.6420067", "0.64172447", "0.6407375", "0.6402117", "0.64005554", "0.63910824", "0.6388499", "0.6379536", "0.6375428", "0.63745785", "0.63737595", "0.63737595", "0.6370826", "0.6370684", "0.6365068", "0.63585514", "0.63550645", "0.6342943", "0.6342943", "0.6342117", "0.6341036", "0.63362056", "0.633414", "0.6331667", "0.63270193", "0.6325594", "0.6325045", "0.6322361", "0.63217056", "0.6320395" ]
0.0
-1
Returns whole file name and without extension.
def name() unless @repo_addr fn = @@fname bn = @@bname return [fn, bn] else return ['', ''] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end", "def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end", "def get_file_name_without_ext(full_name)\n return File.basename(full_name, File.extname(full_name))\n rescue Exception => exc\n puts exc\n return full_name\n end", "def get_raw_filename (file)\n\t\n\t\t# convert to string\n\t\tfile = get_filename(file)\n\t\t# remove extension\n\t\tfile.sub(get_ext(file), \"\")\n\t\t\n\tend", "def filename_without_extension\n (@filename_without_extension || original_filename_without_extension).to_s\n end", "def file_name\n \"#{@file_name}.#{extension}\"\n end", "def basename_without_extension(file)\n return File::basename(file.to_s, File::extname(file.to_s))\n end", "def base file, ext; return File.basename file, ext end", "def base file, ext; return File.basename file, ext end", "def to_name\n basename.to_s.sub extname, ''\n end", "def basename_without_ext; end", "def basename_of(filename)\n filename.sub(/(\\.[a-z]+)*$/, '')\n end", "def name\n file.partition(base).last.gsub(/[_\\/]/, \" \").strip\n end", "def file_name\n File.basename(file_path)\n end", "def basename_of(filename)\n filename.sub(extension_regex, '')\n end", "def filename_without_extension\n filename.include?('.') ? filename.split('.')[0..-2].join('.') : filename\n end", "def basename\n filename.chomp(extname)\n end", "def extname( fn )\n ::File.extname(fn).tr('.', '')\n end", "def basename(filename)\n value = filename\n known_extensions.each do |str|\n value = value.gsub(/\\.#{str}$/, '')\n end\n value\n end", "def base\n File.basename @filename, extension_with_delimiter\n end", "def get_filename(file)\n File.basename(file)\n end", "def original_filename_without_extension\n @original_filename_without_extension || File.basename(original_filename, original_filename_extension)\n end", "def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end", "def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end", "def file_name\n File.basename @path\n end", "def filename\n return @filename if @filename\n name.downcase.gsub(/\\W/, '_').squeeze('_')\n end", "def ext_of(filename)\n filename =~ /((\\.[a-z]+)*)$/ ? $1 : ''\n end", "def name\n @name ||= File.basename(file).chomp(File.extname(file))\n end", "def basename filename, drop_ext = nil\n if drop_ext\n ::File.basename filename, (drop_ext == true ? (extname filename) : drop_ext)\n else\n ::File.basename filename\n end\n end", "def file_name\n name.underscore\n end", "def extname\n File.extname(filename)\n end", "def basename\n if extension\n basename = filename.split('.')\n basename.pop\n basename.join('.')\n else\n filename\n end\n end", "def basename\n File.basename( fullpath, ext )\n end", "def get_filename (file)\n\t\tif file.is_a? File\n\t\t\tfile = file.path\n\t\tend\n\t\treturn file\n\tend", "def original_filename\n File.basename(@file_path)\n end", "def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end", "def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end", "def short_filename\n return $1 if @filename =~ %r{.*/(.*/[^/]+)$}\n return @filename\n end", "def short_filename\n return $1 if @filename =~ %r{.*/(.*/[^/]+)$}\n return @filename\n end", "def basename\n File.basename(filename)\n end", "def main_name(path)\n File.basename(path).sub(/\\.[^\\.]+$/,'')\n end", "def file_name\n return unless @file\n\n @file.absolute_name\n end", "def basename_without_ext\n @basename_without_ext ||= File.basename(path, \".*\")\n end", "def file_name\n if file.original_name.starts_with?('http')\n file.original_name.match(/[^\\/]+$/)[0]\n else\n file.original_name\n end\n end", "def file_ext\n File.extname(@file_name).downcase\n end", "def name\n file.basename('.rb').to_s if file\n end", "def name\n file.basename('.rb').to_s if file\n end", "def chop_extension filename\n filename.sub %r{\\.\\w+$}, \"\"\n end", "def filename\n File.basename( fullpath )\n end", "def name\n @name ||= filename.split(\".\").first.sub(/^_/, \"\")\n end", "def basename( fn )\n ::File.basename(fn, '.*')\n end", "def filename\n \"#{secure_token(10)+File.extname(original_filename)}\" if original_filename.present?\n end", "def filename\n File.basename(path)\n end", "def filename\n @file.basename.to_s\n end", "def basename(file)\n File.basename(file, \".*\")\n end", "def file_name\n \"/\" + current_file.path.split('/').pop\n end", "def extname() File.extname(path) end", "def name\n ::File.basename(path)\n end", "def get_basename(file_path)\n File.basename file_path\n end", "def filename\n [Digest::SHA1.hexdigest(file.read),file.extension].join('.') if original_filename\n end", "def base_name\n File.basename(file_name)\n end", "def output_filename_without_extension\n File.basename @output_path_without_extension\n end", "def extension\n filename = File.extname(self.filename.to_s)\n filename[0] = '' # remove the dot, i.e. (.docx or .pptx)\n filename\n end", "def extname() File.extname(@path) end", "def file_extension\n filename.split(\".\").last\n end", "def extension_with_delimiter\n File.extname @filename\n end", "def file_suffix\n file_name.split('.').last \n end", "def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \n end", "def file_name_from_path(path)\n path.split(\"/\")[-1]\n end", "def basename(file_path)\n filename = File.basename(file_path)\n return filename.split('.')[0].to_sym if file_path\n end", "def omitExt(file)\n b = File.basename(file,\".h\")\n filename = File.basename(b, \".m\")\n return filename\nend", "def file_title(path)\n filename_from_path(path).split(\".\")[0]\n end", "def name_without_extension\n tmp = name\n i = tmp.index('.')\n i ? tmp[0...i] : tmp\n end", "def filename\n \"#{secure_token(10)}.#{file.extension}\" if original_filename.present?\n end", "def extension\n filename = File.extname(self.filename.to_s)\n filename[0] = '' # remove the dot, i.e. (.docx or .pptx)\n filename\n end", "def no_ext(path)\n File.basename(path, \".rb\")\n end", "def filename(file)\n name = if file.respond_to?(:original_filename)\n file.original_filename\n else\n File.basename(file)\n end\n Pathname.normalize_filename(name)\n end", "def basename\n File.basename(@path, '.*')\n end", "def file_name\n # file = full_name\n # file = file.gsub('::', '/')\n # file = file.gsub('#' , '/')\n # file = file.gsub('.' , '-')\n # #file = File.join(output, file + '.html')\n # file\n WebRI.entry_to_path(full_name)\n end", "def ext_of(filename)\n filename =~ extension_regex ? $2 : ''\n end", "def file_name(name)\r\n return name.to_s.downcase + '.rb' if name.kind_of?(Symbol)\r\n return ext_name(name).downcase + '.rb'\r\n end", "def file_name\n potential_name = params[:filename] || file.original_name || (asset.respond_to?(:label) && asset.label) || file.id\n potential_name = potential_name.gsub(/[,;]/, '')\n potential_extension = ''\n if file.mime_type == 'image/png'\n potential_extension = '.png'\n elsif file.mime_type == 'image/tiff'\n potential_extension = '.png'\n elsif file.mime_type == 'image/jpeg' || file.mime_type == 'image/jpg'\n potential_extension = '.jpg'\n end\n return potential_name\n #return potential_name + potential_extension\n end", "def file_ext(filename)\n File.extname( filename ).gsub(\".\", \"\") rescue nil\n end", "def ext\n File.extname( fullpath )\n end", "def file_name(name)\n name.to_s.gsub(/-/, \"_\").underscore\n end", "def getFileExt(file_name)\n \text = file_name.split('.')\n \tif(ext.length > 1)\n \t\tf_ext = ext[ext.length - 1]\n\t\t\n \t\tif(f_ext)\n \t\t\treturn f_ext\n \t\tend\n \tend\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def extension\n begin\n @file_data.original_filename.split(\".\").last\n rescue\n @file_data.path.split(\".\").last\n end\n end", "def name\n File.basename(@path)\n end", "def name\n File.basename(@path)\n end", "def name\n File.basename(@path)\n end", "def extension\n filename =~ /\\./ ? filename.split('.').last : nil\n end", "def name()\n basename.to_s\n end", "def name\n File.basename(path)\n end", "def _output_filename(file)\n sub_strings = File.basename(file).split('.')\n base_name, extensions = sub_strings.first, sub_strings[1..-1]\n\n if extensions.last == 'haml'\n extensions.pop\n if extensions.empty?\n [base_name, options[:default_ext]].join('.')\n else\n [base_name, extensions].flatten.join('.')\n end\n else\n [base_name, extensions, options[:default_ext]].flatten.compact.join('.')\n end\n end", "def basename(fn)\n split_filename(fn).last\n end", "def file_name\n @file_name ||= File.basename tree\n end", "def basename_without_ext\n if not @basename_without_ext\n @basename_without_ext = File.basename(path, '.*')\n if not @is_default_language\n @basename_without_ext ['.' + @language] = ''\n end\n end\n @basename_without_ext\n end", "def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend" ]
[ "0.827731", "0.827731", "0.8152603", "0.8113025", "0.80447334", "0.8028507", "0.79462236", "0.78709334", "0.78709334", "0.7857307", "0.78541654", "0.78443754", "0.78128636", "0.78098804", "0.7794699", "0.7776142", "0.7771309", "0.7770821", "0.7714301", "0.7704968", "0.76999164", "0.76915276", "0.76821905", "0.76821905", "0.7656357", "0.7655245", "0.75475496", "0.754302", "0.7540391", "0.75358504", "0.7505219", "0.74997324", "0.74686813", "0.7462826", "0.74535054", "0.74471325", "0.74471325", "0.7444839", "0.7444839", "0.74344486", "0.7414371", "0.7408517", "0.7403829", "0.74024296", "0.73983467", "0.7393672", "0.7393672", "0.73916334", "0.739059", "0.7385926", "0.7372947", "0.73697037", "0.7364119", "0.7351062", "0.733483", "0.73035586", "0.7302198", "0.7298536", "0.7292777", "0.7291681", "0.72886294", "0.72845125", "0.72833633", "0.7277506", "0.7272496", "0.7265707", "0.72625214", "0.72585607", "0.7256285", "0.7233077", "0.7227244", "0.72156054", "0.7212647", "0.7212217", "0.72075856", "0.7202402", "0.7195378", "0.7192942", "0.71698374", "0.71659255", "0.716177", "0.71581256", "0.7151325", "0.7144947", "0.71433854", "0.7139449", "0.7137392", "0.7137392", "0.7137392", "0.7136795", "0.7119923", "0.7119923", "0.7119923", "0.71168685", "0.7114542", "0.71132714", "0.71121037", "0.71039796", "0.70882225", "0.70584834", "0.705718" ]
0.0
-1
Ruby, S. and Thomas, D., 2009. Agile web development with rails. Raleigh, NC: Pragmatic Bookshelf.
def add_chocolate_bar(chocolate_bar) current_item = line_items.find_by(chocolate_bar_id: chocolate_bar.id) if current_item current_item.quantity += 1 else current_item = line_items.build(chocolate_bar_id: chocolate_bar.id) end current_item end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_rails\n puts \"created Rails biblebook\"\n p = Biblebook.new\n p.title = \"Ruby on Rails\"\n p.author = \"Rails Community\"\n p.published_at = Date.new 2012, 12, 31\n p.intro = \"Rails is a super *web application* framework\"\n load_rails_md p\n p.save!\nend", "def main\n puts 'Ruby bootstrap...'\n puts 'Check sqlite3'\n if system('sqlite3 --version')\n puts 'Ok'\n else\n puts 'Ko: sqlite3 is required'\n puts 'https://guides.rubyonrails.org/getting_started.html'\n exit 1\n end\n\n puts 'Update Ruby gem manager'\n system('gem update --system')\n\n puts 'Install bundler'\n system('gem install bundler')\n\n puts 'Install rails'\n system('gem install rails')\n system('rails --version')\nend", "def name\n\t\"Berkshelf\"\n end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app\n Rubies\n end", "def load_rails\n puts \"created Rails post\"\n p = Post.new\n p.title = \"Ruby on Rails\"\n p.author = \"Rails Community\"\n p.published_at = Date.new 2012, 12, 31\n p.intro = \"Rails is a super *web application* framework\"\n load_rails_md p\n p.save!\nend", "def generate_rails!\n #make sure we're on the bleeding edge before generating\n system(\"cd vendor/rails_versions/edge && git pull\") if self.rails_version == 'edge'\n system(\"cd ../ && ruby #{Dir.pwd}/#{rails_generate_path} #{self.underscored_name}\")\n end", "def app_generators; end", "def create_app()\n file=File.open(\"app.rb\", \"w\")\n file.puts(\"require 'bundler'\")\n file.puts(\"Bundler.require\")\n file.puts(\"\")\n file.puts(\"require_relative 'lib/...'\")\n file.close\n create_readme()\nend", "def app; @app; end", "def make_and_model; end", "def appraisals; end", "def appraisals; end", "def app\n App\nend", "def app\n MyApp.new\nend", "def scaffold\n # Generate models\n generate(\"frontier_model\", ARGV[0])\n\n unless model.skip_ui?\n # Generate controllers\n generate(\"frontier_controller\", ARGV[0])\n\n # Generate views\n generate(\"frontier_crud_views\", ARGV[0])\n\n # Generate policies\n generate(\"frontier_policy\", ARGV[0])\n\n # Generate routes\n generate(\"frontier_route\", ARGV[0])\n end\n\n # Version 2\n #\n # 1. Add in model validations\n # 2. Searching (nominate searchable fields. Support strings, booleans, and enums out of the box)\n # 3. Export as CSV (Have a default CSVExport object that accepts some symbols of keys and exports)\n # This will probably require two steps - 1. Choose fields to export, 2. Export those as CSV\n end", "def manifest\n record do |m|\n # # Check for class naming collisions.\n # m.class_collisions controller_class_path, \"#{controller_class_name}Controller\", \"#{controller_class_name}ControllerTest\", \"#{controller_class_name}Helper\"\n\n # Controller, helper, views, and test directories.\n\n # Model, controller, helper, views, and test directories.\n m.directory File.join('app/models', class_path)\n m.directory File.join('test/unit', class_path)\n # I use factories\n # m.directory File.join('test/fixtures', class_path)\n m.directory File.join('app/controllers', controller_class_path)\n m.directory File.join('app/helpers', controller_class_path)\n m.directory File.join('app/views', controller_class_path, controller_file_name)\n m.directory File.join('app/views/layouts', controller_class_path)\n m.directory File.join('test/functional', controller_class_path)\n\n # Unit test, and fixtures.\n # m.template 'unit_test.rb', File.join('test/unit', \"#{singular_name}_test.rb\")\n # I use factories\n # m.template 'fixtures.yml', File.join('test/fixtures', \"#{singular_name}.yml\")\n\n m.complex_template 'model.rb',\n File.join('app/models', \"#{singular_name}.rb\"),\n :insert => 'model_scaffolding.rhtml',\n :sandbox => lambda { create_sandbox }\n\n m.complex_template('form.rhtml',\n File.join('app/views',\n controller_class_path,\n controller_file_name,\n '_form.rhtml'),\n :insert => 'form_scaffolding.rhtml',\n :sandbox => lambda { create_sandbox },\n :begin_mark => 'form',\n :end_mark => 'eoform',\n :mark_id => singular_name) if less_dry_partial?\n\n m.complex_template('show.rhtml',\n File.join('app/views',\n controller_class_path,\n controller_file_name,\n '_show.rhtml'),\n :insert => 'show_scaffolding.rhtml',\n :sandbox => lambda { create_sandbox },\n :begin_mark => 'show',\n :end_mark => 'eoshow',\n :mark_id => singular_name) if less_dry_partial?\n\n # Controller class, functional test, helper, and views.\n # m.template('functional_test.rb', File.join('test/functional', controller_class_path, \"#{controller_file_name}_controller_test.rb\"))\n controller_template_name = 'controller_methods.rb'\n m.complex_template controller_template_name,\n File.join('app/controllers',\n controller_class_path,\n \"#{controller_file_name}_controller.rb\"),\n :insert => 'controller_scaffolding.rhtml',\n :sandbox => lambda { create_sandbox }\n m.template 'helper.rb',\n File.join('app/helpers',\n controller_class_path,\n \"#{controller_file_name}_helper.rb\") \n\n end\n end", "def make; end", "def weber; end", "def app\n @app || make_app\nend", "def create_rails3_app rails_version, arel_version = nil\n app = app_path rails_version\n clone AREL_REPO, AREL_CLONE_PATH\n FileUtils.cd AREL_CLONE_PATH do\n if arel_version\n run 'git', 'reset', '--hard', \"v#{arel_version}\"\n else # \"Edge\"\n run 'git', 'reset', '--hard', 'origin/master'\n end\n run 'git', 'clean', '-f'\n end\n\n clone RAILS_REPO, RAILS_CLONE_PATH\n FileUtils.cd RAILS_CLONE_PATH do\n if rails_version\n run 'git', 'reset', '--hard', \"v#{rails_version}\"\n else # \"Edge\"\n run 'git', 'reset', '--hard', 'origin/master'\n end\n run 'git', 'clean', '-f'\n\n begin\n clean_bundler_environment\n run 'env', \"AREL=#{AREL_CLONE_PATH}\",\n 'bundle', 'install', '--path', '../bundle', '--without', 'db'\n FileUtils.rm_r(app) if File.exist?(app)\n run 'env', \"AREL=#{AREL_CLONE_PATH}\",\n 'bundle', 'exec', 'bin/rails', 'new', app, '--skip-activerecord', '--dev'\n ensure\n restore_bundler_environment\n end\n end\n\n create_gemfile app\n bundlerize app\n end", "def install\n # Switch this to use Module#prepend at some point when I stop caring about Ruby 1.9.\n ::Berkshelf::Berksfile.class_exec do\n old_sources = instance_method(:sources)\n define_method(:sources) do\n original_sources = begin\n old_sources.bind(self).call\n rescue ::Berkshelf::NoAPISourcesDefined\n # We don't care, there will be a source\n []\n end\n # Make sure we never add two halite sources.\n original_sources.reject {|s| s.is_a?(::Halite::Berkshelf::Source) } + [::Halite::Berkshelf::Source.new(self)]\n end\n end\n\n # Inject support for the :halite location type\n ::Berkshelf::Downloader.class_exec do\n old_try_download = instance_method(:try_download)\n define_method(:try_download) do |source, name, version|\n remote_cookbook = source.cookbook(name, version)\n if remote_cookbook && remote_cookbook.location_type == :halite\n tmp_dir = Dir.mktmpdir\n Halite.convert(remote_cookbook.location_path, tmp_dir)\n tmp_dir\n else\n old_try_download.bind(self).call(source, name, version)\n end\n end\n end\n\n end", "def standalone; end", "def ordered_railties; end", "def ordered_railties; end", "def rails_app\n # TODO: Return a `String` with the right command to create a new rails app called `watch-list`.\nend", "def prerequisites\n\tKitchenplan::Application.fatal! \"Don't run this as root!\" if running_as_superuser?\n\tKitchenplan::Log.warn \"Platform version too low. Your version: #{self.version}\" unless version_supported?\n\tinstall_bundler\n\t# needed for proper librarian usage\n\tinstall_git\n\tkitchenplan_bundle_install\n end", "def addNewShelf()\n Shelf.new(self)\n end", "def pre_install; end", "def app\n BranchApp.new\nend", "def index\n @title = \"Welcome to Ramaze and Heroku!\"\n\n # Get all of the books from the Book model and order them\n # in alphabetical order.\n @books = Book.select.order(:title).all\n end", "def ruby_engine; end", "def ruby_engine; end", "def how_it_works\r\n end", "def rake\n app.init 'webby'\n app.load_rakefile\n load_command_line_options\n app.top_level\n end", "def create_new_app\n rake 'install --trace'\n FileUtils.rm_rf(rails_app)\n sh \"relevance_rails new #{rails_app} --database=#{database} --relevance-dev\"\n end", "def docs = require_relative 'scaffold/docs'", "def keppler\n end", "def appFX\n appEM.app\nend", "def create_objects\n# Create a new \"Mash\" object and assign it to \"awesome\"\n awesome Mash.new\n end", "def initialize(app); end", "def book\n fetch('harry_potter.books')\n end", "def init\n clone_appd_cookbook\n chef_gem \"install berkshelf\"\n end", "def app\n self\n end", "def app\n self\n end", "def enshelf \n a_to_g = ('a'..'g').to_a\n \th_to_p = ('h'..'p').to_a\n\t\tif (a_to_g.include?(self.get_title[0].downcase))\n\t\t @library.get_shelves[0].add_book (self)\n\t\telsif (h_to_p.include?(self.get_title[0].downcase))\n\t\t @library.get_shelves[1].add_book (self)\n\t\telse \n\t\t @library.get_shelves[2].add_book (self)\n\t\tend\n \n\tend", "def start_app\nend", "def angular_scaffold\n object = get_stdin(\"What is the Object name to scaffold? \")\n puts \"Describe your structure like a model generation :\\nnom:string description:text prix:decimal rdv:date validation:boolean heure:time creation:datetime\"\n parameters = get_stdin(\"What's the structure of the object? \")\n system \"rails generate angular_scaffold #{object} #{parameters}\"\nend", "def rails(*args, &block)\n self.class.rails(*args, &block)\n end", "def setup_db\n #Supress annoying Schema creation output when tests run\n old_stdout = $stdout\n $stdout = StringIO.new\n \n ActiveRecord::Schema.define(:version => 1) do\n create_table :people do |t|\n t.column :username, :string\n t.column :hair_color, :string\n end\n \n create_table :coffee_mugs do |t|\n t.column :person_id, :integer\n end\n \n create_table :roles do |t|\n t.column :name, :string\n end\n \n create_table :people_roles do |t|\n t.column :role_id, :integer\n t.column :person_id, :integer\n end\n \n create_table :notebooks do |t|\n t.column :title, :string\n t.column :owner_id, :integer\n t.column :ghost_writer_id, :integer\n end\n \n create_table :update_permissions do |t|\n t.column :updater_id, :integer\n t.column :notebook_id, :integer\n end\n \n create_table :pages do |t|\n t.column :number, :integer\n t.column :notebook_id, :integer\n end\n \n create_table :margin_notes do |t|\n t.column :content, :string\n t.column :page_id, :integer\n end\n \n create_table :coffee_stains do |t|\n t.column :opacity, :integer\n t.column :page_id, :integer\n end\n \n create_table :words do |t|\n t.column :text, :string\n t.column :page_id, :integer\n end\n end\n \n #Re-enable stdout\n $stdout = old_stdout\nend", "def basic_setup\n # Change ApplicationRecord's inheritence\n gsub_file 'app/models/application_record.rb', 'class ApplicationRecord < ActiveRecord::Base', 'class ApplicationRecord < Kablam::KablamRecord'\n\n # Setup Initializer\n template \"kablam.rb\", \"config/initializers/kablam.rb\"\n copy_file \"_sample_target_item.html.erb\", \"app/views/kablam/models/_sample_target_item.html.erb\"\n end", "def db; end", "def db; end", "def app_root; end", "def build_model\n \n return if skip_method(__method__)\n\n filename = singular_table_name + '.rb'\n \n template = File.read(template(\"rails/model.erb\"))\n text = Erubis::Eruby.new(template).evaluate( self )\n\n path = File.join(\"app\",\"models\",filename) \n puts \"build Rails model for #{model_name} in #{path}\"\n write_artifact(path,text)\n\n end", "def home\n # Insert ruby code...\n end", "def scientist; end", "def list\n recipes = @cookbook.all\n # byebug\n @view.display_recipes(recipes)\n end", "def appDB\n appEM.db\nend", "def index\n \n breadcrumbs.add 'MY SHELVES'\n \n @shelves = BookList.find_all_by_user_id(current_user.id)\n if(@shelves.size > 0)\n @shelf0 = ListItem.find_all_by_book_list_id(@shelves[0].id).paginate(:page=>1, :per_page => 3)\n else\n @shelf0 = []\n end\n if(@shelves.size > 1)\n @shelf1 = ListItem.find_all_by_book_list_id(@shelves[1].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf1 = []\n end\n \n if(@shelves.size > 2) \n @shelf2 = ListItem.find_all_by_book_list_id(@shelves[2].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf2 = []\n end\n if(@shelves.size > 3)\n @shelf3 = ListItem.find_all_by_book_list_id(@shelves[3].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf3 = []\n end\n if(@shelves.size > 4)\n @shelf4 = ListItem.find_all_by_book_list_id(@shelves[4].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf4 = []\n end\n if(@shelves.size > 5)\n @shelf5 = ListItem.find_all_by_book_list_id(@shelves[5].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf5 = []\n end\n if(@shelves.size > 6)\n @shelf6 = ListItem.find_all_by_book_list_id(@shelves[6].id).paginate(:page=>1, :per_page => 3)\n else\n @shelf6 = []\n end\n if(@shelves.size > 7)\n @shelf7 = ListItem.find_all_by_book_list_id(@shelves[7].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf7 = []\n end\n if(@shelves.size > 8)\n @shelf8 = ListItem.find_all_by_book_list_id(@shelves[8].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf8 = []\n end\n end", "def get_development_application(page, da_container)\n\n #Get detail page of da\n\n detail_page = get_da_detail_page(page, da_container)\n\n \n\n #Get da summary\n\n da_summary = get_da_summary(page, da_container, detail_page)\n\n \n\n #Create a record that includes da_summary and detail_page to save to the database\n\n record = da_summary\n\n record['page_content'] = detail_page.body.to_s.force_encoding('utf-8')\n\n \n\n #Save record to database\n\n save_record_to_database(record)\n\nend", "def get_development_application(page, da_container)\n\n #Get detail page of da\n\n detail_page = get_da_detail_page(page, da_container)\n\n \n\n #Get da summary\n\n da_summary = get_da_summary(page, da_container, detail_page)\n\n \n\n #Create a record that includes da_summary and detail_page to save to the database\n\n record = da_summary\n\n record['page_content'] = detail_page.body.to_s.force_encoding('utf-8')\n\n \n\n #Save record to database\n\n save_record_to_database(record)\n\nend", "def conscientious_require; end", "def bundle()\n puts \"TODO\"\n end", "def install\n \n end", "def kitten\n end", "def meteorite; end", "def gems; end", "def gems; end", "def gems; end", "def add_shelves\r\n\t\tputs \"I understand you want to add a new shelf.\"\r\n\t\tputs \"What is the name of your shelf?\"\r\n\t\tnew_shelf = gets.chomp\r\n\t\tputs \"Alright! I am adding #{new_shelf} to your list of shelves. Is that correct?\"\r\n\t\tif y_or_n\r\n\t\t\tadd_shelf(@db, new_shelf)\r\n\t\t\tputs \"I have added your shelf!\"\r\n\t\tend\r\n\t\tmanage_shelves\r\n\tend", "def generate\n require_relative \"resume/ruby_version_checker\"\n RubyVersionChecker.check_ruby_version\n require_relative \"resume/cli/application\"\n CLI::Application.start\n end", "def before_bootstrap; end", "def app\n \tCollaborator\n end", "def generator\n @app.generator\nend", "def app\n @app ||= LiuLunch\n end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def create_db\n SQLite3::Database.new \"flatiron.db\"\nend", "def developer\n end", "def freeze_rails\n new_version = rails_version_to_freeze\n\n version_file = File.join(install_directory,'vendor','rails-version')\n vendor_rails = File.join(install_directory,'vendor','rails')\n \n old_version = File.read(version_file).chomp rescue nil\n \n if new_version == old_version\n return\n elsif old_version != nil\n rm_rf(vendor_rails)\n end\n\n mkdir_p(vendor_rails)\n \n package_map = {\n 'rails' => File.join(vendor_rails,'railties'),\n 'actionmailer' => File.join(vendor_rails,'actionmailer'),\n 'actionpack' => File.join(vendor_rails,'actionpack'),\n 'actionwebservice' => File.join(vendor_rails,'actionwebservice'),\n 'activerecord' => File.join(vendor_rails,'activerecord'),\n 'activesupport' => File.join(vendor_rails,'activesupport'),\n }\n \n specs = Gem.source_index.find_name('rails',[new_version])\n \n unless specs.to_a.size > 0\n raise InstallFailed, \"Can't locate Rails #{new_version}!\"\n end\n \n copy_gem(specs.first, package_map[specs.first.name])\n \n specs.first.dependencies.each do |dep|\n next unless package_map[dep.name]\n \n dep_spec = Gem.source_index.find_name(dep.name,[dep.version_requirements.to_s])\n if dep_spec.size == 0\n raise InstallFailed, \"Can't locate dependency #{dep.name} #{dep.version_requirements.to_s}\"\n end\n \n copy_gem(dep_spec.first, package_map[dep.name])\n end\n \n File.open(version_file,'w') do |f|\n f.puts @@rails_version\n end\n end", "def prerequisites\n\tKitchenplan::Application.fatal! \"Don't run this as root!\" unless running_as_normaluser?\n\tKitchenplan::Application.fatal! \"#{ENV['USER']} needs to be part of the 'admin' group!\" unless user_is_admin?\n\tKitchenplan::Application.fatal! \"Platform version too low. Your version: #{self.version}\" unless version_supported?\n\tinstall_bundler\n\t# needed for proper librarian usage\n\tinstall_git\n\tkitchenplan_bundle_install\n end", "def prerequisites\n\tKitchenplan::Application.fatal! \"Don't run this as root!\" unless running_as_normaluser?\n\tKitchenplan::Application.fatal! \"#{ENV['USER']} needs to be part of the 'admin' group!\" unless user_is_admin?\n\tKitchenplan::Application.fatal! \"Platform version too low. Your version: #{self.version}\" unless version_supported?\n\tinstall_bundler\n\t# needed for proper librarian usage\n\tinstall_git\n\tkitchenplan_bundle_install\n end", "def welcome\n\tputs \"Welcome to your recipe manager!\"\nend", "def my_hobbies\n\tend", "def app\n @book_slug = params[:book]\n if(params[:s] =~ /\\d+/)\n if @book_slug.present?\n @ref = SongBook\n .joins(:book)\n .where(books: {slug: @book_slug}, index: params[:s])\n .first\n end\n song = Song.find(@ref&.song_id || params[:s])\n if song.present?\n @song_id = song.id\n @preloaded_song = song.app_entry\n @preloaded_current_book = Book.find_by(slug: @book_slug)&.app_entry\n @preloaded_books = song.app_entry(:books)\n @preloaded_references = song.app_entry(:references)\n end\n end\n end", "def to_code\n\t\tprefix = [ \n\t\t\t\"#!/usr/bin/ruby\", \n\t\t\t\"system( \\\"#{self.to_scaffold}\\\")\", \n\t\t\t\"Dir.chdir \\\"#{self.name}\\\"\" \n\t\t]\n\n\t\tself.klasses.reduce( prefix) { |m,klass| \n\t\t\tm << \"system( \\\"#{klass.to_scaffold}\\\")\" << klass_to_file(klass)\n\t\t} << \"rake db:create\" << \"rake db:migrate\"\n\tend", "def include_dsl_modules\n WebBrowser.include_module(:RecommerceDSL)\n WebBrowser.include_module(:CommonFunctions)\n WebBrowser.include_module(:CommonCookieDSL)\n WebBrowser.include_module(:TestHarnessDSL)\n WebBrowser.include_module(:MonitoringDSL)\nend", "def create_database_yml\n return unless File.directory?(\"/app/#{ENV['app_dir']}/config\")\n topic \"Writing config/database.yml to read from DATABASE_URL\"\n File.open(\"/app/#{ENV['app_dir']}/config/database.yml\", \"w\") do |file|\n file.puts <<-DATABASE_YML\n<%\n\nrequire 'cgi'\nrequire 'uri'\n\nbegin\nuri = URI.parse(ENV[\"DATABASE_URL\"])\nrescue URI::InvalidURIError\nraise \"Invalid DATABASE_URL\"\nend\n\nraise \"No RACK_ENV or RAILS_ENV found\" unless ENV[\"RAILS_ENV\"] || ENV[\"RACK_ENV\"]\n\ndef attribute(name, value, force_string = false)\nif value\nvalue_string =\nif force_string\n '\"' + value + '\"'\nelse\n value\nend\n\"\\#{name}: \\#{value_string}\"\nelse\n\"\"\nend\nend\n\nadapter = uri.scheme\nadapter = \"postgresql\" if adapter == \"postgres\"\n\ndatabase = (uri.path || \"\").split(\"/\")[1]\n\nusername = uri.user\npassword = uri.password\n\nhost = uri.host\nport = uri.port\n\nparams = CGI.parse(uri.query || \"\")\n\n%>\n\ntest:\n<%= attribute \"adapter\", adapter %>\n<%= attribute \"database\", database %>\n<%= attribute \"username\", username %>\n<%= attribute \"password\", password, true %>\n<%= attribute \"host\", host %>\n<%= attribute \"port\", port %>\n\n<% params.each do |key, value| %>\n<%= key %>: <%= value.first %>\n<% end %>\n DATABASE_YML\n end\nend", "def generate_html\n html_renderer = Carta::CLI::HTMLRenderer.new(@PROJECT_DIR)\n # puts @MANUSCRIPT_DIR\n book['html'] = html_renderer.manuscript_html\n book['outline'] = html_renderer.outline\n book['epub_toc_html'] = html_renderer.epub_toc_html\n book['html_toc_html'] = html_renderer.html_toc_html\n\n generate_epub_manifest\n end" ]
[ "0.64919496", "0.56565297", "0.563342", "0.56238055", "0.56238055", "0.56238055", "0.56238055", "0.56238055", "0.56238055", "0.56238055", "0.56238055", "0.56238055", "0.56238055", "0.55928266", "0.5405755", "0.5395589", "0.53235054", "0.52686423", "0.5246219", "0.5204262", "0.51884043", "0.51884043", "0.50602764", "0.49841565", "0.4977704", "0.49486956", "0.4940587", "0.49331138", "0.49223387", "0.4910029", "0.4905067", "0.49001223", "0.48588222", "0.48588222", "0.48345104", "0.48177874", "0.4806241", "0.47599527", "0.4751779", "0.47478315", "0.4746969", "0.4746969", "0.47451296", "0.47272742", "0.47108668", "0.46887589", "0.4682492", "0.46799564", "0.46684372", "0.4658201", "0.46528956", "0.46460494", "0.4639901", "0.4639901", "0.46395257", "0.46356285", "0.46349272", "0.46251273", "0.46225634", "0.46166936", "0.4613674", "0.4613674", "0.46124452", "0.46113306", "0.4606593", "0.4605474", "0.4592329", "0.4590102", "0.45857024", "0.45846516", "0.45846516", "0.45838708", "0.4580937", "0.4578486", "0.45765013", "0.4576161", "0.4567302", "0.4567302", "0.4567302", "0.45550686", "0.45527208", "0.45523512", "0.4548703", "0.4548675", "0.45460254", "0.45441586", "0.45441586", "0.45441586", "0.45441586", "0.45416728", "0.45409864", "0.4539869", "0.45388454", "0.45388454", "0.4537016", "0.45331615", "0.45320544", "0.45319363", "0.4527454", "0.4525372", "0.45167875" ]
0.0
-1
Google related helper methods
def google_email(connection) email_array = connection["gd$email"] unless email_array.nil? or email_array.blank? return email_array[0]["address"] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def google\n process_oauth_callback\n end", "def google(query)\n # API key, engine id, and uri to make API call\n key = CSE_API_KEY\n # \"AIzaSyDpp4azZVRsBYgmjAqSI-Z-PIZG8FI-hfw\"\n engine_id = CSE_ENGINE_ID\n # \"011724650152002634172:r-e9bq2ubda\"\n uri = URI(\"https://www.googleapis.com/customsearch/v1?cx=#{engine_id}&q=#{query}&key=#{key}\")\n\n # GET request\n request = Net::HTTP::Get.new(uri)\n\n # Receive response\n res = Net::HTTP.get_response(uri)\n\n # Parse JSON file and converts to hash\n json = JSON.parse(res.body)\n items = json['items']\n\n # Iterate through JSON/items array and print each index\n i = 0\n loop do\n puts (i+1).to_s + \" -- \" + items[i]['title']\n # puts items[i]['link'] # url\n # puts items[i]['snippet'] # snippet of article\n i += 1\n if i == items.length\n break\n end\n end\n end", "def import_profile_from_google\n # forthcoming\n end", "def on_cmd_google(action)\n action.reply @web.google(action.message.sub(/^!google /, ''))\n end", "def getGoogleID(location, dbl)\n return dbl.getgID(\"../Booru/#{location}\")\nrescue NoMethodError\nend", "def search_results\n GoogleSearchResults.instance\n end", "def run\n super\n\n # Attach to the google service & search\n results = Client::Google::SearchService.new.search(@entity.name)\n\n results.each do |result|\n create_entity Entities::Domain, :name => result[:visible_url]\n create_entity Entities::SearchResult, {\n :name => result[:title_no_formatting],\n :url => result[:unescaped_url],\n :content => result[:content]\n }\n end\n\nend", "def google(name: T.unsafe(nil), email: T.unsafe(nil), uid: T.unsafe(nil)); end", "def title_for_google\n google_title.present? ? google_title : name\n end", "def google_package\n return nil\n end", "def google(m, query)\n m.reply(search(query))\n end", "def ext_url\n \"#{GOOGLEAPIS_URL}#{ext_path}\"\n end", "def google_search(query, sitelink)\n s = Google::Search::Web.new\n s.query = \"#{query}\" + \" site:#{sitelink}\"\n s.get_response\n end", "def build_url(input)\n url = \"#{GOOGLE_BOOKS_API_BASE_URL}#{input}\"\n url\nend", "def auth_google\n @attributes[:auth_google]\n end", "def google_oauth2\n youtube_connect\n end", "def get_image_from_google_for(keywords)\n get_link_from_google_for keywords, :image\n rescue Exception\n ''\n end", "def add_google_info(access_token)\n if self.google_id.blank?\n if self.start_time.present? && self.title.present?\n google_event = Google::Event.search_by_date_range(\n access_token,\n self.start_time,\n (self.start_time + 1.minutes),\n self.google_calendar_id\n )\n if !google_event['error'] && items = google_event['data']['items']\n event = items.select{|item| item['title'] == self.title}.first\n if event\n self.details = event['details']\n self.google_id = event['id']\n end\n end\n end\n end\n end", "def run\n super\n\n # Attach to the google search service\n x = Client::Google::SearchService.new\n\n # Use the inurl: capability\n results = x.search \"inurl:.#{@entity.name}\"\n\n results.each do |result|\n # Create a new domain\n o = create_entity Entities::DnsRecord, { :name => result.visible_url, \n :organization => @entity.organization }\n end\n\nend", "def search_get_url(user_input)\n fetch_json_from_url(GOOGLE_API_SEARCH_URL + user_input.to_s)\n end", "def description_for_google\n google_description.present? ? google_description : description\n end", "def create_client_from_outhAccount(scope, oob_uri, user_id, oauth_cred_file)\n #oob_uri = 'urn:ietf:wg:oauth:2.0:oob'\n #user_id = 'eyemole@gmail.com'\n client_id = Google::Auth::ClientId.from_file(oauth_cred_file)\n token_store = Google::Auth::Stores::FileTokenStore.new(:file => 'tokens.yaml')\n authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store)\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: oob_uri )\n #Launchy.open(url)\n puts \"Open this URL in Browser and enter the code you got from browser below\"\n puts \"URL: #{url}\"\n print \"enter the code you got from browser here and press Enter: \"\n # code = gets\n code = STDIN.gets.chomp\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: oob_uri)\n end\n blogger = Google::Apis::BloggerV3::BloggerService.new\n blogger.authorization = credentials\n return blogger\nend", "def verify_self\n self.verify_google_search_input\n end", "def use_google(hash)\n @google_hash = hash\n @google_hash\n end", "def build_google_search_url\n\t'https://www.google.com/search?q='+ARGV.to_a.join('+')\nend", "def run\n super\n\n # Attach to the google service & search\n results = Client::Google::SearchService.new.search(@entity.name)\n\n results.each do |result|\n # Create a domain\n create_entity Entities::DnsRecord, :name => result[:visible_url]\n\n # Create the top-level domain\n create_entity Entities::DnsRecord, :name => result[:visible_url].split(\".\").last(2).join(\".\")\n\n #Handle Twitter search results\n if result[:title_no_formatting] =~ /on Twitter/\n account_name = result[:title_no_formatting].scan(/\\(.*\\)/).first[1..-2]\n create_entity(Entities::TwitterAccount, { :name => account_name,\n :uri => \"http://www.twitter.com/#{account_name}\" })\n \n # Handle Facebook search results\n elsif result[:unescaped_url] =~ /https:\\/\\/www.facebook.com/\n account_name = result[:unescaped_url].scan(/[^\\/]+$/).first\n create_entity(Entities::FacebookAccount, { :name => account_name, \n :uri => \"http://www.facebook.com/#{account_name}\" })\n \n # Handle LinkedIn search results\n elsif result[:unescaped_url] =~ /http:\\/\\/www.linkedin.com\\/in/\n account_name = result[:unescaped_url].scan(/[^\\/]+$/).first\n create_entity(Entities::LinkedinAccount, { :name => account_name,\n :uri => \"http//www.linkedin.com/in/#{account_name}\" })\n # Otherwise, just create a generic search result\n else\n create_entity(Entities::WebPage, {\n :name => result[:title_no_formatting],\n :uri => result[:unescaped_url],\n :content => result[:content]\n })\n end\n end\n\nend", "def getToolsSyndicateGoogle( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/google\",params)\n end", "def google_load_search\n return '' if defined?(@google_load_search_included)\n @google_load_search_included = true\n (google_ajax_api_scripts + '<script type=\"text/javascript\">google.load(\"search\", \"1\");</script>').html_safe\n end", "def getGoogleURL(location)\n url = \"http://maps.googleapis.com/maps/api/geocode/json?address=\"\n city = location[/^([\\w ]+), ([\\w ]+)+$/, 1]\n state = location[/^([\\w ]+), ([\\w ]+)+$/, 2]\n city = city.gsub(' ', '+')\n state_abbrev = STATE_ABBR[state]\n \n # State abbrev is either a US state, or a country (Madrid, Spain)\n state_abbrev ||= state\n state_abbrev = state_abbrev.gsub(' ', '+')\n \n url << city <<',' << state_abbrev << \"&sensor=false\"\n return url\n \n end", "def authenticate_url\n \"https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/urlshortener&response_type=code&client_id=#{ENV['GOOGL_CLIENT_ID']}&redirect_uri=#{ENV['GOOGL_REDIRECT_URI']}&access_type=offline&include_granted_scopes=true&approval_prompt=force\"\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def google?\n ['google_oauth2', 'google'].include?(self.provider)\n end", "def google_typed_search(type, feeds = [], locale = nil)\n content = \"var #{type}Search = new google.search.#{type.capitalize}Search();\\n\"\n if !['video', 'blog'].include?(type)\n if !locale.blank?\n content << \"#{type}Search.setRestriction(google.search.Search.RESTRICT_EXTENDED_ARGS, {lr:'lang_#{locale}'});\\n\"\n end\n end\n if !['video', 'local', 'patent', 'book'].include?(type)\n feeds.each do |feed|\n if !feed.display_uri.blank?\n content << \"#{type}Search.setSiteRestriction('#{feed.display_uri}');\\n\"\n end\n end\n end\n content << \"searchControl.addSearcher(#{type}Search);\\n\".html_safe\n end", "def google(*args)\n W \"TRY google+\", *args unless Rails.env.test?\n\n oauth = args.extract_options!\n expect! oauth => {\n :consumer_key => String,\n :consumer_secret => String,\n :oauth_refresh_token => String,\n :oauth_expires_at => [Integer, nil],\n }\n \n # init Ruby Google API Client - see: https://github.com/google/google-api-ruby-client\n client = Google::APIClient.new(\n :application_name => Bountybase.config.google_app[\"name\"],\n :application_version => \"1.0\"\n )\n\n # basic client authorization init\n client.authorization.client_id = oauth[:consumer_key]\n client.authorization.client_secret = oauth[:consumer_secret]\n client.authorization.refresh_token = oauth[:oauth_refresh_token]\n client.authorization.grant_type = 'refresh_token'\n\n # exchange access token with refresh token since it might be expired\n client.authorization.fetch_access_token! unless Rails.env.test?\n\n client.execute(*args) unless Rails.env.development?\n W \"OK google+\", *args unless Rails.env.test?\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\nend", "def google_listing(client)\n notify \"Run Google Listing..\"\n escaped_path = @fields[:path]\n decoded_path = CGI::unescape(escaped_path)\n # this result is in hash format\n result = client.listing_path(decoded_path)\n return result\n end", "def search_ex_url(ex)\n \"http://www.google.com/search?q=#{URI.escape ex.message}\"\nend", "def google(query)\n url = \"http://www.google.com/search?q=#{CGI.escape(query)}\"\n res = Nokogiri::HTML(open(url)).at(\"h3.r\")\n\n title = res.text\n link = res.at('a')[:href]\n desc = res.at(\"./following::div\").children.first.text \nrescue \n \"No results found\"\nelse\n CGI.unescape_html \"#{title} - #{desc} (#{link})\"\nend", "def google?\n @domain.include?(:Google)\n end", "def url\n \"#{GOOGLE_SEARCH_URL}/cse?#{@custom_params.merge(DEFAULT_PARAMS).merge(:q => query, :cx => @search_engine_id, :sort => @sort).delete_if{|k,v| v.nil?}.to_query}\" \n end", "def google\n google_config = GenericApiRails.config.google_hash\n access_token = params['access_token']\n\n # get the token\n #https://www.googleapis.com/oauth2/v3/token\n code_uri = URI('https://www.googleapis.com/oauth2/v3/token');\n oauth_https = Net::HTTP.new(code_uri.host, code_uri.port)\n oauth_https.use_ssl = true\n\n post_data = {\n :code => access_token,\n :client_id => google_config[:client_id],\n :client_secret => google_config[:client_secret],\n :redirect_uri => access_token['redirect_uri'],\n :grant_type => 'authorization_code'\n }\n\n post_data_string = URI.escape(post_data.collect{|k,v| \"#{k}=#{v}\"}.join('&'))\n code_response = oauth_https.post(code_uri.path, post_data_string)\n\n if code_response.code.to_s != 200.to_s\n render :json => { success: false , error: \"Could not authenticate using Google\" }\n return\n end\n\n auth_response = JSON.parse(code_response.body)\n access_token = auth_response['access_token']\n\n logger.debug(\"INCOMING API TOKEN '#{incoming_api_token.presence}'\")\n render :json => { success: false , error: \"Could not authenticate using Google\" }\n end", "def gs_url\n \"gs://#{self.study.bucket_id}/#{self.bucket_location}\"\n end", "def gs_url\n \"gs://#{self.bucket_id}\"\n end", "def api_key\n Rails.application.secrets.google_geocode_key\n end", "def google_play\n self.in(GooglePlay)\n end", "def googleNewsSearch(name, mins = 720)\n\n type = \"\"\n theRep = Rep.all\n puts \"THE REP! : #{theRep}\"\n if Rep.where(name: name)[0].json.index(\"senate\") != nil\n type = \"Sen\"\n else\n type = \"Rep\"\n end\n\n # fix the name -- so if there is 'ç' or some weird\n # character like that, it turns into 'c'\n name = ActiveSupport::Inflector.transliterate(name)\n query = \"%22#{type} #{name}%22\"\n query.gsub!(\" \", \"%20\")\n\n link = \"https://www.google.com/search?q=#{query}&tbm=nws&tbs=qdr:n#{mins}\"\n file = open(link)\n document = Nokogiri::HTML(file)\n puts document.class\n titles = document.css('h3 > a')\n urls = document.css('h3 > a')\n excerpts = document.css('.st')\n dates = document.css('div.slp > span.f')\n\n\n\n articles = []\n for i in 0..(titles.length - 1)\n article_info = {}\n article_info[\"title\"] = cleanString(titles[i].text)\n article_info['url'] = cleanUrl(urls[i].attr('href'))\n article_info['excerpt'] = cleanString(excerpts[i].text)\n article_info['date'] = cleanDate(dates[i].text)\n articles << article_info\n end\n\n return articles\nend", "def set_search_google\n @search_google = SearchGoogle.find(params[:id])\n end", "def google?\n provider_name == 'Google'\n end", "def description\n \"This task hits the Google API and finds related content. Discovered domains are created.\"\nend", "def description\n \"This task hits the Google API and finds related content. Discovered domains are created.\"\nend", "def google_client\n @google_client ||= (::Google::Auth.get_application_default rescue nil) || google_oauth\n end", "def googleplus_url; \"https://plus.google.com/#{googleplus}\" end", "def google_data_source\n base_data_sample.merge({data_source: 'Google(testkey)', key: 'testkey'})\nend", "def get_google_img(query)\n img_search_keywords = query.strip.gsub(/\\s+/,'+')\n \n if img_search_keywords != ''\n url = \"http://ajax.googleapis.com/ajax/services/search/images?rsz=large&start=1&v=1.0&q=#{img_search_keywords}\"\n \n json_results = open(url) {|f| f.read };\n results = JSON.parse(json_results)\n image_array = results['responseData']['results']\n image = image_array[0] if image_array\n image = image['tbUrl']\n \n if image\n return image\n else\n return 'no image found'\n end\n end\n end", "def googleSearch(q, n = 5)\n\n\tsearch = Google::Search::Web.new do |search|\n\t search.query = q\n\t search.size = :small\n\tend\n\tbegin\n\t\turis = search.first(n).map(&:uri)\n\trescue\n\t\t\"uri fault\"\n\tend\n\n\treturn uris\nend", "def google_search_response(auto_metareview)\n review_text_arr = auto_metareview.review_array\n # require 'ruby-web-search'\n count = 0\n temp_array = Array.new\n review_text_arr.each{\n |rev_text|\n if(!rev_text.nil?)\n #placing the search text within quotes to search exact match for the complete text\n response = RubyWebSearch::Google.search(:query => \"\\\"\"+ rev_text +\"\\\"\") \n #if the results are greater than 0, then the text has been copied\n if(response.results.length > 0)\n count+=1\n else\n temp_array << rev_text #copying the non-plagiarised text for evaluation\n end\n end\n }\n #setting temp_array as the @review_array\n auto_metareview.review_array = temp_array\n \n if(count > 0)\n return true\n else\n return false\n end\n end", "def description\n \"This task hits the Google API and creates an entity for all discovered subdomains.\"\nend", "def transl8 (input,lang) #method to translate incoming text\n translate = Google::Cloud::Translate.new\n detection = translate.detect input.to_s\n #puts input + \"Looks like you're speak in #{detection.language}\"\n #puts \"Confidence: #{detection.confidence}\"\n #translation = translate.translate \"Hello world!\", to: \"la\"\n translation = translate.translate input.to_s, to: lang.to_s\n return \"In #{lang} that's \" + translation\nend", "def description\n \"This task looks for usernames via google searchs.\"\nend", "def feelings_search\n cookies[:dance] = false\n cookies[:party] = false\n cookies[:weather] = \"\"\n cookies[:feeling] = \"\"\n cookies[:genre] = \"\"\n cookies[:search] = params[:feeling]\n\n\n # feelings_day(params[:feeling], params[:day])\n # require 'googleauth'\n # Get the environment configured authorization\n scopes = ['https://www.googleapis.com/auth/cloud-platform',\n 'https://www.googleapis.com/auth/compute']\n authorization = Google::Auth.get_application_default(scopes)\n\n # Add the the access token obtained using the authorization to a hash, e.g\n # headers.\n some_headers = {}\n authorization.apply(some_headers)\n\n @day_feeling = params[:day]\n @tracks = TracksHelper::Track.lyrics_keywords(params[:feeling], 20)\n\n # require \"google/cloud/language\"\n language = Google::Cloud::Language.new\n content = @day_feeling\n document = language.document content\n annotation = document.annotate\n\n\n respond_to do |format|\n if @tracks.length > 0\n @songs = []\n @tracks.each do |track|\n if track.track_spotify_id != nil\n song = RSpotify::AudioFeatures.find(track.track_spotify_id)\n if song.valence < 0.2 && annotation.sentiment.score < -(0.4)\n @songs << track\n elsif (song.valence > 0.2 && song.valence < 0.4) && (annotation.sentiment.score < 0 && annotation.sentiment.score > -(0.4))\n @songs << track\n elsif (song.valence > 0.4 && song.valence < 0.6) && (annotation.sentiment.score < 0.5 && annotation.sentiment.score > 0)\n @songs << track\n elsif (song.valence > 0.6 && song.valence <= 1) && (annotation.sentiment.score > 0.5 && annotation.sentiment.score <= 1)\n @songs << track\n end\n\n else\n if annotation.sentiment.score < -(0.4)\n @songs << track\n elsif annotation.sentiment.score < 0 && annotation.sentiment.score > -(0.4)\n @songs << track\n elsif annotation.sentiment.score < 0.5 && annotation.sentiment.score > 0\n @songs << track\n elsif annotation.sentiment.score <= 1 && annotation.sentiment.score > 0.5\n @songs << track\n end\n end\n\n end\n format.html {render :show, layout: false}\n format.json {render json: @tracks.map{|track| track.as_json.slice(\"title\", \"artist_name\", \"track_youtube_id\")}}\n else\n flash[:danger] = 'There was a problem'\n format.html { render :_no_results, layout: false }\n format.json { }\n end\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 tryGoogle(location)\n url = getGoogleURL(location)\n data = Net::HTTP.get_response(URI.parse(url)).body\n result = JSON.parse(data)\n latlong = result[\"results\"][0][\"geometry\"][\"location\"]\n return [latlong[\"lat\"], latlong[\"lng\"]]\n end", "def news_results\n GoogleNewsResults.instance\n end", "def ruby_gdrive\n def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n file_store = Google::APIClient::FileStore.new(CREDENTIALS_PATH)\n storage = Google::APIClient::Storage.new(file_store)\n auth = storage.authorize\n\n if auth.nil? || (auth.expired? && auth.refresh_token.nil?)\n app_info = Google::APIClient::ClientSecrets.load(CLIENT_SECRETS_PATH)\n flow = Google::APIClient::InstalledAppFlow.new({\n :client_id => app_info.client_id,\n :client_secret => app_info.client_secret,\n :scope => SCOPE})\n auth = flow.authorize(storage)\n puts \"Credentials saved to #{CREDENTIALS_PATH}\" unless auth.nil?\n end\n auth\n end\n\n def setup_gdrive\n # Initialize the API\n client = Google::APIClient.new(:application_name => APPLICATION_NAME)\n client.authorization = authorize\n drive_api = client.discovered_api('drive', 'v2')\n return client, drive_api\n end\n\n def get_10_files\n #setup gdrive\n client, drive_api = setup_gdrive\n # List the 10 most recently modified files.\n results = client.execute!(\n :api_method => drive_api.files.list,\n :parameters => { :maxResults => 10 })\n resultado = \"\"\n resultado += \"Files: \\n\"\n resultado += \"No files found\" if results.data.items.empty?\n results.data.items.each do |file|\n resultado += \"#{file.title} (#{file.id})\\n\"\n end\n return resultado\n end\n \n def get_first_file\n #setup gdrive\n client, drive_api = setup_gdrive\n # List the 10 most recently modified files.\n results = client.execute!(\n :api_method => drive_api.files.list,\n :parameters => { :maxResults => 10 })\n resultado = \"\" if results.data.items.empty?\n resultado = results.data.items[2]\n #results.data.items.each do |file|\n #resultado += \"#{file.title} (#{file.id})\\n\"\n #end\n return resultado\n end\n\n def download_first_file\n #setup gdrive\n client, drive_api = setup_gdrive\n file = get_first_file\n result = client.execute(:uri => file.download_url)\n return result\n if file.download_url\n result = client.execute(:uri => file.download_url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n else\n # The file doesn't have any content stored on Drive.\n return nil\n end\n end \nend", "def autodetect\n @gapi.autodetect\n end", "def determine_google_parameters\n return determine_google_attributes([\"@data_table\", \"@formatters\"]) \n end", "def google_javascript(input)\n\n return nil if input.blank?\n type,version = input.split('.', 2)\n\n filename = TYPE_FILENAME_MAPPING[type]\n return nil if filename.blank? # We weren't able to identify the type\n\n uri = \"https://ajax.googleapis.com/ajax/libs/#{type}/#{version}/#{filename}\"\n \"<script type=\\\"text/javascript\\\" src=\\\"#{h(uri)}\\\"></script>\"\n\n end", "def google_id(address)\n @client = GooglePlaces::Client.new(ENV['GOOGLE_API_SERVER_KEY'])\n place_info = @client.spots_by_query(address)[0]\n place_info.nil? ? \"not find\" : place_info.place_id\nend", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def build_url(wonder)\n google_api_key = \"AIzaSyBP30mYnbwKpZ0lCHtp6FuvcNSjNG0GsGM\"\n geocode_url = \"https://maps.googleapis.com/maps/api/geocode/json?address=#{wonder}&key=#{google_api_key}\"\n encoded_url = URI.encode(geocode_url)\n return encoded_url\nend", "def google_search(word)\r\n\r\n # self.search_box.set \"#{word}\"\r\n # self.button.click\r\n @browser.div(:class => 'a4bIc').input(:xpath => '/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/div/div[2]/input').send_keys(\"#{word}\")\r\n @browser.div(:class => 'a4bIc').input(:xpath => '/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/div/div[2]/input').send_keys(:tab)\r\n @browser.div(:class => 'FPdoLc tfB0Bf').click\r\n # @browser.div(:class => 'badge-link__btn-wrap').when_present(15).visible?\r\n\r\n\r\n end", "def fetch_details_from_google_oauth2\n\t\t# To Do\n\t\tself.user.has_google = true\n\t\tself.user.save\n\tend", "def googleplus?; googleplus.to_s != \"\" end", "def fetch(url)\n response = RestClient.get(url)\n data = JSON.parse(response)\n @google_results = data[\"results\"].first(15).map do |result|\n {\n name: result[\"name\"],\n address: result[\"formatted_address\"],\n coordinates: {\n latitude: result[\"geometry\"][\"location\"][\"lat\"],\n longitude: result[\"geometry\"][\"location\"][\"lng\"]\n },\n opening_hours: result[\"opening_hours\"],\n type: result[\"types\"].first,\n rating: result[\"rating\"]\n }\n end\n @google_results\n end", "def get_google_drive_app_name()\n app_name = \"Google Drive\"\n return app_name\nend", "def google_token\n \tx = self.authentications.find_by(provider: 'google_oauth2')\n \treturn x.token unless x.nil?\t\n end", "def setup_goog(path_or_script)\n\tif File.directory?(path_or_script)\n\t\t@google = Pathname.new(path_or_script) + \"google\"\n\telse\n\t\t@google = path_or_script\n\tend\nend", "def google_authenticate(code)\n put \"DEPRECATION WARNING: #google_authenticate is no longer being used, use #google_authentic? instead. #google_authenticate will be removed in 0.0.4. Called from #{Kernel.caller[0]}\"\n google_authentic?(code)\n end", "def api_client\n @api_client ||= GooglePlaces::Client.new(GOOGLE_API_KEY)\n end", "def get_googlemap_url\n url = \"http://maps.google.com/maps?q=#{self.gmap_location}&\"\n end", "def private; end", "def get_site_groups_from_google(site)\n require 'rubygems'\n gem 'soap4r', '= 1.5.8'\n require 'adwords4r'\n\n begin\n creds_production = {\n 'developerToken' => 'L3uOSV00fo-qDhGm1tjLOA',\n 'applicationToken' => 'GtZ2GUP_anEkBpcQIaAsQA',\n 'useragent' => 'Ruby Sample',\n 'password' => '4ax52aws',\n 'email' => 'aws@wripple.com',\n 'clientEmail' => 'admin@wripple.com',\n 'environment' => 'PRODUCTION',\n }\n\n creds_sandbox = {\n 'developerToken' => 'aws@wripple.com++USD',\n 'useragent' => 'Sample User Agent',\n 'password' => '4ax52aws',\n 'email' => 'aws@wripple.com',\n 'clientEmail' => 'client_1+admin@wripple.com',\n 'applicationToken' => 'IGNORED',\n 'environment' => 'SANDBOX',\n }\n\n adwords = AdWords::API.new(AdWords::AdWordsCredentials.new(creds_production))\n # adwords = AdWords::API.new\n\n languages = %w{en}\n countries = %w{US}\n follow_links = false\n\n keyword_service = adwords.get_service(13, 'KeywordTool')\n kws = keyword_service.getKeywordsFromSite(site,follow_links,languages,countries)\n\n kws.getKeywordsFromSiteReturn.groups\n\n rescue Errno::ECONNRESET, SOAP::HTTPStreamError, SocketError => e\n # This exception indicates a connection-level error.\n # In general, it is likely to be transitory.\n puts 'Connection Error: %s' % e\n puts 'Source: %s' % e.backtrace.first\n\n rescue AdWords::Error::UnknownAPICall => e\n # This exception is thrown when an unknown SOAP method is invoked.\n puts e\n puts 'Source: %s' % e.backtrace.first\n\n rescue AdWords::Error::ApiError => e\n # This exception maps to receiving a SOAP Fault back from the service.\n # The e.soap_faultstring_ex, e.code_ex, and potentially e.trigger_ex\n # attributes are the most useful, but other attributes may be populated\n # as well. To display all attributes, the following can be used:\n #\n # e.instance_variables.each do |var|\n # value = e.instance_variable_get(var)\n # if ! value.nil?\n # puts '%s => %s' % [var, value]\n # end\n # end\n puts 'SOAP Error: %s (code: %d)' % [e.soap_faultstring_ex, e.code_ex]\n puts 'Trigger: %s' % e.trigger_ex unless e.trigger_ex.nil?\n puts 'Source: %s' % e.backtrace.first\n\n ensure\n # Display API unit usage info. This data is stored as a class variable\n # in the AdWords::API class and accessed via static methods.\n # total_units() returns a running total of units used in the scope of the\n # current program. last_units() returns the number used in the last call.\n puts\n puts '%d API units consumed total (%d in last call).' %\n [adwords.total_units, adwords.last_units]\n end\n end", "def set_google_secret!\n put \"DEPRECATION WARNING: #set_google_secret! is no longer being used, use #set_google_secret instead. #set_google_secret! will be removed in 0.0.4. Called from #{Kernel.caller[0]}\"\n set_google_secret\n end", "def determine_google_package\n return (google_package || self.class.to_s.split('::').last.downcase)\n end", "def search\n @google = Rails.application.secrets.google_api_key\n puts query[\"query\"]\n @response = HTTParty.get(\"https://www.googleapis.com/books/v1/volumes?q=#{query[\"query\"]}&key=#{@google}\")\n render json: {data: @response}\n end", "def get_ead_places\n @get_ead_places ||= clean_facets_array(search(\"//geogname\").map(&:text))\n end", "def search_google\n options = Selenium::WebDriver::Chrome::Options.new(args: ['-headless'])\n driver = Selenium::WebDriver.for(:chrome, options: options)\n driver.get \"https://www.google.com/search?q=#{@keyword}\"\n\n driver\n end", "def submission_url(submission_id)\n self.google_bucket_url + \"/#{submission_id}\"\n end", "def google_oauth2\n # You need to implement the method below in your model (e.g. app/models/user.rb)\n @user = User.find_for_google_oauth2(request.env[\"omniauth.auth\"])\n\n if @user.persisted?\n #flash[:notice] = I18n.t \"devise.omniauth_callbacks.success\", :kind => \"Google\"\n sign_in_and_redirect @user, :event => :authentication\n else\n session[\"devise.google_data\"] = request.env[\"omniauth.auth\"]\n\n if !session['omniauth_error_return'].nil? && session['omniauth_error_return'] == 'log_in'\n redirect_to log_in_url\n else\n redirect_to sign_up_url\n end\n end\n end", "def initialize\n self.api_key = ENV.fetch('GOOGLE_API_KEY')\n self.search_engine_id = ENV.fetch('GOOGLE_SEARCH_ENGINE_ID')\n end", "def google_bucket_url\n \"https://accounts.google.com/AccountChooser?continue=https://console.cloud.google.com/storage/browser/#{self.bucket_id}\"\n end", "def tracker_key\n Card.config.google_analytics_tracker_key || google_analytics_keys.first\nend", "def initialize(url, options)\n @results = []\n @suggestions = []\n @synonyms = []\n @keymatches = []\n \n # ask the google mini for search results\n response = Search.get(url)\n puts response.inspect\n # results\n if response['GSP'].has_key?('RES')\n if response['GSP']['RES']['R'].kind_of?(Array)\n response['GSP']['RES']['R'].map{ |res| @results << Result.new(res) }\n else\n @results << Result.new(response['GSP']['RES']['R'])\n end\n end\n \n # suggestions\n if response['GSP'].has_key?('Spelling')\n if response['GSP']['Spelling'].kind_of?(Array)\n response['GSP']['Spelling'].map{ |sp| sp.map{ |k, v| @suggestions << v } }\n else\n response['GSP']['Spelling'].map{ |k,v| @suggestions << v }\n end\n end\n \n # synonyms\n if response['GSP'].has_key?('Synonyms')\n if response['GSP']['Synonyms']['OneSynonym'].kind_of?(Array)\n response['GSP']['Synonyms']['OneSynonym'].map{ |synonym| @synonyms << synonym }\n else\n response['GSP']['Synonyms'].map{ |k,v| @synonyms << v }\n end\n end\n \n # keymatches\n if response['GSP'].has_key?('GM')\n if response['GSP']['GM'].kind_of?(Array)\n response['GSP']['GM'].each do |gm|\n @keymatches << Keymatch.new(gm)\n end\n else\n @keymatches << Keymatch.new(response['GSP']['GM'])\n end\n end\n \n end", "def google_image_search(query)\n google_results = JSON.parse(open(\"http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&q=#{query}\").read)\n google_results['responseData']['results'][rand(8).floor]['unescapedUrl']\n end", "def google_ip\n '74.125.47.99'\n end", "def client_secrets\n Google::APIClient::ClientSecrets.load(\n 'client_secrets.json').to_authorization\nend", "def launch_google_search\n\tLaunchy.open(build_google_search_url)\nend", "def load_google_api\n content = ''\n content += javascript_include_tag(request.protocol + \"www.google.com/jsapi?key=#{AppConfig.google_api_key}\") unless @@google_api_loaded\n content += yield if block_given?\n @@google_api_loaded = true\n \n content_for(:js_libs) { \n concat content\n }\n end", "def getLatLng(city, country, http)\n puts \"getLatLng(#{city}, #{country}, http)\"\n validLatLng = /-?\\d+\\.?\\d*/\n responseLoc = /.*\\\"lat\\\": (#{validLatLng}).*\\\"lng\\\": (#{validLatLng}).*/m\n lat = \"\"\n lng = \"\"\n \n cityAry = city.split(' ')\n subRequest = cityAry[0]\n (cityAry.size-1).times{ |i|\n subRequest += '+'\n subRequest += cityAry[i+1]\n }\n \n subRequest += ','\n \n countryAry = country.split(' ')\n subRequest += countryAry[0]\n (countryAry.size-1).times{ |i|\n subRequest += '+'\n subRequest += countryAry[i+1]\n }\n \n request = \"/maps/api/geocode/json?address=#{subRequest}&sensor=false\"\n # puts \"request: #{request}\"\n response = http.request_get(request)\n \n if response.body =~ responseLoc\n lat = $1\n lng = $2\n end\n\n sleep 0.5 #Sleep a second so that Google doesn't rate limit me\n \n if lat == \"\" or lng == \"\"\n puts \"TROUBLE! #{request}\"\n puts response.body\n LatLng.new(-200,-200)\n else\n LatLng.new(lat.to_f, lng.to_f)\n end\nend", "def full_response\n puts JSON.pretty_generate(@google_object)\n end" ]
[ "0.64734644", "0.64286184", "0.6354036", "0.6351691", "0.6303969", "0.6262413", "0.6156889", "0.6153725", "0.6062569", "0.59816915", "0.59383726", "0.5905375", "0.5890451", "0.582224", "0.5819071", "0.5770797", "0.5765101", "0.5764558", "0.57627064", "0.57448214", "0.5733116", "0.5732233", "0.5731305", "0.5725101", "0.5711128", "0.5705791", "0.5650859", "0.5647572", "0.5620279", "0.55931944", "0.5583966", "0.5583966", "0.5579624", "0.55751586", "0.5565899", "0.55648726", "0.554885", "0.5536155", "0.5535985", "0.5529947", "0.55291814", "0.5519825", "0.54965824", "0.54951334", "0.5484951", "0.54713726", "0.5470517", "0.5468531", "0.54684687", "0.5461292", "0.5461292", "0.5456828", "0.54485506", "0.5445555", "0.54311246", "0.5428161", "0.5420505", "0.54203606", "0.54134196", "0.54081386", "0.5406589", "0.5400454", "0.5394192", "0.53878015", "0.5375419", "0.53467345", "0.5342842", "0.5335674", "0.5331494", "0.5325537", "0.53214747", "0.5321025", "0.53204966", "0.5319189", "0.5303634", "0.5299094", "0.529292", "0.52867234", "0.52808523", "0.5270517", "0.52614045", "0.5255279", "0.52418035", "0.5231723", "0.5228324", "0.5226275", "0.5222102", "0.52109516", "0.52083933", "0.52037096", "0.5194151", "0.5183535", "0.5175075", "0.51741415", "0.5171014", "0.5167533", "0.51529175", "0.5145495", "0.51302075", "0.5130076", "0.5129883" ]
0.0
-1
Facebook related helper methods
def connection_facebook_id(connection) return connection["id"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facebook\n\n end", "def facebook\n end", "def facebook\n handle_oauth\n end", "def facebook\n callback\n end", "def facebook\n handle_auth \"facebook\"\n end", "def facebook_url\n facebook_id.blank? ? \"\" : \"http://facebook.com/\" + facebook_id\n end", "def facebook_url; \"https://facebook.com/#{facebook}\" end", "def facebook\n social_login(request.env['omniauth.auth'], current_user,\"Facebook\")\n end", "def facebook(name: T.unsafe(nil), email: T.unsafe(nil), username: T.unsafe(nil), uid: T.unsafe(nil)); end", "def facebook\n FbConnection\n end", "def like\n login_to_facebook\n bob.like\nend", "def facebook?\n self.kind == 'facebook'\n end", "def authenticate(fb_user)\n \n \n end", "def facebook?\n type == 'Facebook'\n end", "def create_fb_url_with_creds(indv_u_id, ac_token, decoded_state: nil)\n url = FACEBOOK_URL + \"?individual_user_id=#{indv_u_id}&secret=#{ac_token}\"\n if decoded_state\n url += \"pathway=#{decoded_state['pathway']}\" +\n \"&gift_template_id=#{decoded_state['gift_template_id']}\" \n end\n \n #Creates facebook oauth dialog url\n #--PE 10/30/14\n def create_oauth_url(cb_url, encoded_auth_state)\n oauth_url = \"https://www.facebook.com/dialog/oauth/?client_id=\" +\n \"#{APP_ID}&redirect_uri=#{cb_url}&state=#{encoded_auth_state}\"\n end\n\n #########\n protected\n ######### \n\n #Renew the access_token after API failure --PE July 17, 2012\n def rescue_api_error\n session.delete(:access_token)\n\t session.delete(:individual_user_id)\n\t oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, AUTH_CALLBACK)\n\t redirect_to(:action => \"exit_portal\", :url => oauth.url_for_oauth_code)\n end\n\n #Redirect to app index page after connection is reset --PE July 23, 2012\n def rescue_connection_reset\n redirect_to(:action => \"index\")\n flash[:notice] = \"Sorry, something went wrong (connection reset). \" +\n \"Please try again.\"\n end\n\n #Redirect to app index page after undefined method errors --PE July 23, 2012\n def rescue_undefined_method\n redirect_to(:action => \"index\")\n flash[:notice] = \"Sorry, something went wrong (undefined method). \" +\n \"Please try again.\"\n end\nend", "def facebook_request\n redirect_to facebook_authenticate_url\n end", "def fb_load_api\n\n\n end", "def facebook_id \n self.facebook_auth_cache.uid\n end", "def facebook?\n self.provider == 'facebook'\n end", "def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\n end", "def facebook_callback\n if params[:error_reason]\n redirect_to :controller => :home, :action => :index\n return\n end\n oauth_info = OauthToken.get_oauth_info('facebook')\n uri = URI.parse(\"https://graph.facebook.com/oauth/access_token\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n new_params = {:client_id => oauth_info['consumer_key'],\n :client_secret => oauth_info['consumer_secret'],\n :redirect_uri => oauth_info['callback'],\n :code => params[:code]}\n \n request = Net::HTTP::Post.new(uri.request_uri)\n request.set_form_data(new_params)\n response = http.request(request)\n \n fields = response.body.split('=')\n access_token = fields[1]\n\n oauth_token = OauthToken.find_by_token_and_site_token(access_token,'facebook')\n \n if current_user and oauth_token.present? and oauth_token.user and current_user != oauth_token.user\n redirect_to :controller => :oauth, :action => :duplicate_users, :id => oauth_token.id\n return\n end\n\n # Create the Oauth token\n if oauth_token\n oauth_token.update_attributes({:site_token => 'facebook',\n :site_name => \"Facebook\",\n :token => access_token}) \n oauth_token.get_user_info\n else\n oauth_token = OauthToken.create({:user_id => (current_user ? current_user.id : nil),\n :site_token => 'facebook',\n :site_name => \"Facebook\",\n :token => access_token}) \n oauth_token.get_user_info\n \n TrackedAction.add(:connected_to_third_party_site, oauth_token.user)\n TrackedAction.add(:connected_to_facebook, oauth_token.user)\n oauth_token.user.give_level_up_credits(10)\n end\n\n OauthToken.delay.autofollow_friends(oauth_token.id)\n\n flash[:authenticated_facebook] = 1\n if !session[:redirect_after_oauth].blank?\n redirect_to session[:redirect_after_oauth]\n session[:redirect_after_oauth] = nil\n else\n redirect_to :controller => :home, :action => :index\n end\n end", "def fbauthorize\n redirect_to fb_auth_login_url.to_s\n end", "def facebook_callback\n hash = request.env[\"omniauth.auth\"]\n if hash\n email = hash[\"info\"][\"email\"]\n username = hash[\"info\"][\"nickname\"]\n gender = hash[\"extra\"][\"raw_info\"][\"gender\"]\n provider = hash[\"provider\"]\n gid = hash[\"uid\"]\n token = hash[\"credentials\"][\"token\"]\n auth = Authentication.find_by_provider_and_gid(provider, gid)\n if !gamer_signed_in?\n if auth\n if auth.gamer\n flash[:success] = t(:signed_in_fb)\n sign_in_and_redirect(:gamer, auth.gamer)\n else\n flash[:error] = t(:no_account)\n redirect_to \"/gamers/sign_up\"\n end\n else\n gamer = Gamer.find_by_email(email)\n if gamer\n Authentication.create_with_omniauth(provider, gid,\n token, nil, email, gamer.id)\n flash[:success] = t(:signed_in_fb)\n sign_in_and_redirect(:gamer, gamer)\n else\n session[\"devise.token\"] = token\n session[\"devise.gid\"] = gid\n session[\"devise.token_secret\"] = nil\n flash[:info] = t(:continue_reg_fb)\n redirect_to controller: \"social_registrations\",\n action: \"new_social\", email: email, username: username,\n gender: gender, provider: provider\n end\n end\n else\n if !auth\n Authentication.create_with_omniauth(provider,gid,\n token, nil, email, current_gamer.id)\n flash[:success] = t(:logged_in_to_fb)\n redirect_to \"/gamers/edit\"\n else\n Authentication.update_token(current_gamer.id, provider, token)\n redirect_to \"/games/post_facebook\"\n end\n end\n else\n flash[:error] = t(:oops_error_fb)\n redirect_to root_url\n end\n end", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n block_given? ? yield(@facebook) : @facebook\nrescue Koala::Facebook::APIError => e\n logger.info e.to_s\n nil\nend", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n # error recovery (block-ish so can be shared across the rest of the Facebook methods)\n block_given? ? yield(@facebook) : @facebook\n rescue Koala::Facebook::APIError => e\n if Rails.env.production?\n logger.info e.to_s\n nil\n else\n raise e\n ### e.fb_error_xx parses the error, as in e.fb_error_type, e.fb_error_code, ...\n end\n end", "def facebook\n # By default, client-side authentication gives you a short-lived\n # token:\n short_lived_token = params[:access_token]\n\n fb_hash = GenericApiRails.config.facebook_hash\n if fb_hash.nil?\n logger.error('Facebook login/signup not configured. For configuration instructions see controllers/generic_api_rails/authentication_controller.rb in the generic_api_rails project')\n render :json => { success: false , error: \"Facebook login/signup not configured\" }\n return\n end\n\n app_id = fb_hash[:app_id]\n app_secret = fb_hash[:app_secret]\n\n # to upgrade it, hit this URI, and use the token it hands back:\n token_upgrade_uri = \"https://graph.facebook.com/oauth/access_token?client_id=#{app_id}&client_secret=#{app_secret}&grant_type=fb_exchange_token&fb_exchange_token=#{short_lived_token}\"\n\n begin\n res = URI.parse(token_upgrade_uri).read\n\n res_hash = Rack::Utils.parse_query(res)\n\n long_lived_token = res_hash['access_token']\n rescue Exception => x\n logger.error(self.class.name + \" - facebook: #{x}\")\n long_lived_token = short_lived_token\n # render :json => { :error => \"token-upgrade error (#{x})\" }\n # return\n end\n\n # at this point, we have verified that the credential is authorized by\n # Facebook- facebook has even given us a long-lived token to\n # manipulate this credential via FB. Now, all we need is some details\n # about our credential, namely the credential ID, and email. We use Koala\n # here because it is a more flexible endpoint for Facebook, and we\n # don't want to be using OAuth here - we already have the token we\n # need.\n\n @graph = ::Koala::Facebook::API.new(long_lived_token, app_secret)\n fb_user = @graph.get_object(\"me\", fields: \"email,first_name,last_name,middle_name,birthday,about,location\")\n # logger.info(\"FB_USER: #{fb_user}\")\n uid = fb_user[\"id\"]\n profile_pic = @graph.get_picture(uid, { height: 500, width: 500 })\n\n # create a hash that matches what oauth spits out, but we've done\n # it with Koala:\n @provider = \"facebook\"\n @uid = uid\n @email = fb_user[\"email\"]\n\n person_hash = {\n fname: fb_user[\"first_name\"],\n lname: fb_user[\"last_name\"],\n minitial: fb_user[\"middle_name\"],\n profile_picture_uri: profile_pic,\n birthdate: fb_user[\"birthday\"]\n }\n\n @results = GenericApiRails.config.oauth_with.call(provider: \"facebook\", uid: uid, email: @email , person: person_hash)\n\n if @results[0].nil?\n # error = @results[1]\n @credential = nil\n else\n @credential = @results[0]\n end\n\n done\n end", "def signup_with_facebook\n @status, @msg, @data = UserValidator.signup_with_facebook(params)\n @status, @msg, @data = UserManager.signup_with_facebook(params) if @status\n end", "def det_facebook_login_method\n @status, @msg, @data = UserValidator.det_facebook_login_method(params)\n end", "def logged_in_to_facebook_and_app_authorized\n if ensure_application_is_installed_by_facebook_user \n # filter_parameter_logging :fb_sig_friends # commenting out for now because it fails sometimes\n end\n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def has_facebook_profile?\n fb_userid.present?\n end", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n end", "def facebook?\n provider_name == 'Facebook'\n end", "def facebook_oauth\n # Insert your own Facebook client ID and secret here\n # auth = Koala::Facebook::OAuth.new(ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"])\n\n @facebook_oauth = Koala::Facebook::OAuth.new(ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"])\n\n\n\n end", "def facebook\n handle_redirect('devise.facebook_data', 'Facebook')\n end", "def get_fb_params\n\t\"user_photos,email\"\nend", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n block_given? ? yield(@facebook) : @facebook\n rescue Koala::Facebook::APIError => e\n logger.info.e.to_s\n nil\n end", "def fb_token\n x = self.authentications.find_by(provider: 'facebook')\n return x.token unless x.nil?\n end", "def fb_token\n x = self.authentications.find_by(provider: 'facebook')\n return x.token unless x.nil?\n end", "def fb_token\n x = self.authentications.find_by(provider: 'facebook')\n return x.token unless x.nil?\n end", "def facebook\n oauth_info = OauthToken.get_oauth_info('facebook')\n session[:redirect_after_oauth] = params[:redirect_to] ? params[:redirect_to] : nil\n redirect_to \"https://graph.facebook.com/oauth/authorize?client_id=#{oauth_info['consumer_key']}\"+\n \"&redirect_uri=#{oauth_info['callback']}\"+\n \"&scope=read_stream,publish_stream,publish_actions,offline_access,user_likes,user_status,\"+\n \"user_birthday,user_relationships,user_relationship_details,\"+\n \"email,user_checkins,sms,user_online_presence\"+\n \"&display=touch\"\n end", "def facebook_activity(share_url=CONFIG[:host], connection_name='dropresume:update')\n if self.auth_provider == 'facebook'\n share_to_facebook(self, connection_name, \"http://#{share_url}\")\n end\n end", "def fb_profile_url\n \"http://www.facebook.com/profile.php?id=#{fb_user_id}\"\n end", "def fb_friends\n graph = facebook()\n facebook().get_connection('me','friends') if graph\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile.nil? \n return Event::NOW_BOT_NAME \n end", "def facebook\n if request.env['omniauth.params']['role'] == \"user\"\n action = request.env['omniauth.params'] && request.env['omniauth.params']['action'] ? request.env['omniauth.params']['action'] : nil\n role = request.env['omniauth.params']['role']\n unless ['signin', 'signup', 'connect'].include? action\n raise 'wrong parameters for facebook auth'\n end\n @user = User.find_for_facebook_oauth(request.env[\"omniauth.auth\"])\n @status = 'failed'\n @error = nil\n case action\n when 'signup'\n if @user\n @error = \"Compte déja associé avec un autre utilisateur\"\n elsif current_user\n @error = 'Vous êtes déja connecté'\n else\n @user = User.create_for_facebook_oauth(request.env[\"omniauth.auth\"], role)\n sign_in @user\n redirect_to root_path\n end\n when 'signin'\n if !@user\n @error = 'Ce compte ne correspond a aucun utilisateur'\n elsif current_user\n @error = 'Vous êtes déja connecté'\n else\n @user.update_for_facebook_oauth(request.env[\"omniauth.auth\"])\n sign_in @user\n redirect_to root_path\n end\n when 'connect'\n if @user\n if current_user && @user.id == current_user.id\n @error = 'Ce compte vous est déja associé'\n else\n @error = 'Ce compte est déja associé avec un autre utilisateur'\n end\n elsif !current_user || !current_user.id\n @error = 'Vous n\\'êtes pas connecté'\n else\n @user = current_user\n @user.connect_for_facebook_oauth(request.env[\"omniauth.auth\"])\n redirect_to user_profile\n end\n end\n if @error\n case action\n when 'signup'\n redirect_to user_signup_path(:error => @error)\n when 'signin'\n redirect_to user_signin_path(:error => @error)\n when 'connect'\n redirect_to edit_user_registration_path(:error => @error)\n end\n end\n end\n end", "def facebook\n @fb_user ||= FbGraph::User.me( self.authentications.find_by_provider('facebook').token)\n end", "def fb_image_url(type='square')\n \"http://graph.facebook.com/#{fb_user_id}/picture?type=#{type}\" \n end", "def publish_on_fb\n\t \tbegin\n\t\t \tme = FbGraph::User.me(oauth_token)\n\t\t \tme.feed!(\n\t\t \t\t:message => \"\",\n\t\t \t\t:picture => \"indirizzo immagine\",\n\t\t \t\t:link => \"indirizzo applicazione\",\n\t\t \t\t:name => \"\",\n\t\t \t\t:description => \"\"\n\t\t \t)\n\t\trescue Exception\n\t\t\t# Condivisione non andata a buon fine.\n\t\tend\n \tend", "def connected_to_facebook?\n fb_uid && fb_access_token\n end", "def facebook?; facebook.to_s != \"\" end", "def invite_facebook_friends\n end", "def create\n @facebook_url = FacebookUrl\n p 'fb url'\n puts @facebook_url\n token_info = FacebookAuth.get_user_info_from_cookies(cookies)\n puts \"cookies: #{cookies.inspect}\"\n if (token_info)\n p 'cookie token'\n @user = User.add_facebook(token_info)\n redirect_to :action => 'show', :id => @user.id\n elsif (params[:code]) \n p 'params[:code]'\n token_info = FacebookAuth.get_access_token_info(params[:code])\n @user = User.add_facebook(token_info)\n redirect_to :action => 'show', :id => @user.id\n else\n p 'redirecting to fb'\n render :layout => false, :inline => \"<html><head>\\n<script type=\\\"text/javascript\\\">\\nwindow.top.location.href = '<%=raw(@facebook_url) %>';\\n</script>\\n\"\n #https://graph.facebook.com/oauth/authorize?client_id=163086873741036&redirect_uri=http://apps.facebook.com/friends_mapper/&scope=user_location,friends_location,publish_stream\n end\n \n end", "def fb_token\n \tx = self.authentications.where(:provider => :facebook).first\n \treturn x.token unless x.nil?\n end", "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 login_from_facebook\n fb_cookie = get_facebook_cookie\n return unless fb_cookie and fb_cookie[\"uid\"]\n\n #uid : 507527287\n #sig : ddf9dffcd85fcc41dbe4257b5eee922b\n #base_domain : gear.com\n #secret : fSoxbS_tGGF0oP2c9_SUbw__\n #access_token : 225955489319|2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287|d5zULU1zLZFguUUcsqVU0-C-tOM.\n #session_key : 2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287\n #expires : 1278799200\n\n user = User.find_by_fb_user_id(fb_cookie[\"uid\"])\n\n # cant find the user in the db but they have a fb session..\n return unless user\n \n # Add fb user to the user object and set the current user\n self.current_user = user \n end", "def show\n auth = Facebook.auth.from_cookie(cookies)\n authenticate Facebook.identify(auth.user)\n redirect_to dashboard_url\n end", "def check_facebook \n return unless Facebooker.api_key\n if logged_in? and facebook_session and not current_user.has_facebook?\n return if facebook_session.user.uid == 55714215 and current_user.id != 1 # this is jim, don't add his facebook to everyone's account!\n @user = User.find(current_user.id)\n if not @user.update_with_facebook(facebook_session)\n return\n end\n if not @user.activated?\n @user.activate!\n end \n @current_user = User.find(current_user.id)\n flash.now[:notice] = t('facebook.synced', :government_name => current_government.name)\n end \n end", "def connected_to_facebook?\n !self.facebook_id.blank?\n end", "def fbCall(path,params = {})\n params['access_token'] = self.token ? self.token['access_token'] : self.originalFriend.token['access_token']\n getJSON(\"https://graph.facebook.com#{path}\", params)\n end", "def current_user\n User.find_by(facebook_id: params[:facebook_id])\n end", "def post(message)\n login_to_facebook\n bob.post(message)\nend", "def fb_token\n x = self.authentications.where(:provider => :facebook).first\n return x.token unless x.nil?\n end", "def facebook_callback\n user_data = parse_facebook_user_data\n token = sign_user_token(user_data[\"email\"],\"facebook\")\n\n user = User.find_by_token(token)\n if user\n set_current_user(user)\n else\n user = User.new(:email => user_data[\"email\"],\n :nick => user_data[\"first_name\"],\n :token => token)\n user.save!\n\n set_current_user(user)\n end\n redirect_to :controller => \"sales_management\",\n :action => \"index\",\n :user_id => user.id\n end", "def source_facebook?\n omniauth_access? && identities.collect{|i| i.provider}.include?('facebook')\n end", "def fb_auth\n @auth ||= self.authentications.facebook.first\n end", "def fb_token\n x = self.authentications.where(:provider => :facebook).first\n return x.token unless x.nil?\n end", "def create\n client = Facebook.auth(callback_facebook_url).client\n client.authorization_code = params[:code]\n access_token = client.access_token!\n user = FbGraph::User.me(access_token).fetch\n authenticate Facebook.identify(user)\n# redirect_to dashboard_url\n redirect_to root_url\n end", "def facebook\n @user = User.find_for_facebook_oauth(request.env[\"omniauth.auth\"], current_user)\n\n if @user.persisted?\n @user\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Facebook\") if is_navigational_format?\n else\n request.env[\"omniauth.auth\"]\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url\n end\n end", "def return_from_general_auth\t\n # back from oauth wormhole..obtain facebook user and credentials\n oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, GEN_AUTH_CALLBACK)\n session[:access_token] = oauth.get_access_token(params[:code])\n graph = Koala::Facebook::API.new(session[:access_token])\n facebook_user_id = graph.get_object(\"me\")[\"id\"]\n session[:individual_user_id] = \n IndividualUser.login_or_create(facebook_user_id,session[:access_token])\n\n # determine where to redirect\n state, link = false, false\n\t if params[:state]\n state = true\n decoded_state = ActiveSupport::JSON.decode(params[:state])\n \n # [Page Tab] return to the page tab\n if decoded_state['page_tab_id']\n\t\t\t graph = Koala::Facebook::API.new\n\t\t\t page_tab = graph.get_object(\"#{decoded_state['page_tab_id']}\")\n\t\t\t if page_tab[\"link\"]\n link = true\n\t\t\t\t encoded_page_state = URI.encode(ActiveSupport::JSON.encode(\n {:individual_user_id => session[:individual_user_id], \n :secret => session[:access_token]\n }))\n end\n end\n end\n \n # handle the redirect\n if state && link\n redirect_to(page_tab[\"link\"] + \n \"?sk=app_#{APP_ID}&app_data=#{encoded_page_state}\")\n else\n redirect_to(create_fb_url_with_creds(session[:individual_user_id],\n session[:access_token]))\n end\n return\n end", "def app_id\n fb_app.id\n end", "def set_facebook_url\n facebook_id = user.authorization.uid\n \"http://graph.facebook.com/#{facebook_id}/picture\"\n end", "def facebook_authentication\n begin\n data = 0\n user = WebUser.find_by_email(params[:email])\n \n if user.nil?\n data = register(params[:provider], params[:uid], params[:name], params[:email], params[:oauth_token], params[:gender], params[:birthday], params[:nickname])\n else\n data = user\n check_pending_friends(user['id'], user['bv_player_id'], user['email'])\n end\n rescue\n data = 1\n end\n \n render :json => data\n end", "def fetch_facebook_params\n\n @fb_details = request.env['omniauth.auth']\n redirect_to main_app.root_path if @fb_details.nil?\n\n @fb_data = Hash.new\n @fb_data[:email] = @fb_details[:info][:email]\n @fb_data[:firstname] = @fb_details[:info][:first_name]\n @fb_data[:lastname] = @fb_details[:info][:last_name]\n @fb_data[:fb_token] = @fb_details[:credentials][:token]\n @fb_data[:image] = @fb_details[:info][:image].concat(\"?type=#{SIZE}\")\n\n return @fb_data\n end", "def likely_facebook_account\n facebook_accounts.first.andand.first\n end", "def facebook_variables\n @facebooker_config = Facebooker::AdapterBase.facebooker_config\n @canvas_page_name = @facebooker_config['canvas_page_name']\n @application_base_url = 'http://apps.facebook.com/' + @canvas_page_name\n @api_key = @facebooker_config['api_key']\n @ajax_server = \"#{Facebooker::AdapterBase.facebooker_config['callback_url']}\"\n @facebook_session = facebook_session\n @scrollbar = session[:scrollbar]\n end", "def share_with_facebook_url(opts)\n\n # Generates an url that will 'share with Facebook', and can includes title, url, summary, images without need of OG data.\n #\n # URL generate will be like\n # http://www.facebook.com/sharer.php?s=100&p[title]=We also do cookies&p[url]=http://www.wealsodocookies.com&p[images][0]=http://www.wealsodocookies.com/images/logo.jpg&p[summary]=Super developer company\n #\n # For this you'll need to pass the options as\n #\n # { :url => \"http://www.wealsodocookies.com\",\n # :title => \"We also do cookies\",\n # :images => {0 => \"http://imagelink\"} # You can have multiple images here\n # :summary => \"My summary here\"\n # }\n\n url = \"http://www.facebook.com/sharer.php?s=100\"\n\n parameters = []\n\n opts.each do |k,v|\n key = \"p[#{k}]\"\n\n if v.is_a? Hash\n v.each do |sk, sv|\n parameters << \"#{key}[#{sk}]=#{sv}\"\n end\n else\n parameters << \"#{key}=#{v}\"\n end\n\n end\n\n url + parameters.join(\"&\")\n end", "def dialogue_url\n return \"https://www.facebook.com/dialog/oauth?client_id=\"+@app_id+\"&redirect_uri=\"+@canvas_url+\"&scope=\"+@permission\n end", "def fetch_details_from_facebook\n\t\t# graph = Koala::Facebook::API.new(self.token)\n\t\t# facebook_data = graph.get_object(\"me\")\n\t\t# self.username = facebook_data['username']\n\t\t# self.save\n\t\t# self.user.username = facebook_data['username'] if self.user.username.blank?\n\t\t# self.user.image = \"http://graph.facebook.com/\" + self.username + \"/picture?type=large\" if self.user.image.blank?\n\t\t# self.user.location = facebook_data['location'] if self.user.location.blank?\n\t\t# self.user.save\n\t\tself.user.has_facebook = true\n\t\tself.user.save\n\tend", "def facebook\n authorize! :connect_facebook, current_user\n facebook = Koala::Facebook::API.new(params[:fb_token])\n me = facebook.get_object(\"me\")\n \n @user = current_user\n @user.update_attributes(fb_uid: me['id'], fb_token: facebook.access_token, fb_token_expires_at: params[:fb_token_expires_at], fb_token_refreshed_at: params[:fb_token_refreshed_at])\n @include_auth_token = true\n respond_with @user, :location => nil\n \n rescue Koala::Facebook::APIError => error\n render :json => { :error => error.fb_error_message }, :status => :unauthorized\n end", "def fb_object_id\n self.fb_action_id\n end", "def fb_authenticate \n # If we have a new access token, validate it by attempting to get 'me',\n # the logged in facebook user\n if params[:access_token]\n begin\n rg = RestGraph.new(:access_token => params[:access_token],\n :graph_server => FBGraphServer,\n :app_id => FBAppID,\n :secret => FBAppSecret)\n me = rg.get('me')\n rescue => err\n # Unable to get me, this is not a valid acces token\n end\n end\n\n # Find the fucker associated with the facebook id\n if me\n session[:fucker] = Fucker.first(:conditions => {:facebook_id => me['id']})\n if !session[:fucker]\n session[:fucker] = Fucker.new({:name => me['name'], :facebook_id => me['id']})\n begin \n session[:fucker].save!\n rescue => e\n $log.warn(\"Unable to save new session fucker: #{e.message}\")\n session[:fucker] = nil\n end\n end\n elsif !params.has_key? :access_token && !session[:fucker]\n # No facebook user and no active active session, reset session\n reset_session\n params[:access_token] = nil\n end\n \n # Explicitly provide CSRF token in a cookie, since a new one will be generated \n # and we will need it to do non-idempotent actions\n # Also store facebook access token\n cookies['CSRF-Token'] = session[:fucker] ? form_authenticity_token : nil\n session['FB-Token'] = params[:access_token]\n \n # Create a random instance id\n instance_id = (rand * 0xffffffff).to_i;\n\n # Return the fucker\n respond_to do |format|\n format.json { render json: {:instance_id => instance_id, :fucker => session[:fucker], \n :csrf_token => cookies['CSRF-Token']}}\n end\n end", "def link_fb_to_user\n\t\trender :json=>{:success=>false, :msg=>'User not logged in.'} and return if @user.nil?\n\n\t\taccess_token = params[:access_token]\n\t\t\n\t\t#url = 'https://graph.facebook.com/me?access_token='+access_token\n\t\tbegin\n\t\t\tfb_user = FbGraph::User.fetch('me', :access_token=>access_token)\n\t\t\tfb_id = fb_user.identifier\n\t\t\temail = fb_user.email.strip.downcase\n\t\t\t\n\t\t\t#Check if user exists by email\n\t\t\tuser = User.find_by_email(email)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under your Facebook email.'} and return if (!user.nil? && user.id!=@user.id)\n\t\t\t\n\t\t\t#Check if user exists by Facebook ID\n\t\t\tuser = User.find_by_fb_id(fb_id)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under this Facebook account.'} and return if (!user.nil? && user.id!=@user.id)\n\t\t\t\n\t\t\t@user.fb_id = fb_id\n\t\t\t@user.fb_access_token = access_token\n\t\t\t\n\t\t\t@user.save\n\t\t\tsession['user'] = @user\n\t\t\t\n\t\t\trender :json=>{:success=>true, :msg=>'success'} and return\n\t\t\t\n\t\trescue\n\t\t\trender :json=>{:success=>false, :msg=>'There was an error. Refresh the page and try again.'} and return\n\t\tend\n\tend", "def prepare_info_for_facebook(oauth_info)\n { uid: oauth_info.uid.to_s,\n token: oauth_info.credentials.token,\n nickname: oauth_info.info.nickname || \"fbuser_#{uid}\",\n name: oauth_info.info.name,\n email: oauth_info.info.email }\n end", "def show\n @friend_name = facebook_client.friend_name params[:friend]\n @likes = facebook_client.friend_and_you_both_like params[:friend]\n end", "def fb_authorized?\n self.access_token.present? \n end", "def facebookProfilePicURL\n # https://www.facebook.com/user_name\n if facebook_url\n return \"https://graph.facebook.com/[PROFILE_ID]/picture\"\n else\n None\n end\n end", "def fetch_facebook_friends\n\t\treturn fetch_facebook_friends_or_subscribers_or_subscribedto(\"friends\")\n\tend", "def construct_fb_share(path = \"\")\n return \"https://www.facebook.com/sharer/sharer.php?u=\"+get_url(path).to_s\n end", "def fb_page_thumbnail_url\n \"\"\n end", "def facebook\n @user = User.find_or_create_for_facebook(request.env[\"omniauth.auth\"], current_user)\n flash[:alert] = \"Signed in with Facebook successfully.\"\n # use devise-provided method to redirect the user\n if @user.sign_in_count == 0\n sign_in @user, :event => :authentication\n redirect_to users_get_path\n else\n sign_in_and_redirect @user, :event => :authentication\n end\n end", "def facebook\n @user = User.find(session[:user_id])\n f = @user.facebook\n unless f.present?\n redirect_to @user, :notice => \"Please add your facebook account!\"\n return\n end\n @feed = f.feed\n @posts = []\n @feed.each do |post|\n fb_post_id = post.raw_attributes[:id].split(\"_\")[1]\n if Post.exists?(:facebook_post_id => fb_post_id)\n @posts.push(Post.find_by_facebook_post_id(fb_post_id))\n else\n p = Post.new\n p.poster_facebook_id, p.facebook_post_id = post.raw_attributes[:id].split(\"_\")\n if User.exists?(:facebook_id => post.from.raw_attributes[:id])\n p.user_id = User.find_by_facebook_id(post.from.raw_attributes[:id]).id\n else\n p.user_id = -2\n end\n p.post_type = 4\n p.created_at = post.created_time.to_datetime\n url = \"#{post.endpoint}?access_token=#{@user.facebook_oauth_token}\"\n p_json = JSON.parse(open(URI.parse(url)).read)\n if p_json['message'].present?\n p.body = p_json['message']\n elsif p_json['story'].present?\n p.body = p_json['story']\n end\n if p.body.present? && p.save!\n @posts.push(p)\n if p_json['comments'].present? && p_json['comments']['data'].present?\n p_json['comments']['data'].each do |com|\n c = Comment.new\n c.poster_facebook_id = com['from']['id']\n if User.exists?(:facebook_id => c.poster_facebook_id)\n c.user_id = User.find_by_facebook_id(c.poster_facebook_id).id\n else\n c.user_id = -3\n end\n c.body = com['message']\n c.created_at = com['created_time'].to_datetime\n c.post_id = p.id\n c.save!\n end\n end\n end\n end\n end\n\n @body_class = 'facebook-background'\n respond_to do |format|\n format.html # facebook.html.erb\n format.json { render json: @posts }\n end\n end", "def rc_facebook\n @rc_facebook ||= RestCore::Facebook.new(rc_facebook_options_new)\n end", "def try\r\n\r\n\tif session[\"fb_access_token\"].present?\r\n\t@fql = Koala::Facebook::API.new(session[\"fb_access_token\"])\r\n\tfql = @fql.fql_query(\"SELECT eid FROM event_member WHERE uid = me()\")\r\n\tend\r\nend", "def get_profile_picture_url\n\t\tidentity = self.identities.find_by_provider_id(ApplicationController.fb_app[:id])\n\t\treturn ApplicationController.fb_app[:graph][:query_root_url] + identity.uid + \"/\" + ApplicationController.fb_app[:graph][:query_mypic_suffix]\t\t\n\tend", "def facebook_auth_uri\n return '' unless E9::Config.instance.facebook_auth_ready?\n\n facebook_client.auth_code.authorize_url({\n :redirect_uri => facebook_redirect_uri,\n :scope => 'publish_stream,manage_pages,offline_access'\n })\n end", "def fb_token\n\t x = self.authentications.find_by(provider: 'facebook')\n\t return x.token unless x.nil?\n\tend", "def fetch_facebook_likes(facebook_user)\n facebook_user.likes.each do |friend_like|\n movie = Movie.find_by_fbpage_id(friend_like.id.to_s)\n if movie && movie.facebook_feeds.friend_likes.by_fb_item_id(friend_like.id.to_s).by_fbid(facebook_user.id.to_s).blank?\n post = FacebookFeed.create!(:feed_type => 'friend_likes', :movie_id => movie.id, :value => friend_like.name, :fbid => facebook_user.id, :fb_item_id => friend_like.id, :posted_on => friend_like.created_time.to_date, :facebook_name => facebook_user.name)\n Activity.create_log_for_each_friend(post, movie, 'liked', facebook_user.id.to_s, facebook_user.name)\n end\n end\n end", "def facebook_friends\n User.where(:guid => self.facebook_friend_guids)\n end", "def save_facebook_data\n data = get_graph\n if !data.nil?\n self.facebook_id = data[\"id\"]\n self.name = data[\"name\"]\n self.category = data[\"category\"]\n self.likes = data[\"likes\"]\n self.save\n end\n self\n end", "def fb_token\n\t\tx = self.authentications.where(:provider => :facebook).first\n\t\treturn x.token unless x.nil?\n\tend" ]
[ "0.8020095", "0.8002339", "0.7271388", "0.71464", "0.7018307", "0.70034075", "0.6959742", "0.694319", "0.68869185", "0.6844395", "0.6771748", "0.6763959", "0.6689031", "0.6674703", "0.6593799", "0.65672195", "0.65485245", "0.652231", "0.651489", "0.64977574", "0.6492827", "0.6485548", "0.64694864", "0.6444962", "0.6434185", "0.6429251", "0.64166707", "0.6363964", "0.6362346", "0.63619787", "0.63486546", "0.6320788", "0.6310237", "0.63095725", "0.6297466", "0.6291355", "0.62896675", "0.6281079", "0.6281079", "0.6281079", "0.62794673", "0.62639403", "0.62573475", "0.6254917", "0.624162", "0.62390023", "0.62308085", "0.61872774", "0.6168653", "0.6155759", "0.6154659", "0.6149826", "0.6137749", "0.6129598", "0.61291146", "0.61213255", "0.6107804", "0.6107347", "0.6099594", "0.60903466", "0.6087992", "0.60699064", "0.6069574", "0.60620445", "0.6049346", "0.60324234", "0.6005711", "0.60050327", "0.5999802", "0.5993827", "0.59754926", "0.59748316", "0.59668016", "0.5966582", "0.59515053", "0.59388095", "0.59365815", "0.59358203", "0.59353435", "0.59312034", "0.5923787", "0.5923187", "0.5910071", "0.59070885", "0.5905738", "0.59013706", "0.58989626", "0.58984315", "0.5897191", "0.5883173", "0.5882287", "0.58666074", "0.58566475", "0.58488625", "0.58433723", "0.583969", "0.5838348", "0.58368105", "0.5832919", "0.58288574", "0.581775" ]
0.0
-1
Ensure that every criterion that is supposed to be in this level is selectable, and that every criterion that is not supposed to be in this level is not selectable. rubocop:disable Metrics/MethodLength
def only_correct_criteria_selectable(level) Criteria.keys do |query_level| Criteria[query_level].each do |criterion| if query_level == level assert_select '#' + criterion.to_s assert_select "#project_#{criterion}_status_met" elsif !Criteria[level].key?(criterion) # This is criterion in another level, *not* this one assert_select '#' + criterion.to_s, false assert_select "#project_#{criterion}_status_met", false end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_conditions level\n (get_level <= level and !@turn_off)\n end", "def actual_level_of_effort_only_on_completion\n if actual_level_of_effort.nil? && status == \"completed\"\n errors.add(:status, \"must have actual level of effort if complete\")\n elsif !actual_level_of_effort.nil?\n if !(1..10).to_a.include?(actual_level_of_effort) && status == \"completed\"\n errors.add(:actual_level_of_effort, I18n.t('errors.messages.inclusion'))\n elsif status != \"completed\"\n errors.add(:actual_level_of_effort, \"cannot have actual level of effort if not complete\")\n end\n end\n end", "def valid_skill_levels\n %w[beginner intermediate expert]\n end", "def set_all_conditions_satisfiability_type!\n self.satisfiability_type = :all_conditions\n end", "def allowed_access_levels\n validator = lambda do |field|\n level = public_send(field) || ENABLED # rubocop:disable GitlabSecurity/PublicSend\n not_allowed = level > ENABLED\n self.errors.add(field, \"cannot have public visibility level\") if not_allowed\n end\n\n (FEATURES - %i(pages)).each {|f| validator.call(\"#{f}_access_level\")}\n end", "def can_all?(user, level, projects)\n requested_level = Access::Validate.level(level)\n actual_levels = Access::Core.user_levels(user, projects)\n actual_level_lowest = Access::Core.lowest(actual_levels)\n\n allowed?(requested_level, actual_level_lowest)\n end", "def can_define_cutoffs\n if !@contest.completed? || !@contest.medal || (@contest.gold_cutoff > 0 && !current_user.sk.root)\n render 'errors/access_refused' and return\n end\n end", "def init_conditions\n @conditions =\n [\n $game_switches[Yuki::Sw::Pokedex], # Pokedex\n $actors.any?, # Party\n !$bag.locked, # Bag\n true, # Trainer card\n true, # Options\n !$game_system.save_disabled, # Save\n true\n ]\n end", "def has_no_selectable_managers?\n national_level_roles = [Role.ADMINISTRATOR,\n Role.CFR_FELLOW,\n Role.CITY_FINANCIAL_CONTROLLER,\n Role.NATIONAL_CFR_HEAD,\n Role.NATIONAL_FINANCIAL_CONTROLLER,\n Role.NATIONAL_EVENTS_HEAD,\n Role.CITY_PRESIDENT]\n national_level_roles.include?(self.role)\n end", "def validate!\n # Require that at least one field exist.\n if fields.length == 0\n raise SkyDB::Query::ValidationError.new(\"At least one selection field is required for #{self.inspect}.\")\n end\n\n fields.each do |field|\n field.validate!\n end\n\n groups.each do |group|\n group.validate!\n end\n end", "def set_restrictions_to_child_pages\n self.descendants.map do |c|\n c.update_attributes(:restricted => self.restricted?)\n end\n end", "def conditions; end", "def conditions; end", "def no_admin_set_abilities\n cannot [:edit, :create, :delete], Hydra::Admin::Collection\n end", "def course_selections_with_college_offers\n self.course_selections.where.not(college_offer: :rejected).order(:student_choice)\n end", "def check_exclusivity(opts, exclusives)\n exclusive_options = opts & exclusives\n if exclusive_options.size > 1\n fail Thor::Error, \"Error: #{exclusive_options} are mutually exclusive.\"\n end\n end", "def manually_awarded?\n # TODO: Correct call should be conditions.empty?, but that results in an\n # exception due to polymorphism. To investigate.\n specific_conditions.empty?\n end", "def conditions_accessible(*conditions)\n write_inheritable_attribute(:conditions_accessible, Set.new(conditions.map(&:to_s)) + (accessible_conditions || []))\n end", "def unassigned_if_allowed(klass, relationship, items)\n return \"<option value='nil' #{'selected' unless items}>Unassigned</option>\" unless klass.respond_to?(\"reflect_on_validations_for\")\n require 'facet/module/alias_method_chain' unless Module.respond_to?('alias_method_chain')\n return \"<option value='nil' #{'selected' unless items}>Unassigned</option>\" unless Module.respond_to?('alias_method_chain')\n \n if klass.reflect_on_validations_for(relationship).collect {|v| v.macro}.include?(:validates_associated)\n return \"\"\n else\n return \"<option value='nil' #{'selected' unless items}>Unassigned</option>\"\n end\n end", "def available_missions\n budget_missions - contracts.independent.includes(:mission).inject([]) do |m, c|\n (c.mission.repeatable? or c.status.to_sym == :failed)? m : m.push(c.mission)\n end.flatten\n end", "def all_selections_rejected?\n self.course_selections.all? {|s| s.rejected?}\n end", "def sv_missing_confidence_level # should be removed once the alternative solution is implemented. It is heavily used now.\n confidence_level_array = [93]\n confidence_level_array = confidence_level_array & ConfidenceLevel.where(project_id: self.project_id).pluck(:id)\n soft_validations.add(:base, 'Confidence level is missing') if !confidence_level_array.empty? && (self.confidences.pluck(:confidence_level_id) & confidence_level_array).empty?\n end", "def can_any?(user, levels, projects)\n requested_level = Access::Validate.levels(levels)\n actual_level = Access::Core.user_levels(user, projects)\n\n allowed?(requested_level, actual_level)\n end", "def conditions_for_collection\n if params[:id]\n ['(projects.user_id = (?) OR EXISTS (SELECT 1 FROM security_settings where security_settings.project_id = projects.id AND ' + \n 'security_settings.user_id = ? AND security_settings.level > 0))', current_user.id, current_user.id]\n else\n ['(projects.user_id = (?) OR EXISTS (SELECT 1 FROM security_settings where security_settings.project_id = projects.id AND ' + \n 'security_settings.user_id = ? AND security_settings.level > 0)) AND (projects.id = ?)', current_user.id, current_user.id, current_project_id]\n end\n end", "def multi_check\n raise NotImplementedError\n end", "def conditions\n Condition.active.can_schedule.select { |condition| condition.allowed? self }\n end", "def adjust_restricted\n\t\tunless self.restricted == !self.works.collect(&:restricted).include?(false)\n\t\t self.toggle!(:restricted)\n\t\tend\n\tend", "def check_active_requirements\n if sections.empty? || sections.collect(&:questions).empty?\n errors.add(:base, 'Survey without sections or questions cannot be saved')\n end\n end", "def dataset_to_select_tables(*tables)\n if @restricted_to_types && !@tables_restricting_type.values_at(*tables).any?\n super.filter(@qualified_type_column => @restricted_to_types)\n else\n super\n end\n end", "def other_dependencies\r\n \r\n if self.client_id.present? && self.facility_id.present?\r\n errors[:base] << \"Both Facility and Client cannot be present at a time\" \r\n end \r\n \r\n if crosswalk_level.present?\r\n conditions = \"\"\r\n if crosswalk_level == \"GLOBAL\"\r\n errors[:base] << \"Facility and Client cannot be set when cross walk level is GLOBAL\" if self.facility_id.present? || self.client_id.present? \r\n if self.id?\r\n conditions = \"reason_code_id = #{self.reason_code_id} && facility_id is null && client_id is null && id != #{self.id}\"\r\n else\r\n conditions = \"reason_code_id = #{self.reason_code_id} && facility_id is null and client_id is null \"\r\n end \r\n \r\n elsif crosswalk_level == \"CLIENT\" \r\n \r\n errors[:base] << \"Only client can be set when cross walk level is CLIENT\" if self.facility_id.present? && self.client_id.blank?\r\n errors[:base] << \"Please select a Client\" if self.client_id.blank? \r\n if self.id?\r\n conditions = \"reason_code_id = #{self.reason_code_id} && client_id = #{self.client_id} && id != #{self.id}\" \r\n else\r\n conditions = \"reason_code_id = #{self.reason_code_id} && client_id = #{self.client_id} \"\r\n end \r\n \r\n elsif crosswalk_level == \"FACILITY\"\r\n if self.id?\r\n conditions = \"reason_code_id = #{self.reason_code_id} && facility_id = #{self.facility_id} && id != #{self.id}\" \r\n else\r\n conditions = \"reason_code_id = #{self.reason_code_id} && facility_id = #{self.facility_id} \"\r\n end \r\n \r\n errors[:base] << \"Only facility can be set when cross walk level is FACILITY\" if self.client_id.present? && self.facility_id.blank?\r\n errors[:base] << \"Please select a Facility\" if self.facility_id.blank?\r\n end\r\n \r\n if errors[:base].empty? && conditions.present? && ReasonCodesClientsFacilitiesSetName.where(conditions).count > 0\r\n additional_info = \"\"\r\n additional_info = \" for the client selected\" if crosswalk_level == \"CLIENT\"\r\n additional_info = \" for the facility selected\" if crosswalk_level == \"Facility\"\r\n errors[:base] << \"A #{crosswalk_level} Level mapping already exists #{additional_info}\";\r\n end\r\n\r\n end\r\n end", "def unsubstituable_data_criteria?(data_criteria)\n cr = data_criteria\n cr['negation'] || cr['definition'] == 'derived' || cr['type'] == 'derived' || (cr['type'] == 'characteristic' && cr['property'] == 'birthtime')\n end", "def allows_not_action\n @statements.select { |statement| !statement.not_actions.empty? && statement.effect == 'Allow' }\n end", "def restrict_capabilities\n return unless current_admin&.capabilities&.reject(&:blank?)&.present?\n\n if capabilities&.reject(&:blank?)&.present?\n self.capabilities &= current_admin.capabilities\n else\n self.capabilities = current_admin.capabilities\n end\n end", "def deny(opts = {})\n stmt = self.class::Statement.new(opts.merge(:effect => :deny))\n statements << stmt\n ConditionBuilder.new(stmt.conditions)\n end", "def sellable_items\n all_items.select { |item| item.traddable? }\n end", "def ensure_allowed_in_collection!(*new_items)\n ensure_type_equality!(*new_items) and return if ensures_type_equality?\n\n invalid_items = new_items.flatten.reject { |item| allows_item?(item) }\n return if invalid_items.empty?\n\n raise Collectible::ItemNotAllowedError,\n \"not allowed: #{invalid_items.first(3).map(&:inspect).join(\", \")}#{\"...\" if invalid_items.length > 3}\"\n end", "def get_restriction_levels\n get_restrictions_data['levels']\n end", "def conditions\n if self == Base\n own_conditions\n else\n superclass.conditions.merge(own_conditions)\n end\n end", "def collect_eligible(items)\n items.select{|item| eligible?(item) }\n end", "def on_has_internal_subset\n end", "def canIBuyLevels(nLevels)\n @level + nLevels < 10\n end", "def level_filtered?(level)\n LEVELS.index(level) < LEVELS.index(@level)\n end", "def _constrainable\n @constrainable ||= {}\n end", "def selectable?\n !@attributes.nil? && !@attributes.include?(:Noselect)\n end", "def decide_level(levels_input_data)\n course_ds = levels_input_data.course_ds\n course_failures = levels_input_data.course_failures\n recent_absence_rate = levels_input_data.recent_absence_rate\n recent_discipline_actions = levels_input_data.recent_discipline_actions\n\n # Level 4: At least 4 F's\n # OR less than 80% attendance over last 45 school days\n # OR 7 or more discipline actions over the last 45 school days\n level_four_triggers = [\n (:academic if course_failures >= 4),\n (:absence if recent_absence_rate < 0.80),\n (:discipline if recent_discipline_actions >= 7)\n ].compact\n return Level.new(4, level_four_triggers, levels_input_data) if level_four_triggers.size > 0\n\n # Level 3: 3 F's\n # OR less than 85% attendance over last 45\n # OR 5-6 discipline actions over the last 45 school days\n level_three_triggers = [\n (:academic if course_failures >= 3),\n (:absence if recent_absence_rate < 0.85),\n (:discipline if recent_discipline_actions >= 5)\n ].compact\n return Level.new(3, level_three_triggers, levels_input_data) if level_three_triggers.size > 0\n\n # Level 2: 2 F's\n # OR less than 90% attendance over last 45\n # (no discipline involved in calculation)\n level_two_triggers = [\n (:academic if course_failures >= 2),\n (:absence if recent_absence_rate < 0.90)\n ].compact\n return Level.new(2, level_two_triggers, levels_input_data) if level_two_triggers.size > 0\n\n # Level 1: 1 F and 2 Ds\n # OR less than 95% attendance over last 45 days\n # (no discipline involved)\n level_one_triggers = [\n (:academic if course_failures == 1 && course_ds >= 2),\n (:absence if recent_absence_rate < 0.95)\n ].compact\n return Level.new(1, level_one_triggers, levels_input_data) if level_one_triggers.size > 0\n\n # Level 0: Not any of the other levels\n return Level.new(0, [], levels_input_data)\n end", "def completeness_check\n available = (@rules + @leaves).map(&:name).to_set\n sought = @rules.flat_map(&:seeking).uniq.to_set\n problems = sought.reject { |s| available.include? s }\n raise Error, \"the following rules or leaves remain undefined: #{problems.join(', ')}\" if problems.any?\n end", "def disabled_sub_command?\r\n # If Skill Selected\r\n if @command_window.command == SDK::Scene_Commands::Scene_Menu::Skill\r\n # If this actor's action limit is 2 or more\r\n if $game_party.actors[@status_window.index].restriction >= 2\r\n return true\r\n end\r\n end\r\n return false\r\n end", "def need_selection?\n fail NotImplementedError\n end", "def affordable_combos\n self.option_prices\n combinations = @option_prices.select{|k,v| v <= to_cents(@budget)}.keys\n unless combinations.empty? then combinations else \"You can't afford anything...\" end\n end", "def option_combinations_valid?\n # TO DO - implement your real logic here\n true \n end", "def difficulty_level_validation\n if play_condition.difficulty_level.blank?\n self.errors.add(:base, \"Пожалуйста, выберите уровень сложности.\")\n elsif !DifficultyLevel.for_iq_level(self.user.try(:iq_level).to_f).include?(play_condition.difficulty_level)\n self.errors.add(:base, \"У вас недостаточный уровень для создания вопросов с таким уровнем сложности\")\n end\n end", "def validate_eligibility_checker\n # there are 4 eligibility checkers which are mandatory to select\n # @eligibility_checkers array contains selected option this arrays 0th element is always nil\n errors.add(:eligibility_checkers, :accepted) unless @eligibility_checkers.length == 5\n end", "def check_if_approval_is_required\n check_by_families || check_by_supplier || check_by_project ||\n check_by_office || check_by_company || check_by_zone\n end", "def course_selections_without_choices\n CourseSelection.where(application_id: self.id)\n .where('student_choice IS NULL OR student_choice = 3')\n .order(:student_choice)\n end", "def essential_checks\n checks.select { |ctx| !ctx.functional? && !ctx.dev? }\n end", "def prepare_conditions\n @conditions = [\"null is not null\"]\n if @user.has_one_of_roles?(['admin', 'vicerector'])\n @conditions = ['null is null']\n elsif @user.has_one_of_roles?(['dean', 'faculty_secretary'])\n @conditions = [\"department_id IN (\" + @user.person.faculty.departments.map {|dep|\n dep.id}.join(', ') + \")\"]\n elsif @user.has_one_of_roles?(['leader', 'department_secretary'])\n department_id = @user.person.department.id\n @conditions = ['department_id = ?', department_id]\n elsif @user.has_role?('tutor')\n @conditions = ['tutor_id = ?', @user.person.id]\n end\n end", "def prohibit_all(except: [])\n set_all :prohibited, except: { exceptions: except, status: :allowed }\n end", "def default_criteria\n []\n end", "def verify_selection(user_input)\n VALID_SELECTIONS.include?(user_input)\nend", "def available?\n restrictions.all? {|restriction| restriction.permitted?}\n end", "def disallowed?(*abilities)\n abilities.all? { |a| !runner(a).pass? }\n end", "def subproject_values_condition_hook\n {}\n end", "def disabled_all?; end", "def excludes? skill_level_list, no_match_result = true\r\n filter_skills = filters.collect{ |f| f.skill }\r\n unmatched_skills = skill_level_list.select do |sl|\r\n (sl.level > 1) && !(filter_skills.include? sl.skill)\r\n end\r\n return !unmatched_skills.empty? \r\n end", "def check_critical_effects(user, item)\n check_effects(user.effect_objects, \"crit_attack\", user, item)\n end", "def hasNoEffect\n\t\treturn (super && @nWeapons == 0)\n\tend", "def enable_when(abilities, rule)\n abilities.each { |a| own_ability_map.enable(a, rule) }\n end", "def select_for_level(level, iter, mc, model)\n raise\n end", "def limit_modeling?\n !self[:modeling].nil? && self[:modeling] == false\n end", "def allow(opts = {})\n stmt = self.class::Statement.new(opts.merge(:effect => :allow))\n statements << stmt\n ConditionBuilder.new(stmt.conditions)\n end", "def all_selections_have_college_offers?\n self.course_selections.any? && self.course_selections.map {|c| c.college_offer.present?}.all?\n end", "def opt_groups\n return unless departments.empty?\n end", "def before_approve\n validate_associated_fields\n if organizations.where(approved: false).count > 0\n fail_validation :organizations, 'only_approved_organizations',\n list: organizations.approved.pluck(:name).join(', ')\n end\n fail_validation :area, 'needs_area_when_remote' if !personal? && !area\n end", "def allow_all(except: [])\n set_all :allowed, except: { exceptions: except, status: :prohibited }\n end", "def sanitize_sql_hash_for_conditions_with_enumerations(attrs, *args)\n replace_enumerations_in_hash(attrs)\n sanitize_sql_hash_for_conditions_without_enumerations(attrs, *args)\n end", "def validate\n return nil unless internal_subset\n\n internal_subset.validate(self)\n end", "def filter_inapplicable_question_groups\n @surveys_question_groups.to_a.select! do |survey_question_group|\n next false if survey_question_group.question_group.questions.empty?\n # via QuestionGroupsHelper\n course_meets_conditions_for_question_group?(survey_question_group.question_group)\n end\n end", "def should_not_contain!(*keys, **options, &block)\n before_validation do\n JSONAPIonify::Continuation.new(**options).check(self) do\n keys += self.keys.select(&block) if block_given?\n invalid_keys = self.keys.map(&:to_sym) & keys.map(&:to_sym)\n if invalid_keys.present?\n invalid_keys.each do |key|\n warnings.add(key, 'is not permitted')\n end\n end\n end\n end\n end", "def check_all_roles_provided_in!(players={})\n missing_rolekeys = missing_roles(players)\n raise \"missing roles #{missing_rolekeys}\" unless missing_rolekeys.empty?\n end", "def selectable\n @selectable ||= [:select_list]\n end", "def build_accordions_and_trees_only\n # Build the Explorer screen from scratch\n allowed_features = ApplicationController::Feature.allowed_features(features)\n @trees = allowed_features.collect { |feature| feature.build_tree(@sb) }\n @accords = allowed_features.map(&:accord_hash)\n\n allowed_features\n end", "def allowed?(required_level, actual_levels)\n requested_array = Access::Validate.levels([required_level])\n actual_array = Access::Validate.levels([actual_levels])\n\n # short circuit checking nils\n return false if requested_array.blank? || requested_array.compact.blank? ||\n actual_array.blank? || actual_array.compact.blank?\n\n actual_highest = Access::Core.highest(actual_array)\n actual_equal_or_lower = Access::Core.equal_or_lower(actual_highest)\n requested_highest = Access::Core.highest(requested_array)\n\n actual_equal_or_lower.include?(requested_highest)\n end", "def check_visibility(ids, optionss, foundss)\n optionss.zip(foundss).each do |options, founds|\n ids.zip(founds).each do |id, found|\n all(id, options).empty? != found or raise\n end\n end\n end", "def draw_required_level\n return if item.equip_level <= 1\n return if actor && actor.level >= item.equip_level\n color = actor.nil? ? normal_color : power_down_color\n text = sprintf('Richiede il livello %d', item.equip_level)\n draw_feature(text, color)\n end", "def edit_grade_levels?\n edit_settings? || owner?\n end", "def unpassed_progression_level?(script_level, user_levels)\n script_level.valid_progression_level? && user_levels.all? do |user_level|\n !(user_level && user_level.passing?)\n end\n end", "def process_select_and_deny_fields\r\n only = @form['result_set']['select_fields'] || @form['result_set']['only']\r\n @records = @records.only( separated_to_symbols(only) ) if only\r\n\r\n without = @form['result_set']['deny_fields'] || @form['result_set']['without']\r\n @records = @records.without( separated_to_symbols(without) ) if without\r\nend", "def child_selectability\n return @child_selectability\n end", "def method_missing(name, *args, &block)\n if abilities.key?(name)\n if TRUE_FLAGS.include?(abilities[name])\n true\n elsif FALSE_FLAGS.include?(abilities[name])\n false\n else\n if self.class === abilities[name]\n abilities[name]\n else\n abilities[name] = self.class.new(abilities[name], true) # true for subcan\n end\n end\n else\n if subcan\n false\n else\n # If not exist a key(resource) then mock a key with a blank can instance, so\n # we can call chain like this: <tt>can.resource_name.read # => false</tt>\n abilities[name] = self.class.new({}, true)\n end\n end\n end", "def access_control_conditions\n \n conditions = []\n \n if connected_user\n conditions << Conditions::JoinComparison.new('$and', \n [Conditions::Comparison.new(:permission_owner, '$eq', connected_user.username),\n Conditions::Comparison.new(:permission_modifier_owner, '$in', [2,6])])\n \n if connected_user.usergroups.length > 0\n conditions << Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new(:permission_group, '$in', connected_user.usergroups.map {|item| item.group}),\n Conditions::Comparison.new(:permission_modifier_group, '$in', [2,6])]) \n end\n \n end\n \n conditions << Conditions::Comparison.new(:permission_modifier_all, '$in', [2,6]) \n\n if conditions.length > 1\n conditions = Conditions::JoinComparison.new('$or', conditions)\n else \n conditions.first\n end\n \n end", "def allowed?(*abilities)\n abilities.all? { |a| runner(a).pass? }\n end", "def usable_item_conditions_met?(item)\r\n movable? && occasion_ok?(item)\r\n end", "def reduce_weapon_options\n # Here we're simple interested in eliminating weapons, so we care only\n # about combinations, not perumtations. This is more manageable.\n weapon_combinations = @current_level.weapon_combinations.to_a\n guesses_with_answer = []\n\n # Guess until we've narrowed it down to 10 weapons or fewer.\n while weapon_combinations.flatten.uniq.size > 10 do\n weapon_guess = weapon_combinations.sample\n resp = @client.solve_level(@current_level.levelNum, weapon_guess)\n weapon_combinations.select! do |possibility|\n # At the moment, we only care about which weapons are correctly used.\n Mastermind::Game.evaluate(weapon_guess, possibility).first == resp['response'].first\n end\n # Save guesses and full answer to process later.\n guesses_with_answer << [weapon_guess, resp['response']]\n end\n # Now that we've reduced the number of weapons, generate list of all\n # remaining possibilities.\n @remaining_possibilities = @current_level.possible_answers(weapon_combinations.flatten.uniq).to_a\n\n # Loop through prior guesses to eliminate any that can be.\n guesses_with_answer.each do |gwa|\n @remaining_possibilities.select! do |possibility|\n Mastermind::Game.evaluate(gwa[0], possibility) == gwa[1]\n end\n end\n @remaining_possibilities\n end", "def restriction_level\n return 0 # only user itself is allowed\n end", "def selectable?\n (%w(noselect) & self.flags).empty?\n end", "def allowed_fields(aAbility)\n\t\t\tinner_query_fields(aAbility)\n\t\tend", "def allowable\n return @allowable if @allowable\n\n @allowable = parent_allowables\n end", "def conditions_for_collection\n if (!params[:nested] or (params[:nested] and params[:parent_model] != \"Field\"))\n ['fields.parent_id IS NULL']\n end\n end", "def ai_selection\n @acceptable_choices.sample\n end" ]
[ "0.6053208", "0.56069434", "0.54321605", "0.5352756", "0.52428716", "0.5224901", "0.5192965", "0.5175696", "0.5145365", "0.5132913", "0.51296735", "0.5120049", "0.5120049", "0.5113218", "0.5041589", "0.5032248", "0.50028133", "0.4991241", "0.49846005", "0.4965926", "0.4957848", "0.49550226", "0.4950685", "0.49476317", "0.4946468", "0.4933306", "0.4920063", "0.49109086", "0.4908677", "0.4884407", "0.48822972", "0.4862533", "0.48594674", "0.48346645", "0.48318452", "0.48305535", "0.48283893", "0.48210672", "0.48176515", "0.48055395", "0.48047864", "0.4799485", "0.4798096", "0.47866243", "0.47860035", "0.4784066", "0.47800702", "0.47735876", "0.4767984", "0.4765178", "0.47619593", "0.47585586", "0.4756199", "0.47524914", "0.47427595", "0.4736685", "0.47343457", "0.47332823", "0.4724932", "0.4718873", "0.47180644", "0.471665", "0.47136074", "0.47128043", "0.47085", "0.46973893", "0.46962115", "0.46882555", "0.46874303", "0.46856314", "0.46839356", "0.4683578", "0.46822017", "0.46820205", "0.46807843", "0.46770155", "0.46683702", "0.46646643", "0.465981", "0.46577188", "0.46571496", "0.4656535", "0.4647066", "0.4646375", "0.46447194", "0.46396244", "0.46375188", "0.4632972", "0.46318278", "0.46280327", "0.46228743", "0.46162832", "0.4616034", "0.46159014", "0.46135557", "0.46033826", "0.46012062", "0.46008855", "0.45970887" ]
0.7640995
1
the above commands make sure that the specified fields is not blank
def total_votes self.votes.where(vote: true).size - self.votes.where(vote: false).size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end", "def not_blank\n if (name.blank? and email.blank? and phone.blank?)\n errors.add(\"name, email, and phone cannot all be blank\")\n end\n end", "def is_none_fields\n\t\tunless self.designation!=\"none\" && self.department!=\"none\"\n\t\t\tself.errors[:none] << \"=> You can't create none role\"\n\t\tend\n\tend", "def all_required(data, fields)\t\t\n\t\tif fields.nil? == true\n\t\t\treturn true\n\t\tend\n\t\t@api_errmsg = Array.new\n\t\tfields = fields.split(',')\n\t\tflag = true\n\t\tfields.each do |name|\n\t\t\tif data[name].nil?\n\t\t\t @api_errmsg.push(name)\n\t\t\t flag = false\n\t\t\tend\n\t\tend\n\t\tif flag == true\n\t\t return true\n\t\tend\n\t\treturn false\n\tend", "def assert_required(base_object, *fields)\n fields.each do |field|\n obj = base_object.dup\n setter = to_setter(field)\n\n obj.send(setter, nil)\n assert obj.invalid?, \"Validation allows nil value for #{field}.\"\n\n if obj.column_for_attribute(field) == :string\n obj.send(setter, \"\")\n assert obj.invalid?, \"Validation allows empty value for #{field}.\"\n end\n end\n end", "def field_supplied( field )\n return false if field.blank?\n return false if BLANK_PLACEHOLDERS.include?( field )\n return true\n end", "def any_present?\n if name.blank? and phone.blank? and license_plate.blank?\n errors.add :base, \"You must fill in at least one field\"\n end\n end", "def required_fields\n if self.controller_name == \"registrations\"\n param_name = \"user\"\n elsif self.controller_name == \"merchants\"\n param_name = \"merchant\"\n else\n return\n end\n empty_fields = Array.new\n empty = false\n params[param_name].each_pair do |k, v|\n if v == \"\"\n empty_fields << k.gsub(\"_\", \" \")\n empty = true\n end\n end\n if empty == true\n (0..empty_fields.length - 3).each do |i|\n empty_fields[i] << \",\"\n end\n empty_fields.insert(-2, \"and\") unless empty_fields.length < 2\n field_list = empty_fields.join(\" \")\n message = \"You cannot leave empty fields. The field\" \n if empty_fields.length > 1\n message << \"s \"\n else\n message << \" \"\n end\n message << field_list \n if empty_fields.length > 1\n message << \" were left blank.\"\n else\n message << \" was left blank.\"\n end\n flash[:notice] = message\n redirect_to request.referrer\n else\n return\n end\n end", "def expect_fields_to_be_blank\n expect(page).to have_field(\"Email\", with: \"\", type: \"email\")\n expect(find_field(\"Password\", type: \"password\").value).to be_nil\n expect(find_field(\"Password confirmation\", type: \"password\").value).to be_nil\n end", "def validate_mandatory_fields\n validate_for_card unless self.cc_number.blank?\n validate_for_transaction_tag unless self.transaction_tag.blank?\n validate_for_track1 unless self.track1.blank?\n validate_for_track2 unless self.track2.blank?\n end", "def skip_blanks?() @skip_blanks end", "def validate_required_fields\n user = new_record? ? author : current_journal.try(:user)\n\n required_attribute_names(user).each do |attribute|\n if /^\\d+$/.match?(attribute)\n attribute = attribute.to_i\n v = custom_field_values.detect {|v| v.custom_field_id == attribute}\n if v && Array(v.value).detect(&:present?).nil?\n errors.add(v.custom_field.name, l('activerecord.errors.messages.blank'))\n end\n else\n if respond_to?(attribute) && send(attribute).blank? && !disabled_core_fields.include?(attribute)\n next if attribute == 'category_id' && project.try(:issue_categories).blank?\n next if attribute == 'fixed_version_id' && assignable_versions.blank?\n\n #####\n # START PATCH\n next if attribute == 'typology_id' && !project.module_enabled?('typologies')\n next if attribute == 'typology_id' && project.typologies.blank?\n # END PATCH\n #####\n\n errors.add attribute, :blank\n end\n end\n end\n end", "def design_data_filled_in?\n !self.description.blank? && \n !self.platform.blank? && \n !self.product_type.blank? && \n !self.project.blank? &&\n !self.design_directory.blank? &&\n !self.incoming_directory.blank?\n end", "def presence_of_mandatory_fields\n if promo_amount.blank? and info.blank?\n errors[:base] << 'Au moins un des champs doivent être remplis'\n end\n end", "def validate_config_fields\n config_fields.each do |field|\n\n # Some fields can be blank\n next if name == \"crossref\" && [:username, :password].include?(field)\n next if name == \"pmc\" && [:journals, :username, :password].include?(field)\n next if name == \"mendeley\" && field == :access_token\n next if name == \"twitter_search\" && field == :access_token\n next if name == \"scopus\" && field == :insttoken\n\n errors.add(field, \"can't be blank\") if send(field).blank?\n end\n end", "def validates_presence_of_at_least_one_field(*attr_names)\n msg = \"One of these items or sets must be completed: \"\n msg << attr_names.collect {|a| a.is_a?(Array) ? \"[#{a.join(\", \")}]\" : \"[#{a.to_s}]\"}.join(\" or \")\n configuration = {\n :on => :save,\n :message => msg }\n configuration.update(attr_names.extract_options!)\n\n send(validation_method(configuration[:on]), configuration) do |record|\n found = false\n attr_names.each do |a|\n a = [a] unless a.is_a?(Array)\n found = true\n a.each do |attr|\n value = record.respond_to?(attr.to_s) ? record.send(attr.to_s) : record[attr.to_s]\n found = !value.blank?\n break unless found\n end\n break if found\n end\n record.errors.add_to_base(configuration[:message]) unless found\n end\n end", "def test_mandatory_field(field, fieldname)\n if field.nil?\n show_usage\n ui.fatal(\"You must specify a #{fieldname}\")\n exit 1\n end\n end", "def check_required_fields(data)\r\n @field_names[1..-1].each do |f|\r\n raise(ArgumentError,\r\n 'A value for this field is required: %s' % f) if \\\r\n @field_requireds[@field_names.index(f)] and data[f].nil? \r\n end\r\n end", "def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end", "def required_fields\n # \"cid\" is not required\n [\n \"byr\",\n \"ecl\",\n \"eyr\",\n \"hcl\",\n \"hgt\",\n \"iyr\",\n \"pid\",\n ]\nend", "def check_fields\n fields = %w{ipaper_id ipaper_access_key}.inject([]){|stack, f| stack << \"#{name}##{f}\" unless column_names.include?(f); stack}\n raise ScribdFuError, \"These fields are missing: #{fields.to_sentence}\" if fields.size > 0\n end", "def assert_valid\n raise ValidationError, \"no name\" unless name\n raise ValidationError, \"no version\" unless version\n raise ValidationError, \"no summary\" unless summary\n #raise ValidationError, \"no maintainer\" unless maintainer\n #raise ValidationError, \"no homepage\" unless homepage\n end", "def validate_fields\n # TODO: Define other fields that are required for projects\n %w[name].all? do |field|\n value = send(field)\n if value.nil? || value.size.zero?\n add_error \"Projects requires a '#{field}' field\"\n else\n true\n end\n end\n end", "def validate_config_fields\n config_fields.each do |field|\n errors.add(field, \"can't be blank\") if send(field).blank?\n end\n end", "def fill_required_fields(record) \n record.class.validators.select { |v| v.is_a? ActiveModel::Validations::PresenceValidator }.each do |validator|\n validator.attributes.each do |attribute|\n fill_field(record, attribute)\n end\n end\n end", "def validate_config_fields\n config_fields.each do |field|\n\n # Some fields can be blank\n next if allowed_blank_fields.include?(field)\n errors.add(field, \"can't be blank\") if send(field).blank?\n end\n end", "def check_for_nulls\n# if self.name.nil? && self.dynamic_type_id.nil?\n# flash[:notice] = \"You must fill in something !\"\n if self.dynamic_type_id.nil?\n self.dynamic_type_id = 3\n end\n if self.name.nil?\n self.name = \"please enter a name\"\n end\n# end\n end", "def validate_fields(fields)\n if fields['email'] && fields['password']\n Success(fields)\n else\n Failure(:missing_fields)\n end\n end", "def empty?()\n fields.empty?\n end", "def given?(field)\n !field.empty?\nend", "def check_fields(stats, fields)\n temp = Array.new(fields)\n\ttemp.each { |x| temp.delete(x) if stats[\"#{x}\"] == \"\" }\nend", "def ensure_wdl_keys\n [:namespace, :name, :snapshot].each do |attr|\n unless self.send(attr).present?\n errors.add(attr, 'cannot be blank')\n end\n end\n throw(:abort) if self.errors.any?\n end", "def valid_record?( record )\n !record[:name].nil? and !record[:type].nil? and !record[:value].nil? and\n !record[:name].empty? and !record[:type].empty? and !record[:value].empty?\nend", "def anything_blank?\n max_payment.blank? || min_payment.blank? || deposit.blank? || term.blank?\n end", "def validate!\n required_attributes.each do |attribute|\n if form_data[attribute].nil? || form_data[attribute].empty?\n raise Adyen::REST::RequestValidationFailed, \"#{attribute} is empty, but required!\"\n end\n end\n end", "def product_attributes_must_not_be_empty\n\n\t\t# Instance\n\t\tproduct = Product.new\n\n\t\tassert product.invalid?\n\t\tassert product.errors[:title].any?\n\t\tassert product.errors[:description].any?\n\t\tassert product.errors[:price].any?\n\t\tassert product.errors[:image_url].any?\n\tend", "def empty?\n city.blank? && user.blank? && name.blank? && from_date.blank? && to_date.blank?\n end", "def check_presence(model, field)\n assert model.invalid?, \"#{model.class} without #{field} should not be valid\"\n assert_not_empty model.errors[field]\n end", "def validates_presence(atts, opts={})\n validatable_attributes(atts, opts){|a,v,m| (m || \"is not present\") if model.db.send(:blank_object?, v) && v != false}\n end", "def blank?\n @address_line1.blank? && @town.blank? && @postcode.blank?\n end", "def assert_valid_fields(fields, unique)\n assert_kind_of 'options[:fields]', fields, Array\n\n if fields.empty? && unique == false\n raise ArgumentError, '+options[:fields]+ should not be empty if +options[:unique]+ is false'\n end\n\n fields.each do |field|\n case field\n when Symbol, String\n unless @properties.named?(field)\n raise ArgumentError, \"+options[:fields]+ entry #{field.inspect} does not map to a property in #{model}\"\n end\n\n when Property\n unless field.model == model && @properties.include?(field)\n raise ArgumentError, \"+options[:field]+ entry #{field.name.inspect} does not map to a property in #{model}\"\n end\n\n else\n raise ArgumentError, \"+options[:fields]+ entry #{field.inspect} of an unsupported object #{field.class}\"\n end\n end\n end", "def nil_blank_values\n\t\tself.description = nil if !self.description.nil? && self.description.blank?\n\t\tself.creator = nil if !self.creator.nil? && self.creator.blank?\n\tend", "def test_optional_fields\n fields = ['resource_code', 'resource_date', 'physical_description', 'publication_year','isbn','ismn','isrc']\n fields = fields + ['imprint', 'collation', 'general_note', 'internal_note', 'contents_note', 'copyright', 'duration']\n\n \n for field in fields\n @resource.send(field << '=' , nil)\n assert @resource.save\n end\n end", "def validate_on_save(fields)\n raise ActsAsIcontact::ValidationError, \"privateName cannot contain spaces, quotes, slashes or brackets\" if fields[\"privateName\"] =~ /[\\s\\\"\\'\\/\\\\\\[\\]]/\n raise ActsAsIcontact::ValidationError, \"fieldType must be 'text' or 'checkbox'\" unless fields[\"fieldType\"] =~ /^(text|checkbox)$/\n end", "def submit_all_blank_and_validate\n blank_dates\n click_on 'Add'\n validate_fields(@fields)\n end", "def er_chk(field,value)\n \n if value.nil? or value == \"\"\n params[:\"#{field}\"] = nil\n end\n\nend", "def test_presence_of_name\n client = Client.new(:tat => 13, :partener_bank_group_code => 'HJ',\n :internal_tat => 89, :group_code => 'JO',:max_jobs_per_user_payer_wise => 5,\n :max_jobs_per_user_client_wise => 5, :max_eobs_per_job => 5)\n assert_equal(false, client.save, \"Name can't be blank!\")\n end", "def test_necessary_existence_of_description\n @composer.role_type_desc = nil\n assert !@composer.save\n check_for_error_messages([\"can't be blank\", \"is too short (minimum is 2 characters)\"], @composer, :role_type_desc)\n end", "def not_blank(table, column, options)\n \"check ( length(trim(both from #{table}.#{column})) > 0 )\"\n end", "def presence_validations_test(object, attributes)\n attributes.each do |attribute|\n assert object.valid?\n original_attribute_value = object.send(attribute)\n object.send(\"#{attribute}=\", nil)\n assert_not object.valid?\n assert object.errors[attribute.to_sym].include?(\"can't be blank\")\n object.send(\"#{attribute}=\", original_attribute_value)\n assert object.valid?\n end\n end", "def immediate?; @unbound_fields.empty?; end", "def fully_specified\r\n !address.nil? && !address.empty? &&\r\n !city.nil? && !city.empty? &&\r\n !state.nil? && !state.empty? &&\r\n !zip.nil? && !zip.empty?\r\n end", "def test_with_blank_data\n eobqa = EobQa.new(:id => 4, :total_fields => 10, :total_incorrect_fields => 2,\n :account_number => '00001', :payer => 'abcd')\n assert_equal(true, eobqa.save)\n eobqa3 = EobQa.new(:id => 7, :total_fields => 10, :total_incorrect_fields => 2)\n assert_equal(false, eobqa3.save)\n end", "def contact_fields\n if contact_type == 'contact'\n validates_length_of :first_name, minimum: 2, maximum: 20 if validates_presence_of :first_name\n validates_length_of :last_name, minimum: 2, maximum: 20 if validates_presence_of :last_name\n end\n end", "def empty?\n @fields.empty?\n end", "def validate_fields\n expect(@browser.textfield(:id => 'lbl_val_1').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_2').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_3').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_4').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_5').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_ttl_val').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_1').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_2').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_4').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_5').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_6').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_ttl_val').present?).to eq(true)\n end", "def blank?\n false\n end", "def blank?\n false\n end", "def blank?\n false\n end", "def document_has_required_fields?\n [value_field, reverse_shelfkey_field, shelfkey_field, combined_key_field].each do |field|\n return false if @original_document[field].blank?\n end\n true\n end", "def test_presence\n item = Item.new\n assert !item.valid?\n assert_equal @@error[:blank], item.errors.on(:user_id)\n assert_equal @@error[:blank], item.errors.on(:date)\n assert_equal @@error[:blank], item.errors.on(:value)\n end", "def blank?\n true\n end", "def blank?\n true\n end", "def blank?\n true\n end", "def filled_info(opponent)\n opponent.gamertag != \"\" && opponent.game != \"\" && opponent.bracket != \"\" && opponent.characters != \"\" && opponent.score != \"\"\n end", "def creating_vault_validation_spaces(params)\n if params[\"Username\"].strip.empty? != true and params[\"Password\"].strip.empty? != true\n return true \n else \n return false\n end \n end", "def assert_presence(model, field)\n model.valid?\n assert_match /can't be blank/, model.errors[field].join, \"Presence error for #{field} not found on #{model.class}\"\n end", "def assert_presence(model, field)\n model.valid?\n assert_match /can't be blank/, model.errors[field].join, \"Presence error for #{field} not found on #{model.class}\"\n end", "def has_invalid_fields?\n if invalids = invalid_fields(fields)\n say 'Invalid field name:', :red\n say \" #{invalids.join(\", \")}\"\n end\n end", "def check_fields\n columns= resource.model.column_names - AutoRest::AR_MAGIC_COLUMNS\n\n default_columns= columns.select { |attr| attr !~ /.*_count$/ }.map do |elem|\n [elem.intern, elem.titleize]\n end\n\n # For storing columns, I use an array and not a hash --i.e.: (:column => 'Title') -- \n # to ensure the order of the columns. I convert the params from linear array to \n # grouped array to alivianate user's data entry:\n # [[:col0, \"name0\"], [:col1, \"name1\"]] becomes [:col0, \"name0\", :col1, \"name1\"]\n \n # *TODO* This should be cleaned a little, because right now is a bit difficult\n # to remember the way the attributes for each view work.\n\n [:for_index, :for_new, :for_edit, :for_show].each do |key|\n arr= fields.send(key)\n exc= exclude_fields.send(key)\n\n if !arr # User has not supplied columns.\n arr= default_columns\n else\n # enum_for creates an enum from array, therefore protecting the original array contents.\n # each slice returns an array of specified elements: [1,2,3,4] => 1..4 => [[1,2],[3,4]]\n arr= arr.enum_for(:each_slice, 2).to_a\n end\n \n # Remove excluded fields.\n arr= arr.reject { |e| exc.map{|elem|elem.to_s}.include?(e[0].to_s) } if exc\n fields.send(\"#{key}=\", arr)\n end\n end", "def check_validity!\n # nothing\n end", "def no_nil_attributes\n GroupEvent.attribute_names.without(\"deleted\").each do |a|\n if self.send(a).blank?\n errors.add(:base, \"All fields are required to publish an event\")\n return false\n end\n end\n return true\n end", "def field_empty_afterward?(*args)\n Log.debug(\"[GRIDIUM::Element] Checking the field after sending #{args}, to see if it's empty\")\n check_again = has_characters?(*args) && no_symbols?(*args)\n field_is_empty_but_should_not_be = check_again && field_empty?\n if field_is_empty_but_should_not_be\n raise \"Browser Error: tried to input #{args} but found an empty string afterward: #{value}\"\n end\n end", "def attribute_empty?(apicall, field)\n if (apicall[field.to_sym].nil? || apicall[field.to_sym].length < 1)\n return true\n else\n return false\n end\n end", "def validate\n super\n errors.add(:name, \"can't be empty\") if name.blank?\n errors.add(:category_id, \"can't be empty\") if category_id.blank?\n errors.add(:price, \"can't be empty\") if price.blank?\n end", "def null_controlled_fields!(attrs)\n ::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|\n # do not null fields that are not being changed\n next unless attrs.keys.include?(\"#{field_name}_attributes\")\n\n object.public_send(\"#{field_name}=\", [])\n end\n end", "def validation; end", "def validation; end", "def validate\n errors.add(:post_office, \"- must be filled for postalcode #{self.postal_code}\") if self.post_office.blank? && !self.postal_code.blank?\n errors.add(:postal_code, \"- must be filled for #{self.post_office}\") if self.postal_code.blank? && !self.post_office.blank? \n errors.add_to_base(\"- Person must have at least one phonenumber\") if (self.phone_home.blank? && self.phone_cell.blank? && self.phone_work.blank?) \n end", "def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end", "def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end", "def test_blank_eobqa\n eobqa = EobQa.new(:total_fields => 10, :total_incorrect_fields => 2)\n assert_equal(false, eobqa.save)\n end", "def validation_error_check_discrepancies(ar, fields)\n\t\tmsgs = []\n\t\t# get the list of fields that have errors (err_fields)\n\t\terr_fields = []\n\t\tar.errors.each {|k,v| err_fields << k}\n\t\t# identify fields missing from the record’s errors \n\t\tmissing_errors = []\n\t\tfields.each do |field_name|\n\t\t\tmissing_errors << field_name unless err_fields.include?(field_name) #if ar.errors[field_name].blank?\n\t\tend\n\t\tif missing_errors.length > 0\n\t\t\tmsgs << \"missing validation error for fields #{missing_errors.join(', ')}\"\n\t\tend\n\t\t# identify unexpected fields in the record’s errors\n\t\tunexpected_errors = []\n\t\terr_fields.each do |field_name|\n\t\t\tunexpected_errors << field_name unless fields.include?(field_name)\n\t\tend\n\t\tif unexpected_errors.length > 0\n\t\t\tmsgs << \"unexpected errors for fields #{unexpected_errors.join(', ')}\"\n\t\tend\n\t\tif msgs.length > 0\n\t\t\tassert false, msgs.join(\".\\r\")\n\t\tend\n\tend", "def must_fill_all_fields(surfboard)\n \t\tif surfboard.surfboard_owner != current_user || !form_is_filled?\n \t\t\tflash[:errors] = \"All fields must be filled.\"\n \t\t\tredirect \"/surfboards/#{@surfboard.id}/edit\"\n \t\tend\n \tend", "def edit_fee_fields_filled\n if !params[:edit_fees].nil?\n edit_fees_vals = params[:edit_fees].values\n edit_fees_vals.each_slice(3) do |fee, time, remove|\n if fee.empty? || time.empty?\n return false\n end\n end\n end\n return true\n end", "def test_invalid_with_empty_rule_name_or_state_or_logic\n owner = people(:valid_person)\n rule = Rule.new(:person_id => owner.id)\n assert !rule.valid?\n # The rule_name field should have validation errors\n assert rule.errors[:rule_name].any?\n # The state field should have validation errors\n assert rule.errors[:state].any?\n # The logic field should have validation errors\n assert rule.errors[:logic].any?\n end", "def assert_not_empty\n if options.empty?\n raise \":length, :maxmimum or :minimum must be given as option\"\n end\n end", "def check_not_blank(data)\n data.to_s.length.should > 0\n data.to_s.delete(\"^a-zA-Z0-9\").length.should > 0\n end", "def valida_titulo\n errors.add_to_base 'avisotitulo' if tituloes.blank? and titulofr.blank? \nend", "def test_invalid_with_empty_attributes\r\n responsible_party = ResponsibleParty.new\r\n assert !responsible_party.valid?, responsible_party.errors.full_messages\r\n assert responsible_party.errors.invalid?(:first_name)\r\n assert responsible_party.errors.invalid?(:last_name)\r\n assert responsible_party.errors.invalid?(:address)\r\n assert responsible_party.errors.invalid?(:city)\r\n assert responsible_party.errors.invalid?(:state)\r\n assert responsible_party.errors.invalid?(:zipcode)\r\n end", "def validate\n validates_presence([:name, :phone])\n end", "def dont_test_not_create_invalid_order\n# # TODO: By now theres no way to make an order invalid, it accepts any blank values and saves it.\n# an_order = Order.new\n# assert !an_order.valid?\n# assert an_order.errors.invalid?(:order_number)\n# # An order must have a number.\n# assert_equal \"can't be blank\", an_order.errors.on(:order_number)\n# assert !an_order.save\n end", "def test_optional_fields\n @event.event_finish = nil\n fields = ['event_start','entry_age_limit', 'internal_note', 'entry_fee_note', 'prize_info_note']\n fields = fields + ['event_finish','entry_deadline','tickets_note', 'general_note']\n \n for field in fields\n puts \"***SETTING TO NIL:#{field}\"\n @event.send(field << '=' , nil)\n assert @event.save\n end\n end", "def fields_missing_errors(*fields)\n !fields_have_errors(*fields)\n end", "def assert_validates_presence_of(*params)\n object = params.shift\n attributes = params\n\n attributes.each do |attr|\n object.send(\"#{attr}=\", nil)\n end\n\n assert_invalid object, attributes\n end", "def required_fields\n []\n end", "def check_attributes\n if (@values == nil)\n puts \"Specify necessary informations: \"\n get_input_values\n @additions = Array.new()\n end\n #check_time_string\n end", "def valid_parionsdirect_account_params?\n status = true\n if @pseudo.blank? || @firstname.blank? || @lastname.blank? || @email.blank? || @password.blank? || @password_confirmation.blank? || @birthdate.blank?\n status = false\n end\n\n return status\n end", "def valid?\n filled?\n end", "def entered_all_obligatory_fields?(array)\n @contact_form.obligatory_field_ids.each do |field_id|\n if array.blank? || array[\"#{field_id}\"].blank?\n return false\n end\n end\n\n true\n end", "def test_necessary_existence_of_last_name\n @person.last_name = nil\n assert !@person.save\n check_for_error_messages([\"cannot be empty\",\"is too short (minimum is 2 characters)\"], @person, :last_name)\n end" ]
[ "0.76139396", "0.7068433", "0.6778111", "0.67348576", "0.67177594", "0.6701642", "0.6691128", "0.66364396", "0.6602282", "0.6596749", "0.658611", "0.65655494", "0.6564474", "0.6512758", "0.6502888", "0.6499729", "0.6473405", "0.6472589", "0.647067", "0.644545", "0.64326346", "0.6408549", "0.64023936", "0.6377972", "0.637166", "0.637026", "0.6350016", "0.6327844", "0.632531", "0.62632567", "0.6252027", "0.62359524", "0.6231311", "0.62298006", "0.6215098", "0.62105656", "0.62039906", "0.61944795", "0.6186332", "0.6182432", "0.6172939", "0.6166043", "0.61507136", "0.61333245", "0.61315525", "0.61212283", "0.61072874", "0.61014587", "0.6100062", "0.6088065", "0.60775745", "0.6069124", "0.60625", "0.60616416", "0.6054556", "0.6052393", "0.60283685", "0.60283685", "0.60283685", "0.602739", "0.6023665", "0.60234874", "0.60234874", "0.60234874", "0.6008001", "0.60005975", "0.5999875", "0.5999875", "0.5994933", "0.59920746", "0.59847975", "0.5984397", "0.59826636", "0.5976748", "0.5972263", "0.59721243", "0.5968399", "0.5968399", "0.59658325", "0.5959616", "0.5959616", "0.59528863", "0.594842", "0.59410834", "0.59210724", "0.5920833", "0.5918525", "0.59141153", "0.5907179", "0.5895652", "0.5895639", "0.58955127", "0.58930963", "0.58907735", "0.5889193", "0.58883446", "0.5885192", "0.5883253", "0.5882021", "0.5881962", "0.5880942" ]
0.0
-1
global varible so that each recursion can use same one
def fibo_rec(target_number) if target_number<1 $series[0]=0 return 0 elsif target_number=1 $series[1]=1 fibo_rec 0 return 1 else ans=fibo_rec(target_number-1)+(fibo_rec(target_number-2)) $series[target_number]=ans return ans end return $series end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive => nil", "def recursive_solution\n\n end", "def global; return root end", "def depth=(_arg0); end", "def nesting() end", "def one_singleton_ancestors_cache; end", "def my_depth\n 1\n end", "def global; end", "def recurse_local\n result = perform_recursion(self[:path])\n return {} unless result\n result.inject({}) do |hash, meta|\n next hash if meta.relative_path == \".\"\n\n hash[meta.relative_path] = newchild(meta.relative_path)\n hash\n end\n end", "def parent_variable; end", "def not_reset_scope?(node); end", "def getlocal() end", "def outer; end", "def lvlres\n @level = 0\n lvlup\n end", "def singleton_ancestors_cache; end", "def build_default_proc(_left, _right, _total, _path, _last_height)\n ->(h, level) do\n left, right, total, path, last_height = _left, _right, _total, _path, _last_height\n levels = level - last_height\n if path == 1\n increase = left * levels\n path = 0\n total += increase\n right += increase\n else\n increase = right * levels\n path = 1\n total += increase\n left += increase\n end\n last_height = level\n nested = {\n left: left,\n right: right,\n total: total,\n path: path,\n next: nested\n }\n nested.default_proc = build_default_proc(left, right, total, path, last_height)\n\n\n h[level] = nested\n end\nend", "def factorial_recursive(num)\n if num == 0\n 1\n else \n num * factorial_recursive(num-1)\n \n # 7 * 6 = 42\n # 42 * 5 = 210\n # 210 * 4 = 840\n # 840 * 3 = 2520\n # 2520 *2 = 5040\n # 5040* 1 = 5040\n end\nend", "def recursion(x)\n return \"HEYO!\" if x >= 5\n puts x\n recursion(x += 1)\nend", "def dfs_rec(target)\n dfs_recursive_helper(target,@root)\n end", "def _level1\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_apply)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_grouped)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_level0)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_level1 unless _tmp\n return _tmp\n end", "def process_tree_with_renew\n @process_tree = nil\n process_tree\n end", "def dfs_rec(target,current,array_length,stack,visited)\n left = current.find_left_child[0]\n right = current.find_right_child[0]\n parent = current.find_parent[0]\n if current.value == target\n return current\n elsif visited.length == array_length\n return nil\n elsif !left.nil? && !visited.include?(left)\n stack.push(left)\n visited.push(left)\n dfs_rec(target,left,array_length,stack,visited)\n elsif !right.nil? && !visited.include?(right)\n stack.push(right)\n visited.push(right)\n dfs_rec(target,right,array_length,stack,visited)\n else\n stack.pop\n dfs_rec(target,parent,array_length,stack,visited)\n end\nend", "def stack; end", "def stack; end", "def current_depth\n 0\n end", "def naked_top_level; end", "def factorial_recursion(number)\n\t\ttotal = number\n\tif number > 0\n\t\ttotal = total \n\t\t\n\telse\n\t\tputs total\n\tend\n\n\n\nend", "def global_scope; @scope = :global end", "def next_in_chain\n @_next_in_chain ||= nil\n @_next_in_chain\n end", "def depth; end", "def my_recursive_method # Thanks to Zach for help with this method!\n\tputs \"What do you want to know?\"\n\tputs \"Please choose a number 1-16\"\n\tputs \"1. Local vs. Remote\"\n\tputs \"2. FTP\"\n\tputs \"3. Accessing your Server\"\n\tputs \"4. HTML vs Ruby\"\n\tputs \"5. Ruby's History\"\n\tputs \"6. What is programming?\"\n\tputs \"7. Variables\"\n\tputs \"8. Floats and Integers\"\n\tputs \"9. Strings\"\n\tputs \"10. Booleans\"\n\tputs \"11. Arrays\"\n\tputs \"12. Hashes\"\n\tputs \"13. Conditions\"\n\tputs \"14. Loops\"\n\tputs \"15. Methods\"\n\tputs \"16. Objects\"\n\tputs \"Type 'exit' to end program.\"\n\tchoice = gets.chomp.to_i\n\tif choice == 1\n\t\tputs \"So you want to learn about Local vs. Remote files...\"\n\t\tputs \"If your files stay on your computer and you access them from there, then your website is local.\"\n\t\tputs \"If you're uploading your files to a server and then accessing them on that server, your website is remote.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 2\n\t\tputs \"So you want to learn about FTP...\"\n\t\tputs \"FTP stands for 'File Transfer Protocol'.\"\n\t\tputs \"It gets your files to the remote server.\"\n\t\tputs \"Popular clients (Applications) include Fetch, Cyberduck, and FileZilla.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\n\telsif choice == 3\n\t\tputs \"Ok, you want to know about accessing your server...\"\n\t\tputs \"You will need a hostname, username, and password.\"\n\t\tputs \"These are typically provided by your host.\"\n\t\tputs \"Port 21 is FTP, port 22 is SFTP.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 4\n\t\tputs \"Ok, you want to know about HTML vs Ruby...\"\n\t\tputs \"Ruby is logic based.\"\n\t\tputs \"It's not used to markup, it's used to make decisions.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 5\n\t\tputs \"So, you want to know about Ruby's history?\"\n\t\tputs \"Ruby was written by Yukihiro 'Matz' Matsumoto in the mid 1990s.\"\n\t\tputs \"It was implemented in C.\"\n\t\tputs \"At a Google Tech Talk in 2008 Matsumoto further stated,\"\n\t\tputs \"'I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy.\"\n\t\tputs \"That is the primary purpose of Ruby language.'\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 6\n\t\tputs \"Ok, you want to know about Programming...\"\n\t\tputs \"Basically, programming is defining commands, issuing them, and the ensuring they get executed.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 7\n\t\tputs \"Ok, so you want to learn about Variables...\"\n\t\tputs \"Think of variables like you would in Alegbra.\"\n\t\tputs \"5+x=14 => Solve for x => x=9\"\n\t\tputs \"Variables are containers for values.\"\n\t\tputs \"x=5 or y='Zach' or q=x+r\"\n\t\tputs \" \"\n\t\tputs \"Variables also have many differnt types.\"\n\t\tputs \"1. Float ­ numbers with decimal points: 10.32, 65.323, .32\"\n\t\tputs \"2. Integer ­ natural numbers ­ 11, 53, 3\"\n\t\tputs \"3. Strings ­ a line of text ­ 'Jon', 'Elephants are awesome'.\"\n\t\tputs \"4. Boolean ­ either true or false.\"\n\t\tputs \"5. Arrays ­ a collection of values ­ [5,3,12,'omega']\"\n\t\tputs \"6. Objects ­ a representation of something in the real world, with properties and methods.\" \n\t\tputs \" A Car object would have brakes, and a method to make the car move.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 8\n\t\tputs \"Ok. Here are the different Data Types...\"\n\t\tputs \"Floats are numbers with decimal points.\"\n\t\tputs \"Examples are: 10.32, 65.323, 0.32\"\n\t\tputs \"Integers are natural numbers. Meaning they are whole and have no decimals.\"\n\t\tputs \"Examples are: 11, 53, 3\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 9\n\t\tputs \"Ok. Lets talk about Strings...\"\n\t\tputs \"Strings are lines of text.\"\n\t\tputs \"Examples are: Jon, '12' + '12'\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 10\n\t\tputs \"Ok lets talk about Booleans.\"\n\t\tputs \"Booleans are either true or false.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 11\n\t\tputs \"Lets talk about Arrays...\"\n\t\tputs \"An array is a collection of values.\"\n\t\tputs \"For example: [5,3,4,'omega', 15.3, 'cappa']\"\n\t\tputs \"When assigned to variables, can be accessed with brackets[]\"\n\t\tputs \"For example: a = [5,3,4,'omega', 15.3, 'cappa']\"\n\t\tputs \"a[0] == 5, a[4] == 15.3\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 12\n\t\tputs \"Lets talk about Hashes!\"\n\t\tputs \"Hashes are another way to store data - similar to an array.\"\n\t\tputs \"It's used to store key => value pairs.\"\n\t\tputs \"For example: myHash = {jan: 'January', feb: 'February'}\"\n\t\tputs \"To access value: myHash['January']\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 13 \n\t\tputs \"Ok. Lets talk about Conditions...\"\n\t\tputs \"A condition is a test for something.\"\n\t\tputs \"if 'this' then 'that'\"\n\t\tputs \"For example: if (2 == 2) puts '2 really does equal 2!'\"\n\t\tputs \"Conditions contain 'if', 'elsif', 'else', and 'end'.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 14\n\t\tputs \"Ok. Lets talk about Loops...\"\n\t\tputs \"Loops are repetitive conditions where one variable changes.\"\n\t\tputs \"There are For, While, Each, and Begin...rescue..end\"\n\t\tputs \"(more examples go here)\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 15\n\t\tputs \"Lets talk about Methods!\"\n\t\tputs \"Methods are shortcuts to a block of code.\"\n\t\tputs \"They take arguments and they typically return a value.\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == 16\n\t\tputs \"Lets talk about Objects...\"\n\t\tputs \"Objects are a representation of something in the real world.\"\n\t\tputs \"They have properties and methods.\"\n\t\tputs \"For instance: a Car has an engine, and a method to start the engine.\"\n\t\tputs \"Instance vs Class Methods require a new instance of the class to work (def addTwo).\"\n\t\tputs \"Class methods will work without a new instance (def self.addTwo).\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\telsif choice == \"exit\n\t\tputs \"goodbye...\"\n\t\tputs \" \"\n\telse puts \"Oops! Please enter a number between 1-17\"\n\t\tputs \" \"\n\t\tputs \"Press 'Enter' to continue...or type 'exit' to stop.\"\n\t\texit = gets.chomp\n\t\t\tif exit == \"exit\"\n\t\t\t\tputs \"goodbye...\"\n\t\t\t\tputs \" \"\n\t\t\telse my_recursive_method\n\t\t\tend\n\tend", "def printDepthFirst()\n # println(\"printDepthFirst\");\n # # // global fileCounter\n # @fileCounter = 0;\n # printRealDepthFirst(0,-1);\n # println(fileCounter+\" files\");\n end", "def run_recursive_loop &block\n results = yield\n return results\nend", "def recursion(x)\n return \"HEYO!\" if x >= 5\n puts x\n recursion x += 1\nend", "def recursion(x)\n return \"HEYO!\" if x >= 5\n puts x\n recursion x += 1\nend", "def factorial_non_recursion(numbers)\n numbers.each do |number|\n result = 1 # <-- reset result to 1 so factorial results from other numbers aren't combined together\n numbers_to_calculate = numbers_to_calculate_factorial(number)\n numbers_to_calculate.each {|number| result *= number}\n puts \"The factorial of the the number #{number} is #{result}\"\n end\nend", "def spielen(levels, start)\r\n\t# next_lvl wird mit dem ersten level (\"start\") initialisiert\r\n\t# diese zusatzvariable brauchen wir, da sonst immer nur \"start\" \r\n\t# als level in der while-Schleife unten nutzen würden. Wir wollen\r\n\t# jedoch die level wechseln können\r\n\tnext_lvl = start\r\n\t\r\n\twhile true\r\n\t\t# lvl wird mit als startlevel aus dem ROOMS initialisiert\r\n\t\t# start entspricht dabei der funktion \"def start\"\r\n\t\tlvl = levels[next_lvl]\r\n\t\tputs \"\\n-- -- -- --\"\r\n\t\tnext_lvl = lvl.call()\r\n\tend\r\nend", "def root=(_arg0); end", "def root=(_arg0); end", "def root=(_arg0); end", "def root=(_arg0); end", "def one_instance_ancestors_cache; end", "def recursive_factorial(number)\n\nend", "def recursive_factorial(number)\n\nend", "def dfs_rec(tree, value, args = {})\r\n verbose = args.fetch(:verbose, false)\r\n return nil if tree == nil \r\n return nil if tree.visited == true\r\n tree.visited = true\r\n return tree if tree.value == value\r\n puts \"current = #{tree}\" if verbose\r\n left = dfs_rec(tree.children[0], value, args)\r\n return left if left != nil\r\n right = dfs_rec(tree.children[1], value, args)\r\n return right # if right != nil\r\n end", "def find_recur_target\n nil\n end", "def naked_top_level?; end", "def buildArray(localObjCache, increase)\n localDirContents=[] #Array of all items in the cwd\n localDirContents=Dir[Dir.pwd+\"/*\"] #Builds the array of items in cwd\n\n localDirContents.each do |item|\n if File.file?(item)\n fileObj = FileName.new(item)\n localObjCache.push(fileObj)\n n = increase.call #printing every 100 files scanned\n if n % 100 == 0\n puts n\n end\n elsif File.directory?(item)\n Dir.chdir(item)\n buildArray(localObjCache, increase) \n end\n end\n\n return localObjCache\n end", "def find_beeper()\n while not next_to_a_beeper?()\n move_toward_beeper()\n end\n end", "def recursion(number)\n if number == 1\n return number\n else\n p number\n recursion(number - 1)\n end\nend", "def traverse; end", "def combine_variables(x)\n # We call the global variable a as the argument below, which replaces x and outputs 4\n puts \"inner x is: #{x}\"\n # We call b, which is still defined in the previous sister method as 12\n puts \"and outer b is: #{b}\"\n # Now w redefine b within this method\n b = \"pizza\"\n # This line outputs with the new definition of b\n puts \"but now b is: #{b}\"\nend", "def factorial_recursive(n)\n\tif n == 0\n\t\treturn 1 # 0! = 1\n\telse\n\t\treturn n*factorial_recursive(n-1) #keep calling the function\n\tend\nend", "def recursive?\n false\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 parentage\n get_parents unless @already_fetched_parents\n @already_fetched_parents = true\n super\n end", "def globals; end", "def globals; end", "def sum_recurse(num)\n return 0 if num == 0\n num[0] + sum_recurse(num.delete(1))\nend", "def recursive?\n @recursive\n end", "def previously_ran?; end", "def previously_ran?; end", "def traverse_folders(nav_level, parent, parent_link, parent_full_link, node_folder_path) \n\n\t\tnode_list = []\n\t\n\t\t#puts \"traverse_folders(#{nav_level.to_s}, #{parent}, #{node_folder_path})\"\n\t\n\t\tsubfolders = nil\n\t\tbegin\n\t\t\tsubfolders = Dir.entries(node_folder_path).select {|entry| File.directory? File.join(node_folder_path, entry) and !(entry == '.' || entry == '..' || entry == 'assets' || entry == 'images') }\n\t\trescue Errno::ENOENT\n\t\t\tputs \"ERROR: No File or Directory [#{node_folder}]\"\n\t\t\tputs puts\n\t\t\texit\n\t\tend\t \n\t\t\n\t\tsubfolders.each do |folder|\n\t\t\tnode = Map.new\n\n\t\t\tsub_path = node_folder_path + \"/\" + folder\n\t\t\n\t\t\tlink = (parent_link.length == 0 ? \"\" : parent_link + \"/\" ) + folder\n\t\t\tfull_link =\t (parent_full_link.length == 0 ? \"/\" : parent_full_link + \"/\" ) + folder\n\t\t\t\t\n\t\t\tnode = Map.new({\n\t\t\t\tdoctype: \"nav\",\n\t\t\t\tsubtype: \"nav_\" + nav_level.to_s,\n\t\t\t\tnav_type: (File.exist?(\"#{sub_path}/../#{folder}.markdown\") ? \"folder+markdown\" : \"folder\"),\n\t\t\t\tnav_level: nav_level,\n\t\t\t\tnav_order: 9000,\n\t\t\t\tnav_title: process_navigation_name(folder),\t\t\t \n\t\t\t\tsource: folder,\n\t\t\t\tlink: link,\n\t\t\t\tfull_link: full_link,\n\t\t\t\tparent: parent,\n\t\t\t\tparent_nav_title: process_navigation_name(parent_link),\n\t\t\t\tparent_link: parent_link,\n\t\t\t\tparent_full_link: parent_full_link,\n\t\t\t\tparent_path: node_folder_path,\n\t\t\t\tsource_path: sub_path,\n\t\t\t\tancestors: [],\n\t\t\t\tancestors_links: [],\n\t\t\t\tsiblings: [],\n\t\t\t\tsiblings_links: [],\n\t\t\t\tdescendants: [],\n\t\t\t\tdescendants_links: [],\n\t\t\t\tnavigation_yml: (File.exists? (sub_path + \"/aaaa-navigation.yml\")),\n\t\t\t\tindex_erb: (File.exists? (sub_path + \"/index.erb\"))\n\t\t\t})\n\t\t\t\t\n\t\t\titems = traverse_folders(nav_level + 1, folder, link, full_link, sub_path)\n\t\t\n\t\t\tif items.size > 0\n\t\t\t\t node.children = {}\n\t\t\t\t node.children.count = items.size\n\t\t\t\t node.children.items = items\n\t\t\tend\n\t\t\n\t\t\tnode_list << node\n\t\tend\n\t\n\t\tnode_list\n\t \n\tend", "def recursion_test\n begin\n fibonacci = Fibonacci.new\n fibonacci.get_via_recursion(TEST_VALUE)\n rescue SystemStackError => e\n STDERR.puts 'recursion depth death'\n -1\n end\n end", "def local_variable_scope\n parent.local_variable_scope\n end", "def use_global_memo; CurrentParser[:global_memo ]=true; end", "def recurse_trade(node, route, items, visited={})\n \tif node == route[0]\n \t\troute << node\n \t\treturn route\n \telsif visited[node]\n \t\treturn\n \telse\n \t\tvisited[node] = true\n \t\troute << node\n \t\titems_children(node, items).each do |child|\n if child.new_owner\n next\n end\n \t\t\tresult = recurse_trade(child, route, items, visited)\n if result and result.count > 1\n # puts \"RESULT is #{result.count}\"\n # puts \"Result first is #{result.first}\"\n # puts \"Result last is #{result.last}\"\n return result\n else\n end\n \t\t\t# return result if result\n \t\tend\n \tend\t\t\n end", "def cache_ancestry\n self.names_depth_cache = path.map(&:name).join('/')\n end", "def next_in_chain\n @_next_in_chain ||= nil\n @_next_in_chain\n end", "def local_scope; @scope = :local end", "def _init_cache\n @cache_parent = {}\n end", "def get_root()\n \n end", "def relative_access\n @define_relative_access = @define_nesting = true\n '$$'\n end", "def no_circular_reference\n\n end", "def recurse_result_set(result, options = {}, &block)\n return result unless block_given? \n inner_recursion = options.delete(:inner_recursion)\n result_set = inner_recursion ? result : result.dup\n \n parent_id = (options.delete(:parent_id) || result_set.first[result_set.first.parent_col_name]) rescue nil\n options[:level] ||= 0\n options[:nested] = true unless options.key?(:nested)\n \n siblings = options[:nested] ? result_set.select { |s| s.parent_id == parent_id } : result_set \n siblings.sort! {|a,b| a.send(options[:sort_on]) <=> b.send(options[:sort_on])} if options[:sort_on]\n siblings.each do |sibling|\n result_set.delete(sibling) \n block.call(sibling, options[:level])\n opts = { :parent_id => sibling.id, :level => options[:level] + 1, :inner_recursion => true, :sort_on => options[:sort_on]} \n recurse_result_set(result_set, opts, &block) if options[:nested]\n end\n result_set.each { |orphan| block.call(orphan, options[:level]) } unless inner_recursion\n end", "def parentloop; end", "def dfs_object(root_node, target)\n #two base cases\n return root_node if root_node.value == target\n # return nil if root_node.parent.nil? #when there are no parents, we know we're back at the actual root of the tree\n\n root_node.children.each do |child_node|\n result = dfs(child_node, target)\n\n #returning nil at this point would cut short\n if result #is not nil\n return result\n end\n end\n\n nil\nend", "def fibonacciRecurse(a,b,depth)\n\tif depth>0\n\t\treturn String(a+b)+\" \"+fibonacciRecurse(b, a+b, depth-1)\n\telse\n\t\treturn \"\"\n\tend\nend", "def find_var(name, depth = 0)\n return @self_reference if name == @name\n\n @parent.find_var(name, depth + 1)\n end", "def recursive_traverse(node, current_state)\n Log.debug \"visiting #{node.name}\"\n current_state.timelines.first << node.name\n if node.downstream.empty?\n Log.debug \"#{node.name} has no downstream nodes. Reached end of timeline\"\n return current_state\n elsif node.downstream.size == 1\n Log.debug \"#{node.name} only one downstream node. Moving to it now.\"\n return recursive_traverse node.downstream.first, current_state\n else\n Log.debug \"#{node.name} has #{node.downstream.size} downstream nodes. Investigating merge options.\"\n\n timeline_forks = node.downstream.collect { |down|\n downstream_fork_states = recursive_traverse(down, TimelineState.new).timelines\n raise \"Downstream partial merge detected. This type of merge is not yet supported\" unless downstream_fork_states.size == 1\n downstream_fork_states.first\n }\n common_elems = timeline_forks.inject { |sum, nex| sum & nex }\n\n common_elem = common_elems.first\n base_forks = timeline_forks.select { |f| f.first.equal? common_elem }\n if common_elem.nil?\n current_state.state = 'No merge is possible'\n\n timelines = timeline_forks.collect { |f|\n (current_state.timelines + f).flatten\n }\n\n current_state.timelines = timelines\n\n elsif base_forks.empty?\n current_state.state = 'Partial merge is possible'\n\n common_elem_index = timeline_forks.first.find_index common_elem\n agreed_tail_arry = timeline_forks.first.slice(common_elem_index, timeline_forks.first.size - 1)\n\n disputed_events_array = timeline_forks.collect { |f|\n term = f.find_index common_elem\n f.slice(0, term)\n }\n\n # could iterate over permuations of parallel events here to list all possible timelines, but outside of problem description\n possible_timelines = disputed_events_array.collect { |p|\n (current_state.timelines + p + agreed_tail_arry).flatten\n }\n\n current_state.timelines = possible_timelines\n\n elsif base_forks.size == 1\n current_state.state = 'Merge is possible'\n Log.debug 'Full merge possible'\n\n longest_merge_array = timeline_forks.sort_by(&:size).last\n current_state.timelines = [(current_state.timelines + longest_merge_array).flatten]\n else\n raise 'Only one base fork should be found!'\n end\n\n end\n current_state\n end", "def _parent; end", "def last_context=(_arg0); end", "def nested_set_recurse(set, &block)\n block.call self, lambda{\n index = set.index(self) + 1\n while set[index].parent_id == self.id\n set[index].nested_set_recurse(set, &block)\n index += 1\n end\n }\n end", "def crawl(&blk)\r\n while crawlNext(&blk)\r\n end\r\n end", "def recursive_search(path,current_depth)\n # If we haven't hit our max depth\n if current_depth < @depth \n sub_hash = @wiki\n # Follow our path down the hash\n path.each do |node|\n sub_hash = sub_hash[node]\n end\n\n # Expand this node of the sub-tree\n sub_hash.keys.each do |link|\n sub_hash[link] = get_links(\"http://en.wikipedia.org#{link}\")\n # Here's our magic recursion, add this node to the\n # path, increment our depth, and traverse that\n recursive_search(path+[link],current_depth+1)\n end\n\n end\nend", "def cross_pipeline\n strong_memoize(:cross_pipeline) do\n fetch_dependencies_in_hierarchy\n end\n end", "def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r.size\n assert_equal 4, find_node('1_1_2_1_1').ancestors_r.size\n end", "def find_closest_value(target, item_count, acc_sum, k, multi)\n\tputs \"calling function\"\n\n #puts \"k = \" + k.to_s + \" acc_sum = \" + acc_sum.to_s + \" multi = \" + multi.to_s\n #puts \"k = \" + k.to_s + \" multi = \" + multi.to_s\n #item_count.each { |x| puts x }\n\n\n #checks current accumulated value with current max value to find the best match of given subset\n if acc_sum > $max_val\n $max_val = acc_sum\n #puts \"max value set \" + acc_sum.to_s\n #item_count.each { |x| puts x }\n $max_mul = item_count\n puts \"#{item_count}\"\n return item_count\n end\n\n #item_count contains the list of multipliers. is set here to the multiplier value\n item_count[k] = multi\n #item_count.insert(k, multi)\n puts multi.to_s\n #BASE CASE TO END RECURSION\n if multi == 0\n return 0\n end\n\n #If exact match found to target the max value is set and returns false to destroy whole recursive stack\n if acc_sum + $price[k] * item_count[k] == target\n $max_val = acc_sum + $price[k] * item_count[k]\n #item_count[k] = item_count[k] + 1\n puts \"max value set \" + $max_val.to_s\n $max_mul = item_count\n $max_mul.each { |x| puts x }\n return false\n\n#This step used to go deeper into the recursive stack only if more elements are present in the given set\n#And also checks if current value + old accumulated value doesnt exceed the target sum given\n elsif k + 1 < $n && acc_sum + $price[k] * item_count[k] <= target\n item_count = find_closest_value(target, item_count, acc_sum + $price[k] * item_count[k], k+1, (target-$price[k] * item_count[k])/$price[k+1])\n #used to destroy recursion when perfect match is found\n puts \"Next max value set \" + $max_val.to_s\n if item_count == false\n return false\n end\n end\n\n # if k+1 < $n && acc_sum + $price[k] * (item_count[k-1] - 1) + ((target - acc_sum) / $price[k + 1]) * $price[k + 1] <= target\n # item_count[k] = item_count[k] - 1\n # find_closest_value(target, item_count, acc_sum + $price[k] * item_count[k - 1], k+1, (target - acc_sum)/$price[k+1])\n # end\n\n # elsif\n temp = [0,0,0,0,0,0]\n #puts \"k last = \" + k.to_s\n #item_count.each { |x| puts x }\n #recursive call with multiplier reduced by 1 for the same element in the set\n find_closest_value(target, temp, acc_sum, k, multi - 1)\n # end\nend", "def max_path_sum(root)\n @max = -999999\n max_path_recursive(root)\n return @max\nend", "def dfs_helper\n end", "def semplice\r\n puts \"senza parentesi\"\r\nend", "def global\n raise NotImplementedError\n end", "def set_Recursive(value)\n set_input(\"Recursive\", value)\n end", "def change\n $global = 99\nend", "def global_var\n $global_var \nend", "def build_self(build_once = true)\n self.result = @children.collect {|p| p.last.build }.uniq\n end", "def deep_cur\n self.cur.deep_cur\n end", "def find_recur_target\n self\n end", "def depth_of(score)\n if include?(score) #This is calling the method on line 44\n 1 + @root_node.depth_of(score) \n else \n nil\n end \nend", "def depth_first(value)\n\tend", "def recurse_call(*args)\n # # create a state for the call.\n # call_state = SequencerT.current.step\n\n # Get the variables for handling the stack overflow.\n stack_ptr = @stack_ptr\n depth = @depth \n argsIdx = @argsIdx\n this = self\n\n # Adds the argument to the stack if no overflow.\n HDLRuby::High.top_user.hif(stack_ptr < depth) do\n # hprint(\"stack_ptr=\",stack_ptr,\" depth=\",depth,\"\\n\")\n # Adds the arguments and the return state to the current stack frame.\n # Since not pushed the stack yet for not loosing the previous\n # arguments, add +1 to the offset when poking the new arguments.\n # args.each_with_index { |arg,i| self.poke(@argsIdx + i,arg,1) }\n args.each_with_index { |arg,i| this.poke(argsIdx + i,arg,1) }\n end\n\n # Push a new frame.\n self.push_all\n\n # create a state for the call.\n call_state = SequencerT.current.step\n\n # Prepare the handling of overflow\n call_state_value = call_state.value\n overflow = @funcE.overflow\n if overflow then\n HDLRuby::High.top_user.hif(stack_ptr > depth) do\n HDLRuby::High.top_user.instance_exec(&overflow)\n end\n end\n\n # Get the state value of the function: it is the state\n # following the first function call.\n func_state_value = @state.value + 1\n # Do the call.\n call_state.gotos << proc do\n HDLRuby::High.top_user.instance_exec do\n hif(stack_ptr <= depth) do\n next_state_sig <= func_state_value\n end\n helse do\n # Overflow! Skip the call.\n next_state_sig <= call_state_value + 1\n # if overflow then\n # # There is some overflow code to execute.\n # HDLRuby::High.top_user.instance_exec(&overflow)\n # end\n end\n end\n end\n\n return call_state\n end" ]
[ "0.6926839", "0.63375765", "0.59233725", "0.5814848", "0.5782792", "0.5763344", "0.57407284", "0.56935567", "0.5641538", "0.56200415", "0.5612161", "0.5598958", "0.5568708", "0.55281496", "0.55179334", "0.5499403", "0.5471157", "0.5402655", "0.5388618", "0.53799194", "0.5338421", "0.5329672", "0.5325305", "0.5325305", "0.53190255", "0.5311001", "0.5309738", "0.53036594", "0.5299187", "0.52980703", "0.5281968", "0.52775365", "0.52712774", "0.5270959", "0.5270959", "0.524751", "0.52436906", "0.5243005", "0.5243005", "0.5243005", "0.5243005", "0.5241912", "0.5238466", "0.5238466", "0.5231395", "0.5224736", "0.52226585", "0.5217449", "0.52168846", "0.5213709", "0.52010185", "0.5167903", "0.5151904", "0.51464456", "0.5136901", "0.5129661", "0.5125788", "0.5125788", "0.51218873", "0.5118206", "0.5108542", "0.5108542", "0.5105625", "0.5101437", "0.5100856", "0.50958955", "0.50945", "0.5086558", "0.5077507", "0.50771046", "0.5073437", "0.5061489", "0.5059236", "0.50513285", "0.50389194", "0.5037031", "0.503214", "0.5021712", "0.50206244", "0.501746", "0.5014125", "0.50059277", "0.49967757", "0.49936113", "0.49904957", "0.49831402", "0.49815017", "0.49813586", "0.49810416", "0.49806216", "0.49798843", "0.49774662", "0.49766967", "0.49729154", "0.49703828", "0.49679163", "0.4960262", "0.49591795", "0.4957954", "0.49536678", "0.49534655" ]
0.0
-1
:section: Basics Some commands sometimes cause side effects. When evaluating arguments, if you discover that undoing doesn't make sense, and will be confusing to the user, call dont_undo, and the interpreter will ignore the call for purposes of undoing
def dont_undo @should_undo = false return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def undo\n\t\t\n\tend", "def undo\n\t\t\n\tend", "def test_undo_quick_start\n job 'jobbist'\n\n start 'jobbist'\n pause\n start\n message = undo\n assert_message(lines(undid_prefix('quick_start'),\n undid_restart_quickly('jobbist')),\n message)\n\n job 'background'\n background 'background'\n\n stop_day\n start_day\n start 'jobbist'\n pause\n start\n\n message = undo\n assert_message(lines(undid_prefix('quick_start'),\n undid_pausing_start_quickly('background')),\n message)\n\n # For laughs, undo way back.\n assert_match(undid_re('pause'), undo) # undo pause\n assert(@session.running?('jobbist'))\n assert(@session.paused?('background'))\n\n assert_match(undid_re('start'), undo) # undo start jobbist\n assert(@session.stopped?('jobbist'))\n assert(@session.running?('background'))\n \n assert_match(undid_re(\"start_day\"), undo) # undo start_day\n assert(@session.stopped?('jobbist'))\n assert(@session.stopped?('background'))\n\n assert_match(undid_re('stop_day'), undo) # undo stop_day\n # This puts us back to the pause of jobbist because the start\n # was undone.\n assert(@session.paused?('jobbist'))\n\n assert(@session.jobs['background'].is_background?)\n assert_match(undid_re('background'), undo) # undo background\n assert_equal(false, @session.jobs['background'].is_background?)\n\n assert_match(undid_re(\"job\"), undo) # undo job\n assert_equal(false, @session.jobs.has_key?('background'))\n\n assert_match(undid_re('pause'), undo) # pause jobbist\n assert(@session.running?('jobbist'))\n\n assert_match(undid_re('start'), undo) # start jobbist\n assert(@session.active_records.empty?)\n assert(@session.records.empty?)\n\n assert_match(undid_re('job'), undo) # job 'jobbist'\n assert(@session.jobs.empty?)\n end", "def options_undo opts, colors\n\t\t\t\topts.separator \"\"\n\t\t\t\topts.separator \" *\".colorize(colors[:cyan]) + \" undo, u\".colorize(colors[:yellow]) + \n\t\t\t\t\" undos a completed task\".colorize(colors[:magenta])\n\t\t\t\topts.separator \" usage: \".colorize(colors[:cyan]) + USAGE[:undo].colorize(colors[:red])\n\t\t\t\topts.separator \" -n references a task by its number\"\n\t\t\tend", "def undo\n\t\t\t\t\n\t\t\tend", "def undoables(*args)\n args = [:all] if args.size == 0\n @operations.find(:not_undone, *args)\n end", "def undo\n $log.debug \" got UNDO call #{@pointer}, sz:#{@actions.size} \"\n return if @pointer == 0\n @reject_update = true\n @pointer -=1 #if @pointer > 0\n @source.repaint_required true\n @reject_update = false\n edit = @actions[@pointer]\n perform_undo edit\n end", "def can_undo?; @last_done >= 0; end", "def can_redo\n false\n end", "def can_undo(possible)\n #@tool_buttons[:undo].enabled = possible\n end", "def undo\n\t\tundoCommandList.each do |commandItem|\n\t\t\tcommandItem.undo\n\t\tend\n\tend", "def can_undo?\n !send_message(:CANUNDO).zero?\n end", "def undo\n if !(isAtBeginning)\n @actions[@index].applyOpposite\n @index -= 1\n end\n end", "def undo!(modifier = nil, options_or_version = nil)\n undo(modifier, options_or_version)\n save!\n end", "def skips=(_arg0); end", "def undo\n raise \"Can't undo unless there are commands in past\" unless can_undo?\n\n @actions[@last_done].undo\n @last_done -= 1\n\n nil\n end", "def undo\n\t\t@memo.call\n\tend", "def onTransactionUndo(_)\n return if !tool_active? || @undone\n\n @undone = true # prevent recursion\n Sketchup.undo # call a second undo since new operation has already started\n update_comp\n refresh_html\n end", "def nop(*argv) end", "def -(arg0)\n end", "def -(arg0)\n end", "def undo(all = false)\n @operations.find(:not_undone, (all ? :last : :first)).undo\n end", "def not _args\n \"not _args;\" \n end", "def test_undo_quick_stop_no_resumption\n job 'kvik'\n\n mark = Time.set(Time.now)\n start 'kvik'\n Time.advance(30.hours)\n stop\n Time.advance(3.minutes)\n\n message = undo\n assert_message(lines(undid_prefix('quick_stop'),\n undid_stop(mark, 30.hours + 3.minutes,\n 'kvik', 'running')),\n message)\n Time.advance(10.minutes)\n assert_message(record_list(30.hours + 13.minutes,\n [mark, 30.hours+13.minutes, 'kvik', 'running']),\n records)\n end", "def test_defun_command_2\n##### [my_command2]\n defun(:my_command2,\n :interactive => \"d\", :docstring => \"description...\") { |point|\n insert_string(\"Current point is #{point}.\"); newline\n }\n##### [/my_command2]\n assert_equal(\"d\", nth(1, commandp(:my_command2)))\n assert_equal(\"description...\", documentation(:my_command2))\n assert_equal(\"Current point is 1.\\n\",\n with_temp_buffer_string{ call_interactively(:my_command2) })\n end", "def undo_penalty\n 2 ** self.undo_count\n end", "def _entry_3_invalidcommand(*args)\n\n end", "def _entry_4_invalidcommand(*args)\n\n end", "def drop _args\n \"drop _args;\" \n end", "def undo\n fan.off\n end", "def underwater _args\n \"underwater _args;\" \n end", "def undo\n light.off\n end", "def _entry_2_invalidcommand(*args)\n\n end", "def _entry_6_invalidcommand(*args)\n\n end", "def send_undoable(method_args, *undoable_options)\n if method_args.is_a? Array\n method_name = method_args.shift\n else\n method_name = method_args\n method_args = []\n end\n \n result = nil\n undo_manager.execute(*undoable_options) {result = self.send(method_name, *method_args)}\n result\n end", "def add_original_commands; end", "def undo!\n bb = @stack.pop\n set_black(bb[:black])\n set_white(bb[:white])\n end", "def perform_redo act\n row = act.row\n col = act.index0\n $log.debug \" REDO processing #{act} \"\n case act.type\n when :INSERT\n @source.list[row].insert(col, act.text)\n when :DELETE\n row = act.row\n col = act.index0\n howmany = act.index1 - col\n @source.list[row].slice!(col,howmany)\n when :DELETE_LINE\n #$log.debug \" UNDO redo got deleteline #{row} \"\n #@source.list.delete_at row\n # changed on 2010-05-23 12:21 since was not handling mult delete\n case act.text\n when Array\n act.text.size.times { @source.list.delete_at row }\n when String\n @source.list.delete_at row\n end\n when :INSERT_LINE\n case act.text\n when Array\n index = row\n act.text.each_with_index{|r,i| @source.list.insert index+i, r}\n when String\n @source.list.insert row, act.text\n end\n else\n $log.warn \"unhandled change type #{act.type} \"\n end\n end", "def _entry_5_invalidcommand(*args)\n\n end", "def rl_undo_command(count, key)\r\n if (count < 0)\r\n return 0 # Nothing to do.\r\n end\r\n while (count>0)\r\n if (rl_do_undo())\r\n count-=1\r\n else\r\n rl_ding()\r\n break\r\n end\r\n end\r\n 0\r\n end", "def removeAllActions _args\n \"removeAllActions _args;\" \n end", "def _entry_1_invalidcommand(*args)\n\n end", "def _entry_1_invalidcommand(*args)\n\n end", "def subcommand!() __subcommand__! end", "def make_redo_link\n link = params[:redo] == 'true' ? 'Undo that please!' : 'Redo that please!'\n view_context.link_to link, undo_path(@article_version.next, redo: !params[:redo]), method: :post\n end", "def __subcommand__!() @__subcommand__ end", "def undo\n\t\t@moves.undo\n\tend", "def flag _args\n \"flag _args;\" \n end", "def revert!\n %x[git checkout master]\nend", "def redo\n $log.debug \"UNDO GOT REDO call #{@pointer}, #{@actions.size} \"\n return if @pointer >= @actions.size\n @reject_update = true\n edit = @actions[@pointer]\n perform_redo edit\n @source.repaint_required true\n @pointer +=1 #if @pointer > 0\n @reject_update = false\n end", "def original_run_command=(_arg0); end", "def do_preparation_tool_undo(wdialog, pstr_a=[])\n\t\treturn false if (!valid)\n\t\treturn false if ( (!pstr_a.is_a?(Array)) || (pstr_a.empty?) )\t \n\t\tif NameRegionTool.instance.has_multiple_regions?\n\t\t\tdo_select_region_name wdialog, :callback => 'execute_preparation_tool_undo', :callback_params => pstr_a[0]\n\t\telse\n\t\t\t#only one region\n\t\t\texecute_preparation_tool_undo wdialog, pstr_a\n\t\tend\n\tend", "def rewrite_history\n\t#Argument::Truth = \"NO, you're not.\"\nend", "def dry_run *args\n raise \"Not implemented: #{self.class.name}::dry_run\"\n end", "def supercommand!() __supercommand__ end", "def autofinish=(_arg0); end", "def unassignCurator _args\n \"unassignCurator _args;\" \n end", "def undo(frame)\n @xorify.unpack( undo_bypass(frame) )\n end", "def add_original_commands\n end", "def slop!; end", "def slop!; end", "def revert!\n %x[git checkout master]\n %x[git branch -D deployment]\nend", "def revert!\n %x[git checkout master]\n %x[git branch -D deployment]\nend", "def lnbClear _args\n \"lnbClear _args;\" \n end", "def undo(times = 1)\n @commands.pop(times)\n self\n end", "def sentinel(subcommand, *args); end", "def skip_actions; end", "def undo\n if done\n @text = text.sub(DONE_REGEX, '').strip\n @done = false\n end\n end", "def test_defun_command_3\n sum = nil\n##### [my_command3]\n interactive_proc = lambda { [1+1, 1] }\n defun(:my_command3,\n :interactive => interactive_proc) { |a, b|\n sum = a + b\n }\n##### [/my_command3]\n assert_equal nil, sum\n call_interactively :my_command3\n assert_equal 3, sum\n end", "def undo_move(s)\n # puts \"Undoing move...\" #NICE TO HAVE\n if s[:m] == -1\n s[:m] = s[:num_moves]\n else\n s[:m] = s[:m] - 1\n end\n while s[:given_moves].include? s[:m] do # Make sure we're not undoing a given move\n s[:m] = s[:m] -1\n end\n xy = s[:known_moves][s[:m]-1]\n s[:moves][xy[:y]][xy[:x]] = 0\n derive_moves_metadata(s)\nend", "def undo\n if(@history != nil)\n @history.undo\n end\n end", "def debriefingText _args\n \"debriefingText _args;\" \n end", "def doNothing\n\n system(%Q{say -v \"karen\" \"You do nothing and watch as 5 innocent men die\"})\n system(%Q{say -v \"karen\" \"Choosing to do nothing is still a chose\"})\n system(%Q{say -v \"karen\" \"You are responsible for these mens deaths\"})\n system(%Q{say -v \"karen\" \"and the blood is on your hands \"})\n\n end", "def undo\n {\n method: \"DOM.undo\"\n }\n end", "def discard=(_arg0); end", "def subcommand\n # clear_last_line\n # pbold 'Subcommand:'\n begin\n prompt = %(\n [q] quit [w] config write [d] delete\n [x] update config + quit [r] config read [r] rename\n [wq] write config + quit [e] edit file under cursor [m] move\n [P] copy PWD to clipboard [o] open file under cursor [c] copy\n [p] copy filename to clipboard [h] help [t] toggle flags\n )\n # command = readline 'Enter command: q x wq P p w e r h :'\n command = readline prompt\n return if command == ''\n rescue StandardError\n return\n end\n if command == 'q'\n quit_command\n elsif command == 'wq'\n @quitting = true\n @writing = true\n elsif command == 'w'\n config_write\n elsif command == 'r'\n config_read\n elsif command == 'x'\n @quitting = true\n @writing = true if @modified\n elsif command == 'e'\n edit_current\n elsif command == 'o'\n open_current\n elsif command == 'd'\n delete_file\n elsif command == 'c'\n copy_file\n elsif command == 'r'\n rename_file\n elsif command == 'm'\n move_file\n elsif command == 'h' || command == 'help' || command == '?'\n print_help\n elsif command == 'P'\n # or should be put current file in clip ?\n system 'echo $PWD | pbcopy'\n message 'Stored PWD in clipboard (using pbcopy)'\n elsif command == 'p'\n system \"echo #{current_file} | pbcopy\"\n message \"Stored #{current_file} in clipboard (using pbcopy)\"\n elsif command == 't' || command == 'toggle'\n toggle_menu\n else\n perror \"Don't know about command #{command}. Try :h or :help\"\n end\nend", "def undo\n light.on\n end", "def undo\n fan.medium\n end", "def undo\n fan.medium\n end", "def disableUserInput _args\n \"disableUserInput _args;\" \n end", "def quando_preposto(*args)\n end", "def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker(-1)}\n end", "def notifyUndoUpdate\n updateCommand(Wx::ID_UNDO) do |ioCommand|\n if (@UndoStack.empty?)\n ioCommand[:Title] = 'Undo'\n ioCommand[:Enabled] = false\n else\n lLastOperationTitle = @UndoStack[-1].Title\n ioCommand[:Title] = \"Undo #{lLastOperationTitle}\"\n ioCommand[:Enabled] = true\n end\n end\n end", "def undo_changes\r\n return synchronize( true )\r\n end", "def make_undo_link\n view_context.link_to 'Undo that please!', undo_path(@article.versions.last), method: :post\n end", "def can_redo?; @last_done < (@actions.size - 1); end", "def skip_transcription(*args)\n @@skippable = args\n end", "def confirm(args = T.unsafe(nil)); end", "def skips; end", "def barf!(msg=nil)\n puts \"*** add_nocommit: %s \" % msg if msg\n exit -1\nend", "def ! *args\n false\n end", "def dirty=(_arg0); end", "def removeUniform _args\n \"removeUniform _args;\" \n end", "def internals(obj:)\n p prompt(obj)\n bool = gets.strip\n return present_selections if bool == 'skip'\n if bool == 'yes'\n log obj\n success\n else\n call_method meth_name_from(obj)\n end\n end", "def original_run_command; end", "def invalid_command\n puts \"Please enter a valid command\"\n #invalid_command\n # code invalid_command here\nend", "def input args\n if args.state.inputlist.length > 5\n args.state.inputlist.pop\n end\n\n should_process_special_move = (args.inputs.keyboard.key_down.j) ||\n (args.inputs.keyboard.key_down.k) ||\n (args.inputs.keyboard.key_down.a) ||\n (args.inputs.keyboard.key_down.d) ||\n (args.inputs.controller_one.key_down.y) ||\n (args.inputs.controller_one.key_down.x) ||\n (args.inputs.controller_one.key_down.left) ||\n (args.inputs.controller_one.key_down.right)\n\n if (should_process_special_move)\n if (args.inputs.keyboard.key_down.j && args.inputs.keyboard.key_down.k) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"shield\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.inputlist[0] == \"forward-attack\") && ((args.state.tick_count - args.state.lastpush) <= 15)\n args.state.inputlist.unshift(\"dash-attack\")\n args.state.player.dx = 20\n elsif (args.inputs.keyboard.key_down.j && args.inputs.keyboard.a) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.left)\n args.state.inputlist.unshift(\"back-attack\")\n elsif ( args.inputs.controller_one.key_down.x || args.inputs.keyboard.key_down.j)\n args.state.inputlist.unshift(\"forward-attack\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.player.y > 128)\n args.state.inputlist.unshift(\"dair\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"up-attack\")\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) &&\n (args.state.inputlist[0] == \"<\") &&\n ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.inputlist.unshift(\"<<\")\n args.state.player.dx = -15\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a)\n args.state.inputlist.unshift(\"<\")\n args.state.timeleft = args.state.tick_count\n elsif (args.inputs.controller_one.key_down.right || args.inputs.keyboard.key_down.d)\n args.state.inputlist.unshift(\">\")\n end\n\n args.state.lastpush = args.state.tick_count\n end\n\n if args.inputs.keyboard.space || args.inputs.controller_one.r2 # if the user presses the space bar\n args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame\n\n # if the time that has passed since the jump is less than the player's jump duration and\n # the player is not falling\n if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling\n args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump\n end\n end\n\n # if the space bar is in the \"up\" state (or not being pressed down)\n if args.inputs.keyboard.key_up.space || args.inputs.controller_one.key_up.r2\n args.state.player.jumped_at = nil # jumped_at is empty\n args.state.player.falling = true # the player is falling\n end\n\n if args.inputs.left # if left key is pressed\n if args.state.player.dx < -5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = -5\n end\n\n elsif args.inputs.right # if right key is pressed\n if args.state.player.dx > 5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = 5\n end\n else\n args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down\n end\n\n if ((args.state.player.dx).abs > 5) #&& ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.player.dx *= 0.95\n end\nend", "def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker()}\n end", "def apply_args!(args)\n intro = args.shift\n d = args.shift\n introduced intro if intro\n desc d if d\n args\n end", "def undo\n @workout.undo\n redirect_to workout_path(@workout),\n notice: t('.success')\n end" ]
[ "0.64404494", "0.64404494", "0.626697", "0.6181161", "0.6152248", "0.61470264", "0.60993606", "0.60690165", "0.59408873", "0.59353113", "0.5875205", "0.5849912", "0.5845147", "0.5778812", "0.5750887", "0.57296675", "0.5691882", "0.5619012", "0.5612826", "0.55998266", "0.55998266", "0.55922294", "0.55869496", "0.55831987", "0.55739814", "0.55733883", "0.55150795", "0.5514706", "0.5510909", "0.5499749", "0.54984295", "0.54892355", "0.54834455", "0.5476501", "0.54483646", "0.5444862", "0.54368335", "0.54362607", "0.54324037", "0.54308414", "0.54193944", "0.54162943", "0.54162943", "0.5404325", "0.53976583", "0.5388784", "0.5388074", "0.53807986", "0.5376781", "0.53762573", "0.53707516", "0.53217405", "0.5317337", "0.52828676", "0.52788925", "0.5277058", "0.5273916", "0.5271747", "0.5270728", "0.525776", "0.525776", "0.5249601", "0.5249601", "0.5235151", "0.5229833", "0.5218149", "0.5217248", "0.52169514", "0.5215185", "0.51992977", "0.5199249", "0.51976115", "0.5195274", "0.5192137", "0.5184789", "0.51845574", "0.51811445", "0.51802367", "0.51802367", "0.51678705", "0.51603854", "0.5154789", "0.5150097", "0.51417553", "0.51399654", "0.5130258", "0.51082134", "0.5095984", "0.5095262", "0.5095118", "0.50941443", "0.50937754", "0.5091943", "0.5090857", "0.5090114", "0.508669", "0.50745046", "0.5071235", "0.5060279", "0.5051193" ]
0.68540466
0
This is how you'll access the Vizier::Subject object that's the interface of every command to the program state.
def subject @subject end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject; end", "def subject\n self['subject']\n end", "def subject; @message_impl.getSubject; end", "def subject\n @subject\n end", "def subject\n @subject\n end", "def subject\n return @subject\n end", "def subject\n return @subject\n end", "def subject\n return @subject\n end", "def subject\n return @subject\n end", "def subject\n return @subject\n end", "def subject\n return @subject\n end", "def get_subject\n\t\tend", "def subject\n self['subject'] || msg['subject']\n end", "def inspect\n \"<#{self.class}:#{self.object_id} @subject: #{@subject}>\"\n end", "def subject\n raise \"Override #subject in the service class\"\n end", "def subject\n message.subject\n end", "def receive_subject\n subjects = @subjects.keys.\n map { |subject| button(subject) }.\n join(\"\\n\")\n subject = ask(\"Что сдавал?\\n#{subjects}\")\n check_exist_subject(subject)\n end", "def subject\n @subject ||= connection.get(path_prefix){|req| req.params.merge!params }.body\n end", "def subject\n @subject ||= connection.get(path_prefix){|req| req.params.merge!params }.body\n end", "def prep_subject(subject)\n add_command_requirements(subject)\n @command_set.add_defaults(subject)\n subject.required_fields(subject_requirements())\n subject.undo_stack = @undo_stack\n subject.command_set = @command_set\n subject.chain_of_command = @commands_pending\n subject.pause_decks = @pause_decks\n subject.mode_stack = @sub_modes\n return subject\n end", "def subject\n subtype_instance\n end", "def data\n self.class.repository.query(:subject => subject)\n end", "def subject\n title \n end", "def data_subject\n return @data_subject\n end", "def subject\n self.klass.subject\n end", "def show\n @subject = get_subject\n end", "def commands\n self.class.commands\n end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject=(_arg0); end", "def subject_requirements\n return [:undo_stack, :command_set,\n :chain_of_command, :pause_decks, :mode_stack]\n end", "def subject\n children[0]\n end", "def subject=(subject); @message_impl.setSubject subject; end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def message_subject\n return @message_subject\n end", "def write_subject\n self.subject ||= self.class.instance_variable_get(\"@job_name\")\n end", "def commands\n abstract!\n end", "def on subject\n @subject = subject\n self\n end", "def show\n\t\tcreate_audit __method__, 'subject', @subject.id\n\tend", "def subject\n\t\t@subjct || (@subject = creation_block.call)\n\tend", "def subcommands\n Properties[self.class] ||= {}\n return Properties[self.class][:subcmds] || []\n end", "def commands\n COMMANDS\n end", "def commands\n\n {\n 'TODO' => \"This one shout take its sub commands from current(headers/body) variables and the key value should be the command description\n This one should depend on current context\"\n }\n\n end", "def subject_class\n self.class.subject_class\n end", "def commands; end", "def selectDiarySubject _obj, _args\n \"_obj selectDiarySubject _args;\" \n end", "def cmd; end", "def get_demographics(subject)\n act = SubjectViewAction.new(self)\n act.get(subject)\n end", "def get_rx_data\n return self.sendcmd(\"rx.get_data\")\n end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def path\n send self.class.subject_path\n end", "def inspect\n sprintf(\n \"#<%s:%#0x SUBJECT:%s>\",\n self.class.to_s, self.object_id, self.subject\n )\n end", "def commandFSM _obj, _args\n \"_obj commandFSM _args;\" \n end", "def print\n puts @subject\n puts @text\n end", "def subjects\n subjects_array = object.syncable_subjects.to_a\n\n return subjects_array unless object.is_send?\n\n subjects_array << Subject.new(subject_code: \"U3\", subject_name: \"Special Educational Needs\")\n\n subjects_array\n end", "def current_subject_from_session\n return unless session[:subject_type].present? && session[:subject_id].present?\n\n session[:subject_type].constantize.find session[:subject_id]\n end", "def first_subject\n subject\n end", "def get_subject\n @pcp_subject = PcpSubject.find( params[ :pcp_subject_id ])\n end", "def commands\n\t\t{\n\t\t\t\"?\" => \"Help menu\",\n\t\t\t\"background\" => \"Backgrounds the current session\",\n\t\t\t\"close\" => \"Closes a channel\",\n\t\t\t\"channel\" => \"Displays information about active channels\",\n\t\t\t\"exit\" => \"Terminate the meterpreter session\",\n\t\t\t\"help\" => \"Help menu\",\n\t\t\t\"interact\" => \"Interacts with a channel\",\n\t\t\t\"irb\" => \"Drop into irb scripting mode\",\n\t\t\t\"migrate\" => \"Migrate the server to another process\",\n\t\t\t\"use\" => \"Load a one or more meterpreter extensions\",\n\t\t\t\"quit\" => \"Terminate the meterpreter session\",\n\t\t\t\"read\" => \"Reads data from a channel\",\n\t\t\t\"run\" => \"Executes a meterpreter script\",\n\t\t\t\"bgrun\" => \"Executes a meterpreter script as a background thread\",\n\t\t\t\"bgkill\" => \"Kills a background meterpreter script\",\n\t\t\t\"bglist\" => \"Lists running background scripts\",\n\t\t\t\"write\" => \"Writes data to a channel\",\n\t\t}\n\tend", "def by_subject\n @exam = Exam.new\n session[:exam] = @exam\n @subjects = PlanSubject.find_unfinished_for(@user, :subjects => true)\n end", "def command_name; end", "def subject_name\n return @subject_name\n end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def command; datastore['COMMAND']; end", "def set_subject(subject)\n\t\tend", "def interface\n Context.interface\n end", "def subject\n @subject=EzCrypto::Name.new(@cert.subject) unless @subject\n @subject\n end", "def subject_results\n env.subjects.map(&method(:subject_result))\n end" ]
[ "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.643268", "0.635685", "0.6337496", "0.61610323", "0.61610323", "0.61504906", "0.61504906", "0.61504906", "0.61504906", "0.61504906", "0.61504906", "0.61229664", "0.59478074", "0.5911912", "0.5820405", "0.58016306", "0.5798074", "0.5775522", "0.5754366", "0.56686646", "0.5657384", "0.560431", "0.5590818", "0.5582951", "0.5549241", "0.5470071", "0.54375297", "0.5435196", "0.5435196", "0.5435196", "0.5435196", "0.5435196", "0.5435196", "0.5435196", "0.5435196", "0.5434594", "0.5432037", "0.5417088", "0.5408177", "0.5408177", "0.5408177", "0.5408177", "0.5408177", "0.5408177", "0.5395377", "0.53866327", "0.53860563", "0.53844416", "0.53732544", "0.5369684", "0.5343173", "0.5342809", "0.53199714", "0.5302322", "0.52878445", "0.527954", "0.5264919", "0.52490234", "0.5243473", "0.52403635", "0.52403635", "0.52403635", "0.52403635", "0.52403635", "0.52403635", "0.52079767", "0.51967865", "0.5189721", "0.5183609", "0.5177097", "0.5164009", "0.5158402", "0.51516795", "0.5135777", "0.51330745", "0.5125608", "0.51255673", "0.5112783", "0.51127064", "0.50954646", "0.50919956", "0.50864166", "0.5074949" ]
0.62788373
20
:section: Pause and Resume Stop here. Return control to the user. If several commands are chained (c.f. chain) and the pause is subsequently resumed (StandardCommands::Resume) the whole chain will be resumed.
def pause(deck = nil) raise ResumeFrom, deck end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_pause\n raw_stop\n end", "def raw_pause\n raw_stop\n end", "def resume\n @halt = false\n end", "def resume; end", "def resume; end", "def resume!\n raise InvalidActionError, \"Cannot resume a Output that is not paused.\" unless paused?\n resume_action.tap do |action|\n result = write_action action\n resumed! if result\n end\n end", "def resume\n end", "def resume\n end", "def pause\n return unless running?\n return if paused?\n info \"PAUSE!\"\n send_command :pause\n @paused = true\n callback! :pause, true\n end", "def resume!\n raise InvalidActionError, \"Cannot resume a Output that is not paused.\" unless paused?\n resume_action.tap do |action|\n result = write_action action\n resumed! if result\n end\n end", "def resume!\n raise InvalidActionError, \"Cannot resume a Say that is not paused.\" unless paused?\n resume_action.tap do |action|\n result = write_action action\n resumed! if result\n end\n end", "def pause\n $stderr.write('Press CTRL+j or ENTER to continue') && $stdin.gets\n end", "def resume\n\tend", "def pause(*args)\n send_cmd(\"pause #{OptArg.parse(*args)}\").join.chomp\n nil\n end", "def resume\n action('resume')\n end", "def resume\n\n end", "def resume\n if(@paused)\n @paused = false\n reset\n end\n current_self\n end", "def resume(*)\n super.tap do\n __debug_sim(\"*** RESUME WORKFLOW STATE #{prev_state} ***\")\n end\n end", "def resume!\n should_flush = @paused_mutex.synchronize do\n @paused -= 1 if @paused > 0\n @paused == 0\n end\n flush! if should_flush\n self\n end", "def pause!\n @state = :paused\n end", "def pause\n print \"Press Enter/Return to continue...\"\n gets\n end", "def resume\n execute_prlctl('resume', @uuid)\n end", "def resume\n @suspended = false\n end", "def pause!\n @paused = true\n raise(Paused)\n end", "def _pause_if_needed\n return unless Nenv.cuke_step?\n\n STDOUT.puts \"\\n\\nPress enter to continue\"\n STDIN.gets\n end", "def resume(&block)\n @pauses_manager.resume(&block)\n end", "def pause\n print \"Press Enter To Continue...\"\n $stdin.getc\n end", "def pause; end", "def pause\n\n end", "def pause!\n raise InvalidActionError, \"Cannot pause a Say that is not executing\" unless executing?\n pause_action.tap do |action|\n result = write_action action\n paused! if result\n end\n end", "def resume\n if !block_given?\n @j_del.java_method(:resume, []).call()\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling resume()\"\n end", "def pause\n end", "def pause\n end", "def pause\n end", "def pause()\r\n # nothing here\r\n end", "def cmd_pause argv\n setup argv\n uuid = @hash['uuid']\n response = @api.pause(uuid)\n msg response\n return response\n end", "def suspend\n _suspend(false) do\n system(\"tput cup 26 0\")\n system(\"tput ed\")\n system(\"echo Enter C-d to return to application\")\n system (ENV['PS1']='\\s-\\v\\$ ') if ENV['SHELL']== '/bin/bash'\n system(ENV['SHELL']);\n end\n end", "def pause_program\n puts\n puts \"Press enter to continue\"\n pause = STDIN.gets\nend", "def pause\n puts \"Pausing Microwave...\"\n send_request(:command => :pause)\n end", "def pause\n if !block_given?\n @j_del.java_method(:pause, []).call()\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling pause()\"\n end", "def toggle_pause()\n %x{#{echo} pause > #{fifo()}} if running?\n system \"stty #{$app.old_stty}\" # restore stty settings\n end", "def pause!\n raise InvalidActionError, \"Cannot pause a Output that is not executing\" unless executing?\n pause_action.tap do |action|\n result = write_action action\n paused! if result\n end\n end", "def pause\n @paused = true\n end", "def pause\n @paused = true\n end", "def pause(msg=\"paused, press return key to continue\")\n puts msg\n STDIN.gets\n end", "def resume\n FMOD.invoke(:ChannelGroup_SetPaused, self, 0)\n self\n end", "def pause\n super\n each_slave{ |instance, iter| instance.framework.pause{ iter.next } }\n true\n end", "def resume()\n @ole.Resume()\n end", "def pause!\n raise InvalidActionError, \"Cannot pause a Output that is not executing\" unless executing?\n pause_action.tap do |action|\n result = write_action action\n paused! if result\n end\n end", "def pause\n @service.context.post(@control_path, :action => 'pause')\n self\n end", "def option_to_continue\n puts \"Would you like to continue? yes/no\"\n continue?\nend", "def pause_or_unpause\n paused? ? unpause : pause\n end", "def resume()\n #This is a stub, used for indexing\n end", "def pause()\n #This is a stub, used for indexing\n end", "def cmd_resume argv\n setup argv\n uuid = @hash['uuid']\n response = @api.resume(uuid)\n msg response\n return response\n end", "def pause\n puts \"press ENTER to cotinue\"\n h_line \n gets\n nil\nend", "def pause\n @actor << 'PAUSE'\n @actor.wait\n end", "def resume(job = ALL_JOBS)\n DRMAA.control(job, DRMAA::ACTION_RESUME)\n end", "def pause\n unless(@paused)\n @paused = true\n reset\n end\n current_self\n end", "def resume\n @vm.resume\n end", "def resume\n with_queue_control do |control|\n control.resume\n end\n end", "def resume\n @pauses.each do |topic, partitions|\n partitions.each do |partition, pause|\n next unless pause.paused?\n next unless pause.expired?\n\n pause.resume\n\n yield(topic, partition)\n end\n end\n end", "def resume(job = ALL_JOBS)\n DRMAA.control(job, DRMAA::ACTION_RESUME)\n end", "def resume(view)\n @ctrlDown = false\n @shiftDown = false\n end", "def trap_resume\n Curses.raw\n old_cont = trap 'CONT' do Curses.doupdate end\n\n yield\n\n ensure\n Curses.noraw\n trap 'CONT', old_cont\n end", "def manual_stop!\n exit 1 if stopping?\n stop!\n STDOUT.puts \"Press Ctrl-C again to stop immediately.\"\n end", "def do_resume(msg)\n\n return unless h.state == 'paused' || h.state == 'awaiting'\n\n h.state = nil\n\n m = h.delete('paused_apply')\n return do_apply(m) if m\n # if it's a paused apply, pipe it directly to #do_apply\n\n replies = h.delete('paused_replies') || []\n\n do_persist || return\n\n h.children.each { |i| @context.storage.put_msg('resume', 'fei' => i) }\n # resume children\n\n replies.each { |m| @context.storage.put_msg(m.delete('action'), m) }\n # trigger replies\n end", "def resume\n super\n each_slave { |instance, iter| instance.framework.resume{ iter.next } }\n true\n end", "def resume(node)\n Result.new(call(CMD_RESUME % node))\n end", "def pause\r\n STDIN.gets\r\n end", "def pause_program\n STDIN.gets\n end", "def pause\n @paused += 1\n end", "def continue\n @proceed = true\n end", "def pause wait_time\r\n command 'pause', wait_time\r\n end", "def pause\n with_queue_control do |control|\n control.pause\n end\n end", "def raw_pause\n raise NotImplementedError, _(\"must be implemented in a subclass\")\n end", "def pause\n sleep PAUSE_SECONDS\n end", "def pause\n sleep PAUSE_SECONDS\n end", "def resume_next\n @condition_variable.signal\n end", "def play_pause()\n @ole.PlayPause()\n end", "def cmd_suspend(*args)\n # give'em help if they want it, or seem confused\n if args.length == 0 or (args.include? \"-h\")\n cmd_suspend_help\n return true\n end\n\n continue = args.delete(\"-c\") || false\n resume = args.delete(\"-r\") || false\n\n # validate all the proposed pids first so we can bail if one is bogus\n valid_pids = validate_pids(args)\n args.uniq!\n diff = args - valid_pids.map {|e| e.to_s}\n if not diff.empty? # then we had an invalid pid\n print_error(\"The following pids are not valid:\t#{diff.join(\", \").to_s}.\")\n if continue\n print_status(\"Continuing. Invalid args have been removed from the list.\")\n else\n print_error(\"Quitting.\tUse -c to continue using only the valid pids.\")\n return false\n end\n end\n\n targetprocess = nil\n if resume\n print_status(\"Resuming: #{valid_pids.join(\", \").to_s}\")\n else\n print_status(\"Suspending: #{valid_pids.join(\", \").to_s}\")\n end\n begin\n valid_pids.each do |pid|\n print_status(\"Targeting process with PID #{pid}...\")\n targetprocess = client.sys.process.open(pid, PROCESS_ALL_ACCESS)\n targetprocess.thread.each_thread do |x|\n if resume\n targetprocess.thread.open(x).resume\n else\n targetprocess.thread.open(x).suspend\n end\n end\n end\n rescue ::Rex::Post::Meterpreter::RequestError => e\n print_error \"Error acting on the process: #{e.to_s}.\"\n print_error \"Try migrating to a process with the same owner as the target process.\"\n print_error \"Also consider running the win_privs post module and confirm SeDebug priv.\"\n return false unless continue\n ensure\n targetprocess.close if targetprocess\n end\n return true\n end", "def unpause\n @service.context.post(@control_path, :action => 'unpause')\n self\n end", "def enter_to_continue\n puts \"\\n\"\n puts \"\\t\\t--------Press Enter to Continue------\"\n continue = gets\n end", "def pause prompt = nil, &block\n s = Scene::Pause.subclass do |actor, scene|\n scene.prompt = prompt unless prompt.nil?\n block&.call(actor, scene)\n end\n scene_classes.push s\n s\n end", "def resume\n\t\traise NotImplementedError\n\tend", "def pause_here\n puts \"\\n\\nHit ENTER to continue\"\n gets.chomp\nend", "def continue; end", "def continue; end", "def pause_prompt\n puts \"Press ENTER to continue . . .\"\n STDIN.getc\nend", "def pause()\n @ole.Pause()\n end", "def stopcmd\n end", "def pause\n @pause_queue << :paused\n end", "def resume_all_processes\n resume_processes\n end", "def resume_continuation\n t = self.continuation\n t.convert_to_runnable_state\n self.continuation = nil\n t.resume_from_continuation\n end", "def pause(cycles)\n @paused = true\n @paused_counter = cycles\n end", "def pause(cycles)\n @paused = true\n @paused_counter = cycles\n end", "def continue\n\n # FIXME: with the ruby-supported stepping, we might not\n # need the below any more.\n # I'm guessing the stack size can't ever reach this\n @next_level = 32000\n\n @next_thread = nil\n if @settings[:traceprint]\n @core.step_count = 1 # traceprint will avoid stopping\n else\n @core.step_count = -1 # No more event stepping\n end\n @leave_cmd_loop = true # Break out of the processor command loop.\n end", "def pause\n \tsleeper(25)\n end", "def pause\n \tsleeper(25)\n end", "def resume\n process_status = status\n if process_status == 'stopped'\n return status if Process.kill('CONT', @proc_attrs[:pid].to_i)\n end\n process_status\n rescue Errno::EPERM\n return 'non-privilaged operation'\n end" ]
[ "0.6763182", "0.6763182", "0.6719082", "0.65291953", "0.65291953", "0.64089096", "0.6381771", "0.6381771", "0.63779324", "0.63572705", "0.6347065", "0.6307767", "0.6295562", "0.6261589", "0.6237658", "0.61858994", "0.61754566", "0.6127437", "0.6123034", "0.610057", "0.6075805", "0.605633", "0.6053903", "0.6040912", "0.6036917", "0.6000344", "0.599883", "0.59966964", "0.59467995", "0.5944915", "0.59397507", "0.5936963", "0.5936963", "0.5936963", "0.5934052", "0.5922141", "0.59195936", "0.59191126", "0.59108484", "0.5910043", "0.59074074", "0.59071785", "0.590041", "0.590041", "0.5891058", "0.5871743", "0.58562875", "0.5851771", "0.58334655", "0.5814396", "0.5804076", "0.5799764", "0.5787533", "0.57806873", "0.57681257", "0.5765371", "0.57583433", "0.5754437", "0.575179", "0.5716842", "0.56821895", "0.5680281", "0.5665154", "0.5651788", "0.5623136", "0.5623087", "0.5616192", "0.56066996", "0.5596285", "0.5596032", "0.55613846", "0.55555516", "0.5545446", "0.5541076", "0.55274206", "0.5505503", "0.5481307", "0.5481307", "0.5471441", "0.54665655", "0.54662806", "0.5460923", "0.546054", "0.5460391", "0.54410315", "0.5421672", "0.54203755", "0.54203755", "0.5418121", "0.54093176", "0.54088145", "0.540701", "0.5398526", "0.53881735", "0.53767776", "0.53767776", "0.5369309", "0.5367984", "0.5367984", "0.5357526" ]
0.59623754
28
Stop here and return control to the user. If several commands are chained (c.f. chain) and the pause is subsequently resumed (StandardCommands::Resume) the rest of the chain (not this command) will be dropped.
def defer(deck = nil) raise ResumeFromOnlyThis, deck end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_pause\n raw_stop\n end", "def raw_pause\n raw_stop\n end", "def resume\n @halt = false\n end", "def pause\n $stderr.write('Press CTRL+j or ENTER to continue') && $stdin.gets\n end", "def _pause_if_needed\n return unless Nenv.cuke_step?\n\n STDOUT.puts \"\\n\\nPress enter to continue\"\n STDIN.gets\n end", "def pause\n return unless running?\n return if paused?\n info \"PAUSE!\"\n send_command :pause\n @paused = true\n callback! :pause, true\n end", "def stopcmd\n end", "def suspend\n _suspend(false) do\n system(\"tput cup 26 0\")\n system(\"tput ed\")\n system(\"echo Enter C-d to return to application\")\n system (ENV['PS1']='\\s-\\v\\$ ') if ENV['SHELL']== '/bin/bash'\n system(ENV['SHELL']);\n end\n end", "def pause\n print \"Press Enter/Return to continue...\"\n gets\n end", "def end_command(_name)\n @parent_command.pop\n decrement_nest\n @io.puts \"* * * * * *\\n\\n\" unless @nest.size > 2\n end", "def pause(deck = nil)\n raise ResumeFrom, deck\n end", "def pause\n print \"Press Enter To Continue...\"\n $stdin.getc\n end", "def stop\n Prompt.restore\n Hook.unregister\n end", "def pause(*args)\n send_cmd(\"pause #{OptArg.parse(*args)}\").join.chomp\n nil\n end", "def cancel\n unless @state == :stop\n raise Delayer::StateError(@state), 'cannot cancel Delayer::Procedure'\n end\n\n @state = :cancel\n self\n end", "def manual_stop!\n exit 1 if stopping?\n stop!\n STDOUT.puts \"Press Ctrl-C again to stop immediately.\"\n end", "def halt!\n @running = false\n return nil\n end", "def cancel\n self.break_condition = 1\n end", "def halted(command)\n end", "def continue\n if gets == \"\\n\"\n system \"clear\"\n main\n end\n end", "def resume; end", "def resume; end", "def cmd_exit(*args)\n\t\tshell.stop\n\tend", "def abort_chain\n @_abort_chain = true\n end", "def stop_chain\n fail StopChainException\n end", "def pause!\n raise InvalidActionError, \"Cannot pause a Say that is not executing\" unless executing?\n pause_action.tap do |action|\n result = write_action action\n paused! if result\n end\n end", "def abort_chain\n @_abort_chain = true\n end", "def stop\n control :kill\n self\n end", "def toggle_pause()\n %x{#{echo} pause > #{fifo()}} if running?\n system \"stty #{$app.old_stty}\" # restore stty settings\n end", "def brake\r\n command 'break'\r\n end", "def pause!\n raise InvalidActionError, \"Cannot pause a Output that is not executing\" unless executing?\n pause_action.tap do |action|\n result = write_action action\n paused! if result\n end\n end", "def pause!\n raise InvalidActionError, \"Cannot pause a Output that is not executing\" unless executing?\n pause_action.tap do |action|\n result = write_action action\n paused! if result\n end\n end", "def cancel_skill \n @windows[Win_Confirm].reset_commands \n @cursor.active = true\n end", "def pause\n puts \"press ENTER to cotinue\"\n h_line \n gets\n nil\nend", "def resume_next\n @condition_variable.signal\n end", "def resume!\n raise InvalidActionError, \"Cannot resume a Output that is not paused.\" unless paused?\n resume_action.tap do |action|\n result = write_action action\n resumed! if result\n end\n end", "def stop(&block)\n yield(DONE)\n puts stop_message\n end", "def stop\n super\n @player.action_queue.next_action\n end", "def pause_program\n puts\n puts \"Press enter to continue\"\n pause = STDIN.gets\nend", "def pause\n super\n each_slave{ |instance, iter| instance.framework.pause{ iter.next } }\n true\n end", "def pause!\n @paused = true\n raise(Paused)\n end", "def resume!\n raise InvalidActionError, \"Cannot resume a Output that is not paused.\" unless paused?\n resume_action.tap do |action|\n result = write_action action\n resumed! if result\n end\n end", "def pause; end", "def resume\n if(@paused)\n @paused = false\n reset\n end\n current_self\n end", "def stop!\n throw :return, 1\n end", "def end_commands\n abstract!\n end", "def unpause\n @service.context.post(@control_path, :action => 'unpause')\n self\n end", "def pause()\r\n # nothing here\r\n end", "def enter_to_continue\n puts \"\\n\"\n puts \"\\t\\t--------Press Enter to Continue------\"\n continue = gets\n end", "def ask_to_continue_or_cancel(msg=nil)\n puts msg if msg\n print \"(Ctrl-C to cancel or any key to continue)\"\n STDOUT.flush\n STDIN.getc\nend", "def pause\n with_queue_control do |control|\n control.pause\n end\n end", "def resume!\n raise InvalidActionError, \"Cannot resume a Say that is not paused.\" unless paused?\n resume_action.tap do |action|\n result = write_action action\n resumed! if result\n end\n end", "def resume(view)\n @ctrlDown = false\n @shiftDown = false\n end", "def pause\n if !block_given?\n @j_del.java_method(:pause, []).call()\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling pause()\"\n end", "def cancel_cli\n generic_step(\"cancel\")\n end", "def resume(*)\n super.tap do\n __debug_sim(\"*** RESUME WORKFLOW STATE #{prev_state} ***\")\n end\n end", "def halt\n w = get_op(pc)\n if w == OP::RETURN || w == OP::REVERT\n operate\n output\n elsif w == OP::STOP || w == OP::SELFDESTRUCT\n operate\n nil\n else\n EMPTY_SET\n end\n end", "def interact(&block)\n\t\tinit_tab_complete\n\n\t\t# Run queued commands\n\t\tcommands.delete_if { |ent|\n\t\t\trun_single(ent)\n\t\t\ttrue\n\t\t}\n\n\t\t# Run the interactive loop\n\t\trun { |line|\n\t\t\t# Run the command\n\t\t\trun_single(line)\n\n\t\t\t# If a block was supplied, call it, otherwise return false\n\t\t\tif (block)\n\t\t\t\tblock.call\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\t}\n\tend", "def cmdloop(intro = nil)\n preloop\n write intro if intro\n begin\n set_completion_proc(:complete)\n begin\n execute_command\n # Catch ^C\n rescue Interrupt\n user_interrupt\n # I don't know why ZeroDivisionError isn't caught below...\n rescue ZeroDivisionError\n handle_all_remaining_exceptions(ZeroDivisionError)\n rescue => exception\n handle_all_remaining_exceptions(exception)\n end\n end until @stop\n postloop\n end", "def continue\n @proceed = true\n end", "def halt!\n @running = false\n @audio.stop_audio\n @hardware_interface.teardown\n end", "def cmd_pause argv\n setup argv\n uuid = @hash['uuid']\n response = @api.pause(uuid)\n msg response\n return response\n end", "def stop\n stop_control_loop\n end", "def resume\n with_queue_control do |control|\n control.resume\n end\n end", "def answer result, &block\n callchain.each do |c|\n c.instance_exec @current_state do |cs|\n @previous_states << @current_state\n @current_state = cs\n end\n end\n # next time, control will be passed to our calling block or our block\n if block_given?\n @previous_command_blocks << @command_block if @command_block\n @command_block = block \n else\n @command_block = @previous_command_blocks.pop\n end\n set_executed_command_chain\n \n # unwind to the command block \n pause = PauseProcessing.new\n pause.value = result\n raise pause\n end", "def stop?(*) end", "def resume\n end", "def resume\n end", "def pause\n end", "def pause\n end", "def pause\n end", "def continue?; end", "def stop\n print \"\\b\"\n end", "def pause(msg=\"paused, press return key to continue\")\n puts msg\n STDIN.gets\n end", "def pause\n unless(@paused)\n @paused = true\n reset\n end\n current_self\n end", "def pause\n puts \"Pausing Microwave...\"\n send_request(:command => :pause)\n end", "def stop\n begin\n pre_stop\n ensure\n begin\n stop_impl\n ensure\n post_stop\n end\n end\n end", "def pause\n\n end", "def pause\n @service.context.post(@control_path, :action => 'pause')\n self\n end", "def command_cancel\n Sound.play_decision\n return_scene\n end", "def pause_program\n STDIN.gets\n end", "def command_cancel\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Switch to menu screen\r\n $scene = Scene_Menu.new(5)\r\n end", "def resume\n @suspended = false\n end", "def stopped?; end", "def stopped?; end", "def stopped?; end", "def stopped?; end", "def halt; end", "def halt; end", "def pause\r\n STDIN.gets\r\n end", "def reset_for_next_command\n # self.args, self.switches, self.options = [], [], {}\n self.output, self.capture = false, false\n end", "def option_to_continue\n puts \"Would you like to continue? yes/no\"\n continue?\nend", "def reset!\n @suspend_new = false\n stop_all!\n end", "def continue; end", "def continue; end", "def cancel\n return unless @running\n @running = false\n end", "def pause\n @actor << 'PAUSE'\n @actor.wait\n end", "def commandStop _args\n \"commandStop _args;\" \n end", "def stop\n raise NotImplementedError.new(\"Implement stop() in your Invoker. \")\n end", "def cmd_keyscan_stop(*args)\n\t\tprint_line(\"Stopping the keystroke sniffer...\")\t\t\n\t\tclient.ui.keyscan_stop\n\t\treturn true\n\tend", "def pause\n @paused = true\n end" ]
[ "0.6680757", "0.6680757", "0.6440828", "0.6343416", "0.61830145", "0.6043394", "0.59855115", "0.5966923", "0.59566194", "0.59408", "0.5923926", "0.58985835", "0.5883969", "0.5872774", "0.5844364", "0.5834944", "0.58259034", "0.5788786", "0.5788114", "0.5783912", "0.57826936", "0.57826936", "0.57784665", "0.5771286", "0.57633007", "0.57378006", "0.57243335", "0.57175964", "0.57154554", "0.5704605", "0.56960046", "0.5673013", "0.5663774", "0.56633806", "0.5658276", "0.56439424", "0.5643727", "0.56397325", "0.5639418", "0.5635997", "0.56334597", "0.5627187", "0.562673", "0.56254756", "0.56224096", "0.56208843", "0.5618734", "0.5618165", "0.5617419", "0.56161344", "0.5609305", "0.5608518", "0.56082964", "0.56016743", "0.5594901", "0.55846006", "0.55809724", "0.55768466", "0.5567458", "0.5557926", "0.55516475", "0.554919", "0.5537616", "0.55354166", "0.55307853", "0.55173135", "0.5497943", "0.5497943", "0.54970044", "0.54970044", "0.54970044", "0.5488721", "0.5483781", "0.54715043", "0.54640394", "0.5462752", "0.545913", "0.5457705", "0.54531085", "0.5448422", "0.5443931", "0.5441866", "0.5441724", "0.5433341", "0.5433341", "0.5433341", "0.5433341", "0.5431833", "0.5431833", "0.54253644", "0.54209", "0.5418603", "0.5410618", "0.5404094", "0.5404094", "0.5397984", "0.5391514", "0.538142", "0.5378586", "0.5370639", "0.53696877" ]
0.0
-1
Allows for a command to be broken into pieces so that a resume can pick up within a command. The block will be executed normally, but if the command is resumed with a task id, all task blocks until that id will be skipped.
def task(id) #:yield: if not @resume_from.nil? if @resume_from == id @resume_from = nil end return end yield if block_given? @last_completed_task = id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_command_waiting\r\n self.class.send :alias_method, :command, :command_and_wait\r\n yield\r\n self.class.send :alias_method, :command, :command_verbatim \r\n end", "def process_command\n @fiber.resume get_result\n end", "def prepare_idle_continuation(command)\n when_not_awaiting_continuation do\n waiter = await_continuations\n command.stopback do\n waiter.stop\n begin\n send_data \"DONE\\r\\n\"\n rescue => e\n command.fail e\n end\n end\n end\n end", "def run(&_block)\n return_value = nil\n\n command = catch(:breakout_nav) do # Throws from PryByebug::Commands\n return_value = allowing_other_threads { yield }\n {} # Nothing thrown == no navigational command\n end\n\n # Pry instance to resume after stepping\n @pry = command[:pry]\n\n perform(command[:action], command[:options])\n\n return_value\n end", "def interact(&block)\n\t\tinit_tab_complete\n\n\t\t# Run queued commands\n\t\tcommands.delete_if { |ent|\n\t\t\trun_single(ent)\n\t\t\ttrue\n\t\t}\n\n\t\t# Run the interactive loop\n\t\trun { |line|\n\t\t\t# Run the command\n\t\t\trun_single(line)\n\n\t\t\t# If a block was supplied, call it, otherwise return false\n\t\t\tif (block)\n\t\t\t\tblock.call\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\t}\n\tend", "def raw(*command, &block)\n int_callback = lambda do\n @interrupted = true\n @logger.info(\"Interrupted.\")\n end\n\n Util::Busy.busy(int_callback) do\n Subprocess.execute(@vboxmanage_path, *command, &block)\n end\n end", "def raw(*command, &block)\n int_callback = lambda do\n @interrupted = true\n @logger.info(\"Interrupted.\")\n end\n\n # Append in the options for subprocess\n command << { :notify => [:stdout, :stderr] }\n\n Vagrant::Util::Busy.busy(int_callback) do\n Vagrant::Util::Subprocess.execute(*command, &block)\n end\n end", "def answer result, &block\n callchain.each do |c|\n c.instance_exec @current_state do |cs|\n @previous_states << @current_state\n @current_state = cs\n end\n end\n # next time, control will be passed to our calling block or our block\n if block_given?\n @previous_command_blocks << @command_block if @command_block\n @command_block = block \n else\n @command_block = @previous_command_blocks.pop\n end\n set_executed_command_chain\n \n # unwind to the command block \n pause = PauseProcessing.new\n pause.value = result\n raise pause\n end", "def iter_to_block_commands(iter)\n if iter[3].is_a?(Array) && iter[3].first == :block\n iter[3][1..-1]\n else\n [iter[3]]\n end\n end", "def next_command\n @commands_pending.shift\n end", "def raw(*command, &block)\n int_callback = lambda do\n @interrupted = true\n\n # We have to execute this in a thread due to trap contexts\n # and locks.\n Thread.new { @logger.info('Interrupted.') }\n end\n\n # Append in the options for subprocess\n command << { notify: [:stdout, :stderr] }\n\n Vagrant::Util::Busy.busy(int_callback) do\n Vagrant::Util::Subprocess.execute(*command, &block)\n end\n end", "def raw(*command, &block)\n int_callback = lambda do\n @interrupted = true\n @logger.info(\"Interrupted.\")\n end\n\n # Append in the options for subprocess\n command << { :notify => [:stdout, :stderr] }\n\n Vagrant::Util::Busy.busy(int_callback) do\n Vagrant::Util::Subprocess.execute(@vboxmanage_path, *command, &block)\n end\n end", "def raw(*command, &block)\n int_callback = lambda do\n @interrupted = true\n\n # We have to execute this in a thread due to trap contexts\n # and locks.\n Thread.new { @logger.info(\"Interrupted.\") }.join\n end\n\n # Append in the options for subprocess\n command << { notify: [:stdout, :stderr] }\n\n Vagrant::Util::Busy.busy(int_callback) do\n Vagrant::Util::Subprocess.execute(*command, &block)\n end\n rescue Vagrant::Util::Subprocess::LaunchError => e\n raise Vagrant::Errors::OpenBSDError,\n message: e.to_s\n end", "def execute_command(command, &blk)\n so, se = nil\n\n time_obj = Time.now\n ts = time_obj.to_i\n dt = time_obj.strftime(\"%Y-%m-%d\")\n\n tmp_dir_base = @config.get(PATRIOT_TMP_DIR_KEY, DEFAULT_PATRIOT_TMP_DIR)\n\n # the forked variable is used for checking whether fork invocation hangs.\n # (due to https://redmine.ruby-lang.org/issues/5240 ?)\n forked = false\n until forked\n cid = do_fork(command, dt, ts, tmp_dir_base)\n tmpdir = tmp_dir(cid, dt, ts, tmp_dir_base)\n i = 0\n # If fork hangs, output directory would not be created.\n # wait at most 5 seconds for the directory created.\n until forked || i > 5\n sleep(1)\n forked = File.exist?(tmpdir)\n i = i+1\n end\n # fork hanged, kill the hanged process.\n unless forked\n # check whether cid is id of child process to avoid to kill unrelated processes\n begin\n if Process.waitpid(cid, Process::WNOHANG).nil?\n @logger.warn(\"forked process :#{cid} hanged. kill #{cid}\")\n Process.kill(\"KILL\", cid)\n @logger.warn(\"SIGKILL sent to #{cid}\")\n Process.waitpid(cid)\n @logger.warn(\"#{cid} is killed\")\n else\n raise ExternalCommandException, \"#{cid} is not a child of this\"\n end\n rescue Exception => e\n @logger.warn \"failed to kill hanged process #{cid}\"\n raise e\n end\n end\n end\n\n @logger.info \"executing #{command}: results stored in #{tmpdir}\" \n pid, status = Process.waitpid2(cid)\n so = File.join(tmpdir, \"#{cid.to_i}#{STDOUT_SUFFIX}\")\n se = File.join(tmpdir, \"#{cid.to_i}#{STDERR_SUFFIX}\")\n\n @logger.info \"#{command} is finished\" \n return so if status.exitstatus == 0\n @logger.warn \"#{command} end with exit status #{status.exitstatus}\" \n if block_given?\n yield(status, so, se)\n else\n max_err_size = @config.get(MAX_ERROR_MSG_SIZE_KEY, DEFAULT_MAX_ERROR_MSG_SIZE)\n err_size = File.stat(se).size\n err_msg = \"#{command}\\n#{se} :\"\n if err_size < max_err_size\n File.open(se){|f| err_msg = \"#{err_msg}\\n#{f.read}\"}\n else\n err_msg = \"#{err_msg} \\n the size of stderr is #{err_size} (> #{max_err_size}\" \n end\n raise ExternalCommandException, err_msg\n end\n end", "def brake\r\n command 'break'\r\n end", "def exec(command, &block); end", "def send_blocking_command(command, _timeout, &block); end", "def raw(*command, &block)\n int_callback = lambda do\n @interrupted = true\n\n # We have to execute this in a thread due to trap contexts\n # and locks.\n Thread.new { @logger.info(\"Interrupted.\") }.join\n end\n\n # Append in the options for subprocess\n command << { notify: [:stdout, :stderr] }\n\n Vagrant::Util::Busy.busy(int_callback) do\n Vagrant::Util::Subprocess.execute(@vmrun_path, *command, &block)\n end\n end", "def block_eg1(cutblock)\n puts \"this is the first message from 1 \"\n cutblock.call\n puts \"this is the middle message\"\n cutblock.call\n puts \"this is the last\\n\\n\"\nend", "def defer(block)\n p = Proc.new { self.commands_from_block(block) }\n end", "def process\n if command = AVAILABLE_COMMANDS.find { |command_class| command_class.new(@user, @message).should_start? }\n command.new(@user, @message).start\n else\n BotCommand::Undefined.new(@user, @message).start\n end\n end", "def run(&_block)\n @state ||= Byebug::RegularState.new(\n Byebug.current_context,\n [],\n Byebug.current_context.frame_file,\n interface,\n Byebug.current_context.frame_line\n )\n\n return_value = nil\n\n command = catch(:breakout_nav) do # Throws from PryByebug::Commands\n return_value = yield\n {} # Nothing thrown == no navigational command\n end\n\n # Pry instance to resume after stepping\n @pry = command[:pry]\n\n perform(command[:action], command[:options])\n\n return_value\n end", "def each_command!(complete = {}, &block)\r\n @command_queue.each do |command|\r\n block.call(command, complete) if !complete[command]\r\n complete[command] = true\r\n end\r\n\r\n @extended_spec.first.each_command!(complete, &block) if !@extended_spec.empty?\r\n end", "def split_commands(cmd_line); end", "def command_thread(&block)\n start_service\n Ricer::Thread.execute {\n begin\n yield\n rescue StandardError => e\n reply_exception(e)\n ensure\n stopped_service\n end\n }\n end", "def split(message)\n @block.call(message) if @block\n end", "def run_part(part)\n return if ARGV.include?(\"--skip-#{part}\")\n\n parts[part]&.call\n yield if block_given?\nend", "def process_blocks(blocks); end", "def pipe_chunk chunk, command\n content = chunk.content\n output = @context.ui.pipe_to_process(command) do |stream|\n stream.write content\n end\n\n handle_pipe_output command, output\n end", "def execute(commands, &block)\n run_as_system { session_logger.before_executing commands }\n validate_command commands\n execute_in_protected_mode(&block)\n rescue Console1984::Errors::ForbiddenCommandAttempted, FrozenError => error\n flag_suspicious(commands, error: error)\n rescue Console1984::Errors::SuspiciousCommandAttempted => error\n flag_suspicious(commands, error: error)\n execute_in_protected_mode(&block)\n rescue Console1984::Errors::ForbiddenCommandExecuted => error\n # We detected that a forbidden command was executed. We exit IRB right away.\n flag_suspicious(commands, error: error)\n Console1984.supervisor.exit_irb\n ensure\n run_as_system { session_logger.after_executing commands }\n end", "def consume_command! num=1\n @command.shift(num)\n end", "def send_blocking_command(command, _timeout, &block)\n send_command(command, &block)\n end", "def exec(command, &block)\n if block\n @connector.exec(command, buffer) do\n check_log_silence\n block.call\n end\n else\n @connector.exec(command, buffer)\n end\n end", "def attempt_multiline(message, &block)\n perform_action(message, true, nil, false, &block)\nend", "def process! non_block=false\n @running = true\n while @running && (message = shift(non_block))\n @transport.send_message(message)\n end\n message\n end", "def use_blocker\n blocker do\n # next\n # break\n # return\n \"HA!\"\n # next\n # break\n # return\n end\n puts \"DONE!\"\nend", "def execute_delayed_move\n return nil if @me.remaining_action_cooldown_ticks > 0\n\n print 'D' if DEBUG\n @last_print = 'D'\n\n delay_move = @delayed_moves.shift\n return nil unless delay_move\n\n if delay_move.action_type == ActionType::CLEAR_AND_SELECT\n if delay_move.select_group == @selected\n p 'Alredy selected group: ' + @selected.to_s + ', skip'\n\n if @delayed_moves.any?\n execute_delayed_move\n end\n\n return nil\n end\n\n @selected = delay_move.select_group\n end\n\n\n delay_move.proc.call\n end", "def isolate(&blk)\n old, @commands = @commands, nil\n result = yield\n new_code, @commands = @commands, old\n result\n end", "def attempt_multiline(message, &block)\n perform_action(message, true, @passfail, nil, true, false, &block)\nend", "def execute_block(&block)\n @currently_executing_block = true\n output \"tell session id #{name}_tty\"\n self.instance_eval(&block)\n output \"end tell\"\n @currently_executing_block = false\n end", "def halted(command)\n end", "def continue_with(options = {}, &block)\n params = options[:params] || []\n params << self\n @next_tasks = [] if @next_tasks.nil?\n task = Task.new(options.merge(params: params), &block)\n @next_tasks << task\n task.start if completed? || faulted?\n task\n end", "def R!(command, &block)\n run!(command, &block)\n end", "def blocks() end", "def continuous\n @shell_commands ||= []\n yield\n end", "def execute(*command, &block)\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info('Exit code != 0, but interrupted. Ignoring.')\n else\n # If there was an error running command, show the error and the\n # output.\n raise VagrantPlugins::Parallels::Errors::ExecutionError,\n command: command.inspect,\n stderr: r.stderr\n end\n end\n r.stdout\n end", "def task_run(&block) \n task(&block).start\n end", "def execute(*command, &block)\n # Get the options hash if it exists\n opts = {}\n opts = command.pop if command.last.is_a?(Hash)\n\n tries = 0\n tries = 3 if opts[:retryable]\n\n sleep = opts.fetch(:sleep, 1)\n\n # Variable to store our execution result\n r = nil\n\n retryable(:on => LXC::Errors::ExecuteError, :tries => tries, :sleep => sleep) do\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n @logger.info(\"Exit code != 0, but interrupted. Ignoring.\")\n else\n raise LXC::Errors::ExecuteError, :command => command.inspect\n end\n end\n end\n\n # Return the output, making sure to replace any Windows-style\n # newlines with Unix-style.\n r.stdout.gsub(\"\\r\\n\", \"\\n\")\n end", "def run cmd, opts = {}\n id = enqueue cmd, @waitfor, opts\n if @type == :sequential\n @waitfor = [id]\n @result = [id]\n else\n @result << id\n end\n @result\n end", "def cmdloop(intro = nil)\n preloop\n write intro if intro\n begin\n set_completion_proc(:complete)\n begin\n execute_command\n # Catch ^C\n rescue Interrupt\n user_interrupt\n # I don't know why ZeroDivisionError isn't caught below...\n rescue ZeroDivisionError\n handle_all_remaining_exceptions(ZeroDivisionError)\n rescue => exception\n handle_all_remaining_exceptions(exception)\n end\n end until @stop\n postloop\n end", "def run\n until halted?\n step\n end\n end", "def try!\r\n raise \"Invalid status: message must be in progress to try!\" unless [:in_progress].include? self.status\r\n\r\n new_status = self.execute\r\n if :retry == new_status\r\n if self.tries >= self.max_tries\r\n new_status = :fail\r\n logger.fatal \"AsyncCommand #{self.id} failed on #{self.max_tries} maximum tries\"\r\n else\r\n self.push_next_try_at\r\n end\r\n end\r\n self.status = new_status\r\n self.save!\r\n end", "def run!\n while @commands.length > 0\n command = @commands.shift\n puts command\n @run_success = run command unless @dry_run\n end \n end", "def prepareExecution(iUserID, iComment)\n # Nothing to do\n yield\n end", "def shell(&block)\n task('shell').tap do |t|\n t.enhance &block if block\n end\n end", "def exec(command, options = {}, &block) #:yields: stdin\n exec4(command, options) do |pid, stdin, stdout, stderr|\n block.call(stdin) if block_given?\n stdin.close_write\n pid, status = Process.waitpid2(pid)\n raise Error, stderr.read.chomp if status.exitstatus.nonzero?\n stdout\n end\n end", "def exec3(command, options = {}, &block) #:yields: stdin, stdout, stderr\n exec4(command, options) do |pid, stdin, stdout, stderr|\n block.call(stdin, stdout, stderr) if block_given?\n stdin.close_write\n pid, status = Process.waitpid2(pid)\n raise Error, stderr.read.chomp if status.exitstatus.nonzero?\n [stdin, stdout, stderr]\n end\n end", "def on_block_break(evt)\n target_block = evt.block\n player = evt.player\n tool = player.inventory.item_in_main_hand\n return if player.sneaking?\n return unless pickaxe?(tool.type) || spade?(tool.type)\n return unless has_job?(player)\n return unless range_breakable?(target_block)\n\n n = case tool.type\n when Material::IRON_PICKAXE then 1\n when Material::DIAMOND_PICKAXE then 1\n else 1\n end\n\n around_blocks = cubic_around_blocks(target_block, n)\n blocks = around_blocks.reject { |block|\n block.y < player.location.y\n }.select { |block|\n breakable_together?(target_block, block)\n }\n\n blocks.each do |block|\n later(0) do\n block.break_naturally(tool)\n end\n end\n\n end", "def execute(*command, &block)\n # Get the options hash if it exists\n opts = {}\n opts = command.pop if command.last.is_a?(Hash)\n\n tries = 0\n tries = 3 if opts[:retryable]\n\n sleep = opts.fetch(:sleep, 1)\n\n # Variable to store our execution result\n r = nil\n\n retryable(:on => LXC::Errors::ExecuteError, :tries => tries, :sleep => sleep) do\n # Execute the command\n r = raw(*command, &block)\n\n # If the command was a failure, then raise an exception that is\n # nicely handled by Vagrant.\n if r.exit_code != 0\n if @interrupted\n raise LXC::Errors::SubprocessInterruptError, command.inspect\n else\n raise LXC::Errors::ExecuteError,\n command: command.inspect, stderr: r.stderr, stdout: r.stdout, exitcode: r.exit_code\n end\n end\n end\n\n # Return the output, making sure to replace any Windows-style\n # newlines with Unix-style.\n stdout = r.stdout.gsub(\"\\r\\n\", \"\\n\")\n if opts[:show_stderr]\n { :stdout => stdout, :stderr => r.stderr.gsub(\"\\r\\n\", \"\\n\") }\n else\n stdout\n end\n end", "def executeQueuedTasks\n until @tasks.empty?\n task = @tasks.shift\n task.resume if task.alive?\n end\n end", "def pipe(command, continue = false)\n log(2, \"Action: pipe to #{command.inspect}\")\n deliver_pipe(command, @message)\n if $? != 0\n\tm = \"pipe failed for command #{command.inspect}\"\n log(1, \"Error: \" + m)\n\traise DeliveryCommandFailure.new(m, $?)\n end\n unless continue\n\traise DeliverySuccess.new(\"pipe to #{command.inspect}\")\n end\n end", "def block_fork(board)\n\t\treturn fork(board, opponent_symbol(@symbol))\n\tend", "def exec_command_or_do(command, from, &block)\n return if self.exec_command(command, from)\n\n unless block.nil?\n @log.info \"Executing default action\"\n block.call(command, from)\n end\n end", "def send_pipeline_command(command, &block)\n with_command_shell(command) do |shell, cmd|\n response_reader.read_message(command_output_message(shell, cmd), true, &block)\n end\n end", "def i_continue\n yield\n puts \"after yield\"\nend", "def launch(cmd, &block)\n\t\tself.class.launch(cmd, &block)\n\tend", "def command\n consume 1, :command\n end", "def update_command\n while @commands.size > 0 && proccess_command(@commands[0])\n @commands.shift\n end\n end", "def runTask task\n while !task.finished && task.status < 16 do\n task.run\n\n if task.status == 8 && task.wait > 0\n sleep task.wait\n end\n end\n end", "def execute(&block)\n block.call\n puts \"End of block\"\nend", "def setup_while\n return TSBS.error(@acts[0], 2, @used_sequence) if @acts.size < 3\n cond = @acts[1]\n action_key = @acts[2]\n actions = (action_key.class == String ? TSBS::AnimLoop[action_key] :\n action_key)\n if actions.nil?\n show_action_error(action_key)\n end\n begin\n while eval(cond)\n exe_act = actions.clone\n until exe_act.empty? || @break_action\n @acts = exe_act.shift\n execute_sequence\n end\n end\n rescue StandardError => err\n display_error(\"[#{SEQUENCE_WHILE},]\",err)\n end\n end", "def paused_exec\n raise \"No block given.\" if !block_given?\n self.pause\n \n begin\n sleep 0.2 while @httpserv and @httpserv.working_count and @httpserv.working_count > 0\n @paused_mutex.synchronize do\n Timeout.timeout(15) do\n yield\n end\n end\n ensure\n self.unpause\n end\n end", "def test_yields_self_to_block\n inner = nil\n outer = Crd::Flex::Command.new 'mxmlc' do |c|\n inner = c\n end\n assert_same( outer, inner )\n end", "def select_wrapping_block\n buffer_current.select_wrapping_block\n update_status_line\n end", "def chain(&block)\n commands = Commands.new(mode: :chain)\n commands.instance_eval(&block)\n self.!(commands)\n end", "def step\n unless halt?\n next_states = exec_blocks(get_blocks)\n \n if next_states.empty?\n @halt = true\n else\n @cur_state = next_states.pop\n end\n \n return next_states, @tape\n end\n end", "def work(&block)\n Celluloid::Logger.info \"Preparing work...\"\n self.working_code = block if block_given?\n end", "def run\n\t\t\t\t@wrapper.run do |command|\n\t\t\t\t\t@log.puts \"-> #{command.inspect}\"\n\t\t\t\t\t\n\t\t\t\t\tresult = yield command\n\t\t\t\t\t\n\t\t\t\t\t@log.puts \"<- #{result.inspect}\"\n\t\t\t\t\t\n\t\t\t\t\tnext result\n\t\t\t\tend\n\t\t\tend", "def _LineBlock\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_ItemsList)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_LineCommand)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_LineBlock unless _tmp\n return _tmp\n end", "def process_shell_command\n command_line.set_prompt ':!'\n cmd = command_line.get_command(prompt: ':!')[1..-1]\n execute_external_command pause: true do\n system cmd\n end\n rescue Interrupt\n ensure\n command_line.clear\n command_line.noutrefresh\n end", "def perform_blocks\n execute_with_block do | thread_id, task |\n task.call(thread_id)\n end\n end", "def ssh(commandString, dryRun)\n #N Without this, command being executed won't be echoed to output\n puts \"SSH #{userAtHost} (#{shell.join(\" \")}): executing #{commandString}\"\n #N Without this check, the command will execute even it it's meant to be a dry run\n if not dryRun\n #N Without this, the command won't actually execute and return lines of output\n output = getCommandOutput(shell + [userAtHost, commandString])\n #N Without this loop, the lines of output won't be processed\n while (line = output.gets)\n #N Without this, the lines of output won't be passed to callers iterating over this method\n yield line.chomp\n end\n #N Without closing, the process handle will leak resources\n output.close()\n #N Without a check on status, a failed execution will be treated as a success (yielding however many lines were output before an error occurred)\n checkProcessStatus(\"SSH #{userAtHost} #{commandString}\")\n end\n end", "def ejecutar2(&bloque)\r\n if block_given?\r\n bloque.call #same as yield\r\n else\r\n puts 'No tiene bloque asignado'\r\n end\r\nend", "def readBlock(pieceIndex, offset, length)\n id = returnAndIncrRequestId\n return id if @state == :after_stop\n @requests.push [id, :read_block, pieceIndex, offset, length]\n @requestsSemaphore.signal\n id\n end", "def step(msg, &block)\n yield\n end", "def process_command_queue\n @commands.pop do |command|\n op = proc do\n if built_in?(command[:command])\n run_built_in(command[:command])\n else\n run_in_slave(command[:command])\n end\n end\n cb = proc do |output|\n command[:callback].call(output)\n process_command_queue\n end\n EM.defer(op, cb)\n end\n end", "def shift non_block=false\n @messages.shift(non_block)\n end", "def run_command interval, duration\n (duration / interval).times do \n yield\n sleep(interval)\n end\nend", "def next_piece\n @current_block = MyPieceChallenge.next_piece(self)\n @current_pos = nil\n @auto_used = false\n end", "def run\n begin\n loop do\n command = @queue.pop\n start_time = Time.now\n # Commands are defined in command modules\n command['command'] == 'STOP' ? break : self.send(command['method'].to_sym, @agent, @state)\n end_time = Time.now\n diff = end_time - start_time\n @responses << {id: @id, command: command['command'], method: command['method'], step: command['step'], status: @agent.page.code, time: diff}\n break unless ['200', '301', '302'].include? @agent.page.code\n end\n rescue Exception => e\n puts \"Something went wrong! Bot: #{@id}, #{e}\"\n @responses << {id: @id, status: 'dead'}\n end\n end", "def pipe(&block)\n cmds = Commands.new(mode: :pipe)\n cmds.instance_eval(&block)\n self.!(cmds.to_a)\n end", "def execute\n yield self if block_given?\n end", "def __execute\n Thread.new do\n tasks = flatten_task_tree\n pipe_reader, pipe_writer = IO.pipe\n @__pid = execute_in_process(tasks, pipe_reader, pipe_writer)\n pipe_writer.close\n\n tasks.each do |task|\n task.__pid = @__pid\n task.__status = TaskStatus::RUNNING\n\n begin\n task.__result = Marshal.load(pipe_reader)\n rescue EOFError\n # do nothing\n end\n\n if task.__result == '__TASK_FINISHED_WITH_EXCEPTION__'\n faulted_result(task, Marshal.load(pipe_reader))\n else\n task.__result = nil if task.__result == '__TASK_FINISHED_NO_RESULT__' || task.canceled?\n task.__status = TaskStatus::COMPLETED unless task.canceled?\n end\n\n yield if block_given?\n\n case task.__status\n when TaskStatus::COMPLETED\n task.oncomplete_block&.call(task)\n when TaskStatus::FAULTED\n task.onfault_block&.call(task)\n end\n end\n\n pipe_reader.close\n end\n end", "def run\n @wait = 0\n @status = @@statuses[:running]\n while !@finished && @wait == 0 && @status != @@statuses[:error]\n begin\n execState\n rescue\n pp $!\n pp $@\n puts \"An error occured.\"\n @status = :error\n end\n end\n\n # The only way it exits the loop is if the task is finished or waiting.\n @status = @finished ? :finished : :waiting\n end", "def start(&block)\n while line = next_line\n cmd, *args = parse(line)\n cmd && !cmd.empty? ?\n # If the command is not empty - invoke the handler\n block.call(cmd, args) :\n # Empty command ends the processing loop\n break\n end\n end", "def run_errored_command(broker, targets, command)\n run_command(broker, targets, command,\n blocking_request: true,\n expected_response_type: \"http://puppetlabs.com/rpc_error_message\") do |response_dataset|\n response_dataset.each { |data| yield data['description'] } if block_given?\n end\nend", "def chore\n if complete?\n stat :found_completed, item_id: object_id\n return\n end\n stat :will_execute, item_id: object_id\n begin\n @result = @block.call(*@args)\n rescue Exception => e\n @error = e\n end\n stat :did_execute, item_id: object_id\n discard\n end", "def begin\n puts instruction\n\n while read_command(gets.chomp)\n end\n end", "def _runCommand(command)\n pid = Process.spawn command\n #pid = fork {exec command}\n Process.waitpid(pid)\n end", "def start\n while @next_command_index < @commands_array.length\n apply_command(@commands_array[@next_command_index])\n @next_command_index += 1\n end\n end" ]
[ "0.58563584", "0.5820798", "0.57175434", "0.5440751", "0.53977746", "0.5369646", "0.5253311", "0.51831436", "0.51503336", "0.51449543", "0.51425433", "0.5089442", "0.50614905", "0.5060039", "0.5044992", "0.5001407", "0.49813578", "0.49724594", "0.4968552", "0.49647057", "0.4950657", "0.48930758", "0.4878217", "0.48623276", "0.48617885", "0.48570216", "0.48371163", "0.4822233", "0.4821562", "0.48196912", "0.4792934", "0.4788864", "0.4773865", "0.47649643", "0.4761352", "0.47526515", "0.475172", "0.47516686", "0.47411573", "0.4738417", "0.47316054", "0.47279382", "0.47254154", "0.4713844", "0.4668483", "0.46637747", "0.4662616", "0.46614155", "0.465781", "0.46505713", "0.46478125", "0.46407554", "0.46362177", "0.46346727", "0.4632606", "0.4625834", "0.46168917", "0.46126962", "0.46051642", "0.4603168", "0.4603055", "0.45968533", "0.4593406", "0.4589666", "0.45824483", "0.45704365", "0.4565043", "0.45642704", "0.45557806", "0.45491233", "0.45483923", "0.4548146", "0.45398992", "0.4538836", "0.453779", "0.45359626", "0.45273912", "0.45235065", "0.452089", "0.45147002", "0.45131952", "0.45052812", "0.45023906", "0.44974816", "0.4497438", "0.4493958", "0.4492133", "0.44895542", "0.44892067", "0.4488197", "0.44876707", "0.44871184", "0.44756088", "0.44744575", "0.44676256", "0.44630384", "0.44625157", "0.44619337", "0.44618842", "0.4459684" ]
0.47904146
31
For big jobs splitting them into subthreads and such. But they need to be debugged, and IIRC there's a deadlock condition
def action_thread(&block) collector = sub_collector return Thread.new do $stdout.set_thread_collector(collector) block.call $stdout.remove_thread_collector(collector) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_job() \n number_of_real_process = @cores * 2\n number_of_columns_to_render = @job.ending_column - @job.starting_column\n\n number_of_jobs_that_we_want_to_create = number_of_real_process\n if((number_of_columns_to_render/number_of_real_process) < 1) \n number_of_jobs_that_we_want_to_create = number_of_columns_to_render\n end\n\n @subjobs = generate_subjobs(number_of_jobs_that_we_want_to_create) \n end", "def in_parallel?; end", "def allow_concurrency; end", "def allow_concurrency; end", "def work_pool; end", "def queue_job; end", "def reserve_and_run_one_job; end", "def allowing_other_threads; end", "def worker_pool; end", "def worker_pool; end", "def fork_worker(after_requests = T.unsafe(nil)); end", "def check_for_stuck_jobs\n Job.incomplete.each do |job|\n if job.stuck_chunks?\n job.priority = 50\n job.save!\n job.resend_stuck_chunks \n elsif job.stuck_packing?\n job.send_pack_request\n end\n end\n end", "def deadlock_scenario(low, high, slice)\n t1 = n_threads(2) do\n (low..high).each_slice(slice) do |commits|\n ActiveRecord::Base.transaction do\n # debug helper\n # puts \"Enqueue: [#{commits.join(', ')}] #{Thread.current}\"\n commits.each do |x|\n Delayed::Job.enqueue_once SomeJob.new(x)\n Thread.pass\n sleep 0.005\n Delayed::Job.enqueue AnotherJob.new(x)\n end\n # debug helper\n # puts \" [#{commits.join(', ')}] -- DONE #{Thread.current}\"\n end\n end\n end\n\n t2 = n_threads(2) do\n high.downto(low).each_slice(slice) do |commits|\n\n ActiveRecord::Base.transaction do\n # puts \"Enqueue: [#{commits.join(', ')}] #{Thread.current}\"\n commits.each do |x|\n Delayed::Job.enqueue_once SomeJob.new(x)\n sleep 0.005\n Thread.pass\n Delayed::Job.enqueue AnotherJob.new(x)\n end\n # puts \" [#{commits.join(', ')}] -- DONE #{Thread.current}\"\n end\n end # high -> low\n end\n\n t3 = n_threads(1) do\n (low..high).each do |x|\n Delayed::Job.enqueue_once SomeJob.new(x)\n sleep 0.02\n end\n end\n t1 + t2 + t3\n end", "def threadpool\n\n\n # work queue defines 1000 times iteration\n\twork_q = Queue.new\n\t(0...999).to_a.each { |i| work_q << i }\n\n\tt = []\n\tputs Benchmark.measure{\n # we spawn only 5 threads\n\t\tt = (0...4).map do \n\t\t\tThread.new do\n\t\t\t\tbegin \n # before taking any action \n # thread try to pop from work queue\n # if work queue is empty then \n # threaderror exception get raised\n\t\t\t\t\twhile x = work_q.pop(true)\n\t\t\t\t\t\t#puts x\n\t\t\t\t\t\tdumb(x) \n\t\t\t\t\tend\n\t\t\t\trescue ThreadError\n\t\t\t\tend\n\t\t\tend\t\n\t\tend\n\t\tt.each { |x| x.join }\n\t}\n\nend", "def on_worker_fork(&block); end", "def parallelize_me!; end", "def cheap_wait; end", "def jobs\r\n end", "def lock; end", "def lock; end", "def lock; end", "def after_worker_fork(&block); end", "def flush!\n # Check for finished jobs\n @jobs_running.select! do |job|\n r = (job[:ds].nil? ? project : job[:ds]).add_result(job[:job], false)\n say \"Completed pid:#{job[:pid]} for #{job[:task_name]}.\" unless r.nil?\n r.nil?\n end\n # Avoid single datasets hogging resources\n @jobs_to_run.rotate! rand(jobs_to_run.size)\n # Launch as many +jobs_to_run+ as possible\n while jobs_running.size < maxjobs\n break if jobs_to_run.empty?\n launch_job @jobs_to_run.shift\n end\n end", "def master_queue; @master_queue ||= []; end", "def execute_parallel_action \n Log.instance.info(\"execute_parallel_action call / action: #{request.action}, agent=#{request.agent}, data=#{request.data.pretty_inspect}\")\n #validate :joblist, /\\A[\\w\\+\\/= \\{\\}\\\"@\\-\\.:\\'\\\\\\n~,_]+\\z/\n #validate :joblist, :shellsafe\n\n joblist = request[config.identity]\n pidlist = []\n inline_list = []\n joblist.each { |parallel_job|\n job = parallel_job[:job]\n cartridge = job[:cartridge]\n action = job[:action]\n args = job[:args]\n if cartridge == 'openshift-origin-node' && action != 'connector-execute'\n inline_list << parallel_job\n else\n begin\n if cartridge == 'openshift-origin-node' && action == 'connector-execute'\n pid, stdin, stdout, stderr = oo_connector_execute(action, args)\n else\n pid, stdout, stderr = execute_parallel_job(cartridge, action, args)\n end\n rescue Exception =>e\n parallel_job[:result_exit_code] = 127\n parallel_job[:result_stdout] = e.message\n parallel_job[:result_stderr] = e.message\n next\n end\n pidlist << [parallel_job, pid, stdout, stderr]\n end\n }\n\n # All the inline calls are made using multiple threads instead of processes\n in_threads = []\n inline_list.each do |parallel_job|\n # BZ 876942: Disable threading until we can explore proper concurrency management\n # in_threads << Thread.new(parallel_job) do |pj| # BZ 876942\n pj = parallel_job # BZ 876942\n begin\n handle_oo_job(pj)\n rescue Exception => e\n pj[:result_exit_code] = 1\n pj[:result_stdout] = e.message\n pj[:result_stderr] = e.message\n next\n end\n # end # BZ 876942\n end\n in_threads.each { |thr| thr.join }\n\n pidlist.each { |reap_args|\n pj, pid, sout, serr = reap_args\n reap_output(pj, pid, sout, serr)\n }\n Log.instance.info(\"execute_parallel_action call - 10 #{joblist}\")\n reply[:output] = joblist\n reply[:exitcode] = 0\n end", "def jobs\n raise NotImplementedError\n end", "def execute_cron_job\n lambda do\n |request, jle|\n $db_lock.synchronize {\n jle.run_status = 'Running'\n jle.start_time = Time.now\n jle.save(:validate => false)\n }\n jlh = Hash.new\n jlh[:run_status] = \"Failure\"\n @@thread_count = @@thread_count + 1;\n Thread.current[:name] = \"JOB_THREAD \" + request.to_s + ' ' + @@thread_count.to_s;\n Thread.current[:watchdogged] = false\n begin\n jmd = JobMetadata.job_code(request)[0]\n @job_map[Thread.current] = jmd.max_execution_minutes.to_i.minutes.from_now\n\n jlh[:jmd] = jmd\n jlh[:jle] = jle\n commands = gather_commands(true,request)\n commands = commands[request]\n if (commands.nil? || commands.empty?)\n $logger.error(\"There are no commands for request #{request}. Exiting...\")\n return\n end\n $logger.debug(\"The size of commands is \" << commands.length.to_s)\n #total_result = nil\n commands.each do |command|\n command.chomp!\n $logger.debug(\"command = #{command}\")\n #$stderr.puts(\"executing #{command}\")\n #result = `#{command}` There seems to be a bug in ruby where backticks hang in multi threaded situations\n result = JobEngine.execute_command_to_temp(command)\n #$stderr.puts(\"executed #{command}\")\n result.chomp!\n\n if (jlh[:job_result].nil?)\n jlh[:job_result] = result\n else\n jlh[:job_result] << \"\\n\" << result\n end\n $logger.debug(\"the result is #{result}...\")\n #check to see if the command is in\n end\n # $stderr.puts(\"About to finish the jle\")\n # finish_job_log_entry(Time.now,total_result, jle, nil)\n jlh[:run_status] = \"Completed\"\n # $stderr.puts(\"finished the jle\")\n # email_job_result(total_result,jle,jmd) if jmd.email_result\n # $stderr.puts(\"emailed\") if jmd.email_result\n # $stderr.puts(\"not emailed\") unless jmd.email_result\n\n rescue =>ex\n error = \"An execution thread terminated while executing \" << request\n $logger.error(error)\n $logger.error(ex.to_s)\n jlh[:job_result] = '' if jlh[:job_result].nil?\n jlh[:job_result] << ex.to_s\n ensure\n unless jlh[:run_status].eql?(\"Completed\")\n jlh[:job_result] = '' if jlh[:job_result].nil?\n if (Thread.current[:watchdogged])\n jlh[:job_result] << \"\\nKilled by the job watch dog at \" + Thread.current[:watchdogged_time].to_s + \"!\"\n else\n jlh[:job_result] << \"\\nAn exceptional event occurred!\"\n end\n end\n finish_job_log_entry(jlh)\n end\n end\n end", "def lock!; end", "def merge_pending_jobs!(data, shutdown=false)\n merged_data = data\n rows_start = data.length\n begin\n # Grab a lock so other workers don't fight over grabbing these jobs\n @commit_lock_manager.lock(pending_lock_key, @lock_timeout*2) do |locked|\n return merged_data unless locked\n\n while @queue.pending_jobs.merge_ready?(rows_start, @upload_min_batch_size, shutdown)\n merged_data = @queue.pending_jobs.reduce(merged_data, @upload_min_batch_size, shutdown)\n break if merged_data.length == rows_start\n\n end\n end\n if merged_data.length > rows_start\n @logger.debug(\"Merged pending jobs\",\n :stream_id => @stream_id,\n :execution_id => @queue.execution_id,\n :pipeline_id => pipeline_id,\n :rows_start => rows_start,\n :rows_pending => @queue.pending_jobs.length,\n :rows_merged => merged_data.length)\n end\n rescue Redlock::LockError\n # Do nothing\n rescue Redis::BaseConnectionError\n # Do nothing\n end\n\n merged_data\n end", "def collect_new_jobs\n raise NotImplementedError\n end", "def refork; end", "def executor; end", "def executor; end", "def executor; end", "def launch_worker\n @worker_threads << Thread.new {\n while work = @work_queue.pop\n begin\n #RJR::Logger.debug \"launch thread pool job #{work}\"\n work.pool_lock = @pool_lock\n @running_queue << work\n work.exec\n # TODO cleaner / more immediate way to pop item off running_queue\n #RJR::Logger.debug \"finished thread pool job #{work}\"\n rescue Exception => e\n # FIXME also send to rjr logger at a critical level\n puts \"Thread raised Fatal Exception #{e}\"\n puts \"\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n } unless @worker_threads.size == @num_threads\n end", "def test_no_task()\n [0, 10].each() do |concurrent_duties|\n [true, false].each() do |persistent_workers|\n [true, false].each() do |perform_now|\n assert_nothing_thrown() do\n s = generate_spawner(concurrent_duties, persistent_workers, 0,\n @jobs_log_file, @spawner_log_file)\n generate_tasks_addition(s, 0, perform_now, 2) {}\n end\n\n assert_equal(0, File.stat(@jobs_log_file).size(), \"The jobs log is not empty, while it should\")\n end\n end\n end\n end", "def flaky_jobs\n if !exhausted? && !build_failed_fast?\n raise \"Queue is not yet exhausted\"\n end\n\n requeued = @redis.hkeys(key_requeues)\n\n return [] if requeued.empty?\n\n requeued - @redis.hkeys(key_failures)\n end", "def invoke_job\r\n\r\n # BgWorker.log(\"Worker: invoke job\")\r\n\r\n fork {\r\n\r\n # BgWorker.log(\"Worker: fork: system 'cd #{Rails.root}; rake #{self.name}'\")\r\n\r\n `cd #{Rails.root}; rake #{self.name}`\r\n\r\n # BgWorker.log(\"Worker: fork: closing job #{res ? 'OK' : 'KO'}, return code: #{$?}\")\r\n\r\n self.close_job($?)\r\n }\r\nend", "def jobs\n\t\t# ...\n\tend", "def test_return_in_job()\n assert_nothing_thrown() do\n s = generate_spawner(1, false, 0, @jobs_log_file, @spawner_log_file)\n generate_tasks_addition(s, 1, true, 2) {return 42}\n end\n end", "def calc_queued_jobs_requesting_GPUs\n @queued_jobs_requesting_gpus = 0\n #@queued_jobs_requesting_gpus = 0\n #@oodClustersAdapter.info_all_each { |job| queued_jobs_requesting_gpus_counter(job) }\n #@queued_jobs_requesting_gpus\n end", "def command_queue; end", "def thread; end", "def thread; end", "def thread; end", "def test_asynchronous_job_has_no_segmentation_by_default\n omit_if(@service.splunk_version[0] == 4)\n job = @service.jobs.create(\"search index=_internal GET | head 3\")\n until job.is_done?()\n sleep(0.1)\n end\n assert_false(job.events().include?(\"<sg\"))\n assert_false(job.preview().include?(\"<sg\"))\n end", "def before_fork; end", "def test_suicide_duty()\n [1, 2].each() do |concurrent_duties|\n [true, false].each() do |persistent_workers|\n assert_nothing_thrown() do\n s = generate_spawner(concurrent_duties, persistent_workers, 0,\n @jobs_log_file, @spawner_log_file)\n\n generate_tasks_addition(s, 2, true, 2) {exit 42}\n end\n end\n end\n end", "def test_dead_lock\n begin\n Thread.current.name = \"MainThread!\"\n z = Thread.new{Thread.stop}\n a, b = Thread.new { 1 until b; b.join }, Thread.new { 1 until a; a.join }\n a.name = \"aaaaa\"\n b.name = \"bbbbb\"\n z.name = \"zzzz\"\n a.join\n\n flunk 'should dead lock'\n rescue Exception => e\n error_info = e.inspect\n assert /No live threads left. Deadlock\\?/ =~ error_info\n assert error_info.lines.size > 50\n end\nend", "def allow_concurrency=(_arg0); end", "def allow_concurrency=(_arg0); end", "def spawn\n Thread.new {\n c = Thread.current\n c[:run] = true\n\n while c[:run]\n job = @jobs.pop\n begin\n job.call\n rescue Exception => e\n @logger.error(\"Exception occured during build: #{e.message}\")\n end\n @njobs.dec\n end\n }\n end", "def do_not_thread; true; end", "def do_not_thread; true; end", "def do_not_thread; true; end", "def work\n if job = lock_job\n QC.log_yield(:at => \"work\", :job => job[:id]) do\n process(job)\n end\n end\n end", "def run_job(job)\r\n @log = Logger.new(File.expand_path(\"#{Rails.root}/log/cleaner_job.log\", __FILE__))\r\n @log.info(\"#{self.class} started (id:#{self.id})\") \r\n \r\n # clean raw_programs\r\n if self.clean_raw_programs\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Deleting #{RawProgram.count} raw programs.\")\r\n job.save \r\n RawProgram.delete_all\r\n end\r\n \r\n # clean raw_channels\r\n if self.clean_raw_channels\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Deleting #{RawChannel.count} raw channels.\")\r\n job.save \r\n RawChannel.delete_all\r\n end\r\n \r\n # clean all broadcast_events\r\n if self.clean_broadcast_events\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Deleting #{BroadcastEvent.count} broadcast events.\")\r\n job.save \r\n BroadcastEvent.delete_all\r\n end\r\n \r\n # clean historic broadcast_events\r\n if self.clean_broadcast_events\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Deleting #{BroadcastEvent.historic.count} historic broadcast events.\")\r\n job.save \r\n BroadcastEvent.historic.delete_all\r\n end\r\n \r\n # clean programs\r\n if self.clean_programs\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Deleting #{Program.count} programs.\")\r\n job.save \r\n Program.delete_all\r\n end\r\n \r\n # clean broadcast_services\r\n if self.clean_broadcast_services\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Deleting #{BroadcastService.count} broadcast services.\")\r\n job.save \r\n BroadcastService.delete_all\r\n end \r\n \r\n # clean channels\r\n if self.clean_channels\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Deleting #{Channel.count} channels.\")\r\n job.save \r\n Channel.delete_all\r\n end\r\n \r\n # entire job is completed\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > #{self.class} completed (id:#{self.id})\")\r\n job.save\r\n \r\n @log.info(\"#{self.class} completed (id:#{self.id})\")\r\n return true\r\n end", "def test_empty_tasks()\n [3, 10].each() do |concurrent_duties|\n [true, false].each() do |persistent_workers|\n [true, false].each() do |perform_now|\n assert_nothing_thrown() do\n s = generate_spawner(concurrent_duties, persistent_workers, 0,\n @jobs_log_file, @spawner_log_file)\n generate_tasks_addition(s, 10, perform_now, 3) {}\n end\n\n assert_equal(0, File.stat(@jobs_log_file).size(), \"The jobs log is not empty, while it should\")\n end\n end\n end\n end", "def before_starting_workers\n end", "def _test_threads\n m = Mutex.new \n threads = []\n @custom_number_of_users.times do\n threads << Thread.new do\n m.synchronize {threaded_mage_checkout}\n threaded_mage_checkout\n end\n end\n threads.each {|x| x.join}\n end", "def run\n\t\t\tSignal.trap(\"INT\") do\n\t\t\t\tdie = true if (Time.now.to_i - @last_sigterm) < 5\n\t\t\t\tif !die\n\t\t\t\t\tputs \"------------------------------\"\n\t\t\t\t\tputs \"Thread and lock debugging data\"\n\t\t\t\t\tputs \"------------------------------\"\n\t\t\t\t\tputs \"Open flock() locks:\"\n\t\t\t\t\tpp MU::MommaCat.locks\n\t\t\t\t\tputs \"------------------------------\"\n\t\t\t\tend\n\t\t\t Thread.list.each do |t|\n\t\t\t\t\tnext if !t.status # skip threads that've been cleanly terminated\n\t\t\t\t\tif die\n\t\t\t\t\t\tif t.object_id != Thread.current.object_id and t.thread_variable_get(\"name\") != \"main_thread\"\n\t\t\t\t\t t.kill\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tthread_name = t.thread_variable_get(\"name\")\n\t\t\t\t\t\tputs \"Thread #{thread_name} (#{t.object_id}): #{t.inspect} #{t.status}\"\n\t\t\t\t\t\tt.thread_variables.each { |tvar|\n\t\t\t\t\t\t\tputs \"#{tvar} = #{t.thread_variable_get(tvar)}\"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpp t.backtrace\n\t\t\t\t\t\tif !@dependency_threads[thread_name].nil?\n\t\t\t\t\t\t\tputs \"\"\n\t\t\t\t\t\t\tputs \"Waiting on #{@dependency_threads[thread_name]}\"\n\t\t\t\t\t\t\tThread.list.each { |parent|\n\t\t\t\t\t\t\t\tparent_name = parent.thread_variable_get(\"name\")\n\t\t\t\t\t\t\t\tif @dependency_threads[thread_name].include?(parent_name)\n\t\t\t\t\t\t\t\t\tputs \"\\t#{parent_name} (#{parent.object_id}): #{parent.inspect} #{parent.status}\"\n\t\t\t\t\t\t\t\t\tparent.thread_variables.each { |tvar|\n\t\t\t\t\t\t\t\t\t\tputs \"\\t#{tvar} = #{parent.thread_variable_get(tvar)}\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tend\n\t\t\t\t\t\tputs \"------------------------------\"\n\t\t\t\t\t\tt.run\n\t\t\t\t\tend\n\t\t\t end\n\t\t\t\tif !die\n\t\t\t\t\tputs \"Received SIGINT, hit ctrl-C again within five seconds to kill this deployment.\"\n\t\t\t\telse\n\t\t\t\t\traise \"Terminated by user\"\n\t\t\t\tend\n\t\t\t\t@last_sigterm = Time.now.to_i\n\t\t\tend\n\n\t\t\tbegin\n\t\t\t\tkeyname, ssh_private_key, ssh_public_key = createEc2SSHKey\n\n\t\t\t\tmetadata = {\n\t\t\t\t\t\"appname\" => @appname,\n\t\t\t\t\t\"timestamp\" => @timestamp,\n\t\t\t\t\t\"environment\" => @environment,\n\t\t\t\t\t\"seed\" => MU.seed,\n\t\t\t\t\t\"deployment_start_time\" => @timestart,\n\t\t\t\t\t\"chef_user\" => MU.chef_user\n\t\t\t\t}\n\t\t\t\tmommacat = MU::MommaCat.new(\n\t\t\t\t\tMU.mu_id,\n\t\t\t\t\tcreate: true,\n\t\t\t\t\tconfig: @main_config,\n\t\t\t\t\tverbose: MU.verbose,\n\t\t\t\t\tssh_key_name: keyname,\n\t\t\t\t\tssh_private_key: ssh_private_key,\n\t\t\t\t\tssh_public_key: ssh_public_key,\n\t\t\t\t\tdeployment_data: metadata\n\t\t\t\t)\n\t\t\t\tMU.setVar(\"mommacat\", mommacat)\n\n\t\t\t\t@admins.each { |admin|\n\t\t\t\t\tnotify(\"admins\", admin['name'], admin)\n\t\t\t\t}\n\n\t\t\t\t@deploy_semaphore = Mutex.new\n\n\t\t\t\tparent_thread_id = Thread.current.object_id\n\n\t\t\t\t# Kick off threads to create each of our new servers.\n\t\t @my_threads << Thread.new {\n\t\t\t\t\tMU.dupGlobals(parent_thread_id)\n\t\t\t\t\tThread.current.thread_variable_set(\"name\", \"mu_create_container\")\n\t\t\t\t\tMU.resource_types.each { |cloudclass|\n\t\t\t\t\t\tif !@main_config[cloudclass.cfg_plural].nil? and\n\t\t\t\t\t\t \t\t@main_config[cloudclass.cfg_plural].size > 0 and\n\t\t\t\t\t\t\t\tcloudclass.instance_methods(false).include?(:create)\n\t\t\t\t\t\t\tcreateResources(@main_config[cloudclass.cfg_plural], \"create\")\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t# Some resources have a \"deploy\" phase too\n\t\t @my_threads << Thread.new {\n\t\t\t\t\tMU.dupGlobals(parent_thread_id)\n\t\t\t\t\tThread.current.thread_variable_set(\"name\", \"mu_deploy_container\")\n\t\t\t\t\tMU.resource_types.each { |cloudclass|\n\t\t\t\t\t\tif !@main_config[cloudclass.cfg_plural].nil? and\n\t\t\t\t\t\t \t\t@main_config[cloudclass.cfg_plural].size > 0 and\n\t\t\t\t\t\t\t\tcloudclass.instance_methods(false).include?(:deploy)\n\t\t\t\t\t\t\tcreateResources(@main_config[cloudclass.cfg_plural], \"deploy\")\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t # Poke child threads to make sure they're awake\n\t\t\t @my_threads.each do |t|\n\t\t\t\t\tt.run if t.alive?\n\t\t\t end\n\n\t\t\t\tsleep 5\n\t\t\t \n\t\t\t # Reap child threads.\n\t\t\t @my_threads.each do |t|\n\t\t\t t.join\n\t\t\t end\n\t\t\trescue Exception => e\n\n\t\t\t @my_threads.each do |t|\n\t\t\t\t\tif t.object_id != Thread.current.object_id and t.thread_variable_get(\"name\") != \"main_thread\"\n\t\t\t\t\t\tMU::MommaCat.unlockAll\n\t\t\t\t t.kill\n\t\t\t\t\tend\n\t\t\t end\n\n\t\t\t\t# If it was a regular old exit, we assume something deeper in already\n\t\t\t\t# handled logging and cleanup for us, and just quietly go away.\n\t\t\t\tif e.class.to_s != \"SystemExit\"\n\t\t\t\t\tMU.log e.inspect, MU::ERR, details: e.backtrace\n\t\t\t\t\tif !@nocleanup\n\t\t\t\t\t\tMU::Cleanup.run(MU.mu_id, true, false, true, mommacat: mommacat)\n\t\t\t\t\tend\n\t\t\t\t\tMU.log e.inspect, MU::ERR\n\t\t\t\tend\n\n\t\t\t exit 1\n\t\t\tend\n\t\t\t\n\t\t\tdeployment[\"deployment_end_time\"]=Time.new.strftime(\"%I:%M %p on %A, %b %d, %Y\").to_s;\n\t\t\tMU::MommaCat.syncMonitoringConfig\t\n\n\t\t\t# Send notifications\n\t\t\tsendMail\n\t\t\tMU.log \"Deployment complete\", details: deployment\n\n\t\tend", "def job_key; Thread.current[:job_key]; end", "def mutex; end", "def mutex; end", "def mutex; end", "def mutex; end", "def test_failing_job_without_retries()\n assert_nothing_thrown() do\n s = generate_spawner(1, false, 0, @jobs_log_file, @spawner_log_file)\n generate_tasks_addition(s, 1, true, 2) {plop}\n end\n end", "def work\n if job = lock_job\n QC.log_yield(:action => \"work_job\", :job => job[:id]) do\n begin\n call(job)\n log(:action => \"finished_work\", :job => job[:id])\n rescue Object => e\n log(:action => \"failed_work\", :job => job[:id], :error => e.inspect)\n handle_failure(job, e)\n ensure\n @queue.delete(job[:id])\n log(:action => \"delete_job\", :job => job[:id])\n end\n end\n end\n end", "def run\n Signal.trap(\"INT\") do\n # Don't use MU.log in here, it does a synchronize {} and that ain't\n # legal inside a trap.\n die = true if (Time.now.to_i - @last_sigterm) < 5\n if !die and !MU::MommaCat.trapSafeLocks.nil? and MU::MommaCat.trapSafeLocks.size > 0\n puts \"------------------------------\"\n puts \"Thread and lock debugging data\"\n puts \"------------------------------\"\n puts \"Open flock() locks:\"\n pp MU::MommaCat.trapSafeLocks\n puts \"------------------------------\"\n end\n Thread.list.each do |t|\n next if !t.status # skip threads that've been cleanly terminated\n if !die\n thread_name = t.thread_variable_get(\"name\")\n puts \"Thread #{thread_name} (#{t.object_id}): #{t.inspect} #{t.status}\"\n t.thread_variables.each { |tvar|\n puts \"#{tvar} = #{t.thread_variable_get(tvar)}\"\n }\n pp t.backtrace\n if !@dependency_threads[thread_name].nil?\n puts \"\"\n puts \"Waiting on #{@dependency_threads[thread_name]}\"\n Thread.list.each { |parent|\n parent_name = parent.thread_variable_get(\"name\")\n if @dependency_threads[thread_name].include?(parent_name)\n puts \"\\t#{parent_name} (#{parent.object_id}): #{parent.inspect} #{parent.status}\"\n parent.thread_variables.each { |tvar|\n puts \"\\t#{tvar} = #{parent.thread_variable_get(tvar)}\"\n }\n end\n }\n end\n puts \"------------------------------\"\n t.run\n end\n end\n if !die\n puts \"Received SIGINT, hit ctrl-C again within five seconds to kill this deployment.\"\n else\n Thread.list.each do |t|\n next if !t.status\n if t.object_id != Thread.current.object_id and\n t.thread_variable_get(\"name\") != \"main_thread\" and \n t.thread_variable_get(\"owned_by_mu\")\n t.kill\n end\n end\n\n if @main_thread\n @main_thread.raise \"Terminated by user\"\n else\n raise \"Terminated by user\"\n end\n end\n @last_sigterm = Time.now.to_i\n end\n\n begin\n @main_thread = Thread.current\n if !@mommacat\n metadata = {\n \"appname\" => @appname,\n \"timestamp\" => @timestamp,\n \"environment\" => @environment,\n \"seed\" => MU.seed,\n \"deployment_start_time\" => @timestart,\n \"chef_user\" => MU.chef_user,\n \"mu_user\" => MU.mu_user\n }\n @mommacat = MU::MommaCat.new(\n MU.deploy_id,\n create: true,\n config: @main_config,\n environment: @environment,\n nocleanup: @nocleanup,\n no_artifacts: @no_artifacts,\n set_context_to_me: true,\n deployment_data: metadata,\n mu_user: MU.mu_user\n )\n MU.setVar(\"mommacat\", @mommacat)\n end\n\n @admins.each { |admin|\n @mommacat.notify(\"admins\", admin['name'], admin)\n }\n if @mommacat.numKittens(types: [\"Server\", \"ServerPool\"]) > 0\n MU::MommaCat.start\n end\n\n @deploy_semaphore = Mutex.new\n parent_thread_id = Thread.current.object_id\n\n # Run cloud provider-specific deploy meta-artifact creation (ssh keys,\n # resource groups, etc)\n @mommacat.cloudsUsed.each { |cloud|\n cloudclass = MU::Cloud.cloudClass(cloud)\n cloudclass.initDeploy(@mommacat)\n }\n @mommacat.writeDeploySecret\n\n # Kick off threads to create each of our new servers.\n @my_threads << Thread.new {\n MU.dupGlobals(parent_thread_id)\n Thread.current.thread_variable_set(\"name\", \"mu_create_container\")\n# Thread.abort_on_exception = false\n MU::Cloud.resource_types.values.each { |data|\n if !@main_config[data[:cfg_plural]].nil? and\n @main_config[data[:cfg_plural]].size > 0 and\n data[:instance].include?(:create)\n createResources(@main_config[data[:cfg_plural]], \"create\")\n end\n }\n }\n\n # Some resources have a \"groom\" phase too\n @my_threads << Thread.new {\n MU.dupGlobals(parent_thread_id)\n Thread.current.thread_variable_set(\"name\", \"mu_groom_container\")\n# Thread.abort_on_exception = false\n MU::Cloud.resource_types.values.each { |data|\n if !@main_config[data[:cfg_plural]].nil? and\n @main_config[data[:cfg_plural]].size > 0 and\n data[:instance].include?(:groom)\n createResources(@main_config[data[:cfg_plural]], \"groom\")\n end\n }\n }\n\n # Poke child threads to make sure they're awake\n @my_threads.each do |t|\n t.run if t.alive?\n end\n\n sleep 5\n\n # Reap child threads.\n @my_threads.each do |t|\n t.join\n end\n\n @mommacat.save!\n\n # XXX Functions have a special behavior where we re-invoke their groom\n # methods one more time at the end, so we can guarantee their\n # environments are fully populated with all sibling resource idents\n # regardless of dependency order. This is, obviously, a disgusting\n # hack, and we should revisit our dependency language in the next big\n # release.\n if !@main_config[\"functions\"].nil? and\n @main_config[\"functions\"].size > 0\n createResources(@main_config[\"functions\"], \"groom\")\n end\n\n rescue StandardError => e\n MU.log e.class.name, MU::ERR, details: caller\n\n @my_threads.each do |t|\n if t.object_id != Thread.current.object_id and\n t.thread_variable_get(\"name\") != \"main_thread\" and\n t.object_id != parent_thread_id\n MU::MommaCat.unlockAll\n t.kill\n end\n end\n\n # If it was a regular old exit, we assume something deeper in already\n # handled logging and cleanup for us, and just quietly go away.\n if e.class.to_s != \"SystemExit\"\n MU.log e.class.name+\": \"+e.message, MU::ERR, details: e.backtrace if @verbosity != MU::Logger::SILENT\n if !@nocleanup\n\n # Wrap this in a thread to protect the Azure SDK from imploding\n # because it mistakenly thinks there's a deadlock.\n cleanup_thread = Thread.new {\n MU.dupGlobals(parent_thread_id)\n Thread.abort_on_exception = false\n MU::Cleanup.run(MU.deploy_id, skipsnapshots: true, verbosity: @verbosity, mommacat: @mommacat)\n }\n cleanup_thread.join\n @nocleanup = true # so we don't run this again later\n end\n end\n\n\n @reraise_thread.raise MuError, e.inspect, e.backtrace if @reraise_thread\n Thread.current.exit\n ensure\n if @mommacat and @mommacat.numKittens(clouds: [\"CloudFormation\"]) > 0\n MU::Cloud::CloudFormation.writeCloudFormationTemplate(tails: MU::Config.tails, config: @main_config, path: @cloudformation_output, mommacat: @mommacat)\n # If we didn't build anything besides CloudFormation, purge useless\n # metadata.\n if @mommacat.numKittens(clouds: [\"CloudFormation\"], negate: true) == 0\n Thread.list.each do |t|\n if t.object_id != Thread.current.object_id and t.thread_variable_get(\"name\") != \"main_thread\" and t.object_id != parent_thread_id\n t.kill\n end\n end\n MU::Cleanup.run(MU.deploy_id, skipcloud: true, verbosity: MU::Logger::SILENT, mommacat: @mommacat)\n return\n end\n end\n end\n if @mommacat.numKittens(clouds: [\"CloudFormation\"], negate: true) > 0\n if !@mommacat.deployment['servers'].nil? and @mommacat.deployment['servers'].keys.size > 0\n # XXX some kind of filter (obey sync_siblings on nodes' configs)\n @mommacat.syncLitter(@mommacat.deployment['servers'].keys)\n end\n deployment = @mommacat.deployment\n deployment[\"deployment_end_time\"]=Time.new.strftime(\"%I:%M %p on %A, %b %d, %Y\").to_s;\n if MU.myCloud == \"AWS\" \n MU::Cloud::AWS.openFirewallForClients # XXX add the other clouds, or abstract\n end\n# MU::MommaCat.getLitter(MU.deploy_id, use_cache: false)\n if @mommacat.numKittens(types: [\"Server\", \"ServerPool\"]) > 0\n# MU::MommaCat.syncMonitoringConfig # TODO only invoke if Server or ServerPool actually changed something when @updating\n end\n end\n\n\n # Send notifications\n sendMail\n if @mommacat.numKittens(clouds: [\"AWS\"]) > 0\n MU.log \"Generating cost calculation URL for all Amazon Web Services resources.\"\n MU.setLogging(MU::Logger::SILENT)\n\n @environment ||= \"dev\"\n\n begin\n Thread.abort_on_exception = false\n t = Thread.new {\n Thread.abort_on_exception = true\n\n # I do not understand why this is necessary, but here we are.\n Thread.handle_interrupt(MU::Cloud::MuCloudResourceNotImplemented => :never) {\n begin\n Thread.handle_interrupt(MU::Cloud::MuCloudResourceNotImplemented => :immediate) {\n MU.log \"Cost calculator not available for this stack, as it uses a resource not implemented in Mu's CloudFormation layer.\", MU::DEBUG, verbosity: MU::Logger::NORMAL\n Thread.current.exit\n }\n ensure\n end\n }\n begin\n MU.setVar(\"deploy_id\", nil) # make sure we won't ever accidentally blow away the parent deploy\n cost_dummy_deploy = MU::Deploy.new(\n @environment.dup,\n verbosity: MU::Logger::SILENT,\n force_cloudformation: true,\n cloudformation_path: \"/dev/null\",\n nocleanup: false, # make sure we clean up the cost allocation deploy\n stack_conf: @original_config,\n reraise_thread: @main_thread,\n no_artifacts: true\n )\n cost_dummy_deploy.run\n rescue MU::Cloud::MuCloudFlagNotImplemented, MU::Cloud::MuCloudResourceNotImplemented, MU::MuError => e\n # This doesn't seem to get caught and I don't know why and I don't care\n# MU.log \"Failed to generate AWS cost-calculation URL. Skipping.\", MU::WARN, details: \"Deployment uses a feature not available in CloudFormation layer.\", verbosity: MU::Logger::NORMAL\n end\n }\n\n t.join\n rescue MU::Cloud::MuCloudFlagNotImplemented, MU::Cloud::MuCloudResourceNotImplemented => e\n # already handled in the thread what did it\n MU.log \"Failed to generate AWS cost-calculation URL. Skipping.\", MU::WARN, details: \"Deployment uses a feature not available in CloudFormation layer.\", verbosity: MU::Logger::NORMAL\n ensure\n MU.setLogging(@verbosity)\n MU.log \"Deployment #{MU.deploy_id} \\\"#{MU.handle}\\\" #{@updating ? \"updated\" : \"complete\"}\", details: deployment, verbosity: @verbosity\n end\n else\n MU.log \"Deployment #{MU.deploy_id} \\\"#{MU.handle}\\\" #{@updating ? \"updated\" : \"complete\"}\", details: deployment, verbosity: @verbosity\n end\n\n\n if MU.summary.size > 0\n MU.summary.each { |msg|\n puts msg\n }\n end\n\n @mommacat.sendAdminSlack(\"Deploy #{MU.deploy_id} \\\"#{MU.handle}\\\" #{@updating ? \"updated\" : \"complete\"}\", msg: MU.summary.join(\"\\n\"))\n end", "def before_fork(&block); end", "def process\n by_time_batch\n by_waiting_batch\n rescue\n @logger.fatal \"Failed to process: #{$!}\"\n @logger.fatal $!.backtrace.join(\"\\n\")\n end", "def threads\n raise CapabilitiesExceeded\n end", "def run_jobs(result_io=nil)\n result_io = ResultIO.new if result_io.nil?\n self.reload\n begin\n while self.pending_op_groups.count > 0\n op_group = self.pending_op_groups.first\n self.user_agent = op_group.user_agent\n if op_group.pending_ops.count == 0\n case op_group.op_type\n when :change_members\n added = Array(op_group.args['added']).select{ |id| (role = role_for(id)) and Ability.has_permission?(id, :ssh_to_gears, Application, role, self) } \n removed = Array(op_group.args['removed']).dup\n Array(op_group.args['changed']).each do |(id, from, to)|\n was = Ability.has_permission?(id, :ssh_to_gears, Application, from || default_role, self) \n is = Ability.has_permission?(id, :ssh_to_gears, Application, to || default_role, self) \n next if is == was\n (is ? added : removed) << id\n end\n ops = calculate_update_existing_configuration_ops({\n # FIXME this is an unbounded operation, all keys for all users added and removed to each gear. need to optimize\n 'add_keys_attrs' => CloudUser.members_of(added).map{ |u| get_updated_ssh_keys(u._id, u.ssh_keys) }.flatten(1),\n 'remove_keys_attrs' => CloudUser.members_of(removed).map{ |u| get_updated_ssh_keys(u._id, u.ssh_keys) }.flatten(1),\n })\n op_group.pending_ops.push(*ops)\n when :update_configuration\n ops = calculate_update_existing_configuration_ops(op_group.args)\n op_group.pending_ops.push(*ops)\n when :add_features\n #need rollback\n features = self.requires + op_group.args[\"features\"]\n group_overrides = (self.group_overrides || []) + (op_group.args[\"group_overrides\"] || [])\n ops, add_gear_count, rm_gear_count = update_requirements(features, group_overrides, op_group.args[\"init_git_url\"], op_group.args[\"user_env_vars\"])\n try_reserve_gears(add_gear_count, rm_gear_count, op_group, ops)\n when :remove_features\n #need rollback\n features = []\n features = self.requires - op_group.args[\"features\"] unless op_group.args[\"remove_all_features\"]\n group_overrides = (self.group_overrides || []) + (op_group.args[\"group_overrides\"] || [])\n ops, add_gear_count, rm_gear_count = update_requirements(features, group_overrides)\n try_reserve_gears(add_gear_count, rm_gear_count, op_group, ops)\n when :update_component_limits\n updated_overrides = (self.group_overrides || []).deep_dup\n found = updated_overrides.find {|go| go[\"components\"].include? op_group.args[\"comp_spec\"] }\n group_override = found || {\"components\" => [op_group.args[\"comp_spec\"]]}\n group_override[\"min_gears\"] = op_group.args[\"min\"] unless op_group.args[\"min\"].nil?\n group_override[\"max_gears\"] = op_group.args[\"max\"] unless op_group.args[\"max\"].nil?\n group_override[\"additional_filesystem_gb\"] = op_group.args[\"additional_filesystem_gb\"] unless op_group.args[\"additional_filesystem_gb\"].nil?\n updated_overrides.push(group_override) unless found\n features = self.requires\n ops, add_gear_count, rm_gear_count = update_requirements(features, updated_overrides)\n try_reserve_gears(add_gear_count, rm_gear_count, op_group, ops)\n when :delete_app\n self.pending_op_groups.clear\n self.delete\n when :remove_gear\n ops = calculate_remove_gear_ops(op_group.args)\n try_reserve_gears(0, 1, op_group, ops)\n when :scale_by\n #need rollback\n ops, add_gear_count, rm_gear_count = calculate_scale_by(op_group.args[\"group_instance_id\"], op_group.args[\"scale_by\"])\n try_reserve_gears(add_gear_count, rm_gear_count, op_group, ops)\n when :replace_all_ssh_keys\n ops = calculate_replace_all_ssh_keys_ops(op_group.args)\n op_group.pending_ops.push(*ops)\n when :add_alias\n self.group_instances.each do |group_instance|\n if group_instance.gears.where(app_dns: true).count > 0\n gear = group_instance.gears.find_by(app_dns: true)\n op_group.pending_ops.push PendingAppOp.new(op_type: :add_alias, args: {\"group_instance_id\" => group_instance.id.to_s, \"gear_id\" => gear.id.to_s, \"fqdn\" => op_group.args[\"fqdn\"]} )\n break\n end\n end\n when :remove_alias\n self.group_instances.each do |group_instance|\n if group_instance.gears.where(app_dns: true).count > 0\n gear = group_instance.gears.find_by(app_dns: true)\n op_group.pending_ops.push PendingAppOp.new(op_type: :remove_alias, args: {\"group_instance_id\" => group_instance.id.to_s, \"gear_id\" => gear.id.to_s, \"fqdn\" => op_group.args[\"fqdn\"]} )\n break\n end\n end\n when :add_ssl_cert\n self.group_instances.each do |group_instance|\n if group_instance.gears.where(app_dns: true).count > 0\n gear = group_instance.gears.find_by(app_dns: true)\n op_group.pending_ops.push PendingAppOp.new(op_type: :add_ssl_cert, args: {\"group_instance_id\" => group_instance.id.to_s, \"gear_id\" => gear.id.to_s,\n \"fqdn\" => op_group.args[\"fqdn\"], \"ssl_certificate\" => op_group.args[\"ssl_certificate\"], \"private_key\" => op_group.args[\"private_key\"], \"pass_phrase\" => op_group.args[\"pass_phrase\"] } )\n break\n end\n end\n when :remove_ssl_cert\n self.group_instances.each do |group_instance|\n if group_instance.gears.where(app_dns: true).count > 0\n gear = group_instance.gears.find_by(app_dns: true)\n op_group.pending_ops.push PendingAppOp.new(op_type: :remove_ssl_cert, args: {\"group_instance_id\" => group_instance.id.to_s, \"gear_id\" => gear.id.to_s, \"fqdn\" => op_group.args[\"fqdn\"]} )\n break\n end\n end\n when :patch_user_env_vars\n op_group.pending_ops.push(PendingAppOp.new(op_type: op_group.op_type, args: op_group.args.dup))\n when :add_broker_auth_key, :remove_broker_auth_key\n ops = []\n args = op_group.args.dup\n self.group_instances.each do |group_instance|\n args[\"group_instance_id\"] = group_instance._id.to_s\n group_instance.gears.each do |gear|\n args[\"gear_id\"] = gear._id.to_s\n ops.push(PendingAppOp.new(op_type: op_group.op_type, args: args.dup))\n end\n end\n op_group.pending_ops.push(*ops)\n when :start_app, :stop_app, :restart_app, :reload_app_config, :tidy_app\n ops = calculate_ctl_app_component_ops(op_group.op_type)\n op_group.pending_ops.push(*ops)\n when :start_feature, :stop_feature, :restart_feature, :reload_feature_config\n ops = calculate_ctl_feature_component_ops(op_group.op_type, op_group.args['feature'])\n op_group.pending_ops.push(*ops)\n when :start_component, :stop_component, :restart_component, :reload_component_config\n ops = calculate_ctl_component_ops(op_group.op_type, op_group.args['comp_spec'])\n op_group.pending_ops.push(*ops)\n when :execute_connections\n op_group.pending_ops.push PendingAppOp.new(op_type: :execute_connections)\n end\n end\n\n if op_group.op_type != :delete_app\n op_group.execute(result_io)\n unreserve_gears(op_group.num_gears_removed)\n op_group.delete\n self.reload\n end\n\n end\n true\n rescue Exception => e_orig\n Rails.logger.error e_orig.message\n Rails.logger.debug e_orig.backtrace.inspect\n\n #rollback\n begin\n op_group.execute_rollback(result_io)\n op_group.delete\n num_gears_recovered = op_group.num_gears_added - op_group.num_gears_created + op_group.num_gears_rolled_back + op_group.num_gears_destroyed\n unreserve_gears(num_gears_recovered)\n rescue Exception => e_rollback\n Rails.logger.error \"Error during rollback\"\n Rails.logger.error e_rollback.message\n Rails.logger.error e_rollback.backtrace.inspect\n end\n raise e_orig\n end\n end", "def sleepy_run; end", "def synchronized?; end", "def processAllBatches\n Thread.current[:name] = \"batch thread\" # label all stdout from this thread\n loop do\n # Grab a batch from the input queue\n batch = $batchQueue.pop\n batch or break\n\n # And process it\n processBatch(batch)\n end\nend", "def processAllBatches\n Thread.current[:name] = \"batch thread\" # label all stdout from this thread\n loop do\n # Grab a batch from the input queue\n batch = $batchQueue.pop\n batch or break\n\n # And process it\n processBatch(batch)\n end\nend", "def import_all_tab_files_parallel(tabs_list, dataset_id, task_id, root_url)\n max_parallelism = 10\n running_parallelism = 0\n wait_seconds = 10\n\n tabs_list.each { |tab_object|\n tab_file = tab_object[\"MzTab_file\"]\n\n running_parallelism += 1\n\n fork do\n #import_dataset_tab_psm_file(dataset_id, task_id, tab_file, root_url)\n import_tab_cmd = \"ruby ./populate_parallel_tab.rb \"\n import_tab_cmd += dataset_id + \" \"\n import_tab_cmd += task_id + \" \"\n import_tab_cmd += tab_file + \" \"\n import_tab_cmd += root_url\n\n puts import_tab_cmd\n `#{import_tab_cmd}`\n\n abort\n end\n\n sleep(wait_seconds)\n if running_parallelism == max_parallelism\n Process.waitall\n running_parallelism = 0\n end\n }\n\n Process.waitall\nend", "def test_start_pause_stop_combinations\n stqe = @session.jobs['stqe']\n kaner = stqe.subjobs['kaner - usage testing']\n mail = @session.jobs['misc. email']\n\n # A simple start->stop\n mail_start = @now\n start(mail) # record 1\n assert_states([mail], [])\n assert_new_record 1, mail, mail_start\n stop(mail) # record 1 stops\n assert_states([], [])\n assert_stopped_with(1, 1.minute)\n\n # A simple start->pause->stop\n stqe_start = @now\n start(stqe) # record 2\n assert_states([stqe], [])\n assert_new_record 2, stqe, stqe_start\n pause\n assert_states([], [stqe])\n stop(stqe) # record 2 stops\n assert_states([], [])\n assert_stopped_with(2, 1.minute)\n\n # Now, two jobs at once.\n stqe_start = @now\n start(stqe) # record 3\n assert_states([stqe],[])\n assert_new_record 3, stqe, stqe_start\n mail_start = @now\n start(mail) # record 4\n assert_states([mail],[stqe])\n assert_new_record 4, mail, mail_start\n pause\n assert_states([], [mail, stqe])\n start(mail) \n assert_states([mail], [stqe])\n pause\n assert_states([], [mail, stqe])\n start(mail)\n assert_states([mail], [stqe])\n stop(mail) # record 4 stops\n assert_states([], [stqe])\n assert_stopped_with(4, 3.minutes)\n start(stqe)\n assert_states([stqe], [])\n stop(stqe) # record 3 stops\n assert_states([], [])\n assert_stopped_with(3, 2.minutes)\n\n # Three jobs\n kaner_start = @now\n start(kaner) # record 5\n assert_states([kaner], [])\n assert_new_record 5, kaner, kaner_start\n stqe_start = @now\n start(stqe) # record 6\n assert_states([stqe], [kaner])\n assert_new_record 6, stqe, stqe_start\n pause\n assert_states([], [stqe, kaner])\n start(stqe)\n assert_states([stqe], [kaner])\n start(kaner)\n assert_states([kaner], [stqe])\n pause\n assert_states([], [kaner, stqe])\n mail_start = @now\n start(mail) # record 7\n assert_new_record 7, mail, mail_start\n assert_states([mail], [kaner, stqe])\n start(stqe)\n assert_states([stqe], [mail, kaner])\n start(mail)\n assert_states([mail], [stqe, kaner])\n start(stqe)\n assert_states([stqe], [mail, kaner])\n stop(stqe) # record 6 stops\n assert_states([], [mail, kaner])\n assert_stopped_with(6, 4.minutes)\n start(kaner)\n assert_states([kaner], [mail])\n stop(kaner) # record 5 stops\n assert_states([], [mail])\n assert_stopped_with(5, 3.minutes)\n stop(mail) # record 7 stops\n assert_states([], [])\n assert_stopped_with(7, 2.minutes)\n\n # Loose ends - pausing due to other jobs\n stqe_start = @now\n start(stqe) # record 8 \n assert_states([stqe], [])\n assert_new_record 8, stqe, stqe_start\n pause\n assert_states([], [stqe])\n kaner_start = @now\n start(kaner) # record 9 \n assert_states([kaner], [stqe])\n assert_new_record 9, kaner, kaner_start\n start(stqe)\n assert_states([stqe], [kaner])\n stop(stqe) # record 8 stops\n assert_states([], [kaner])\n assert_stopped_with(8, 2.minutes)\n stop(kaner) # record 9 stops\n assert_states([], [])\n assert_stopped_with(9, 1.minute)\n end", "def in_parallel(manager = T.unsafe(nil)); end", "def test_asynchronous_job_has_segmentation_when_forced\n omit_if(@service.splunk_version[0] == 4)\n job = @service.jobs.create(\"search index=_internal GET | head 3\")\n until job.is_done?()\n sleep(0.1)\n end\n assert_true(job.events(:segmentation => \"raw\").include?(\"<sg\"))\n assert_true(job.preview(:segmentation => \"raw\").include?(\"<sg\"))\n end", "def process_all_db(blast_result_hash,gbff_dir,seq_dir,flanking_res)\n gbff_files = Array.new\n numbThreads = 3\n gbff_files =Dir.glob(\"#{seq_dir}/*.seq\")\n gbff_files.concat(Dir.glob(\"#{gbff_dir}/*.gbff\"))\n gbff_files.each do |gbff_file|\n process_single_db(blast_result_hash,flanking_res,gbff_file)\n #print(\"#{Thread.list.size}\\n\")\n # if(Thread.list.size < numbThreads)\n # a = Thread.new{process_single_db(blast_result_hash,flanking_res,gbff_file)}\n # a.run\n #else\n # Thread.list.each do |thr|\n # thr.join\n # end\n #end\n end\n #output all the unseen items in the database to the insufficient DNA database\n blast_result_hash.each do |key,value|\n if(value.output_to_db == false)\n output_blast_hit(value)\n end\n end\nend", "def perform(resource_id, owner_code, repo_id)\n \n @owner_code = owner_code\n @repo_id = repo_id\n \n resourcetree = URIResolver.resolve_references(Resource.to_jsonmodel(resource_id.to_i), ['tree'])\n \n thread_array = []\n \n archival_object_searched = 0\n digital_objects_created = 0\n \n work_q = Queue.new \n\n prepare_tree_nodes(resourcetree['tree'][\"_resolved\"]) do |child|\n Log.info(child.inspect)\n if child['node_type'] == 'archival_object'\n Log.info('ARCHIVAL OBJECT FOUND: '+child['title'])\n archival_id = child['id']\n #If a digital object does not already exist for the archival object, create one\n if !child['instance_types'].include?('digital_object')\n Log.info(\"Adding \" + archival_id.to_s + \" to queue\")\n work_q << archival_id\n archival_object_searched = archival_object_searched + 1\n end\n \n end\n end\n \n responses = []\n osn_errors = []\n no_osn = []\n mutex = Mutex.new\n @countMutex = Mutex.new\n \n @count = 1\n workers = (0...4).map do\n thread = Thread.new do\n begin\n while archival_id = work_q.pop(true)\n Log.info(\"Poppped \" + archival_id.to_s + \" from queue\")\n RequestContext.open(:repo_id => repo_id) do \n archival_object = ArchivalObject.to_jsonmodel(archival_id.to_i)\n \n Log.info('ARCHIVAL OBJECT RETRIEVED: '+archival_object.to_json)\n #create digital object\n \n if (@count % 15 == 0)\n Log.info(\"SLEEPING 30 SECS TO ALLOW TIME_WAITS TO CLEAR>>>>>\")\n sleep(30)\n end\n t = create_digital_object(archival_object)\n mutex.synchronize do\n if (t.has_key?('error'))\n Log.error(t['error'])\n osn_errors << t['osn']\n elsif (t.has_key?('urn_created'))\n Log.info('URN created for' + t['osn'])\n digital_objects_created = digital_objects_created + 1\n elsif (t.has_key?('no_urn'))\n Log.info('No URN found for' + t['osn'])\n no_osn << t['osn']\n end\n end\n end\n end\n rescue ThreadError\n end\n end\n thread_array << thread\n thread.join\n \n end\n \n response = {:resource_id => resource_id, :osn_errors=>osn_errors, :no_osns=>no_osn, :archival_objects_searched => archival_object_searched, :digital_objects_created => digital_objects_created}\n end", "def work\n while true\n job = @queue.pop\n task = job[:task]\n\n if task == :quit\n break\n elsif task == :joust\n begin\n work_joust(job[:prog], job[:code], job[:try_only], job[:callback])\n rescue => err\n log(err.inspect, err)\n job[:callback].call(:fatal, err.inspect)\n break\n end\n else\n log(\"Broken job: #{job}\")\n job[:callback].call(:fatal, \"Broken job: #{job}.\")\n break\n end\n end\n end", "def grab_job_uniq\n throw :notimpl\n end", "def join_until_no_more_jobs\n\n @exit_when_no_more_jobs = true\n join\n end", "def fill_queues \n while @thread_queues.any?(&:empty?) && (@running || !@output_queue.empty?)\n el = @output_queue.shift \n @thread_queues[el[:thread]] << el if el\n end\n end", "def queue; end", "def queue; end", "def locked; end", "def grab_thread_results(threads)\n # TODO: this barrier might take arbitrarily long. Mostly needed\n # for merging pruposes, but we might consider instrumenting this\n # and doing something smarter if it's a bottleneck\n start_time = Time.now.to_i\n threads.each do |thread|\n remaining_time = (@max_thread_wait_time_minutes*60) - (Time.now.to_i-start_time)\n if remaining_time < 1 then remaining_time = 1 end\n @logger.debug{\"Thread #{thread}: Remaining time: #{remaining_time}\"}\n begin \n # thread.get will throw an exception if the underlying thread\n # threw an exception during execution\n if $executor\n java_import java.util.concurrent.TimeUnit\n thread.get(remaining_time*1000, TimeUnit::MILLISECONDS) \n else \n thread.join\n end\n rescue Exception => e\n if $executor\n # Two levels of nesting to get at the real exception!\n # jruby, sometimes you do weird things...\n begin\n e = e.cause if e.cause\n e = e.cause if e.cause\n rescue Exception # catch errors this generates...\n # What errors is it generating??? That might be good to\n # know ;-)\n end\n raise e\n else\n raise e\n end\n end\n if $executor then thread.cancel(true) end # should do nothing if done, but needs to happen to free up threads otherwise\n end\n end", "def run_job\n end", "def working!\n disque.with {|cn| cn.call :working, job_id } if disque && job_id\n end", "def finish_synchronize; end", "def spawn_threads!\n @threads = []\n num_worker_threads.times do |thread_num|\n log(:debug) { \"Spawning background worker thread #{thread_num}.\" }\n\n @threads << Thread.new do\n Thread.current[:influxdb] = object_id\n\n until @should_stop\n check_background_queue(thread_num)\n sleep rand(sleep_interval)\n end\n\n log(:debug) { \"Exit background worker thread #{thread_num}.\" }\n end\n end\n end", "def spawn_and_monitor_workers\n daemon_log :msg => \"Spawning #{$daemon[:worker_count]} workers...\"\n\n while $daemon[:work]\n daemon_update_heartbeat\n\n # (Re)start workers\n while $daemon[:worker_pids].count < $daemon[:worker_count] do\n sp = Spawnling.new(:argv => $worker[:process_prefix]) do\n worker_runner\n end\n $daemon[:worker_pids] << sp.handle\n end\n\n sleep $daemon[:monitoring_sleep]\n\n # Delete PIDs from the array child_pids which don't exists anymore\n $daemon[:worker_pids].each do |ch_pid|\n begin\n ps = ProcTable.ps(ch_pid)\n rescue\n ps = nil\n daemon_log :msg => \"Error in ProcTable.ps: #{$!}\", :sev => :error\n end\n $daemon[:worker_pids].delete ch_pid unless ps && ps.comm == 'ruby'\n end\n end\nend", "def alive?; @locker.synchronize { !! @threads }; end", "def spawn_thread\n Thread.new do\n while true\n x = @queue.shift\n if x == Directive::SUICIDE_PILL\n \t@worker_threads_count.decrement\n \tThread.current.terminate\n end\n Thread.pass\n begin\n x.job.call(x)\n rescue StandardError => e\n $stderr.puts \"Threadz: Error in thread, but restarting with next job: #{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n @worker_threads_count.increment\n end", "def launch_worker\n @worker_threads << Thread.new {\n while work = @work_queue.pop\n begin\n #RJR::Logger.debug \"launch thread pool job #{work}\"\n @running_queue << work\n work.exec(@thread_lock)\n # TODO cleaner / more immediate way to pop item off running_queue\n #RJR::Logger.debug \"finished thread pool job #{work}\"\n rescue Exception => e\n # FIXME also send to rjr logger at a critical level\n puts \"Thread raised Fatal Exception #{e}\"\n puts \"\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n }\n end", "def waiting; end", "def waiting; end" ]
[ "0.6585305", "0.65603745", "0.6557719", "0.6557719", "0.64358795", "0.642723", "0.6340268", "0.624239", "0.62395394", "0.62395394", "0.6229476", "0.62185264", "0.6170829", "0.611027", "0.61078054", "0.60195905", "0.59924245", "0.59820765", "0.5974776", "0.5974776", "0.5974776", "0.5937382", "0.5926201", "0.5809581", "0.5775753", "0.5734226", "0.5733047", "0.5727703", "0.5689484", "0.5669614", "0.5667025", "0.565845", "0.565845", "0.565845", "0.5618489", "0.56134564", "0.5610794", "0.56097454", "0.559904", "0.5597433", "0.5593389", "0.5592383", "0.5587882", "0.5587882", "0.5587882", "0.5569864", "0.5564934", "0.55642045", "0.55624735", "0.5561507", "0.5561507", "0.55594945", "0.5554041", "0.5554041", "0.5554041", "0.55481994", "0.55472195", "0.55465204", "0.5545202", "0.55451137", "0.55443954", "0.5541367", "0.5535664", "0.5535664", "0.5535664", "0.5535664", "0.5531186", "0.5530796", "0.5530097", "0.551663", "0.551494", "0.55135316", "0.55053514", "0.54966986", "0.5492575", "0.5489955", "0.5489955", "0.5482897", "0.54785967", "0.5474314", "0.5472571", "0.5467915", "0.54678077", "0.54667664", "0.5463984", "0.54616207", "0.54586226", "0.545604", "0.545604", "0.54509366", "0.54491", "0.5439844", "0.54362553", "0.5423117", "0.5413437", "0.54127187", "0.54051137", "0.5404191", "0.53727853", "0.53634846", "0.53634846" ]
0.0
-1
STRONG PARAMS / whitelist what the user can give us
def task_params params.require(:task).permit(:title, :details, :completed) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_params; true; 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 param_whitelist\n [:rating, :review]\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def param_whitelist\n [:role, :title]\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 filtered_parameters; end", "def valid_params?; end", "def valid_params_request?; end", "def allow_params_authentication!; end", "def non_wukong_params\n options.\n reject{|param, val| options.param_definitions[param][:wukong] }.\n map{|param,val| \"--#{param}=#{val}\" }.\n join(\" \")\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 filter_parameters; end", "def filter_parameters; 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 valid_for_params_auth?; 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 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 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 strong_params\n params.require(:education).permit(param_whitelist)\n end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def check_params\n true\n end", "def whitelist; end", "def validate_smurl_params params, blacklisted=[]\n errors = []\n\n url = params[:url]\n errors << \"Url cannot be empty\" if url.nil? || url.gsub(/[[:space:]]/, '').empty?\n\n vanity = params[:vanity]\n\n if vanity\n # illegal characters\n if /[^a-zA-Z0-9]/.match(vanity)\n errors << \"Custom url can only contain a-z, A-Z, and 0-9\"\n end\n\n # blacklisted value\n if blacklisted and blacklisted.include?(vanity)\n errors << \"That custom url cannot be used at this time\"\n end\n end\n\n errors\n end", "def allowed_params\n ALLOWED_PARAMS\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def param_whitelist\n [\n :school_name,\n :school_id,\n :degree,\n :started_at,\n :finished_at,\n majors: [],\n minors: []\n ]\n end", "def strong_params\n params.require(:team_member).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 raw_params(auth); end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def url_whitelist=(_arg0); end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def in_kwarg; end", "def unsolved_params\n \n end", "def parameters(params)\n allowed = [:start,:num,:type,:id,:filter,:tagged,:search,:state,:email,:password]\n params.merge! defaults if defaults\n params.reject {|key,value| !allowed.include? key }\n end", "def user_strong_params\n html_safe(params[:user]).strip\n end", "def preference\n preference_4hackers if params[:\"h@ck\"] #Any interesting name with some technical meaning?\n if request.post?\n end\n end", "def blackandwhite_params\n params.fetch(:blackandwhite, {})\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def blacklisted_params\n params.keys.each_with_object({}) do |param, hash|\n param = param.to_sym\n hash[param] = nil unless WHITELIST_PAGINATION_PARAMS.include?(param)\n end\n end", "def dog_params\n allowed_params = %w(name birthdate breed image_url)\n params.select {|param,value| allowed_params.include?(param)}\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def herbalizable?(param)\n whitelisted?(param) && !blacklisted?(param)\n end", "def filter_argument; end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend", "def safe_params\n params.require(:user).permit(:name)\n end", "def allowed?; true end", "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 hacker_params\n params.fetch(:hacker, {})\n end", "def auth_params\n if !current_user.is_admin?\n params[:person].delete(:is_pal) if params[:person]\n end\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def anonymous_filter_params\n p = params.required('payload')\n # p.permit!('controls_params')\n # p.permit!('columns_params')\n # p.permit!('sorting')\n # p.permit!('global_config')\n p.permit(\n 'name',\n 'controls_list' => [],\n 'controls_hl_mode' => [],\n 'controls_params' => {},\n 'columns_list' => [],\n 'columns_params' => {},\n 'sorting' => {},\n 'global_config' => {}\n ).merge(permit_hashes(p, [\n 'controls_params',\n 'columns_params',\n 'sorting',\n 'global_config'\n ]))\n end", "def less_active_member_params\n clean_params = params.require(:less_active_member).permit(:surname, :given_name, :current_address, :new_address, :new_phone, :reference, :new_note, :resources, tag_list: [])\n clean_params.merge!({current_user_id: current_user.id}) unless current_user.nil?\n end", "def want_params\n #params.require(:want).permit(:USER_ID, :TITLE, :CATEGORY_ID, :COMMENT, :LATITUDE, :LONGITUDE)\n params.require('wants').permit(:USER_ID, :TITLE, :CATEGORY_ID, :COMMENT, :LATITUDE, :LONGITUDE)\n end", "def url_whitelist; end", "def url_allowlist=(_arg0); end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def kladr_params\n params.require(:str) #address from user\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 test_params(params)\n test_params = params.require(:question_programming).permit(\n :prepend, :append, :autograded, :solution, :submission, :submit_as_file,\n submission_files: [],\n solution_files: [],\n data_files: [],\n test_cases: {\n public: [:expression, :expected, :hint, :inline_code],\n private: [:expression, :expected, :hint, :inline_code],\n evaluation: [:expression, :expected, :hint, :inline_code]\n }\n )\n\n whitelist(params, test_params)\n end", "def safe_params\n params.require(:youtube_search).permit(:search_terms, :alert_on_new_result)\n end", "def pointless_params\n params.require(:pointless).permit(:title, :content)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def user(*eras); end", "def sanitize_params\n if valid_lease?\n sanitize_lease_params\n elsif valid_embargo?\n sanitize_embargo_params\n elsif !wants_lease? && !wants_embargo?\n sanitize_unrestricted_params\n else\n @attributes\n end\n end", "def opp_params #Purpose of the opp params is for security purposes against hackers these are strong parameters\n\t\tparams.require(:opp).permit(:title, :text)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def user_params\n allowed_params = [:username, :email, :jabber_id, :jabber_otr_fingerprint, :avatar]\n allowed_params << [:password, :password_confirmation] unless params[:user][:password].blank?\n allowed_params << [:role] if current_user.moderator_or_admin?\n allowed_params << [:tenant_ids => []] if current_user.admin?\n allowed_params << [:user_ids => []] if current_user.moderator_or_admin?\n params.require(:user).permit(allowed_params)\n end", "def user_params\n end", "def user_params\nend", "def set_prefecture\n params.require(:id, :name)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def user_params\r\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def user_params #este metodo SE PUEDE LLAMAR COMO QUIERAS, pero es necesario para que al crear un objeto se autorice su creacion (porque si no nos podrían meter codigo malicioso)\n\t\tparams.require(:user).permit(:name, :email, :password)\n\tend", "def quote_params(params); end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n params.require(:choice)\n end", "def coolstuff_params\n params[:coolstuff]\n end", "def url_allowlist; end", "def parameter_rule?; end", "def accepted_params\n [\n :Amount,\n :isPreAuth,\n :ServiceId, \n :RequestLang, \n :FullName, \n :Email, \n :Phone, \n :MaxInstallments,\n :MerchantTrns,\n :CustomerTrns,\n :SourceCode,\n :PaymentTimeOut,\n :ExpirationDate,\n :AllowRecurring,\n :Tags,\n :AllowTaxCard,\n :ActionUser,\n :DisableCash,\n :DisableCard\n ]\n end", "def like_params\n params.require(:real_estate)\n end", "def user_whitelist\r\n return [:user_id, :first_name, :last_name, :email, :account_type, :password, :password_confirmation, :security_question_id, :security_question_answer]\r\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def whitelisted_args\n args.select &:allowed\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end" ]
[ "0.69359034", "0.6866467", "0.6745993", "0.6593917", "0.657007", "0.65202683", "0.65155405", "0.6446152", "0.64390135", "0.6430172", "0.6336102", "0.63286304", "0.6321278", "0.6321278", "0.6301794", "0.6276191", "0.62626964", "0.62154263", "0.6214585", "0.61983865", "0.61911446", "0.61907494", "0.61889356", "0.618084", "0.615862", "0.61399996", "0.61066324", "0.6099931", "0.60873854", "0.60593957", "0.6046583", "0.6027643", "0.60250694", "0.60187656", "0.60056126", "0.5984562", "0.5977396", "0.59506655", "0.59327483", "0.59326214", "0.5915141", "0.59026396", "0.5890561", "0.58803076", "0.58800626", "0.5869916", "0.58695424", "0.586664", "0.5865573", "0.585012", "0.58442205", "0.5839188", "0.5827996", "0.58221346", "0.5821708", "0.5821134", "0.58204424", "0.58186436", "0.5813625", "0.58033365", "0.5800316", "0.58001155", "0.5798514", "0.5780533", "0.5777432", "0.5767905", "0.5766598", "0.57626736", "0.5761558", "0.575993", "0.5754857", "0.574771", "0.5747524", "0.5726881", "0.5725442", "0.5721732", "0.5721622", "0.57152873", "0.5714539", "0.57026607", "0.5701693", "0.57003456", "0.56997305", "0.5693514", "0.56932056", "0.56861186", "0.5678156", "0.5664583", "0.56630397", "0.56627387", "0.5644057", "0.5643182", "0.5642697", "0.5627394", "0.5616854", "0.5616854", "0.5616854", "0.5616854", "0.5616854", "0.5616854", "0.5616854" ]
0.0
-1
GET /user_biographies/1 GET /user_biographies/1.json
def show @user_biography = UserBiography.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @user_biography } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\n end\n end", "def new\n @user_biography = UserBiography.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_biography }\n end\n end", "def badges\n get(\"user/#{user_id}/badges.json\")\n end", "def index\n @biographies = Biography.added_by(current_admin_user).page(params[:page]).per(10)\n end", "def badges(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/badges.json\")\n end", "def biography\n self.biographies.first\n end", "def index\n @biography_books = current_user.biography_books\n end", "def getHobbies\n login_user_id = params[:my_id]\n login_user = User.find(login_user_id)\n\n hobbies = login_user.hobbies\n\n hobbies_hash = hobbies.map do |hobby|\n hobby_hash = hobby.attributes\n hobby_hash['category_name'] = hobby.category.name\n hobby_hash['photo_url'] = hobby.photo_url\n hobby_hash\n end\n\n if hobbies_hash.blank?\n res = {\n result: false,\n data: nil\n }\n else\n res = {\n result: true,\n data: {\n user_id: login_user_id,\n name: login_user.name,\n hobbies: hobbies_hash\n }\n }\n end\n\n render json: res\n end", "def bio\n response[\"bio\"]\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 badges(id)\n get(\"users/#{id}/badges\")\n end", "def users_profile\n @usersProfile = User.find(params[:id]).to_json(:include => :user_connections)\n render json: { data: @usersProfile }\n end", "def biography(query = {})\n options = { query: query }\n response = client.get('label/biography', options)\n\n Struct::Biography.new(response['biography'])\n end", "def biography artist\n url = \"http://developer.echonest.com/api/v4/artist/biographies?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\"\nend", "def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end", "def get_me\n response = self.class.get(\"https://www.bloc.io/api/v1/users/me\", headers: { \"authorization\" => @auth_token })\n body = JSON.parse(response.body)\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 bio_document\n @bio_document ||= Nokogiri::HTML(Imdb::Person.find_by_id(@id, 'bio'))\n end", "def show\n if Bio.where(:user_id => current_user.id).last == nil #brand new user signed up \n render(\"/bios/new/\")\n else\n @bio = Bio.where(:user_id => current_user.id).last #existing user signing in\n render(\"/bios/show/\")\n end\n end", "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 index\n @user_businesses = Business.where({user_id: current_user.id})\n render json: JSONAPI::Serializer.serialize(@user_businesses, is_collection: true)\n end", "def show\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_biomechanical }\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 index\n @lobbies = Lobby.all\n\n respond_with @lobbies, {:except => [:id, :user_id]}\n end", "def get_user_detail\n user_id = params[:id]\n user = User.find(user_id)\n\n render json: UserSerializer.new(user).profile_detail_hash\n end", "def badges_for_user(username)\n response = get \"v1/market/user-badges:#{username}.json\"\n response[:'user-badges']\n end", "def profile\n p @user.as_json\n render json: @user.as_json\n end", "def index\n @briefs = Brief.includes(:user).order(created_at: :desc).all\n render json: @briefs, each_serializer: BriefsSerializer\n end", "def set_bio\n @bio = bio.find(params[:id])\n end", "def bio\n @data['bio']\n end", "def destroy\n @user_biography = UserBiography.find(params[:id])\n @user_biography.destroy\n\n respond_to do |format|\n format.html { redirect_to user_biographies_url }\n format.json { head :no_content }\n end\n end", "def set_bio\n @bio = Bio.find(params[:id])\n end", "def get_blacklist(user)\n username = Digest::MD5.hexdigest(user.id.to_s)\n begin\n response = RestClient.get(\"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}/blocks/users\",\n \"Authorization\" => \"Bearer #{access_token}\",\n :content_type => :json,\n :accept => :json\n )\n if response.code == 200\n p response\n\n body = JSON.parse(response.body)\n p body\n end\n rescue => e\n puts e.response\n end\n end", "def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end", "def index\n @births = Birth.where(user_id: current_user.id )\n end", "def show\n @user = User.find(params[:id])\n # List the last 5 businesses rated by a user.\n @businesses = Business.paginate_by_sql [\"SELECT businesses.id, businesses.name, businesses.street, businesses.suburb, businesses.postcode, businesses.phone, businesses.email, businesses.url, businesses.permalink, businesses.checked, businesses.created_at, businesses.updated_at FROM businesses LEFT JOIN ratings ON ratings.rateable_id = businesses.id WHERE ratings.user_id = #{@user.id} ORDER BY ratings.created_at DESC\"],\n :page => params[:page],\n :per_page => 5\n @pending_friends = @user.pending_friends_for_me\n \n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @user.to_xml }\n end\n end", "def set_biography\n @biography = Biography.find(params[:id])\n end", "def set_biography\n @biography = Biography.find(params[:id])\n end", "def list_selfies\n user = User.friendly.find(params[:user_id])\n\n if current_user == user or current_user.is_following?(user)\n user_selfies = user.selfies.where(\"blocked = false and hidden = false\").order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 39)\n else\n user_selfies = user.selfies.where(\"private = false and blocked = false and hidden = false\").order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 39)\n end\n followers = user.followers(1)\n following = user.all_following\n #books = user.books\n number_selfie_approved = user.selfies.where(\"blocked = false and hidden = false and approval_status = 1\").count\n\n render json: user_selfies.includes(:challenge), meta: {number_selfies: user_selfies.count, number_following: following.count, number_followers: followers.count, number_approved: number_selfie_approved}\n end", "def get_profile_info\n res = {}\n res[:user] = User.select(:login, :city_id, :email, :admin).where(id: session[:user_id]).take\n res[:character] = Character.select(:id, :title).where(id: @current_user.character_id).take\n render json: res\n end", "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end", "def index\n @breeding_pairs = current_user.breeding_pairs.all\n\n respond_to do |format|\n format.json { render json: @breeding_pairs }\n end\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 index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end", "def profile\n\t\t# determine which user's profile page\n\t\t@user = User.find_by_login(params[:username])\n\t\t# retrieve all bids by this user\n\t @bids = Bid.find_all_by_bidder_id(@user.id, :group => 'item_id')\n\t\t# get all comments for this user\n\t @comments = @user.user_comments\n\t\t# get all user_items by this user\n\t @user_items = @user.posted_items\n\n\t\t# code for facebox\n\t respond_to do |format|\n\t\t\tformat.html\n format.js { render_to_facebox }\n end\n\tend", "def show\n @baggage = Baggage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baggage }\n end\n end", "def born_on_this_day_biographies\n @born_on_this_day ||= begin\n query_date = Date.today\n\n IntervieweeBiography.\n references(oral_history_content: :work).\n where(\"interviewee_biographies.json_attributes -> 'birth' ->> 'date' like '%-#{query_date.strftime(\"%m-%d\")}'\").\n where(oral_history_content: { kithe_models: { published: true}}).\n includes(oral_history_content: { work: :leaf_representative }).\n order(\"random()\").\n limit(3).\n to_a\n end\n end", "def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end", "def profile(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/profile.json\")\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def index\n @bio_urls = BioUrl.all\n end", "def index\n @users = User.where(:alive => true).order(\"nick ASC\")\n @headline = t(:all_users)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def show\n @profile = Profile.find(params[:id])\n @user = User.find(params[:id])\n @comments = Comment.where( :user_id => @user.id).take(3)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { respond_with_bip(@profile) }\n end\n end", "def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server knows about the secret 'pegasuscode'; the data is encoded using this secret, only server knows it so when server gets the information back, it must be the same information server encoded using the secret. Otherwise, it will break.\n # server uses the secret to encode and decode information\n decoded_token = JWT.decode(token, 'pegasuscode', true, { algorithm: 'HS256' })\n\n user_id = decoded_token[0][\"user_id\"] # user id\n\n user = User.find(user_id)\n\n # get the user back\n render json: user\n end", "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 indexUserSocial\n render json: User.where( id: params[:user_id] ).last.socials.page(params[:page] || 1).per(params[:per] || 10) , status: 200\n end", "def index\n @profile = params[:profile]\n @discographys = Discography.all \n end", "def show\n @bio_signal = BioSignal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio_signal }\n end\n end", "def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end", "def profile\n @oneuser = User.find_by(username: params[:username]) \n profile = user_profile(@oneuser.id, @oneuser.username, @oneuser.email, @oneuser.first_name, @oneuser.last_name, @oneuser.avatar_img, @oneuser.created_at) \n render json: profile\n end", "def my_friends\n @current_user = User.find(params[:user_id])\n render json: {\n friends: @current_user.friend.where(status: 'accept').map do |friend|\n {\n id: friend.id,\n name: User.find(friend.friend).name.upcase,\n avatar: \"#{request.base_url}#{Rails.application.routes.url_helpers.rails_blob_path(User.find(friend.friend).avatar, only_path: true)}\",\n date: friend.created_at\n }\n end\n }\n end", "def index\n @userbarries = Userbarry.all\n end", "def index\n json_response(User.all) \n end", "def get_user_books\n user = User.find_by_id(params[:user_id])\n shelves = user.bookshelves\n \n @books = Array.new\n \n shelves.each do |s|\n s.books.each do |book|\n @books << book\n end\n end\n \n #books = Book.where(user_id: params[:user_id])\n \n render json: @books\n end", "def show\n respond_to do |format|\n people = @mob.user_idz.split(',').map{|i| User.find(i).name }.join(', ')\n format.json { render json: @mob.attributes.merge(people: people, users: @mob.users, date: Time.now.strftime('%-m/%-d/%Y')) }\n end\n end", "def index\n @profiles = Profile.all\n respond_to do |format|\n format.html\n format.json do\n @profiles = Profile.near(\n [\n current_user.profile.latitude,\n current_user.profile.longitude\n ], params[:radius]\n ).distinct\n @profiles = @profiles.where.not(id: current_user.profile.id)\n @profiles = @profiles.min_age(params[:min_age]) if params[:min_age].present?\n @profiles = @profiles.max_age(params[:max_age]) if params[:max_age].present?\n @profiles = @profiles.by_gender(params[:gender]) if params[:gender].present?\n @profiles = @profiles.by_activity(params[:activity])\n\n render json: @profiles.map{|profile| profile.attributes.merge(image: profile.image.url(:medium))}\n end\n end\n end", "def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end", "def index\n render json: Lobby.all.as_json( only: [:id, :name] )\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 badges(options={})\n get('/user_badge', options)\n end", "def show \n @user = User.find_by_id(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @user.to_json(:methods => [:avatar_url]) }\n end\n end", "def show \n @user = User.find_by_id(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @user.to_json(:methods => [:avatar_url]) }\n end\n end", "def index\n @bijous = Bijou.all\n end", "def get_user_informations(user_id)\n url = \"#{GRAPH_URL}/#{user_id}?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=#{ENV['MESSENGER_BOT_ACCESS_TOKEN']}\"\n data = RestClient.get url\n if data.empty?\n puts \"MessengerBot - Unable to get user_informations (User has not already send a message or has revoked platform permissions on Facebook)\"\n nil\n else\n puts \"MessengerBot - Get user information with user_id : #{user_id}\"\n JSON.parse(data)\n end\n end", "def index\n render :json => UserInterest.all\n end", "def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "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 profile\n @baker = Baker.find(params[:baker_id])\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 get_bike(bikeID, userID)\n user = User.find_by(id: userID)\n authorize_time_check(user)\n response = RestClient.get('https://www.strava.com/api/v3/gear/'+bikeID, {Authorization: 'Bearer ' + user.access_token})\n bike = JSON.parse(response)\n end", "def update\n @user_biography = UserBiography.find(params[:id])\n\n respond_to do |format|\n if @user_biography.update_attributes(params[:user_biography])\n format.html { redirect_to @user_biography, notice: 'User biography was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_biography.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_profiles }\n end\n end", "def get_user_relationships_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"relationships\"] = user.get_relationship_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end", "def create\n @biography = Biography.new(biography_params)\n respond_to do |format|\n if @biography.save\n current_admin_user.biographies << @biography\n format.html { redirect_to [:admin, @biography], notice: 'Biography was successfully created.' }\n format.json { render action: 'show', status: :created, location: @biography }\n else\n format.html { render action: 'new' }\n format.json { render json: @biography.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @bikes = current_user.bikes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bikes }\n end\n end", "def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end", "def me\n user = current_user\n render :json => user.to_json(:only => [:id, :name, :email, :avatar_url])\n end", "def my_profile\n render json: { user: current_user}\n end", "def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end", "def show\n @borc = Borc.where(:UyeId => current_user.uid).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borc }\n end\n end", "def show\n results = Dbpedia.sparql.query(\"SELECT ?person ?abstract ?name WHERE {\n ?person rdf:type <http://dbpedia.org/ontology/Person>.\n ?person foaf:name ?name.\n ?person dbpedia-owl:abstract ?abstract .\n FILTER (LANG(?abstract)='pl' && ?name=\\\"\"+@author.full_name+\"\\\"@en)\n }\")\n if results.first != nil\n @bio=results.first[:abstract] \n end\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end", "def index\n @bloodpressures = current_user.bloodpressures.page(params[:page]).per(3)\n end", "def show_disposisi_user\n\t\t@user = Disposisi.where(user_id: params[:user_id]).order(id: :desc).limit(20)\n\t\trender json: @user\t\n\tend", "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" ]
[ "0.644018", "0.6396032", "0.6361036", "0.63073796", "0.62759113", "0.62329787", "0.61055005", "0.60451716", "0.59533983", "0.58362174", "0.58237267", "0.58040273", "0.57759655", "0.5772738", "0.57715225", "0.57408094", "0.56855345", "0.56695676", "0.5669275", "0.56559336", "0.5646175", "0.56376106", "0.56262815", "0.5618453", "0.5612399", "0.5583286", "0.55756515", "0.55635333", "0.55608684", "0.55607873", "0.55527574", "0.55493003", "0.55437386", "0.55371296", "0.5505343", "0.5486125", "0.54841435", "0.54841435", "0.54740185", "0.54683816", "0.5462764", "0.54616773", "0.5461068", "0.5455177", "0.54442924", "0.5437423", "0.5435927", "0.5415929", "0.54156643", "0.540487", "0.53984463", "0.53966016", "0.53907293", "0.53903174", "0.53891337", "0.5379659", "0.5374671", "0.53724176", "0.5370061", "0.5366429", "0.53646", "0.5359073", "0.53550833", "0.5353869", "0.53455925", "0.53445077", "0.5343244", "0.53428143", "0.53387326", "0.533249", "0.5325707", "0.53229487", "0.52931756", "0.52931756", "0.5290063", "0.5287239", "0.5283245", "0.5280718", "0.5276185", "0.52750206", "0.52727735", "0.52713186", "0.52700084", "0.52688897", "0.5263989", "0.5263396", "0.5259419", "0.5255346", "0.5249991", "0.5249372", "0.52468514", "0.52455026", "0.52438116", "0.5243533", "0.52430254", "0.5238979", "0.52355725", "0.5234557", "0.52329606", "0.5232807" ]
0.70377785
0
GET /user_biographies/new GET /user_biographies/new.json
def new @user_biography = UserBiography.new respond_to do |format| format.html # new.html.erb format.json { render json: @user_biography } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @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 @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 create\n @bio = Bio.new(params[:bio])\n\n respond_to do |format|\n if @bio.save\n format.html { redirect_to @bio, notice: 'Bio was successfully created.' }\n format.json { render json: @bio, status: :created, location: @bio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bio.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 @user = User.new\n\n render json: @user\n end", "def new\n @bounty = Bounty.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bounty }\n end\n end", "def new\n @user = User.new\n render :json => @user\n end", "def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @county }\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 \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 new\n @boat = Boat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @boat}\n end\n end", "def new\n @user_profile = UserProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_profile }\n end\n end", "def new\n @user_profile = UserProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_profile }\n end\n end", "def new\n @user_profile = UserProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_profile }\n end\n end", "def new\n @user_person = UserPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_person }\n end\n end", "def new\n @profile = Profile.new\n @profile.build_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\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(:organization_id => current_org.id)\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 @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 create\n @biography = Biography.new(biography_params)\n respond_to do |format|\n if @biography.save\n current_admin_user.biographies << @biography\n format.html { redirect_to [:admin, @biography], notice: 'Biography was successfully created.' }\n format.json { render action: 'show', status: :created, location: @biography }\n else\n format.html { render action: 'new' }\n format.json { render json: @biography.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\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", "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", "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", "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.6884423", "0.688118", "0.6829219", "0.68197525", "0.67852134", "0.67106146", "0.6710588", "0.6694529", "0.66929626", "0.667535", "0.66709125", "0.66633976", "0.66573405", "0.66573405", "0.66573405", "0.66444045", "0.66369414", "0.6634766", "0.6634766", "0.6618654", "0.6609972", "0.659776", "0.65974844", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456", "0.6584456" ]
0.75278735
0
POST /user_biographies POST /user_biographies.json
def create @user_biography = UserBiography.new(params[:user_biography]) respond_to do |format| unless params[:nosave] if @user_biography.save if @user_biography.tour format.html { redirect_to controller: 'tours', action: 'setup', id: @user_biography.tour.id, bio_id: @user_biography.id, notice: 'User biography was successfully created.' } format.json { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography } else format.html { redirect_to @user_biography, notice: 'User biography was successfully created.' } format.json { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography } end else format.html { render action: "new" } format.json { render json: @user_biography.errors, status: :unprocessable_entity } end else format.html { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography } format.json { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @biography = Biography.new(biography_params)\n respond_to do |format|\n if @biography.save\n current_admin_user.biographies << @biography\n format.html { redirect_to [:admin, @biography], notice: 'Biography was successfully created.' }\n format.json { render action: 'show', status: :created, location: @biography }\n else\n format.html { render action: 'new' }\n format.json { render json: @biography.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user_biography = UserBiography.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_biography }\n end\n end", "def create\n @bio = Bio.new(params[:bio])\n\n respond_to do |format|\n if @bio.save\n format.html { redirect_to @bio, notice: 'Bio was successfully created.' }\n format.json { render json: @bio, status: :created, location: @bio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bio.errors, status: :unprocessable_entity }\n end\n end\n end", "def biography_params\n params.require(:biography).permit(:name, :description, :tags_string, :user_id)\n end", "def create\n @biological_relationship = BiologicalRelationship.new(biological_relationship_params)\n\n respond_to do |format|\n if @biological_relationship.save\n format.html { redirect_to @biological_relationship, notice: 'Biological relationship was successfully created.' }\n format.json { render :show, status: :created, location: @biological_relationship }\n else\n format.html { render :new }\n format.json { render json: @biological_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_params\n params.require(:user).permit(:bio)\n end", "def bio_params\n params.require(:bio).permit(:content, :image)\n end", "def create\n @breed = Breed.new(breed_params)\n @user = User.find(params[:user_id])\n @breed.user_id = @user.id\n# puts @breed\nlogger.info(@breed)\n\n if @breed.save!\n render json: @breed, status: :created\n else\n render json: @breed.errors, status: :unprocessable_entity\n end\n # render json: {breed: :breed_params}\n end", "def create\n @biography_book = current_user.biography_books.build(biography_book_params)\n\n respond_to do |format|\n if @biography_book.save\n format.html { redirect_to @biography_book, notice: \"Biography review was successfully created.\" }\n format.json { render :show, status: :created, location: @biography_book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @biography_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend", "def create\n # binding.pry\n @mechanic = Mechanic.new params.require(:mechanic).permit(:bio, :kind, :company, :address, :city, :state, :zip, :speciality, :price, :picture)\n @user = User.new params[:mechanic].require(:user_attributes).permit(:name, :email, :password, :password_confirmation)\n @user.role = 1\n @mechanic.approved = false\n\n respond_to do |format|\n if @user.save\n @mechanic.user_id = @user.id\n if @mechanic.save\n format.html { redirect_to @mechanic, notice: 'Mechanic was successfully created.' }\n format.json { render :show, status: :created, location: @mechanic }\n else\n format.html { render :new }\n format.json { render json: @mechanic.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def bio_save\n @note = current_user.note\n @note.bio = params[:note][:bio]\n @note.save\n @user = current_user\n respond_to do |format|\n if @note.save\n format.js\n else\n format.js {render \"shared/save_failed\"}\n end\n end\n end", "def create\n @birth = Birth.new(birth_params)\n\n respond_to do |format|\n @birth.user_id= current_user.id\n if @birth.save\n format.html { redirect_to @birth, notice: 'Birth was successfully created.' }\n format.json { render :show, status: :created, location: @birth }\n else\n format.html { render :new }\n format.json { render json: @birth.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n gender: params[:gender],\n birthday: params[:birthday],\n address: params[:address],\n phone_number: params[:phone_number],\n currently_doing: params[:currently_doing],\n education: params[:education],\n references: params[:references],\n additional_info: params[:additional_info],\n image_url: params[:image_url],\n parents: params[:parents],\n siblings: params[:siblings],\n shul: params[:shul],\n summers: params[:summers],\n height: params[:height],\n shadchan_info: params[:shadchan_info],\n looking_for: params[:looking_for],\n )\n if @user.save\n render json: { message: \"User created successfully\" }, status: :created\n else\n render json: { errors: @user.errors.full_messages }, status: :bad_request\n end\n end", "def getHobbies\n login_user_id = params[:my_id]\n login_user = User.find(login_user_id)\n\n hobbies = login_user.hobbies\n\n hobbies_hash = hobbies.map do |hobby|\n hobby_hash = hobby.attributes\n hobby_hash['category_name'] = hobby.category.name\n hobby_hash['photo_url'] = hobby.photo_url\n hobby_hash\n end\n\n if hobbies_hash.blank?\n res = {\n result: false,\n data: nil\n }\n else\n res = {\n result: true,\n data: {\n user_id: login_user_id,\n name: login_user.name,\n hobbies: hobbies_hash\n }\n }\n end\n\n render json: res\n end", "def create\n #@gift = Gift.new(gift_params)\n #create(giftname, gifturl, username)\n @id = gift_params[:giver]\n @user = Users.find_by(id: @id)\n puts params\n output = Gift.create(gift_params[:name], gift_params[:url], @user.username, params[:bio])\n render json: output\n # respond_to do |format|\n # if @gift.save\n # format.html { redirect_to @gift, notice: 'Gift was successfully created.' }\n # format.json { render :show, status: :created, location: @gift }\n # else\n # format.html { render :new }\n # format.json { render json: @gift.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def profile_params\n params.permit(\n :user_id,\n :bio\n )\n end", "def create\n @user_allergy = UserAllergie.new(user_allergy_params)\n\n respond_to do |format|\n if @user_allergy.save\n format.html { redirect_to @user_allergy, notice: 'User allergie was successfully created.' }\n format.json { render :show, status: :created, location: @user_allergy }\n else\n format.html { render :new }\n format.json { render json: @user_allergy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @user_biography = UserBiography.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_biography }\n end\n end", "def baby_params\n params.require(:baby).permit(:first_name, :last_name, :weight, :birth_date)\n end", "def create\n @userbarry = Userbarry.new(userbarry_params)\n\n respond_to do |format|\n if @userbarry.save\n format.html { redirect_to @userbarry, notice: 'Userbarry was successfully created.' }\n format.json { render :show, status: :created, location: @userbarry }\n else\n format.html { render :new }\n format.json { render json: @userbarry.errors, status: :unprocessable_entity }\n end\n end\n end", "def biography_params\n params.require(:biography).permit(:title, :body, :header_photo_url)\n end", "def create\n @my_boice = MyBoice.new(my_boice_params)\n\n respond_to do |format|\n if @my_boice.save\n format.html { redirect_to @my_boice, notice: 'My boice was successfully created.' }\n format.json { render :show, status: :created, location: @my_boice }\n else\n format.html { render :new }\n format.json { render json: @my_boice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@buddy = Buddy.new(buddy_params)\n @buddy = current_user.buddies.build(buddy_params)\n\n respond_to do |format|\n if @buddy.save\n format.html { redirect_to @buddy, notice: \"Buddy was successfully created.\" }\n format.json { render :show, status: :created, location: @buddy }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @buddy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def create\n @baby = Baby.new(baby_params)\n\n respond_to do |format|\n if @baby.save\n format.html { redirect_to @baby, notice: 'Baby was successfully created.' }\n format.json { render :show, status: :created, location: @baby }\n else\n format.html { render :new }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end", "def baby_params\n params.require(:baby).permit(:first_name, :last_name, :date_of_birth, :weight)\n end", "def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end", "def create\n @baby = Baby.new(baby_params)\n\n respond_to do |format|\n if @baby.save\n format.html { redirect_to @baby, notice: \"Baby was successfully created.\" }\n format.json { render :show, status: :created, location: @baby }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end", "def create\n @bio = Bio.new(params[:bio])\n\n respond_to do |format|\n if @bio.save\n flash[:notice] = 'Bio was successfully created.'\n format.html { redirect_to(@bio) }\n format.xml { render :xml => @bio, :status => :created, :location => @bio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bio_url = BioUrl.new(bio_url_params)\n\n respond_to do |format|\n if @bio_url.save\n format.html { redirect_to @bio_url, notice: 'Bio url was successfully created.' }\n format.json { render :show, status: :created, location: @bio_url }\n else\n format.html { render :new }\n format.json { render json: @bio_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @user_biography = UserBiography.find(params[:id])\n @user_biography.destroy\n\n respond_to do |format|\n format.html { redirect_to user_biographies_url }\n format.json { head :no_content }\n end\n end", "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n @users = User.friends_by_name(user_params[:name])\n render json: {me: @user, users: @users, rooms: []}, status: :ok\n else\n render json: {error: @user.errors.full_messages.first}, status: :unprocessable_entity\n end\n end", "def create\n @boat = current_user.boats.build(boat_params)\n @boat.create_boat_features_set\n respond_to do |format|\n if @boat.save\n format.html { redirect_to edit_boat_path(@boat), notice: _(\"Boat was successfully created\") }\n format.json { render :edit, status: :created, location: @boat }\n else\n # pictures must be rebuilt to make the field appear in the form\n @boat.pictures.build unless @boat.pictures.any?\n format.html { render :new }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def biography_book_params\n params.require(:biography_book).permit(:title, :date_finished, :pages, :author, :things_learned, :words_learned, :question, :connection, :rating, :rationale, :user_id)\n end", "def user_params\n params.require(:user).permit(:username, :avatar_url, :biography)\n end", "def create\n @user = current_user.children.create(params[:user].merge :email => \"design+parent_id#{current_user.id}_child_count#{current_user.children.count + 1}@newint.com.au\")\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_path(current_user), notice: 'User was successfully created.' }\n format.json { render json: [:institution, @user], status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def biography_params\n params.require(:biography).permit(:content, :image_id)\n end", "def create\n @hobby = Hobby.new(hobby_params)\n\n if @hobby.save\n render :show, status: :created, location: @hobby\n else\n render json: @hobby.errors, status: :unprocessable_entity\n end\n end", "def create\n @experiment_biomechanical = ExperimentBiomechanical.new(params[:experiment_biomechanical])\n\n respond_to do |format|\n if @experiment_biomechanical.save\n format.html { redirect_to @experiment_biomechanical, notice: 'Experiment biomechanical was successfully created.' }\n format.json { render json: @experiment_biomechanical, status: :created, location: @experiment_biomechanical }\n else\n format.html { render action: \"new\" }\n format.json { render json: @experiment_biomechanical.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bounty = Bounty.new(params[:bounty])\n @chore = Chore.find(@bounty.chore_id)\n if @chore.nil?\n puts \"OH GOD WHY JESUS USE VALIDATORS COME ON NOW SERRIOUSLY GUYS\"\n end\n @chore.value=params[:value][:val].to_i\n @chore.save\n #TODO: Make the bounty get a user's information\n #and update the user parameter accordingly.\n @bounty.user = current_user\n respond_to do |format|\n if not @chore.nil? and @bounty.save!\n format.html { redirect_to :bounties, :notice => 'bounty was successfully created.' }\n format.json { render :json => @bounty, :status => :created, :location => @bounty }\n else\n format.html { render :action => \"new\", notice: 'errors creating bounty.' }\n format.json { render :json => @bounty.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user_biography = UserBiography.find(params[:id])\n\n respond_to do |format|\n if @user_biography.update_attributes(params[:user_biography])\n format.html { redirect_to @user_biography, notice: 'User biography was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_biography.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @business_profile = BusinessProfile.new(business_profile_params)\n @business_profile.users << current_user\n\n respond_to do |format|\n if @business_profile.save\n format.html { redirect_to @business_profile, notice: 'Business profile was successfully created.' }\n format.json { render :show, status: :created, location: @business_profile }\n else\n format.html { render :new }\n format.json { render json: @business_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_params\n params.require(:user).permit(:name, :avatar, :birthday, :gender, :phone, :username, :street, :city, :state, :zipcode, :latitude, :longitude, user_children_attributes: [:id, :name, :birthday])\n end", "def create\n owner = User.find_or_create params[:owner_id]\n name = params[:name]\n\n lobby = Lobby.create! owner: owner, name: name\n render json: lobby.as_json( only: [:id, :name] )\n end", "def create\n @my_girlfriend = MyGirlfriend.new(my_girlfriend_params)\n @my_girlfriend.user_id = current_user.id\n respond_to do |format|\n if @my_girlfriend.save\n format.html { redirect_to @my_girlfriend, notice: 'My girlfriend was successfully created.' }\n format.json { render :show, status: :created, location: @my_girlfriend }\n else\n format.html { render :new }\n format.json { render json: @my_girlfriend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend", "def user_allergy_params\n params.require(:user_allergy).permit(:user_id, :allergie_id)\n end", "def baggage_params\n params.require(:baggage).permit(:name, :user_id, :sex, :size, :points, :genre)\n end", "def create\n @boat = Boat.new(boat_params)\n @boat.user_id = current_user.id\n\n respond_to do |format|\n if @boat.save\n format.html { redirect_to @boat, notice: 'Boat was successfully created.' }\n # format.json { render :show, status: :created, location: @boat }\n format.js\n else\n format.html { render :new }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n profile = @user.profile\n user_hash = { user: { id: @user.id, origin: @user.origin, open_id: @user.open_id,\n auth_token: @user.auth_token, password: @user.password, nickname: profile.nickname, avatar: profile.avatar.url }}\n format.json { render json: user_hash, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def bijou_params\n params.require(:bijou).permit(:name, :description)\n end", "def user_params\n\t\tparams.require(:user).permit(:interest, :bio, :avatar, :location, :date_of_birth)\n\tend", "def beast_params\n params.require(:beast).permit(:firstname, :lastname, :pseudo, :degree, :rating, :bio, :image, :subject_ids => [])\n end", "def create\n @boat = Boat.new(boat_params)\n\n respond_to do |format|\n if @boat.save\n=begin\n @user = User.find_by_mobile_no(@boat.mobile_no)\n @boat.user_id = @user.id if @user.present?\n @boat.save\n=end\n format.html {redirect_to @boat, notice: 'Boat was successfully created.'}\n format.json {render json: @boat, status: :created, location: @boat}\n else\n format.html {render action: \"new\"}\n format.json {render json: @boat.errors, status: :unprocessable_entity}\n end\n end\n end", "def save_user\n client = create_db_client\n client.query(\"INSERT INTO users(name, email, password, bio) VALUES('#{@name}', '#{@email}', '#{@password}', '#{@bio}')\")\n \n id = client.last_id\n rawData = client.query(\"SELECT * FROM users WHERE id='#{id}'\")\n users = Array.new\n rawData.each do |data|\n user = {:id => data[\"id\"], :name => data[\"name\"] ,:email => data[\"email\"], :password => data[\"password\"], :bio => data[\"bio\"]}\n users << user\n end\n response = Response.new('success', 'success input user', users)\n return response.response_api\n end", "def create\r\n\r\n # Make a copy of the user params\r\n user_params = (params[:user]).clone\r\n\r\n unless ApplicationHelper.validate_key(request.headers[\"Validation-Key\"])\r\n # If the validation key is there, then this is a test app talking to us, so\r\n # accept whatever secret key is passed in. Otherwise, generate a random key.\r\n user_params.merge!(:secretkey => SecureRandom.uuid)\r\n end\r\n\r\n # initialize bucks to be 200 and member to be false\r\n user_params.merge!(:bucks => 200, :membertime => nil)\r\n\r\n # handle fb friends case\r\n friends = user_params.delete(:fb_friends)\r\n if friends\r\n fbid = user_params[:fbid]\r\n available_friends = fb_friends_helper(fbid, friends)\r\n\r\n user_params.merge!(:fb_friends => available_friends)\r\n end\r\n\r\n # Create the new user\r\n @user = User.new(user_params)\r\n\r\n respond_to do |format|\r\n if @user.save\r\n\r\n # Update bucks for the user for this week\r\n start_date = Time.now.beginning_of_week.to_date\r\n update_bucks_lb(@user.id, user_params[:bucks], start_date)\r\n\r\n log_event(:user, :created, user_params)\r\n\r\n # Be cautious about creating users through the website. The general case is\r\n # that users are only ever created via the JSON API. The website interface\r\n # should only be used for debugging purposes.\r\n format.html { redirect_to @user, notice: 'User was successfully created.' }\r\n format.json { render json: @user.as_json(:only => [:id, :fbid, :membertime, :bucks, :email, :secretkey]) }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json {\r\n create_error(:unprocessable_entity, :post, user_params, @user.errors)\r\n }\r\n end\r\n end\r\n end", "def create\n @profile = current_user.create_profile(profile_params)\n\n @profile.bmi = ((@profile.weight*703)/(@profile.height**2))\n\n if @profile.gender == \"Male\"\n @profile.bodyfat=((86.01*Math.log10((@profile.waist) - (@profile.neck))) - (70.041*Math.log10(@profile.height)) + 36.76)\n\n else\n if @profile.gender == \"Female\"\n @profile.bodyfat=(163.205*math.log10((@profile.waist) - (@profile.hip) + (@profile.neck)) - 97.684*math.log10(@profile.height) - 78.387)\n end\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profiles_path, notice: 'Profile was successfully created.' }\n format.json { render action: 'index', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #ederrafo seteo como nuevo\n @user = User.new(params[:user])\n if @user.save\n @wise = Wise.new(:website => params[:wise][:website],\n :apellation => params[:wise][:apellation],\n :banck_account => params[:wise][:banck_account],\n :bank => params[:wise][:bank],\n :user_id => @user.id,\n :summary => params[:wise][:summary],\n :guy => 1 \n )\n respond_to do |format|\n if @wise.save\n format.html { redirect_to @wise, :notice => 'Wise was successfully created.' }\n format.json { render :json => @wise, :status => :created, :location => @wise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @wise.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def create\n @current_bijou = current_rockhound;\n # @bijou = Bijou.new(bijou_params)\n\n @new_bijou = @current_bijou.bijous.build(bijou_params)\n\n respond_to do |format|\n if @new_bijou.save\n format.html { redirect_to @bijou, notice: 'Bijou was successfully created.' }\n format.json { render :show, status: :created, location: @bijou }\n else\n format.html { render :new }\n format.json { render json: @bijou.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n # TODO do we need this? once we seed fresh the ids should automatically increment properly\n @user.id = User.maximum(:id).next\n\n @user.profile_picture = File.open(File.join(Rails.root, '/app/assets/images/no_photo.jpg'))\n @user.bio = '';\n\n respond_to do |format|\n if @user.save\n session[:user_id] = @user.id\n flash[:alert] = \"Welcome! Please fill in your interests so we can get started.\"\n\n # redirect to edit user path so they can input their interests\n format.html { redirect_to edit_user_path(@user.id) }\n format.json { render json: @user, status: :created, location: @user }\n else\n flash[:alert] = @user.errors.full_messages.to_s # TODO incorporate this into page\n format.html { redirect_to new_user_path }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_bio\n @bio = bio.find(params[:id])\n end", "def baby_params\n params.require(:baby).permit(:name)\n end", "def generate_info(username)\n @url_library = URI.encode(\"http://hummingbird.me/api/v1/users/\"+username+\"/library\")\n @url_profile = URI.encode(\"http://hummingbird.me/api/v1/users/\"+username)\n \n @library_response = HTTParty.get(@url_library)\n @profile_response = HTTParty.get(@url_profile)\n\n @library_body = @library_response.body\n @profile_body = @profile_response.body\n \n @cur_user_list = JSON.parse(@library_body)\n @cur_user = JSON.parse(@profile_body)\n \n new_user = User.new\n new_user.name = @cur_user['name']\n new_user.hm_library_url = \"https://hummingbird.me/users/\"+ @cur_user['name'] + \"/library\"\n new_user.hm_dash_url = \"https://hummingbird.me/users/\"+ @cur_user['name']\n new_user.avatar = @cur_user['avatar']\n new_user.time_spent_on_anime = @cur_user['life_spent_on_anime']\n new_user.time_string = totalTimeString(@cur_user['life_spent_on_anime'])\n new_user.cover_image = @cur_user['cover_image']\n new_user.last_date_updated = DateTime.strptime(@cur_user['last_library_update'],'%Y-%m-%dT%H:%M:%S')\n new_user.number_of_entries,new_user.mean_rating,new_user.number_of_episodes = getMeanScore(@cur_user_list)\n new_user.save! # Save here to allow us to insert records into it after\n\n # Generate each list item from JSON\n @cur_user_list.each do |index, value|\n new_library_entry = LibraryEntry.new\n new_library_entry.title = index['anime']['title']\n new_library_entry.last_date_watched = DateTime.strptime(index['last_watched'],'%Y-%m-%dT%H:%M:%S')\n new_library_entry.episodes_watched = index['episodes_watched']\n new_library_entry.times_rewatched = index['rewatched_times']\n new_library_entry.status = index['status']\n new_library_entry.rating = index['rating']['value']\n new_library_entry.hm_id = index['anime']['id']\n new_library_entry.name = new_user.name\n\n # Find this anime, plug it into users animes and library entry\n cur_entry_anime = Anime.where(:hm_id => index['anime']['id']).first\n new_library_entry.anime = cur_entry_anime\n\n new_library_entry.save!\n\n # Plug new library entry into anime and user\n cur_entry_anime.library_entries << new_library_entry\n new_user.library_entries << new_library_entry\n end\n\n # We only want to set this when everything is over, so that users aren't penalized for unfinished queries.\n new_user.time_can_refresh = Time.zone.now + 6.hours\n new_user.save!\n end", "def create(params, membership)\n # Send payload to blip\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n firstname: (params[5].nil? ? params[4][0] : params[5]),\n lastname: [params[6], params[7]].reject{|e| e.nil? or e.empty?}.join(' '),\n email: (params[3].nil? ? 'unknown@nieuwedelft.nl.invalid' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n blip = post('https://people.i.bolkhuis.nl/persons', data)\n\n # Grab uid\n unless blip == nil\n uid = blip['uid']\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\n end\nend", "def create\n @bokin = Bokin.new(params[:bokin])\n \n @bokin.name = current_user.name\n @bokin.photourl = current_user.screen_name\n \n \n respond_to do |format|\n if @bokin.save\n format.html { redirect_to @bokin, :notice => 'Bokin was successfully created.' }\n format.json { render :json => @bokin, :status => :created, :location => @bokin }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bokin.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user_badge = UserBadge.new(user_badge_params)\n @user_badge.active = true\n @user_badge.user_id = @user.id\n\n respond_to do |format|\n if @user_badge.save\n format.html { redirect_to team_user_path(@team, @user), notice: 'User badge was successfully created.' }\n format.json { render :show, status: :created, location: @user_badge }\n else\n format.html { render :new }\n format.json { render json: @user_badge.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_bio\n @bio = Bio.find(params[:id])\n end", "def create\n @scribble = Scribble.new(params[:scribble])\n @scribble.posted_by_uid=current_user.id\n @user = User.find_by_id(current_user.id)\n @profile = @user.profile\n \n\n @scribble.posted_by= @profile.firstname+ \" \"+@profile.lastname\n \n #t = @profile.user.firstname\n #@scribble.posted_by = t\n #current_user.profile \n #@profile = Profile.current_user.id\n #@scribble.posted_by=@profile.first_name+\" \"+@profule.last_name\n #@scribble.posted_by=current_user.first_name+\" \"+current_user.last_name\n @scribble.promotes=0\n @scribble.demotes=0\n @scribble.save\n respond_to do |format|\n if @scribble.save\n format.html { redirect_to root_path }\n format.json { render :json => @scribble, :status => :created, :location => @scribble }\n else\n format.html { redirect_to root_path }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user_business_profile = UserBusinessProfile.new(user_business_profile_params)\n\n respond_to do |format|\n if @user_business_profile.save\n format.html { redirect_to @user_business_profile, notice: 'User business profile was successfully created.' }\n format.json { render :show, status: :created, location: @user_business_profile }\n else\n format.html { render :new }\n format.json { render json: @user_business_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @biographies = Biography.added_by(current_admin_user).page(params[:page]).per(10)\n end", "def user_params\n params.require(:profile).permit(\n user_attributes: [:first_name,\n :last_name,\n :skill_names,\n :interest_ids =>[]]\n )['user_attributes']\n end", "def set_biography\n @biography = Biography.find(params[:id])\n end", "def set_biography\n @biography = Biography.find(params[:id])\n end", "def user_params\n params.require(:user).permit(:username, :email, :bio)\n end", "def users_profile_params\n params.require(:user).permit(:name, :email, :gender, :image, \n user_profile_attributes: [:id, :name, :furigana, :date_of_birth, :postalcode, :prefecture_id, :address, :occupation, :interest, :remarks] \n )\n end", "def create\n @user_buys_promise = UserBuysPromise.new(user_buys_promise_params)\n\n respond_to do |format|\n if @user_buys_promise.save\n format.html { redirect_to @user_buys_promise, notice: 'User buys promise was successfully created.' }\n format.json { render :show, status: :created, location: @user_buys_promise }\n else\n format.html { render :new }\n format.json { render json: @user_buys_promise.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_params\n params.require(:user).permit(\n :email,\n :first_name,\n :surname,\n :password,\n :password_confirmation,\n :gym_id,\n :gender,\n :image,\n :is_member,\n :is_member_child_4,\n :is_member_child_9,\n :is_free_open\n )\n end", "def user_params\n\n params.require(:user).permit(\n :username,\n :email,\n :password,\n :password_confirmation,\n {:profile_attributes => [\n :id,\n :user_id,\n :college, \n :first_name, \n :last_name, \n :hometown,\n :domicile,\n :birthdate,\n :about_me,\n :gender,\n :my_words ] }\n )\n end", "def create\n @baggage = Baggage.new(params[:baggage])\n\n respond_to do |format|\n if @baggage.save\n format.html { redirect_to @baggage, notice: 'Baggage was successfully created.' }\n format.json { render json: @baggage, status: :created, location: @baggage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @baggage.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @alumno = Alumno.new\n @alumno.build_user\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alumno }\n end\n end", "def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end", "def user_params\n params.require(:user).permit(:name, :biography, :nickname, :affiliation)\n end", "def my_boice_params\n params.require(:my_boice).permit(:name, :description)\n end", "def create\n @booze_user = BoozeUser.new(params[:booze_user])\n @booze_user.user = current_user\n\n respond_to do |format|\n if @booze_user.save\n @boozes = Booze.all\n format.html { redirect_to boozes_path, :notice => 'Booze #{@booze_user.booze.name} was successfully added to your account.'}\n format.xml { render :xml => @booze, :status => :created, :location => @booze }\n else\n @booze_users = BoozeUser.all\n format.html { render :action => boozes_path }\n format.xml { render :xml => @booze_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n byebug\n @skill_user_profile = SkillUserProfile.new(skill_user_profile_params)\n\n if @skill_user_profile.save\n render json: @skill_user_profile, status: :created, location: @skill_user_profile\n else\n render json: @skill_user_profile.errors, status: :unprocessable_entity\n end\n end", "def create\n @boat = Boat.new(boat_params)\n @boat.user_id = current_user.id\n if @boat.save\n redirect_to boats_path\n else\n redirect_to new_boat_path, :notice => \"Please ensure that your boat name is unique (boat names are case sensitive), that your boat's max capacity is at least 1, and that you have selected a location\"\n end\n\n end", "def create\n #@user = User.new(params[:user])\n @user = User.new\n @user.city = params[:user][:city]\n @user.dob = params[:user][:dob]\n @user.email = params[:user][:email]\n @user.first_name = params[:user][:first_name]\n @user.gender = params[:user][:gender]\n @user.last_name = params[:user][:last_name]\n @user.state = params[:user][:state]\n @user.password = params[:user][:password]\n\n respond_to do |format|\n if @user.save\n # Send the welcome email message\n BvMailer.user_welcome_email(@user).deliver\n \n format.html { redirect_to '/userhome', :notice => 'Your account was successfully created. You should see an email from us soon.' }\n #format.json { render :json => @user, :status => :created, :location => @user }\n else\n @button_text = 'Sign up!'\n @show_tos = true\n format.html { render :action => \"new\" }\n #format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bio_signal = BioSignal.new(params[:bio_signal])\n\n respond_to do |format|\n if @bio_signal.save\n format.html { redirect_to @bio_signal, notice: 'Bio signal was successfully created.' }\n format.json { render json: @bio_signal, status: :created, location: @bio_signal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bio_signal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boite = Boite.new(boite_params)\n\n respond_to do |format|\n if @boite.save\n format.html { redirect_to @boite, notice: 'Boite was successfully created.' }\n format.json { render :show, status: :created, location: @boite }\n else\n format.html { render :new }\n format.json { render json: @boite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @profile = Profile.new\n @profile.build_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def create\n @user_charity = UserCharity.new(user_charity_params)\n\n respond_to do |format|\n if @user_charity.save\n format.html { redirect_to @user_charity, notice: 'User charity was successfully created.' }\n format.json { render :show, status: :created, location: @user_charity }\n else\n format.html { render :new }\n format.json { render json: @user_charity.errors, status: :unprocessable_entity }\n end\n end\n end", "def profile_params\n params.require(:profile).permit(:residence, :first_time, :expectancy,\n :agile_id, :agile_description,\n :hobbies, :bring, :proposal,\n :bio, :agileRelation_id,\n :gender_id, :size_id)\n end", "def create\n @bloodpressure = current_user.bloodpressures.build(bloodpressure_params)\n\n respond_to do |format|\n if @bloodpressure.save\n format.html { redirect_to @bloodpressure, notice: 'Bloodpressure Record Created' }\n format.json { render :show, status: :created, location: @bloodpressure }\n else\n format.html { render :new }\n format.json { render json: @bloodpressure.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_params\n params.require(:user).permit(\n :first_name, :last_name, :bio, :email, :username, :password,\n :password_confirmation, :interest_list\n )\n end", "def create\n @jam_circle = JamCircle.new(jam_circle_params)\n @jam_circle.user_id = @user.id\n @jam_circle.users << @user\n if params[:users]\n user_ids = params[:users].keys\n user_ids.each do |id|\n @jam_circle.users << User.find(id)\n end\n end\n respond_to do |format|\n if @jam_circle.save\n format.html { redirect_to @jam_circle }\n format.json { render :show, status: :created, location: @jam_circle }\n else\n format.html { render :new }\n format.json { render json: @jam_circle.errors, status: :unprocessable_entity }\n end\n end\n end", "def hobby\r\n @profile ||= HobbyProfile.new(:account_id => session[:account_id])\r\n \r\n if request.post?\r\n # ! unlimited required !\r\n \r\n @profile.intro = params[:intro] && params[:intro].strip\r\n @profile.interest = params[:interest] && params[:interest].strip\r\n @profile.music = params[:music] && params[:music].strip\r\n @profile.movie = params[:movie] && params[:movie].strip\r\n @profile.cartoon = params[:cartoon] && params[:cartoon].strip\r\n @profile.game = params[:game] && params[:game].strip\r\n @profile.sport = params[:sport] && params[:sport].strip\r\n @profile.book = params[:book] && params[:book].strip\r\n @profile.words = params[:words] && params[:words].strip\r\n @profile.food = params[:food] && params[:food].strip\r\n @profile.idol = params[:idol] && params[:idol].strip\r\n @profile.car = params[:car] && params[:car].strip\r\n @profile.place = params[:place] && params[:place].strip\r\n \r\n if @profile.save\r\n flash.now[:message] = \"已成功保存\"\r\n else\r\n flash.now[:error_msg] = \"操作失败, 再试一次吧\"\r\n end\r\n \r\n end\r\n end" ]
[ "0.6635438", "0.6198474", "0.61068356", "0.60496575", "0.5917843", "0.5771784", "0.56593245", "0.5633631", "0.5619063", "0.56128657", "0.56062555", "0.5566145", "0.5563016", "0.5516866", "0.5489686", "0.5484335", "0.54818875", "0.54562587", "0.5415347", "0.5408733", "0.540066", "0.5398538", "0.5377614", "0.53746563", "0.53674555", "0.5358074", "0.53562117", "0.53366923", "0.53314304", "0.5327782", "0.5321346", "0.5311038", "0.5308573", "0.53018063", "0.5296089", "0.5283048", "0.5282777", "0.5272699", "0.526932", "0.52690613", "0.5251452", "0.52488965", "0.52367383", "0.52193725", "0.5214328", "0.5211235", "0.5206415", "0.5200431", "0.51990414", "0.5195943", "0.5194778", "0.5180541", "0.51732826", "0.5148297", "0.5134528", "0.51321745", "0.51284987", "0.51275915", "0.5125796", "0.5120298", "0.51185924", "0.5117989", "0.5117928", "0.5116001", "0.51079535", "0.5103998", "0.50972", "0.5096015", "0.5090938", "0.5089068", "0.5073173", "0.50592774", "0.5054858", "0.5054682", "0.5046898", "0.50432295", "0.50432295", "0.50367475", "0.5036534", "0.50226307", "0.50189734", "0.5015614", "0.5013133", "0.501107", "0.50020075", "0.5001385", "0.49977192", "0.49959213", "0.4994961", "0.49949473", "0.4992941", "0.49859124", "0.49814498", "0.4981286", "0.49780142", "0.49729216", "0.49702704", "0.4964638", "0.4962785", "0.4961624" ]
0.5598525
11
PUT /user_biographies/1 PUT /user_biographies/1.json
def update @user_biography = UserBiography.find(params[:id]) respond_to do |format| if @user_biography.update_attributes(params[:user_biography]) format.html { redirect_to @user_biography, notice: 'User biography was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @user_biography.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n if @bio.update_attributes(params[:bio])\n format.html { redirect_to @bio.user.profile, notice: 'Bio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bio.update(bio_params)\n format.html { redirect_to biography_path, notice: 'bio was successfully updated.' }\n format.json { render :index, status: :ok, location: @biography }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @bio.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def set_bio\n @bio = bio.find(params[:id])\n end", "def update\n respond_to do |format|\n if @biography.update(biography_params)\n format.html { redirect_to [:admin, @biography], notice: 'Biography was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @biography.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_biography\n @biography = Biography.find(params[:id])\n end", "def set_biography\n @biography = Biography.find(params[:id])\n end", "def set_bio\n @bio = Bio.find(params[:id])\n end", "def update\n respond_to do |format|\n if @biological_relationship.update(biological_relationship_params)\n format.html { redirect_to @biological_relationship, notice: 'Biological relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @biological_relationship }\n else\n format.html { render :edit }\n format.json { render json: @biological_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_my_hobbies\n\t \tif @user.update_attributes(my_hobby: params[:my_hobby])\n\t \t# response to the JSON\n\t\t\trender json: { success: true,message: \"My hobby Successfully Updated.\", response: {my_hobby: @user.my_hobby} },:status=>200\n\t else\n\t render :json=> { success: false, message: @user.errors },:status=> 203\n\t end\t\n\tend", "def create\n @biography = Biography.new(biography_params)\n respond_to do |format|\n if @biography.save\n current_admin_user.biographies << @biography\n format.html { redirect_to [:admin, @biography], notice: 'Biography was successfully created.' }\n format.json { render action: 'show', status: :created, location: @biography }\n else\n format.html { render action: 'new' }\n format.json { render json: @biography.errors, status: :unprocessable_entity }\n end\n end\n end", "def biography_params\n params.require(:biography).permit(:name, :description, :tags_string, :user_id)\n end", "def update\n respond_to do |format|\n if @bio_url.update(bio_url_params)\n format.html { redirect_to @bio_url, notice: 'Bio url was successfully updated.' }\n format.json { render :show, status: :ok, location: @bio_url }\n else\n format.html { render :edit }\n format.json { render json: @bio_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @bio = Bio.where(:user_id => current_user.id).last # Get last updated bio of user\n end", "def bio_save\n @note = current_user.note\n @note.bio = params[:note][:bio]\n @note.save\n @user = current_user\n respond_to do |format|\n if @note.save\n format.js\n else\n format.js {render \"shared/save_failed\"}\n end\n end\n end", "def destroy\n @user_biography = UserBiography.find(params[:id])\n @user_biography.destroy\n\n respond_to do |format|\n format.html { redirect_to user_biographies_url }\n format.json { head :no_content }\n end\n end", "def update\n \n @user = User.find(params[:id])\n \n bSave = true\n \n if(bSave)\n bSave = @user.update_attribute(:bio,params[:user][:bio])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:location,params[:user][:location])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:first_name,params[:user][:first_name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:last_name,params[:user][:last_name])\n end\n if(bSave)\n bSave = @user.update_attribute(:name,params[:user][:name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:email,params[:user][:email])\n #@user.email = params[:user][:email]\n #bSave = @user.save\n end\n \n #debugger\n respond_to do |format|\n if bSave\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @my_boice.update(my_boice_params)\n format.html { redirect_to @my_boice, notice: 'My boice was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_boice }\n else\n format.html { render :edit }\n format.json { render json: @my_boice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(boat_params)\n=begin\n @user = User.find_by_mobile_no(@boat.mobile_no)\n @boat.user_id = @user.id if @user.present?\n @boat.save\n=end\n format.html {redirect_to @boat, notice: 'Boat was successfully updated.'}\n format.json {head :no_content}\n else\n format.html {render action: \"edit\"}\n format.json {render json: @boat.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def show\n @user_biography = UserBiography.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_biography }\n end\n end", "def new\n @user_biography = UserBiography.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_biography }\n end\n end", "def update\n respond_to do |format|\n @birth.user_id= current_user.id\n if @birth.update(birth_params)\n format.html { redirect_to @birth, notice: 'Birth was successfully updated.' }\n format.json { render :show, status: :ok, location: @birth }\n else\n format.html { render :edit }\n format.json { render json: @birth.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def set_biography_book\n @biography_book = BiographyBook.find(params[:id])\n end", "def update\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n\n respond_to do |format|\n if @experiment_biomechanical.update_attributes(params[:experiment_biomechanical])\n format.html { redirect_to @experiment_biomechanical, notice: 'Experiment biomechanical was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment_biomechanical.errors, status: :unprocessable_entity }\n end\n end\n end", "def bio_params\n params.require(:bio).permit(:content, :image)\n end", "def create\n @bio = Bio.new(params[:bio])\n\n respond_to do |format|\n if @bio.save\n format.html { redirect_to @bio, notice: 'Bio was successfully created.' }\n format.json { render json: @bio, status: :created, location: @bio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bijou.update(bijou_params)\n format.html { redirect_to @bijou, notice: 'Bijou was successfully updated.' }\n format.json { render :show, status: :ok, location: @bijou }\n else\n format.html { render :edit }\n format.json { render json: @bijou.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @biography_book.update(biography_book_params)\n format.html { redirect_to @biography_book, notice: \"Biography review was successfully updated.\" }\n format.json { render :show, status: :ok, location: @biography_book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @biography_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user_info = User.find(params[:id])\n if !user_info.points\n @user[:points] = 100\n end\n if !user_info.image\n @user[:image] = 'https://graph.facebook.com/'+user_info.uid.to_s+'/picture?width=360&height=210'\n end\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend", "def user_params\n params.require(:user).permit(:bio)\n end", "def update\n respond_to do |format|\n if @baby.update(baby_params)\n format.html { redirect_to @baby, notice: 'Baby was successfully updated.' }\n format.json { render :show, status: :ok, location: @baby }\n else\n format.html { render :edit }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile(body)\n post(\"user/#{user_id}/profile.json\", body)\n end", "def profile_params\n params.permit(\n :user_id,\n :bio\n )\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def set_bio_url\n @bio_url = BioUrl.find(params[:id])\n end", "def update\n respond_to do |format|\n if @baby.update(baby_params)\n format.html { redirect_to @baby, notice: \"Baby was successfully updated.\" }\n format.json { render :show, status: :ok, location: @baby }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n id = params[\"id\"].to_i\n name = params[\"name\"]\n linkedin_connections = params[\"linkedin_connections\"].to_i\n facebook_connections = params[\"facebook_connections\"].to_i\n twitter_followers = params[\"twitter_followers\"].to_i\n\n user = User.find(id)\n user.update(\n id: id,\n name: name, \n linkedin_connections: linkedin_connections, \n facebook_connections: facebook_connections, \n twitter_followers: twitter_followers,\n social_connection_index: User.compute_social_connection(\n linkedin_connections,\n facebook_connections,\n twitter_followers\n )\n )\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'Human was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bio_signal = BioSignal.find(params[:id])\n\n respond_to do |format|\n if @bio_signal.update_attributes(params[:bio_signal])\n format.html { redirect_to @bio_signal, notice: 'Bio signal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bio_signal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end", "def update_params\n params.permit(:surname, :bio)\n end", "def update\n #puts \"@params[:gym]: #{params[:user][:gym]}\"\n #@gym = Gym.find(params[:user][:gym])\n\n redirect_to edit_user_path(current_user) if @user != current_user\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to challenges_path, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boat = Boat.find(params[:id])\n @boat.update({\n name: params[:boat][:name],\n maxcontainers: params[:boat][:maxcontainers],\n company_id: params[:boat][:company_id],\n location: params[:boat][:location],\n image: params[:boat][:image]\n })\n\n if (@boat)\n redirect_to url_for(:controller => :boats, :action => :index)\n else\n redirect_to url_for(:controller => :boats, :action => :edit)\n end\n end", "def update\n respond_to do |format|\n if @userbarry.update(userbarry_params)\n format.html { redirect_to @userbarry, notice: 'Userbarry was successfully updated.' }\n format.json { render :show, status: :ok, location: @userbarry }\n else\n format.html { render :edit }\n format.json { render json: @userbarry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(current_user.id)\n\n # if they have no interests, make interest_ids = empty array\n # otherwise it'll automatically save with one interest\n if user_params[:interest_ids].nil?\n @user.update(interest_ids: [])\n end\n @user.update(user_params)\n # save_friendships\n redirect_to profiles_path\n end", "def update_user(user)\n contact = find(user.id)\n\n mapper.update(user, contact.attributes)\n end", "def update\n if params[:users]\n user_ids = params[:users].keys\n user_ids.each do |id|\n @jam_circle.users << User.find(id)\n end\n end\n respond_to do |format|\n if @jam_circle.update(jam_circle_params)\n format.html { redirect_to @jam_circle }\n format.json { render :show, status: :ok, location: @jam_circle }\n else\n format.html { render :edit }\n format.json { render json: @jam_circle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @baton = Baton.find(params[:id])\n\n if @baton.update_attributes(params[:baton])\n flash[:notice] = \"성공적으로 바톤이 수정되었습니다!\"\n redirect_to find_path\n else\n flash[:error] = \"바톤 등록에 실패했습니다!\"\n render action: \"useredit\"\n end\n\n end", "def update\n respond_to do |format|\n if @user_allergy.update(user_allergy_params)\n format.html { redirect_to @user_allergy, notice: 'User allergie was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_allergy }\n else\n format.html { render :edit }\n format.json { render json: @user_allergy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n if @boy.update_attributes(params[:boy])\n format.html { redirect_to @boy, notice: 'Boy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n if @boy.update_attributes(params[:boy])\n format.html { redirect_to @boy, notice: 'Boy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end", "def updateProfile(data)\r\n self.bio = data[:bio].to_s\r\n self.birthDate = Date.strptime( data[:bdate], '%m/%d/%Y')\r\n self.lname = data[:lname]\r\n self.fname = data[:fname]\r\n self.gender = data[:gender]\r\n self.image_id = data[:asset_id].to_i\r\n self.family_gender_id = data[:familyStatus].to_i\r\n self.save\r\n end", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end", "def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update\n\n\n respond_to do |format|\n if @new_biosensor.update(new_biosensor_params)\n format.html { redirect_to @new_biosensor, notice: 'New biosensor was successfully updated.' }\n format.json { render :show, status: :ok, location: @new_biosensor }\n else\n format.html { render :edit }\n format.json { render json: @new_biosensor.errors, status: :unprocessable_entity }\n end\n end\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def biography_params\n params.require(:biography).permit(:title, :body, :header_photo_url)\n end", "def update\n if @hobby.update(hobby_params)\n render :show, status: :ok, location: @hobby\n else\n render json: @hobby.errors, status: :unprocessable_entity\n end\n end", "def update\n @baggage = Baggage.find(params[:id])\n\n respond_to do |format|\n if @baggage.update_attributes(params[:baggage])\n format.html { redirect_to @baggage, notice: 'Baggage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @baggage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_url, notice: 'Bowler was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def set_biometria\n @biometria = Biometria.find(params[:id])\n end", "def update_user_info(opts)\n opts[:birthday] = format_date(opts[:birthday]) if opts[:birthday]\n post(\"/user/#{@user_id}/profile.json\", opts)\n end", "def set_baby\n @baby = Baby.find(params[:id])\n end", "def set_baby\n @baby = Baby.find(params[:id])\n end", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @boite.update(boite_params)\n format.html { redirect_to @boite, notice: 'Boite was successfully updated.' }\n format.json { render :show, status: :ok, location: @boite }\n else\n format.html { render :edit }\n format.json { render json: @boite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n birth = \"2016\"+\"-\"+params[:month]+\"-\"+params[:day]\n @user.age_segment = params[:age_segment]\n @user.birthday = birth\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n set_boat\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to harbour_boats_path, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_baby\n @baby = Baby.find(params[:baby_id])\n end", "def update\n\t\tthe_user_id = params[\"id\"]\n \tuser = User.find_by(:id => the_user_id)\n \tuser.first = params[\"first\"]\n \tuser.last = params[\"last\"]\n \tuser.email = params[\"email\"]\n user.phone = params[\"phone\"]\n user.add_l1 = params[\"add1\"]\n \tuser.city = params[\"city\"]\n \tuser.state = params[\"state\"]\n \tuser.zip = params[\"zip\"]\n \tuser.age = params[\"age\"]\n \tuser.save\n \tredirect_to show_lobbys_url\n\tend", "def user_update_me(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_update_me ... opts: #{opts}\"\n end\n\n # resource path\n path = \"/user\".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 = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\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 = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"firstname\"] = opts[:'firstname'] if opts[:'firstname']\n form_params[\"lastname\"] = opts[:'lastname'] if opts[:'lastname']\n form_params[\"oldPassword\"] = opts[:'old_password'] if opts[:'old_password']\n form_params[\"newPassword\"] = opts[:'new_password'] if opts[:'new_password']\n form_params[\"newPasswordConfirm\"] = opts[:'new_password_confirm'] if opts[:'new_password_confirm']\n form_params[\"country\"] = opts[:'country'] if opts[:'country']\n form_params[\"pgpPubKey\"] = opts[:'pgp_pub_key'] if opts[:'pgp_pub_key']\n\n # http body (model)\n post_body = nil\n\n\n auth_names = []\n result = @api_client.call_api(:PUT, 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 => 'User')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_update_me. Result: #{result.inspect}\"\n end\n return result\n end", "def set_bijou\n @bijou = Bijou.find(params[:id])\n end", "def update\n respond_to do |format|\n if @boredom.update(boredom_params)\n format.html { redirect_to @boredom, notice: 'Boredom was successfully updated.' }\n format.json { render :show, status: :ok, location: @boredom }\n else\n format.html { render :edit }\n format.json { render json: @boredom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def biography_params\n params.require(:biography).permit(:content, :image_id)\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(user_params)\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.json { respond_with_bip(@user) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@user) }\n end\n end\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 respond_to do |format|\n if @tipocambio.update(tipocambio_params)\n format.html { redirect_to @tipocambio, notice: 'Tipocambio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipocambio }\n else\n format.html { render :edit }\n format.json { render json: @tipocambio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def update\n\t\tperson = Person.find_by_id(user_params[\"id\"])\n\t\tif person\n\t\t\tperson.favoriteCity = params[\"update\"]\n\t\t\tif person.save\n\t\t\t\trender json: {id: person.id, name: person.name, favoriteCity: person.favoriteCity}\n\t\t\telse\n\t\t\t\trender body: 'Person Invalid', status: 404\n\t\t\tend\n\t\telse\n\t\t\trender body: 'Person Not Found', status: 404\n\t\tend\n\tend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update\n if params[:user_goal_id] && params[user_id]\n goals = @user.update!(user_goal_params)\n render json: goals, status: :accepted\n end\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n #@user = User.find(params[:id])\n \n if @gym.update(gym_params)\n render JSON: @gym\n else\n render JSON: @gym.errors, status: :unprocessable_entity\nend\nend", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def update\n errors = {}\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if params[:person]\n begin\n if @person.json_update_attributes(params[:person])\n render_json :entry => @person.to_hash(@user, @client) and return\n end\n rescue NoMethodError => e\n errors = e.to_s\n end\n end\n\n render_json :status => :bad_request, :messages => @person.errors.full_messages\n @person = nil\n end", "def update\n @baby = Baby.find params[:id]\n respond_to do |format|\n if @baby.update_attributes(baby_params)\n format.html { redirect_to baby_path(@baby), notice: 'Bebe se actualizo correctamente.' }\n else\n format.html { render :edit }\n end\n end\n end", "def put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\n end", "def update_profile\n \t@user = User.find_by_id(params[:id])\n \tif @user.nil?\n render :json => {:message => \"User not exists\"}, :status => :not_acceptable\n else\n \tbegin\n\t @user.update_attributes(params[:user])\n\t @user.save!\n\t render :json => {:success => true, :message => \"User updated\", :user =>@user}, :status => :ok\n\t rescue Exception => e\n\t \tp e.backtrace\n\t render :json => {:success => false, :message => e.backtrace}, :status => :not_acceptable\n\t end\n end\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def biography_book_params\n params.require(:biography_book).permit(:title, :date_finished, :pages, :author, :things_learned, :words_learned, :question, :connection, :rating, :rationale, :user_id)\n end", "def update\n respond_to do |format|\n if @bunny.update(bunny_params)\n format.html { redirect_to @bunny, notice: 'Bunny was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bunny.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6728715", "0.61430943", "0.6076785", "0.6006197", "0.5944847", "0.5944847", "0.59333885", "0.59219307", "0.59190124", "0.5903632", "0.58626586", "0.5792056", "0.5694102", "0.56844187", "0.5684088", "0.5627282", "0.5609686", "0.55957776", "0.5563816", "0.5562741", "0.5554327", "0.55334044", "0.5481735", "0.548067", "0.54750603", "0.54728895", "0.54376197", "0.54317343", "0.5416155", "0.5415147", "0.5396798", "0.5390294", "0.53862137", "0.53767127", "0.53722036", "0.5363073", "0.536254", "0.5356868", "0.5355692", "0.5352504", "0.53523594", "0.53482056", "0.5344991", "0.5340311", "0.5337133", "0.53141356", "0.53098714", "0.53065306", "0.5288518", "0.52803004", "0.52790236", "0.5275196", "0.5267425", "0.5267425", "0.52505976", "0.5240432", "0.52337986", "0.52297556", "0.5224675", "0.52179", "0.5214976", "0.521062", "0.51940405", "0.5191384", "0.51911944", "0.51879495", "0.5184661", "0.5180804", "0.5180804", "0.51736593", "0.51707536", "0.5161368", "0.51595086", "0.5158449", "0.5157766", "0.5151144", "0.5150874", "0.51507616", "0.51432526", "0.51432526", "0.51432526", "0.5137566", "0.51367134", "0.51352125", "0.51274675", "0.51186633", "0.51184887", "0.5105465", "0.5105465", "0.5092566", "0.5085133", "0.50743866", "0.5074248", "0.5069779", "0.50685316", "0.50556976", "0.5054674", "0.5053736", "0.504956", "0.5035034" ]
0.69388103
0
DELETE /user_biographies/1 DELETE /user_biographies/1.json
def destroy @user_biography = UserBiography.find(params[:id]) @user_biography.destroy respond_to do |format| format.html { redirect_to user_biographies_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @biography.destroy\n respond_to do |format|\n format.html { redirect_to admin_biographies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bio = Bio.find(params[:id])\n @bio.destroy\n\n respond_to do |format|\n format.html { redirect_to bios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bio_url.destroy\n respond_to do |format|\n format.html { redirect_to bio_urls_url, notice: 'Bio url was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @biological_relationship.destroy\n respond_to do |format|\n format.html { redirect_to biological_relationships_url, notice: 'Biological relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bio.destroy\n respond_to do |format|\n format.html { redirect_to biography_url, notice: 'bio was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @bio = Bio.find(params[:id])\n @bio.destroy\n\n respond_to do |format|\n format.html { redirect_to(bios_url) }\n format.xml { head :ok }\n end\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n @bio = Bio.find(params[:id])\n @bio.destroy\n\n respond_to do |format|\n format.html { redirect_to bios_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n @experiment_biomechanical.destroy\n\n respond_to do |format|\n format.html { redirect_to experiment_biomechanicals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_allergy.destroy\n respond_to do |format|\n format.html { redirect_to user_allergies_url, notice: 'User allergie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @bio_signal = BioSignal.find(params[:id])\n @bio_signal.destroy\n\n respond_to do |format|\n format.html { redirect_to bio_signals_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def borrar\n @user.deleteUserFromUserStories\n @user.deleteUserFromComments\n @user.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_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 @userbarry.destroy\n respond_to do |format|\n format.html { redirect_to userbarries_url, notice: 'Userbarry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n User.cascade_delete(@user)\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @profile = @user.profile\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(@user) }\n format.json { head :no_content }\n end\n #redirect_to user_path(@user)\n end", "def remove\n @user = User.find(params[:id])\n @study.contacts.delete(@user)\n\n respond_to do |format|\n format.xml { head :ok }\n format.js\n end\n end", "def destroy\n @bijou.destroy\n respond_to do |format|\n format.html { redirect_to bijous_url, notice: 'Bijou was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def destroy\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @baby.destroy\n respond_to do |format|\n format.html { redirect_to babies_url, notice: 'Baby was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @baby.destroy\n respond_to do |format|\n format.html { redirect_to babies_url, notice: \"Baby was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_person = UserPerson.find(params[:id])\n @user_person.destroy\n\n respond_to do |format|\n format.html { redirect_to user_people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goody = Goody.find(params[:id])\n @goody.destroy\n\n respond_to do |format|\n format.html { redirect_to goodies_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 @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @guidances_user.destroy\n respond_to do |format|\n format.html { redirect_to guidances_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @baggage = Baggage.find(params[:id])\n @baggage.destroy\n\n respond_to do |format|\n format.html { redirect_to baggages_url }\n format.json { head :no_content }\n end\n end", "def remove_user\n query_api '/rest/user', nil, 'DELETE'\n end", "def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy #DESC: Eliminar hobbies\n @hobbie = Hobbie.find(params[:id])\n @hobbie.destroy\n\n respond_to do |format|\n format.html { redirect_to(hobbies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @biography_book.destroy\n respond_to do |format|\n format.html { redirect_to biography_books_url, notice: \"Biography review was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_user.destroy\n\n head :no_content\n end", "def destroy\n @specialty = Specialty.find(params[:id])\n\n\n @users = User.all\n\n @specialty.destroy\n\n respond_to do |format|\n format.html { redirect_to specialties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_bid = UserBid.find(params[:id])\n @user_bid.destroy\n\n respond_to do |format|\n format.html { redirect_to user_bids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_boice.destroy\n respond_to do |format|\n format.html { redirect_to my_boices_url, notice: 'My boice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'DELETE',\n path: path,\n headers: headers,\n params: params,\n )\n end", "def destroy\n @myuser.destroy\n\n head :no_content\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n HerosUsers.destroy_all(:user_id => @user.id)\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n format.json { head :no_content }\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to residencial_apartamento_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @boy = Boy.find(params[:id])\n @boy.destroy\n\n respond_to do |format|\n format.html { redirect_to boys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @boy = Boy.find(params[:id])\n @boy.destroy\n\n respond_to do |format|\n format.html { redirect_to boys_url }\n format.json { head :no_content }\n end\n end", "def user_management_delete_user id\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 << \"/v1/users\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"id\" => id,\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.delete query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 404\n raise APIException.new \"Not found\", 404, response.raw_body\n elsif response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "def destroy\n @bread.destroy\n respond_to do |format|\n format.html { redirect_to breads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brewhouse = Brewhouse.find(params[:id])\n @brewhouse.destroy\n\n respond_to do |format|\n format.html { redirect_to brewhouses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bunny.destroy\n respond_to do |format|\n format.html { redirect_to bunnies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @achievementuser = Achievementuser.find(params[:id])\n @achievementuser.destroy\n\n respond_to do |format|\n format.html { redirect_to achievementusers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @roadcrime = Roadcrime.find(params[:id])\n @roadcrime.destroy\n\n respond_to do |format|\n format.html { redirect_to roadcrimes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end", "def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n raise params.inspect\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user_business_profile.destroy\n respond_to do |format|\n format.html { redirect_to user_business_profiles_url, notice: 'User business profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_interest = UserInterest.find(params[:id])\n @user_interest.destroy\n \n if @user_interest.save\n render json: {\n status: 200,\n message: \"Successfully deleted user interest\",\n user_interests: @user_interest\n }.to_json\n else\n render json: {\n status: 500,\n message: \"Couldn't delete user interest.\",\n errors: @user_interest.errors\n }.to_json\n end\n end", "def delete_user\n client.delete(user)\n end", "def destroy\n @habrauser = Habrauser.find(params[:id])\n @habrauser.destroy\n\n respond_to do |format|\n format.html { redirect_to current_user }\n format.json { head :ok }\n end\n end", "def delete(user)\n Rails.logger.debug \"Call to photo.delete\"\n if !self.file.blank?\n Util.delete_image(self.file) #Delete the image file from the image server\n end\n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password'])#Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end", "def destroy\n @bottle.destroy\n respond_to do |format|\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @business = @user.businesses.find(params[:id])\n \n @business.destroy\n respond_to do |format|\n format.html { redirect_to root_path(@user), notice: 'Business was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.user.destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person.destroy\n @application_session.destroy\n session[:cos_session_id] = nil\n render_json :status => :ok\n end", "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_attribute.destroy\n respond_to do |format|\n format.html { redirect_to user_attributes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @boat = Boat.find(params[:id])\n remove_reknro_from_berth\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to boats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n logger.info(\"Delete friend_id 33333\")\n logger.info(\"Delete friend_id #{params[:user_id]}\")\n @friendship.destroy\n if request.format.json?\n render text: \"Delete\"\n else\n @friendship.destroy\n redirect_to friendships_url \n end \n end", "def destroy\n @bprofile.destroy\n respond_to do |format|\n format.html { redirect_to bprofiles_url, notice: 'Bprofile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @boite.destroy\n respond_to do |format|\n format.html { redirect_to boites_url, notice: 'Boite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_by_body\n @person = Person.find(person_delete_param[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def destroy\n @autobus.destroy\n respond_to do |format|\n format.html { redirect_to autobuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_hito.destroy\n respond_to do |format|\n format.html { redirect_to user_hitos_url, notice: 'User hito was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "def delete_by_id(user_id)\n Iterable.request(conf, \"/users/byUserId/#{user_id}\").delete\n end", "def destroy\n @burrito.destroy\n respond_to do |format|\n format.html { redirect_to burritos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @euclid_user = EuclidUser.find(params[:id])\n @euclid_user.destroy\n\n respond_to do |format|\n format.html { redirect_to euclid_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ubigeo.destroy\n respond_to do |format|\n format.html { redirect_to ubigeos_url, notice: 'Ubigeo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @county = County.find(params[:id])\n @county.destroy\n\n respond_to do |format|\n format.html { redirect_to counties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end", "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "def destroy\n @sluzby = Sluzby.find(params[:id])\n @sluzby.destroy\n\n respond_to do |format|\n format.html { redirect_to sluzbies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.address.destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'Aww.. we are sad you\\'ve left us' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_info.destroy\n respond_to do |format|\n format.html { redirect_to user_infos_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 @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_vacancy.destroy\n respond_to do |format|\n format.html { redirect_to user_vacancies_url, notice: 'Aplicación eliminada correctamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n @body_profile_nutrient = BodyProfileNutrient.find(params[:id])\n @body_profile_nutrient.destroy\n\n respond_to do |format|\n format.html { redirect_to body_profile_nutrients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_boat\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to harbour_boats_path}\n format.json { head :no_content }\n end\n end" ]
[ "0.7078497", "0.684274", "0.6570586", "0.6549361", "0.6459091", "0.6452129", "0.6434868", "0.6414489", "0.6368596", "0.63259935", "0.6324762", "0.6265212", "0.62557817", "0.62532383", "0.6248457", "0.6214569", "0.6174089", "0.61298287", "0.6116617", "0.61144644", "0.61012375", "0.60977083", "0.60922426", "0.6090916", "0.6090686", "0.6090686", "0.6087425", "0.6087045", "0.6086033", "0.60831", "0.6076785", "0.6074371", "0.6070831", "0.6068688", "0.6066345", "0.60537785", "0.60517395", "0.6046299", "0.60416305", "0.60416305", "0.60363007", "0.60295254", "0.60205466", "0.60200226", "0.60042506", "0.60040224", "0.59996116", "0.5994827", "0.59934026", "0.59902495", "0.59891105", "0.5988031", "0.5987554", "0.5985429", "0.5985429", "0.5985155", "0.5983387", "0.597781", "0.5977754", "0.5975138", "0.5972776", "0.59724754", "0.5966936", "0.5963186", "0.5962021", "0.596181", "0.59603316", "0.5959834", "0.5959502", "0.59594584", "0.59581137", "0.59531343", "0.594476", "0.594392", "0.59395474", "0.5937189", "0.5935175", "0.59324425", "0.5931839", "0.5930278", "0.59282815", "0.592754", "0.5923692", "0.5923467", "0.592113", "0.59198725", "0.5919031", "0.5916098", "0.5913731", "0.591037", "0.590938", "0.59091306", "0.59053", "0.5902412", "0.5901848", "0.5899675", "0.58945906", "0.5894496", "0.58920467", "0.58905" ]
0.7754777
0
GET /instructors GET /instructors.json
def index @instructors = Instructor.all(:order => :name) respond_to do |format| format.html # index.html.erb format.json { render :json => @instructors } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @instructors = Instructor.all\n end", "def index\n @section_instructors = SectionInstructor.all\n end", "def show\n render json: @instructor\n end", "def show\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instructor }\n end\n end", "def show\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @instructor }\n end\n end", "def instructors \n self.object.instructors.map do |instructor|\n {\n instructor_id: instructor.id,\n instructor_name: instructor.name, \n instructor_date_of_birth: instructor.date_of_birth, \n instructor_specialty: instructor.specialty, \n instructor_years_experience: instructor.years_experience,\n instructor_certification: instructor.certification\n }\n end\n end", "def index\n @course_instructors = CourseInstructor.all\n end", "def index\n @instructors = Instructor.all\n # render json: @instructors.to_json\n render json: @instructors.to_json(only: [:first_name, :last_name, :region, :photo, :email, :bio, :instagram, :experience, :user_id],\n include: [schedules: { only: [:title, :start, :end, :instructor_id, :workout_id]}])\n end", "def get_course_of_instructor\n instructor_id = params[:instructor_id]\n\n course_ids = if instructor_id.blank?\n []\n else\n Course.where(:user_id => instructor_id).map(&:id).map(&:to_s)\n end\n\n render json: {:course_ids => course_ids}\n end", "def show\n @manage_instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manage_instructor }\n end\n end", "def new\n employee_url = \"http://104.131.73.180/api/v1/employees\"\n employees = HTTParty.get(employee_url)\n\n @instructors_hash = {}\n\n employees[\"employees\"].each do |employee|\n if employee[\"role\"] == \"instructor\"\n key = employee[\"id\"]\n @instructors_hash[key] = employee\n end\n end\n\n @instructor = Instructor.new\n\n cohort_url = \"http://104.131.73.180/api/v1/cohorts\"\n cohorts = HTTParty.get(cohort_url)\n\n cohorts[\"cohorts\"].each do |cohort|\n cohort[\"instructor_ids\"].each do |instructor_id|\n @instructors_hash[instructor_id][\"cohort\"] = cohort[\"id\"]\n end\n end\n\n end", "def show\n @filial = Filial.find(params[:id])\n @instructors = @filial.instructors\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end", "def instructors\n course_enrollments.where(course_role: CourseRole.instructor).map(&:user)\n end", "def instructors\n users.not_students\n end", "def index\n if instructor_signed_in? and current_instructor.is_admin\n # Only an admin has access to this information. Ohter instructors will not get the link\n @instructor = Instructor.all\n else \n redirect_to root_path\n return\n end\n end", "def show\n @instructor = Instructor.find(params[:id])\n end", "def index\n\t@count = Instructor.all.count\n\t@page = (params[:page] || 0).to_i\n @instructors = Instructor.all.offset(PAGE_SIZE * @page).limit(PAGE_SIZE) \n end", "def show\n @instructor1 = Instructor1.find(params[:id])\n\t@instructorcourses = Instructorcourse.where(instructoremail: @instructor1.email)\n\t@s=Instructor1.find(session[:user_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instructor1 }\n end\n end", "def instructor_detail(id, options = {})\n get \"instructor_details/#{id}\", options\n end", "def new\n @instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor }\n end\n end", "def index\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n\n @students = $selected_course.students.collect{|student| {name: student.first + ' ' + student.last, student_id: student.id }}\n end", "def index\n @cohort_instructors = CohortInstructor.all\n end", "def instructor_show\n\t\t\tif (current_instructor.quizzes.exists?(:id => params[:id]))\n\t\t\t\tquiz = current_instructor.quizzes.find(params[:id])\n\t\t\t\tquestions = quiz.questions\n\t\t\t\trender json: questions, status: 200\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 404\n\t\t\tend\n\t\tend", "def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end", "def show\n @course = Course.find(params[:id])\n if signed_in?\n @students = @course.students #assigns a student to that course array which it yields\n @teachers = @course.teachers #course array which it yields teachers\n @teacher = @teachers.include?(current_user)\n @student = @students.include?(current_user)\n\n end\n @assignments = Assignment.all\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @manage_instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manage_instructor }\n end\n end", "def courses\n unless user_signed_in? && current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n $selected_course = nil\n\n @courses = current_user.instructor.courses.collect{ |course|\n {\n name: course.name,\n id: course.id\n }\n }\n\n render :template => \"home/index\"\n end", "def getInstructorList (o, offset)\n o['Result'][offset]['Instructor']\n end", "def show\n @instructor_text = InstructorText.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instructor_text }\n end\n end", "def new\n @instructor1 = Instructor1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor1 }\n end\n end", "def show\n if instructor_signed_in?\n @instructor = current_instructor\n @courses = @instructor.courses\n @isInstructor = true\n @isStudent = false\n @isAssistant = false\n else \n redirect_to root_path\n return\n end\n end", "def get_names(instructors)\n instructors.map do |instructor|\n instructor[:name]\n end\nend", "def index\n @instructors = User.where(user_type: \"\") # be careful about singular and plural\n @admin = User.where(user_type: \"admin\")\nend", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def index\n #instructor_id =session[:id]\n #@courses = Course.where([\"instructor_id = ?\", instructor_id])\n @courses = Course.all\n end", "def new\n @instructor = Instructor.new\n @aircraft_types = AircraftType.by_name.collect{|at| [at.name, at.id]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @instructor }\n end\n end", "def index\n @instructor_apps = InstructorApp.all\n end", "def set_instructor\n @instructor = User.find(params[:name])\n end", "def instructor_index\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\trender json: quizzes.as_json(:only => [:id, :name, :created_at, :no_of_MCQ, :no_of_rearrangeQ]), status: 200\n\t\tend", "def index\n if(Admin.new.type== current_user.type)\n @instructors = Instructor.all\n else\n flash[:danger] = \"You are not authorized to view this page!\"\n redirect_to user_path(current_user.id)\n end\n end", "def show\n render json: {teacher: @course.teacher, course: @course, categories: @course.categories, training_sessions: @course.training_sessions}\n end", "def create\n @instructor = Instructor.new(trainer_params)\n if @instructor.save\n render json: @instructor\n else\n render json: @instructor.errors\n end\n end", "def instructor_list\n #NEED TO ADD CURRENT USER\n @courses = Course.where(:instructor_id=>current_user.id).paginate(:per_page=>10, :page=>params[:page])\n @course_category_id = \"\"\n @instructor_section = true\n @page_title = 'Courses for <span style=\"font-size:14px\">for ' + current_user.name + '</span>'\n\n render :action=>\"/courses/index\"\n end", "def index\n authorize! :read, Course\n\n if is_student?\n @course_sections = Course.find_student_courses(current_user.id)\n else\n @course_sections = Course.find_professor_courses(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "def index\n @instructor_texts = InstructorText.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instructor_texts }\n end\n end", "def destroy\n @instructor = Instructor.find(params[:id])\n @instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to instructors_url }\n format.json { head :ok }\n end\n end", "def index\n \n if can? :update, @course #instructor \n @courses = current_user.subjects #Course.where(:user_id => current_user.id) #courses that person teaches\n else\n @courses = current_user.courses \n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "def show\n @instructors = InstructorApp.where(instance_id: @instance.id) || []\n @instructor1 = @instructors.first\n if @instructors.first != @instructors.last\n @instructor2 = @instructors.last\n end\n \n end", "def set_instructor\n\t\t\t@instructor = Instructor.find(params[:id])\n\t\tend", "def show\n @user = current_user #User.find(params[:id])\n @taking_courses = @user.takes\n @offering_courses = Array.new\n \n Authour.where(:user_id => @user.id).each do |authour|\n @offering_courses << Course.find(authour.course_id)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mypage }\n end\n end", "def set_section_instructor\n @section_instructor = SectionInstructor.find(params[:id])\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 show\n @enrollment = Enrollment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enrollment }\n end\n end", "def instructor #want to return the instructor id and name from the users table\n # return Users.Section.where(:users.id => :section.id)\n return User.find(self.user_id)\n end", "def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end", "def show\n render json: course\n end", "def get_instructor_names(instructors)\n instructors.map do |instructor|\n instructor[:name]\n end.uniq\nend", "def identities\n render json: current_user.identities\n end", "def after_sign_in_path_for(resource)\n instructors_path\n end", "def index\n if params[:story_id].present?\n @invitations = Story.find(params[:story_id]).invitations\n else\n @invitations = Invitation.find_by_email(@current_user.email)\n end\n render json: @invitations\n end", "def index\n @tutor = Tutor.all\n\n render json: @tutor, status: :ok\n end", "def show\n @course = Course.find(params[:id])\n @enrollments = Enrollment.where(\"course_id = ?\", params[:id].to_s)\n end", "def create\n @instructor = Instructor.new(params[:instructor])\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render json: @instructor, status: :created, location: @instructor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do |format|\n format.json { render json: @courses }\n end\n end", "def student_show\n @course = Course.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n \n end", "def index\n puts render json: @user.students, each_serializer: UserSerializer\n end", "def index\n\t\t@courses = @teacher.courses\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @courses }\n end\n end", "def physicians\n physicians = User.physicians\n render json: { status: 200, data: physicians }\n end", "def add_instructor(instructor)\n @instructors << instructor\n end", "def show\n render json: @course\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 @instructor = Instructor.find(params[:id])\n @showCohort = Cohort.where('instructor_id = ?', params[:id]) \nend", "def show\n @enroll = Enroll.find(params[:id])\n render json: JSON.parse(@enroll.to_json)\n end", "def set_course_instructor\n @course_instructor = CourseInstructor.find(params[:id])\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n authorize @institute\n @admins = User.where(role:3,institute_id: @institute.id)\n @students = User.where(role:1,institute_id: @institute.id)\n end", "def create_instructor\n instructor = params[\"instructor\"]\n\n if instructor.blank?\n render json: {message: \"Chưa truyền dữ liệu!\"}, status: :unprocessable_entity\n return\n end\n\n instructor = JSON.parse(instructor)\n\n user = User.new(\n name: instructor['name']\n )\n\n email = instructor['email'].blank? ? Utils.nomalize_string(instructor['name']).to_s + \"@tudemy.vn\" : instructor['email']\n user.email = email\n user.password = \"12345678\"\n\n instructor_profile = User::InstructorProfile.new()\n instructor_profile.academic_rank = instructor['instructor_profile']['academic_rank'] unless instructor['instructor_profile']['academic_rank'].blank?\n instructor_profile.major = instructor['instructor_profile']['major'] unless instructor['instructor_profile']['major'].blank?\n instructor_profile.function = instructor['instructor_profile']['function'] unless instructor['instructor_profile']['function'].blank?\n instructor_profile.work_unit = instructor['instructor_profile']['work_unit'] unless instructor['instructor_profile']['work_unit'].blank?\n instructor_profile.description = instructor['instructor_profile']['description'] unless instructor['instructor_profile']['description'].blank?\n \n user.instructor_profile = instructor_profile\n\n if user.save\n render json: {message: \"Success\"}\n return\n else\n render json: {message: \"Lỗi không lưu được data\"}, status: :unprocessable_entity\n return\n end\n \n end", "def create_instructor\n instructor = params[\"instructor\"]\n\n if instructor.blank?\n render json: {message: \"Chưa truyền dữ liệu!\"}, status: :unprocessable_entity\n return\n end\n\n instructor = JSON.parse(instructor)\n\n user = User.new(\n name: instructor['name']\n )\n\n email = instructor['email'].blank? ? Utils.nomalize_string(instructor['name']).to_s + \"@tudemy.vn\" : instructor['email']\n user.email = email\n user.password = \"12345678\"\n\n instructor_profile = User::InstructorProfile.new()\n instructor_profile.academic_rank = instructor['instructor_profile']['academic_rank'] unless instructor['instructor_profile']['academic_rank'].blank?\n instructor_profile.major = instructor['instructor_profile']['major'] unless instructor['instructor_profile']['major'].blank?\n instructor_profile.function = instructor['instructor_profile']['function'] unless instructor['instructor_profile']['function'].blank?\n instructor_profile.work_unit = instructor['instructor_profile']['work_unit'] unless instructor['instructor_profile']['work_unit'].blank?\n instructor_profile.description = instructor['instructor_profile']['description'] unless instructor['instructor_profile']['description'].blank?\n\n user.instructor_profile = instructor_profile\n\n if user.save\n render json: {message: \"Success\"}\n return\n else\n render json: {message: \"Lỗi không lưu được data\"}, status: :unprocessable_entity\n return\n end\n end", "def index\n @students = Student.all\n render json: @students\n end", "def index\n # puts \"params[:course][:id] is: #{params[:course][:id]}\"\n # @course = Course.find_by_id(params[:course][:id])\n# @students = @course.students\n end", "def new\n @instructor = Instructor.new\n end", "def new\n @instructor = Instructor.new\n end", "def show\n @enroll = Enroll.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enroll }\n end\n end", "def destroy\n @manage_instructor = Instructor.find(params[:id])\n @manage_instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_instructors_url }\n format.json { head :ok }\n end\n end", "def new\n @instructor_text = InstructorText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor_text }\n end\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end", "def show\n\t\t@all_locations = Location.where(:faculty => params[:id])\n\t\trender :json => @all_locations\n\tend", "def index\n @courses = Course.all\n render json: @courses, status: :ok\n end", "def show\n json_response(@faculty)\n end", "def available_collaborators\n input = available_collaborators_input\n return unauthorized unless available_collaborators_auth(input)\n student_id = current_visitor.portal_student.id\n clazz = Portal::Offering.find(input[:offering_id]).clazz\n collaborators = clazz.students.select { |s| s.id != student_id }.map { |s| {:id => s.id, :name => s.name} }\n render json: collaborators\n end" ]
[ "0.7474448", "0.72173893", "0.7175054", "0.70918465", "0.70283026", "0.6961625", "0.69567657", "0.69409734", "0.69235194", "0.69104546", "0.68709964", "0.684239", "0.68309546", "0.67133147", "0.67078835", "0.66748357", "0.6630658", "0.6601479", "0.65697086", "0.65195835", "0.64981234", "0.64697987", "0.64668053", "0.6422134", "0.63287044", "0.6314536", "0.6238924", "0.6168158", "0.61596435", "0.6157661", "0.61229277", "0.60844564", "0.60515964", "0.60511136", "0.60511136", "0.60511136", "0.60511136", "0.60511136", "0.60511136", "0.60511136", "0.60511136", "0.60371", "0.6022521", "0.60200214", "0.59674984", "0.5960205", "0.59353614", "0.5934183", "0.59224355", "0.5919824", "0.5918689", "0.5883644", "0.586924", "0.5829531", "0.58160466", "0.5812133", "0.5806117", "0.5791704", "0.5790387", "0.5790079", "0.5789274", "0.57821894", "0.57792825", "0.5778451", "0.57766193", "0.57688963", "0.57646745", "0.57639086", "0.57586724", "0.57575756", "0.57566965", "0.5747709", "0.57433593", "0.57299143", "0.57200515", "0.57141346", "0.5700541", "0.5699872", "0.56992275", "0.5694247", "0.56861025", "0.56842816", "0.56842816", "0.56842816", "0.5680304", "0.5679415", "0.56772524", "0.5674711", "0.5668957", "0.56648403", "0.56648403", "0.5660705", "0.5656264", "0.5652628", "0.56515616", "0.56515616", "0.5645133", "0.56412226", "0.5638679", "0.563787" ]
0.7403752
1
GET /instructors/1 GET /instructors/1.json
def show @instructor = Instructor.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @instructor } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instructor }\n end\n end", "def index\n @instructors = Instructor.all(:order => :name)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @instructors }\n end\n end", "def show\n render json: @instructor\n end", "def show\n @manage_instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manage_instructor }\n end\n end", "def index\n @instructors = Instructor.all\n end", "def show\n @filial = Filial.find(params[:id])\n @instructors = @filial.instructors\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end", "def show\n @instructor1 = Instructor1.find(params[:id])\n\t@instructorcourses = Instructorcourse.where(instructoremail: @instructor1.email)\n\t@s=Instructor1.find(session[:user_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instructor1 }\n end\n end", "def new\n employee_url = \"http://104.131.73.180/api/v1/employees\"\n employees = HTTParty.get(employee_url)\n\n @instructors_hash = {}\n\n employees[\"employees\"].each do |employee|\n if employee[\"role\"] == \"instructor\"\n key = employee[\"id\"]\n @instructors_hash[key] = employee\n end\n end\n\n @instructor = Instructor.new\n\n cohort_url = \"http://104.131.73.180/api/v1/cohorts\"\n cohorts = HTTParty.get(cohort_url)\n\n cohorts[\"cohorts\"].each do |cohort|\n cohort[\"instructor_ids\"].each do |instructor_id|\n @instructors_hash[instructor_id][\"cohort\"] = cohort[\"id\"]\n end\n end\n\n end", "def index\n @section_instructors = SectionInstructor.all\n end", "def index\n @instructors = Instructor.all\n # render json: @instructors.to_json\n render json: @instructors.to_json(only: [:first_name, :last_name, :region, :photo, :email, :bio, :instagram, :experience, :user_id],\n include: [schedules: { only: [:title, :start, :end, :instructor_id, :workout_id]}])\n end", "def show\n @instructor = Instructor.find(params[:id])\n end", "def get_course_of_instructor\n instructor_id = params[:instructor_id]\n\n course_ids = if instructor_id.blank?\n []\n else\n Course.where(:user_id => instructor_id).map(&:id).map(&:to_s)\n end\n\n render json: {:course_ids => course_ids}\n end", "def new\n @instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor }\n end\n end", "def new\n @instructor1 = Instructor1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor1 }\n end\n end", "def index\n @course_instructors = CourseInstructor.all\n end", "def new\n @manage_instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manage_instructor }\n end\n end", "def instructor_detail(id, options = {})\n get \"instructor_details/#{id}\", options\n end", "def instructors \n self.object.instructors.map do |instructor|\n {\n instructor_id: instructor.id,\n instructor_name: instructor.name, \n instructor_date_of_birth: instructor.date_of_birth, \n instructor_specialty: instructor.specialty, \n instructor_years_experience: instructor.years_experience,\n instructor_certification: instructor.certification\n }\n end\n end", "def index\n\t@count = Instructor.all.count\n\t@page = (params[:page] || 0).to_i\n @instructors = Instructor.all.offset(PAGE_SIZE * @page).limit(PAGE_SIZE) \n end", "def show\n @instructor_text = InstructorText.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instructor_text }\n end\n end", "def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end", "def index\n @cohort_instructors = CohortInstructor.all\n end", "def instructor_show\n\t\t\tif (current_instructor.quizzes.exists?(:id => params[:id]))\n\t\t\t\tquiz = current_instructor.quizzes.find(params[:id])\n\t\t\t\tquestions = quiz.questions\n\t\t\t\trender json: questions, status: 200\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 404\n\t\t\tend\n\t\tend", "def index\n if instructor_signed_in? and current_instructor.is_admin\n # Only an admin has access to this information. Ohter instructors will not get the link\n @instructor = Instructor.all\n else \n redirect_to root_path\n return\n end\n end", "def new\n @instructor = Instructor.new\n @aircraft_types = AircraftType.by_name.collect{|at| [at.name, at.id]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @instructor }\n end\n end", "def index\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n\n @students = $selected_course.students.collect{|student| {name: student.first + ' ' + student.last, student_id: student.id }}\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end", "def show\n @enrollment = Enrollment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enrollment }\n end\n end", "def show\n @course = Course.find(params[:id])\n if signed_in?\n @students = @course.students #assigns a student to that course array which it yields\n @teachers = @course.teachers #course array which it yields teachers\n @teacher = @teachers.include?(current_user)\n @student = @students.include?(current_user)\n\n end\n @assignments = Assignment.all\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end", "def instructors\n users.not_students\n end", "def instructors\n course_enrollments.where(course_role: CourseRole.instructor).map(&:user)\n end", "def getInstructorList (o, offset)\n o['Result'][offset]['Instructor']\n end", "def show\n @inschool = Inschool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inschool }\n end\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def show\n @institute_admin = InstituteAdmin.includes(:profile).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institute_admin }\n end\n end", "def student_show\n @course = Course.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n \n end", "def show\n json_response(@faculty)\n end", "def show\n @instructors = InstructorApp.where(instance_id: @instance.id) || []\n @instructor1 = @instructors.first\n if @instructors.first != @instructors.last\n @instructor2 = @instructors.last\n end\n \n end", "def index\n @instructor_texts = InstructorText.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instructor_texts }\n end\n end", "def show\n render json: {teacher: @course.teacher, course: @course, categories: @course.categories, training_sessions: @course.training_sessions}\n end", "def show\n render json: course\n end", "def show\n @instructor = Instructor.find(params[:id])\n @showCohort = Cohort.where('instructor_id = ?', params[:id]) \nend", "def index\n #instructor_id =session[:id]\n #@courses = Course.where([\"instructor_id = ?\", instructor_id])\n @courses = Course.all\n end", "def show\n @college = College.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @college }\n end\n end", "def set_instructor\n @instructor = User.find(params[:name])\n end", "def show\n @university_profile = UniversityProfile.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university_profile }\n end\n end", "def new\n @instructor_text = InstructorText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor_text }\n end\n end", "def show\n @enroll = Enroll.find(params[:id])\n render json: JSON.parse(@enroll.to_json)\n end", "def show\n @anniversary = Anniversary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @anniversary }\n end\n end", "def show\n @enroll = Enroll.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enroll }\n end\n end", "def show\n render json: @faculty\n end", "def show\n @course = Course.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "def show\n render json: @course\n end", "def destroy\n @instructor = Instructor.find(params[:id])\n @instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to instructors_url }\n format.json { head :ok }\n end\n end", "def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end", "def show\n render status: 200, json: Training.find(params[:id])\n end", "def create\n @instructor = Instructor.new(trainer_params)\n if @instructor.save\n render json: @instructor\n else\n render json: @instructor.errors\n end\n end", "def instructor_index\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\trender json: quizzes.as_json(:only => [:id, :name, :created_at, :no_of_MCQ, :no_of_rearrangeQ]), status: 200\n\t\tend", "def show\n\t\t@all_locations = Location.where(:faculty => params[:id])\n\t\trender :json => @all_locations\n\tend", "def show\n @tutor = Tutor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutor }\n end\n end", "def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end", "def index\n @instructor_apps = InstructorApp.all\n end", "def index\n # puts \"params[:course][:id] is: #{params[:course][:id]}\"\n # @course = Course.find_by_id(params[:course][:id])\n# @students = @course.students\n end", "def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end", "def show\n @assessment_course = AssessmentCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment_course }\n end\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: @course, status: :found\n end", "def show\n @analyst = Analyst.find(params[:id])\n\n render json: @analyst\n end", "def new\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end", "def show\n @enrolled_student = EnrolledStudent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enrolled_student }\n end\n end", "def index\n @students = Student.all\n render json: @students\n end", "def show\n @student = User.find params[:id]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student }\n end\n end", "def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do |format|\n format.json { render json: @courses }\n end\n end", "def show\n if instructor_signed_in?\n @instructor = current_instructor\n @courses = @instructor.courses\n @isInstructor = true\n @isStudent = false\n @isAssistant = false\n else \n redirect_to root_path\n return\n end\n end", "def index\n @tutor = Tutor.all\n\n render json: @tutor, status: :ok\n end", "def show\n @alumni = Alumni.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alumni }\n end\n end", "def show\n render json: @student\n end", "def show\n @court = Court.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end", "def show\n @collaborator = Collaborator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collaborator }\n end\n end", "def index\n puts render json: @user.students, each_serializer: UserSerializer\n end", "def create\n @instructor = Instructor.new(params[:instructor])\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render json: @instructor, status: :created, location: @instructor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\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 show\n @course = Course.find(params[:id])\n @enrollments = Enrollment.where(\"course_id = ?\", params[:id].to_s)\n end", "def show\n student = Student.find(params[:id])\n render json: student\nend", "def index\n @instructors = User.where(user_type: \"\") # be careful about singular and plural\n @admin = User.where(user_type: \"admin\")\nend", "def set_instructor\n\t\t\t@instructor = Instructor.find(params[:id])\n\t\tend", "def instructor #want to return the instructor id and name from the users table\n # return Users.Section.where(:users.id => :section.id)\n return User.find(self.user_id)\n end", "def index\n authorize! :read, Course\n\n if is_student?\n @course_sections = Course.find_student_courses(current_user.id)\n else\n @course_sections = Course.find_professor_courses(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "def show\n @user = current_user #User.find(params[:id])\n @taking_courses = @user.takes\n @offering_courses = Array.new\n \n Authour.where(:user_id => @user.id).each do |authour|\n @offering_courses << Course.find(authour.course_id)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mypage }\n end\n end", "def show\n @curriculum_assessment = current_user.curriculumAssessments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curriculum_assessment }\n end\n end", "def new\n @instructor = Instructor.new\n end", "def new\n @instructor = Instructor.new\n end" ]
[ "0.7551621", "0.75332004", "0.745846", "0.7375946", "0.73743033", "0.71484536", "0.7090503", "0.7067631", "0.70597637", "0.7032259", "0.70185703", "0.6976074", "0.69606", "0.6956809", "0.6795209", "0.6745011", "0.6743703", "0.6740313", "0.66673917", "0.6654393", "0.662805", "0.64813215", "0.6463704", "0.6455748", "0.6448463", "0.63847965", "0.6336237", "0.6336237", "0.63185865", "0.6287754", "0.62478983", "0.62430614", "0.6218135", "0.6197462", "0.61721665", "0.61721665", "0.61721665", "0.61721665", "0.61721665", "0.61721665", "0.61721665", "0.61721665", "0.61677", "0.616436", "0.61556584", "0.6152321", "0.6150933", "0.6149383", "0.6144072", "0.6135492", "0.6128854", "0.61266184", "0.6120219", "0.61087304", "0.610497", "0.610369", "0.6091361", "0.60878307", "0.6086368", "0.60795355", "0.60536915", "0.60531145", "0.60456485", "0.6034075", "0.60238004", "0.60173947", "0.6015438", "0.60073614", "0.60024375", "0.6000797", "0.59965056", "0.59938043", "0.59915215", "0.59818506", "0.5979453", "0.59768957", "0.59749216", "0.59688795", "0.59658784", "0.5961942", "0.59492356", "0.5946146", "0.59400237", "0.5939613", "0.59359026", "0.5934791", "0.59341973", "0.59338725", "0.5930286", "0.59266126", "0.5926066", "0.5924401", "0.592187", "0.59193516", "0.59181625", "0.59162384", "0.59077346", "0.5907292", "0.5905319", "0.5905319" ]
0.7491764
2
GET /instructors/new GET /instructors/new.json
def new @instructor = Instructor.new @aircraft_types = AircraftType.by_name.collect{|at| [at.name, at.id]} respond_to do |format| format.html # new.html.erb format.json { render :json => @instructor } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor }\n end\n end", "def new\n @manage_instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manage_instructor }\n end\n end", "def new\n @instructor1 = Instructor1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor1 }\n end\n end", "def new\n employee_url = \"http://104.131.73.180/api/v1/employees\"\n employees = HTTParty.get(employee_url)\n\n @instructors_hash = {}\n\n employees[\"employees\"].each do |employee|\n if employee[\"role\"] == \"instructor\"\n key = employee[\"id\"]\n @instructors_hash[key] = employee\n end\n end\n\n @instructor = Instructor.new\n\n cohort_url = \"http://104.131.73.180/api/v1/cohorts\"\n cohorts = HTTParty.get(cohort_url)\n\n cohorts[\"cohorts\"].each do |cohort|\n cohort[\"instructor_ids\"].each do |instructor_id|\n @instructors_hash[instructor_id][\"cohort\"] = cohort[\"id\"]\n end\n end\n\n end", "def new\n @instructor = Instructor.new\n end", "def new\n @instructor = Instructor.new\n end", "def create\n @instructor = Instructor.new(params[:instructor])\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render json: @instructor, status: :created, location: @instructor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @instructor_text = InstructorText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor_text }\n end\n end", "def new\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enrollment }\n end\n end", "def new\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enrollment }\n end\n end", "def new\n @course = Course.find(params[:course_id])\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enrollment }\n end\n end", "def create\n @manage_instructor = Instructor.new(params[:manage_instructor])\n\n respond_to do |format|\n if @manage_instructor.save\n format.html { redirect_to @manage_instructor, notice: 'Instructor was successfully created.' }\n format.json { render json: @manage_instructor, status: :created, location: @manage_instructor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manage_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @inschool = Inschool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(trainer_params)\n if @instructor.save\n render json: @instructor\n else\n render json: @instructor.errors\n end\n end", "def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @county }\n end\n end", "def new\n @court = Court.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @court }\n end\n end", "def new\n @university = University.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @university }\n end\n end", "def new\n @university = University.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @university }\n end\n end", "def new\n @anniversary = Anniversary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @anniversary }\n end\n end", "def new\n @instructor = User.new\n # Add proper data to this\nend", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @inning = Inning.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inning }\n end\n end", "def new\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html\n format.json { render json: @course }\n end\n end", "def new\n @course = Course.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end", "def new\n @course = Course.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def create\n @instructor = Instructor.new(params[:instructor])\n render :action => :new unless @instructor.save\n end", "def new\n @assessment_course = AssessmentCourse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assessment_course }\n end\n end", "def new\n @course = Course.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end", "def new\n if params[:instructor_id]\n @instructors = User.find_all_by_id(params[:instructor_id])\n else\n @instructors = User.find_all_by_type(\"Instructor\");\n end\n\n @timeslots = Array.new\n @end_timeslots = Array.new\n t=Time.parse(\"8:00\")\n while (t.hour < 20 || (t.hour==20 && t.min==0) )\n @timeslots.push(t.strftime(\"%H:%M\"))\n t=t+(30*60)\n end\n @days = Array.new\n t=Time.parse(\"Nov 1,2010\")\n 7.times do\n @days.push({'name'=>t.strftime(\"%A\") , 'id'=>t.wday})\n t=t+(24*60*60)\n end\n\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @course }\n end\n end", "def new\n @alumni = Alumni.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alumni }\n end\n end", "def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=> @course }\n end\n end", "def new\r\n @course = Course.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @course}\r\n end\r\n end", "def new\n @course_request = CourseRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course_request }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n client = authorize\n client.materialize(\"Course__c\")\n \n @Course = Course__c.new\n @Course.OwnerId = '005E0000001T9Nv'\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @Course }\n end\n end", "def new\n @court = Court.new\n\n respond_to do |format|\n format.html { render \"new\", :layout=>false}\n format.json { render json: @court }\n end\n end", "def create\n @course_instructor = CourseInstructor.new(course_instructor_params)\n\n respond_to do |format|\n if @course_instructor.save\n format.html { redirect_to @course_instructor, notice: 'Course instructor was successfully created.' }\n format.json { render :show, status: :created, location: @course_instructor }\n else\n format.html { render :new }\n format.json { render json: @course_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @course_staff = CourseStaff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course_staff }\n end\n end", "def new\n @course = Course.new\n authorize! :create, @course\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "def new\n @tutor_location = TutorLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutor_location }\n end\n end", "def new\n if !current_user.instructor?(@course)\n return\n end\n\n @assignment = Assignment.new\n @assignment.name = \"New Assignment\"\n @assignment.reviews_required = 4\n\n if @course.get_students.length <= 4\n @assignment.reviews_required = @course.get_students.length - 1\n end\n\n if @assignment.reviews_required <= 0\n @assignment.reviews_required = 0\n end\n\n @assignment.manual_assignment = true\n @assignment.draft = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "def new\n @nurse = Nurse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nurse }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course_role }\n end\n end", "def new\n # @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @course =Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end", "def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end", "def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end", "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 @course_professor = CourseProfessor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course_professor }\n end\n end", "def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end", "def new\n @online_student = OnlineStudent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @student }\n end\n end", "def new\n @collaborator = Collaborator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collaborator }\n end\n end", "def create\n @instructor = Instructor.new(params[:instructor])\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, :notice => 'Instructor was successfully created.' }\n format.json { render :json => @instructor, :status => :created, :location => @instructor }\n else\n @aircraft_types = AircraftType.by_name.collect{|at| [at.name, at.id]}\n\n format.html { render :action => \"new\" }\n format.json { render :json => @instructor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @notebook = Notebook.new\n render json: @notebook\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 @training = Training.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training }\n end\n end", "def new\n @organism = Organism.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organism }\n end\n end", "def new\n @courtstation = Courtstation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @courtstation }\n end\n end", "def new\n @enrolled_student = EnrolledStudent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enrolled_student }\n end\n end", "def new\n\t\t@tutorial = Tutorial.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render :json => @tutorial }\n\t\tend\n\tend", "def new\n @assignment = Assignment.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "def new\n @assignment = Assignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "def new\n @assignment = Assignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "def new\n @course = Course.new\n 1.times { @course.lessons.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end", "def new\n @clinician = Clinician.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clinician }\n end\n end", "def new\n @enrolled = Enrolled.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled }\n end\n end", "def new\n @entrant = Entrant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entrant }\n end\n end", "def new\n @entrant = Entrant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entrant }\n end\n end", "def new\n @study_course = StudyCourse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @study_course }\n end\n end", "def new\n @ident = Ident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ident }\n end\n end", "def new\n @course_category = CourseCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course_category }\n end\n end", "def new\n @classroom = classroom.new\n\n render json: @classroom\n end", "def new\n @user = User.new\n render :json => @user\n end", "def new\n @teacher = Teacher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teacher }\n end\n end", "def new\n @teacher = Teacher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teacher }\n end\n end" ]
[ "0.79211736", "0.7722816", "0.7513944", "0.7511639", "0.7312013", "0.7312013", "0.71173847", "0.7111925", "0.70473874", "0.70473874", "0.7037403", "0.70316744", "0.695933", "0.68866456", "0.68866456", "0.68866456", "0.68828076", "0.68552125", "0.68540186", "0.6851731", "0.6851731", "0.6817314", "0.6805981", "0.67955744", "0.67955744", "0.67955744", "0.67955744", "0.67955744", "0.67955744", "0.67955744", "0.67955744", "0.67955744", "0.67955744", "0.6779199", "0.6771354", "0.677115", "0.6765672", "0.67564136", "0.67413217", "0.6735471", "0.6721826", "0.66962904", "0.66949195", "0.66922724", "0.6688338", "0.66767347", "0.66744244", "0.66744244", "0.66744244", "0.66744244", "0.66744244", "0.66744244", "0.66744244", "0.66744244", "0.66744244", "0.66744244", "0.66744244", "0.6667291", "0.66644984", "0.6660404", "0.66600055", "0.6647175", "0.66393894", "0.6631591", "0.66222477", "0.66183984", "0.66178143", "0.6612823", "0.65991265", "0.65991265", "0.6581653", "0.6575749", "0.6575713", "0.65718037", "0.65694803", "0.65694803", "0.6567938", "0.6563277", "0.6557489", "0.6552384", "0.6552317", "0.6551745", "0.6551683", "0.65502286", "0.65491563", "0.65465754", "0.6543389", "0.6543389", "0.6541269", "0.6540852", "0.65332186", "0.6529294", "0.6529294", "0.6528729", "0.65249723", "0.6507651", "0.6505092", "0.650011", "0.6499954", "0.6499954" ]
0.6792313
33
POST /instructors POST /instructors.json
def create @instructor = Instructor.new(params[:instructor]) respond_to do |format| if @instructor.save format.html { redirect_to @instructor, :notice => 'Instructor was successfully created.' } format.json { render :json => @instructor, :status => :created, :location => @instructor } else @aircraft_types = AircraftType.by_name.collect{|at| [at.name, at.id]} format.html { render :action => "new" } format.json { render :json => @instructor.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @instructor = Instructor.new(trainer_params)\n if @instructor.save\n render json: @instructor\n else\n render json: @instructor.errors\n end\n end", "def create\n @instructor = Instructor.new(params[:instructor])\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render json: @instructor, status: :created, location: @instructor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @manage_instructor = Instructor.new(params[:manage_instructor])\n\n respond_to do |format|\n if @manage_instructor.save\n format.html { redirect_to @manage_instructor, notice: 'Instructor was successfully created.' }\n format.json { render json: @manage_instructor, status: :created, location: @manage_instructor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manage_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_instructor\n instructor = params[\"instructor\"]\n\n if instructor.blank?\n render json: {message: \"Chưa truyền dữ liệu!\"}, status: :unprocessable_entity\n return\n end\n\n instructor = JSON.parse(instructor)\n\n user = User.new(\n name: instructor['name']\n )\n\n email = instructor['email'].blank? ? Utils.nomalize_string(instructor['name']).to_s + \"@tudemy.vn\" : instructor['email']\n user.email = email\n user.password = \"12345678\"\n\n instructor_profile = User::InstructorProfile.new()\n instructor_profile.academic_rank = instructor['instructor_profile']['academic_rank'] unless instructor['instructor_profile']['academic_rank'].blank?\n instructor_profile.major = instructor['instructor_profile']['major'] unless instructor['instructor_profile']['major'].blank?\n instructor_profile.function = instructor['instructor_profile']['function'] unless instructor['instructor_profile']['function'].blank?\n instructor_profile.work_unit = instructor['instructor_profile']['work_unit'] unless instructor['instructor_profile']['work_unit'].blank?\n instructor_profile.description = instructor['instructor_profile']['description'] unless instructor['instructor_profile']['description'].blank?\n \n user.instructor_profile = instructor_profile\n\n if user.save\n render json: {message: \"Success\"}\n return\n else\n render json: {message: \"Lỗi không lưu được data\"}, status: :unprocessable_entity\n return\n end\n \n end", "def new\n employee_url = \"http://104.131.73.180/api/v1/employees\"\n employees = HTTParty.get(employee_url)\n\n @instructors_hash = {}\n\n employees[\"employees\"].each do |employee|\n if employee[\"role\"] == \"instructor\"\n key = employee[\"id\"]\n @instructors_hash[key] = employee\n end\n end\n\n @instructor = Instructor.new\n\n cohort_url = \"http://104.131.73.180/api/v1/cohorts\"\n cohorts = HTTParty.get(cohort_url)\n\n cohorts[\"cohorts\"].each do |cohort|\n cohort[\"instructor_ids\"].each do |instructor_id|\n @instructors_hash[instructor_id][\"cohort\"] = cohort[\"id\"]\n end\n end\n\n end", "def create_instructor\n instructor = params[\"instructor\"]\n\n if instructor.blank?\n render json: {message: \"Chưa truyền dữ liệu!\"}, status: :unprocessable_entity\n return\n end\n\n instructor = JSON.parse(instructor)\n\n user = User.new(\n name: instructor['name']\n )\n\n email = instructor['email'].blank? ? Utils.nomalize_string(instructor['name']).to_s + \"@tudemy.vn\" : instructor['email']\n user.email = email\n user.password = \"12345678\"\n\n instructor_profile = User::InstructorProfile.new()\n instructor_profile.academic_rank = instructor['instructor_profile']['academic_rank'] unless instructor['instructor_profile']['academic_rank'].blank?\n instructor_profile.major = instructor['instructor_profile']['major'] unless instructor['instructor_profile']['major'].blank?\n instructor_profile.function = instructor['instructor_profile']['function'] unless instructor['instructor_profile']['function'].blank?\n instructor_profile.work_unit = instructor['instructor_profile']['work_unit'] unless instructor['instructor_profile']['work_unit'].blank?\n instructor_profile.description = instructor['instructor_profile']['description'] unless instructor['instructor_profile']['description'].blank?\n\n user.instructor_profile = instructor_profile\n\n if user.save\n render json: {message: \"Success\"}\n return\n else\n render json: {message: \"Lỗi không lưu được data\"}, status: :unprocessable_entity\n return\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n @instructor.deleteable = true\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to admin_path(current_user), notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: admin_path(current_user) }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n # create team\n team = Team.create(name: params[:team_name], course: $selected_course)\n\n # add students to teams\n student_ids = params[:student_ids]\n student_ids.each do |student_id|\n StudentTeam.create(student_id: student_id, team: team)\n end\n\n render json: { success: true }\n end", "def create\n @section_instructor = SectionInstructor.new(section_instructor_params)\n\n respond_to do |format|\n if @section_instructor.save\n format.html { redirect_to @section_instructor, notice: 'Section instructor was successfully created.' }\n format.json { render :show, status: :created, location: @section_instructor }\n else\n format.html { render :new }\n format.json { render json: @section_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @course_instructor = CourseInstructor.new(course_instructor_params)\n\n respond_to do |format|\n if @course_instructor.save\n format.html { redirect_to @course_instructor, notice: 'Course instructor was successfully created.' }\n format.json { render :show, status: :created, location: @course_instructor }\n else\n format.html { render :new }\n format.json { render json: @course_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor }\n end\n end", "def create\n @enrollment = Enrollment.new(instructor: true)\n @course = Course.new(course_params)\n @course.enrollments << @enrollment\n current_user.enrollments << @enrollment\n\n respond_to do |format|\n if @enrollment.save and @course.save and current_user.save\n format.html { redirect_to root_url, notice: 'Course was successfully created.' }\n format.json { render action: 'show', status: :created, location: @course }\n else\n format.html { render action: 'new' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor1 = Instructor1.new(params[:instructor1])\n\n respond_to do |format|\n if @instructor1.save\n format.html { redirect_to '/home', notice: 'Instructor account was successfully created. now login!' }\n # format.json { render json: @instructor1, status: :created, location: @instructor1 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instructor1.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @manage_instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manage_instructor }\n end\n end", "def create\n @instructor = Instructor.new(params[:instructor])\n render :action => :new unless @instructor.save\n end", "def index\n @instructors = Instructor.all\n end", "def add_instructor(instructor)\n @instructors << instructor\n end", "def create\n if params[:id]\n begin\n check_admin\n course = Course.find(params[:course_id])\n teacher = User.find(params[:id])\n course.teachers << teacher\n if course.save\n json_successful\n else\n json_failed\n end\n rescue ActiveRecord::RecordNotFound\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n else\n json_failed(REASON_NOT_IMPLEMENTED)\n end\n end", "def new\n @instructor1 = Instructor1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor1 }\n end\n end", "def new\n @instructor = Instructor.new\n end", "def new\n @instructor = Instructor.new\n end", "def new\n @instructor = User.new\n # Add proper data to this\nend", "def instructors \n self.object.instructors.map do |instructor|\n {\n instructor_id: instructor.id,\n instructor_name: instructor.name, \n instructor_date_of_birth: instructor.date_of_birth, \n instructor_specialty: instructor.specialty, \n instructor_years_experience: instructor.years_experience,\n instructor_certification: instructor.certification\n }\n end\n end", "def create\n @instructor = User.new\n # Add proper Data here as well\n if @instructor.save\n redirect_to @instructor, notice: \"Successfully Saved!\"\n else\n render :new\n end\nend", "def instructor_params\n params.require(:instructor).permit(:email, :name, :password, :password_confirmation, :type, :deleteable)\n end", "def create\n # Instantiate a new object using form parameters\n attrs = params.permit(:coursenumber, :title, :description, :start_date, :end_date, :created_at, :updated_at, :status, :active, :inactivation_request)\n @instructor = Instructor.find_by_email params[:email]\n\n attrs[:instructor] = @instructor\n if @instructor\n @course = Course.create(attrs)\n redirect_to courses_path\n else\n @course = Course.new\n render new_course_path\n end\n end", "def create\n @enrollments = Enrollment.new(enrollment_params)\n\n respond_to do |format|\n if @enrollments.save\n format.html { redirect_to current_user }\n format.json { render :show, status: :created, location: @enrollments }\n else\n format.html { render :new }\n format.json { render json: @enrollments.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def show\n render json: @instructor\n end", "def index\n @instructors = Instructor.all(:order => :name)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @instructors }\n end\n end", "def instructor_params\n params.require(:instructor).permit!\n end", "def index\n @section_instructors = SectionInstructor.all\n end", "def instructor_params\n params.require(:instructor).permit(:user_id, :street1, :street2, :city, :state, :country, :zip, :certificates, :teach_since, :styles, :certificate_name)\n end", "def create\n @teach = Teach.new(params[:teach])\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to '/instructors/'+current_instructor.id.to_s+'/courses/'+@teach.course_id, notice: 'Teacher was successfully added.' }\n format.json { render json: @teach, status: :created, location: @teach }\n else\n # format.html { redirect_to '/instructors/'+current_instructor.id.to_s+'/courses/'+@teach.course_id+'/newinstructor'}\n format.html { render action: \"new\" }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n\n #'/instructors/'+params[:id]+'/courses/'+params[:course_id]+'/newinstructor'\n end\n end\n end", "def instructor_params\n params.require(:instructor).permit(:name, :course, :range)\n end", "def new\n @instructor_text = InstructorText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor_text }\n end\n end", "def create\n course_name = params[:text].to_s\n course = Course.create(name: course_name)\n CourseInstructor.create(course: course, instructor: current_user.instructor)\n\n @courses = current_user.instructor.courses.collect{ |course|\n {\n name: course.name,\n id: course.id\n }\n }\n\n render :template => \"home/index\"\n end", "def instructor_params\n params.require(:instructor).permit(:fname, :lname, :email, :age, :salary, :degree, :id)\n end", "def create\n \n\t# create a new student as well if there is not already a student associated with this user.\n\t#Student.new({:user_id => session[:id], :student_number => params[:enrollment][:student_number]})\n\t\n\t# give correct user id.\n\tparams[:enrollment][:user_number] = session[:user_id]\n @enrollment = Enrollment.new(params[:enrollment])\n\t\n respond_to do |format|\n if @enrollment.save\n format.html { redirect_to @enrollment, notice: 'Enrollment was successfully created.' }\n format.json { render json: @enrollment, status: :created, location: @enrollment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @instructor = Instructor.find(params[:id])\n @instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to instructors_url }\n format.json { head :ok }\n end\n end", "def index\n @instructors = Instructor.all\n # render json: @instructors.to_json\n render json: @instructors.to_json(only: [:first_name, :last_name, :region, :photo, :email, :bio, :instagram, :experience, :user_id],\n include: [schedules: { only: [:title, :start, :end, :instructor_id, :workout_id]}])\n end", "def instructor_params\n params.permit(:first_name, :last_name, :bio, :active)\n end", "def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end", "def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course added. Warning no Instructor assigned. Go to the manage user history tab and add instructor' }\n format.json { render action: 'show', status: :created, location: @course }\n else\n format.html { render action: 'new' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = User.find(params[:name])\n end", "def enrollment(params = {})\n scope 'default'\n post('enrollment/', params)\n end", "def create\n @enrollment = @parent.enrollments.build enrollment_params\n if @enrollment.save\n render :show, status: :created, location: api_v1_mutant_enrollment_url(@enrollment.mutant_id, @enrollment)\n else\n render json: @enrollment.errors, status: :unprocessable_entity\n end\n end", "def update\n if @instructor.update(instructor_params)\n render json: @instructor\n else\n render json: @instructor.errors\n end\n end", "def section_instructor_params\n params.require(:section_instructor).permit(:section_id, :instructor_id)\n end", "def instructor_params\n params.require(:instructor).permit(:full_name, :photo_id, :full_bio, :short_bio, :active)\n end", "def create\n @instructor_app = InstructorApp.new(instructor_app_params)\n @instructor_app.instructor = current_user.instructor\n @instructor_app.course = params[:course]\n respond_to do |format|\n if @instructor_app.save\n format.html { redirect_to portal_path(current_user.id), notice: 'Instructor app was successfully created.' }\n format.json { render :show, status: :created, location: @instructor_app }\n else\n format.html { render :new }\n format.json { render json: @instructor_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def instructor_params\n params.require(:instructor).permit(:fname, :lname, :age, :salary, :education)\n end", "def create\n @enrollment = Enrollment.new(enrollment_params)\n\n respond_to do |format|\n if @enrollment.save\n format.html { redirect_to @enrollment, notice: 'Enrollment was successfully created.' }\n format.json { render :show, status: :created, location: @enrollment }\n else\n format.html { render :new }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @enrollment = Enrollment.new(enrollment_params)\n\n respond_to do |format|\n if @enrollment.save\n format.html { redirect_to @enrollment, notice: 'Enrollment was successfully created.' }\n format.json { render :show, status: :created, location: @enrollment }\n else\n format.html { render :new }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n instructor_geolocation = InstructorGeolocation.new\n instructor_geolocation.address = params[:geolocation]\n\n instructor_geolocation.longitude = params[:lng]\n instructor_geolocation.latitude = params[:lat]\n instructor_geolocation.street = params[:route]\n instructor_geolocation.street_number = params[:street_number]\n instructor_geolocation.zip = params[:postal_code]\n instructor_geolocation.city = params[:locality]\n instructor_geolocation.country = params[:country]\n instructor_geolocation.state = params[:administrative_area_level_1]\n\n @instructor.user_id = current_user.id\n\n respond_to do |format|\n if @instructor.save\n instructor_geolocation.instructor_id = @instructor.id\n if instructor_geolocation.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor_geolocation.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @instructor.destroy\n respond_to do |format|\n format.html { redirect_to instructors_url, notice: 'Instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instructor.destroy\n respond_to do |format|\n format.html { redirect_to instructors_url, notice: 'Instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instructor }\n end\n end", "def create\n @enrollment_ta = EnrollmentTa.new(enrollment_ta_params)\n\n respond_to do |format|\n if @enrollment_ta.save\n format.html { redirect_to @enrollment_ta, notice: 'Enrollment ta was successfully created.' }\n format.json { render :show, status: :created, location: @enrollment_ta }\n else\n format.html { render :new }\n format.json { render json: @enrollment_ta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t\tquiz = Quiz.new(quiz_params)\n\t\t\tif quiz.save\n\t\t\t\tcurrent_instructor.quizzes << quiz\n\t\t\t\trender json: { id: quiz.id }, status: 201\n\t\t\telse\n\t\t\t\trender json: { error: quiz.errors }, status: 422\n\t\t\tend\n\t\tend", "def destroy\n @manage_instructor = Instructor.find(params[:id])\n @manage_instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_instructors_url }\n format.json { head :ok }\n end\n end", "def instructor_params\n\t\t\tparams.require(:instructor).permit(:first_name, :last_name, :bio, :phone, :email, :active)\n\t\tend", "def create\n @enrolled = Enrolled.new(:student_id => current_student.student_id, :course_id => params[:course_id])\n\n respond_to do |format|\n if @enrolled.save\n format.html { redirect_to @enrolled, notice: 'Enrolled was successfully created.' }\n format.json { render json: @enrolled, status: :created, location: @enrolled }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enrolled.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor_text = InstructorText.new(params[:instructor_text])\n\n respond_to do |format|\n if @instructor_text.save\n format.html { redirect_to @instructor_text, notice: 'Instructor text was successfully created.' }\n format.json { render json: @instructor_text, status: :created, location: @instructor_text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instructor_text.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @enrollment = Enrollment.new(enrollment_params)\n\n respond_to do |format|\n if @enrollment.save\n format.html { redirect_to [:admin, @enrollment], notice: 'enrollment was successfully created.' }\n format.json { render :show, status: :created, location: @enrollment }\n else\n format.html { render :new }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def course_instructor_params\n params.require(:course_instructor).permit(:course_id, :user_id)\n end", "def create\n admin_only\n @subject = Subject.new(subject_params)\n\n new_tutor_ids = []\n unless params[:subject][:people_teaching_attributes].blank?\n params[:subject][:people_teaching_attributes].each do |attribute|\n id = attribute[1][:incoming_tutor_id]\n new_tutor_ids << id unless attribute[1][:_destroy] == \"1\"\n end\n end\n\n respond_to do |format|\n if @subject.save\n\n unless new_tutor_ids == []\n new_tutor_ids.each do |id|\n e = ProvidingEnrollment.new\n e.user_id = id\n e.subject_id = @subject.id\n e.save!\n end\n end\n\n format.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @course_instructors = CourseInstructor.all\n end", "def create\n authorize! :manage, Course\n @course = Course.new(course_params)\n @course.course_sections.each do |course_section|\n course_section.name = \"#{@course.name} #{course_section.grade_section.name}\"\n end\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @course = Course.new(course_params)\n\n if @course.save\n @course.generate_join_token\n if current_user.has_role? :instructor\n current_user.courses << @course\n current_user.add_role :instructor, @course\n current_user.add_role :grader, @course\n end\n\n flash[:notice] = \"Course created successfully.\"\n redirect_to @course\n else\n render :action => :new\n end\n end", "def instructor_params\n params.require(:instructor).permit(:university_id, :instructor, :email, :phone, :class_code, :hired_date, :start_date, :pre_quiz_taken, :tier_id, :active)\n end", "def new\n @instructor = Instructor.new\n @aircraft_types = AircraftType.by_name.collect{|at| [at.name, at.id]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @instructor }\n end\n end", "def show\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @instructor }\n end\n end", "def assigning_tutor\n unless params[:student_ids].empty?\n @students = Student.where(id: params[:student_ids])\n tutor = User.find(params[:user_id])\n\n @students.each do |s|\n s.assign_tutor(tutor)\n end\n message = {message: @students.size.to_s + ' students have been assigned a new tutor.'}\n else\n message = {message: 'No student ids were received.'}\n end\n render json: message\n end", "def test_course_instructors_associated_with_courses\n c = Course.create(name: \"Tech News\", course_code: \"xyz546\")\n i = CourseInstructor.create()\n c.course_instructors << i\n assert_equal [i], Course.find(c.id).course_instructors\n end", "def create\n @faculties = Faculty.create!(faculty_params)\n json_response(@faculties, :created)\n end", "def create\n @course = Course.find(params[:course_id])\n @enrollment = @course.enrollments.create(params[:enrollment])\n\n respond_to do |format|\n if @enrollment.save\n format.html { render :template => 'enrollments/success', notice: 'ya' }\n format.json { render json: @enrollment, status: :created, location: @enrollment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n format.js\n end\n end", "def create\n @course = Course.new(course_params)\n @course.user_id = @current_user.user_id\n respond_to do |format|\n #instructor_exists\n if !course_name_exists? and professor_exist? and @course.save\n current_user.courses << @course\n format.html { redirect_to @course, notice: \"Successfully added course #{@course.course_name}\" }\n format.json { render :show, status: :created, location: @course }\n else\n if @course.errors[:message].empty?\n @course.errors.add(:course_name, \"Course name exists\")\n end\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n if current_user && current_user.university_id\n begin \n params[:enrollment][:user_id] = current_user.id \n params[:enrollment][:university_id] = current_user.university_id\n @enrollment = Enrollment.renew( params[:enrollment] )\n render :show\n rescue \n render json: {error: \"Enrollment not created.\"}\n end\n else\n render json: {error: \"Enrollment not created.\"}\n end\n end", "def create\n professor = Professor.new(professor_params)\n \n if professor.save\n render json: professor.to_json(include: :courses)\n else\n render :json => { :errors => professor.errors }, :status => 422\n end\n end", "def set_section_instructor\n @section_instructor = SectionInstructor.find(params[:id])\n end", "def create\n course = Course.includes(:professors).new(course_params)\n course.professor_ids=(params[:professors])\n\n if course.save\n render json: course.to_json(include: :professors)\n else\n render :json => { :errors => course.errors }, :status => 422\n end\n end", "def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end", "def create\n @creator = current_user.id\n @user_tutorial = UserTutorial.new(user_tutorial_params)\n @user_tutorial.user_id = @creator\n\n respond_to do |format|\n if @user_tutorial.save\n format.html { redirect_to @user_tutorial, notice: 'User tutorial was successfully created.' }\n format.json { render :show, status: :created, location: @user_tutorial }\n else\n format.html { render :new }\n format.json { render json: @user_tutorial.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @manage_instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manage_instructor }\n end\n end", "def platform_params\n params.require(:instructor).permit(:name, :description, :address, :logoRef)\n end", "def create\n\n @teaching = Teaching.new(teaching_params)\n @user = User.find(session[:user_id]) \n \n respond_to do |format|\n if @teaching.save\n @user.teachings << @teaching\n format.html { redirect_to @teaching, notice: 'La actividad se registro con exito.' }\n format.json { render :show, status: :created, location: @teaching }\n else\n format.html { render :new }\n format.json { render json: @teaching.errors, status: :unprocessable_entity }\n end\n end\n\n \n end", "def create\n @enrollment = Enrollment.new(enrollment_params)\n\n respond_to do |format|\n if @enrollment.save\n format.html { redirect_to @enrollment, notice: 'Matrícula criada com sucesso.' }\n format.json { render :show, status: :created, location: @enrollment }\n else\n format.html { render :new }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @section_instructor.destroy\n respond_to do |format|\n format.html { redirect_to section_instructors_url, notice: 'Section instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @cohort_instructor = CohortInstructor.new(cohort_instructor_params)\n\n respond_to do |format|\n if @cohort_instructor.save\n format.html { redirect_to cohorts_path, notice: 'Cohort was successfully updated.' }\n format.json { render :show, status: :created, location: @cohort_instructor }\n else\n format.html { redirect_to edit_cohort_path, alert: \"Cohort was not updated: #{@cohort_instructor.errors.full_messages.to_sentence}\"}\n format.json { render json: @cohort_instructor.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7211147", "0.7157347", "0.7080013", "0.7080013", "0.7080013", "0.7005359", "0.6938629", "0.6901605", "0.6890581", "0.6829674", "0.6803561", "0.6802934", "0.67715555", "0.6598164", "0.65361786", "0.651337", "0.64388067", "0.64371824", "0.6317453", "0.6299684", "0.6266201", "0.6246052", "0.62062025", "0.62062025", "0.6201089", "0.61939216", "0.6187936", "0.6182606", "0.6175176", "0.616239", "0.61530346", "0.6152731", "0.6138954", "0.6112324", "0.61020666", "0.5954987", "0.5924155", "0.5920413", "0.5917914", "0.59135604", "0.5883997", "0.5868382", "0.5858466", "0.5857836", "0.58551776", "0.5847569", "0.58464026", "0.58464026", "0.58464026", "0.58464026", "0.58464026", "0.58464026", "0.58464026", "0.58464026", "0.5829564", "0.58274335", "0.58006936", "0.57907593", "0.57818377", "0.5773334", "0.57723", "0.5769891", "0.57506925", "0.57506925", "0.5733376", "0.57292885", "0.57292885", "0.5725598", "0.5725484", "0.57233596", "0.57224", "0.57173544", "0.5716275", "0.571475", "0.5711784", "0.57093954", "0.5708321", "0.57031447", "0.5695628", "0.5693271", "0.5671517", "0.56714404", "0.5669639", "0.5642887", "0.5632381", "0.5631368", "0.5622361", "0.5620606", "0.5615579", "0.5613844", "0.5612271", "0.5588385", "0.5582905", "0.5581783", "0.55817175", "0.55793613", "0.55744505", "0.55729884", "0.5568816", "0.55595946" ]
0.6376019
18
PUT /instructors/1 PUT /instructors/1.json
def update @instructor = Instructor.find(params[:id]) respond_to do |format| if @instructor.update_attributes(params[:instructor]) format.html { redirect_to @instructor, :notice => 'Instructor was successfully updated.' } format.json { head :ok } else @aircraft_types = AircraftType.by_name.collect{|at| [at.name, at.id]} format.html { render :action => "edit" } format.json { render :json => @instructor.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @instructor.update(instructor_params)\n render json: @instructor\n else\n render json: @instructor.errors\n end\n end", "def update\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n if @instructor.update_attributes(params[:instructor])\n format.html { redirect_to @instructor, notice: 'Instructor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @manage_instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n if @manage_instructor.update_attributes(params[:manage_instructor])\n format.html { redirect_to @manage_instructor, notice: 'Instructor was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manage_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instructor.update(instructor_params)\n format.html { redirect_to @instructor, notice: 'Instructor was successfully updated.' }\n format.json { render :show, status: :ok, location: @instructor }\n else\n format.html { render :edit }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instructor1 = Instructor1.find(params[:id])\n\n respond_to do |format|\n if @instructor1.update_attributes(params[:instructor1])\n format.html { redirect_to @instructor1, notice: 'Instructor1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instructor1.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = Instructor.find(params[:id])\n end", "def set_instructor\n @instructor = User.find(params[:name])\n end", "def update\n @instructor = Instructor.find(params[:id])\n render :action => :edit unless @instructor.update_attributes(params[:instructor])\n \n end", "def update(instructor, subject, school)\n school[:instructors].each do |i|\n i[:subject] = subject if i[:name] == instructor\n end\nend", "def update\n respond_to do |format|\n if @course_instructor.update(course_instructor_params)\n format.html { redirect_to @course_instructor, notice: 'Course instructor was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_instructor }\n else\n format.html { render :edit }\n format.json { render json: @course_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_instructor\n\t\t\t@instructor = Instructor.find(params[:id])\n\t\tend", "def update_instructor(tmp_object, instructor_id)\n tmp_object[\"instructor_id\"] = instructor_id\n tmp_object[\"instructor\"] = nil\n tmp_object[\"instructor\"] = User.find(instructor_id).name(session[:ip]) if instructor_id\n end", "def update\n respond_to do |format|\n if @section_instructor.update(section_instructor_params)\n format.html { redirect_to @section_instructor, notice: 'Section instructor was successfully updated.' }\n format.json { render :show, status: :ok, location: @section_instructor }\n else\n format.html { render :edit }\n format.json { render json: @section_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_section_instructor\n @section_instructor = SectionInstructor.find(params[:id])\n end", "def create\n @instructor = Instructor.new(params[:instructor])\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render json: @instructor, status: :created, location: @instructor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instructor = User.new\n # Add proper data to this\n if @instructor.update\n redirect_to @instructor, notice: \"Successfully Updated!\"\n else\n render :edit\n end\nend", "def set_course_instructor\n @course_instructor = CourseInstructor.find(params[:id])\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_instructor(list, name, subject)\n\tlist.each do |instructor|\n\t\tif instructor[:name] == name\n\t\t\tinstructor[:subject] = subject\n\t\tend\n\tend\nend", "def destroy\n @instructor = Instructor.find(params[:id])\n @instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to instructors_url }\n format.json { head :ok }\n end\n end", "def create\n @manage_instructor = Instructor.new(params[:manage_instructor])\n\n respond_to do |format|\n if @manage_instructor.save\n format.html { redirect_to @manage_instructor, notice: 'Instructor was successfully created.' }\n format.json { render json: @manage_instructor, status: :created, location: @manage_instructor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manage_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if(current_user.type==\"Admin\" && @instructor.update(instructor_params))\n \t flash[:notice] = 'Instructor was successfully updated.'\n \t redirect_to admin_path(current_user.id)\n else\n respond_to do |format|\n if @instructor.update(instructor_params)\n format.html { redirect_to @instructor, notice: 'Instructor was successfully updated.' }\n format.json { render :show, status: :ok, location: @instructor }\n else\n format.html { render :edit }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def destroy\n @manage_instructor = Instructor.find(params[:id])\n @manage_instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_instructors_url }\n format.json { head :ok }\n end\n end", "def create\n @instructor = Instructor.new(instructor_params)\n @instructor.deleteable = true\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to admin_path(current_user), notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: admin_path(current_user) }\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_instructor(school,name,new_subject)\n school[:instructors].each do |instructor|\n if instructor.has_value?(name)\n instructor[:subject] = new_subject\n end\n end\nend", "def create\n @instructor = Instructor.new(trainer_params)\n if @instructor.save\n render json: @instructor\n else\n render json: @instructor.errors\n end\n end", "def new\n employee_url = \"http://104.131.73.180/api/v1/employees\"\n employees = HTTParty.get(employee_url)\n\n @instructors_hash = {}\n\n employees[\"employees\"].each do |employee|\n if employee[\"role\"] == \"instructor\"\n key = employee[\"id\"]\n @instructors_hash[key] = employee\n end\n end\n\n @instructor = Instructor.new\n\n cohort_url = \"http://104.131.73.180/api/v1/cohorts\"\n cohorts = HTTParty.get(cohort_url)\n\n cohorts[\"cohorts\"].each do |cohort|\n cohort[\"instructor_ids\"].each do |instructor_id|\n @instructors_hash[instructor_id][\"cohort\"] = cohort[\"id\"]\n end\n end\n\n end", "def show\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instructor }\n end\n end", "def show\n render json: @instructor\n end", "def new\n @instructor1 = Instructor1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor1 }\n end\n end", "def show\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @instructor }\n end\n end", "def new\n @instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor }\n end\n end", "def index\n @instructors = Instructor.all\n end", "def show\n @manage_instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manage_instructor }\n end\n end", "def create\n @section_instructor = SectionInstructor.new(section_instructor_params)\n\n respond_to do |format|\n if @section_instructor.save\n format.html { redirect_to @section_instructor, notice: 'Section instructor was successfully created.' }\n format.json { render :show, status: :created, location: @section_instructor }\n else\n format.html { render :new }\n format.json { render json: @section_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @instructor.update(instructor_params)\n format.html { redirect_to @booking, notice: 'Instructor confirmation was successfully updated.' }\n else\n format.html { render action: 'edit' }\n end\n end", "def new\n @manage_instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manage_instructor }\n end\n end", "def edit\n @instructor = Instructor.find(params[:id])\n # => app/views/users/edit.html.erb\n end", "def show\n @instructor = Instructor.find(params[:id])\n end", "def create\n @course_instructor = CourseInstructor.new(course_instructor_params)\n\n respond_to do |format|\n if @course_instructor.save\n format.html { redirect_to @course_instructor, notice: 'Course instructor was successfully created.' }\n format.json { render :show, status: :created, location: @course_instructor }\n else\n format.html { render :new }\n format.json { render json: @course_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor1 = Instructor1.new(params[:instructor1])\n\n respond_to do |format|\n if @instructor1.save\n format.html { redirect_to '/home', notice: 'Instructor account was successfully created. now login!' }\n # format.json { render json: @instructor1, status: :created, location: @instructor1 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instructor1.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_platform\n @instructor = Instructor.find(params[:id])\n end", "def destroy\n @instructor = Instructor.find(params[:id])\n @instructor.destroy\n end", "def instructor_params\n params.require(:instructor).permit!\n end", "def instructor_params\n params.require(:instructor).permit(:name, :course, :range)\n end", "def instructor_params\n params.require(:instructor).permit(:user_id, :street1, :street2, :city, :state, :country, :zip, :certificates, :teach_since, :styles, :certificate_name)\n end", "def update\n\n @enrollment = Enrollment.shard_for( params[:enrollment][:classroom_id] ).find(params[:id])\n\n respond_to do |format|\n if @enrollment.update_attributes(params[:enrollment])\n format.html { redirect_to @enrollment, notice: 'Enrollment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_subject(school, instructor_name, new_subject)\n school[:instructors].collect do |instructor|\n if instructor[:name] == instructor_name\n instructor[:subject] = new_subject\n end\n end\nend", "def instructor_params\n params.require(:instructor).permit(:fname, :lname, :email, :age, :salary, :degree, :id)\n end", "def destroy\n @instructor = Instructor.find(params[:id])\n @instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to instructores_url }\n format.json { head :no_content }\n end\n end", "def create_instructor\n instructor = params[\"instructor\"]\n\n if instructor.blank?\n render json: {message: \"Chưa truyền dữ liệu!\"}, status: :unprocessable_entity\n return\n end\n\n instructor = JSON.parse(instructor)\n\n user = User.new(\n name: instructor['name']\n )\n\n email = instructor['email'].blank? ? Utils.nomalize_string(instructor['name']).to_s + \"@tudemy.vn\" : instructor['email']\n user.email = email\n user.password = \"12345678\"\n\n instructor_profile = User::InstructorProfile.new()\n instructor_profile.academic_rank = instructor['instructor_profile']['academic_rank'] unless instructor['instructor_profile']['academic_rank'].blank?\n instructor_profile.major = instructor['instructor_profile']['major'] unless instructor['instructor_profile']['major'].blank?\n instructor_profile.function = instructor['instructor_profile']['function'] unless instructor['instructor_profile']['function'].blank?\n instructor_profile.work_unit = instructor['instructor_profile']['work_unit'] unless instructor['instructor_profile']['work_unit'].blank?\n instructor_profile.description = instructor['instructor_profile']['description'] unless instructor['instructor_profile']['description'].blank?\n \n user.instructor_profile = instructor_profile\n\n if user.save\n render json: {message: \"Success\"}\n return\n else\n render json: {message: \"Lỗi không lưu được data\"}, status: :unprocessable_entity\n return\n end\n \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 instructor_params\n params.require(:instructor).permit(:email, :name, :password, :password_confirmation, :type, :deleteable)\n end", "def update\n professor = Professor.find(params[:id])\n professor.update!(professor_params)\n\n render json: professor.to_json(include: :courses)\n end", "def destroy\n @instructor.destroy\n respond_to do |format|\n format.html { redirect_to instructors_url, notice: 'Instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instructor.destroy\n respond_to do |format|\n format.html { redirect_to instructors_url, notice: 'Instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @section_instructors = SectionInstructor.all\n end", "def update\n \n @enrollment = Enrollment.find(params[:id])\n\t# give correct user id.\n\t\n respond_to do |format|\n if @enrollment.update_attributes(params[:enrollment])\n format.html { redirect_to @enrollment, notice: 'Enrollment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_instructor\n instructor = params[\"instructor\"]\n\n if instructor.blank?\n render json: {message: \"Chưa truyền dữ liệu!\"}, status: :unprocessable_entity\n return\n end\n\n instructor = JSON.parse(instructor)\n\n user = User.new(\n name: instructor['name']\n )\n\n email = instructor['email'].blank? ? Utils.nomalize_string(instructor['name']).to_s + \"@tudemy.vn\" : instructor['email']\n user.email = email\n user.password = \"12345678\"\n\n instructor_profile = User::InstructorProfile.new()\n instructor_profile.academic_rank = instructor['instructor_profile']['academic_rank'] unless instructor['instructor_profile']['academic_rank'].blank?\n instructor_profile.major = instructor['instructor_profile']['major'] unless instructor['instructor_profile']['major'].blank?\n instructor_profile.function = instructor['instructor_profile']['function'] unless instructor['instructor_profile']['function'].blank?\n instructor_profile.work_unit = instructor['instructor_profile']['work_unit'] unless instructor['instructor_profile']['work_unit'].blank?\n instructor_profile.description = instructor['instructor_profile']['description'] unless instructor['instructor_profile']['description'].blank?\n\n user.instructor_profile = instructor_profile\n\n if user.save\n render json: {message: \"Success\"}\n return\n else\n render json: {message: \"Lỗi không lưu được data\"}, status: :unprocessable_entity\n return\n end\n end", "def update\n authorize @institute\n respond_to do |format|\n if @institute.update(institute_params)\n format.html { redirect_to @institute, notice: 'Institute was successfully updated.' }\n format.json { render :show, status: :ok, location: @institute }\n else\n format.html { render :edit }\n format.json { render json: @institute.errors, status: :unprocessable_entity }\n end\n end\n end", "def section_instructor_params\n params.require(:section_instructor).permit(:section_id, :instructor_id)\n end", "def create\n @instructor = Instructor.new(params[:instructor])\n render :action => :new unless @instructor.save\n end", "def index\n @instructors = Instructor.all(:order => :name)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @instructors }\n end\n end", "def add_instructor(instructor)\n @instructors << instructor\n end", "def destroy\n @instructor1 = Instructor1.find(params[:id])\n @instructor1.destroy\n\n respond_to do |format|\n format.html { redirect_to instructor1s_url }\n format.json { head :no_content }\n end\n end", "def set_cohort_instructor\n @cohort_instructor = CohortInstructor.find(params[:id])\n end", "def update_subject(school, name, subject)\n\tschool[:instructors].each { |instructor| instructor[:subject] = subject if instructor[:name] == name}\nend", "def update\n @instructor_text = InstructorText.find(params[:id])\n\n respond_to do |format|\n if @instructor_text.update_attributes(params[:instructor_text])\n format.html { redirect_to @instructor_text, notice: 'Instructor text was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instructor_text.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n # create team\n team = Team.create(name: params[:team_name], course: $selected_course)\n\n # add students to teams\n student_ids = params[:student_ids]\n student_ids.each do |student_id|\n StudentTeam.create(student_id: student_id, team: team)\n end\n\n render json: { success: true }\n end", "def instructor_params\n params.require(:instructor).permit(:full_name, :photo_id, :full_bio, :short_bio, :active)\n end", "def new\n @instructor = Instructor.new\n end", "def new\n @instructor = Instructor.new\n end", "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_subject(instructor_name, new_subject)\n\t\tSCHOOL[:instructors].each do |hash|\n\t\t\thash[:subject]=new_subject if hash[:name]==instructor_name\n\t\tend\n\tend", "def update\n @institute_admin = InstituteAdmin.find(params[:id])\n respond_to do |format|\n if @institute_admin.update_attributes(params[:institute_admin])\n format.html { redirect_to @institute_admin, notice: 'InstituteAdmin was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institute_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n #don't need to add user_id here.. already exists.\n \n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "def course_instructor_params\n params.require(:course_instructor).permit(:course_id, :user_id)\n end", "def update\n @faculty.update(faculty_params)\n head :no_content\n end", "def create\n @instructor = Instructor.new(params[:instructor])\n\n respond_to do |format|\n if @instructor.save\n format.html { redirect_to @instructor, :notice => 'Instructor was successfully created.' }\n format.json { render :json => @instructor, :status => :created, :location => @instructor }\n else\n @aircraft_types = AircraftType.by_name.collect{|at| [at.name, at.id]}\n\n format.html { render :action => \"new\" }\n format.json { render :json => @instructor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instructor_app.update(instructor_app_params)\n format.html { redirect_to portal_path(current_user.id), notice: 'Instructor app was successfully updated.' }\n format.json { render :show, status: :ok, location: @instructor_app }\n else\n format.html { render :edit }\n format.json { render json: @instructor_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def instructor_params\n params.require(:instructor).permit(:fname, :lname, :age, :salary, :education)\n end", "def update\n course = Course.includes(:professors).find(params[:id])\n course.update!(course_params)\n \n course.professor_ids=(params[:professors])\n\n render json: course.to_json(include: :professors)\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update\n\n @intake.title = @intake.course.title + \": \" + @intake.start_date.strftime(\"%b, %Y\")\n respond_to do |format|\n if @intake.update_attributes(params[:intake])\n format.html { redirect_to @intake, notice: 'Intake was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @intake.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @enroll = Enroll.find(params[:id])\n if @enroll.update_attributes(params[:enroll])\n render json: JSON.parse(@enroll.to_json)\n else\n render json: JSON.parse(@enroll.errors.to_json)\n end\n end", "def update\n respond_to do |format|\n\n previous_tier = @instructor.tier_id\n\n if @instructor.update(instructor_params)\n\n unless previous_tier == @instructor.tier_id\n\n if ((params['instructor']['tier_update_notes']) and (params['instructor']['tier_update_notes'] != \"\"))\n TierUpdate.create({instructor_id: @instructor.id, old_tier: previous_tier, new_tier: @instructor.tier_id, notes: params['instructor']['tier_update_notes']})\n else\n format.html { redirect_to edit_instructor_path(@instructor), alert: 'You can not change the tier of an instructor without giving a reason!' }\n end\n end\n\n format.html { redirect_to @instructor, notice: 'Instructor was successfully updated.' }\n format.json { render :show, status: :ok, location: @instructor }\n else\n format.html { render :edit }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @section_instructor.destroy\n respond_to do |format|\n format.html { redirect_to section_instructors_url, notice: 'Section instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def change_subject(school, instructor_name2, new_subject)\n school[:instructors].each do |instructor|\n if instructor_name2 == instructor[:name]\n instructor[:subject] = new_subject\n puts \"#{instructor_name2}'s subject has been updated to #{new_subject}\"\n end\n end\nend", "def destroy\n @instructor.destroy\n end", "def update\n respond_to do |format|\n if @tutorial_committee.update(tutorial_committee_params)\n format.html { redirect_to @tutorial_committee, notice: 'Tutorial committee was successfully updated.' }\n format.json { render :show, status: :ok, location: @tutorial_committee }\n else\n format.html { render :edit }\n format.json { render json: @tutorial_committee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end" ]
[ "0.7247789", "0.71572495", "0.69670326", "0.69597566", "0.6910412", "0.6750971", "0.6750971", "0.6750971", "0.6750971", "0.6750971", "0.6750971", "0.6750971", "0.6750971", "0.65655047", "0.65613306", "0.65545636", "0.6540953", "0.652795", "0.65277505", "0.6497438", "0.6445801", "0.6414653", "0.6379073", "0.6332049", "0.63181585", "0.63181585", "0.63181585", "0.6312662", "0.630988", "0.63072497", "0.62622356", "0.62543046", "0.62389106", "0.6192874", "0.6180712", "0.61601967", "0.61294115", "0.61003244", "0.6079831", "0.6078103", "0.6077795", "0.6057383", "0.6049738", "0.6024874", "0.60223615", "0.60216147", "0.6017097", "0.60101587", "0.6001748", "0.5985604", "0.5985351", "0.5974301", "0.595931", "0.59515715", "0.59425014", "0.59403026", "0.59202594", "0.5913756", "0.5906004", "0.58817214", "0.58713895", "0.5865449", "0.5861308", "0.5857798", "0.5857798", "0.5844194", "0.5841901", "0.5839094", "0.58385146", "0.582978", "0.5803326", "0.5795427", "0.5794676", "0.57940346", "0.57902837", "0.5788614", "0.5772614", "0.5771048", "0.5768433", "0.57579756", "0.57579756", "0.5732251", "0.57056445", "0.56950796", "0.5694538", "0.5671232", "0.5669094", "0.5668694", "0.5664859", "0.56547314", "0.5642718", "0.56413656", "0.5637649", "0.56331176", "0.5630588", "0.5629194", "0.56193846", "0.56123257", "0.56109726", "0.56083035" ]
0.6376264
23
DELETE /instructors/1 DELETE /instructors/1.json
def destroy @instructor = Instructor.find(params[:id]) @instructor.destroy respond_to do |format| format.html { redirect_to instructors_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @instructor = Instructor.find(params[:id])\n @instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to instructores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manage_instructor = Instructor.find(params[:id])\n @manage_instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_instructors_url }\n format.json { head :ok }\n end\n end", "def destroy\n @instructor1 = Instructor1.find(params[:id])\n @instructor1.destroy\n\n respond_to do |format|\n format.html { redirect_to instructor1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instructor.destroy\n respond_to do |format|\n format.html { redirect_to instructors_url, notice: 'Instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instructor.destroy\n respond_to do |format|\n format.html { redirect_to instructors_url, notice: 'Instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @section_instructor.destroy\n respond_to do |format|\n format.html { redirect_to section_instructors_url, notice: 'Section instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instructor = Instructor.find(params[:id])\n @instructor.destroy\n end", "def destroy\n @course_instructor.destroy\n respond_to do |format|\n format.html { redirect_to course_instructors_url, notice: 'Course instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instructor.destroy\n end", "def destroy\n @instructor= Instructor.find(params[:id])\n if(@instructor.course_instructors.length >0)\n flash[:danger] = \"Instructor has references. Unable to delete.\"\n redirect_to instructors_path\n return\n end\n @instructor.destroy\n respond_to do |format|\n format.html { redirect_to admin_path(current_user.id), notice: 'Instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @cohort_instructor.destroy\n respond_to do |format|\n format.html { redirect_to cohort_instructors_url, notice: 'Cohort instructor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.html { redirect_to '/students', notice: 'La Cursada se borró exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instructor_text = InstructorText.find(params[:id])\n @instructor_text.destroy\n\n respond_to do |format|\n format.html { redirect_to instructor_texts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment = Enrollment.find(params[:id])\n @enrollment.destroy\n\n respond_to do |format|\n format.html { redirect_to enrollments_url }\n format.json { head :no_content }\n end\n end", "def destroy \n if @enrollment && @enrollment.destroy \n render json: {success: \"Delete Successfully.\"}, status: 200\n else\n render json: {error: \"Enrollment not deleted.\"}\n end \n end", "def destroy\n @alumni = Alumni.find(params[:id])\n @alumni.destroy\n\n respond_to do |format|\n format.html { redirect_to alumnis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instructor.destroy\n redirect_to action: :index, notice: \"Successfully deleted!\" # use redirect instead of render to avoid double submission (double deletion)\nend", "def destroy\n @leadership.destroy\n respond_to do |format|\n format.html { redirect_to leaderships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inschool = Inschool.find(params[:id])\n @inschool.destroy\n\n respond_to do |format|\n format.html { redirect_to inschools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instructor_app.destroy\n respond_to do |format|\n format.html { redirect_to instructor_apps_url, notice: 'Instructor app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n student.destroy\n respond_to do |format|\n format.html { redirect_to admin_students_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render json: @tutorial\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.html { redirect_to enrollments_url, notice: 'Enrollment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.html { redirect_to enrollments_url, notice: 'Enrollment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.html { redirect_to enrollments_url, notice: 'Enrollment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.html { redirect_to enrollments_url, notice: 'Enrollment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.html { redirect_to enrollments_url, notice: 'Enrollment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n\n head :no_content\n end", "def destroy\n @enroll = Enroll.find(params[:id])\n @enroll.destroy\n\n respond_to do |format|\n format.html { redirect_to enrolls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment = Enrollment.shard_for( params[:classroom_id] ).find(params[:id])\n @enrollment.destroy\n\n respond_to do |format|\n format.html { redirect_to enrollments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.html { redirect_to admin_enrollments_url, notice: 'enrollment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.delete\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.html { redirect_to enrollments_url, notice: 'Matrícula excluída com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @university_course.destroy\n respond_to do |format|\n format.html { redirect_to university_courses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @optin_contestant = OptinContestant.find(params[:id])\n @optin_contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to optin_contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment_ta.destroy\n respond_to do |format|\n format.html { redirect_to enrollment_tas_url, notice: 'Enrollment ta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dojo_student = DojoStudent.find(params[:id])\n @dojo_student.destroy\n\n respond_to do |format|\n format.html { redirect_to dojo_students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial_committee.destroy\n respond_to do |format|\n format.html { redirect_to tutorial_committees_url, notice: 'Tutorial committee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment = Enrollment.find(params[:id])\n @enrollment.delete\n end", "def destroy\n authorize @institute\n @institute.destroy\n respond_to do |format|\n format.html { redirect_to institutes_url, notice: 'Institute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumni.destroy\n respond_to do |format|\n format.html { redirect_to alumnis_url, notice: 'Alumni was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @student = Student.find(params[:student_id])\n @lunchdetention = Lunchdetention.find(params[:id])\n @lunchdetention.destroy\n\n respond_to do |format|\n format.html { redirect_to student_url(@student) }\n format.json { head :no_content }\n end\n end", "def destroy\n @examination = Examination.find(params[:id])\n @examination.destroy\n\n respond_to do |format|\n format.html { redirect_to examinations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thesis_examination.destroy\n respond_to do |format|\n format.html { redirect_to thesis_examinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrolled_student = EnrolledStudent.find(params[:id])\n @enrolled_student.destroy\n\n respond_to do |format|\n format.html { redirect_to enrolled_students_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @enroll = Enroll.find(params[:id])\n @enroll.destroy\n render json: JSON.parse({msg:\"success\"}.to_json)\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :ok }\n end\n end", "def destroy\n @student = Student.find(params[:student_id])\n @inschool = Inschool.find(params[:id])\n @inschool.destroy\n\n respond_to do |format|\n format.html { redirect_to student_url(@student) }\n format.json { head :no_content }\n end\n end", "def destroy\n @enroll.destroy\n respond_to do |format|\n format.html { redirect_to enrolls_path, notice: 'Test was successfully destroyed.' }\n format.json { head :no_enroll }\n end\n end", "def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_student.destroy\n respond_to do |format|\n format.html { redirect_to class_students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_interest.destroy\n respond_to do |format|\n format.html { redirect_to student_interests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nurse = Nurse.find(params[:id])\n @nurse.destroy\n\n respond_to do |format|\n format.html { redirect_to nurses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @optician = Optician.find(params[:id])\n @optician.destroy\n\n respond_to do |format|\n format.html { redirect_to opticians_url }\n format.json { head :ok }\n end\n end", "def destroy\n authorize @attorney\n @attorney.destroy\n respond_to do |format|\n format.html { redirect_to attorneys_url, notice: 'Attorney was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\r\n @student1 = Student1.find(params[:id])\r\n @student1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to student1s_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classroom.students.destroy_all\n @classroom.destroy\n respond_to do |format|\n format.html { redirect_to current_user.teacher, notice: 'Classroom was successfully destroyed.' }\n format.json { head :no_content }\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 @first_aid_course = FirstAidCourse.find(params[:id])\n @first_aid_course.destroy\n\n respond_to do |format|\n format.html { redirect_to first_aid_courses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @studentsection.destroy\n respond_to do |format|\n format.html { redirect_to studentsections_url, notice: 'Studentsection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to admin_course_tutorials_path(@course) }\n format.json { head :no_content }\n end\n end", "def destroy\n @enroll.destroy\n respond_to do |format|\n format.html { redirect_to enrolls_url, notice: 'Enroll was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @attorney.destroy\n respond_to do |format|\n format.html { redirect_to attorneys_url, notice: 'Attorney was successfully destroyed.' }\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 @inning = Inning.find(params[:id])\n @inning.destroy\n\n respond_to do |format|\n format.html { redirect_to innings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to login_index_url }\n format.json { head :ok }\n end\n end", "def destroy\n @college = College.find(params[:id])\n @college.destroy\n\n respond_to do |format|\n format.html { redirect_to colleges_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :ok }\n end\n end", "def destroy\n @clinician = Clinician.find(params[:id])\n @clinician.destroy\n\n respond_to do |format|\n format.html { redirect_to clinicians_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @online_student = OnlineStudent.find(params[:id])\n @online_student.destroy\n\n respond_to do |format|\n format.html { redirect_to online_students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n student = @taking.student \n @taking.destroy\n respond_to do |format|\n format.html { redirect_to student, notice: 'Taking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n current_user.enrollments.where(course_id: @course.id).first.destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_url, :flash => { :success => 'Course was successfully deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n @life_insurance.destroy\n\n respond_to do |format|\n format.html { redirect_to life_insurances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_user = ExamUser.find(params[:id])\n @exam_user.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutor = Tutor.find(params[:id])\n @tutor.destroy\n\n respond_to do |format|\n format.html { redirect_to tutors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial_section.destroy\n respond_to do |format|\n format.html { redirect_to tutorial_sections_url, notice: 'Tutorial section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to course_assessments_url(@course), notice: 'Attempt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to course_assessments_url(@course), notice: 'Attempt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7996455", "0.79741395", "0.79579455", "0.7898916", "0.7898916", "0.77079374", "0.76391745", "0.75418645", "0.7397706", "0.7370281", "0.7235165", "0.7205407", "0.7058448", "0.6970631", "0.6963942", "0.6914965", "0.6912169", "0.6902971", "0.6870069", "0.6862512", "0.684864", "0.68456906", "0.683786", "0.6837644", "0.6837644", "0.6837644", "0.6837644", "0.6837644", "0.6831041", "0.6828271", "0.6826819", "0.6818097", "0.679977", "0.67992634", "0.67973644", "0.6791323", "0.67889917", "0.67797714", "0.67729986", "0.67725635", "0.6771713", "0.6755435", "0.6753477", "0.67532194", "0.6751114", "0.6749019", "0.67474324", "0.67250985", "0.67227095", "0.6709826", "0.67029923", "0.67029923", "0.67029923", "0.67029923", "0.66953766", "0.66932076", "0.66925687", "0.6692002", "0.6686343", "0.6683121", "0.66824013", "0.6673785", "0.6672676", "0.6666357", "0.6665191", "0.66604614", "0.6658744", "0.6658635", "0.6658338", "0.66551983", "0.66488886", "0.6648386", "0.66471314", "0.6644397", "0.6638366", "0.6637607", "0.6636119", "0.66341704", "0.6633288", "0.6627701", "0.6625164", "0.6619383", "0.66126025", "0.661194", "0.66102433", "0.6606314", "0.66062146", "0.6604153", "0.66026044", "0.66026044", "0.66026044", "0.66026044", "0.66026044", "0.66026044", "0.66026044", "0.66026044", "0.66010153", "0.659946", "0.6599125", "0.6599125" ]
0.8137119
0
dscl . read /Groups/ladmins
def group_get_info(attribs, dir_info) attribs = group_record_name_alternatives(attribs) check_critical_attribute( attribs, :record_name ) command = {action: 'read', scope: 'Groups', value: nil} user_attrs = attribs.merge(command) dscl( user_attrs, dir_info ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_list\n execute('dscacheutil -q group') do |result|\n groups = []\n result.stdout.each_line do |line|\n groups << line.split(': ')[1].strip if /^name:/.match?(line)\n end\n\n yield result if block_given?\n\n groups\n end\n end", "def get_nodegroups()\n nodemgr_rest_call(\"GET\", \"classifier\", \"groups\", $credentials)\nend", "def list_groups(client, options)\n if !options[:directory].nil?\n directory = client.directories.get options[:directory]\n groups = directory.groups\n else\n puts \"Missing arguments\"\n return\n end\n\n groups.each do |group|\n print_group(group)\n end\nend", "def enum_dom_groups(domain,username,password,dc_ip)\n output = \"#{domain}-groups.txt\"\n puts \"[+] Currently enumerating all domain groups ...\"\n enum = `rpcclient -U \"#{domain}\\\\#{username}%#{password}\" #{dc_ip} -c enumdomgroups | awk -F\"[\" {'print $2'} | awk -F\"]\" {'print $1'} | tee #{output}`\n msg = \"Success! All domain groups have been stored in #{output}\"\n ip_check(dc_ip,enum,msg)\nend", "def list_group_mem(group)\n\t\tdevisor = \"-------------------------------------------------------------------------------\\r\\n\"\n\t\traw_list = client.shell_command_token(\"net localgroup #{group}\").split(devisor)[1]\n\t\taccount_list = raw_list.split(\"\\r\\n\")\n\t\taccount_list.delete(\"The command completed successfully.\")\n\t\treturn account_list\n\tend", "def retrieve_groups_from_ldap\n LdapUser.retrieve_groups self.login\n end", "def list_domain_group_mem(group)\n\t\taccount_list = []\n\t\tdevisor = \"-------------------------------------------------------------------------------\\r\\n\"\n\t\traw_list = client.shell_command_token(\"net groups \\\"#{group}\\\" /domain\").split(devisor)[1]\n\t\traw_list.split(\" \").each do |m|\n\t\t\taccount_list << m\n\t\tend\n\t\taccount_list.delete(\"The command completed successfully.\")\n\t\treturn account_list\n\tend", "def group_get(name)\n execute(\"dscacheutil -q group -a name #{name}\") do |result|\n fail_test \"failed to get group #{name}\" unless /^name: #{name}/.match?(result.stdout)\n gi = {} # group info\n result.stdout.each_line do |line|\n pieces = line.split(': ')\n gi[pieces[0].to_sym] = pieces[1].strip if pieces[1] != nil\n end\n answer = \"#{gi[:name]}:#{gi[:password]}:#{gi[:gid]}\"\n\n yield answer if block_given?\n answer\n end\n end", "def collect_group_details\n cmd = 'lsgroup -a ALL' # get all group names\n result ||= inspec.backend.run_command(cmd)\n return [] if result.exit_status.to_i != 0\n names = result.stdout.split(\"\\n\")\n groups_cache = []\n names.sort.uniq.each do |n|\n groups_cache << AixGroup(inspec, n)\n end\n groups_cache\n end", "def read_groups(pid)\n read_group_field = Hydra.config[:permissions][:read][:group]\n doc = permissions_doc(pid)\n rg = edit_groups(pid) | ((doc == nil || doc.fetch(read_group_field,nil) == nil) ? [] : doc.fetch(read_group_field,nil))\n logger.debug(\"[CANCAN] read_groups: #{rg.inspect}\")\n return rg\n end", "def list\n @groups = Group.find(:all, :order => 'name')\n end", "def groups\n\t\t\t@groups ||= begin\n\t\t\t\tFile.readlines(File.join(@svcdir, 'group')).map { |g| g.strip }\n\t\t\trescue Exception => e\n\t\t\t\t[]\n\t\t\tend\n\t\tend", "def fetch_groups!\n ldap_groups.map do |dn|\n /^cn=([^,]+),/i.match(dn)[1]\n end\n end", "def get_groups\n `id -nG #{name}`.split(' ')\n end", "def read_groups\n read_group_field = Hydra.config[:permissions][:read][:group]\n rg = edit_groups | ((@permissions_solr_document == nil || @permissions_solr_document.fetch(read_group_field,nil) == nil) ? [] : @permissions_solr_document.fetch(read_group_field,nil))\n logger.debug(\"read_groups: #{rg.inspect}\")\n return rg\n end", "def get_users\n #users = []\n static_admins=[\"root\", \"n8\", \"daemon\", \"puppet\", \"nobody\"]\n userlist=`/usr/bin/dscl . -list /users`.split(\" \").slice(1..-1)-static_admins\n userlist.grep(/^[a-z]/) { |u| puts u }\nend", "def priv_groups(domain,username,password,dc_ip)\n groupArr = [\"Domain Admins\",\"Enterprise Admins\",\"Administrators\"]\n groupArr.each {|group| enum_group_membership(domain,username,password,dc_ip,group)}\n\n priv_groups = Array.new\n\n groupArr.each do |group|\n groupFormatted = group.gsub(' ','-')\n file = \"#{domain}-#{groupFormatted}.txt\"\n r = File.open(file)\n r.each_line {|line| priv_groups.push line.split(\"\\\\\")[1].chomp}\n end\n\n priv_groups.sort!.uniq!\n\n for i in 0 .. priv_groups.length-1 do\n group = priv_groups[i].to_s\n puts \"\"\n puts \"[+] Searching for users in the group #{group}\"\n enum_group_membership(domain,username,password,dc_ip,group)\n end\nend", "def get_group\n send_request(FUNCTION_GET_GROUP, [], '', 4, 'k4')\n end", "def read ()\n groups_validate\n\n gid = @options[:groupId]\n\n client = GroupsClient.new\n client.api_token = @options[:api_token]\n client.app_url = @options[:app_url]\n\n resp = client.read( gid)\n print_json resp\n end", "def list\n @session[:clustername]=nil\n @session[:clustername1]=nil\n @group_pages, @groups = paginate :groups, :per_page => 10\n end", "def get_hosts netgroup\n hosts = []\n # Bind RO to ldap for recursive searching netgroup. FIXME: hardcoded\n auth = { :method => :simple, :username => 'uid=network,ou=Netgroup,dc=catnip', :password => 'sedLdapPassword' }\n Net::LDAP.open(:host => 'ldap.cat.pdx.edu', :port => 636, :auth => auth, :encryption => :simple_tls) do |ldap|\n filter = Net::LDAP::Filter.eq( \"cn\", netgroup )\n attrs = [\"nisNetgroupTriple\",\"memberNisNetgroup\"]\n ldap.search(:base => 'ou=Netgroup,dc=catnip', :filter => filter, :attributes => attrs) do |entry|\n [*entry[\"nisNetgroupTriple\"]].each do |triple|\n host = (/([-\\w]+\\.)+\\w+/.match(triple)).to_s\n hosts << host unless host == \"\"\n end\n [*entry[\"memberNisNetgroup\"]].each do |memberNetgroup|\n hosts += get_hosts(memberNetgroup) #get subgroups\n end\n end\n end\n return hosts\nend", "def getGroups()\n\n groups = YAML.load_file(@GROUPSFILE)\n groupsS = []\n for i in 0..groups.size\n groupsS <= groups[i]\n end\n return groupsS\n\n end", "def groups_list(trace: false, &block)\n r = dropbox_query(query: '2/team/groups/list', trace: trace)\n r['groups'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team/groups/list/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['groups'].each(&block)\n end\n end", "def index\n @groups = @flr.groups.all\n end", "def hc_group_list(id)\n org=Org.find(id)\n org.hc_groups.group_list\n end", "def get_groups\n res = search(@config[:groupdn])\n \n if (res[:message] != \"Success\")\n # tbd handle error\n return nil\n end\n \n if (res[:values] == [])\n return nil\n end\n \n groups = []\n \n res[:values].each do |group|\n groups << group.cn.first\n end\n \n return groups\n end", "def groups\n g = File.join(@root,'groups')\n FileUtils.mkdir_p g\n Dir.chdir(File.join(@root,'groups')) do\n Dir['*']\n end\n end", "def read_groups_string\n read_groups.join(', ')\n end", "def group_gid(name)\n gid = -1\n execute(\"dscacheutil -q group -a name #{name}\") do |result|\n result.stdout.each_line do |line|\n if /^gid:/.match?(line)\n gid = (line[5, line.length - 5]).chomp\n break\n end\n end\n gid\n end\n end", "def list(response)\n requested_group = response.args[1]\n output = get_groups_list(response.args[1])\n if output.empty?\n response.reply(empty_state_for_list(requested_group))\n else\n response.reply(output.join(\"\\n\"))\n end\n end", "def index\n @labgroups = Labgroup.all\n end", "def find_group(onms_home, name)\n file_name = nil\n Dir.foreach(\"#{onms_home}/etc/datacollection\") do |group|\n next if group !~ /.*\\.xml$/\n file = ::File.new(\"#{onms_home}/etc/datacollection/#{group}\", 'r')\n doc = REXML::Document.new file\n file.close\n exists = !doc.elements[\"/datacollection-group[@name='#{name}']\"].nil?\n if exists\n file_name = \"#{onms_home}/etc/datacollection/#{group}\"\n break\n end\n end\n file_name\n end", "def getAnts(groupName)\n\n result = `/home/obs/ruby/bin/fxconf.rb sals`\n\n list = [];\n\n # Get the antennas in the \"groupName\" group\n result.each do |line| \n line = line.chomp.strip; \n if(line.include?(groupName) == true) \n parts = line.chomp.split(/\\s+/);\n parts[1..-1].each do |a|\n list << Ant.new(a);\n end\n end\n end \n return list; \nend", "def [] name\n @groups ||= {}\n root = File.join(@root,'groups',name)\n rel_root = @rel_root.nil? ? root : File.join(@rel_root,'groups',name)\n FileUtils.mkdir_p(root)\n return @groups[name] if @groups[name]\n db = DB.new(root,rel_root,self)\n db.use_not_found = self.use_not_found\n return (@groups[name] = db)\n end", "def groups; end", "def groups; end", "def groups; end", "def show_groups\n content = Accio::Parser.read\n content.groups.each do |group|\n puts \"#{group.title}\\n\"\n end\n end", "def read_ld_output_file(ldfile)\n snp_lds = Array.new\n\n begin\n File.open(ldfile, \"r\") do |file|\n file.each_line do |oline|\n oline.each_line(\"\\r\") do |line|\n next if line =~ /^\\n$/\n if line =~ /LOD/\n next\n end\n\n data=strip_and_split(line) \n snp_lds << SNPCombination.new(data[0], data[1], data[2], data[3], data[4])\n end\n end\n end\n rescue StandardError => e\n puts e\n exit(1)\n end\n return snp_lds\n\n end", "def read_groups\n search_by_type_and_mode(:group, ::ACL.Read).map(&:agent_name)\n end", "def print_members(p)\n puts p.getNetid + ':'\n DSpace.create(p).groups.each { |g| puts \"\\t#{g.getName}\" }\nend", "def groups\n if groups_last_update.blank? || ((Time.now - groups_last_update) > 24 * 60 * 60)\n return groups!\n end\n group_list.split(\";?;\")\n end", "def groups\n match(/Groups\\s+:\\s+(.+)$/).split rescue []\n end", "def getGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"get\",\"/group\",params)\n end", "def build_cdm_list\r\n cdm_solo_str = `grep \"^node\" /etc/puppet/manifests/site.pp |grep 'am-'|awk '{print $2}' | sed \"s/\\'//g\" |sed \"s/\\.us\\.gsoa\\.local//g\"`\r\n cdm_cal_str = `grep \"^node\" /etc/puppet/manifests/site.pp |grep 'amc'|awk '{print $2}' | sed \"s/\\'//g\" |sed \"s/\\.us\\.gsoa\\.local//g\"`\r\n cdm_multi_str = `grep \"am-\" /etc/puppet/manifests/site.pp | grep \":\" |grep -v \"#\" | sed 's/\\\"//g'| sed \"s/://g\"`\r\n\r\n cdm_solo_arr = cdm_solo_str.split.sort!\r\n cdm_cal_arr = cdm_cal_str.split.sort!\r\n cdm_multi_arr = cdm_multi_str.split.sort!\r\n\r\n # check if ssh to the host is working\r\n cdm_solo_arr.each do |cdm|\r\n cmd=\"ssh -o 'PreferredAuthentications=publickey' root@\"+cdm + \" hostname >/dev/null 2>&1\"\r\n if !(system(cmd)) then\r\n cdm_solo_arr -= [cdm]\r\n end\r\n end\r\n cdm_cal_arr.each do |cdm|\r\n cmd=\"ssh -o 'PreferredAuthentications=publickey' root@\"+cdm + \" hostname >/dev/null 2>&1\"\r\n if !(system(cmd)) then\r\n cdm_cal_arr -= [cdm]\r\n end\r\n end\r\n\r\n # check if any cdm is a multiT\r\n cdm_solo_arr.each do |cdm|\r\n cmd = \"ssh root@\"+cdm+\" sm_service show >/dev/null 2>&1\"\r\n if (system(cmd)) then\r\n cmd = \"ssh root@\"+cdm+\" sm_service show |grep namespace >/dev/null 2>&1\"\r\n if (system(cmd)) then\r\n cdm_solo_arr -= [cdm]\r\n cdm_multi_arr += [cdm]\r\n end\r\n end\r\n end\r\n\r\n File.open(\"/root/smangam/cdm_solo.txt\",\"w\") do |f|\r\n f.puts cdm_solo_arr\r\n f.close\r\n end\r\n File.open(\"/root/smangam/cdm_cal.txt\",\"w\") do |f|\r\n f.puts cdm_cal_arr\r\n f.close\r\n end\r\n File.open(\"/root/smangam/cdm_multi.txt\",\"w\") do |f|\r\n f.puts cdm_multi_arr\r\n f.close\r\n end\r\nend", "def show(id:)\n id_check('id', id)\n\n cf_get(path: \"/zones/#{zone_id}/firewall/waf/packages/#{package_id}/groups/#{id}\")\n end", "def ruby_class_personnel\n # find group in group.txt\n ruby_group = ruby_group_raw_data.find { |line| line.start_with?('c74686')}\n\n # clean up group.txt file data\n members = ruby_group.split(':').slice(3).strip\n\n # turn data into array of member names\n members = members.split(',')\n end", "def group\n Group.get!(gidnumber)\n end", "def do_list_groups()\n I18n.t(\"sms.some_groups\") + \": \" + Group.primary_group_abbrevs\n end", "def show\n @group = @course.groups.find(params[:id])\n end", "def user_group_membership(domain,username,password,dc_ip,user)\n output = \"#{domain}-#{user}-groups.txt\"\n enum = `net rpc user info #{user} -U \"#{domain}\\\\#{username}%#{password}\" -S #{dc_ip}`\n puts \"[+] Currently identifying groups that #{user} is a member of ...\"\n\n if enum.length == 0\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the user #{user} does not exist\"\n elsif enum.length == 1\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the user #{user} does not exist\"\n else\n enum = `net rpc user info #{user} -U \"#{domain}\\\\#{username}%#{password}\" -S #{dc_ip} | tee #{output}`\n puts enum\n puts \"[+] Success! All groups that #{user} is a member of has been stored in #{output}\"\n end\nend", "def ldap_group_list(refresh = false, separator = \"\\n\")\n @ldap_group_list = nil if refresh\n @ldap_group_list ||= ldap_groups(refresh).map{|v| v.name.upcase}.join(separator)\n end", "def get(id, which=:groups)\n resp = self.class.get(\"/#{which}/#{id}\")\n check_errors resp\n res = resp.parsed_response['Response']['Entry']\n rebuild_groups! res\n res\n end", "def get_tg\n raise ZFS::NotFound, \"no such lu #{@name}\" unless exist?\n\n cmd = [ZFS::STMFADM_PATH] + [\"list-view\", \"-l\", @name]\n out, status = Open3.capture2e(*cmd)\n if status.success?\n out.lines.collect do |line|\n if line.include? \"Target Group\"\n return TargetGroup.new(line.split[3])\n end\n end\n end\n nil\n end", "def refresh!\n response = Wucluster.ec2.describe_security_groups(:group_name => id)\n update! response.securityGroupInfo.item.first\n end", "def list_user(param = '1110')\n @group_users.each { |item| puts item.info(param) }\n end", "def index\n @groups = current_trainer.groups\n end", "def index\n @lexicon_groups = @current_user.lexicon_groups.page params[:page]\n end", "def directory_group\n res = nil\n Group.role_names_for(user).each do |role_name|\n if Filesystem.test_dir role_name, self, :read\n res = File.stat(path_for(role_name: role_name)).gid\n break if res\n end\n end\n res\n end", "def user_in_group?(attribs, dir_info)\n temp = user_record_name_alternatives(attribs)\n username = temp[:record_name]\n # pp username\n # pp attribs\n\n attribs = group_record_name_alternatives(attribs)\n # groupname = attribs[:record_name]\n attribs[:value] = username\n # pp attribs\n\n check_critical_attribute( attribs, :value, :username )\n check_critical_attribute( attribs, :record_name, :groupname )\n attribs = tidy_attribs(attribs)\n\n command = {action: 'read', scope: 'Groups', attribute: nil, value: nil}\n cmd_attribs = attribs.merge(command)\n\n dscl( cmd_attribs, dir_info )\n end", "def groups()\n\t\t\tend", "def discover_groups\n search_by_type_and_mode(:group, Hydra::ACL.Discover).map(&:agent_name)\n end", "def get_anodes()\n nodes = [] ; 1.upto(32){|i|nodes << \"compute-0-#{i}\"}\n run_cluster(nodes, \"uptime\").map{|e|[e[0], e[1].scan(/\\d\\.\\d\\d/)[0].to_f, e[2]]}.sort_by{|e|e[1]} \nend", "def is_in_group_name\n returnGroup = []\n group = query_root_node(\"fao:isInGroup/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s.split(\"/\")[7]\n end\n end\n returnGroup\n end", "def groups\n hyrax_groups.map(&:name)\n end", "def show_group\n group_name = params[:name]\n @group = $iam.groups[group_name]\n @users = @group.users\n @policies = @group.policies\n end", "def hc_group_list_all(id)\n org=Org.find(id)\n org.hc_groups.all(:order=>'group_name')\n end", "def fetch_log_groups(client)\n logger.info('fetching log groups')\n log_groups = []\n next_token = nil\n\n begin\n options = { next_token: next_token }\n resp = client.describe_log_groups(options)\n log_groups += resp.log_groups\n next_token = resp.next_token\n end while next_token\n log_groups\n end", "def access\n data = Array.new\n rds.security_groups.each do |group|\n group.ec2_security_groups.each do |group_access|\n data << [group.id, group_access['EC2SecurityGroupName'] + ' @ ' + group_access['EC2SecurityGroupOwnerId'], group_access['Status']]\n end\n group.ip_ranges.each do |ip_range|\n data << [group.id, ip_range['CIDRIP'], ip_range['Status']]\n end\n data\n end\n begin\n require 'hirb'\n puts Hirb::Helpers::AutoTable.render(data, :headers => ['Security Group', 'IP Range/Security Group', 'Status'])\n rescue LoadError\n data.unshift ['SECURITY GROUP', 'IP RANGE / SECURITY GROUP', 'STATUS']\n lengths = (0..2).map { |i| data.map { |d| d[i].length }.max }\n puts data.map { |d| '%-*s %-*s %-*s' % [lengths[0], d[0], lengths[1], d[1], lengths[2], d[2]] }.join(\"\\n\")\n end\n end", "def groups\n\t\t\t@groups ||= Group.find(:all, :distinguishedname => @entry.memberOf)\n\t\tend", "def enum_group_membership(domain,username,password,dc_ip,group)\n cmd = `rpcclient -U '#{domain}\\\\\\\\#{username}%#{password}' #{dc_ip} -c lsaquery | head -n 1`\n\n groupFormatted = group.gsub(' ','-')\n output = \"#{domain}-#{groupFormatted}.txt\"\n enum = `net rpc group members \"#{group}\" -I #{dc_ip} -U \"#{domain}\\\\#{username}%#{password}\"`\n\n if enum.length == 0\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the group #{group} does not exist\"\n puts \"[+] Checking to see if #{group} is actually a user account\"\n user_group_membership(domain,username,password,dc_ip,group)\n #abort\n elsif enum.length == 1\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the group #{group} does not exist\"\n puts \"[+] Checking to see if #{group} is actually a user account\"\n user_group_membership(domain,username,password,dc_ip,group)\n #abort\n else\n enum = `net rpc group members \"#{group}\" -I #{dc_ip} -U \"#{domain}\\\\#{username}%#{password}\" | tee #{output}`\n puts enum\n puts \"[+] Success! Members which are in the #{group} group have been stored in #{output}\"\n end\nend", "def groups\n if (groups_last_update.blank? || ((Time.now-groups_last_update) > 24*60*60 ))\n return groups!\n end\n return self.group_list.split(\";?;\")\n end", "def groups\n if (groups_last_update.blank? || ((Time.now-groups_last_update) > 24*60*60 ))\n return groups!\n end\n return self.group_list.split(\";?;\")\n end", "def get_attribute_group(id)\n @client.raw('get', \"/config/attribute-groups/#{id}\")\n end", "def find_groupid(group_name)\n number = ldap.search(:base => group_dn, :filter => \"cn=#{group_name}\")\n gid = []\n number.each do |result|\n gid = result[:gidnumber][0]\n end\n gid\n end", "def gid_next\n gid_last = execute(\"dscl . -list /Groups PrimaryGroupID | sort -k 2 -g | tail -1 | awk '{print $2}'\")\n gid_last.to_i + 1\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 is_in_group_url\n returnGroup = []\n group = query_root_node(\"fao:isInGroup/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s\n end\n end\n returnGroup\n end", "def i_groups; end", "def load_groups\n @groups = Group.order(:name)\n end", "def extract_group_links\n # this one works to extract the group node container:\n #\n # group_list_node = mahara_dashboard_page.css('#groups').each do |node|\n # ...\n # end\n #\n # However, I decided to go the easy way here with some knowledge on how the url must look like\n\n return @mahara_dashboard_page.links_with(:href => /mahara\\/group\\/view/)\n end", "def groups\n find_groups if @groups.nil?\n @groups\n end", "def test_get_ad_group\n test_add_ad_group_cpc() unless @ad_group\n selector = @ad_group_srv.module::AdGroupSelector.new\n selector.adGroupIds = [@ad_group.id]\n response = @ad_group_srv.get(selector)\n assert_not_nil(response.rval.entries, 'Empty result set returned')\n assert_equal(1, response.rval.entries.size,\n 'Unexpected number of entries returned')\n assert_equal(@ad_group.id, response.rval.entries.first.id)\n end", "def get_group_by_id(id)\n $r.hgetall(\"group:#{id}\")\n end", "def key\n 'groupid'\n end", "def list_groups\n BrickFTP::API::Group.all\n end", "def list_groups\n BrickFTP::API::Group.all\n end", "def slapd_db_config_file\n Dir[\"#{node['ca_openldap']['config_dir']}/cn=config/olcDatabase=\\{*\\}{#{ node['ca_openldap']['db_backend'] }}.ldif\"].first\n end", "def all_scheduled(db)\r\n\t\tall_array=[]\r\n\t\tall_array = db.execute(\"SELECT * FROM playgroups\")\r\n\t\tall_array.each do |i|\r\n\t\t\tputs \"Host:#{i[1]}, Location:#{i[3]}, Kids attending:#{i[2]}\"\r\n\t\tend\t\t\r\n\tend", "def ldap\n conf['dashboard']['ldap']\n end", "def group_members_list(external_group_id: nil, group_id: nil, trace: false, &block)\n if group_id != nil\n group_query = \"{\\\"group\\\":{\\\".tag\\\":\\\"group_id\\\",\\\"group_id\\\":\\\"#{group_id}\\\"}}\"\n elsif external_group_id != nil\n group_query = \"{\\\"group\\\":{\\\".tag\\\":\\\"group_external_id\\\",\\\"group_external_id\\\":\\\"#{external_group_id}\\\"}}\"\n else\n return nil\n end\n r = dropbox_query(query: '2/team/groups/members/list', query_data: group_query, trace: trace)\n r['members'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team/groups/members/list/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['members'].each(&block)\n end\n end", "def parse(id)\n regex = /.+\\/resourceGroups\\/([^\\/]+)\\/providers\\/Microsoft.Network\\/networkSecurityGroups\\/([^\\/]+)\\/securityRules\\/([^\\/]+).*/\n captures = regex.match(id).captures\n {group: captures[0], nsg: captures[1], name: captures[2]}\nend", "def group_absent(name, &block)\n execute(\"if dscl . -list /Groups/#{name}; then dscl . -delete /Groups/#{name}; fi\", {}, &block)\n end", "def extract_group_members(grouplink, groupname)\n mahara_group_overview_page = @agent.get(grouplink)\n # selecting group member page ...\n mahara_group_members_page_1 = mahara_group_overview_page.link_with(:href => /mahara\\/group\\/members/).click\n # selecting complete view of members\n form = mahara_group_members_page_1.form_with(:class => 'form-pagination js-pagination form-inline pagination-page-limit dropdown')\n PortfolioAnalyzerTools.select_option(form, 'setlimitselect', '500')\n mahara_group_members_page_2 = form.submit\n\n # extract members\n main_column = mahara_group_members_page_2.css('div.main-column')[0]\n # an alternative, more general approach might be: mahara_group_members_page_2.css('div.list-group-item').each do |row|\n\n group_members = extract_members(main_column, grouplink, groupname)\n end", "def test_ldif\n File.open( TestLdifFilename, \"r\" ) {|f|\n ds = Net::LDAP::Dataset::read_ldif( f )\n assert_equal( 13, ds.length )\n }\n end", "def members(group)\n reload\n @group[group] || []\n end", "def get_node_group_by_name(node_group_name, http)\n # Get all node groups from the REST API\n all_node_groups_json = get_rest_api('groups', http)\n all_node_groups_hash = JSON.parse(all_node_groups_json)\n\n # Search the list of node groups for the specified group.\n group = {}\n all_node_groups_hash.each do |g|\n if node_group_name.eql? g['name']\n group = g # found group hash in json response\n next\n end\n end\n\n # If we didn't find the group, something went horribly wrong.\n # Print out a message and exit.\n if group.empty?\n puts \"Node group #{group_name} doesn't exist.\"\n exit 1\n end\n\n # Return the group if we found it.\n group\nend", "def leaderboards\n GameLeaderboard.leaderboards @short_name\n end", "def gid() end", "def list_groups()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/groups\", { \n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com' \n }\n })\n return JSON.parse response.read_body\n end" ]
[ "0.5869755", "0.5858927", "0.58041286", "0.57643944", "0.5731714", "0.5700018", "0.56217474", "0.55706805", "0.55501926", "0.54923594", "0.54857326", "0.54787624", "0.5444364", "0.5424681", "0.54155844", "0.53593093", "0.53563887", "0.5346893", "0.53294224", "0.53145015", "0.530193", "0.52798975", "0.52590114", "0.52451277", "0.5227019", "0.52254665", "0.5217736", "0.5206417", "0.5206039", "0.5178066", "0.5170634", "0.5153124", "0.51370996", "0.5133448", "0.5132507", "0.5132507", "0.5132507", "0.5128783", "0.51212734", "0.511915", "0.5100093", "0.50988626", "0.50888866", "0.50853825", "0.5081967", "0.50673157", "0.50643474", "0.5059709", "0.5036679", "0.5030327", "0.5029495", "0.5024279", "0.5023684", "0.5016228", "0.50060153", "0.5005404", "0.50027645", "0.49820822", "0.49756274", "0.4968333", "0.49670014", "0.49669507", "0.49579224", "0.49532357", "0.4937812", "0.4937213", "0.4922465", "0.49122837", "0.49068347", "0.4906271", "0.4902503", "0.49001712", "0.49001712", "0.48891518", "0.4887456", "0.48829883", "0.48796275", "0.4871287", "0.48706046", "0.48533642", "0.4853009", "0.4847055", "0.48435593", "0.48411244", "0.4838442", "0.48355496", "0.48355496", "0.48305812", "0.4826205", "0.4824856", "0.48152068", "0.48134384", "0.48126367", "0.4809649", "0.48004466", "0.4793579", "0.47891673", "0.47881433", "0.4787717", "0.47876295" ]
0.61652225
0
dscl . read /Groups/ladmins TODO: switch to dseditgroup o checkmember m username groupname dseditgroup o checkmember m btihen employee yes btihen is a member of employee dseditgroup o checkmember m btihen student no btihen is NOT a member of student
def user_in_group?(attribs, dir_info) temp = user_record_name_alternatives(attribs) username = temp[:record_name] # pp username # pp attribs attribs = group_record_name_alternatives(attribs) # groupname = attribs[:record_name] attribs[:value] = username # pp attribs check_critical_attribute( attribs, :value, :username ) check_critical_attribute( attribs, :record_name, :groupname ) attribs = tidy_attribs(attribs) command = {action: 'read', scope: 'Groups', attribute: nil, value: nil} cmd_attribs = attribs.merge(command) dscl( cmd_attribs, dir_info ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def priv_groups(domain,username,password,dc_ip)\n groupArr = [\"Domain Admins\",\"Enterprise Admins\",\"Administrators\"]\n groupArr.each {|group| enum_group_membership(domain,username,password,dc_ip,group)}\n\n priv_groups = Array.new\n\n groupArr.each do |group|\n groupFormatted = group.gsub(' ','-')\n file = \"#{domain}-#{groupFormatted}.txt\"\n r = File.open(file)\n r.each_line {|line| priv_groups.push line.split(\"\\\\\")[1].chomp}\n end\n\n priv_groups.sort!.uniq!\n\n for i in 0 .. priv_groups.length-1 do\n group = priv_groups[i].to_s\n puts \"\"\n puts \"[+] Searching for users in the group #{group}\"\n enum_group_membership(domain,username,password,dc_ip,group)\n end\nend", "def user_group_membership(domain,username,password,dc_ip,user)\n output = \"#{domain}-#{user}-groups.txt\"\n enum = `net rpc user info #{user} -U \"#{domain}\\\\#{username}%#{password}\" -S #{dc_ip}`\n puts \"[+] Currently identifying groups that #{user} is a member of ...\"\n\n if enum.length == 0\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the user #{user} does not exist\"\n elsif enum.length == 1\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the user #{user} does not exist\"\n else\n enum = `net rpc user info #{user} -U \"#{domain}\\\\#{username}%#{password}\" -S #{dc_ip} | tee #{output}`\n puts enum\n puts \"[+] Success! All groups that #{user} is a member of has been stored in #{output}\"\n end\nend", "def enum_group_membership(domain,username,password,dc_ip,group)\n cmd = `rpcclient -U '#{domain}\\\\\\\\#{username}%#{password}' #{dc_ip} -c lsaquery | head -n 1`\n\n groupFormatted = group.gsub(' ','-')\n output = \"#{domain}-#{groupFormatted}.txt\"\n enum = `net rpc group members \"#{group}\" -I #{dc_ip} -U \"#{domain}\\\\#{username}%#{password}\"`\n\n if enum.length == 0\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the group #{group} does not exist\"\n puts \"[+] Checking to see if #{group} is actually a user account\"\n user_group_membership(domain,username,password,dc_ip,group)\n #abort\n elsif enum.length == 1\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the group #{group} does not exist\"\n puts \"[+] Checking to see if #{group} is actually a user account\"\n user_group_membership(domain,username,password,dc_ip,group)\n #abort\n else\n enum = `net rpc group members \"#{group}\" -I #{dc_ip} -U \"#{domain}\\\\#{username}%#{password}\" | tee #{output}`\n puts enum\n puts \"[+] Success! Members which are in the #{group} group have been stored in #{output}\"\n end\nend", "def ruby_class_personnel\n # find group in group.txt\n ruby_group = ruby_group_raw_data.find { |line| line.start_with?('c74686')}\n\n # clean up group.txt file data\n members = ruby_group.split(':').slice(3).strip\n\n # turn data into array of member names\n members = members.split(',')\n end", "def is_in_group_name\n returnGroup = []\n group = query_root_node(\"fao:isInGroup/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s.split(\"/\")[7]\n end\n end\n returnGroup\n end", "def enum_dom_groups(domain,username,password,dc_ip)\n output = \"#{domain}-groups.txt\"\n puts \"[+] Currently enumerating all domain groups ...\"\n enum = `rpcclient -U \"#{domain}\\\\#{username}%#{password}\" #{dc_ip} -c enumdomgroups | awk -F\"[\" {'print $2'} | awk -F\"]\" {'print $1'} | tee #{output}`\n msg = \"Success! All domain groups have been stored in #{output}\"\n ip_check(dc_ip,enum,msg)\nend", "def checkGroupFileAccess(groupName, fToAccess, fAccess)\n\n if File.exist?(fAccess)\n\n fileProps = YAML.load_file(fAccess)\n\n fileGroups = fileProps[\"groups\"]\n if(fileGroups.index(\";guests;\") != nil || fileGroups.index(\";#{groupName};\") != nil)\n return true\n else\n return false\n end\n end\n return false\n end", "def group_get_info(attribs, dir_info)\n attribs = group_record_name_alternatives(attribs)\n\n check_critical_attribute( attribs, :record_name )\n\n command = {action: 'read', scope: 'Groups', value: nil}\n user_attrs = attribs.merge(command)\n\n dscl( user_attrs, dir_info )\n end", "def extract_group_members(grouplink, groupname)\n mahara_group_overview_page = @agent.get(grouplink)\n # selecting group member page ...\n mahara_group_members_page_1 = mahara_group_overview_page.link_with(:href => /mahara\\/group\\/members/).click\n # selecting complete view of members\n form = mahara_group_members_page_1.form_with(:class => 'form-pagination js-pagination form-inline pagination-page-limit dropdown')\n PortfolioAnalyzerTools.select_option(form, 'setlimitselect', '500')\n mahara_group_members_page_2 = form.submit\n\n # extract members\n main_column = mahara_group_members_page_2.css('div.main-column')[0]\n # an alternative, more general approach might be: mahara_group_members_page_2.css('div.list-group-item').each do |row|\n\n group_members = extract_members(main_column, grouplink, groupname)\n end", "def get_phd_groups(ldap:, users_groups: )\n # Get all the PhD's, which will include last years ones too, and these will have no paper.\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'group' ) & Net::LDAP::Filter.eq('cn', '*phd*.now')\n treebase = 'OU=now,OU=Groups,dc=UoA,dc=auckland,dc=ac,dc=nz'\n\n ldap.search( base: treebase, filter: filter, attributes: [ 'member' ] ) do |entry|\n # group = entry.dn.split(',')[0].split('=')[1].split('.')[0]\n entry.each do |attribute, values|\n next unless attribute =~ /^member/ # Getting empty member attributes, and new attribute: member;range=0-xxxx, as this group is large.\n\n values.each do |value|\n member = value.split('=')[1].split(',')[0]\n users_groups[member] ||= [] # If this is the users first group, then create an Array\n end\n end\n end\n\n # Get the PhD's again, this time by level 8 paper, so we can determine the Faculty.\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'group' ) & Net::LDAP::Filter.eq('cn', '*.8*.now')\n treebase = 'OU=now,OU=Groups,dc=UoA,dc=auckland,dc=ac,dc=nz'\n\n ldap.search( base: treebase, filter: filter, attributes: [ 'member' ] ) do |entry|\n group_pieces = entry.dn.split('=')[1].split(',')[0].split('.')\n if group_pieces.length > 2 # Want only the courses, not stray groups with 898 in their names.\n group = group_pieces[0]\n entry['member'].each do |value| # PhD groups small enough, so no member;range attributes.\n member = value.split('=')[1].split(',')[0]\n users_groups[member] ||= [] # If this is the users first group, then create an Array\n # Add this group to this users group Array, only if group not already in Array\n group_def = @course_codes_to_faculty[group]\n if (group_def != nil && (faculty = group_def['faculty'])) != nil && faculty != '' && users_groups[member].include?(faculty) == false\n users_groups[member] << faculty\n end\n end\n end\n end\nend", "def member_from_group_id(group_id)\n #scrap first page\n begin\n puts \"fetching group ID #{group_id}\"\n members = flickr.groups.members.getList(:group_id => \"#{group_id}\")\n members.each do |m|\n #store member\n save_member(m, group_id)\n end\n #scrap next page\n total_pages = members.pages\n current_page = 2\n while current_page <= total_pages\n begin\n puts \"fetching at current page #{current_page} of group id #{group_id}\"\n members = flickr.groups.members.getList(:group_id => \"#{group_id}\", :page => current_page)\n members.each do |m|\n save_member(m, group_id)\n end\n rescue => e\n write_to_log(e)\n write_to_log(\"fetching at current page #{current_page} of group id #{group_id}\")\n end\n current_page = current_page + 1\n end\n rescue => e\n write_to_log(e)\n end\n end", "def accessInheritedFromGroup(userName, fToAccess)\n fAccess = File.absolute_path(fToAccess)+\".access\"\n\n if File.exist?(fAccess)\n fileProps = YAML.load_file(fAccess)\n\n fileUsers = fileProps[\"users\"]\n if(fileUsers.index(userName) != nil)\n return false\n end\n fileGroups = fileProps[\"groups\"]\n if(fileGroups.index(\";guests;\") != nil)\n return true\n end\n user = YAML.load_file(@CONFIG_ROOT+@CONFIG_REST_PATH+userName+\"Profile.properties\")\n\n groups = Array.new\n groupFound = true\n groupAt = 0\n while groupFound do\n\n if(user.key?(\"group#{groupAt}\"))\n\n groupTmp = user[\"group#{groupAt}\"]\n groups << groupTmp\n groupAt = groupAt.next\n else\n groupFound= false\n end\n end\n\n for i in 0..groups.size\n if(fileGroups.index(\";#{groups.get(i)};\") != nil)\n return true\n end\n end\n return false\n end\n return false\n end", "def extract_members(main_column, grouplink, groupname, is_group_search=true)\n group_members = []\n main_column.css('div.list-group-item').each do |row|\n student = nil\n a = row.css('a')[0]\n link = a['href']\n name = a.text.strip\n img = row.css('img')[0]\n img_src = img['src']\n span = row.css('span')[1]\n if (span.text.to_s.include? 'Teilnehmer' or not is_group_search) then\n puts \"adding \" + name + \": \" + link + \", src=\" + img_src\n member = MaharaMember.new(name, link, groupname, grouplink)\n group_members << member\n end\n end\n group_members\n end", "def fetch_groups!\n ldap_groups.map do |dn|\n /^cn=([^,]+),/i.match(dn)[1]\n end\n end", "def get_staff_groups(ldap:, users_groups:)\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'group' ) & Net::LDAP::Filter.eq('cn', '*.staff.uos')\n treebase = 'dc=UoA,dc=auckland,dc=ac,dc=nz'\n\n ldap.search( base: treebase, filter: filter, attributes: [ 'member' ] ) do |entry|\n # eg CN=SCIFAC.staff.uos,OU=uos,OU=Groups,DC=UoA,DC=auckland,DC=ac,DC=nz\n group = entry.dn.split(',')[0].split('=')[1].split('.')[0]\n entry.each do |attribute, values|\n next unless attribute =~ /^member/ # Getting empty member attributes, and new attribute: member;range=0-XXXX for SCIFAC and MEDFAC.\n\n values.each do |value|\n member = value.split('=')[1].split(',')[0]\n users_groups[member] ||= [] # If this is the users first group, then create an Array\n # Add this group to this users group Array, only if group not already in Array\n group_def = @academic_department_code_to_faculty[group]\n if (group_def != nil && (faculty = group_def['faculty'])) != nil && faculty != '' && users_groups[member].include?(faculty) == false\n users_groups[member] << faculty\n end\n end\n end\n end\nend", "def atest_ID_25874_user_follows_a_group_you_manage()\n login_as_user1\n read_all_updates\n groupName = create_any_new_group(\"Open Group\", \"News\")\n logout_common\n login_as_user2\n read_all_updates\n find_a_group(\"#{groupName}\")\n follow_a_group\n logout_common\n login_as_user1\n verify_updates\n end", "def find_group (student, cohort)\n groups = acct_groups1(cohort)\n p \"#{student} is in group #{groups[student][1]}\"\nend", "def test_group\n \n user = @user_1\n group = 'customer-test'\n \n assert (not @crowd.group_member? user.name, group), \"#{user.name} is already a member of group #{group}\"\n\n @crowd.add_user_to_group user.name, group \n assert (@crowd.group_member? user.name, group) \n\n groups = @crowd.find_group_memberships user.name\n assert (groups.length > 0)\n assert (groups.include? group)\n\n @crowd.remove_user_from_group user.name, group \n assert (not @crowd.group_member? user.name, group)\n\n groups_after_remove = @crowd.find_group_memberships user.name\n\n # ensure the user in one less group \n assert_equal groups.length - 1, groups_after_remove.length\n \n end", "def read_groups(pid)\n read_group_field = Hydra.config[:permissions][:read][:group]\n doc = permissions_doc(pid)\n rg = edit_groups(pid) | ((doc == nil || doc.fetch(read_group_field,nil) == nil) ? [] : doc.fetch(read_group_field,nil))\n logger.debug(\"[CANCAN] read_groups: #{rg.inspect}\")\n return rg\n end", "def is_in_group_url\n returnGroup = []\n group = query_root_node(\"fao:isInGroup/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s\n end\n end\n returnGroup\n end", "def group?(group)\n\t\t\t\treturn(infile(group, '/etc/group'))\n\t\t\tend", "def list_member_groups(member, options = {})\n list = \"\"\n sep = \"\"\n if options[:group_list]\n group_list = options[:group_list] \n cnt = group_list.length\n \n if member.total_reviews > 0 && member.status == 'member'\n if !member.awards.blank? && member.awards.split(\",\").map(&:strip).find { |a| a =~ /certified_student_reviewer/}\n list = options[:badges] ? '<span class=\"certified_reviewer\"></span>' : \"Certified Student Reviewer\"\n else\n list = options[:badges] ? '<span class=\"reviewer_badge\"></span>' : \"Reviewer\"\n end\n sep = \", \"\n end\n if member.is_trusted_member?\n list += options[:badges] ? '<span class=\"trusted_member_badge\"></span>' : sep + \"Trusted Member\"\n sep = \", \"\n end\n if member.is_student?\n list += options[:badges] ? '<span class=\"student_badge\"></span>' : sep + \"Student\"\n sep = \", \"\n end\n if member.is_educator?\n list += options[:badges] ? '<span class=\"educator_badge\"></span>' : sep + \"Educator\"\n sep = \", \"\n end\n 0.upto(cnt-1) do |i|\n if member.in_group?(group_list[i])\n if options[:badges]\n list += '<span class=\"' + humanize_token_direct(\"member_groups\", group_list[i]).downcase + '_badge\"></span>' \n else\n list += sep + humanize_token_direct(\"member_groups\", group_list[i])\n sep = \", \"\n end\n end\n end\n end\n if list == \"\"\n list = \"No Roles\"\n end\n return list\n \n end", "def is_group(line)\n\t\treturn line.split(\" \")[1].downcase == \"group\" ? true : false\n\tend", "def get_hosts netgroup\n hosts = []\n # Bind RO to ldap for recursive searching netgroup. FIXME: hardcoded\n auth = { :method => :simple, :username => 'uid=network,ou=Netgroup,dc=catnip', :password => 'sedLdapPassword' }\n Net::LDAP.open(:host => 'ldap.cat.pdx.edu', :port => 636, :auth => auth, :encryption => :simple_tls) do |ldap|\n filter = Net::LDAP::Filter.eq( \"cn\", netgroup )\n attrs = [\"nisNetgroupTriple\",\"memberNisNetgroup\"]\n ldap.search(:base => 'ou=Netgroup,dc=catnip', :filter => filter, :attributes => attrs) do |entry|\n [*entry[\"nisNetgroupTriple\"]].each do |triple|\n host = (/([-\\w]+\\.)+\\w+/.match(triple)).to_s\n hosts << host unless host == \"\"\n end\n [*entry[\"memberNisNetgroup\"]].each do |memberNetgroup|\n hosts += get_hosts(memberNetgroup) #get subgroups\n end\n end\n end\n return hosts\nend", "def read_groups\n read_group_field = Hydra.config[:permissions][:read][:group]\n rg = edit_groups | ((@permissions_solr_document == nil || @permissions_solr_document.fetch(read_group_field,nil) == nil) ? [] : @permissions_solr_document.fetch(read_group_field,nil))\n logger.debug(\"read_groups: #{rg.inspect}\")\n return rg\n end", "def get_group(string); end", "def group_members_list(external_group_id: nil, group_id: nil, trace: false, &block)\n if group_id != nil\n group_query = \"{\\\"group\\\":{\\\".tag\\\":\\\"group_id\\\",\\\"group_id\\\":\\\"#{group_id}\\\"}}\"\n elsif external_group_id != nil\n group_query = \"{\\\"group\\\":{\\\".tag\\\":\\\"group_external_id\\\",\\\"group_external_id\\\":\\\"#{external_group_id}\\\"}}\"\n else\n return nil\n end\n r = dropbox_query(query: '2/team/groups/members/list', query_data: group_query, trace: trace)\n r['members'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team/groups/members/list/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['members'].each(&block)\n end\n end", "def all(domain,username,password,dc_ip)\n\n enum_dom_users(domain,username,password,dc_ip)\n\n enum_dom_groups(domain,username,password,dc_ip)\n\n groupArr = [\"Domain Admins\",\"Domain Computers\",\"Enterprise Admins\",\"Administrators\"]\n\n groupArr.each {|group| enum_group_membership(domain,username,password,dc_ip,group)}\n\n priv_groups(domain,username,password,dc_ip)\n\n grab_attr(domain,username,password,dc_ip)\nend", "def groups\n\nroster = [ \"Caroline Artz\", \"Syema Ailia\", \"Alan Alcesto\", \"Daniel Andersen\", \"James Artz\", \"Darius Atmar\", \"Brian Bensch\", \"Nicola Beuscher\", \"Kris Bies\", \"Logan Bresnahan\", \"William Brinkert\", \"Laura C.\", \"Scott Chou\", \"Bernice Anne W Chua\", \"Abraham Clark\", \"Jon Clayton\", \"Kevin Corso\", \"Jacob Crofts\", \"John D.\", \"Katy D.\", \"Emmanuel Kaunitz\", \"Amaar Fazlani\", \"Solomon Fernandez\", \"Edward Gemson\", \"Jamar Gibbs\", \"Chris Gomes\", \"Will Granger\", \"Christopher M. Guard\", \"Adell H.\", \"James Hwang\", \"Matt H.\", \"Michael H.\", \"Peter H.\", \"Ryan Ho\", \"Igor Kazimirov\", \"Walter Kerr\", \"Karla King\", \"Becky Lehmann\", \"Malia Lehrer\", \"Carolina Medellin\", \"Timothy Meixell\", \"Lorena Mesa\", \"Chris Miklius\", \"Joshua Monzon\", \"Shea Munion\", \"Bryan Munroe\", \"Neal Peters\", \"Trevor Newcomb\", \"Aleksandra Nowak\", \"Morgan O.\", \"Fatma Ocal\", \"Van Phan\", \"Luis Fernando Plaz\", \"Nalie Polen\", \"Alicia Quezada\", \"Celeen R.\", \"Jessie Richardson\", \"Gary S.\", \"Iulia S.\", \"Nimi Samocha\", \"Zach Schatz\", \"Schwartz\", \"Pratik Shah\", \"Josh Shin\", \"Shawn Spears\", \"Sasha ilor\", \"Nil Thacker\", \"Nasha Thapliyal\", \"Sabrina Unrein\", \"Brian Wagner\", \"Clinton Weber\", \"Gregory Wehmeier\", \"Michael Whelpley\", \"Alexander Williams\", \"Peter N Wood\", \"Caitlyn Y.\", \"Ryan Zell\",\"random name\"]\n#initial solution\n\n=begin\n group_arrays = []\n i = 0\n while i < roster.length\n group_arrays << roster[i..i+3]\n i += 4\n end\n\n extra = []\n i = 0\n group_arrays.each { |group|\n if group.length < 3\n extra = group #take contents of group and add it to a different group\n if group_arrays[i].length == 5\n i += 1\n end\n group_arrays[i].concat(extra)\n group.pop\n end\n }\n puts group_arrays.to_s\nend\n\n=end\n\n# If I run this program 3 times, it will return the exact same groups\n#The program could be set up to store past groups, but I'd have to make some updates\n#no groups would be impacted by 1 person leaving, once 2 people left I could run the code again though.\n#biggest issue is I can empty the last array, but it doesn't delete the brackets. so that's a thing.\n\n#refactored solution:\n\n group_arrays = []\n while roster.length > 0\n group_arrays << roster.slice!(0..3)\n end\n\n left_overs = group_arrays[-1]\n\n i = 0\n group_arrays.each { |array|\n if left_overs.length < 3 && left_overs.length > 0\n group_arrays[i].push(left_overs[0])\n left_overs.shift\n if group_arrays[i].length == 5\n i += 1\n end\n elsif array.length > 5\n left_overs.push(array[-1])\n array.pop\n end\n }\n puts group_arrays.to_s\nend", "def checkFileAccess(userName, fToAccess, fAccess)\n\n #return false if fAccess.end_with?(\".access\")\n if File.exist?(fAccess) && userExists(userName)\n\n fileProps = YAML.load_file(fAccess)\n fileUsers = fileProps[\"users\"]\n fileGroups = fileProps[\"groups\"]\n if fileGroups.index(\";guests;\") != nil\n return true\n end\n\n if userName == nil\n return false\n end\n\n user = loadUser(userName)\n groups = Array.new\n groupFound = true\n groupAt = 0\n while groupFound\n\n if user.key?(\"group#{groupAt}\")\n groupTmp = user[\"group#{groupAt}\"]\n groups << groupTmp\n groupAt = groupAt.next\n else\n groupFound = false\n end\n end\n\n if(fileUsers.index(\";#{userName};\") != nil || fileUsers.index(\";guest;\") != nil)\n return true\n end\n if fileGroups.index(\";guests;\") != nil\n return true\n end\n for i in 0..groups.size\n\n if(fileGroups.index(\";#{groups[i]};\") != nil)\n return true\n end\n end\n return false\n end\n return false\n end", "def ldap_crea_grupo(grupo, prob)\n if !ENV['JN316_CLAVE']\n prob << 'Falta clave LDAP para agregar grupo'\n return nil\n end\n opcon = {\n host: Rails.application.config.x.jn316_servidor,\n port: Rails.application.config.x.jn316_puerto,\n auth: {\n method: :simple, \n username: Rails.application.config.x.jn316_admin,\n password: ENV['JN316_CLAVE']\n }\n }.merge(Rails.application.config.x.jn316_opcon)\n ldap_conadmin = Net::LDAP.new( opcon )\n cn = limpia_cn(grupo.cn)\n dn = \"cn=#{cn},#{Rails.application.config.x.jn316_basegrupos}\"\n if grupo.gidNumber.nil?\n grupo.gidNumber = Msip::Grupo.maximum('gidNumber')\n if grupo.gidNumber.nil?\n prob << \"No pudo obtenerse gidNumber máximo. Parece que no ha sincronizado (cree algún usuario en LDAP antes)\"\n return false\n end\n grupo.gidNumber += 1\n end\n attr = {\n cn: cn,\n gidNumber: grupo.gidNumber.to_s,\n description: grupo.nombre,\n objectclass: [\"top\", \"posixGroup\"]\n }\n gusuarios = grupo.usuario.map(&:nusuario).sort.uniq\n ldap_conadmin.open do |ldap|\n if !ldap.add(:dn => dn, :attributes => attr)\n prob << ldap.get_operation_result.code.to_s +\n ' - ' + ldap.get_operation_result.message \n return false\n end\n gusuarios.each do |nusuario|\n unless ldap.add_attribute(dn, 'memberUid', nusuario)\n prob << ldap.get_operation_result.code.to_s +\n ' - ' + ldap.get_operation_result.message \n return nil\n end\n end\n end\n return true\n rescue Exception => exception\n prob << 'Problema conectando a servidor LDAP (ldap_crea_grupo). ' +\n ' Excepción: ' + exception.to_s\n puts prob\n return false\n end", "def print_members(p)\n puts p.getNetid + ':'\n DSpace.create(p).groups.each { |g| puts \"\\t#{g.getName}\" }\nend", "def directory_group\n res = nil\n Group.role_names_for(user).each do |role_name|\n if Filesystem.test_dir role_name, self, :read\n res = File.stat(path_for(role_name: role_name)).gid\n break if res\n end\n end\n res\n end", "def manage_group\n member_options = set_members_options\n if member_options.empty?\n shell_out!(\"pw\", \"groupmod\", set_options)\n else\n member_options.each do |option|\n shell_out!(\"pw\", \"groupmod\", set_options, option)\n end\n end\n end", "def find_group(onms_home, name)\n file_name = nil\n Dir.foreach(\"#{onms_home}/etc/datacollection\") do |group|\n next if group !~ /.*\\.xml$/\n file = ::File.new(\"#{onms_home}/etc/datacollection/#{group}\", 'r')\n doc = REXML::Document.new file\n file.close\n exists = !doc.elements[\"/datacollection-group[@name='#{name}']\"].nil?\n if exists\n file_name = \"#{onms_home}/etc/datacollection/#{group}\"\n break\n end\n end\n file_name\n end", "def has_group?(group)\n\t\t# TODO: remove return true\n\t\treturn true\n\t\t# return FsLdap::groups_of_loginname(self.loginname).include? group\n\tend", "def list_domain_group_mem(group)\n\t\taccount_list = []\n\t\tdevisor = \"-------------------------------------------------------------------------------\\r\\n\"\n\t\traw_list = client.shell_command_token(\"net groups \\\"#{group}\\\" /domain\").split(devisor)[1]\n\t\traw_list.split(\" \").each do |m|\n\t\t\taccount_list << m\n\t\tend\n\t\taccount_list.delete(\"The command completed successfully.\")\n\t\treturn account_list\n\tend", "def find_member(name)\n if name.nil? \n return nil\n end\n # Do some crude preprocessing of \"name\"\n name = name.downcase\n # Check for extra clauses with a ','\n if name.index(',')\n clauses = name.split(',')\n # Use the clause that doesn't contain the word \"minister\"\n if clauses[0].match(/minister|secretary/)\n name = clauses[1]\n else\n name = clauses[0]\n end\n end\n # Now remove any remaining titles that we don't care about\n name.gsub!(\"rt hon\", \"\")\n name.gsub!(\"deputy prime minister\", \"\")\n name.gsub!(\"prime minister\", \"\")\n name.gsub!(\"foreign secretary\", \"\")\n name.gsub!(\"foreign office minister\", \"\")\n name.gsub!(\"international development minister\", \"\")\n name.gsub!(\"minister for europe\", \"\")\n name.gsub!(\"minister\", \"\") # Note this needs to be *after* any others including the word \"minister\"\n name.gsub!(\"mr \", \"\")\n name.gsub!(\" mp\", \"\")\n name.gsub!(\"sir \", \"\")\n name.strip!\n \n member = find_member_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/all-members.xml')\n if member.nil? \n member = find_member_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/all-members-2010.xml')\n if member.nil? \n member = find_lord_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/peers-ucl.xml')\n end\n end\n member\nend", "def find_member(name)\n if name.nil? \n return nil\n end\n # Do some crude preprocessing of \"name\"\n name = name.downcase\n # Check for extra clauses with a ','\n if name.index(',')\n clauses = name.split(',')\n # Use the clause that doesn't contain the word \"minister\"\n if clauses[0].match(/minister|secretary/)\n name = clauses[1]\n else\n name = clauses[0]\n end\n end\n # Now remove any remaining titles that we don't care about\n name.gsub!(\"rt hon\", \"\")\n name.gsub!(\"deputy prime minister\", \"\")\n name.gsub!(\"prime minister\", \"\")\n name.gsub!(\"foreign secretary\", \"\")\n name.gsub!(\"foreign office minister\", \"\")\n name.gsub!(\"international development minister\", \"\")\n name.gsub!(\"minister for europe\", \"\")\n name.gsub!(\"minister\", \"\") # Note this needs to be *after* any others including the word \"minister\"\n name.gsub!(\"mr \", \"\")\n name.gsub!(\" mp\", \"\")\n name.gsub!(\"sir \", \"\")\n name.strip!\n \n member = find_member_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/all-members.xml')\n if member.nil? \n member = find_member_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/all-members-2010.xml')\n if member.nil? \n member = find_lord_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/peers-ucl.xml')\n end\n end\n member\nend", "def find_member(name)\n # Do some crude preprocessing of \"name\"\n name = name.downcase\n # Check for extra clauses with a ','\n if name.index(',')\n clauses = name.split(',')\n # Use the clause that doesn't contain the word \"minister\"\n if clauses[0].match(/minister/)\n name = clauses[1]\n else\n name = clauses[0]\n end\n end\n # Now remove any remaining titles that we don't care about\n name.gsub!(\"rt hon\", \"\")\n name.gsub!(\"deputy prime minister\", \"\")\n name.gsub!(\"prime minister\", \"\")\n name.gsub!(\"foreign secretary\", \"\")\n name.gsub!(\"foreign office minister\", \"\")\n name.gsub!(\"minister for europe\", \"\")\n name.gsub!(\"minister\", \"\") # Note this needs to be *after* any others including the word \"minister\"\n name.gsub!(\"mr \", \"\")\n name.gsub!(\" mp\", \"\")\n name.gsub!(\"sir \", \"\")\n name.strip!\n \n member = find_member_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/all-members.xml')\n if member.nil? \n member = find_member_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/all-members-2010.xml')\n if member.nil? \n member = find_lord_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/peers-ucl.xml')\n end\n end\n member\nend", "def find_member(name)\n # Do some crude preprocessing of \"name\"\n name = name.downcase\n # Check for extra clauses with a ','\n if name.index(',')\n clauses = name.split(',')\n # Use the clause that doesn't contain the word \"minister\"\n if clauses[0].match(/minister/)\n name = clauses[1]\n else\n name = clauses[0]\n end\n end\n # Now remove any remaining titles that we don't care about\n name.gsub!(\"rt hon\", \"\")\n name.gsub!(\"deputy prime minister\", \"\")\n name.gsub!(\"prime minister\", \"\")\n name.gsub!(\"foreign secretary\", \"\")\n name.gsub!(\"foreign office minister\", \"\")\n name.gsub!(\"minister for europe\", \"\")\n name.gsub!(\"minister\", \"\") # Note this needs to be *after* any others including the word \"minister\"\n name.gsub!(\"mr \", \"\")\n name.gsub!(\" mp\", \"\")\n name.gsub!(\"sir \", \"\")\n name.strip!\n \n member = find_member_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/all-members.xml')\n if member.nil? \n member = find_member_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/all-members-2010.xml')\n if member.nil? \n member = find_lord_from_url(name, 'http://ukparse.kforge.net/svn/parlparse/members/peers-ucl.xml')\n end\n end\n member\nend", "def verify_groups(test_data)\n test_groups = test_data[Org::GROUPS.name]\n errors = []\n test_groups = [{ Org::GROUP.name => ''}] unless test_groups\n test_groups.each_with_index do |test_grp, index|\n text_values_match?(test_grp[Org::GROUP.name], element_value(group_input(index)), errors)\n end\n errors\n end", "def atest_ID_25873_access_granted_as_follower_of_a_private_group()\n login_as_user1\n read_all_updates\n groupName = create_any_new_group(\"Private\", \"News\")\n logout_common\n login_as_user2\n read_all_updates\n find_a_group(\"#{groupName}\")\n request_invite\n logout_common\n login_as_user1\n verify_updates\n go_to_updates_page\n approve_as_follower\n logout_common\n login_as_user2\n verify_updates\n end", "def get_membership(group)\n @uri = URI.parse(\"#{@api_url}/group/#{group}/member\")\n body = make_get_request\n doc = Nokogiri::HTML(body)\n members = []\n doc.xpath('//a[@class=\"member\"]').each do |m|\n members << m.text\n end\n members\n end", "def groups\n @groups ||= STDIN.read.split(\"\\n\\n\").map { |e| e.split.map { |f| f.chars } }\nend", "def list(response)\n requested_group = response.args[1]\n output = get_groups_list(response.args[1])\n if output.empty?\n response.reply(empty_state_for_list(requested_group))\n else\n response.reply(output.join(\"\\n\"))\n end\n end", "def groups; end", "def groups; end", "def groups; end", "def read_groups_string\n read_groups.join(', ')\n end", "def list_groups(client, options)\n if !options[:directory].nil?\n directory = client.directories.get options[:directory]\n groups = directory.groups\n else\n puts \"Missing arguments\"\n return\n end\n\n groups.each do |group|\n print_group(group)\n end\nend", "def fidder_crabs(names)\n\n # Create empty container for everyone in the group\n everybody = Hash.new\n # Create a counter for group number, defalt to 1\n counter = 1\n\n names.shuffle\n #Mix it up.!!!!!\n\n #while the list is longer than 8 people, put 5 each in a group.\n while names.length >= 8 do\n names_in_group = names[0..4]\n everybody[counter] = names_in_group\n counter +=1\n names = names.drop(5)\n end\n\n #if the remainder is 5, have the last group with 5 people\n if names.length == 5\n names_in_group = names[0..4]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(5)\n\n #if the remaiinder group is 7, then we need to split the group into 4 and 3\n elsif names.length == 7\n names_in_group = names[0..3]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(4)\n #creating the last group\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n\n #if the remainder is 6, we can have 2 groups of 3's\n elsif names.length == 6\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n #creating last group of 3\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n\n #if there is a remainder of 4 then create 1 group\n elsif names.length == 4\n names_in_group = names[0..3]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(4)\n\n #if the remainder is 3, then create the last group with 3\n elsif names.length == 3\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n else\n names.length < 3\n names_in_group = names[0..1]\n everybody[counter] = names_in_group\n names = names.drop(3)\n end\n\n # since we filter by 8, the highest remainder is 7 and the lowest is 3, only 7 and 6 need to be split into 2 groups, while 3 and 4 could be in 1 group by themselfs.\n everybody\n #Return the hash of everybody in their group number with their names.\nend", "def has_group?(group)\n\t\tFsLdap.groups_of_loginname(self.loginname).include?(group)\n\tend", "def list_group_mem(group)\n\t\tdevisor = \"-------------------------------------------------------------------------------\\r\\n\"\n\t\traw_list = client.shell_command_token(\"net localgroup #{group}\").split(devisor)[1]\n\t\taccount_list = raw_list.split(\"\\r\\n\")\n\t\taccount_list.delete(\"The command completed successfully.\")\n\t\treturn account_list\n\tend", "def openOrSenior(data)\n memberships = []\n data.each do |single_member_info|\n if single_member_info[0] >= 55 && single_member_info[1] > 7\n memberships << 'Senior'\n else\n memberships << 'Open'\n end\n end\n return memberships\nend", "def li__my_groups(access_keys)\n access_token = OAuth::AccessToken.new(get_linkedin_consumer(3), access_keys[:access_token], access_keys[:access_secret])\n \n \n # -- X. WITH 'posts' -> to be used as part of automatically determining the location of the group (for targeted groups)\n # json_groups = _get_linkedin(access_token, \"people/~/group-memberships:(group:(id,name,num-members,short-description,small-logo-url,large-logo-url,website-url,site-group-url,posts,counts-by-category,locale,location),membership-state)?format=json&start=0&count=1000\")\n \n \n # -- X. WITHOUT 'posts'\n json_groups = _get_linkedin(access_token, \"people/~/group-memberships:(group:(id,name,num-members,short-description,small-logo-url,large-logo-url,website-url,site-group-url,counts-by-category,locale,location),membership-state)?format=json&start=0&count=1000\")\n \n \n # response = access_token.get(\"http://api.linkedin.com/v1/people/~/group-memberships:(group:(id,name,num-members,small-logo-url),membership-state,show-group-logo-in-profile,allow-messages-from-members,email-digest-frequency,email-announcements-from-managers,email-for-every-new-post)?format=json&start=0&count=1000\")\n # response = access_token.get(\"http://api.linkedin.com/v1/groups::(5049608,5112233,5161898):(id,name,site-group-url,posts)?format=json\")\n \n json_groups\n end", "def check_domain_admin(verbose=true)\n files=[]\n users=[]\n cmd1 = \"net group \\\"Domain Admins\\\" /domain\"\n cmd2 = \"net group \\\"Enterprise Admins\\\" /domain\"\n begin\n text = \"#{@tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.txt\"\n bat = \"#{@tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.bat\"\n cmdexec = \"%COMSPEC% /C echo #{cmd1} ^> #{text} > #{bat} & %COMSPEC% /C start %COMSPEC% /C #{bat}\"\n smb_psexec(cmdexec, false)\n da_output = get_output(text, false)\n files << text\n files << bat\n text = \"#{@tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.txt\"\n bat = \"#{@tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.bat\"\n cmdexec = \"%COMSPEC% /C echo #{cmd2} ^> #{text} > #{bat} & %COMSPEC% /C start %COMSPEC% /C #{bat}\"\n smb_psexec(cmdexec, false)\n ea_output = get_output(text, false)\n files << text\n files << bat\n cleanup_after(files, false)\n usr=false\n da_output.split(\"\\n\").each do |line|\n if usr\n if not line =~ /The command completed successfully/i and not line.nil? and not line == ''\n line.split(' ').each {|user| users << user unless user.nil? or user == '' }\n end\n end\n usr=true if line =~ /-{1,79}/\n end\n usr=false\n ea_output.split(\"\\n\").each do |line|\n if usr\n if not line =~ /The command completed successfully/i and not line.nil? and not line == ''\n line.split(' ').each {|user| users << user unless user.nil? or user == '' }\n end\n end\n usr=true if line =~ /-{1,79}/\n end\n users = users.uniq!\n return users\n rescue Rex::Proto::SMB::Exceptions::InvalidCommand => e\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Error running commands to check actively logged in users!\".white if verbose\n return nil\n end\nend", "def readGroup(group_id)\n @file.rewind\n\n enter = false\n store = {}\n\n while (line = @file.gets)\n line = line.split(\";\")[0]\n\n if line.strip.empty? \n next\n end\n\n if /\\[.*\\]/.match(line).nil? and enter == true # =\n\n filterKeyPair(line, store)\n\n else\n tempGroup = line.split(/\\[|\\]/)[1]\n\n if tempGroup == group_id.to_s and enter == false\n enter = true\n end\n\n if enter == true and tempGroup != group_id.to_s\n enter = false\n return store\n end\n\n end\n end\n\n if enter == true\n return store\n end\n\n return nil\n end", "def get_node_group_by_name(node_group_name, http)\n # Get all node groups from the REST API\n all_node_groups_json = get_rest_api('groups', http)\n all_node_groups_hash = JSON.parse(all_node_groups_json)\n\n # Search the list of node groups for the specified group.\n group = {}\n all_node_groups_hash.each do |g|\n if node_group_name.eql? g['name']\n group = g # found group hash in json response\n next\n end\n end\n\n # If we didn't find the group, something went horribly wrong.\n # Print out a message and exit.\n if group.empty?\n puts \"Node group #{group_name} doesn't exist.\"\n exit 1\n end\n\n # Return the group if we found it.\n group\nend", "def get_members(group_ldap_dn)\n ldap = Net::LDAP.new :host => SiteSetting.ldap_hostname,\n :port => SiteSetting.ldap_port,\n :auth => {\n :method => :simple,\n :username => SiteSetting.ldap_bind_dn,\n :password => SiteSetting.ldap_password\n }\n\n filter = Net::LDAP::Filter.construct('(memberOf='+ group_ldap_dn +')')\n \n treebase = SiteSetting.ldap_base\n\n result_attrs =[\"mail\"]\n \n group_members = []\n ldap.search(:base => treebase, :filter =>\n filter, :attributes => result_attrs,:return_result =>\n false) do |entry|\n group_members.append(entry[\"mail\"])\n end\n group_members\n end", "def group?(group)\n\t\t\tend", "def ldap_busca_grupos_usuario_como_admin(uid, gidnumber, prob)\n grupos = []\n opcon = {\n host: Rails.application.config.x.jn316_servidor,\n port: Rails.application.config.x.jn316_puerto,\n auth: {\n method: :simple, \n username: Rails.application.config.x.jn316_admin,\n password: ENV['JN316_CLAVE']\n }\n }.merge(Rails.application.config.x.jn316_opcon)\n filter = Net::LDAP::Filter.eq( \"objectClass\", 'posixGroup')\n ldap_conadmin = Net::LDAP.new( opcon )\n lgrupos = ldap_conadmin.search(\n base: Rails.application.config.x.jn316_basegrupos, \n filter: filter \n )\n if lgrupos.nil?\n prob << 'No se pudieron cargar grupos: '+\n ldap_conadmin.get_operation_result.code.to_s +\n ' - ' + ldap_conadmin.get_operation_result.message \n return nil\n end\n lgrupos.each do |entry|\n if (entry.gidnumber && gidnumber && \n entry.gidnumber[0] == gidnumber) || \n (uid && entry[:memberuid].include?(uid))\n puts \"OJO gidnumber=#{entry.gidnumber}, cn=#{entry.cn}\"\n g = crear_actualizar_grupo(entry, prob)\n if (g.nil?)\n return nil\n end\n grupos << g.id\n end\n end\n return grupos\n rescue Exception => exception\n prob << 'Problema conectando a servidor LDAP '+\n '(ldap_busca_grupos_usuario_como_admin). Excepción: ' + exception.to_s\n puts prob\n return nil\n end", "def show\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t #this won't work - it won't find children groups\n\t @group = Group.find_by_id(params[:id])\n\t @group = nil unless current_user.can_access_group?(@group)\n respond_to do |format|\n if @group\n format.html # show.html.erb\n format.xml { render :xml => @group }\n else\n flash[:notice] = 'Group invalid or you do not have access to this group.'\n format.html { redirect_to groups_path}\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def start\n init()\n set_sending_patterns()\n\n membership_str = \"\"\n $groups.each do |g|\n str = \"Member of Group #{g}: \"\n $members[g].each { |n| str << (n.to_s + \" \") }\n membership_str << str << \"\\n\"\n end\n\n all_runs()\n\n puts membership_str\n $patterns_file.close\nend", "def validate()\n print \"Username: \"\n user = gets.chomp\n\n # Check user value\n user_state = [false]\n @users.keys.each do |u|\n if u == user then\n user_state[0] = true\n user_state << @users[user][\"group\"]\n next\n end\n end\n\n if user_state and (not user_state.nil? or not user_state.empty?) then\n print \"Password: \"\n password = STDIN.noecho(&:gets).gsub(/\\n/,\"\")\n\n # Check password value\n password_state = false\n @sudo[\"passphrases\"].each do |p|\n if (p[0] == user_state[1]) and (p[1] == password) then\n password_state = true\n next\n end\n end\n\n if password_state then\n group = @users[user][\"group\"]\n return group unless group.empty?\n else\n return \"guest\"\n end\n else\n return \"guest\"\n end\n end", "def check_for_shared_netid(netid,format=nil)\n uri = URI.parse(\"https://iam-ws.u.washington.edu:7443/group_sws/v1/group/u_netid_#{netid}_admins/member\")\n cert = File.read(@configuration[:cert])\n key = File.read(@configuration[:key])\n http = Net::HTTP.new(uri.host,uri.port)\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.use_ssl = true\n http.cert = OpenSSL::X509::Certificate.new(cert)\n http.key = OpenSSL::PKey::RSA.new(key)\n #http.ca_file = \"/home/nikky/uwca.crt\"\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n if response.code == '404'\n return nil\n elsif response.code != '200'\n raise \"The service didn't return a valid 200 response: #{response.code}\"\n end\n\n doc = Nokogiri::HTML(response.body)\n netids = ''\n doc.css('li').each_with_index do |li,index|\n if format\n netids += \"#{doc.css('li')[index].text}|\"\n else\n puts doc.css('li')[index].text\n end\n end\n return netids.chomp(\"|\") if netids != ''\n end", "def get_nodegroups()\n nodemgr_rest_call(\"GET\", \"classifier\", \"groups\", $credentials)\nend", "def ldap_add_members!\n Rails.logger.tagged(:ldap) { Rails.logger.info \"Looking up an LDAP group matching '#{name}'\" }\n\n portus_user = User.portus\n usernames = users.map(&:username)\n\n ::Portus::LDAP::Search.new.find_group_and_members(name).each do |member|\n next if usernames.include?(member)\n next unless User.exists?(username: member)\n\n add_team_member!(portus_user, member)\n end\n\n update!(ldap_group_checked: Team.ldap_statuses[:checked], checked_at: Time.zone.now)\n end", "def student_leave_grp(course, group)\n load_course_grps course\n logger.info \"Leaving group '#{group.title}'\"\n wait_for_update_and_click link_element(xpath: \"//a[contains(@aria-label,'Leave group #{group.title}')]\")\n list_item_element(xpath: '//li[contains(.,\"Left Group\")]').when_present Utils.short_wait\n end", "def manage_group\n shell_out!(\"groupmod\", set_options)\n modify_group_members\n end", "def show_group\n group_name = params[:name]\n @group = $iam.groups[group_name]\n @users = @group.users\n @policies = @group.policies\n end", "def add_group_member(dept_id, user_id)\n\n user_create = {\n \"@odata.id\" => \"https://graph.microsoft.com/v1.0/directoryObjects/#{user_id}\"\n }\n\n response = HTTParty.post(\"https://graph.microsoft.com/v1.0/groups/#{dept_id}/members/$ref\", { \n \n body: user_create.to_json,\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com',\n \"Content-Type\" => 'application/json', \n\n }\n\n })\n\n case response.code\n when 204\n return response.code\n when 400...600\n return JSON.parse response.read_body\n end\n \n end", "def belongs_to_group group_name\n res = LdapUser.belongs_to_group(self.login, group_name) \n end", "def retrieve_groups_from_ldap\n LdapUser.retrieve_groups self.login\n end", "def member(item,group)\n n = group.length\n \n if group.length == 0\n nil\n elsif item == group[0]\n true\n else\n member(item,group[1,n])\n \n end\n \nend", "def student_join_grp(course, group)\n load_course_grps course\n logger.info \"Joining group '#{group.title}'\"\n wait_for_update_and_click link_element(xpath: \"//a[contains(@aria-label,'Join group #{group.title}')]\")\n list_item_element(xpath: '//li[contains(.,\"Joined Group\")]').when_present Utils.short_wait\n end", "def get_minister_name(dept, position, minister_date)\n dept_shortnames = { \"Ministry of Defence\" => \"Defence\" }\n # Retrieve a list of members of parliament from parlparse\n minister_html = ScraperWiki.scrape('http://ukparse.kforge.net/svn/parlparse/members/ministers.xml')\n minister_doc = Nokogiri::HTML(minister_html)\n # See if we can find the given position\n minister_name = nil\n ministers = minister_doc.css(\"moffice[dept='#{dept}'][position='#{position}']\")\n if ministers.empty? \n # We didn't get any matches, it could be because we're looking for \"Secretary of State\" for example,\n # when in the parlparse data that would be \"Secretary of State for Defence\", so try adding that\n position = position+\" for \"+dept_shortnames[dept]\n ministers = minister_doc.css(\"moffice[dept='#{dept}'][position='#{position}']\")\n end\n ministers.each do |m|\nputs m.inspect\n begin\n start_date = Date.parse(m['fromdate'])\nputs \"start \"+start_date.to_s\n end_date = Date.parse(m['todate'])\nputs \"end \"+end_date.to_s\n search_date = Date.strptime(minister_date, \"%d/%M/%Y\")\n if search_date >= start_date && search_date < end_date\n # We've found who we want\n minister_name = m['name']\n end\n rescue\nputs \"exception\"\n end\n end\n minister_name\nend", "def get_minister_name(dept, position, minister_date)\n dept_shortnames = { \"Ministry of Defence\" => \"Defence\" }\n # Retrieve a list of members of parliament from parlparse\n minister_html = ScraperWiki.scrape('http://ukparse.kforge.net/svn/parlparse/members/ministers.xml')\n minister_doc = Nokogiri::HTML(minister_html)\n # See if we can find the given position\n minister_name = nil\n ministers = minister_doc.css(\"moffice[dept='#{dept}'][position='#{position}']\")\n if ministers.empty? \n # We didn't get any matches, it could be because we're looking for \"Secretary of State\" for example,\n # when in the parlparse data that would be \"Secretary of State for Defence\", so try adding that\n position = position+\" for \"+dept_shortnames[dept]\n ministers = minister_doc.css(\"moffice[dept='#{dept}'][position='#{position}']\")\n end\n ministers.each do |m|\nputs m.inspect\n begin\n start_date = Date.parse(m['fromdate'])\nputs \"start \"+start_date.to_s\n end_date = Date.parse(m['todate'])\nputs \"end \"+end_date.to_s\n search_date = Date.strptime(minister_date, \"%d/%M/%Y\")\n if search_date >= start_date && search_date < end_date\n # We've found who we want\n minister_name = m['name']\n end\n rescue\nputs \"exception\"\n end\n end\n minister_name\nend", "def read_groups\n search_by_type_and_mode(:group, ::ACL.Read).map(&:agent_name)\n end", "def group_members\n members(\"Group\")\n end", "def group_members(id)\n get(\"/groups/#{id}/members\")\n end", "def group_creator(name_list)\n\n\taccountability_groups = []\n\trandomized_names = name_list.shuffle #Used non-destructive shuffle so that I can call on list again for unit 2/3\n\n\twhile (randomized_names.length > 4)\n\t\taccountability_groups << randomized_names.pop(4)\t\n\tend\n\n\tcounter = 0\n\tuntil (randomized_names.length == 0)\n\t\taccountability_groups[counter] << randomized_names.pop\n\t\tcounter\t+= 1\n\tend\n\t\t\n\tcounter = 0\n\tuntil accountability_groups[counter] == nil\n\t\tputs \"Group \" + (counter + 1).to_s + \":\" ; puts accountability_groups[counter]\n\t\tputs\n\t\tcounter += 1 \n\tend\nend", "def group_get(name)\n execute(\"dscacheutil -q group -a name #{name}\") do |result|\n fail_test \"failed to get group #{name}\" unless /^name: #{name}/.match?(result.stdout)\n gi = {} # group info\n result.stdout.each_line do |line|\n pieces = line.split(': ')\n gi[pieces[0].to_sym] = pieces[1].strip if pieces[1] != nil\n end\n answer = \"#{gi[:name]}:#{gi[:password]}:#{gi[:gid]}\"\n\n yield answer if block_given?\n answer\n end\n end", "def group?\n members.count > 2 or self[:name].present?\n end", "def hack_members_for_newsletter\n member_hash = {}\n hack_members.name_seq.each do | member |\n member_hash[member.informal_name] = {:name => member.informal_name,\n :grp_with => member.group_with_id.nil? ? nil : member.group_with.informal_name,\n :subnodes => []}\n end\n member_hash.each do |_, item|\n parent = member_hash[item[:grp_with]]\n parent[:subnodes] << item if parent\n end\n unique_array = member_hash.reject {|_, item| member_hash.has_key? item[:grp_with] }.values\n ar = []\n collect_names(ar, unique_array)\n\n leader = self.hack_leader.informal_name\n if ar.include? leader\n ar.delete leader\n ar.push leader\n end\n\n ar.blank? ? 'None.' : ar.to_sentence(:last_word_connector => ' and ')\n end", "def student_visit_grp(course, group)\n load_course_grps course\n logger.info \"Visiting group '#{group.title}'\"\n wait_for_update_and_click student_visit_grp_link(group)\n wait_until(Utils.short_wait) { recent_activity_heading.include? group.title }\n end", "def group_entry\n unless @user.eql?('cchdo_admin')\n redirect_to :controller => '/staff', :action => 'index'\n end\n @groups = CruiseGroup.all\n render :partial => \"group_entry\"\n end", "def group_name(group)\n if group.name == 'all users'\n :adjust_permissions_all_users.t\n elsif group.name == 'reviewers'\n :REVIEWERS.t\n elsif group.name.match(/^user \\d+$/)\n group.users.first.legal_name\n else\n group.name\n end\n end", "def index\n id = -1 \n if params[:id] \n id = params[:id]\n else \n id = current_user.id \n end \n\n @user = User.find(id)\n @group = UserGroup.find_by(user_id: id, name: params[:group])\n\n if !@group.nil?\n @group_members = get_members(@user, @group)\n end \n\n end", "def members(group)\n reload\n @group[group] || []\n end", "def search\n # Check input parameters\n if params[:member_ids].blank?\n @error = 'You must choose at least one member to be in this group.'\n raise BadParams\n end\n if params[:leader_ids].blank?\n @error = 'You must choose at least one leader to lead this group.'\n raise BadParams\n end\n\n params[:max_groups] = params[:max_groups] && params[:max_groups].to_i > 0 ? params[:max_groups].to_i : params[:leader_ids].length\n params[:groups_per_leader] = params[:groups_per_leader] && params[:groups_per_leader].to_i > 0 ? params[:groups_per_leader].to_i : 1\n\n\n if params[:max_groups] > params[:leader_ids].length * params[:groups_per_leader]\n @error = \"You don't have enough leaders to lead #{pluralize(params[:max_groups], 'group')}. Either add more leaders, or increase the number of groups per leader.\"\n raise BadParams\n end\n @member_ids = params[:member_ids] ? Array.wrap(params[:member_ids]).map(&:to_i) : []\n @co_leader_ids = params[:co_leader_ids] ? Array.wrap(params[:co_leader_ids]).map(&:to_i) : []\n @leader_ids = params[:leader_ids] ? Array.wrap(params[:leader_ids]).map(&:to_i) : []\n person_ids = @member_ids + @co_leader_ids + @leader_ids\n unless person_ids.empty?\n @people = Person.find(:all, :conditions => [\"#{_(:id, :person)} in (?)\", person_ids])\n timetables = {}\n @no_timetable = []\n @people.each_with_index do |person, i|\n if person.free_times.empty?\n @no_timetable << person\n Timetable.initialize_timetable(person)\n end\n timetables[person] = Timetable.setup_timetable(person)\n end\n # @people -= @no_timetable\n unless @people.empty?\n num_blocks = (params[:length].to_f.hours || 1.hour) / Timetable::INTERVAL\n num_blocks = num_blocks > 0 ? num_blocks : 1\n user_weights = []\n midnight = Time.now.beginning_of_day\n stop_time = midnight + (Timetable::LATEST - (Timetable::INTERVAL * num_blocks))\n\n\n possible_times = []\n 7.times do |day|\n time = midnight + Timetable::EARLIEST\n while time < stop_time\n time_in_seconds = time.to_i - midnight.to_i\n possible_times << {:time => time_in_seconds, :score => 0, :day => day}\n time += Timetable::INTERVAL\n end\n end\n @people.each_with_index do |person, i|\n user_weights[i] = 1.0 / @people.length\n end\n\n # logger.debug \"Initial weights: \\n#{user_weights.inspect}\\n\\n\"\n\n needed_groups = params[:max_groups]\n\n top_times = Timetable.get_top_times(user_weights, timetables, num_blocks, needed_groups, possible_times, @people, @leader_ids)\n\n groups = []\n # if needed_groups > 1\n top_times.each_with_index do |top_time, i|\n groups << [top_time]\n possible_times -= [top_time]\n end\n # end\n\n # pp groups\n\n (2..needed_groups).each do |i|\n # Otherwise, just go with the top pick and recurse from there\n groups.each_with_index do |group, gi|\n time = Timetable.get_top_times(group[i - 2][:user_weights], timetables, num_blocks, needed_groups, possible_times, @people, @leader_ids, group[i - 2][:assigned], i)[0]\n possible_times -= [time]\n groups[gi] << time\n end\n end\n\n # groups.each_with_index do |group, i|\n # logger.debug \"Options #{i + 1}\"\n # group.each do |time_slot|\n # logger.debug \"#{time_slot[:day]} - #{time_slot[:time] / 60.0 / 60}: #{time_slot[:score]}\"\n # end\n # end\n @groups = groups\n end\n end\n\n respond_to do |wants|\n wants.js do\n render :update do |page|\n page[:results].replace_html :partial => 'possible_times'\n page[:results].show\n page[:spinnersubmit].hide\n page[:timetable_search].hide\n end\n end\n end\n rescue BadParams\n respond_to do |wants|\n wants.js do\n render :update do |page|\n page[:results].hide\n page[:spinnersubmit].hide\n page.alert(@error)\n end\n end\n end\n ensure\n # Clear fake timetables\n @no_timetable.each do |person|\n person.timetable.free_times.destroy_all\n end if @no_timetable\n end", "def listgroups(msg, ent, ii, depth)\r\n ent.each do |bit|\r\n next unless bit.is_a?(Sketchup::Group)\r\n bname = bit.name.empty? ? 'no name' : bit.name\r\n spacer = ' ' * depth\r\n msg += spacer + ii.to_s + ' - ' + bname + \"\\n\"\r\n msg = listgroups(msg, bit.entities, ii, depth + 1)\r\n end\r\n msg\r\n end", "def moderator?\n groups.exists? id: Group::GATHER_MODERATORS\n end", "def show\n @group = Group.includes(:users).find(params[:id])\n @group_member = GroupMember.new\n @group_member.group = @group\n\n if params[:from_reading_list]\n @reading_list = ReadingList.find(params[:from_reading_list])\n else\n @reading_list = nil\n end\n\n respond_to do |format|\n if @group.owner == current_user\n format.html\n format.json { render json: @group }\n else\n msg = \"You are not authorized to access group #{params[:id]}.\"\n format.html { redirect_to groups_url, alert: msg }\n format.json { render json: msg }\n end\n end\n end", "def leader?\n\t\tself.group_members.each{|m| return true if m.group_role_id == 1 or m.group_role_id == 5}\n\t\treturn false\n\tend", "def is_member_in(group)\n unless group.members.include? current_user\n flash[:danger] = \"Devi essere un membro per accedere ad un gruppo ed alle sue informazioni\"\n redirect_to groups_path\n end\n end", "def list_group_members(dept_id)\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/groups/#{dept_id}/members\", { \n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com' \n }\n })\n return JSON.parse response.read_body\n end", "def read_groups_string=(groups)\n self.read_groups = groups.split(/[\\s,]+/)\n end", "def test_data_extraction\n\t\tYAML.load_file('test/groups.yml')[\"groups\"].each do |g_data|\n\t\t\tstub_request(:get, g_data[\"url\"]).\n\t\t\tto_return(:status => 200, :body => File.read(\"test/yahoo_pages/#{g_data['id']}.html\"), :headers => {})\n\n\t\t\tgroup = YahooGroupData.new(g_data[\"url\"])\n\t\t\tassert_equal g_data[\"age_restricted\"], group.age_restricted?\n\t\t\tassert_equal g_data[\"private\"], group.private?\n\t\t\tassert_equal g_data[\"not_found\"], group.not_found?\n\t\t\tassert_equal g_data[\"name\"], group.name\n\t\t\tassert_equal g_data[\"description\"], group.description\n\t\t\tassert_equal g_data[\"post_email\"], group.post_email\n\t\t\tassert_equal g_data[\"subscribe_email\"], group.subscribe_email\n\t\t\tassert_equal g_data[\"owner_email\"], group.owner_email\n\t\t\tassert_equal g_data[\"unsubscribe_email\"], group.unsubscribe_email\n\t\t\tassert_equal g_data[\"founded\"], group.founded\n\t\t\tassert_equal g_data[\"language\"], group.language\n\t\t\tassert_equal g_data[\"num_members\"], group.num_members\n\t\t\tassert_equal g_data[\"category\"], group.category\n\t\tend\n\tend", "def get_users_in_group(group_id)\n @url = \"http://#{$canvas_host}/api/v1/groups/#{group_id}/users\"\n puts \"@url is #{@url}\"\n\n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get users in group has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n\n user_data = @getResponse.parsed_response\n set_of_user_ids = Set.new\n\n user_data.each do |user_data_info|\n set_of_user_ids.add user_data_info[\"id\"]\n end \n\n if @getResponse.empty?\n puts \"WARNING: No users in group from Active listener group 1 or Active listener group 2, program may not function correctly!\"\n end\n\n return set_of_user_ids\nend" ]
[ "0.63096815", "0.6192209", "0.6168978", "0.5735705", "0.57065", "0.566582", "0.55977696", "0.555057", "0.5533047", "0.55120414", "0.54727644", "0.5412138", "0.5398606", "0.538851", "0.5374278", "0.53711075", "0.5338259", "0.5334743", "0.5280515", "0.5279155", "0.5274533", "0.52742046", "0.52632046", "0.52164954", "0.52017534", "0.5188469", "0.51823664", "0.51802653", "0.517431", "0.5156096", "0.5150891", "0.5132981", "0.5110451", "0.5095234", "0.5084243", "0.5083112", "0.5069647", "0.50686646", "0.50686646", "0.50652975", "0.50652975", "0.5058077", "0.50506306", "0.5050372", "0.5036763", "0.5018151", "0.5012097", "0.5012097", "0.5012097", "0.5009987", "0.50094986", "0.49970758", "0.49957123", "0.49752137", "0.49722314", "0.4965853", "0.49599805", "0.49401063", "0.49302694", "0.49253008", "0.49249995", "0.49218673", "0.49141157", "0.4912407", "0.49077296", "0.49057174", "0.49014962", "0.489865", "0.48969766", "0.48933586", "0.48890942", "0.48837423", "0.4880153", "0.48780543", "0.48723456", "0.48681927", "0.4864301", "0.4864301", "0.48618275", "0.48600847", "0.48589113", "0.48378232", "0.4836002", "0.48313674", "0.48312473", "0.48289716", "0.48245674", "0.4823231", "0.4822166", "0.48064756", "0.48056123", "0.4802658", "0.4801527", "0.47982466", "0.47945985", "0.47910076", "0.47801504", "0.47787365", "0.47690806", "0.4764374" ]
0.6092619
3
dscl . delete /Groups/yourGroupName
def group_delete(attribs, dir_info) attribs = group_record_name_alternatives(attribs) check_critical_attribute( attribs, :record_name ) command = {action: 'delete', scope: 'Groups', attribute: nil, value: nil} user_attrs = attribs.merge(command) dscl( user_attrs, dir_info ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n Group.delete_groups_and_acls([id])\n end", "def delete_group(client, options)\n if options[:directory].nil? or options[:group].nil?\n puts \"Missing arguments\"\n return\n end\n\n groups = client.groups\n group = groups.get options[:group]\n group.delete\n puts \"Group deleted.\"\n return\nend", "def deleteGroup _args\n \"deleteGroup _args;\" \n end", "def remove_group(name)\n visit 'groups'\n click_link name\n\n page.accept_alert do\n click_button 'group_delete'\n end\n end", "def delete_group(group)\n\t\t\tend", "def delete_group(group)\n\t\t\tend", "def group_absent(name, &block)\n execute(\"if dscl . -list /Groups/#{name}; then dscl . -delete /Groups/#{name}; fi\", {}, &block)\n end", "def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @client.resource_groups.delete(@resource_group)\n end", "def remove_group(group)\n self.groups.destroy group \n end", "def destroy\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.remove_users_from_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Removed member #{params[:id]}\"\n end", "def test_delete\n g = [22058]\n Group.delete(g)\n end", "def destroy\n @group.destroy\n\n head :no_content\n end", "def delete_related_groups\n \n end", "def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def deleteGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"delete\",\"/group\",params)\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n redirect_to groups_path\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n redirect_to groups_path\n end", "def destroy\n @group.destroy\n msg = [\"Destroyed group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end", "def delete_resource_group(group_name)\n cmdline = Schott::AzureCLI::Commandlines.delete_resource_group(group_name)\n sh(cmdline)\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n head :no_content\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_groups_url) }\n format.xml { head :ok }\n end\n end", "def dissolve_groups\n groups.destroy_all\n end", "def destroy\n return access_denied unless is_admin?(current_user)\n\n @group = Group.find(params[:id])\n @group.destroy\n redirect_to(groups_url)\n end", "def delete_group(uuid)\n Uploadcare::Group.delete(uuid)\n end", "def destroy_group(name)\n response = Curl.delete(azure_face_uri << name) do |http|\n http.headers[\"Ocp-Apim-Subscription-Key\"] = key\n end\n response.body_str\n end", "def destroy\n # @group = @hub.groups.get(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to hub_groups_url }\n format.json { head :no_content }\n end\n end", "def delete(name)\n return unless resource_group?(name)\n\n info \"deleting the resource group: #{name}\"\n @client.resource_groups.delete(name, name)\n end", "def del(id, which=:groups)\n resp = self.class.delete(\"/#{which}/#{id}\")\n check_errors resp\n end", "def disband_group\n destroy_collection({:table=>'groups', :on_success=>'You disbanded the group.'})\n rescue\n flash[:notice] = \"Could not find group.\"\n redirect_to :action=>'groups'\n end", "def delete_group\n @mailing_list_group.destroy if @ok\n render 'update_list'\n end", "def remove_group(group)\r\n\t\tsend('RMG', group.info[:guid])\r\n\t\t## XXX save changes locally?\r\n\t\treturn 1\r\n\tend", "def delete_group(id)\n delete(\"groups/#{id}\")\n end", "def delete_app_group(group,app)\n\t\t\tresults = submit_cmd('delete app group',:db,\" -env #{self.env} -domain #{self.domain} -plant #{self.plant} -group #{group} -app_instance #{app}\")\n\t\t\tputs results\n\tend", "def deleteEntityGroup( 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/group\",params)\n end", "def delete_asg name\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n raise \"unable to delete asg, #{name}. asg not found!\" if groups[name].nil? \n\n asg = groups[name]\n\n puts \"deleting asg, #{asg.name}\"\n asg.delete({:force => true})\n delete_launch_configs\nend", "def hcRemoveGroup _obj, _args\n \"_obj hcRemoveGroup _args;\" \n end", "def destroy\n @group = Group.find_by_guid(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def delete_secGrp(groupName,vpc=nil)\n start = @serverBranch if vpc == nil or vpc == \"\"\n start = @vpc_serverBranch[vpc] if vpc != nil and vpc != \"\"\n t = @tree.findItem(groupName,start)\n if t != nil\n p = t.parent\n if p != nil\n if (p.text() == \"Servers\" and (vpc == nil or vpc == \"\")) or\n ((vpc != nil and vpc != \"\") and p.text() == vpc)\n @tree.removeItem(t)\n end\n else\n puts \"Security Group not found in tree\"\n end\n else\n puts \"Security Group not found in tree\"\n end\n end", "def destroy\n @group = Group.find(params[:id])\n\n mbs = Membership.where \"group_id = ?\", @group.id\n\n mbs.each do |m|\n m.destroy\n end\n\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n #@s_group.destroy\n @s_group = SGroup.find(params[:id].to_i)\n @s_group.delete_flg = 1\n @s_group.save!\n\n respond_to do |format|\n format.html { redirect_to s_groups_url, notice: 'S group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_group\r\n if request.post?\r\n @group=Group.find_by_id(params[:id], :conditions=>['account_id = ?',session[:account_id]])\r\n if @group.nil?\r\n flash[:error] = \"Invalid action.\"\r\n else\r\n flash[:success]= \"Group \" + @group.name + \" was deleted successfully \"\r\n @group.destroy\r\n @group_devices = Device.find(:all, :conditions=>['group_id=?',@group.id])\r\n for device in @group_devices\r\n device.icon_id =\"1\"\r\n device.group_id = nil\r\n device.save\r\n end\r\n end\r\n end\r\n redirect_to :action=>\"groups\"\r\n end", "def delete_group(group)\n\t\t\t\tgroupname = nil\n\t\t\t\tif(group.respond_to(:groupname))\n\t\t\t\t\tgroupname = group.groupname\n\t\t\t\telse\n\t\t\t\t\tgroupname = group\n\t\t\t\tend\n\n\t\t\t\t`pw groupdel #{groupname}`\n\t\t\tend", "def delete_group_label(group, name)\n delete(\"/groups/#{url_encode group}/labels/#{name}\")\n end", "def deletesecuritygroup\n if not checkRequirements([\"thezone\",\"thefirewall\"])\n return false\n end\n checkToken(@thezone)\n submit = queryGCE(:path => '/compute/v1beta15/projects/#{@thezone.name}/global/firewalls/#{@thefirewall.serial}', :method => 'delete', :options => '', :acces_token => @thezone.token )\n checkQuery(:type => 'global', :token => @thezone.token, :projectname => @thezone.name, :operationname => submit[\"name\"])\n end", "def service_group_delete(a10, name)\n a10.send(:axapi, 'slb.service_group.delete', 'post', {name: name, format: 'json'})\nend", "def remove_group\n create_group.tap do |r|\n r.action(:remove)\n end\n end", "def remove_group\n group = current_account.groups.of_devices.find(params[:group_id])\n\n group.devices.delete(current_account.devices.find(params[:apply_ids].split(\",\")))\n\n redirect_to devices_path\n end", "def destroy\n @lab_group = LabGroup.find(params[:id])\n @lab_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(lab_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n authorize @group, :destroy?\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(browse_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end", "def DeleteGroup id\n \n APICall(path: \"groups/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n start = Time.now\n debug(\"Deleting device group: \\\"#{resource[:full_path]}\\\"\")\n connection = self.class.get_connection(resource[:account])\n device_group = get_device_group(connection, resource[:full_path], 'id')\n if device_group\n delete_device_group = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_DELETE)\n valid_api_response?(delete_device_group) ? nil : alert(delete_device_group)\n end\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end", "def destroy\n @group.destroy\n redirect_to groups_url, notice: \"Group was successfully destroyed.\" \n end", "def destroy\r\n @agroup.destroy\r\n respond_to do |format|\r\n format.html { redirect_to agroups_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete_group \n Group.destroy(params[:id])\n\n respond_to do |format|\n format.html {redirect_to dashboard_path}\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to admin_groups_url, notice: t('activerecord.models.group') +'删除成功!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @access_group = AccessGroup.find(params[:id])\n @access_group.destroy\n\n respond_to do |format|\n format.html { redirect_to access_groups_url }\n format.json { head :no_content }\n end\n end", "def delete_group(group_id)\n\t\tself.group_list.delete(group_id)\n\t\tself.update_attribute(:group_list, self.group_list)\n\tend", "def destroy\n @group.destroy\n audit(@group, \"destroy\", @group.name )\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = @course.groups.find(params[:id])\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n redirect_to :action => :index and return unless is_owner?\n for member in @group.members\n member.destroy\n end\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mem_group.destroy\n respond_to do |format|\n format.html { redirect_to admin_mem_groups_url, notice: '会员分组成功删除.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_group = ExamGroup.shod(params[:id])\n authorize! :delete, @exam_group\n batch = @exam_group.batch\n @exam_group.destroy\n flash[:notice] = 'Exam Group deleted successfully!'\n redirect_to exam_group_path(batch)\n end", "def destroy\n Group.destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ail_group = AilGroup.find(params[:id])\n @ail_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(ail_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find_by_param(params[:id])\n @group.tuners.clear\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def remove_group(id)\n delete(\"/groups/#{id}\")\n end", "def destroy\n @attribute_group = AttributeGroup.find(params[:id])\n @attribute_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(attribute_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find_by_slug_or_id(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @user_group = UserGroup.find_by_id(params[:id])\n @user_group.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end", "def groups\r\n save_default_group(params)\r\n delete_group(params)\r\n end", "def destroy\n group = Group.find(params[:group_id])\n\n @subgroup = group.subgroups.find(params[:id])\n @subgroup.destroy\n\n respond_to do |format|\n format.html { redirect_to(group_subgroups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @target_group = TargetGroup.find(params[:id])\n @target_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_target_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @add_to_group = AddToGroup.find(params[:id])\n @add_to_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(add_to_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @esol_group = EsolGroup.find(params[:id])\n @esol_group.destroy\n\n respond_to do |format|\n format.html { redirect_to esol_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy #:nodoc:\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n # format.xml { head :ok }\n end\n end", "def destroy\n @cwa_db_grp_util = CwaDbGrpUtil.find(params[:id])\n @cwa_db_grp_util.destroy\n\n respond_to do |format|\n format.html { redirect_to cwa_db_grp_utils_url }\n format.json { head :no_content }\n end\n end", "def destroy_group_with_extension\n # INFO: currently only a superuser can destroy a group. See CartoDB/cartodb-postgresql#114\n organization.owner.in_database(as: :superuser) do |conn|\n Carto::Group.destroy_group_extension_query(conn, name)\n end\n end", "def ListView_RemoveGroup(hwnd, iGroupId) send_listview_message(hwnd, :REMOVEGROUP, wparam: iGroupId) end" ]
[ "0.7440654", "0.7241825", "0.7211262", "0.7123508", "0.7112543", "0.7112543", "0.71104467", "0.70682937", "0.7066243", "0.7046521", "0.7028241", "0.701744", "0.70083165", "0.6990598", "0.69859797", "0.6957801", "0.69464016", "0.69464016", "0.6940704", "0.6863574", "0.68242246", "0.6823347", "0.68144786", "0.681136", "0.6800742", "0.6764321", "0.6739002", "0.6721093", "0.6715347", "0.6704738", "0.6696089", "0.66853833", "0.66851574", "0.6681683", "0.66773164", "0.66670537", "0.66621006", "0.66560155", "0.6649802", "0.66496456", "0.6645191", "0.6638395", "0.66372216", "0.6621761", "0.6615321", "0.6613529", "0.6596034", "0.6592174", "0.6585203", "0.65610105", "0.65569", "0.65521234", "0.6543844", "0.65328926", "0.65322214", "0.6517781", "0.6505792", "0.64986634", "0.64863604", "0.6486132", "0.64793825", "0.6477989", "0.64778286", "0.6472834", "0.6470158", "0.6464521", "0.64586747", "0.6457667", "0.6457667", "0.6456145", "0.6454032", "0.6452975", "0.64465106", "0.64461666", "0.6440009", "0.6439038", "0.64353126", "0.6429124", "0.6429124", "0.6429124", "0.6429124", "0.6429124", "0.6429124", "0.64233696", "0.64233696", "0.6422338", "0.64206797", "0.6417155", "0.6417155", "0.6417155", "0.6417155", "0.6417155", "0.6417155", "0.6417155", "0.6417155", "0.64101803", "0.6404664", "0.6403122", "0.640158", "0.6400132" ]
0.7430047
1
Runs one game loop
def game_loop(game, word) game.update_screen(word) until game.correct_positions.all? { |position| position == true } special_result = game.read_and_validate_input(word) break if special_result == 'QUIT' if special_result == 'SAVE' game.save_game(word) break end if special_result == 'WORD' correct = game.guess_word(word) if correct puts "\n\nCongratulations! You won!" game.update_screen(word, true) break else puts "\nYou were wrong :(" game.update_screen(word) next end end if special_result == 'GAMEOVER' puts "\n\nYour man has fallen to his doom :(" puts "The Word was #{word}\n" puts 'Game over..'.red break end system('clear') game.update_screen(word) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n start_game\n game_loop\n end_game\n end", "def game_loop\n end", "def game_loop\n end", "def play\n\t\tgame_loop\n\tend", "def run_game\n if !@board.game_over? and @running\n @timer.stop\n @timer.start(@board.delay, (lambda {|x| @board.run; run_game}))\n end\n end", "def beginGameLoop\n @gameLoop.play\n end", "def play_game\n loop do\n puts \"\\n\\n\"\n display_board\n player_turn\n check_game_status\n end\n end", "def play\n\t# while $game_end == false\n\t\t9.times { \n\t\t\tif $game_end == false\n\t\t\t\tturns\n\t\t\tend\n\t\t}\nend", "def game_loop\n while !game_over?\n # Start a new turn with the current player\n turn = Turn.new(@player1_turn ? @player1 : @player2)\n turn.run\n\n # Display scores and check if game is over\n display_scores\n switch_players\n end\n end", "def run_game\n start_game\n new_board\n while true\n print_grid\n tour_joueur1\n tour_joueur2\n end\nend", "def run\n self.start_time = Time.now\n n = 0\n event = nil\n loop do\n handle_event event, n while event = SDL::Event.poll\n SDL::Key.scan\n handle_keys\n\n unless paused then\n update n unless paused\n\n draw_and_flip n\n\n n += 1 unless paused\n end\n end\n end", "def run\n until game_over?\n # Get the next move from the player and update the game state.\n @board.play(get_valid_move,@players[0].sign)\n increment_turn\n end\n if(w = @board.win?)\n puts \"Game over #{w} wins!\"\n else\n puts \"Cat's game.\"\n end\n end", "def play\n while(true)\n system('clear')\n render_board\n board_update\n sleep(5)\n end\n end", "def game_loop\n\t\tuntil @board.check_for_winner || @board.no_more_moves\n\t\t\tputs \"Player #{@next_player.token}, it's your turn.\"\n\t\t\tputs @board\n\t\t\tplay_legal_location\n\t\t\tswitch_player\n\t\tend\n\t\tputs @board\n\t\tputs \"Game over!\"\n\t\tif @board.check_for_winner\n\t\t\tputs \"#{@board.check_for_winner} won\"\n\t\telse\n\t\t\tputs \"It's a tie\"\n\t\tend\n\tend", "def start\r\n initialize_game\r\n until @game.over?\r\n take_turn\r\n end\r\n print_outcome\r\n end", "def play_single_round\n loop do\n clear\n deal_initial_cards\n show_cards\n turn_cycle\n update_score\n show_result\n break if someone_won_tournament?\n quit_early unless play_again?\n reset\n end\n end", "def game_loop\n again = true\n\n while again\n bet\n deal\n player_action\n dealer_action\n reveal_final_hand\n print_player_outcomes\n remove_players\n\n again = play_again?\n linebreak\n end\n\n exit_message\n\n end", "def start_game\n # Infinite loop\n while\n # Draw the board on the terminal\n @board.print_board\n # Ask the player to choose where to draw the symbol\n @active_player.choose_spot\n # Check if the current player won\n if @board.check_win(@active_player.player_symbol)\n @board.print_board\n puts 'Has ganado'\n @active_player.victory\n # Ask if the player wants to play again\n play_again\n # If not, the loop is broken\n break\n else\n # Check if there is a draw\n if @board.check_draw\n puts 'Empate'\n play_again\n break\n end\n # If there isn't a draw the game switch the current player\n switch_player\n end\n end\n end", "def play_game\n \twhile true\n \t\t@view.display_game_state(@word, @misses, @hits, @guesses_left)\n \t\tbreak if game_over?\n \t\tguess = get_guess\n \t\tbreak if guess == :save\n \t\tupdate_game_state guess\n \tend\n \tsave_game if guess == :save\n\tend", "def start_game\n loop do\n display_board\n turn\n position_available ? player_positions : turn\n (display_board; p \"#{@player} wins!\"; break) if win_game\n (display_board; p \"Draw\"; break) if draw\n next_player\n end\n end", "def run\n play_round until game_over?\n puts \"#{winner} wins!\"\n end", "def loop\n end", "def game_play\n until game_over\n graphic\n guess\n end\n end", "def play\n loop do\n prep_game\n loop do\n current_player_moves\n break if board.someone_won? || board.full?\n board.clear_screen_and_display_board(players) if human_turn?\n end\n display_result\n break unless play_again?\n reset\n end\n display_goodbye_message\n end", "def run (game)\n @state.run(self, game)\n end", "def loop\n end", "def loop\n end", "def game_loop\n loop do\n current_state\n\n Display.win(@word) if win_condition\n Display.lose(@word) if lose_condition\n break if win_condition || lose_condition\n\n ask_letter\n end\n end", "def start_game\n puts 'GAME STARTED'\n until @is_game_over\n @count_turns += 1\n @board.draw_board\n @board.update_board(@controller.get_input)\n game_over?\n end\n puts @count_turns\n end_game\n end", "def play\n # unless the game is over players take turns\n take_turn until game_over?\n\n #start a new game if the game is over\n new_game_or_quit\n end", "def start_game\n loop do\n turn #loop turns from X to O\n\n if win?\n puts \"Player #{player} wins!\"\n break #end the turn loop and the game\n end\n end\n end", "def run\n start_key = self.display_instructions\n exit if start_key.downcase == \"q\"\n self.play_round until @board.won? || @board.lost?\n @board.lost? ? self.display_loss : self.display_win\n end", "def loop; end", "def main\r\n welcome\r\n process_cmd_line\r\n top_up_players\r\n\r\n play_game\r\n\r\n rescue Interrupt\r\n puts\r\n end", "def run()\n while(true)\n cycle() ;\n sleep(2) ;\n end\n end", "def run\n loop { run_once }\n end", "def play\n display_welcome_message\n loop do\n human.choose\n computer.choose\n display_moves\n display_winner\n keep_score\n break unless play_again?\n end\n display_goodbye_message\n end", "def runner\n welcome\n game = initial_round\n until game > 21 do\n game = hit?(game)\n display_card_total(game)\n end\nend_game(game)\nend", "def play\n game_introductions\n\n loop do\n set_markers_and_first_mover\n\n loop do\n clear_screen_and_display_board\n loop_of_player_moves\n display_result\n break if someone_won_match?\n display_play_again_message\n reset\n end\n\n clear\n display_champion\n break unless rematch?\n reset_game_data\n end\n\n display_goodbye_message\n end", "def runner\r\n welcome\r\n sleep(0.75)\r\n ct = initial_round\r\n until ct > 21\r\n ct = hit?(ct)\r\n display_card_total(ct)\r\n end\r\n end_game(ct)\r\nend", "def main_loop\r\n Graphics.update # Update game screen\r\n Input.update # Update input information\r\n main_update # Update scene objects\r\n update # Update Processing\r\n end", "def play\n # checks if the game is over after every turn\n until over?\n # plays the first few turns of the game\n turn\n end\n\n # checks if the game is won after every turn\n if won?\n puts \"Congratulations #{winner}!\"\n # checks if the game is draw after every turn\n elsif draw?\n puts \"Cats Game!\" # prints \"Cats Game!\" on a draw\n end\n\n end", "def play\n\t\n\t\tuntil over?\n\t\tturn\n\t\tend\n\t\t\n\t\tif won? \n\t\t\twinner\n\t\telsif draw? \n\t\t\tputs \"The game was a Draw!\"\n\t\telse \n\t\t\tputs \"Unexpected Error Occured\" \n\t\tend\n\tend", "def run\n Interface::header\n Interface::newline\n\n count = get_number_of_players\n get_player_names( count )\n\n @b.play_game\n end", "def start\n\t\twhile true\n\t\t\tclean\n\t\t\tscore_table\n\t\t\tarray_start(1)\n\t\t\tif player_win(1) == false || test_fin == false \n\t\t\t\tbreak\n\t\t\tend\n\t\t\tclean\n\t\t\tscore_table\n\t\t\tarray_start(2)\n\t\t\tif player_win(2) == false || test_fin == false\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend", "def start_game\n\t\ti = 0\n\t\tsrand seed.to_i\n\t\t#This is the loop that runs the simulation 5 times.\n\t\tloop do\n\t\t\ti += 1\n\t\t\tnew_run(i)\n\t\t\tif i == 5\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\ti\n\tend", "def buildAndSetGameLoop\n oneStep = proc do\n # update actors\n updateSprites\n\n # check for collision\n checkCollisions\n\n # removed dead things\n cleanupSprites\n end\n oneFrameAmt = Duration.millis( 1000.0 / getFramesPerSecond )\n oneFrame = KeyFrame.new oneFrameAmt, oneStep\n\n # sets the game world's game loop (Timeline)\n infinite_loop = TimelineBuilder.create\n .cycleCount(Animation::INDEFINITE)\n .keyFrames(oneFrame)\n .build\n\n setGameLoop infinite_loop\n end", "def start\n\t\tif @game_over\n\t\t\traise Exception.new(\"GAME #{@id} IS ALREADY OVER\")\n\t\tend\n\t\tplayer_number = 1\n\t\tloop do\n\t\t\t@game_over = player_turn @players[player_number], player_number\n\t\t\tplayer_number = player_number % 2 + 1\n\t\t\tbreak if @game_over\n\t\tend\n\tend", "def run\n until self.board.over?\n play_turn\n end\n\n if self.board.won?\n winning_player = self.players[self.board.winner]\n puts \"#{winning_player.name} won the game!\"\n else\n puts \"No one wins!\"\n end\n end", "def play\n while true\n speel_game\n break unless speel_opnieuw?\n end\n puts \"Bedankt voor het spelen!\"\nend", "def main_loop\n# Set up the objects the main loop will\n# need.\n\n# The screen is the window displayed on the\n# screen.\nscreen = Screen.new [640, 480]\n\n# The event queue handles events from the\n# operating system\nqueue = EventQueue.new\n\n# The clock limits the framerate to 30fps\nclock = Clock.new\nclock.target_framerate = 30\n\n# This is the infinite main loop\nloop do\n# Pause the program for a short amount of\n# time so it doesn't exceed 30fps\nclock.tick\n\n# Process all events, return if the window\n# was closed\nqueue.each do|e|\nreturn if e.is_a? QuitEvent\nend\n\n# Fill the screen with a grey color and\n# display it on the monitor\nscreen.fill [200, 200, 200]\nscreen.update\nend\n\nensure\nRubygame.quit\nend", "def run_loop\n end", "def main_loop\n @main_loop ||= lambda do\n # Smoother, but slower: GC.start if rand > 0.98\n next_step\n SUBSTEPS.times do\n move\n targeting\n handle_input\n remove_marked\n step_physics\n end\n end\n end", "def run(sleep_period = 0)\n loop do\n show\n evolve\n sleep(sleep_period)\n end\n ensure\n close_game\n end", "def start_game_loop(selection)\n case selection\n when 1\n new_fight = Fight.new(superhero: todays_hero)\n new_fight.start_battle(todays_hero)\n @enemy = Villain.find_by(id: new_fight.villain_id)\n url = URI.parse(@enemy.img)\n res = test_url(url)\n print_picture(url) if res.code == \"200\"\n new_fight.battle(superhero: todays_hero, villain: self.enemy)\n when 2\n @todays_hero.train\n when 3\n run_quest\n when 4\n url = URI.parse(@todays_hero.img)\n res = test_url(url)\n print_picture(url) if res.code == \"200\"\n @todays_hero.display_stats\n when 5\n display_instructions\n when 6\n display_board\n when 7\n return \n end\n display_menu\n end", "def start_game\n begin\n @game_text.intro\n\n # Run the tutorial\n ActionDirector.new(@world, @player).call({command: :talk, target: :jerry})\n\n # The main game\n while @player.alive? && @world.has_hostiles?\n @player.in_battle? ? battle_loop : game_loop\n end\n\n @player.alive? ? @player.win : @player.defeat\n rescue SystemExit, Interrupt # Catpure ctrl+c exit, end gracefully\n @game_text.exit\n end\n end", "def start_a_game\n jeopardy_board\n play_game\nend", "def play_round\n loop do\n self.board.display_board\n self.player1.turn_action\n if self.player1.winner? || self.board.board_full?\n break\n end\n self.player2.turn_action\n if self.player2.winner? || self.board.board_full?\n break\n end\n end\n self.board.display_board\n end", "def play\n until over? do\n turn;\n end\n\n if won?\n puts \"Congratulations #{winner}!\";\n replay\n elsif draw?\n puts \"Cat's Game!\";\n replay\n end\n end", "def run\n @running = true\n clock = Rubygame::Clock.new()\n queue = Rubygame::EventQueue.new()\n queue.enable_new_style_events\n rl = ResourceLocator.instance\n \n clock.tick\n while @running and self.current\n pre_transition = self.current # All events in the queue are applied to the\n # current state\n mouseUps = []\n queue.each do |event|\n pre_transition.raw(event) if pre_transition.respond_to?(:raw)\n case(event)\n when QuitRequested\n @running = false\n when KeyPressed\n result = @hooks[event.key]\n result.call(self) if result\n #puts event.key\n pre_transition.keyEvent(event,true)\n when KeyReleased\n pre_transition.keyEvent(event, false)\n when MouseMoved\n pre_transition.mouseMove(event)\n when MousePressed\n pre_transition.mouseDown(event)\n when MouseReleased\n mouseUps << event\n end\n end\n \n # This is done outside of the event-handling loop, because otherwise\n # the when the continuations it causes (i.e. pressing the 'done' button)\n # return, they bring back the old state of the event queue with them,\n # and the mouse events are re-played.\n mouseUps.each do | event |\n pre_transition.mouseUp(event)\n end\n \n rl.screen.fill([0,0,0])\n current.draw(rl.screen) if current\n rl.screen.flip\n elapsed = clock.tick / 1000.0\n current.update(elapsed) if current\n\n Rubygame::Clock.wait(50)\n \n end\n Rubygame::quit\n end", "def play\n display_welcome_message\n loop do\n number_of_games = 0\n loop do\n computer.choose(@human)\n human.choose\n display_moves\n increment_game_count\n puts\n display_winner\n display_score\n update_win_history\n number_of_games += 1\n puts\n break if first_to_score?(10)\n end\n display_final_outcome\n reset_game\n break unless play_again?\n end\n display_goodbye_message\n end", "def game_loop\n\t\tputs \"Welcome to the game of RED versus BLACK in a \"\n\t\tputs \"Connecting Four battle of wits and colored tokens\"\n\t\tputs \"\"\n\t\tprint \"#{ @turn %2 == 0 ? \"BLACK\" : \"RED\" } will go first!\\n\\n\"\n\t\n\t\tloop do\n\t\t\tdisplay_board\n\n\t\t\t@turn % 2 == 0 ? player = \"black\" : player = \"red\"\n\t\t\tprint \"#{player.upcase}! Into which column would you like to drop your token?\"\n\n\t\t\tinput = 100\n\t\t\tuntil valid?(input)\n\t\t\t\tinput = gets.chomp.to_i \n\t\t\tend\n\n\t\t\tsite = drop_token(player, input)\n\n\t\t\tif winner?(site)\n\t\t\t\tputs \"\\n\\n\"\n\t\t\t\tdisplay_board\n\t\t\t\tputs \"Congratulations #{player}! You've won!\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\t@turn += 1\n\t\tend\n\tend", "def run_full_game()\n set_max_games()\n name_all_players()\n puts play_through_set_of_games()\n set_determine_set_winner()\n puts overall_winner_message()\n end", "def main_loop(fps = 60)\n self.fps = fps\n @ran_main_loop_p = true\n init_sync\n drive_mainloop do\n poll_event\n if block_given?\n screen.fill_rect(0, 0, screen.w, screen.h, background_color) if background_color\n yield(screen)\n end\n sync\n screen.flip\n end\n end", "def play\n display_welcome_message\n loop do \n human.choose #.choose is an instance method on the Player class, since human is an object of the Player class\n computer.choose\n display_winner\n break unless play_again? #could put play again loop here, but easier to not have double loop here\n end \n display_goodbye_message\n end", "def perform\n\tgame_menu\n\tgameplay\nend", "def play\n #turns = 0\n until over?\n turn\n end\nend", "def play\n # Game play asks for players input on a turn of the game\n # Game play checks if the game is over after every turn\n # Game play plays the first turn of the game\n # Game play plays the first few turns of the game\n # Game play checks if the game is won after every turn\n # Game play checks if the game is a draw after every turn\n while !over?\n turn\n end\n # Game play stops playing if someone has won\n # Game play congratulates the winner X\n # Game play congratulates the winner O\n if won?\n puts \"Congratulations #{winner}!\"\n # Game play stops playing in a draw\n # Game play prints \"Cat's Game!\" on a draw\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n\n while @game_complete == false\n\n # starting game text to help the player create a mental picture of the environment\n @new_player_name = \"Mr Developer\" if @debug\n player_set_up unless @debug || @starting_game_text == false\n puts starting_game_text unless @debug || @starting_game_text == false\n @starting_game_text = false\n \n slow_type(\"\\nYou are in #{find_room_by_id(@current_room_id).name}\")\n main_menu = TTY::Prompt.new\n\n choices = [\n { name: 'Move Player', value: 1 },\n { name: 'Look At', value: 2 },\n { name: 'Pick Up', value: 3 },\n { name: 'Use Item', value: 4 },\n { name: 'Talk To', value: 5 },\n { name: 'Quit', value: 6 },\n ]\n attr = main_menu.select(slow_type(\"What would you like to do?\"), choices)\n\n # gets user input\n \n if attr == 1\n player_move\n \n elsif attr == 2\n look_at\n\n elsif attr == 3\n pick_up\n\n elsif attr == 4\n use_item\n\n elsif attr == 5\n talk_to\n \n else attr == 6\n @game_complete = true\n end\n\n end\n end", "def start\n \t\tself.board.display_instruction\n \t\tcurrent_player = select_first_player\n \t\t(self.board.size).times do \n \t\t\tplay(current_player)\n \t\t\tcurrent_player = next_of current_player \n end\n display_winner(nil, true)\n \tend", "def play\n #calls to all the methods that produce game!\n end", "def play\n display_welcome_message\n\n # Each game...\n loop do\n # Each round...\n loop do\n display_game_history unless rounds.empty?\n round_results = Round.new(human, computer).play\n @rounds << round_results\n break if winner?\n end\n\n set_winner\n display_end_game\n\n break unless play_again?\n reset_game\n end\n\n display_goodbye_message\n end", "def main\n\t\tstart\n\t\twhile self == SceneManager.scene\n\t\t\tGraphics.update\n\t\t\tController.keyboard.update\n\t\t\tupdate\n\t\t\tController.wait_next_frame\n\t\tend\n\t\tterminate\n\tend", "def run\r\n catch :quit do\r\n loop do\r\n # Prepare events\r\n @event_queue.fetch_sdl_events\r\n @event_queue << @clock.tick\r\n\r\n # Handle events\r\n @event_queue.each do |event|\r\n yield event if block_given?\r\n # Stop this program if the user closes the window\r\n throw :quit if event.is_a? Rubygame::Events::QuitRequested\r\n end\r\n end\r\n end\r\n end", "def play\n start = Time.now\n until @board.won?\n @player ? round_player : round_ai\n @attempts += 1\n sleep(2)\n system(\"cls\")\n @board.render\n end\n finish = Time.now\n time_to_finish = finish - start\n declare_win(time_to_finish)\n end", "def run\n while 1\n if step == 1 then break end\n end\n end", "def play()\n until over?() == true\n turn()\n end\n if draw?() != true\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cat's Game!\"\n end\n end", "def startGame\n\tif !$running\n\t\t$gui.hide_info()\n\t\t$gui.hide_scored()\n\t\t$p1.reset_position()\n\t\t$p2.reset_position()\n\t\t$ball.reset_position()\n\t\t$ball.start()\n\t\t$running = true\n\tend\nend", "def run\n game = Game.new\n game.game_start\nend", "def play_game\n @board.print_board\n until @quit || @restart || gameover?\n cell = take_turn(@current_player)\n if !cell.nil?\n coordinates = get_coordinates(cell)\n change_board(coordinates) if valid_cell?(coordinates)\n end\n @current_player = switch_player(@current_player)\n @board.print_board unless @restart || @quit\n end\n reset_board if @restart\n ending_screen if gameover?\n\n end", "def step\n if @game_over\n game_over!\n @event_handler.update\n else\n # background for playing field and hud\n @screen.fill :black\n @screen.fill [50,50,50], Rect.new(Configuration.screen[:hud_rect])\n\n @event_handler.update\n @hud.update @clock.framerate.ceil, @round, @enemies.length, @money, @lives+1, @round_timer\n\n update_timer\n restock_enemies! if @restock_enemies > 0\n\n @the_path.draw @screen # Draw the enemy path.\n @enemies.draw @screen # Draw the enemies.\n @towers.draw @screen # Draw all set towers.\n @grid_highlighter.draw @screen # Draw the nifty semi-transparent highlighter below the mouse.\n @hud.draw @screen # draw the HUD\n end\n\n @screen.update() # Refresh the screen.\n end", "def play_game(game)\n keep_playing = true\n while keep_playing\n game.play_round\n keep_playing = game.play_again?\n end\n end", "def play\r\n display_welcome_message\r\n init_players\r\n\r\n loop do\r\n play_match\r\n break unless play_again?\r\n end\r\n\r\n display_goodbye_message\r\n end", "def play\n @board.display\n while true\n\n # begin\n coords = get_input\n perform_move(coords) if valid_move_sequence?(coords)\n @board.display\n # rescue ArgumentError => e\n # puts \"Could not execute move sequence.\"\n # puts \"Error was: #{e.message}\"\n #\n # end\n\n end\n end", "def play\n board_setup\n gameplay_setup\n end", "def play_game(game)\n\n\t\twhile game.totalHills > 1 and game.turn < 1000 \t\n\t \tgame.turn \n\t end\n\tend", "def run\n if @load_save == true\n puts 'Would you like to play your last saved game? (Yes/No)'\n gets.chomp.downcase == 'yes' ? load_game : (puts \"\\n#{@computer} is coming up with your word.\\n\")\n chosen_word\n end\n loop do \n start_game\n checker\n win_lose\n end\nend", "def play\n @board.print_board\n 9.times do |turns|\n if turn\n break\n end\n end\n end", "def play_game\n loop do\n @turn += 1\n puts '########################################'\n puts \"Turn #{@turn}:\"\n puts '########################################'\n @players.each do |p|\n puts ''\n p.turn\n next unless !@is_final_round && p.score >= 3000\n @is_final_round = true\n final_round(p)\n break\n end\n\n break if @is_final_round\n end\n end", "def run_game\n\n #creating the players\n\n player1 = Player.new(\"Player 1\")\n player2 = Player.new(\"Player 2\")\n @players << player1\n @players << player2\n\n @active_player = @players[1]\n\n while (@active_player.life > 0)\n run_round\n end\n\n game_over\n\n end", "def play\r\n while !over?\r\n turn\r\n end\r\n if won?\r\n puts \"Congratulations #{winner}!\"\r\n elsif draw?\r\n puts \"Cats Game!\"\r\n end\r\n end", "def run\n @music.play(:repeats => -1)\n\thook_run()\n\thook_quit()\n\t# Handling input\n\tloop do\n\t @queue.each do |event|\n\t\thandle(event)\n end\n\t# Draw the image to screen\n\t@intro_screen.blit(@screen,[0,0])\n\t@screen.flip()\n end\n end", "def run_game\n @num_players.times do\n accept_player_connection\n end\n\n loop do\n @players.each do |player_name,socket|\n socket.puts 'move'\n input = socket.gets\n if check_win(input)\n inform_players_of_win(player_name)\n report_results(player_name)\n @wrapper_connection.close\n return\n end\n end\n end\n end", "def play_round\n system(\"clear\")\n @board.render\n puts\n full_move = self.get_full_move\n pos = self.get_position(full_move)\n action = self.get_action(full_move)\n while action.downcase == \"e\" && !(self.valid_flip?(pos))\n self.display_unflag_message\n full_move = self.get_full_move\n pos = self.get_position(full_move)\n action = self.get_action(full_move)\n end\n action.downcase == \"e\" ? @board[pos].reveal : @board[pos].toggle_flag\n @board.reveal_bombs if @board.is_a_bomb?(pos) && @board[pos].revealed\n end", "def game\n game_mode \n set_solution\n until (@turns_left < 1 || @winner)\n guess\n checker\n @turns_left -= 1\n status\n end\n end", "def speel_game\n begin_spel\n puts \"Veel succes!\"\n\n while true\n laat_bord_zien\n set_move get_valid_move\n @zetten += 1\n break if game_over?\n switch_player\n end\nend", "def runner\n # code runner here\n welcome()\n total = initial_round()\n while total < 21 do\n total = hit?(total)\n display_card_total(total)\n end\n end_game(total)\nend", "def play\n until over? do\n turn\n end\n if draw?\n puts \"Cat's Game!\"\n else\n puts \"Congratulations #{winner}!\"\n end\nend", "def play\n until over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def runLoop()\n\t\tgameWon = false;\n\n\t\t# Setup the command for when in a house and when in the neighborhood\n\t\tneighborhoodCommands = Command.new(nil);\n\t\thouseCommands = Command.new(\"house\");\n\t\thome = nil; \n\t\t\n\t\t# Game Loop until Player dies or game is won\n\t\twhile(!gameWon)\n\t\t\t# Check to see if is in a home or not\n\t\t\tif(home === nil)\n\t\t\t\thome = neighborhoodLoop(neighborhoodCommands, home);\n\t\t\telse\n\t\t\t\thomeLoop(houseCommands, home);\n\t\t\t\thome = nil;\n\t\t\tend\n\n\t\t\t# Check for player death\n\t\t\tif(@player.health == 0)\n\t\t\t\tputs \"You have died and failed everyone in your neighborhood. Too Bad!\";\n\t\t\t\treturn nil;\n\t\t\tend\n\n\t\t\t# Check if neighborhood is clear\n\t\t\tif(@neighborhood.all_clear())\n\t\t\t\tgameWon = true;\n\t\t\tend\n\t\tend\n\n\t\tputs \"You have saved the neighborhood!!!\"\n\tend" ]
[ "0.87649673", "0.8544371", "0.8425255", "0.80018187", "0.76502776", "0.76035655", "0.758828", "0.7516517", "0.74487525", "0.74096924", "0.729788", "0.72965634", "0.7294417", "0.72561574", "0.7174715", "0.715", "0.71041787", "0.71010053", "0.7091696", "0.7075392", "0.706808", "0.7043074", "0.7030163", "0.7023911", "0.700877", "0.6982762", "0.6982762", "0.6979373", "0.6978735", "0.69751436", "0.69249964", "0.69231445", "0.69202864", "0.69081557", "0.69071", "0.68998975", "0.68883395", "0.68779695", "0.6875584", "0.6871847", "0.6865848", "0.6854591", "0.68421614", "0.68396914", "0.6833427", "0.68312794", "0.6828565", "0.6828157", "0.68224484", "0.6821487", "0.6807681", "0.68026054", "0.6797178", "0.67963314", "0.6793901", "0.6783424", "0.6782435", "0.6777335", "0.67754614", "0.67633784", "0.676244", "0.6761443", "0.6760764", "0.6747047", "0.6729522", "0.672771", "0.67190236", "0.6715788", "0.67119414", "0.6707313", "0.6698257", "0.66981477", "0.6697025", "0.6691025", "0.668292", "0.66818964", "0.6679874", "0.66738105", "0.66709876", "0.6661237", "0.666096", "0.6658855", "0.66573906", "0.6654653", "0.66534853", "0.66452146", "0.6643138", "0.66383874", "0.6637362", "0.663672", "0.6632035", "0.66317266", "0.66268635", "0.6615835", "0.66147316", "0.6610957", "0.6607963", "0.6604291", "0.66033185", "0.65991986" ]
0.6599419
99
for position 4 (count < position1) at line no. 33 count position curr == nil? 1 4 2 (no) 2 4 3 (no) 3 4 yes = raise for position 5 (count < position1) at line no. 29 count position curr == nil? 1 5 2 (no) 2 5 3 (no) 3 5 nil (yes) it goes further because still counter is remaining till go to position1 4 5 nil (yes) it raise here at line number 29
def delete(head, val) current = head prev = nil while (current != nil) if current.value == val # if it's a first element if prev == nil return head.next # else any element which is not first but 2nd, 3rd and so forth else prev.next = prev.next.next break end else prev = current current = current.next end end return head end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startcheck(pos) #position\n set = [pos,pos] #initialized so ruby recognizes type\n numfound = 0\n\n numfound = check(set,pos,numfound)\n\n #cleanup => \n #unmark those we marked, they don't-need-to/shouldn't be condensed\n if(numfound<3)\n if numfound == 1 #we found only this node\n @board[set[0]].unmark\n else #we found and appended only one other\n @board[set[0]].unmark\n @board[set[1]].unmark\n end\n end\n end", "def main\n\n while line = ARGF.gets do \n next if line.match(\"^#\")\n \n cols = line.chomp.split(/\\s+/)\n \n allelec = [0,0,0,0]\n pos = cols[1] \n cols[3..-1].each do |gt|\n a = gt.split(';')\n 1.upto(4) do |i|\n n = a[i].to_i\n# a[1..-1].each do |n|\n if n > 0\n allelec[i-1] += 1\n end\n # allelec += n.to_i\n end\n end\n \n ga = allelec.select {|g| g > 0}\n if ga.size > 1\n puts line\n# if pos == \"121320556\"\n # $stderr.puts ga.join(\"\\t\")\n # end\n end\n end\nend", "def checker(a,player)\ncounter = 0\ni = 5\ncontroller = 0\nplayer = player\n\nwhile (i >= 0 && counter != 4)\nj = 0\n\twhile ( j <= 5 && counter != 4)\n\t\tcontrol = 1\n\t\tstorer = j \n\t\tstorer2 = i\n\t\tcounter = 0\n\n\t\twhile(a[storer2][storer] != \" \" && counter != 4 && control != 0)\t\n\t\t\tif (a[storer2][storer+1] != nil && a[storer2][storer] == player && storer <= 5)\n\t\t\tcounter = counter + 1\n\t\t\tstorer = storer + 1\n\t\t\telse\n\t\t\tcounter = 1\n\t\t\tcontrol = 0\n\t\t\tend\n\t\tend\n\t\t\tif (counter == 4)\n\t\t\treturn true\n\t\t\tend\n\n\t\tstorer = j\n\t\tstorer2 = i\n\t\tcontrol = 1\n\t\tcounter = 0\n\n\t\twhile(a[storer2][storer] != \" \" && counter != 4 && control != 0)\n\t\t\tif(a[storer2-1][storer+1] != nil && player == a[storer2][storer] && storer <= 5 && storer2 >=0)\n\t\t\tcounter = counter + 1\n\t\t\tstorer2 = storer2 - 1\n\t\t\tstorer = storer + 1\n\t\t\telse\n\t\t\tcounter = 1\n\t\t\tcontrol = 0\n\t\t\tend\n\t\tend\n\t\t\tif (counter == 4)\t\t\t\n\t\t\treturn true\n\t\t\tend\n\n\n\t\tstorer = j\n\t\tstorer2 = i\n\t\tcontrol = 1\n\t\tcounter = 0\n\n\t\twhile(a[storer2][storer] != \" \" && counter != 4 && control != 0)\n\t\t\tif(a[storer2-1][storer] != nil && a[storer2][storer] == player && storer2 >= 0)\n\t\t\tcounter = counter + 1\n\t\t\tstorer2 = storer2 - 1\n\t\t\telse\n\t\t\tcounter = 1\n\t\t\tcontrol = 0\n\t\t\tend\n\n\t\tend\n\t\t\tif (counter == 4)\n\t\t\treturn true\n\t\t\tend\n\n\t\tstorer = j\n\t\tstorer2 = i\n\t\tcontrol = 1\n\t\tcounter = 0\n\n\t\twhile(a[storer2][storer] != \" \" && counter != 4 && control != 0)\n\t\t\tif(a[storer2-1][storer-1] != nil && a[storer2][storer] == player && storer2 >= 0 && storer >=0)\n\t\t\tcounter = counter + 1\t\t\t\n\t\t\tstorer2 = storer2 - 1\n\t\t\tstorer = storer - 1\n\t\t\telse\t\t\t\n\t\t\tcounter = 1\n\t\t\tcontrol = 0\n\t\t\tend\n\t\tend\n\n\t\t\tif (counter == 4)\n\t\t\treturn true\n\t\t\tend\n\n\tj = j +1\n\tend\ni = i - 1\nend\nend", "def check_condition \n\t\tnumber_rule = 0\n\t\tnew_path = Array.new(6) {elem = 0}\n\t\ti = 0\n\t\tj = 0\n\t\tn = 1\n\t\t\n\t\twhile i < 6\n\t\t\tif @path[@last_position[0]][@last_position[1]][i] == 'nil'\n\t\t\t\t@path[@last_position[0]][@last_position[1]][i] = 0\n\t\t\tend\n\t\t\t\n\t\t\tif @path[@last_position[0]][@last_position[1]][i] == 1\n\t\t\t\tn = i - @direction \n\t\t\t\tnew_path[(n.abs % 6 )] = 1 \n\t\t\tend\n\t\t\t\n\n\t\t\ti += 1\n\t\tend\n\t\ti = 0\n\t\t\n\t\twhile i < @count_rule\n\t\t\t#puts \"count_rule: #{@count_real_rule}\"\n\t\t\n\t\t\tif new_path == @rule_status[i]\n\t\t\t\treturn i\n\t\t\tend\n\t\t\t\n\t\t\ti += 1\n \t\tend\n \t\tif (@count_real_rule == @count_rule)\n \t\t\treturn 8\n \t\telse\n\t\t\t@rule_status[@count_real_rule] = new_path \n\t\t\t@count_real_rule += 1\n\t\t\tcheck_condition\n\t\tend\n\tend", "def missing_one_at_either_end\n [2,3].each { |i|\n return true if @counts[i]>0 && @counts[i+1]>0 && @counts[i+2]>0\n }\n return false\n end", "def freed_prisoners(arr)\n counter = 0\n return counter if arr[0] == 0\n arr.each do |cell|\n if cell == 1\n counter += 1\n arr.map! do |switch|\n if switch == 1\n switch = 0\n else\n swith = 1\n end\n end\n else\n next\n end\n end\n counter\nend", "def check_for_tie\n filled_spots = []\n i = 1\n board.each do |spot|\n if spot == i\n i += 1\n else\n filled_spots.push(i)\n i += 1\n end\n next\n end\n filled_spots.length == 9\n end", "def seek\n while @next < @n && @ptns[@next].size == @nums[@next]\n @next += 1\n end\n @next < @n # return true/false\n end", "def count_next_index()\n if @operation == :pour\n if @second_index + 1 >= @original_state.size\n @second_index = 0\n @first_index += 1\n else\n @second_index += @second_index + 1 == @first_index ? 2 : 1\n end\n if @first_index + 1 == @original_state.size && @second_index + 1 >= @original_state.size\n @operation = :nop\n end\n else\n if @first_index + 1 < @original_state.size\n @first_index += 1\n else\n @first_index = 0\n @operation = @operation == :fill ? :empty : :pour\n end\n end\n end", "def setNumFromPairs record, sequenceArr,index\n paramindex=sequenceArr[index]\n tmpArry = []\n num =0\n tag = 1\n flag=1\n for i in 0...@parameters.paramsArr[paramindex].elementsArr.length do\n\t\t flag=1\n for j in 0...index do\n tag =1\n for k in 0...@pairs.length do #for k do start\n if @pairs[k].secondParam == paramindex and @pairs[k].firstParam == sequenceArr[j] ####if start\n for h in 0...@pairs[k].pairsArr.length do #for h do start\n if @pairs[k].pairsArr[h].secondValue == i and @pairs[k].pairsArr[h].firstValue ==record.valuesArr[sequenceArr[j]] and @pairs[k].pairsArr[h].isVisited == false\n num+=1 \n tag=0\n break #break for h\n elsif @pairs[k].pairsArr[h].secondValue ==i and @pairs[k].pairsArr[h].firstValue == record.valuesArr[sequenceArr[j]] and @pairs[k].pairsArr[h].isVisited == 'disabled'\n flag=0\n break #break for h\n end \n end #for h do end\n elsif @pairs[k].firstParam == paramindex and @pairs[k].secondParam == sequenceArr[j] ####ifels\n for h in 0...@pairs[k].pairsArr.length do ##for h do start \n if @pairs[k].pairsArr[h].firstValue == i and @pairs[k].pairsArr[h].secondValue ==record.valuesArr[sequenceArr[j]] and @pairs[k].pairsArr[h].isVisited == false \n num+=1\n tag=0\n break #break for h\n elsif @pairs[k].pairsArr[h].firstValue ==i and @pairs[k].pairsArr[h].secondValue ==record.valuesArr[sequenceArr[j]] and @pairs[k].pairsArr[h].isVisited == 'disabled'\n flag=0\n break #break for h\n end\n end ##for h do end\n if tag == 0 or flag ==0\n break #break for k\n end\n end ####if end \n end #for k do end\n if flag ==0\n break #break for j\n end\n end\n if flag ==1\n tmpArry << [i , num]\n end\n num=0\n end\n return tmpArry\n end", "def no_unison(count, i) \n if @note1 == @note2\n if DIATONIC_SCALE[i] == Scales::FA or DIATONIC_SCALE[i] == Scales::DO\n count += 1\n else\n count += 2\n end\n i += 1\n end\n [count, i]\n end", "def check(lines_mod)\n index = 0\n indexes = []\n acc = 0\n until index == lines_mod.length\n indexes << index\n case lines_mod[index][0..2]\n when 'acc'\n acc += lines_mod[index].match(/[\\-\\+]\\d+/).to_s.to_i\n index += 1\n when 'nop'\n index += 1\n when 'jmp'\n index += lines_mod[index].match(/[\\-\\+]\\d+/).to_s.to_i\n end\n raise 'nope' if indexes.include?(index)\n end\n acc\nend", "def off_by_one_number?(my_ticket, winning_ticket)\n\n\tcounter = 0\n\tindex = 0\n\n\tmy_ticket.length.times do\n\n\t\t# puts winning_ticket[index]\n\t\t# puts my_ticket[index]\n\t\tif winning_ticket[index] == my_ticket[index]\n\t\t\tcounter += 1\n\t\t# puts counter # shows count of matching index pos/each iteration\n\t\tend\n\t\tindex += 1\n\n\tend\n\n\tcounter == my_ticket.length - 1 # returns true/false depending on condition\n\nend", "def last_exercise_correctly_done_before(index)\n index -= 1\n while index >= 0 && !self.user_sequence[index][3] do\n index -= 1\n end\n if index >= 0\n return self.user_sequence[index][0]\n else\n return nil\n end\n end", "def handle\n @counter[@counterIndex]=@counter[@counterIndex]+1\n if(@counter[@counterIndex]) >= @parameters.paramsArr[@counterIndex].elementsArr.length\n @counter[@counterIndex]= 0\n @counterIndex= @counterIndex-1\n if(@counterIndex >= 0)\n #puts \"%%%%%%%%%%\"\n handle\n \n end\n @counterIndex = @parameters.paramsArr.length-1\n end\n\n end", "def obstructed?(current_pos,other_pos,board)\n # debugger\n tester = other_pos\n # puts tester\n # sleep 2\n\n #\n # (-1..1).each do |i|\n # (-1..1).each do |j|\n\n\n if other_pos[0] > current_pos[0] #New position is below us\n if other_pos[1] > current_pos[1] #new position is on our right--bishop move\n tester[0] -= 1\n tester[1] -= 1\n until tester == current_pos\n # puts board.grid[tester[0]][tester[1]]\n # puts !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n # sleep 2\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n # return false if the piece at tester is not a nul piece\n tester[0] -= 1\n tester[1] -= 1\n end\n\n elsif other_pos[1] < current_pos[1] #new position on our left\n until tester == current_pos\n tester[0] -= 1\n tester[1] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n elsif other_pos[1] == current_pos[1] #new position is on our level horizontally\n until tester == current_pos\n tester[1] -= 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n end\n\n elsif other_pos[0] < current_pos[0] #New position is above us\n if other_pos[1] > current_pos[1] #new position is on our right\n until tester == current_pos\n tester[0] += 1\n tester[1] -= 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n elsif other_pos[1] < current_pos[1] #new position on our left\n until tester == current_pos\n tester[0] += 1\n tester[1] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n else #new position is on our level horizontally\n until tester == current_pos\n tester[0] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n end\n\n else #new position is at our level vertically\n if other_pos[1] > current_pos[1] #new position is on our right\n until tester == current_pos\n tester[1] -= 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n elsif other_pos[1] < current_pos[1] #new position on our left\n until tester == current_pos\n tester[1] += 1\n return false if !board.grid[tester[0]][tester[1]].is_a?(Nul_piece)\n end\n\n end\n end\n\n return false if board.grid[other_pos[0]][other_pos[1]].color == self.color\n # puts \"hello\"\n # sleep(2)\n true\n\n end", "def exhasusted?\n @index >= @lines.count\n end", "def judge_try\n on_try = false\n try_success = false\n try_pos = []\n\n # scan lion opposite side\n if @now_turn == @turn['first']\n piece_lion = @piece_lion\n row = 0\n is_upright = false\n else\n piece_lion = @piece_lion_inv\n row = 3\n is_upright = true\n end\n \n 3.times do |i|\n icon = @main_table.getItemIcon(row, i)\n if icon == piece_lion\n on_try = true\n try_pos = [row, i]\n end\n end\n \n if on_try\n move_pieces, pos_list, got_pieces = full_scan_movable(is_upright)\n hit = nil\n pos_list[0].each do |list|\n hit = list.index(try_pos)\n if hit\n break\n end\n end\n if hit == nil\n try_success = true\n end\n end\n\n return on_try, try_success\n end", "def breakpoint_count sequence\n seq = [0] + sequence + [sequence.length + 1]\n count = 0\n 0.upto(seq.length - 2) do |i|\n count += 1 if seq[i + 1] != seq[i] + 1\n end\n count\nend", "def verify(ans_arr, arr)\n p1 = []\n p2 = []\n [0,1,2].each do |i|\n [0,1,2].each do |j|\n if arr[i][j] == 1 \n p1.push(ans_arr[i][j])\n elsif arr[i][j] == 0\n p2.push(ans_arr[i][j]) \n end\n end\n end\n \n if p1.length == 3 \n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-3] == 15\n end\n if p1.length == 4\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-4] == 15\n puts \"Player entering 1 won\" if p1[p1.length-2] + p1[p1.length-3] + p1[p1.length-4] == 15\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-3] + p1[p1.length-4] == 15\n end\n if p1.length == 5\n puts \"Player entering 1 won\" if p1[p1.length-1] + p1[p1.length-2] + p1[p1.length-5] == 15 || \n p1[p1.length-1] + p1[p1.length-3] + p1[p1.length-5] == 15 ||\n p1[p1.length-1] + p1[p1.length-4] + p1[p1.length-5] == 15 ||\n p1[p1.length-2] + p1[p1.length-3] + p1[p1.length-5] == 15 ||\n p1[p1.length-2] + p1[p1.length-4] + p1[p1.length-5] == 15 || \n p1[p1.length-3] + p1[p1.length-4] + p1[p1.length-5] == 15 \n end\n if p2.length == 3 \n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-3] == 15\n end\n if p2.length == 4\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-4] == 15\n puts \"Player entering 0 won\" if p2[p2.length-2] + p2[p2.length-3] + p2[p2.length-4] == 15\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-3] + p2[p2.length-4] == 15\n end\n if p2.length == 5\n puts \"Player entering 0 won\" if p2[p2.length-1] + p2[p2.length-2] + p2[p2.length-5] == 15 || \n p2[p2.length-1] + p2[p2.length-3] + p2[p2.length-5] == 15 ||\n p2[p2.length-1] + p2[p2.length-4] + p2[p2.length-5] == 15 ||\n p2[p2.length-2] + p2[p2.length-3] + p2[p2.length-5] == 15 ||\n p2[p2.length-2] + p2[p2.length-4] + p2[p2.length-5] == 15 || \n p2[p2.length-3] + p2[p2.length-4] + p2[p2.length-5] == 15 \n end\nend", "def adjacent?(attempt)\n res = false\n attempt.push(100)\n previous = attempt[0]\n nums_in_a_row = 1\n attempt[1..-1].each do |num|\n if previous != num\n if nums_in_a_row == 2\n res = true\n break\n elsif nums_in_a_row != 1\n res = false\n end\n previous = num\n nums_in_a_row = 1\n else\n nums_in_a_row += 1\n end\n end\n res\nend", "def part1()\n @seats = @input.map(&:dup)\n until rules_part1() == 0\n end\n count = 0\n @seats.each { |row| count += row.count('#') }\n count\nend", "def external_check?(row,col)\n \n #Get values available in this block\n #------------------------------------------------------------------\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n \n section = []\n \n #Check row\n #Get values available in the other blocks in the current row\n #---------------------------------------------------------------------------------------------------\n 9.times do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(row,i) unless col==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n values_row = values.tr(section,\"\")\n \n if values_row.length == 1\n @rows[row][col] = values_row.to_s\n adjust_values\n return true\n else\n return false\n end \n #Check column\n #Get values available in the other blocks in the current column\n #---------------------------------------------------------------------------------------------------\n 9.times do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(i,col) unless row==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n \n values_col = values.tr(section,\"\")\n if values_col.length == 1\n @rows[row][col] = values_col.to_s\n adjust_values\n return true\n else\n return false\n end \n \n #Check block\n #Get values available in the other blocks in the current block\n #---------------------------------------------------------------------------------------------------\n blk = find_block(row,col)\n case blk\n when 0\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c-1) unless r=row and c=col\n\tend\n end\n when 1\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c+2) unless r=row and c=col\n\tend\n end\n when 2\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c+5) unless r=row and c=col\n\tend\n end\n when 3\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c-1) unless r=row and c=col\n\tend\n end\n when 4\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c+2) unless r=row and c=col\n\tend\n end\n when 5\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c+5) unless r=row and c=col\n\tend\n end\n when 6\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c-1) unless r=row and c=col\n\tend\n end\n when 7\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c+2) unless r=row and c=col\n\tend\n end\n else \n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c+5) unless r=row and c=col\n\tend\n end\n end \n \n @blks[blk].each do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(row,i) unless col==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n \n values_block = values.tr(section,\"\") \n if values_block.length == 1\n @rows[row][col] = values_block.to_s\n adjust_values\n return true\n else\n return false\n end \n end", "def last_exercise_done_before(index)\n if self.user_sequence[index][2] \n return self.user_sequence[index][0]\n else\n index -= 1\n while index >= 0 && !self.user_sequence[index][2] do\n index -= 1\n end\n if index >= 0\n return self.user_sequence[index][0]\n else\n return nil\n end\n end \n end", "def check_prow\n @prow = 0 if @prow < 0\n @pcol = 0 if @pcol < 0\n\n cc = @list.count\n @rows = rows()\n\n #$log.debug \" check_prow prow #{@prow} , list count #{cc}, rows #{@rows} \"\n # 2014-05-28 - 22:41 changed < to <= otherwise prow became -1 when equal\n if cc <= @rows\n @prow = 0\n else\n maxrow = cc - @rows - 1\n if @prow > maxrow\n @prow = maxrow\n end\n end\n #$log.debug \" check_prow after prow #{@prow} , list count #{cc} \"\n # we still need to check the max that prow can go otherwise\n # the pad shows earlier stuff.\n #\n return\n end", "def won?(board)\n counter = 0\n WIN_COMBINATIONS.select do |potential_win_combo|\n print potential_win_combo\n print \"\\n\"\n\n potential_win_combo.select do |potential_occupied|\n if\n position_taken?(board, potential_occupied)\n puts potential_occupied\n counter += 1\n else\n puts \"no\"\n end\n end\n end\nend", "def workbook(n, k, arr)\r\n # Write your code here\r\n sp = 0\r\n count = 0\r\n arr.each do |range|\r\n remainingArray = Array(1..range)\r\n until (remainingArray.empty?)\r\n count += 1\r\n x = remainingArray.slice!(0,k)\r\n sp +=1 if (x.include?count)\r\n end\r\n end\r\n return sp\r\nend", "def check_row\n \n\tcount = 1\n\t\n\t# Checking to the left.\n\tif @last_insert_x > 1\n\t\n\t i = @last_insert_x - 1\n\t player_symbol = assignment[@last_insert_x - 1][@last_insert_y - 1]\n\t next_symbol = assignment[i - 1][@last_insert_y - 1]\n\t \n\t while (i >= 1) && (count < 4) && (next_symbol == player_symbol)\n\t count += 1\n\t\ti -= 1\n\t\tnext_symbol = assignment[i - 1][@last_insert_y - 1]\n\t end\n\t\n\tend \n\t\n\t# Checking to the right.\n\tif @last_insert_x < width\n\t\n\t i = @last_insert_x + 1\n\t player_symbol = assignment[@last_insert_x - 1][@last_insert_y - 1]\n\t next_symbol = assignment[i - 1][@last_insert_y - 1]\n\t \n\t while (i <= width) && (count < 4) && (next_symbol == player_symbol)\n\t count += 1\n\t\ti += 1\n\t\tnext_symbol = (i < width + 1) ? assignment[i - 1][@last_insert_y - 1] : !player_symbol\n\t end\n\t \n\tend\n\t\n count >= 4\n end", "def turn_count()\n count = 0\n index = 0\n loop do\n if position_taken?(index)\n count += 1\n end\n index += 1\n if index > 9 \n break\n end\n end\n return count\n end", "def check_for_loop\n accumulator = 0\n visited = []\n\n i = 0\n while !visited.include?(i)\n visited << i\n case @data[i][0]\n when \"nop\"\n i += 1\n when \"acc\"\n accumulator += @data[i][1]\n i += 1\n when \"jmp\"\n i += @data[i][1]\n end\n end\n\n if i >= @data.length - 1\n return \"yay\"\n else\n return i\n end\nend", "def handleNoninSequence(n,seq)\n @mon.synchronize do\n @alarms = seq[:alarms]\n @spO2 = seq[:SpO2]\n @heartRate = seq[:heartRate]\n @greenp = seq.include?(:greenp) ? seq[:greenp].size : 0\n @redp = seq.include?(:redp) ? seq[:redp].size : 0\n @cond.broadcast\n lightYellowLED(@greenp > 0)\n end\n end", "def cpu_defend\n if check_position_1\n return\n elsif check_position_2\n\n elsif check_position_3\n\n elsif check_position_4\n\n elsif check_position_6\n\n elsif check_position_7\n\n elsif check_position_8\n\n elsif check_position_9\n return\n else\n cpu_place_move\n end\n end", "def available_spots(arr, num)\n count = 0\n arr.each_with_index do |item, index|\n next if index == arr.count - 1\n if item.odd? == arr[index + 1].odd? \n if item.odd? != num.odd?\n next\n else\n count += 1\n end\n else\n count += 1\n end\n end\n count\nend", "def check4aces num\n \tnum.each do |x|\n\t\tif x == 11\n\t\t\t@pScore.delete(11)\n\t\t\t@pScore << 1\n\t\tend\n\tend\n end", "def test_row_first(r)\n flag = false\n $pages[r-1].select{|p| (p.p >> PAGE_SHIFT).even? }.each {|p|\n $pages[r+1].select {|q| (q.p >> PAGE_SHIFT).even? and conflict?(p.v, q.v)\n }.each {|q|\n flag |= hammer_row(r, p, q, $ntime_max)\n } \n }\n return flag\nend", "def turn_count(board)\n count = 0\n\n board.each_with_index do |location, index|\n if position_taken?(board, index)\n count = count + 1\n end\n end\n\n count\nend", "def score_complete(i)\t\t\n if i == 9\t\t\t\t\t\t\t\t# last frame\n frame_score = @frame_scores[player - 1][i].reduce(:+)\n # puts frame_score\n # puts @game_scores[player - 1][-1]\n @game_scores[player - 1] << @game_scores[player - 1][-1] + frame_score\n\t\t\n elsif i == 8 && @frame_scores[player - 1][i][0] == 10\t\t# strike in 9th frame ->> take first two of 10th\n tally_comp(i,0,i+1,0,i+1,1)\n\t\t\t\t\n else\n if @frame_scores[player - 1][i][0] == 10\t\t\t\t# strike in current frame\n if @frame_scores[player - 1][i+1][0] == 10\t\t# followed by strike in next frame\n tally_comp(i,0,i+1,0,i+2,0)\n else\t\t\t\t\t\t\t# followed by anything else\n tally_comp(i,0,i+1,0,i+1,1)\n end\n elsif @frame_scores[player - 1][i].reduce(:+) == 10\t# spare in current frame\n tally_comp(i,0,i,1,i+1,0)\n else\t\t\t\t\t\t\t\t# no bonus\n tally_comp(i,0,i,1,nil,nil)\n end\n end\nend", "def score_complete(i)\t\t\n if i == 9\t\t\t\t\t\t\t\t# last frame\n frame_score = @frame_scores[player - 1][i].reduce(:+)\n # puts frame_score\n # puts @game_scores[player - 1][-1]\n @game_scores[player - 1] << @game_scores[player - 1][-1] + frame_score\n\t\t\n elsif i == 8 && @frame_scores[player - 1][i][0] == 10\t\t# strike in 9th frame ->> take first two of 10th\n tally_comp(i,0,i+1,0,i+1,1)\n\t\t\t\t\n else\n if @frame_scores[player - 1][i][0] == 10\t\t\t\t# strike in current frame\n if @frame_scores[player - 1][i+1][0] == 10\t\t# followed by strike in next frame\n tally_comp(i,0,i+1,0,i+2,0)\n else\t\t\t\t\t\t\t# followed by anything else\n tally_comp(i,0,i+1,0,i+1,1)\n end\n elsif @frame_scores[player - 1][i].reduce(:+) == 10\t# spare in current frame\n tally_comp(i,0,i,1,i+1,0)\n else\t\t\t\t\t\t\t\t# no bonus\n tally_comp(i,0,i,1,nil,nil)\n end\n end\nend", "def condition(cells)\n if cells[0][0]==cells[0][4] and cells[0][4]==cells[0][8] and cells[0][0]!=' '\n return 1\n elsif cells[1][0]==cells[1][4] and cells[1][4]==cells[1][8] and cells[1][4]!=' '\n return 1\n elsif cells[2][0]==cells[2][4] and cells[2][4]==cells[2][8] and cells[2][0]!=' '\n return 1\n elsif cells[0][0]==cells[1][4] and cells[1][4]==cells[2][8] and cells[0][0]!=' '\n return 1\n elsif cells[2][0]==cells[1][4] and cells[1][4]==cells[0][8] and cells[2][0]!=' '\n return 1\n elsif cells[0][0]==cells[1][0] and cells[1][0]==cells[2][0] and cells[0][0]!=' '\n return 1\n elsif cells[0][4]==cells[1][4] and cells[1][4]==cells[2][4] and cells[0][4]!=' '\n return 1\n elsif cells[0][8]==cells[1][8] and cells[1][8]==cells[2][8] and cells[0][8]!=' '\n return 1\n else\n return 0\n end\nend", "def next_move(player,board,move)\n completed = false;\n blocking = false;\n if(move == 1) #First Move (hard coded)\n puts \"2 0\";\n elsif(move == 2) #Second Move (hard coded)\n if(board[1][1] == 'X')\n puts \"2 2\";\n else\n puts \"1 1\";\n end \n elsif(move == 3) #Third move (hard coded)\n if(board[0][1] == 'O' || board[1][0] == 'O' || board[1][2] == 'O' || board[2][1] == 'O')\n puts \"1 1\";\n elsif(board[1][1] == 'O')\n puts \"0 2\";\n elsif(board[0][2] == 'O' || board[2][2] == 'O')\n puts \"0 0\";\n else\n puts \"2 2\";\n end\n else #Any move after the 3rd\n completed = can_complete(player,board)\n if(completed == false)\n blocking = must_block(player,board);\n if(blocking == false)\n prevent = can_complete(player,board)\n if(move == 4 && (board[0][0] == 'X' || board[0][2] == 'X' || board[2][0] == 'X' || board[2][2] == 'X') && (board[0][1] == 'X' || board[1][0] == 'X' || board[1][2] == 'X' || board[2][1] == 'X'))\n if(board[0][1] == 'X' || board[2][1] == 'X')\n puts \"1 0\";\n else\n puts \"0 1\";\n end\n elsif(move == 4 && ((board[0][0] == 'X' && board[2][2] == 'X') || (board[0][2] == 'X' && board[2][0] == 'X') || (board[0][1] == 'X' && board[2][1] == 'X') || (board[1][0] == 'X' && board[1][2] == 'X')))\n if((board[0][0] == 'X' && board[2][2] == 'X') || (board[0][2] == 'X' && board[2][0] == 'X'))\n puts \"0 1\";\n else\n puts \"0 0\";\n end\n elsif(move == 6 && (board[2][1] == 'X' || board[0][1] == 'X') && (board[1][0] == 'X' || board[1][2] == 'X') && board[2][2] == '_')\n puts \"2 2\";\n elsif(board[0][0] == \"_\")\n puts \"0 0\";\n elsif(board[0][2] == \"_\")\n puts \"0 2\";\n elsif(board[2][2] == \"_\")\n puts \"2 2\";\n elsif(board[2][0] == \"_\")\n puts \"2 0\";\n elsif(board[0][1] == \"_\")\n puts \"0 1\";\n elsif(board[2][1] == \"_\")\n puts \"2 1\";\n elsif(board[1][0] == \"_\")\n puts \"1 0\";\n elsif(board[1][2] == \"_\")\n puts \"1 2\";\n else\n puts \"1 1\";\n end\n end\n end\n end\nend", "def sequential\n return true if hand_to_val.last - hand_to_val.first == 4\n return false \n end", "def adjacent_mines(row, col)\n count = 0\n if @field[row + 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row + 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil?\n count = 0\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n elsif @field[row + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n elsif @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n else\n count = 0\n adjacent_cells(row, col).each do |cell|\n if cell.contains_mine?\n count += 1\n end\n end\n end\n count\n end", "def turn_count(board)\n\n\toccupied_spaces = 0\n\n\tcounter = 0\n\twhile counter < board.size\n\t if position_taken?(board, counter)\n\t\t occupied_spaces += 1\t\t \nend \ncounter += 1\nend\noccupied_spaces\nend", "def checker\n @correct_pos = 0\n @correct_num = 0\n x = 0\n @guess.each do |i|\n if (i == @solution[x])\n @correct_pos += 1\n elsif @solution.include?(i)\n @correct_num += 1\n end\n x += 1\n end\n end", "def valid_move?(board,index)\n #arrayIndex = index.to_i - 0\n if index.between?(0, 8) && !position_taken?(board,index)\n true\n else\n false\n\n\n\n\n end\n\nend", "def close_but_no_cigar\r\n\twinning_number = [\"1111\",\"2222\",\"3333\",\"4444\",\"5555\",\"6666\",\"7777\",\"8888\",\"9999\",\"1010\"]\r\n\tmy_ticket = \"2220\"\r\n\twinning_number_each do |winning_number|\r\n\t\tcounter = 0\r\n\t\ti=0\r\n\t\t4.times do\r\n\t\t\tif winning_number[i] = my_ticket[i]\r\n\t\t\t\tcounter += 1\r\n\t\t\tend\r\n\t\t\ti +=1\r\n\t\tend\r\n\t\tif counter == 3\r\n\t\t\tputs \"true\"\r\n\t\telse \r\n\t\t\tputs \"false\"\r\n\t\tend\r\nend\r\nend", "def posboard (position, count)\n\t\t\n\t\tcase position\n\t\t\twhen 0\n\t\t\tputs \"You are at the begining\"\n\t\t\tposition = 0\n\t\t\twhen 1\n\t\t\tputs \"On the board, you are on position 1 #~~~~~~~~\"\n\t\t\twhen 2\n\t\t\tputs \"On the board, you are on position 2 ##~~~~~~~\"\n\t\t\twhen 3\n\t\t\tputs \"On the board, you are on position 3 ###~~~~~~\" \n\t\t\twhen 4\n\t\t\tputs \"On the board, you are on position 4 ####~~~~~\"\n\t\t\twhen 5\n\t\t\tputs \"On the board, you are on position 5 #####~~~~\"\n\t\t\twhen 6\n\t\t\tputs \"On the board, you are on position 6 ######~~~\"\n\t\t\twhen 7\n\t\t\tputs \"On the board, you are on position 7 #######~~\"\n\t\t\twhen 8\n\t\t\tputs \"On the board, you are on position 8 #######~~\"\n\t\t\twhen 9\n\t\t\tputs \"On the board, you are on position 9 ########~\"\n\t\t\twhen 10\n\t\t\tputs \"On the board, you're on position 10 ######### CONGRATULATIONS YOU WON \"\n\t\t\tputs \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n\t\t\tputs \"~ The game took \" + count.to_s + \" repetitions to finish ~\"\n\t\t\tputs \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n\t\t\texit\n\t\telse\n\t\tputs \"Technical issue, restart the game\"\n\t\texit\n\t\tend\n\t\tcount = count + 1\nreturn count\n\nend", "def valid_move?(board, index)\n #this first if statement is checking if the index is on the board and if the position has been taken\n if index.between?(0,8) && position_taken?(board, index) == false\n p true\n elsif index > 9 || index < 0\n p false\n elsif position_taken?(board, index) == true\n p false\n end\nend", "def winner_check\n match = 0\n amounts = []\n bang_sign = 0\n at_sign = 0\n pound_sign = 0\n dollar_sign = 0\n percent_sign = 0\n carot_sign = 0\n amp_sign = 0\n star_sign = 0\n\n @row.each do |item|\n if item == @slot_char[0]\n bang_sign += 1\n elsif item == @slot_char[1]\n at_sign += 1\n elsif item == @slot_char[2]\n pound_sign += 1\n elsif item == @slot_char[3]\n dollar_sign += 1\n elsif item == @slot_char[4]\n percent_sign += 1\n elsif item == @slot_char[5]\n carot_sign += 1\n elsif item == @slot_char[6]\n amp_sign += 1\n elsif item == @slot_char[7]\n star_sign += 1\n end \n end\n amounts.push(bang_sign)\n amounts.push(at_sign)\n amounts.push(pound_sign)\n amounts.push(dollar_sign)\n amounts.push(percent_sign)\n amounts.push(carot_sign)\n amounts.push(amp_sign)\n amounts.push(star_sign)\n\n amounts.each do |totals|\n if totals > 1\n match += 1\n end\n end\n # p(match)\n if match == 1\n puts \"You won!\"\n puts \"Your balance: $#{@wallet.add_money(@bid + @bid)}\"\n self.go_back\n elsif match == 2\n puts \"You won!\"\n puts \"Your balance: $#{@wallet.add_money(@bid + @bid * 0.5)}\"\n self.go_back\n elsif match == 3\n puts \"You won!\"\n puts \"Your balance: $#{@wallet.add_money(@bid + @bid * 2)}\"\n self.go_back\n elsif match == 4\n puts \"BIG WIN!!!\"\n puts \"Your balance: $#{@wallet.add_money(@bid + @bid * 3)}\"\n self.go_back\n else\n puts \"Sorry you did not win! :(\"\n puts \"Your balance: $#{@wallet.current_balance}\"\n self.go_back\n end\n end", "def no_match() \n if $match_index_arr == []\n $turns = $turns - 1\n $index = $index + 1\n end\n end", "def scan\n x = position[0]\n y = position[1]\n !Robot.in_position(x, y).empty? || !Robot.in_position(x+1, y).empty? || !Robot.in_position(x-1,y).empty? || !Robot.in_position(x,y+1).empty? || !Robot.in_position(x,y-1).empty?\n end", "def won?(board)\n WIN_COMBINATIONS.detect do |win_index| # \"detect\" will only return the first element that makes the block true\n # puts win_index[0] # returns 0,3,6,0,1,2,0,6\n # (all 0 index values in WIN_COMBINATIONS[0][0],[1][0],[2][0],[3][0],[4][0],[5][0],etc.)\n # puts win_index[1] # returns 1,4,7,3,4,5,4,4\n # (all 1 index values in WIN_COMBINATIONS[0][1],[1][1],[2][1],[3][1],[4][1],[5][1],etc.)\n # puts win_index[2] # returns 2,5,8,6,7,8,8,2\n # (all 2 index values in WIN_COMBINATIONS[0][2],[1][2],[2][2],[3][2],[4][2],[5][2],etc.)\n # only need three [0,1,2] \"win_index[]\" because that is the length of child arrays\n # now check the board to see if indexes contain \"X\" or \"O\"\n board[win_index[0]] == \"X\" &&\n board[win_index[1]] == \"X\" &&\n board[win_index[2]] == \"X\" ||\n board[win_index[0]] == \"O\" &&\n board[win_index[1]] == \"O\" &&\n board[win_index[2]] == \"O\" &&\n\n position_taken?(board, win_index[0])\n # position_taken? checks if win_index[0] is not nil or not equal to \" \"\n end\n end", "def class_canceled n, array\n late = 0\n array.each do |x|\n if x > 0\n late += 1\n end\n end\n\n on_time = array.size - late\n if on_time >= n\n \"NO\"\n else\n \"YES\"\n end\nend", "def adjacent_mines(row, col)\n @total = 0\n if @mine_field[:bombs][col-1][row] == true\n @total+=1\n end\n if @mine_field[:bombs][col-1][row-1] == true\n @total+=1\n end\n if @mine_field[:bombs][col-1][row+1] == true\n @total+=1\n end\n if @mine_field[:bombs][col+1][row] == true\n @total+=1\n end\n if @mine_field[:bombs][col+1][row-1] == true\n @total+=1\n end\n if @mine_field[:bombs][col+1][row+1] == true\n @total+=1\n end\n if @mine_field[:bombs][col][row-1] == true\n @total+=1\n end\n if @mine_field[:bombs][col][row+1] == true\n @total+=1\n end\n @total\n end", "def check_pungs\n @tmp_count_group_by_tile.each do |tile, count|\n next if count < 3\n if block_given?\n yield(tile, count)\n else\n @tmp_count_group_by_tile[tile] -= 3\n @tmp_win_hand << Array.new(3, tile)\n end\n end\n end", "def has_next()\n !@array[@k+1].nil?\n end", "def good_tuples(nums)\n count = 0\n (0..nums.size - 3).each do |i|\n first, second, third = nums[i], nums[i + 1], nums[i + 2]\n next if 3 * first == first + second + third\n count += 1 if [first, second, third].include?(first ^ second ^ third)\n\n # next if nums[i] == nums[i + 1] && nums[i + 1] == nums[i + 2]\n # next if nums[i] != nums[i + 1] && nums[i + 1] != nums[i + 2] && nums[i] != nums[i + 2]\n end\n\n count\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |win_index| # \"detect\" will only return the first element that makes the block true\n# puts win_index[0] # returns 0,3,6,0,1,2,0,6\n# (all 0 index values in WIN_COMBINATIONS[0][0],[1][0],[2][0],[3][0],[4][0],[5][0],etc.)\n# puts win_index[1] # returns 1,4,7,3,4,5,4,4\n# (all 1 index values in WIN_COMBINATIONS[0][1],[1][1],[2][1],[3][1],[4][1],[5][1],etc.)\n# puts win_index[2] # returns 2,5,8,6,7,8,8,2\n# (all 2 index values in WIN_COMBINATIONS[0][2],[1][2],[2][2],[3][2],[4][2],[5][2],etc.)\n# only need three [0,1,2] \"win_index[]\" because that is the length of child arrays\n# now check the board to see if indexes contain \"X\" or \"O\"\n board[win_index[0]] == \"X\" &&\n board[win_index[1]] == \"X\" &&\n board[win_index[2]] == \"X\" ||\n board[win_index[0]] == \"O\" &&\n board[win_index[1]] == \"O\" &&\n board[win_index[2]] == \"O\" &&\n\n position_taken?(board, win_index[0])\n# position_taken? checks if win_index[0] is not nil or not equal to \" \"\n end\nend", "def minimumBribes(q)\n bribe = 0\n # reverse iteration\n for i in (q.size - 1).downto(0)\n # if line configuration is not possible\n if (q[i] - (i + 1)) > 2\n puts \"Too chaotic\"\n return\n end\n # check bribes at left \n for e in ([q[i] - 2, 0].max..i)\n bribe += 1 if q[e] > q[i]\n end\n end\n\n puts bribe\nend", "def check(position)\n puts position\n case position\n when 1\n if @board[0][0] == @board[0][1] and @board[0][0] == @board[0][2]\n return true\n elsif @board[0][0] == @board[1][0] and @board[0][0] == @board[2][0]\n return true\n elsif @board[0][0] == @board[1][1] and @board[0][0] == @board[2][2]\n return true\n else return false\n end\n when 2\n if @board[0][1] == @board[0][0] and @board[0][1] == @board[0][2]\n return true\n elsif @board[0][1] == @board[1][1] and @board[0][1] == @board[2][1]\n return true\n else return false\n end\n when 3\n if @board[0][2] == @board[0][1] and @board[0][2] == @board[0][0]\n return true\n elsif @board[0][2] == @board[1][2] and @board[0][2] == @board[2][2]\n return true\n elsif @board[0][2] == @board[1][1] and @board[0][2] == @board[2][0]\n return true\n else return false\n end\n when 4\n if @board[1][0] == @board[0][0] and @board[1][0] == @board[2][0]\n return true\n elsif @board[1][0] == @board[1][1] and @board[1][0] == @board[1][2]\n return true\n else return false\n end\n when 5\n if @board[1][1] == @board[0][0] and @board[1][1] == @board[2][2]\n return true\n elsif @board[1][1] == @board[1][0] and @board[1][1] == @board[1][2]\n return true\n elsif @board[1][1] == @board[0][1] and @board[1][1] == @board[2][1]\n return true\n elsif @board[1][1] == @board[0][2] and @board[1][1] == @board[2][0]\n return true\n else return false\n end\n when 6\n if @board[1][2] == @board[0][2] and @board[1][2] == @board[2][2]\n return true\n elsif @board[1][2] == @board[1][0] and @board[1][2] == @board[1][1]\n return true\n else return false\n end\n when 7\n if @board[2][0] == @board[0][0] and @board[2][0] == @board[1][0]\n return true\n elsif @board[2][0] == @board[1][1] and @board[2][0] == @board[0][2]\n return true\n elsif @board[2][0] == @board[2][1] and @board[2][0] == @board[2][2]\n return true\n else return false\n end\n when 8\n if @board[2][1] == @board[2][0] and @board[2][1] == @board[2][2]\n return true\n elsif @board[2][1] == @board[0][1] and @board[2][1] == @board[1][1]\n return true\n else return false\n end\n when 9\n if @board[2][2] == @board[2][0] and @board[2][2] == @board[2][1]\n return true\n elsif @board[2][2] == @board[0][0] and @board[2][2] == @board[1][1]\n return true\n elsif @board[2][2] == @board[0][2] and @board[2][2] == @board[1][2]\n return true\n else return false\n end\n else\n puts \"Error: Switch has a bug\"\n end\n end", "def not_a_match(no)\n if no == false\n @e += 1 \n else nil \n end\n end", "def walk_through\n count = 0\n for i in 0..@n-1\n for j in 0..@m-1\n if @garden[i][j] == 'W'\n @garden[i][j] = 'C'\n count += 1\n check_around(i,j)\n end\n end\n end\n puts count\n end", "def check_add_group size_of_group\n if @group_checker[size_of_group] == size_of_group\n puts \"Can't seat group of #{size_of_group} at any place.\"\n return true\n end\n \n @row = 0\n while @row < 27\n @seat = 0\n while @seat < 2\n if @places[@row][@seat] <= 3-size_of_group \n @places[@row][@seat] += size_of_group\n puts \"Seated a group of #{size_of_group} at #{@row}, #{@seat}(Places left : #{3 - @places[@row][@seat]}) \"\n return true\n end\n @seat+=1\n end\n @row+=1\n end\n \n if size_of_group == 1 and @row == 27 && @seat == 2\n puts \"Plane full\"\n return false\n else\n puts \"Can't seat group of #{size_of_group} at any place.\"\n @group_checker[size_of_group] = size_of_group \n return true\n end\n \nend", "def coverage(topic_sents, topic_sent_count, sents_to_cover, sentSim, threshold_topic_sentence)\n# puts(\"Inside coverage, #topic sents.: #{sents_to_cover.length}\")\n covered = false\n #iterating through the sentences that need to be covered\n for i in 0..sents_to_cover.length-1\n #checking that this sentence is not already covered\n if(sents_to_cover[i].flag_covered == false)\n# puts(\"Sentence to cover: #{sents_to_cover[i].ID}\")\n #covered = false;//setting covered for the sentence to false\n for j in 0..topic_sent_count-1\n if(sents_to_cover[i].ID == topic_sents[j].ID) #if the sentence to cover is the same as the topic sentence\n sents_to_cover[i].flag_covered = true\n covered = true #it is covered, else on breaking it returns false\n next\n end\n #threshold_topi_sentence varies with\n if(sents_to_cover[i].ID < topic_sents[j].ID and sentSim[sents_to_cover[i].ID][topic_sents[j].ID] >= threshold_topic_sentence) \n# puts(\"*** Sentence #{sents_to_cover[i].ID} Covered by #{topic_sents[j].ID}\")\n #if a high sim. edge exists between the sentence to be covered and the current sentence, then it is covered\n sents_to_cover[i].flag_covered = true\n covered = true #the sentence in 'sents_to_cover' was covered by the 'sents'\n next #break out since sentence was covered\n elsif(topic_sents[j].ID < sents_to_cover[i].ID && sentSim[topic_sents[j].ID][sents_to_cover[i].ID] >= threshold_topic_sentence)\n# puts(\"*** Sentence #{sents_to_cover[i].ID} Covered by #{topic_sents[j].ID}\")\n #if a high sim. edge exists between the sentence to be covered and the current sentence, then it is covered\n sents_to_cover[i].flag_covered = true\n covered = true #the sentence in 'sents_to_cover' was covered by the 'sents'\n next #break out since sentence was covered\n end\n end #end of inner for loop for topic sentences\n end\n end #outer for loop for sentences to be covered\n \n #if the topic sentences did not cover any of the cluster's sentences\n if(covered == false)\n return false\n end\n return true #if all sentences in 'sents_to_cover' are covered\n end", "def either_2_4(list) # return true if 2 next to 2 OR 4 next to 4 but not both\n next_to = 0\n (list.size-1).times {|index| next_to += 1 if (list[index] == 2 && list[index+1] == 2) || (list[index] == 4 && list[index+1] == 4)}\n return next_to == 1\nend", "def bishop_check(board, current, destination)\n tx = 0\n ty = 0\n ob = 0\n temp = nil\n if current[0] < destination[0] && current[1] < destination[1]\n tx = current[0] + 1\n ty = current[1] + 1\n array_to_check = [tx, ty]\n while tx <= destination[0] && ty <= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx += 1\n ty += 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n elsif current[0] > destination[0] && current[1] < destination[1]\n tx = current[0] - 1\n ty = current[1] + 1\n array_to_check = [tx, ty]\n while tx >= destination[0] && ty <= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx -= 1\n ty += 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n elsif current[0] < destination[0] && current[1] > destination[1]\n tx = current[0] + 1\n ty = current[1] - 1\n array_to_check = [tx, ty]\n while tx <= destination[0] && ty >= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx += 1\n ty -= 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n\n elsif current[0] > destination[0] && current[1] > destination[1]\n tx = current[0] - 1\n ty = current[1] - 1\n array_to_check = [tx, ty]\n while tx <= destination[0] && ty >= destination[1]\n board.array.each do |item|\n puts 'k' if item.coord == array_to_check\n if item.coord == array_to_check\n unless item.piece_status.nil?\n puts'gudda kathalu 2'\n ob = 1\n return false\n end\n end\n tx -= 1\n ty -= 1\n end\n next unless ob == 0\n end\n board.array.each do |item|\n if item.coord == current\n temp = item.piece_status\n item.piece_status = nil\n end\n item.piece_status = temp if item.coord == destination\n end\n end\n board\nend", "def tell; @next_block_pos end", "def h_dont_cover_holes(pos)\n shape = shape_in_pos(pos) \n is_empty = make_empty_test(shape_in_pos(pos))\n shape.reduce(0) do |score, point| \n if is_empty.(plus(point, Down)) \n then score-1\n else score\n end\n end\n end", "def test_block_count_correct_false\n assert_equal(false, @bv.block_count_correct?(1, [1,2,3,4]))\n end", "def check_prow\n @prow = 0 if @prow < 0\n if @prow > @maxrow-1\n @prow = @maxrow-1\n end\n if @pcol > @maxcol-1\n @pcol = @maxcol-1\n end\n @pcol = 0 if @pcol < 0\n end", "def won? pos, mark\n checklist = materialize(find_array pos)\n checklist.each { |arr| return true if arr.count(mark) == 3 }\n false\n end", "def find_open_rooms(x, y, course) \n temp = 0\n if (course[x][y] != \"Yes\")\n return 0\n else \n #Makes sure it marks as Counted\n course[x][y] = \"Counted\"\n temp+=1\n if x != 0\n temp += find_open_rooms(x-1, y, course)\n end\n if x != course.size-1\n temp += find_open_rooms(x+1, y, course)\n end\n if y != 0\n temp += find_open_rooms(x, y-1, course)\n end\n if y != course.size-1\n temp += find_open_rooms(x, y+1, course)\n end\n return temp\n end \nend", "def walkright_down(i,j,object)\r\n w=0\r\n counter =4\r\n while w < 4 \r\n if @nha2[i-w][j+w] == object \r\n counter =counter -1\r\n end\r\n w+=1\r\n end\r\n return counter\r\n end", "def nip_it_in_the_bud\n while has_bud?(@sequence) do\n @sequence.shift\n @sequence.each { |entry| entry.level -= 1 }\n end\n end", "def threed(list)\n count3 = 0 \n next_to = 0\n list.each do |n|\n if n == 3\n count3 += 1\n end \n end \n (list.size-1).times do |n|\n if list[n] == list[n+1]\n return false\n end \n end\n if count3 == 3\n return true\n elsif count3 > 3 || count3 < 3 \n return false\n end \nend", "def place_mine_indicators\n @board.each_with_index do |r, row|\n r.each_with_index do |_c, col|\n unless @board[row][col].is_a_mine\n count = 0\n if row - 1 >= 0\n count += 1 if col - 1 >= 0 && @board[row - 1][col - 1].is_a_mine\n count += 1 if @board[row - 1][col].is_a_mine\n count += 1 if col + 1 < @board.size && @board[row - 1][col + 1].is_a_mine\n end\n count += 1 if col - 1 >= 0 && @board[row][col - 1].is_a_mine\n count += 1 if col + 1 < @board.size && @board[row][col + 1].is_a_mine\n if row + 1 < @board.size\n count += 1 if col - 1 >= 0 && @board[row + 1][col - 1].is_a_mine\n count += 1 if @board[row + 1][col].is_a_mine\n count += 1 if col + 1 < @board.size && @board[row + 1][col + 1].is_a_mine\n end\n @board[row][col].set_value(count)\n end\n end\n end\n end", "def correct_positions\n counter = 0\n combined = guess.zip(secret_code)\n combined.select do |code, turn|\n if code == turn\n counter += 1\n end\n end\n counter\n end", "def win?\n\n combo = self.all_lines # [8 lines]\n # combo.any? { |line| every_ele_marked?(line) } # b or w\n\n combo.any? do |line|\n # (0...line.length-1).none? do |i|\n # line[i] == :E || line[i] != line[i+1]\n # end\n if every_ele_marked?(line)\n line[0]\n puts \"#{line[0]} won!\"\n true\n else\n false\n end\n end\n\n end", "def validating_position?(board, position, marker)\n \tboard[position] == position + 1\nend", "def look_for_win\n Game::LINES.each do |winning_line|\n markers = group_positions_by_marker(winning_line)\n if markers[marker].length == 2 and markers.keys.include?(nil)\n puts markers.keys\n choice = markers[nil].first\n return choice\n end\n end\n false\n end", "def partial_review_self_check_count\n check_count = 0\n self.sections.each do |s|\n next if !s.dot_rev_check?\n s.subsections.each do |ss|\n next if !ss.dot_rev_check?\n ss.checks.each { |c| check_count += 1 if c.bare_board_design_check? && c.is_self_check? }\n end\n end\n check_count\n end", "def problem_104\n all = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n k = 2\n low_fn0,low_fn1 = 1,1\n hi_fn0,hi_fn1 = 1,1\n loop do\n k += 1\n low_fn0,low_fn1 =(low_fn0 + low_fn1) % 10_000_000_000, low_fn0\n hi_fn0, hi_fn1 = hi_fn0 + hi_fn1, hi_fn0\n if hi_fn0 > 1_000_000_000_000_000_000\n hi_fn0 /= 10\n hi_fn1 /= 10\n end\n front = false\n next unless k > 300\n hi = hi_fn0.to_s[0,9].split(//)\n if (hi & all).length == 9\n puts \"front #{k}\" \n front = true\n end\n if (low = low_fn0.to_s).length >= 9\n low = low[-9,9].split(//)\n if (low & all).length == 9\n puts \"back #{k}\" \n return k if front\n end\n end\n end\nend", "def is_decision\n return (@index == 89)\n end", "def can_win(array, index)\n positions_to_try = [index]\n visited = []\n\n until positions_to_try.empty?\n pos = positions_to_try.shift\n value = array[pos]\n next if value.nil? || visited[pos]\n return true if value == 0\n\n visited[pos] = true\n positions_to_try << pos + value\n positions_to_try << pos - value\n end\nend", "def win_condition_met?(player)\n # Horizontal\n for row in (0..5) do\n counter = 0\n \n @board[row].each do |disc|\n if(disc == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n end\n end\n \n # Vertical\n for col in (0..6) do\n counter = 0\n \n for row in (0..5) do\n if(@board[row][col] == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n end\n end\n \n # Right diagonal\n starting_points = [[0, 0], [1, 0], [2, 0], [0, 1], [0, 2], [0, 3]]\n starting_points.each do |start|\n counter = 0\n \n row = start[0]\n col = start[1]\n \n while(row < 6 && col < 7)\n if(@board[row][col] == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n \n row += 1\n col += 1\n end\n end\n \n # Left diagonal\n starting_points = [[0, 6], [1, 6], [2, 6], [0, 5], [0, 4], [0, 3]]\n starting_points.each do |start|\n counter = 0\n \n row = start[0]\n col = start[1]\n \n while(row < 6 && col >= 0)\n if(@board[row][col] == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n \n row += 1\n col -= 1\n end\n end\n \n return false\n end", "def total_steps?\n print \"At position \" + @position.to_s + \", not counting all resets.\"\n @position\n end", "def unimportant_missing_cr?(index, last_line, line); end", "def next_level_check\n if ($current_lvl == $lvl_1 && $word_count > 9) || ($current_lvl == $lvl_2 && $word_count > 14) || ($current_lvl == $lvl_3 && $word_count > 19)\n $word_count = 0\n system \"clear\"\n level_advance\n else\n # if so display the next word\n system \"clear\"\n next_word()\n end\nend", "def valid_row?(row)\n if @row_counter[row - 1] == nil\n puts \"Row invalid\"\n return 9\n elsif @row_counter[row - 1] > 5\n puts \"Row full\"\n return 9\n else\n return row\n end\n end", "def count_ok?\n\t\tcount <= 5\n\tend", "def got_three?(array)\n counter = 0\n array.each_index do |i|\n if array[i+1] && array[i] == array[i+1]\n counter +=1\n return true if counter == 2\n else\n counter = 0\n end\n end\n false\nend", "def either_2_4(list)\n count_2 = 0\n count_4 = 0\n list.size.times do |n|\n if list[n] == 2 && list[n+1] == 2\n count_2 += 1\n end \n if list[n] == 4 && list[n+1] == 4\n count_4 += 1\n end\n end \n if (count_2 > 0) ^ (count_4 > 0)\n return true\n else\n return false\n end \n\nend", "def check(board, solution)\n available_indications = board.next_boards.map do |board_with_move|\n solution.call(board_with_move)\n end\n required_indications = (0..(@board_length - 1)).to_a\n impossible_indications = (required_indications - available_indications)\n unless impossible_indications.empty?\n puts \"no move available to indicate #{impossible_indications} for #{board}\"\n puts \"boards_with_moves #{boards_with_moves}\"\n puts \"available #{available_indications}\"\n end\n impossible_indications.empty?\n end", "def doVerticalMove? (player, check)\n r = 0\n begin \n if @board[r].include?(check)\n insertVertical(player, check, r)\n return true\n end\n #puts(\"#{r}\")\n r += 1\n end until r > 3\n return false\n end", "def check_block_num(curr_block)\n # make sure number of blocks is in order starting at 0\n return unless curr_block.block_number.to_i != @curr_count\n\n @block_num_error = true\n puts \"Line #{curr_count}: Invalid block number #{curr_block.block_number}, should be #{curr_count} \"\n puts 'BLOCKCHAIN INVALID'\n exit 1\n end", "def h_clear_rows(pos)\n shape = shape_in_pos(pos)\n is_empty = make_empty_test(shape)\n shape.reduce(0) do |score, point|\n if (0..9).zip(Array.new(10,point[1])).\n all?{|pt| !is_empty.(pt)}\n then score + 1\n else score\n end\n end\n end", "def check_column\n count = 0\n \n # Get the players symbol.\n player_symbol = assignment[@last_insert_x - 1][@last_insert_y - 1]\n next_symbol = player_symbol\n \n i = @last_insert_y\n \n # Go to the bottom of the column.\n while (i <= height) && (next_symbol == player_symbol)\n i += 1\n count += 1\n next_symbol = assignment[@last_insert_x - 1][i - 1] \n end\n \n count >= 4\n end", "def nextContent(tryArray, tail) # Dr. Ivey this is my late night recursion function (works wonders though), takes care of the combinations\n if(tryArray[tail] < $count-1) #try to just increment last position\n tryArray[tail] += 1\n elsif( (tail-1) >= 1) # if that doesn't work, try previous position\n tryArray[tail] = 1\n nextContent(tryArray, (tail-1) )\n elsif( (tail == 1 ) && $tail < $numOfComb ) # if that fails, need to add another element to the tryArray\n tryArray[tail] = 1\n $tail += 1\n tryArray[$tail] = 1 \n else\n puts \"No answer found with combination of up to #{$numOfComb} consecutive tiles of your total of #{$count-1} dominos/tiles\"\n exit(0)\n end\n \n \n return tryArray\nend", "def valid_move?(board, index)\n\n # if (0..8).to_a.include?(!index)\n if !index.between?(0, 8)\n nil\n elsif position_taken?(board, index) == false\n true\n end\n\n # if !board[index]\n # false\n # end\n\nend", "def either_2_4(list)\n count = 0\n i = 0\n list.each do |num|\n if num == 2 && count == 0\n if num == list[i + 1]\n count += 2\n end\n elsif num == 4 && count == 0\n if num == list[i + 1]\n count += 1\n end\n elsif num == 4 && count == 2\n if num == list[i + 1]\n return false\n end\n elsif num == 2 && count == 1\n if num == list[i + 1]\n return false\n end\n end\n i = i + 1\n end\n if count == 0\n return false\n else\n return true\n end\nend", "def bounds_check\n r,c = rowcol\n @current_index = 0 if @current_index < 0\n @current_index = @content_rows-1 if @current_index > @content_rows-1\n #$status_message.value = \"visible #{@prow} , #{@current_index} \"\n unless is_visible? @current_index\n if @prow > @current_index\n #$status_message.value = \"1 #{@prow} > #{@current_index} \"\n @prow -= 1\n else\n end\n end\n #end\n check_prow\n #$log.debug \"XXX: PAD BOUNDS ci:#{@current_index} , old #{@oldrow},pr #{@prow}, max #{@maxrow} pcol #{@pcol} maxcol #{@maxcol}\"\n @crow = @current_index + r - @prow\n @crow = r if @crow < r\n # 2 depends on whetehr suppressborders\n @crow = @row + @height -2 if @crow >= r + @height -2\n setrowcol @crow, @curpos+c\n lastcurpos @crow, @curpos+c\n if @oldrow != @prow || @oldcol != @pcol\n @repaint_required = true\n end\n end" ]
[ "0.6377514", "0.6026735", "0.59947467", "0.595899", "0.59440255", "0.5885027", "0.58431447", "0.5826273", "0.58142495", "0.5809331", "0.580567", "0.5799473", "0.57869035", "0.57806444", "0.5780224", "0.5753324", "0.5748126", "0.5726143", "0.5673042", "0.5654381", "0.564202", "0.5532564", "0.55240405", "0.55221057", "0.5503985", "0.549719", "0.5480017", "0.5472852", "0.545586", "0.5448424", "0.5442075", "0.5427898", "0.54139006", "0.5412599", "0.5402393", "0.53954166", "0.5394961", "0.5394961", "0.53918487", "0.53901917", "0.5387077", "0.5375133", "0.53665334", "0.5354992", "0.53423226", "0.5340478", "0.53353345", "0.5334853", "0.5328451", "0.5326589", "0.5321369", "0.53178996", "0.5314935", "0.5305243", "0.5294513", "0.5284124", "0.5284061", "0.5280068", "0.527879", "0.52780324", "0.52774197", "0.5276174", "0.5274385", "0.5269968", "0.52694255", "0.5268721", "0.526736", "0.5266316", "0.5262374", "0.5256365", "0.5256081", "0.5252064", "0.5251588", "0.5250385", "0.52501416", "0.5249799", "0.5245397", "0.52450347", "0.52420586", "0.5240007", "0.5236332", "0.52314764", "0.5219542", "0.5218815", "0.52165914", "0.5215524", "0.5210178", "0.5209711", "0.5207295", "0.5203274", "0.5202837", "0.5200479", "0.52003074", "0.5199077", "0.51964784", "0.5195874", "0.51896876", "0.51896876", "0.5182314", "0.5181476", "0.51810306" ]
0.0
-1
GET /charts/1 GET /charts/1.xml
def show @chart = Chart.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @chart } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @charts = Chart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @charts }\n end\n end", "def get_chart(options={})\n api_response = @api_client.make_api_request(:GET, \"artist/chart\", {}, options)\n @api_client.chart_item_digestor.list_from_xml(api_response.content.chart)\n end", "def show\n @todolist_chart = TodolistChart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @todolist_chart }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @chart }\n end\n end", "def stats\n get_charts\n end", "def index\n @chart = Chart.new\n @charts = Chart.all\n end", "def new\n @chart = Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def new\n @chart = Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def show\n @travel_chart = Travel::Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @travel_chart }\n end\n end", "def new\n @chart = Chart.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def all\n @charts\n end", "def getchart()\n # The data for the bar chart\n data0 = [100, 125, 245, 147, 67]\n data1 = [85, 156, 179, 211, 123]\n data2 = [97, 87, 56, 267, 157]\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\"]\n\n # Create a XYChart object of size 400 x 240 pixels\n c = ChartDirector::XYChart.new(400, 240)\n\n # Add a title to the chart using 10 pt Arial font\n c.addTitle(\" Average Weekday Network Load\", \"\", 10)\n\n # Set the plot area at (50, 25) and of size 320 x 180. Use two alternative\n # background colors (0xffffc0 and 0xffffe0)\n c.setPlotArea(50, 25, 320, 180, 0xffffc0, 0xffffe0)\n\n # Add a legend box at (55, 18) using horizontal layout. Use 8 pt Arial font, with\n # transparent background\n c.addLegend(55, 18, false, \"\", 8).setBackground(ChartDirector::Transparent)\n\n # Add a title to the y-axis\n c.yAxis().setTitle(\"Throughput (MBytes Per Hour)\")\n\n # Reserve 20 pixels at the top of the y-axis for the legend box\n c.yAxis().setTopMargin(20)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Add a multi-bar layer with 3 data sets and 3 pixels 3D depth\n layer = c.addBarLayer2(ChartDirector::Side, 3)\n layer.addDataSet(data0, 0xff8080, \"Server #1\")\n layer.addDataSet(data1, 0x80ff80, \"Server #2\")\n layer.addDataSet(data2, 0x8080ff, \"Server #3\")\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def getchart()\n # The data for the bar chart\n data = [85, 156, 179.5, 211, 123]\n\n # The labels for the bar chart\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\"]\n\n # The colors for the bar chart\n colors = [0xb8bc9c, 0xa0bdc4, 0x999966, 0x333366, 0xc3c3e6]\n\n # Create a XYChart object of size 300 x 220 pixels. Use golden background color.\n # Use a 2 pixel 3D border.\n c = ChartDirector::XYChart.new(300, 220, ChartDirector::goldColor(), -1, 2)\n\n # Add a title box using 10 point Arial Bold font. Set the background color to\n # metallic blue (9999FF) Use a 1 pixel 3D border.\n c.addTitle(\"Daily Network Load\", \"arialbd.ttf\", 10).setBackground(\n ChartDirector::metalColor(0x9999ff), -1, 1)\n\n # Set the plotarea at (40, 40) and of 240 x 150 pixels in size\n c.setPlotArea(40, 40, 240, 150)\n\n # Add a multi-color bar chart layer using the given data and colors. Use a 1 pixel\n # 3D border for the bars.\n c.addBarLayer3(data, colors).setBorderColor(-1, 1)\n\n # Set the labels on the x axis.\n c.xAxis().setLabels(labels)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def get_price_chart\n @price_charts = EmailPriceList.where(category: \"Price Chart\").order(\"updated_at DESC\")\n\n render json: @price_charts , each_serializer: Web::V1::EmailPriceSerializer\n end", "def getchart()\n # The data for the chart\n data = [100, 125, 260, 147, 67]\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\"]\n\n # Create a XYChart object of size 200 x 180 pixels\n c = ChartDirector::XYChart.new(200, 180)\n\n # Set the plot area at (30, 10) and of size 140 x 130 pixels\n c.setPlotArea(30, 10, 140, 130)\n\n # Ise log scale axis if required\n if params[\"img\"] == \"1\"\n c.yAxis().setLogScale3()\n end\n\n # Set the labels on the x axis\n c.xAxis().setLabels(labels)\n\n # Add a color bar layer using the given data. Use a 1 pixel 3D border for the\n # bars.\n c.addBarLayer3(data).setBorderColor(-1, 1)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timecharts }\n end\n end", "def show\n @timechart = Timechart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timechart }\n end\n end", "def index\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_sets = chart.data_sets.all\n\n respond_with(data_sets) do |format|\n \t#response string in specified format\n format.json { render json: { success: true, data_sets: data_sets } }\n end\n end", "def index\n @api_v1_graphs = Api::V1::Graph.all\n end", "def index\n @scales = Scale.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @scales }\n end\n end", "def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @series }\n end\n end", "def weekly_artist_chart(tag, options={})\n get(:standard, {:method => \"tag.getWeeklyArtistChart\", :tag => tag}.merge(options))\n end", "def weekly_chart_list(tag)\n get(:standard, {:method => \"tag.getWeeklyChartList\", :tag => tag})\n end", "def new\n @chart = Chart.new\n\n respond_to do |format|\n # format.html # new.html.erb\n format.html # new.html.haml\n format.json { render json: @chart }\n end\n end", "def getchart()\n # The data for the bar chart\n data0 = [100, 125, 245, 147, 67]\n data1 = [85, 156, 179, 211, 123]\n data2 = [97, 87, 56, 267, 157]\n\n # The labels for the bar chart\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\"]\n\n # Create a XYChart object of size 500 x 320 pixels\n c = ChartDirector::XYChart.new(500, 320)\n\n # Set the plotarea at (100, 40) and of size 280 x 240 pixels\n c.setPlotArea(100, 40, 280, 240)\n\n # Add a legend box at (400, 100)\n c.addLegend(400, 100)\n\n # Add a title to the chart using 14 points Times Bold Itatic font\n c.addTitle(\"Weekday Network Load\", \"timesbi.ttf\", 14)\n\n # Add a title to the y axis. Draw the title upright (font angle = 0)\n c.yAxis().setTitle(\"Average\\nWorkload\\n(MBytes\\nPer Hour)\").setFontAngle(0)\n\n # Set the labels on the x axis\n c.xAxis().setLabels(labels)\n\n # Add a stacked bar layer and set the layer 3D depth to 8 pixels\n layer = c.addBarLayer2(ChartDirector::Stack, 8)\n\n # Add the three data sets to the bar layer\n layer.addDataSet(data0, 0xff8080, \"Server # 1\")\n layer.addDataSet(data1, 0x80ff80, \"Server # 2\")\n layer.addDataSet(data2, 0x8080ff, \"Server # 3\")\n\n # Enable bar label for the whole bar\n layer.setAggregateLabelStyle()\n\n # Enable bar label for each segment of the stacked bar\n layer.setDataLabelStyle()\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def index\n retrieve_data_for_graph\n end", "def get_graphs_data\n service_response = DashboardManagement::GetGraphsData.new(params).perform\n\n if service_response.success?\n render :json => service_response.data\n elsif\n service_response.http_code = 404\n render_api_response(service_response)\n end\n end", "def new\n @todolist_chart = TodolistChart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todolist_chart }\n end\n end", "def new\n @chart = Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chart }\n end\n end", "def show\r\n Connection.switch_data(params[:connection], \"daily\")\r\n @connections = Connection.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @connections.to_xml(:root => 'records', :children => 'record', :dasherize => false) }\r\n end\r\n end", "def getchart()\n # The data for the bar chart\n data = [450, 560, 630, 800, 1100, 1350, 1600, 1950, 2300, 2700]\n\n # The labels for the bar chart\n labels = [\"1996\", \"1997\", \"1998\", \"1999\", \"2000\", \"2001\", \"2002\", \"2003\", \"2004\",\n \"2005\"]\n\n # Create a XYChart object of size 600 x 360 pixels\n c = ChartDirector::XYChart.new(600, 360)\n\n # Add a title to the chart using 18pts Times Bold Italic font\n c.addTitle(\"Annual Revenue for Star Tech\", \"timesbi.ttf\", 18)\n\n # Set the plotarea at (60, 40) and of size 500 x 280 pixels. Use a vertical\n # gradient color from light blue (eeeeff) to deep blue (0000cc) as background. Set\n # border and grid lines to white (ffffff).\n c.setPlotArea(60, 40, 500, 280, c.linearGradientColor(60, 40, 60, 280, 0xeeeeff,\n 0x0000cc), -1, 0xffffff, 0xffffff)\n\n # Add a multi-color bar chart layer using the supplied data. Use soft lighting\n # effect with light direction from left.\n c.addBarLayer3(data).setBorderColor(ChartDirector::Transparent,\n ChartDirector::softLighting(ChartDirector::Left))\n\n # Set x axis labels using the given labels\n c.xAxis().setLabels(labels)\n\n # Draw the ticks between label positions (instead of at label positions)\n c.xAxis().setTickOffset(0.5)\n\n # Add a title to the y axis with 10pts Arial Bold font\n c.yAxis().setTitle(\"USD (millions)\", \"arialbd.ttf\", 10)\n\n # Set axis label style to 8pts Arial Bold\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Set axis line width to 2 pixels\n c.xAxis().setWidth(2)\n c.yAxis().setWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def index\n @payments = @payments.order(\"date DESC\")\n @graph = { :members => chart(\"members\"), \n :total => chart(\"total\"), \n :basic => chart(\"basic\"), \n :associate => chart(\"associate\")}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @payments }\n end\n end", "def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def show\n akt_zeit\n #chart_kurven\n highchart_kurven\n init_diaquenauswahl\n # macht folgende Zeile �berfl�ssig\n #@diagramm = Diagramm.find(params[:id])\n @titelzeile = @diagramm.name + \" - KabDiag\"\n respond_to do |format|\n format.html {\n }\n format.json {\n p @chart\n render :inline => @chart.render #, :layout => false\n }\n end\n end", "def index\n @order = params[:order] || 'created_at desc'\n @datasets = Dataset.find(:all, :order => @order, :conditions => params[:conditions]) \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n format.rss\n end\n end", "def new\n @chart = Chart.new\n respond_with(@chart)\n end", "def index\n @title = \"シリーズ一覧\"\n @series = Serie.order(\"id DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @series }\n end\n end", "def show\n @mpg_chart = open_flash_chart_object(630, 400, mpg_chart_path(@current_user, @vehicle), true, AppConfig.open_flash_chart_base)\n @cpg_chart = open_flash_chart_object(630, 400, cpg_chart_path(@current_user, @vehicle), true, AppConfig.open_flash_chart_base)\n @cpm_chart = open_flash_chart_object(630, 400, cpm_chart_path(@current_user, @vehicle), true, AppConfig.open_flash_chart_base)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle }\n end\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to(charts_url) }\n format.xml { head :ok }\n end\n end", "def index\n @datasets = Dataset.published\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n end\n end", "def basic_chart\n \n end", "def burndown\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n format.html { \n @graph = open_flash_chart_object(800, 500, url_for( :action => 'burndown', :id => params[:id], :format => :json )) \n }\n format.json { \n chart = @sprint.flash_burndown\n render :text => chart, :layout => false\n }\n end\n end", "def show\n if valid_chart?\n render status: :ok,\n json: { success: true, data: Metrics.new(chart, metadata).render }.to_json\n else\n render json: { success: false, error: 'Chart not found.' }\n end\n end", "def index\n @ganglia_graphs = GangliaGraph.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganglia_graphs }\n end\n end", "def get_chart(zpid,unit_type,options={})\n url_s=@@zillow_webservice_url+'GetChart.htm?zws-id='+@zwsid+'&zpid='+zpid.to_s+'&unit-type='+unit_type.to_s\n if options[:width]!=nil then\n url_s=url_s+'&width='+options[:width].to_s\n end\n if options[:height]!=nil then\n url_s=url_s+'&height='+options[:height].to_s\n end\n if options[:chart_duration]!=nil then\n url_s=url_s+'&chartDuration='+options[:chart_duration].to_s\n end\n fetch_result(url_s)\n end", "def index\n @page_title = \"Data Points\"\n @data_points = DataPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @data_points }\n end\n end", "def index\n if params[:id] then\n @graphs = Graph.find_all_by_id(params[:id].split(','), :include => [:subgraphs, :nodes])\n else\n @graphs = Graph.all :include => [:subgraphs, :nodes]\n end\n \n Action.log :controller => params[:controller], :action => params[:action], :user => current_user\n\n respond_to do |format|\n format.html { render :layout => !request.xhr? } # index.html.erb\n format.json #{ render json: @graphs }\n end\n end", "def getchart()\n # The XY data of the first data series\n dataX0 = [50, 55, 37, 24, 42, 49, 63, 72, 83, 59]\n dataY0 = [3.6, 2.8, 2.5, 2.3, 3.8, 3.0, 3.8, 5.0, 6.0, 3.3]\n\n # The XY data of the second data series\n dataX1 = [50, 55, 37, 24, 42, 49, 63, 72, 83, 59]\n dataY1 = [1.6, 1.8, 0.8, 0.5, 1.3, 1.5, 2.3, 2.4, 2.9, 1.5]\n\n # Create a XYChart object of size 450 x 420 pixels\n c = ChartDirector::XYChart.new(450, 420)\n\n # Set the plotarea at (55, 65) and of size 350 x 300 pixels, with white background\n # and a light grey border (0xc0c0c0). Turn on both horizontal and vertical grid\n # lines with light grey color (0xc0c0c0)\n c.setPlotArea(55, 65, 350, 300, 0xffffff, -1, 0xc0c0c0, 0xc0c0c0, -1)\n\n # Add a legend box at (50, 30) (top of the chart) with horizontal layout. Use 12\n # pts Times Bold Italic font. Set the background and border color to Transparent.\n c.addLegend(50, 30, false, \"timesbi.ttf\", 12).setBackground(\n ChartDirector::Transparent)\n\n # Add a title to the chart using 18 point Times Bold Itatic font.\n c.addTitle(\"Server Performance\", \"timesbi.ttf\", 18)\n\n # Add titles to the axes using 12 pts Arial Bold Italic font\n c.yAxis().setTitle(\"Response Time (sec)\", \"arialbi.ttf\", 12)\n c.xAxis().setTitle(\"Server Load (TPS)\", \"arialbi.ttf\", 12)\n\n # Set the axes line width to 3 pixels\n c.yAxis().setWidth(3)\n c.xAxis().setWidth(3)\n\n # Add a scatter layer using (dataX0, dataY0)\n c.addScatterLayer(dataX0, dataY0, \"Server AAA\", ChartDirector::DiamondSymbol, 11,\n 0x008000)\n\n # Add a trend line layer for (dataX0, dataY0)\n c.addTrendLayer2(dataX0, dataY0, 0x008000).setLineWidth(3)\n\n # Add a scatter layer for (dataX1, dataY1)\n c.addScatterLayer(dataX1, dataY1, \"Server BBB\", ChartDirector::TriangleSymbol, 9,\n 0x6666ff)\n\n # Add a trend line layer for (dataX1, dataY1)\n c.addTrendLayer2(dataX1, dataY1, 0x6666ff).setLineWidth(3)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def first\n @charts.first\n end", "def load_daily\n response = HTTParty.get(DAILY_URI, format: :xml)\n load(response['Envelope']['Cube']['Cube'])\n end", "def index\n\n\n respond_to do |format|\n\n format.html { @axes = Axis.where(:user_id => current_user.id).all }\n format.json { render json: Axis.all }\n end\n end", "def index\n @series_descriptions = SeriesDescription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @series_descriptions }\n end\n end", "def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @travel_chart = Travel::Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @travel_chart }\n end\n end", "def index\n @bar_graphs = BarGraph.all\n end", "def series(id)\n get(\"/catalog/titles/series/#{id.to_s}?\")\n end", "def index\n @predict_charts = PredictChart.all\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to(@chart, :notice => 'Chart was successfully created.') }\n format.xml { render :xml => @chart, :status => :created, :location => @chart }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to(@chart, :notice => 'Chart was successfully created.') }\n format.xml { render :xml => @chart, :status => :created, :location => @chart }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to(@chart, :notice => 'Chart was successfully created.') }\n format.xml { render :xml => @chart, :status => :created, :location => @chart }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def getchart()\n # The data for the bar chart\n data0 = [100, 125, 156, 147, 87, 124, 178, 109, 140, 106, 192, 122]\n data1 = [122, 156, 179, 211, 198, 177, 160, 220, 190, 188, 220, 270]\n data2 = [167, 190, 213, 267, 250, 320, 212, 199, 245, 267, 240, 310]\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sept\", \"Oct\",\n \"Nov\", \"Dec\"]\n\n # Create a XYChart object of size 580 x 280 pixels\n c = ChartDirector::XYChart.new(580, 280)\n\n # Add a title to the chart using 14 pts Arial Bold Italic font\n c.addTitle(\"Product Revenue For Last 3 Years\", \"arialbi.ttf\", 14)\n\n # Set the plot area at (50, 50) and of size 500 x 200. Use two alternative\n # background colors (f8f8f8 and ffffff)\n c.setPlotArea(50, 50, 500, 200, 0xf8f8f8, 0xffffff)\n\n # Add a legend box at (50, 25) using horizontal layout. Use 8pts Arial as font,\n # with transparent background.\n c.addLegend(50, 25, false, \"arial.ttf\", 8).setBackground(\n ChartDirector::Transparent)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Draw the ticks between label positions (instead of at label positions)\n c.xAxis().setTickOffset(0.5)\n\n # Add a multi-bar layer with 3 data sets\n layer = c.addBarLayer2(ChartDirector::Side)\n layer.addDataSet(data0, 0xff8080, \"Year 2003\")\n layer.addDataSet(data1, 0x80ff80, \"Year 2004\")\n layer.addDataSet(data2, 0x8080ff, \"Year 2005\")\n\n # Set 50% overlap between bars\n layer.setOverlapRatio(0.5)\n\n # Add a title to the y-axis\n c.yAxis().setTitle(\"Revenue (USD in millions)\")\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def index\n @series = Serie.all\n end", "def index\n @xml_samples = XmlSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @xml_samples }\n format.xml { render xml: @xml_samples }\n end\n end", "def v1_chart_params\n params.fetch(:chart, {})\n end", "def index\n @episodes = Episode.all\n @views_chart = get_all_views(@episodes)\n @change_chart = get_all_differences(@episodes)\n end", "def get_podcast_series(id,num=25) \n url = 'podcast/fetchseries'\n \n options = {\n headers: {\n 'Content-Type': 'application/json'\n },\n query: {\n 'alt': 'json',\n 'nid': id,\n 'num': num\n }\n }\n\n make_get_request url, options\n end", "def index\n @diagrams = Diagram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @diagrams }\n end\n end", "def chart_data\n @track=current_user.tracks.find(params[:id])\n respond_to do |format|\n format.json {render :json => @track.as_chart_data}\n end\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def get(options = {})\n @response_xml = options[:cache_file] ? File.read(options[:cache_file]) : http_get(options)\n response = Response.parse(response_xml, options) do | inner_response, elements |\n parse_reports(inner_response, elements)\n end\n response.response_items.first # there is is only one\n end", "def show_graph\n url_for_data = url_for(controller.params.merge(:action => :data)).gsub('&amp;', '&')\n relative_url_path = ActionController::Base.respond_to?(:relative_url_root) ? ActionController::Base.relative_url_root : ActionController::AbstractRequest.relative_url_root\n html, div_name = controller.open_flash_chart_object_and_div_name('100%', '400', url_for_data, true, \"#{relative_url_path}/\")\n\n html << '<script type=\"text/javascript\">' << \"\\n\"\n html << \"var charts_to_image_title = '#{h(controller.title)}';\\n\" \n html << \"var charts_to_image_id = '#{div_name}';\\n\"\n html << '</script>'\n\n html\n end", "def index\n @title = get_title\n\n @show_conditions = false\n\n if show_date_condition\n @date_condition = true\n @show_conditions = true\n else\n @date_condition = false\n end\n\n if show_pages\n @show_pages = true\n end\n\n unless get_grouping_options.empty?\n @grouping_options = RedmineCharts::GroupingUtils.to_options(get_grouping_options)\n @show_conditions = true\n else\n @grouping_options = []\n end\n\n unless get_conditions_options.empty?\n @conditions_options = RedmineCharts::ConditionsUtils.to_options(get_conditions_options, @project.id)\n @show_conditions = true\n else\n @conditions_options = []\n end\n \n @show_left_column = @show_conditions\n\n unless get_help.blank?\n @help = get_help\n @show_left_column = true\n else\n @help = nil\n end\n\n @range = RedmineCharts::RangeUtils.from_params(params)\n @pagination = RedmineCharts::PaginationUtils.from_params(params)\n @grouping = RedmineCharts::GroupingUtils.from_params(get_grouping_options, params)\n @conditions = RedmineCharts::ConditionsUtils.from_params(get_conditions_options, @project.id, params)\n\n @data = data\n\n render :template => \"charts/index\"\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scale }\n end\n end", "def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @series }\n end\n end", "def getchart()\n # The data for the line chart\n data0 = [410, 420, 500, 590]\n data1 = [500, 370, 680, 850]\n labels = [\"Q1\", \"Q2\", \"Q3\", \"Q4\"]\n\n # Create a XYChart object of size 600 x 400 pixels\n c = ChartDirector::XYChart.new(600, 400)\n\n # Add a title to the chart using 18 pts Times Bold Italic font\n title = c.addTitle(\"Product Line Global Revenue\", \"timesbi.ttf\", 18)\n\n # Tentatively set the plotarea at (50, 55) and of (chart_width - 100) x\n # (chart_height - 150) pixels in size. Use a vertical gradient color from sky blue\n # (aaccff) t0 light blue (f9f9ff) as background. Set both horizontal and vertical\n # grid lines to dotted semi-transprent black (aa000000).\n plotArea = c.setPlotArea(50, 55, c.getWidth() - 100, c.getHeight() - 150,\n c.linearGradientColor(0, 55, 0, 55 + c.getHeight() - 150, 0xaaccff, 0xf9fcff),\n -1, -1, c.dashLineColor(0xaa000000, ChartDirector::DotLine), -1)\n\n # Set y-axis title using 12 points Arial Bold Italic font, and set its position 10\n # pixels from the axis.\n c.yAxis().setTitle(\"Revenue (USD millions)\", \"arialbi.ttf\", 12)\n c.yAxis().setTitlePos(ChartDirector::Left, 10)\n\n # Set y-axis label style to 10 points Arial Bold and axis color to transparent\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 10)\n c.yAxis().setColors(ChartDirector::Transparent)\n\n # Set y-axis tick density to 30 pixels. ChartDirector auto-scaling will use this\n # as the guideline when putting ticks on the y-axis.\n c.yAxis().setTickDensity(30)\n\n # Add a bar layer to the chart with side layout\n layer = c.addBarLayer2(ChartDirector::Side)\n\n # Add two data sets to the bar layer\n layer.addDataSet(data0, 0xff6600, \"FY 2007\")\n layer.addDataSet(data1, 0x0088ff, \"FY 2008\")\n\n # Use soft lighting effect with light direction from the left\n layer.setBorderColor(ChartDirector::Transparent, ChartDirector::softLighting(\n ChartDirector::Left))\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Convert the labels on the x-axis to a CDMLTable\n table = c.xAxis().makeLabelTable()\n\n # Set the default left/right margins to 5 pixels and top/bottom margins to 3\n # pixels. Set the default font size to 10 points\n cellStyle = table.getStyle()\n cellStyle.setMargin2(5, 5, 4, 3)\n cellStyle.setFontSize(10)\n\n # Set the first row to use Arial Bold font, with a light grey (eeeeee) background.\n firstRowStyle = table.getRowStyle(0)\n firstRowStyle.setFontStyle(\"arialbd.ttf\")\n firstRowStyle.setBackground(0xeeeeee, ChartDirector::LineColor)\n\n #\n # We can add more information to the table. In this sample code, we add the data\n # series and the legend icons to the table.\n #\n\n # Add 3 more rows to the table. Set the background of the 2nd row to light grey\n # (eeeeee).\n table.appendRow()\n table.appendRow().setBackground(0xeeeeee, ChartDirector::LineColor)\n table.appendRow()\n\n # Put the values of the 2 data series in the first 2 rows. Put the percentage\n # differences in the 3rd row.\n 0.upto(data0.length - 1) do |i|\n table.setText(i, 1, (data0[i]).to_s)\n table.setText(i, 2, (data1[i]).to_s)\n\n percentageDiff = 100.0 * (data1[i] - data0[i]) / data0[i]\n\n # Use red or green color depending on whether the difference is positive or\n # negative\n formatString = \"<*color=008800*>+{value|1}%\"\n if percentageDiff < 0\n formatString = \"<*color=cc0000*>{value|1}%\"\n end\n table.setText(i, 3, c.formatValue(percentageDiff, formatString))\n end\n\n # Insert a column on the left for the legend icons using Arial Bold font.\n table.insertCol(0).setFontStyle(\"arialbd.ttf\")\n\n # The top cell is set to transparent, so it is invisible\n table.getCell(0, 0).setBackground(ChartDirector::Transparent,\n ChartDirector::Transparent)\n\n # The next 2 cells are set to the legend icons and names of the 2 data series\n table.setText(0, 1, sprintf(\"%s FY 2007\", layer.getLegendIcon(0)))\n table.setText(0, 2, sprintf(\"%s FY 2008\", layer.getLegendIcon(1)))\n\n # The last cell is set to \"Change\"\n table.setText(0, 3, \"Change\")\n\n # Append a column on the right for the total values.\n table.appendCol()\n\n # Put \"Total\" in the top cell as the heading of this column\n table.setText(table.getColCount() - 1, 0, \"Total\")\n\n # The next two cells are the total of the data series\n total0 = ChartDirector::ArrayMath.new(data0).sum()\n total1 = ChartDirector::ArrayMath.new(data1).sum()\n table.setText(table.getColCount() - 1, 1, total0.to_s)\n table.setText(table.getColCount() - 1, 2, total1.to_s)\n\n # The last cell is the percentage differences of the total\n totalPercentageDiff = (total1 - total0) / total0 * 100\n\n # Use red or green color depending on whether the difference is positive or\n # negative\n totalFormatString = \"<*color=008800*>+{value|1}%\"\n if totalPercentageDiff < 0\n totalFormatString = \"<*color=cc0000*>{value|1}%\"\n end\n table.setText(table.getColCount() - 1, 3, c.formatValue(totalPercentageDiff,\n totalFormatString))\n\n #\n # We now demonstrate how to adjust the plot area positions, to allow space for the\n # newly inserted left and right columns in the table.\n #\n\n # We layout the axis first in order to get the axis metrics (including table\n # metrics)\n c.layoutAxes()\n\n # If the first column is wider than the left y-axis, we need to reserve for some\n # left margin to ensure the first column stays within the chart.\n leftMargin = 0\n if table.getColWidth(0) > c.yAxis().getThickness()\n leftMargin = table.getColWidth(0) - c.yAxis().getThickness()\n end\n\n # Similarly, we need to reserve some right margin for the last column\n rightMargin = table.getColWidth(table.getColCount() - 1)\n\n # Adjust the plot area size, such that the bounding box (inclusive of axes) using\n # the given left and right margin, plus 2 more pixels. Put the plot area 10 pixels\n # below the title and use 2 pixels as the bottom margin. from the left, right and\n # bottom edge, and is just under the legend box.\n c.packPlotArea(leftMargin + 2, title.getHeight() + 10, c.getWidth(\n ) - 3 - rightMargin, c.getHeight() - 3)\n\n # After determining the exact plot area position, we may adjust title position so\n # that it is centered relative to the plot area (instead of the chart)\n title.setPos(plotArea.getLeftX() + (plotArea.getWidth() - title.getWidth()) / 2,\n title.getTopY())\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def weekly_chart_list(user)\n get(:standard, {:method => \"user.getWeeklyChartList\", :user => user})\n end", "def index\n @graphs = Graph.all\n end", "def index\n # @trd=TransferData.all\n if current_user == nil \n @charts = Chart.where(\"users_id = 0\").order(\"code\")\n else\n @charts = Chart.where(\"users_id = ?\",current_user.id).order(\"code\")\n end\n\n respond_to do |format|\n # format.html # index.html.erb\n format.html # index.html.haml\n format.json { render json: @charts }\n end\n end", "def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end", "def index\n @rescue_time_charts = RescueTimeChart.all\n end", "def retrieve_rates(date)\n path = \"http://openexchangerates.org/api/historical/#{date.to_s}.json?app_id=#{$app_id}\"\n response = Net::HTTP.get_response(URI.parse path)\n # TODO: error handling\n response.body\nend", "def list\n @multi_year_charts = user_multi_year_charts\n .kept\n .includes(:user)\n .order('created_at DESC')\n .page(params[:page])\n .per(50)\n\n respond_to do |format|\n format.html {render :layout => 'application'}\n end\n end", "def graph\n @data = @category.to_graph_points\n\n @series = [{ values: @data, key: @category.name }]\n\n @title = \"Spending for #{@category.name}\"\n end", "def getchart()\n # The data for the chart\n data0 = [42, 49, ChartDirector::NoValue, 38, 64, 56, 29, 41, 44, 57]\n data1 = [65, 75, 47, 34, 42, 49, 73, ChartDirector::NoValue, 90, 69, 66, 78]\n data2 = [ChartDirector::NoValue, ChartDirector::NoValue, 25, 28, 38, 20, 22,\n ChartDirector::NoValue, 25, 33, 30, 24]\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\",\n \"Nov\", \"Dec\"]\n\n # Create a XYChart object of size 600 x 360 pixels. Set background color to\n # brushed silver, with a 2 pixel 3D border. Use rounded corners.\n c = ChartDirector::XYChart.new(600, 360, ChartDirector::brushedSilverColor(),\n ChartDirector::Transparent, 2)\n c.setRoundedFrame()\n\n # Add a title using 18 pts Times New Roman Bold Italic font. #Set top/bottom\n # margins to 6 pixels.\n title = c.addTitle(\"Product Line Global Revenue\", \"timesbi.ttf\", 18)\n title.setMargin2(0, 0, 6, 6)\n\n # Add a separator line just under the title\n c.addLine(10, title.getHeight(), c.getWidth() - 11, title.getHeight(),\n ChartDirector::LineColor)\n\n # Add a legend box where the top-center is anchored to the horizontal center of\n # the chart, just under the title. Use horizontal layout and 10 points Arial Bold\n # font, and transparent background and border.\n legendBox = c.addLegend(c.getWidth() / 2, title.getHeight(), false, \"arialbd.ttf\",\n 10)\n legendBox.setAlignment(ChartDirector::TopCenter)\n legendBox.setBackground(ChartDirector::Transparent, ChartDirector::Transparent)\n\n # Tentatively set the plotarea at (70, 75) and of 460 x 240 pixels in size. Use\n # transparent border and black (000000) grid lines\n c.setPlotArea(70, 75, 460, 240, -1, -1, ChartDirector::Transparent, 0x000000, -1)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Show the same scale on the left and right y-axes\n c.syncYAxis()\n\n # Set y-axis tick density to 30 pixels. ChartDirector auto-scaling will use this\n # as the guideline when putting ticks on the y-axis.\n c.yAxis().setTickDensity(30)\n\n # Set all axes to transparent\n c.xAxis().setColors(ChartDirector::Transparent)\n c.yAxis().setColors(ChartDirector::Transparent)\n c.yAxis2().setColors(ChartDirector::Transparent)\n\n # Set the x-axis margins to 15 pixels, so that the horizontal grid lines can\n # extend beyond the leftmost and rightmost vertical grid lines\n c.xAxis().setMargin(15, 15)\n\n # Set axis label style to 8pts Arial Bold\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis2().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Add axis title using 10pts Arial Bold Italic font\n c.yAxis().setTitle(\"Revenue in USD millions\", \"arialbi.ttf\", 10)\n c.yAxis2().setTitle(\"Revenue in USD millions\", \"arialbi.ttf\", 10)\n\n # Add the first line. The missing data will be represented as gaps in the line\n # (the default behaviour)\n layer0 = c.addLineLayer2()\n layer0.addDataSet(data0, 0xff0000, \"Quantum Computer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer0.setLineWidth(3)\n\n # Add the second line. The missing data will be represented by using dash lines to\n # bridge the gap\n layer1 = c.addLineLayer2()\n layer1.addDataSet(data1, 0x00ff00, \"Atom Synthesizer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer1.setLineWidth(3)\n layer1.setGapColor(c.dashLineColor(0x00ff00))\n\n # Add the third line. The missing data will be ignored - just join the gap with\n # the original line style.\n layer2 = c.addLineLayer2()\n layer2.addDataSet(data2, 0xff6600, \"Proton Cannon\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer2.setLineWidth(3)\n layer2.setGapColor(ChartDirector::SameAsMainColor)\n\n # layout the legend so we can get the height of the legend box\n c.layoutLegend()\n\n # Adjust the plot area size, such that the bounding box (inclusive of axes) is 15\n # pixels from the left edge, just under the legend box, 16 pixels from the right\n # edge, and 25 pixels from the bottom edge.\n c.packPlotArea(15, legendBox.getTopY() + legendBox.getHeight(), c.getWidth() - 16,\n c.getHeight() - 25)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::JPG), :type => \"image/jpeg\",\n :disposition => \"inline\")\n end", "def getchart()\n # The data for the chart\n data0 = [32, 39, 23, 28, 41, 38, 26, 35, 29]\n data1 = [50, 55, 47, 34, 47, 53, 38, 40, 51]\n\n # The labels for the chart\n labels = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\"]\n\n # Create a XYChart object of size 600 x 300 pixels, with a pale red (ffdddd)\n # background, black border, 1 pixel 3D border effect and rounded corners.\n c = ChartDirector::XYChart.new(600, 300, 0xffdddd, 0x000000, 1)\n c.setRoundedFrame()\n\n # Set directory for loading images to current script directory\n c.setSearchPath(File.dirname(__FILE__))\n\n # Set the plotarea at (55, 58) and of size 520 x 195 pixels, with white (ffffff)\n # background. Set horizontal and vertical grid lines to grey (cccccc).\n c.setPlotArea(55, 58, 520, 195, 0xffffff, -1, -1, 0xcccccc, 0xcccccc)\n\n # Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9\n # pts Arial Bold font. Set the background and border color to Transparent.\n c.addLegend(55, 32, false, \"arialbd.ttf\", 9).setBackground(\n ChartDirector::Transparent)\n\n # Add a title box to the chart using 15 pts Times Bold Italic font. The title is\n # in CDML and includes embedded images for highlight. The text is white (ffffff)\n # on a dark red (880000) background, with soft lighting effect from the right\n # side.\n c.addTitle(\n \"<*block,valign=absmiddle*><*img=star.png*><*img=star.png*> Performance \" \\\n \"Enhancer <*img=star.png*><*img=star.png*><*/*>\", \"timesbi.ttf\", 15, 0xffffff\n ).setBackground(0x880000, -1, ChartDirector::softLighting(ChartDirector::Right\n ))\n\n # Add a title to the y axis\n c.yAxis().setTitle(\"Energy Concentration (KJ per liter)\")\n\n # Set the labels on the x axis\n c.xAxis().setLabels(labels)\n\n # Add a title to the x axis using CMDL\n c.xAxis().setTitle(\n \"<*block,valign=absmiddle*><*img=clock.png*> Elapsed Time (hour)<*/*>\")\n\n # Set the axes width to 2 pixels\n c.xAxis().setWidth(2)\n c.yAxis().setWidth(2)\n\n # Add a spline layer to the chart\n layer = c.addSplineLayer()\n\n # Set the default line width to 2 pixels\n layer.setLineWidth(2)\n\n # Add a data set to the spline layer, using blue (0000c0) as the line color, with\n # yellow (ffff00) circle symbols.\n layer.addDataSet(data1, 0x0000c0, \"Target Group\").setDataSymbol(\n ChartDirector::CircleSymbol, 9, 0xffff00)\n\n # Add a data set to the spline layer, using brown (982810) as the line color, with\n # pink (f040f0) diamond symbols.\n layer.addDataSet(data0, 0x982810, \"Control Group\").setDataSymbol(\n ChartDirector::DiamondSymbol, 11, 0xf040f0)\n\n # Add a custom CDML text at the bottom right of the plot area as the logo\n c.addText(575, 250,\n \"<*block,valign=absmiddle*><*img=small_molecule.png*> <*block*>\" \\\n \"<*font=timesbi.ttf,size=10,color=804040*>Molecular\\nEngineering<*/*>\"\n ).setAlignment(ChartDirector::BottomRight)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def sub_charts\n @sub_charts\n end", "def weekly_artist_chart(user, options={})\n get(:standard, {:method => \"user.getWeeklyArtistChart\", :user => user}.merge(options))\n end", "def show\n @chart_data0 = make_chart_data(@progress.company_name,0)\n @chart_data1 = make_chart_data(@progress.company_name,1)\n @chart_data2 = make_chart_data(@progress.company_name,2)\n end", "def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @series }\n end\n end", "def show\n @series = Series.find(params[:id])\n @artworks = @series.artworks\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @series }\n end\n end", "def show\n @service = Service.find(params[:id], :conditions => conditions)\n @alerts = Alert.all({\n :conditions => [\"service_id = ? and severity <> 0\", @service.id]\n })\n params[:date] = Date.today.to_s if params[:date].blank?\n @date_range = parse_date_range params[:date]\n @metric = @service.metric \n now = Time.now\n #now = Time.parse(\"2010-6-10 12:00\") #for test\n d = @metric.history({:start => now - 24*60*60, :finish => now})\n if d.size > 0\n @history_views = @service.history_views\n @history_views.each do |view|\n view.data = d\n end\n end\n d = @metric.current \n if d\n @default_view = @service.default_view\n @default_view.data = d if @default_view\n @current_views = @service.views\n @current_views.each do |view|\n view.data = d\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { \n #render :xml => @service.to_xml(:dasherize => false)\n }\n end\n end", "def index\n @gauge_graphs = GaugeGraph.all\n end", "def series_get(id)\n begin\n api = \"#{$config['sonarr']['api_url']}/series/#{id}\"\n log_debug(api)\n uri = URI(api)\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json', 'X-Api-Key'=> $config['sonarr']['api_key'])\n \n json = {}\n json['id'] = id\n \n req.body = json.to_json\n res = http.request(req) \n json = JSON.parse(res.body)\n debug json\n rescue => e\n puts \"failed #{e}\"\n end\n end", "def weekly_artist_chart(group, options={})\n get(:standard, {:method => \"group.getWeeklyArtistChart\", :group => group}.merge(options))\n end", "def show\n @chart = Chart.find(params[:id])\n @chartnodes = @chart.chartnodes\n data = @chart.chartnodes.map {|node| [node.xaxis, node.yaxis]}.transpose\n if @chart.charttype == 'column'\n @h1 = LazyHighCharts::HighChart.new('graph') do |f|\n f.title({ :text=> @chart.name})\n f.options[:xAxis][:categories] = data[0]\n f.series(:type=> 'column',:name=> @chart.name,:data=> data[1])\n end\n elsif @chart.charttype == 'spline'\n @h1 = LazyHighCharts::HighChart.new('graph') do |f|\n f.title({ :text=> @chart.name})\n f.options[:xAxis][:categories] = data[0]\n f.series(:type=> 'spline',:name=> @chart.name,:data=> data[1])\n f.plot_options( :spline => {\n :dataLabels => {\n :enabled => true\n }})\n f.tooltip( :crosshairs => true, :shared => true)\n end\n elsif @chart.charttype == 'pie'\n @h1 = LazyHighCharts::HighChart.new('pie') do |f|\n f.chart({:defaultSeriesType=>\"pie\" , :margin=> [50, 200, 60, 170]} )\n series = {\n :type=> 'pie',\n :name=> @chart.name,\n :data=> data.transpose\n }\n f.series(series)\n f.options[:title][:text] = \"Browser share\"\n f.legend(:layout=> 'vertical',:style=> {:left=> 'auto', :bottom=> 'auto',:right=> '50px',:top=> '100px'}) \n f.plot_options(:pie=>{\n :allowPointSelect=>true, \n #:cursor=>\"pointer\" , \n :dataLabels=>{\n :enabled=>true,\n :color=>\"black\",\n :style=>{\n :font=>\"13px Trebuchet MS, Verdana, sans-serif\"\n }\n }\n })\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chart }\n end\n end", "def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @series }\n end\n end" ]
[ "0.7527839", "0.6795368", "0.6685772", "0.65405685", "0.64616686", "0.6404945", "0.640389", "0.640389", "0.6384045", "0.63516575", "0.62155235", "0.6200735", "0.61004233", "0.60807085", "0.6080472", "0.60790664", "0.6067205", "0.606101", "0.60535896", "0.60415655", "0.60105056", "0.59476906", "0.59368724", "0.5928268", "0.59267384", "0.59210545", "0.5843524", "0.5829721", "0.58056784", "0.5799603", "0.5799344", "0.57953405", "0.5794009", "0.5793882", "0.5786516", "0.57581985", "0.57458407", "0.57300097", "0.57147044", "0.57147026", "0.5708447", "0.57032776", "0.56848013", "0.56826067", "0.5672144", "0.5661222", "0.56510085", "0.5641959", "0.56343424", "0.5630105", "0.5628744", "0.5620892", "0.56173253", "0.56173253", "0.560971", "0.56041694", "0.55971617", "0.5589406", "0.5579863", "0.5579863", "0.5579863", "0.557222", "0.55664957", "0.5559874", "0.5553147", "0.55493766", "0.55422187", "0.55402285", "0.55300564", "0.5529135", "0.5529135", "0.5529135", "0.55285364", "0.5523507", "0.5520756", "0.55153036", "0.55126566", "0.5508227", "0.55067277", "0.5501999", "0.549198", "0.54879993", "0.5484802", "0.5481167", "0.5472878", "0.5470211", "0.5461767", "0.5458113", "0.5452391", "0.54428756", "0.5441995", "0.5441453", "0.5439045", "0.54375863", "0.5435963", "0.5433056", "0.54270375", "0.5425489", "0.5424333" ]
0.7207917
2
GET /charts/new GET /charts/new.xml
def new @chart = Chart.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @chart } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @chart = Chart.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def new\n @chart = Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chart }\n end\n end", "def new\n @chart = Chart.new\n\n respond_to do |format|\n # format.html # new.html.erb\n format.html # new.html.haml\n format.json { render json: @chart }\n end\n end", "def new\n @todolist_chart = TodolistChart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todolist_chart }\n end\n end", "def new\n @series = Series.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @series }\n end\n end", "def new\n @chart = Chart.new\n respond_with(@chart)\n end", "def new\n @travel_chart = Travel::Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @travel_chart }\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to(@chart, :notice => 'Chart was successfully created.') }\n format.xml { render :xml => @chart, :status => :created, :location => @chart }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to(@chart, :notice => 'Chart was successfully created.') }\n format.xml { render :xml => @chart, :status => :created, :location => @chart }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to(@chart, :notice => 'Chart was successfully created.') }\n format.xml { render :xml => @chart, :status => :created, :location => @chart }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @series = Series.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @series }\n end\n end", "def new\n @series = Series.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @series }\n end\n end", "def index\n @charts = Chart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @charts }\n end\n end", "def new\n @graph_point = GraphPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @graph_point }\n end\n end", "def new\n @series_description = SeriesDescription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @series_description }\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to @chart, notice: 'Chart was successfully created.' }\n format.json { render json: @chart, status: :created, location: @chart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @chart = Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def show\n @chart = Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def new\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @history_point = HistoryPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @history_point }\n end\n end", "def new\n @cluster = Cluster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cluster }\n end\n end", "def new\n @data_set = DataSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_set }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @scale = Scale.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scale }\n end\n end", "def new\n @product_series = ProductSeries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_series }\n end\n end", "def new\n @activity = Activity.new\n @series = get_series('activities')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def new\n @series_type = SeriesType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @series_type }\n end\n end", "def new\n @historical = Historical.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historical }\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n flash[:notice] = 'Chart was successfully created.' if @chart.save\n respond_with(@chart)\n end", "def new\n @period = Period.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @period }\n end\n end", "def new\n @subscription_history = SubscriptionHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subscription_history }\n end\n end", "def new\n @diagram = Diagram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diagram }\n end\n end", "def new\n @serie = Serie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @serie }\n end\n end", "def new\n @quant = Quant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quant }\n end\n end", "def new\n @curve = Curve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curve }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def new\n @periodista = Periodista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @periodista }\n end\n end", "def new\n @historico = Historico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @historico }\n end\n end", "def new\n @sid = params[:sid]\n @series = @sid.present? ? Series.find_or_new_from_sid(@sid) : Series.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @series }\n end\n end", "def new\n @export = Export.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @export }\n end\n end", "def new\n @page_title = \"Data Points\"\n @data_point = DataPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_point }\n end\n end", "def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end", "def create\n @todolist_chart = TodolistChart.new(params[:todolist_chart])\n\n respond_to do |format|\n if @todolist_chart.save\n flash[:notice] = 'TodolistChart was successfully created.'\n format.html { redirect_to(@todolist_chart) }\n format.xml { render :xml => @todolist_chart, :status => :created, :location => @todolist_chart }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @todolist_chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @rate_change_history = RateChangeHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rate_change_history }\n end\n end", "def new\n @series_description_map = SeriesDescriptionMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @series_description_map }\n end\n end", "def new\n @vertex = Vertex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vertex }\n end\n end", "def new\n @topiccluster = Topiccluster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topiccluster }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end", "def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def new\n @dailyreport = Dailyreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end", "def new\n @datafeed = Datafeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @datafeed }\n end\n end", "def create\n @travel_chart = Travel::Chart.new(params[:travel_chart])\n\n respond_to do |format|\n if @travel_chart.save\n format.html { redirect_to @travel_chart, notice: 'Travel chart was successfully created.' }\n format.json { render json: @travel_chart, status: :created, location: @travel_chart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @travel_chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @payment_history = PaymentHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_history }\n end\n end", "def show\n @todolist_chart = TodolistChart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @todolist_chart }\n end\n end", "def new\n @buying_history = BuyingHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @buying_history }\n end\n end", "def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end", "def new\n @newz = Newz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newz }\n end\n end", "def new\n @trend = Trend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trend }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.json {render json: @page}\n format.xml {render xml: @page}\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 @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def new\n @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def new\n @quartz = Quartz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quartz }\n end\n end", "def new\n @trend = Trend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @trend }\n end\n end", "def new\n @colo = Colo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @colo }\n end\n end", "def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @traffic }\n end\n end", "def new\n @time_series = TimeSeries.new\n @datasets = Dataset.by_owner(@owner.id, current_user.id).only_id_title_languages.sorted\n\n add_time_series_nav_options(set_url: false)\n\n set_tabbed_translation_form_settings\n\n @js.push(\"time_series.js\", 'cocoon.js')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_series }\n end\n end", "def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dashboard }\n end\n end", "def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dashboard }\n end\n end", "def new\n @scrape_order = ScrapeOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scrape_order }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end", "def new_rest\n @page_usage_event = PageUsageEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage_event }\n end\n end", "def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end", "def new\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @price }\n end\n end", "def new\n @feedstock = Feedstock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedstock }\n end\n end", "def new\n @konfig = Konfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @konfig }\n end\n end", "def new\n @category = Category.new\n @rollover = Rollover.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dataset }\n end\n end", "def index\n @chart = Chart.new\n @charts = Chart.all\n end", "def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end", "def new\n @slice = Slice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slice }\n end\n end", "def new\n @daily_price = DailyPrice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @daily_price }\n end\n end", "def new\n @graphic = Graphic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @graphic }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @artist_product }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @meteorological_data = MeteorologicalData.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @meteorological_data }\n end\n end", "def new\n @analysis = Analysis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @analysis }\n end\n end" ]
[ "0.77033484", "0.7309915", "0.7306113", "0.7275111", "0.70852625", "0.7053791", "0.6977749", "0.6737508", "0.6737508", "0.6737508", "0.660809", "0.66072446", "0.6556984", "0.6495462", "0.6344661", "0.6333267", "0.63040686", "0.63040686", "0.6276543", "0.625858", "0.625858", "0.6248557", "0.62369794", "0.6224222", "0.62121433", "0.62010545", "0.61848104", "0.6155886", "0.61509186", "0.6150159", "0.61485004", "0.6147697", "0.61384034", "0.6135559", "0.6132422", "0.61245185", "0.6115074", "0.61106104", "0.610625", "0.6101717", "0.61004823", "0.60951096", "0.6084214", "0.6074585", "0.606865", "0.60680187", "0.60678303", "0.6067801", "0.60632", "0.6056789", "0.60567796", "0.60567796", "0.60541874", "0.60340136", "0.6028694", "0.6017789", "0.60150665", "0.6013555", "0.6013555", "0.60052943", "0.5999595", "0.59809625", "0.59719604", "0.59715354", "0.5959327", "0.5958796", "0.5954711", "0.59467113", "0.59467113", "0.59434205", "0.5943372", "0.59416384", "0.59412706", "0.593461", "0.59340644", "0.59340644", "0.59329003", "0.5932724", "0.59312886", "0.5928658", "0.59279054", "0.5926587", "0.59264517", "0.59249735", "0.59247667", "0.5923845", "0.59191656", "0.59096855", "0.5906065", "0.59049165", "0.5901997", "0.5897627", "0.5897627", "0.5897627", "0.5897627", "0.5897627", "0.5897627", "0.58945996", "0.58928305" ]
0.77778155
1
POST /charts POST /charts.xml
def create @chart = Chart.new(params[:chart]) respond_to do |format| if @chart.save format.html { redirect_to(@chart, :notice => 'Chart was successfully created.') } format.xml { render :xml => @chart, :status => :created, :location => @chart } else format.html { render :action => "new" } format.xml { render :xml => @chart.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @chart = Chart.new(params[:chart])\n flash[:notice] = 'Chart was successfully created.' if @chart.save\n respond_with(@chart)\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to @chart, notice: 'Chart was successfully created.' }\n format.json { render json: @chart, status: :created, location: @chart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @travel_chart = Travel::Chart.new(params[:travel_chart])\n\n respond_to do |format|\n if @travel_chart.save\n format.html { redirect_to @travel_chart, notice: 'Travel chart was successfully created.' }\n format.json { render json: @travel_chart, status: :created, location: @travel_chart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @travel_chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @charts = Chart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @charts }\n end\n end", "def create\n @performance_chart = PerformanceChart.new(performance_chart_params)\n\n respond_to do |format|\n if @performance_chart.save\n format.html { redirect_to @performance_chart, notice: 'Performance chart was successfully created.' }\n format.json { render :show, status: :created, location: @performance_chart }\n else\n format.html { render :new }\n format.json { render json: @performance_chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @chart = Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def new\n @chart = Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def create\n @todolist_chart = TodolistChart.new(params[:todolist_chart])\n\n respond_to do |format|\n if @todolist_chart.save\n flash[:notice] = 'TodolistChart was successfully created.'\n format.html { redirect_to(@todolist_chart) }\n format.xml { render :xml => @todolist_chart, :status => :created, :location => @todolist_chart }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @todolist_chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @timechart = Timechart.new(params[:timechart])\n\n respond_to do |format|\n if @timechart.save\n format.html { redirect_to @timechart, notice: 'Timechart was successfully created.' }\n format.json { render json: @timechart, status: :created, location: @timechart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timechart.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @chart = Chart.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def new\n @chart = Chart.new\n respond_with(@chart)\n end", "def new\n @chart = Chart.new\n\n respond_to do |format|\n # format.html # new.html.erb\n format.html # new.html.haml\n format.json { render json: @chart }\n end\n end", "def create\n @predict_chart = PredictChart.new(predict_chart_params)\n\n respond_to do |format|\n if @predict_chart.save\n format.html { redirect_to @predict_chart, notice: 'Predict chart was successfully created.' }\n format.json { render :show, status: :created, location: @predict_chart }\n else\n format.html { render :new }\n format.json { render json: @predict_chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @chart = Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chart }\n end\n end", "def chart_params\n params.require(:chart).permit(:name, :weight, :length, :BMI, :Proper, :date, :metabolism)\n end", "def new\n @travel_chart = Travel::Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @travel_chart }\n end\n end", "def get_price_chart\n @price_charts = EmailPriceList.where(category: \"Price Chart\").order(\"updated_at DESC\")\n\n render json: @price_charts , each_serializer: Web::V1::EmailPriceSerializer\n end", "def v1_chart_params\n params.fetch(:chart, {})\n end", "def create\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_set = chart.data_sets.new(params[:data_set])\n data_set.save\n\n respond_with(data_set) do |format|\n if data_set.valid?\n format.json { render json: { success: true, data_sets: data_set } }\n else\n format.json { render json: { success: false, errors: data_set.errors } }\n end\n end\n end", "def create\n @chart = Chart.new(chart_params)\n @chart.user = current_user.id\n @chart.amount_1 = 0\n @chart.amount_2 = 0\n respond_to do |format|\n if @chart.save\n \n format.html { redirect_to @chart, notice: 'Chart was successfully created.' }\n format.json { render json: @chart, status: :created, location: @chart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rescue_time_chart = RescueTimeChart.new(rescue_time_chart_params)\n\n respond_to do |format|\n if @rescue_time_chart.save\n format.html { redirect_to @rescue_time_chart, notice: 'Rescue time chart was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rescue_time_chart }\n else\n format.html { render action: 'new' }\n format.json { render json: @rescue_time_chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def chartrepo_charts_post(chart, opts = {})\n chartrepo_charts_post_with_http_info(chart, opts)\n nil\n end", "def getchart()\n # The data for the bar chart\n data0 = [100, 125, 245, 147, 67]\n data1 = [85, 156, 179, 211, 123]\n data2 = [97, 87, 56, 267, 157]\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\"]\n\n # Create a XYChart object of size 400 x 240 pixels\n c = ChartDirector::XYChart.new(400, 240)\n\n # Add a title to the chart using 10 pt Arial font\n c.addTitle(\" Average Weekday Network Load\", \"\", 10)\n\n # Set the plot area at (50, 25) and of size 320 x 180. Use two alternative\n # background colors (0xffffc0 and 0xffffe0)\n c.setPlotArea(50, 25, 320, 180, 0xffffc0, 0xffffe0)\n\n # Add a legend box at (55, 18) using horizontal layout. Use 8 pt Arial font, with\n # transparent background\n c.addLegend(55, 18, false, \"\", 8).setBackground(ChartDirector::Transparent)\n\n # Add a title to the y-axis\n c.yAxis().setTitle(\"Throughput (MBytes Per Hour)\")\n\n # Reserve 20 pixels at the top of the y-axis for the legend box\n c.yAxis().setTopMargin(20)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Add a multi-bar layer with 3 data sets and 3 pixels 3D depth\n layer = c.addBarLayer2(ChartDirector::Side, 3)\n layer.addDataSet(data0, 0xff8080, \"Server #1\")\n layer.addDataSet(data1, 0x80ff80, \"Server #2\")\n layer.addDataSet(data2, 0x8080ff, \"Server #3\")\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def create\n @chart = Chart.new(chart_params)\n @chart.BMI = @chart.set_information[:BMI]\n @chart.Proper = @chart.set_information[:Proper]\n @chart.metabolism = @chart.basal_metabolism(current_user.age)\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to @chart, notice: '編集しました' }\n format.json { render :show, status: :created, location: @chart }\n else\n format.html { render :new }\n format.json { render json: @chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @todolist_chart = TodolistChart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todolist_chart }\n end\n end", "def create\n @charts_account = ChartsAccount.new(charts_account_params)\n\n if @charts_account.save\n render :show, status: :created\n else\n render json: @charts_account.errors, status: :unprocessable_entity\n end\n end", "def chart_params\n params.require(:chart).permit(:code, :content, :glcode, :gst, :header, :users_id)\n end", "def chart_params\n params.require(:chart).permit(:speech_id, :name, :member_id)\n end", "def chart_params\n params.require(:chart).permit(:name, :birth_date, :is_female)\n end", "def index\n @chart = Chart.new\n @charts = Chart.all\n end", "def getchart()\n # The data for the bar chart\n data0 = [100, 125, 245, 147, 67]\n data1 = [85, 156, 179, 211, 123]\n data2 = [97, 87, 56, 267, 157]\n\n # The labels for the bar chart\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\"]\n\n # Create a XYChart object of size 500 x 320 pixels\n c = ChartDirector::XYChart.new(500, 320)\n\n # Set the plotarea at (100, 40) and of size 280 x 240 pixels\n c.setPlotArea(100, 40, 280, 240)\n\n # Add a legend box at (400, 100)\n c.addLegend(400, 100)\n\n # Add a title to the chart using 14 points Times Bold Itatic font\n c.addTitle(\"Weekday Network Load\", \"timesbi.ttf\", 14)\n\n # Add a title to the y axis. Draw the title upright (font angle = 0)\n c.yAxis().setTitle(\"Average\\nWorkload\\n(MBytes\\nPer Hour)\").setFontAngle(0)\n\n # Set the labels on the x axis\n c.xAxis().setLabels(labels)\n\n # Add a stacked bar layer and set the layer 3D depth to 8 pixels\n layer = c.addBarLayer2(ChartDirector::Stack, 8)\n\n # Add the three data sets to the bar layer\n layer.addDataSet(data0, 0xff8080, \"Server # 1\")\n layer.addDataSet(data1, 0x80ff80, \"Server # 2\")\n layer.addDataSet(data2, 0x8080ff, \"Server # 3\")\n\n # Enable bar label for the whole bar\n layer.setAggregateLabelStyle()\n\n # Enable bar label for each segment of the stacked bar\n layer.setDataLabelStyle()\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def graph\n @data = @category.to_graph_points\n\n @series = [{ values: @data, key: @category.name }]\n\n @title = \"Spending for #{@category.name}\"\n end", "def chart_params\n params.require(:chart).permit(:patient_id, :doctor_id, :pages, :chart, :filename)\n end", "def getchart()\n # The data for the bar chart\n data = [85, 156, 179.5, 211, 123]\n\n # The labels for the bar chart\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\"]\n\n # The colors for the bar chart\n colors = [0xb8bc9c, 0xa0bdc4, 0x999966, 0x333366, 0xc3c3e6]\n\n # Create a XYChart object of size 300 x 220 pixels. Use golden background color.\n # Use a 2 pixel 3D border.\n c = ChartDirector::XYChart.new(300, 220, ChartDirector::goldColor(), -1, 2)\n\n # Add a title box using 10 point Arial Bold font. Set the background color to\n # metallic blue (9999FF) Use a 1 pixel 3D border.\n c.addTitle(\"Daily Network Load\", \"arialbd.ttf\", 10).setBackground(\n ChartDirector::metalColor(0x9999ff), -1, 1)\n\n # Set the plotarea at (40, 40) and of 240 x 150 pixels in size\n c.setPlotArea(40, 40, 240, 150)\n\n # Add a multi-color bar chart layer using the given data and colors. Use a 1 pixel\n # 3D border for the bars.\n c.addBarLayer3(data, colors).setBorderColor(-1, 1)\n\n # Set the labels on the x axis.\n c.xAxis().setLabels(labels)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def chartrepo_charts_post_with_http_info(chart, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChartRepositoryApi.chartrepo_charts_post ...'\n end\n # verify the required parameter 'chart' is set\n if @api_client.config.client_side_validation && chart.nil?\n fail ArgumentError, \"Missing the required parameter 'chart' when calling ChartRepositoryApi.chartrepo_charts_post\"\n end\n # resource path\n local_var_path = '/chartrepo/charts'\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', 'text/plain'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['chart'] = chart\n form_params['prov'] = opts[:'prov'] if !opts[:'prov'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\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: ChartRepositoryApi#chartrepo_charts_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.chartnodes.destroy_all\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to charts_url }\n format.json { head :no_content }\n end\n end", "def getchart()\n # The data for the bar chart\n data = [450, 560, 630, 800, 1100, 1350, 1600, 1950, 2300, 2700]\n\n # The labels for the bar chart\n labels = [\"1996\", \"1997\", \"1998\", \"1999\", \"2000\", \"2001\", \"2002\", \"2003\", \"2004\",\n \"2005\"]\n\n # Create a XYChart object of size 600 x 360 pixels\n c = ChartDirector::XYChart.new(600, 360)\n\n # Add a title to the chart using 18pts Times Bold Italic font\n c.addTitle(\"Annual Revenue for Star Tech\", \"timesbi.ttf\", 18)\n\n # Set the plotarea at (60, 40) and of size 500 x 280 pixels. Use a vertical\n # gradient color from light blue (eeeeff) to deep blue (0000cc) as background. Set\n # border and grid lines to white (ffffff).\n c.setPlotArea(60, 40, 500, 280, c.linearGradientColor(60, 40, 60, 280, 0xeeeeff,\n 0x0000cc), -1, 0xffffff, 0xffffff)\n\n # Add a multi-color bar chart layer using the supplied data. Use soft lighting\n # effect with light direction from left.\n c.addBarLayer3(data).setBorderColor(ChartDirector::Transparent,\n ChartDirector::softLighting(ChartDirector::Left))\n\n # Set x axis labels using the given labels\n c.xAxis().setLabels(labels)\n\n # Draw the ticks between label positions (instead of at label positions)\n c.xAxis().setTickOffset(0.5)\n\n # Add a title to the y axis with 10pts Arial Bold font\n c.yAxis().setTitle(\"USD (millions)\", \"arialbd.ttf\", 10)\n\n # Set axis label style to 8pts Arial Bold\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Set axis line width to 2 pixels\n c.xAxis().setWidth(2)\n c.yAxis().setWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def create\n #vicious hack. sorry to whoever is reading this even me again.\n if params[:chart]\n redirect_to :action => :index, :params => params[:chart]\n return\n end\n @sleep = Sleep.new(params[:sleep])\n @sleep.user_id = session[:user_id]\n\n respond_to do |format|\n if @sleep.save\n flash[:notice] = 'Sleep was successfully created.'\n format.html { redirect_to(@sleep) }\n format.xml { render :xml => @sleep, :status => :created, :location => @sleep }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sleep.errors, :status => :unprocessable_entity }\n end\n end\n end", "def getchart()\n # The data for the chart\n data = [100, 125, 260, 147, 67]\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\"]\n\n # Create a XYChart object of size 200 x 180 pixels\n c = ChartDirector::XYChart.new(200, 180)\n\n # Set the plot area at (30, 10) and of size 140 x 130 pixels\n c.setPlotArea(30, 10, 140, 130)\n\n # Ise log scale axis if required\n if params[\"img\"] == \"1\"\n c.yAxis().setLogScale3()\n end\n\n # Set the labels on the x axis\n c.xAxis().setLabels(labels)\n\n # Add a color bar layer using the given data. Use a 1 pixel 3D border for the\n # bars.\n c.addBarLayer3(data).setBorderColor(-1, 1)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to(charts_url) }\n format.xml { head :ok }\n end\n end", "def create\n @series = Series.new(params[:series])\n\n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series se ha creado con éxito.' }\n format.json { render json: @series, status: :created, location: @series }\n else\n format.html { render action: \"new\" }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end", "def getchart()\n # The data for the bar chart\n data0 = [100, 125, 156, 147, 87, 124, 178, 109, 140, 106, 192, 122]\n data1 = [122, 156, 179, 211, 198, 177, 160, 220, 190, 188, 220, 270]\n data2 = [167, 190, 213, 267, 250, 320, 212, 199, 245, 267, 240, 310]\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sept\", \"Oct\",\n \"Nov\", \"Dec\"]\n\n # Create a XYChart object of size 580 x 280 pixels\n c = ChartDirector::XYChart.new(580, 280)\n\n # Add a title to the chart using 14 pts Arial Bold Italic font\n c.addTitle(\"Product Revenue For Last 3 Years\", \"arialbi.ttf\", 14)\n\n # Set the plot area at (50, 50) and of size 500 x 200. Use two alternative\n # background colors (f8f8f8 and ffffff)\n c.setPlotArea(50, 50, 500, 200, 0xf8f8f8, 0xffffff)\n\n # Add a legend box at (50, 25) using horizontal layout. Use 8pts Arial as font,\n # with transparent background.\n c.addLegend(50, 25, false, \"arial.ttf\", 8).setBackground(\n ChartDirector::Transparent)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Draw the ticks between label positions (instead of at label positions)\n c.xAxis().setTickOffset(0.5)\n\n # Add a multi-bar layer with 3 data sets\n layer = c.addBarLayer2(ChartDirector::Side)\n layer.addDataSet(data0, 0xff8080, \"Year 2003\")\n layer.addDataSet(data1, 0x80ff80, \"Year 2004\")\n layer.addDataSet(data2, 0x8080ff, \"Year 2005\")\n\n # Set 50% overlap between bars\n layer.setOverlapRatio(0.5)\n\n # Add a title to the y-axis\n c.yAxis().setTitle(\"Revenue (USD in millions)\")\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def index\n @payments = @payments.order(\"date DESC\")\n @graph = { :members => chart(\"members\"), \n :total => chart(\"total\"), \n :basic => chart(\"basic\"), \n :associate => chart(\"associate\")}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @payments }\n end\n end", "def chart=(v) DataTypeValidator.validate \"Series.chart\", Chart, v; @chart = v; end", "def performance_chart_params\n params[:performance_chart]\n end", "def show\n @chart = Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def show\n @chart = Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def write_chart_type\n # Write the c:barChart element.\n write_line_chart\n end", "def basic_chart\n \n end", "def create\n @bar_graph = BarGraph.new(bar_graph_params)\n\n respond_to do |format|\n if @bar_graph.save\n format.html { redirect_to edit_bar_graph_path(@bar_graph), notice: 'Bar graph was successfully created.' }\n format.json { render :edit, status: :created, location: @bar_graph }\n else\n format.html { render :new }\n format.json { render json: @bar_graph.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_data(graphname, options, value = nil)\n if value.nil?\n params = {\n :graphname => graphname,\n }.merge options\n else\n # obsolute arguments.\n date = options\n params = {\n :graphname => graphname,\n :date => date,\n :value => value,\n }\n end\n\n if params[:value] != nil\n params[:value] = params[:value].to_f\n end\n\n params[:date] = params[:date].strftime(DATE_FORMAT) if params[:date]\n\n res = http_post GRAPH_API_DATA_URI, params\n raise GraphError.new(\"request not successed: #{res}\") if res.code != '201'\n res\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def getchart()\n # The data for the line chart\n data0 = [410, 420, 500, 590]\n data1 = [500, 370, 680, 850]\n labels = [\"Q1\", \"Q2\", \"Q3\", \"Q4\"]\n\n # Create a XYChart object of size 600 x 400 pixels\n c = ChartDirector::XYChart.new(600, 400)\n\n # Add a title to the chart using 18 pts Times Bold Italic font\n title = c.addTitle(\"Product Line Global Revenue\", \"timesbi.ttf\", 18)\n\n # Tentatively set the plotarea at (50, 55) and of (chart_width - 100) x\n # (chart_height - 150) pixels in size. Use a vertical gradient color from sky blue\n # (aaccff) t0 light blue (f9f9ff) as background. Set both horizontal and vertical\n # grid lines to dotted semi-transprent black (aa000000).\n plotArea = c.setPlotArea(50, 55, c.getWidth() - 100, c.getHeight() - 150,\n c.linearGradientColor(0, 55, 0, 55 + c.getHeight() - 150, 0xaaccff, 0xf9fcff),\n -1, -1, c.dashLineColor(0xaa000000, ChartDirector::DotLine), -1)\n\n # Set y-axis title using 12 points Arial Bold Italic font, and set its position 10\n # pixels from the axis.\n c.yAxis().setTitle(\"Revenue (USD millions)\", \"arialbi.ttf\", 12)\n c.yAxis().setTitlePos(ChartDirector::Left, 10)\n\n # Set y-axis label style to 10 points Arial Bold and axis color to transparent\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 10)\n c.yAxis().setColors(ChartDirector::Transparent)\n\n # Set y-axis tick density to 30 pixels. ChartDirector auto-scaling will use this\n # as the guideline when putting ticks on the y-axis.\n c.yAxis().setTickDensity(30)\n\n # Add a bar layer to the chart with side layout\n layer = c.addBarLayer2(ChartDirector::Side)\n\n # Add two data sets to the bar layer\n layer.addDataSet(data0, 0xff6600, \"FY 2007\")\n layer.addDataSet(data1, 0x0088ff, \"FY 2008\")\n\n # Use soft lighting effect with light direction from the left\n layer.setBorderColor(ChartDirector::Transparent, ChartDirector::softLighting(\n ChartDirector::Left))\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Convert the labels on the x-axis to a CDMLTable\n table = c.xAxis().makeLabelTable()\n\n # Set the default left/right margins to 5 pixels and top/bottom margins to 3\n # pixels. Set the default font size to 10 points\n cellStyle = table.getStyle()\n cellStyle.setMargin2(5, 5, 4, 3)\n cellStyle.setFontSize(10)\n\n # Set the first row to use Arial Bold font, with a light grey (eeeeee) background.\n firstRowStyle = table.getRowStyle(0)\n firstRowStyle.setFontStyle(\"arialbd.ttf\")\n firstRowStyle.setBackground(0xeeeeee, ChartDirector::LineColor)\n\n #\n # We can add more information to the table. In this sample code, we add the data\n # series and the legend icons to the table.\n #\n\n # Add 3 more rows to the table. Set the background of the 2nd row to light grey\n # (eeeeee).\n table.appendRow()\n table.appendRow().setBackground(0xeeeeee, ChartDirector::LineColor)\n table.appendRow()\n\n # Put the values of the 2 data series in the first 2 rows. Put the percentage\n # differences in the 3rd row.\n 0.upto(data0.length - 1) do |i|\n table.setText(i, 1, (data0[i]).to_s)\n table.setText(i, 2, (data1[i]).to_s)\n\n percentageDiff = 100.0 * (data1[i] - data0[i]) / data0[i]\n\n # Use red or green color depending on whether the difference is positive or\n # negative\n formatString = \"<*color=008800*>+{value|1}%\"\n if percentageDiff < 0\n formatString = \"<*color=cc0000*>{value|1}%\"\n end\n table.setText(i, 3, c.formatValue(percentageDiff, formatString))\n end\n\n # Insert a column on the left for the legend icons using Arial Bold font.\n table.insertCol(0).setFontStyle(\"arialbd.ttf\")\n\n # The top cell is set to transparent, so it is invisible\n table.getCell(0, 0).setBackground(ChartDirector::Transparent,\n ChartDirector::Transparent)\n\n # The next 2 cells are set to the legend icons and names of the 2 data series\n table.setText(0, 1, sprintf(\"%s FY 2007\", layer.getLegendIcon(0)))\n table.setText(0, 2, sprintf(\"%s FY 2008\", layer.getLegendIcon(1)))\n\n # The last cell is set to \"Change\"\n table.setText(0, 3, \"Change\")\n\n # Append a column on the right for the total values.\n table.appendCol()\n\n # Put \"Total\" in the top cell as the heading of this column\n table.setText(table.getColCount() - 1, 0, \"Total\")\n\n # The next two cells are the total of the data series\n total0 = ChartDirector::ArrayMath.new(data0).sum()\n total1 = ChartDirector::ArrayMath.new(data1).sum()\n table.setText(table.getColCount() - 1, 1, total0.to_s)\n table.setText(table.getColCount() - 1, 2, total1.to_s)\n\n # The last cell is the percentage differences of the total\n totalPercentageDiff = (total1 - total0) / total0 * 100\n\n # Use red or green color depending on whether the difference is positive or\n # negative\n totalFormatString = \"<*color=008800*>+{value|1}%\"\n if totalPercentageDiff < 0\n totalFormatString = \"<*color=cc0000*>{value|1}%\"\n end\n table.setText(table.getColCount() - 1, 3, c.formatValue(totalPercentageDiff,\n totalFormatString))\n\n #\n # We now demonstrate how to adjust the plot area positions, to allow space for the\n # newly inserted left and right columns in the table.\n #\n\n # We layout the axis first in order to get the axis metrics (including table\n # metrics)\n c.layoutAxes()\n\n # If the first column is wider than the left y-axis, we need to reserve for some\n # left margin to ensure the first column stays within the chart.\n leftMargin = 0\n if table.getColWidth(0) > c.yAxis().getThickness()\n leftMargin = table.getColWidth(0) - c.yAxis().getThickness()\n end\n\n # Similarly, we need to reserve some right margin for the last column\n rightMargin = table.getColWidth(table.getColCount() - 1)\n\n # Adjust the plot area size, such that the bounding box (inclusive of axes) using\n # the given left and right margin, plus 2 more pixels. Put the plot area 10 pixels\n # below the title and use 2 pixels as the bottom margin. from the left, right and\n # bottom edge, and is just under the legend box.\n c.packPlotArea(leftMargin + 2, title.getHeight() + 10, c.getWidth(\n ) - 3 - rightMargin, c.getHeight() - 3)\n\n # After determining the exact plot area position, we may adjust title position so\n # that it is centered relative to the plot area (instead of the chart)\n title.setPos(plotArea.getLeftX() + (plotArea.getWidth() - title.getWidth()) / 2,\n title.getTopY())\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def sendData\n\t# List of all days\n\t@list_of_days = (1.month.ago.to_date...Date.today).to_a\n\t# New Array for graph\n\t@graph = Array.new\n\t# Set all dates to zero\n\t@list_of_days.each do |k|\n\t\t# Convert to useable date\n\t\tdate = k.to_date\n\t\t# Count all clicks/leads per day, per user\n\t\t@clicks = Click.complete_day(date).where(:user_id => current_user.id).count\n\t\t@leads = Lead.complete_day(date).where(:user_id => current_user.id).count\n\t\t# Add to array per day with clicks\n\t\t@graph << { y: date.strftime(\"%Y-%m-%d\"), click: @clicks, lead: @leads}\n\tend\n\t#Respond to JSON\n\trespond_to do |format|\n\t\tformat.json { render json: @graph }\n\tend\n end", "def create\n @series = Series.new(params[:series])\n @series.normalize_start_time\n @series.type=determine_series_type(params[:series][:type])\n\n respond_to do |format|\n if @series.save\n flash[:notice] = 'Serie erfolgreich erzeugt.'\n format.html { redirect_to(@series) }\n format.xml { render :xml => @series, :status => :created, :location => @series }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @series.errors, :status => :unprocessable_entity }\n end\n end\n end", "def trends\n data = generate_data(data_factory)\n respond_with data\n end", "def series_json(params={})\n # Create data for charts\n color = params[:color] ||= 'AA4643'\n color = '#' + color\n series = []\n data = []\n\n data << [self.baseline_date, (self.baseline.round*100).round / 100.0]\n # For ideal data\n self.progresses.each{|progress| \n data << [progress.due_date, (progress.accuracy*100).round / 100.0]\n }\n data << [self.due_date, (self.accuracy*100).round / 100.0]\n #Sort data by due date\n data = data.sort_by { |hsh| hsh[0] }\n \n series << {\n :type => 'line',\n :name => \"Ideal chart\",\n :data => data\n }\n if color && color == '#4572A7'\n series[0][:color] = \"#AA4643\"\n end\n # For add grade \n data = []\n self.grades.find_each{|grade| \n data << [grade.due_date, (grade.accuracy*100).round / 100.0]\n }\n data = data.sort_by { |hsh| hsh[0] }\n series << {\n :name => self.name,\n :data => data,\n :color => color \n }\n series.to_json\n end", "def chart_data\n @track=current_user.tracks.find(params[:id])\n respond_to do |format|\n format.json {render :json => @track.as_chart_data}\n end\n end", "def add_chart(chartType, upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn)\n begin\n if(@filename=='')\n raise \"Base file not specified\"\n end\n if(@worksheetname=='')\n raise \"Worksheet is not specified\"\n end\n str_uri = $productURI + \"/cells/\" + @filename + \"/worksheets/\" + @worksheetname + \"/charts?chartType=\" +\n chartType.to_s + \"&upperLeftRow=\" + upperLeftRow.to_s + \"&upperLeftColumn=\" +\n upperLeftColumn.to_s + \"&lowerRightRow=\" + lowerRightRow.to_s + \n \"&lowerRightColumn=\" + lowerRightColumn.to_s\n signed_uri = Common::Utils.sign(str_uri)\n \n response = RestClient.put signed_uri,'', {:accept => 'application/json'}\n v_output = Common::Utils.validate_output(response)\n if(v_output==nil || v_output=='')\n folder = SaasposeStorage::Folder.new\n outputstream = folder.getfile(@filename)\n outputstream\n outputpath = $OutPutLocation + @filename\n Common::Utils.saveFile(outputstream, outputpath)\n return \"Chart added\"\n else\n return v_output\n end\n rescue Exception=>e\n print e\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @chart }\n end\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.destroy\n respond_with(@chart)\n end", "def create\n # @axis = Axis.new(axis_params)\n # @axis.user = current_user\n # respond_to do |format|\n # if @axis.save\n # format.html { redirect_to @axis, notice: 'Axis was successfully created.' }\n # format.json { render :show, status: :created, location: @axis }\n # else\n # format.html { render :new }\n # format.json { render json: @axis.errors, status: :unprocessable_entity }\n # end\n # end\n\n respond_to do |format|\n\n format.json { render json: Axis.create( name: params[:name]) }\n end\n end", "def destroy\n @travel_chart = Travel::Chart.find(params[:id])\n @travel_chart.destroy\n\n respond_to do |format|\n format.html { redirect_to travel_charts_url }\n format.json { head :no_content }\n end\n end", "def chartrepo_repo_charts_post(repo, chart, opts = {})\n chartrepo_repo_charts_post_with_http_info(repo, chart, opts)\n nil\n end", "def create\n @series = Series.new(series_params)\n\n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series was successfully created.' }\n format.json { render action: 'show', status: :created, location: @series }\n else\n format.html { render action: 'new' }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @chart.destroy\n respond_to do |format|\n format.html { redirect_to charts_path, notice: '削除しました' }\n format.json { head :no_content }\n end\n end", "def get_chart(options={})\n api_response = @api_client.make_api_request(:GET, \"artist/chart\", {}, options)\n @api_client.chart_item_digestor.list_from_xml(api_response.content.chart)\n end", "def api_v11_timeseries_post(opts = {})\n api_v11_timeseries_post_with_http_info(opts)\n return nil\n end", "def create\n @series = Series.new(series_params)\n \n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series was successfully created.' }\n format.json { render :show, status: :created, location: @series }\n else\n format.html { render :new }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def create\n @tree_plot = TreePlot.new(tree_plot_params)\n\n respond_to do |format|\n if @tree_plot.save\n # format.html { redirect_to @tree_plot, notice: 'Tree plot was successfully created.' }\n format.html { redirect_to tree_plots_path, notice: 'Tree plot was successfully created.' }\n format.json { render :show, status: :created, location: @tree_plot }\n else\n format.html { render :new }\n format.json { render json: @tree_plot.errors, status: :unprocessable_entity }\n end\n end\n end", "def graph_params\n \n params.require(:graph).permit([\n :name,\n :x_colname,\n :y1_colname,\n :y2_colname,\n :sheetname,\n :y1_legend,\n :y2_legend, \n :color_y1,\n :color_y2,\n :order_num,\n :definition,\n :period])\n \n end", "def create\n @tv_series = TvSerie.new(tv_series_params)\n\n respond_to do |format|\n if @tv_series.save\n format.html { redirect_to @tv_series, notice: \"Tv serie was successfully created.\" }\n format.json { render :show, status: :created, location: @tv_series }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tv_series.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @predict_charts = PredictChart.all\n end", "def write_chart_type; end", "def create\n @velocity = Velocity.new(velocity_params)\n @velocity.chart = Chart.find(params[:id])\n\n respond_to do |format|\n if @velocity.save\n format.html { redirect_to @velocity.chart, notice: 'Velocity was successfully created.' }\n format.json { render :show, status: :created, location: @velocity.chart }\n else\n format.html { render :new }\n format.json { render json: @velocity.errors, status: :unprocessable_entity }\n end\n end\n end", "def chartrepo_repo_charts_post_with_http_info(repo, chart, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChartRepositoryApi.chartrepo_repo_charts_post ...'\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 ChartRepositoryApi.chartrepo_repo_charts_post\"\n end\n # verify the required parameter 'chart' is set\n if @api_client.config.client_side_validation && chart.nil?\n fail ArgumentError, \"Missing the required parameter 'chart' when calling ChartRepositoryApi.chartrepo_repo_charts_post\"\n end\n # resource path\n local_var_path = '/chartrepo/{repo}/charts'.sub('{' + 'repo' + '}', repo.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', 'text/plain'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['chart'] = chart\n form_params['prov'] = opts[:'prov'] if !opts[:'prov'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\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: ChartRepositoryApi#chartrepo_repo_charts_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def alerts_graph\n @days = 30\n if (params.nil? or params[:device].nil? or params[:device][:id].empty?)\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"No device selected\")\n end\n else\n if (not params[:days].nil? and not params[:days].empty?)\n @days = params[:days].to_i\n end\n @device_id = params[:device][:id]\n @device = Device.find @device_id\n misfeed_alerts = Alert.where([\"device_id=? and alert_msg regexp 'misfeed' and alert_date > date_sub(curdate(), interval ? day)\",@device_id,@days]).group('date(alert_date)').count\n maint_alerts = Alert.where([\"device_id=? and alert_msg regexp 'maintenance' and alert_date > date_sub(curdate(), interval ? day)\",@device_id,@days]).group('date(alert_date)').count\n service_alerts = Alert.where([\"device_id=? and alert_msg regexp 'service' and alert_date > date_sub(curdate(), interval ? day)\",@device_id,@days]).group('date(alert_date)').count\n misfeed_data = Hash.new\n maint_data = Hash.new\n service_data = Hash.new\n (@days.days.ago.to_date..Date.today).map do |date|\n misfeed_data[date] = misfeed_alerts[date].nil? ? 0 : misfeed_alerts[date]\n maint_data[date] = maint_alerts[date].nil? ? 0 : maint_alerts[date]\n service_data[date] = service_alerts[date].nil? ? 0 : service_alerts[date]\n end\n @chart = LazyHighCharts::HighChart.new('chart') do |f|\n f.type('scatter')\n f.title( {:text => \"Alerts for #{@device.name}\"} )\n f.xAxis( :type => 'datetime' )\n f.series( :type => 'line', :name => 'Misfeed', \n :pointInterval => 1.day,\n :pointStart => @days.days.ago.to_date,\n :data => misfeed_data.to_a )\n f.series( :type => 'line', :name => 'Maintenance Request', \n :pointInterval => 1.day,\n :pointStart => @days.days.ago.to_date,\n :data => maint_data.to_a )\n f.series( :type => 'line', :name => 'Call for Service', \n :pointInterval => 1.day,\n :pointStart => @days.days.ago.to_date,\n :data => service_data.to_a )\n# f.series( :name => 'test', :data => test_data )\n end\n end\n end", "def new\n @series = Series.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @series }\n end\n end", "def create\n @tv_series = TvSeries.new(tv_series_params)\n\n respond_to do |format|\n if @tv_series.save\n format.html { redirect_to root_path, notice: 'Сериал создан!' }\n format.json { render :index, status: :created, location: root_path }\n else\n format.html { render :new }\n format.json { render json: @tv_series.errors, status: :unprocessable_entity }\n end\n end\n end", "def getchart()\n # The XY data of the first data series\n dataX0 = [50, 55, 37, 24, 42, 49, 63, 72, 83, 59]\n dataY0 = [3.6, 2.8, 2.5, 2.3, 3.8, 3.0, 3.8, 5.0, 6.0, 3.3]\n\n # The XY data of the second data series\n dataX1 = [50, 55, 37, 24, 42, 49, 63, 72, 83, 59]\n dataY1 = [1.6, 1.8, 0.8, 0.5, 1.3, 1.5, 2.3, 2.4, 2.9, 1.5]\n\n # Create a XYChart object of size 450 x 420 pixels\n c = ChartDirector::XYChart.new(450, 420)\n\n # Set the plotarea at (55, 65) and of size 350 x 300 pixels, with white background\n # and a light grey border (0xc0c0c0). Turn on both horizontal and vertical grid\n # lines with light grey color (0xc0c0c0)\n c.setPlotArea(55, 65, 350, 300, 0xffffff, -1, 0xc0c0c0, 0xc0c0c0, -1)\n\n # Add a legend box at (50, 30) (top of the chart) with horizontal layout. Use 12\n # pts Times Bold Italic font. Set the background and border color to Transparent.\n c.addLegend(50, 30, false, \"timesbi.ttf\", 12).setBackground(\n ChartDirector::Transparent)\n\n # Add a title to the chart using 18 point Times Bold Itatic font.\n c.addTitle(\"Server Performance\", \"timesbi.ttf\", 18)\n\n # Add titles to the axes using 12 pts Arial Bold Italic font\n c.yAxis().setTitle(\"Response Time (sec)\", \"arialbi.ttf\", 12)\n c.xAxis().setTitle(\"Server Load (TPS)\", \"arialbi.ttf\", 12)\n\n # Set the axes line width to 3 pixels\n c.yAxis().setWidth(3)\n c.xAxis().setWidth(3)\n\n # Add a scatter layer using (dataX0, dataY0)\n c.addScatterLayer(dataX0, dataY0, \"Server AAA\", ChartDirector::DiamondSymbol, 11,\n 0x008000)\n\n # Add a trend line layer for (dataX0, dataY0)\n c.addTrendLayer2(dataX0, dataY0, 0x008000).setLineWidth(3)\n\n # Add a scatter layer for (dataX1, dataY1)\n c.addScatterLayer(dataX1, dataY1, \"Server BBB\", ChartDirector::TriangleSymbol, 9,\n 0x6666ff)\n\n # Add a trend line layer for (dataX1, dataY1)\n c.addTrendLayer2(dataX1, dataY1, 0x6666ff).setLineWidth(3)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def predict_chart_params\n params.fetch(:predict_chart, {})\n end", "def example(request,response2)\n `rsvg-convert /tmp/chart.svg -o /tmp/chart.png`### Conversion of charts from .svg format provided by GerbilCharts to .png format\n file=File.read(\"/tmp/chart.png\")\n response2[\"Content-Type\"] = \"image/png\"\n response2.write(file)\n response2.finish\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 destroy\n# @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to charts_url }\n format.json { head :no_content }\n end\n end", "def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timecharts }\n end\n end", "def index\n @carreras = Carrera.all\n\n\n builder = Nokogiri::XML::Builder.new do |xml|\n\n xml.carreras {\n @carreras.each do |c|\n xml.carrera do\n xml.nombre c.nombre\n xml.codigo c.codigo\n xml.cantidadAniosAcreditada c.cantidadAniosAcreditada\n xml.capacidadAutoregulacion c.capacidadAutoregulacion\n xml.condicionOperacion c.condicionOperacion\n xml.perfilIngresoResultado c.perfilIngresoResultado\n end\n end\n }\n end\n\n\n data_table = GoogleVisualr::DataTable.new\n\n\n # Add Column Headers\ndata_table.new_column('string', 'Carrera' )\ndata_table.new_column('number', 'Años')\n\n\n# Add Rows and Values\n\n@carreras.each do |c|\n data_table.add_rows([[c.nombre + \" - \"+ c.sede.nombre + \" - \" + c.sede.universidad.nombre, c.cantidadAniosAcreditada]])\n end\n\n\n\noption = { width: 700, height: 300, title: 'Acreditacion de Carreras' }\n@chart = GoogleVisualr::Interactive::ColumnChart.new(data_table, option)\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carreras }\n format.xml { render :xml =>\n builder.to_xml }\n end\n end", "def data\n chart =OpenFlashChart.new\n\n data = get_data\n\n get_converter.convert(chart, data)\n \n if show_y_axis\n y = YAxis.new\n y.set_range(0,(data[:max]*1.2).round,(data[:max]/get_y_axis_labels).round) if data[:max]\n chart.y_axis = y\n end\n\n if show_x_axis\n x = XAxis.new\n x.set_range(0,data[:count] > 1 ? data[:count] - 1 : 1,1) if data[:count]\n if data[:labels]\n labels = []\n if get_x_axis_labels > 0\n step = (data[:labels].size/get_y_axis_labels).to_i\n step = 1 if step == 0\n else\n step = 1\n end\n data[:labels].each_with_index do |l,i|\n if i % step == 0\n labels << l\n else\n labels << \"\"\n end\n end\n x.set_labels(labels)\n end\n chart.x_axis = x\n else\n x = XAxis.new\n x.set_labels([\"\"])\n chart.x_axis = x\n end\n\n unless get_x_legend.nil?\n legend = XLegend.new(get_x_legend)\n legend.set_style('{font-size: 12px}')\n chart.set_x_legend(legend)\n end\n\n unless get_x_legend.nil?\n legend = YLegend.new(get_y_legend)\n legend.set_style('{font-size: 12px}')\n chart.set_y_legend(legend)\n end\n\n chart.set_bg_colour('#ffffff');\n\n chart.to_s\n end", "def simple_chart\n \n end", "def getchart()\n # The data for the chart\n data0 = [42, 49, ChartDirector::NoValue, 38, 64, 56, 29, 41, 44, 57]\n data1 = [65, 75, 47, 34, 42, 49, 73, ChartDirector::NoValue, 90, 69, 66, 78]\n data2 = [ChartDirector::NoValue, ChartDirector::NoValue, 25, 28, 38, 20, 22,\n ChartDirector::NoValue, 25, 33, 30, 24]\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\",\n \"Nov\", \"Dec\"]\n\n # Create a XYChart object of size 600 x 360 pixels. Set background color to\n # brushed silver, with a 2 pixel 3D border. Use rounded corners.\n c = ChartDirector::XYChart.new(600, 360, ChartDirector::brushedSilverColor(),\n ChartDirector::Transparent, 2)\n c.setRoundedFrame()\n\n # Add a title using 18 pts Times New Roman Bold Italic font. #Set top/bottom\n # margins to 6 pixels.\n title = c.addTitle(\"Product Line Global Revenue\", \"timesbi.ttf\", 18)\n title.setMargin2(0, 0, 6, 6)\n\n # Add a separator line just under the title\n c.addLine(10, title.getHeight(), c.getWidth() - 11, title.getHeight(),\n ChartDirector::LineColor)\n\n # Add a legend box where the top-center is anchored to the horizontal center of\n # the chart, just under the title. Use horizontal layout and 10 points Arial Bold\n # font, and transparent background and border.\n legendBox = c.addLegend(c.getWidth() / 2, title.getHeight(), false, \"arialbd.ttf\",\n 10)\n legendBox.setAlignment(ChartDirector::TopCenter)\n legendBox.setBackground(ChartDirector::Transparent, ChartDirector::Transparent)\n\n # Tentatively set the plotarea at (70, 75) and of 460 x 240 pixels in size. Use\n # transparent border and black (000000) grid lines\n c.setPlotArea(70, 75, 460, 240, -1, -1, ChartDirector::Transparent, 0x000000, -1)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Show the same scale on the left and right y-axes\n c.syncYAxis()\n\n # Set y-axis tick density to 30 pixels. ChartDirector auto-scaling will use this\n # as the guideline when putting ticks on the y-axis.\n c.yAxis().setTickDensity(30)\n\n # Set all axes to transparent\n c.xAxis().setColors(ChartDirector::Transparent)\n c.yAxis().setColors(ChartDirector::Transparent)\n c.yAxis2().setColors(ChartDirector::Transparent)\n\n # Set the x-axis margins to 15 pixels, so that the horizontal grid lines can\n # extend beyond the leftmost and rightmost vertical grid lines\n c.xAxis().setMargin(15, 15)\n\n # Set axis label style to 8pts Arial Bold\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis2().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Add axis title using 10pts Arial Bold Italic font\n c.yAxis().setTitle(\"Revenue in USD millions\", \"arialbi.ttf\", 10)\n c.yAxis2().setTitle(\"Revenue in USD millions\", \"arialbi.ttf\", 10)\n\n # Add the first line. The missing data will be represented as gaps in the line\n # (the default behaviour)\n layer0 = c.addLineLayer2()\n layer0.addDataSet(data0, 0xff0000, \"Quantum Computer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer0.setLineWidth(3)\n\n # Add the second line. The missing data will be represented by using dash lines to\n # bridge the gap\n layer1 = c.addLineLayer2()\n layer1.addDataSet(data1, 0x00ff00, \"Atom Synthesizer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer1.setLineWidth(3)\n layer1.setGapColor(c.dashLineColor(0x00ff00))\n\n # Add the third line. The missing data will be ignored - just join the gap with\n # the original line style.\n layer2 = c.addLineLayer2()\n layer2.addDataSet(data2, 0xff6600, \"Proton Cannon\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer2.setLineWidth(3)\n layer2.setGapColor(ChartDirector::SameAsMainColor)\n\n # layout the legend so we can get the height of the legend box\n c.layoutLegend()\n\n # Adjust the plot area size, such that the bounding box (inclusive of axes) is 15\n # pixels from the left edge, just under the legend box, 16 pixels from the right\n # edge, and 25 pixels from the bottom edge.\n c.packPlotArea(15, legendBox.getTopY() + legendBox.getHeight(), c.getWidth() - 16,\n c.getHeight() - 25)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::JPG), :type => \"image/jpeg\",\n :disposition => \"inline\")\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => \"charts\", :action => \"area_chart\") }\n format.xml { head :ok }\n end\n end", "def axis_params\n params.require(:axis).permit(:name)\n end", "def feedbackchart\n \n end", "def create\n @plot = Plot.new(plot_params)\n respond_to do |format|\n if @plot.save\n format.html { redirect_to @plot, notice: 'Plot was successfully created.' }\n format.json { render :show, status: :created, location: @plot }\n else\n format.html { render :new }\n format.json { render json: @plot.errors, status: :unprocessable_entity }\n end\n end\n end", "def burndown\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n format.html { \n @graph = open_flash_chart_object(800, 500, url_for( :action => 'burndown', :id => params[:id], :format => :json )) \n }\n format.json { \n chart = @sprint.flash_burndown\n render :text => chart, :layout => false\n }\n end\n end", "def destroy\n @todolist_chart = TodolistChart.find(params[:id])\n @todolist_chart.destroy\n\n respond_to do |format|\n format.html { redirect_to(todolist_charts_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.65970594", "0.65693563", "0.63704085", "0.6119202", "0.61002785", "0.6066215", "0.6066215", "0.60581326", "0.602852", "0.602785", "0.58818173", "0.585007", "0.5821043", "0.58203584", "0.5788525", "0.5693146", "0.56842303", "0.5673135", "0.5672992", "0.56695896", "0.5654621", "0.5651793", "0.5642922", "0.55987567", "0.55965465", "0.55816126", "0.5546406", "0.5537295", "0.5533548", "0.55266243", "0.55180335", "0.55169004", "0.5516811", "0.55155885", "0.5484699", "0.5478853", "0.54631823", "0.54627687", "0.54571134", "0.54466164", "0.54086685", "0.5401526", "0.53936386", "0.5385072", "0.53772223", "0.5346435", "0.5346435", "0.5345811", "0.5323127", "0.53114897", "0.5306553", "0.53025806", "0.53025806", "0.53025806", "0.5299379", "0.5288044", "0.52623975", "0.5260231", "0.5259701", "0.5254651", "0.5251577", "0.52189016", "0.52182186", "0.5213322", "0.52108943", "0.5209536", "0.5209357", "0.5200641", "0.5186788", "0.51784056", "0.51764685", "0.5174324", "0.51731986", "0.5162946", "0.5153407", "0.51382357", "0.513792", "0.5132755", "0.5131817", "0.5121691", "0.51030636", "0.5100348", "0.5098057", "0.50968134", "0.5094799", "0.5090612", "0.50816035", "0.5071894", "0.50704974", "0.50695986", "0.5068054", "0.50631255", "0.50561917", "0.50512314", "0.50476307", "0.50386876", "0.5030046", "0.50288016" ]
0.6785044
2
PUT /charts/1 PUT /charts/1.xml
def update @chart = Chart.find(params[:id]) respond_to do |format| if @chart.update_attributes(params[:chart]) format.html { redirect_to(@chart, :notice => 'Chart was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @chart.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @chart = Chart.find(params[:id])\n\n respond_to do |format|\n if @chart.update_attributes(params[:chart])\n format.html { redirect_to @chart, notice: 'Chart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end", "def update\n @chart = Chart.find(params[:id])\n flash[:notice] = 'Chart was successfully updated.' if @chart.update(params[:chart])\n respond_with(@chart)\n end", "def update\n # byebug\n respond_to do |format|\n if @chart.update(chart_params)\n format.html { redirect_to @chart, notice: 'Chart was successfully updated.' }\n format.json {render :show, status: :ok, location: @chart}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @travel_chart = Travel::Chart.find(params[:id])\n\n respond_to do |format|\n if @travel_chart.update_attributes(params[:travel_chart])\n format.html { redirect_to @travel_chart, notice: 'Travel chart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @travel_chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todolist_chart = TodolistChart.find(params[:id])\n\n respond_to do |format|\n if @todolist_chart.update_attributes(params[:todolist_chart])\n flash[:notice] = 'TodolistChart was successfully updated.'\n format.html { redirect_to(@todolist_chart) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @todolist_chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_set = chart.data_sets.find(params[:id])\n \tdata_set.update_attributes(params[:data_set])\n\n respond_with(data_set) do |format|\n if data_set.valid?\n format.json { render json: { success: true, data_sets: data_set } }\n else\n format.json { render json: { success: false, errors: data_set.errors } }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @timechart = Timechart.find(params[:id])\n\n respond_to do |format|\n if @timechart.update_attributes(params[:timechart])\n format.html { redirect_to @timechart, notice: 'Timechart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timechart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @series = Series.find(params[:id])\n \n respond_to do |format|\n params[:series][:type]=determine_series_type(params[:series][:type])\n if @series.update_attributes(params[:series])\n flash[:notice] = 'Serie erfolgreich gespeichert.'\n format.html { redirect_to(series_url(@series)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @series.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @performance_chart.update(performance_chart_params)\n format.html { redirect_to @performance_chart, notice: 'Performance chart was successfully updated.' }\n format.json { render :show, status: :ok, location: @performance_chart }\n else\n format.html { render :edit }\n format.json { render json: @performance_chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @chart.update(chart_params)\n format.html { redirect_to edit_multiple_members_path, notice: 'Chart was successfully updated.' }\n format.json { render :show, status: :ok, location: @chart }\n else\n format.html { render :edit }\n format.json { render json: @chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series])\n format.html { redirect_to @series, notice: 'Series se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series])\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to(charts_url) }\n format.xml { head :ok }\n end\n end", "def set_axis\n @axis = Axis.find(params[:id])\n end", "def update\n if @charts_account.update(charts_account_params)\n render json: @charts_account, status: :ok\n else\n render json: @charts_account.errors, status: :unprocessable_entity\n end\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def set_chart\n @chart = Chart.find(params[:id])\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @graph.update_attributes_from_request(update_params)\n head :no_content\n end", "def update\n respond_to do |format|\n if @predict_chart.update(predict_chart_params)\n format.html { redirect_to @predict_chart, notice: 'Predict chart was successfully updated.' }\n format.json { render :show, status: :ok, location: @predict_chart }\n else\n format.html { render :edit }\n format.json { render json: @predict_chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @series.update(series_params)\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { render :show, status: :ok, location: @series }\n else\n format.html { render :edit }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @series.update(series_params)\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { render :show, status: :ok, location: @series }\n else\n format.html { render :edit }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rescue_time_chart.update(rescue_time_chart_params)\n format.html { redirect_to @rescue_time_chart, notice: 'Rescue time chart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rescue_time_chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_graph.update(api_v1_graph_params)\n format.html { redirect_to @api_v1_graph, notice: 'Graph was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_graph }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_graph.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @chart.BMI = @chart.set_information[:BMI]\n @chart.Proper = @chart.set_information[:Proper]\n @chart.metabolism = @chart.basal_metabolism(current_user.age)\n respond_to do |format|\n if @chart.update(chart_params)\n format.html { redirect_to @chart, notice: '更新しました' }\n format.json { render :show, status: :ok, location: @chart }\n else\n format.html { render :edit }\n format.json { render json: @chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @series.update(series_params)\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bar_graph.update(bar_graph_params)\n format.html { redirect_to edit_bar_graph_path(@bar_graph), notice: 'Bar graph was successfully updated.' }\n format.json { render :edit, status: :ok, location: @bar_graph }\n else\n format.html { render :edit }\n format.json { render json: @bar_graph.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to(@chart, :notice => 'Chart was successfully created.') }\n format.xml { render :xml => @chart, :status => :created, :location => @chart }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to(@chart, :notice => 'Chart was successfully created.') }\n format.xml { render :xml => @chart, :status => :created, :location => @chart }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to(@chart, :notice => 'Chart was successfully created.') }\n format.xml { render :xml => @chart, :status => :created, :location => @chart }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chart.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n respond_to do |format|\n if @axis_event.update(axis_event_params)\n format.html { redirect_to @axis_event, notice: 'Axis event was successfully updated.' }\n format.json { render :show, status: :ok, location: @axis_event }\n else\n format.html { render :edit }\n format.json { render json: @axis_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @charts = Chart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @charts }\n end\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def update\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.destroy\n respond_with(@chart)\n end", "def create\n @chart = Chart.new(chart_params)\n @chart.user = current_user.id\n @chart.amount_1 = 0\n @chart.amount_2 = 0\n respond_to do |format|\n if @chart.save\n \n format.html { redirect_to @chart, notice: 'Chart was successfully created.' }\n format.json { render json: @chart, status: :created, location: @chart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @series.update(series_params)\n format.html { redirect_to @series, notice: \"La mêlée du #{Series.date} a été modifiée.\" }\n # format.json { render :show, status: :ok, location: @series }\n else\n format.html { render :edit, status: :unprocessable_entity }\n # format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plot.update(plot_params)\n format.html { redirect_to @plot, notice: 'Plot was successfully updated.' }\n format.json { render :show, status: :ok, location: @plot }\n else\n format.html { render :edit }\n format.json { render json: @plot.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.chartnodes.destroy_all\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to charts_url }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @plot.update(plot_params)\n format.html { redirect_to @plot, notice: \"Plot was successfully updated.\" }\n format.json { render :show, status: :ok, location: @plot }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @plot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tv_series.update(tv_series_params)\n format.html { redirect_to @tv_series, notice: \"Tv serie was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tv_series }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tv_series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def show\n @chart = Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def show\n @chart = Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chart }\n end\n end", "def update\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n flash[:notice] = 'Dataset was successfully updated.'\n format.html { redirect_to dataset_url(@dataset) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors.to_xml }\n end\n end\n end", "def update(index_name, payload)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = \"application/json\"\n req.body = payload.to_json\n @client.send_http(req, true, ['200'])\n end", "def destroy\n @travel_chart = Travel::Chart.find(params[:id])\n @travel_chart.destroy\n\n respond_to do |format|\n format.html { redirect_to travel_charts_url }\n format.json { head :no_content }\n end\n end", "def set_simplified_chart\n @simplified_chart = SimplifiedChart.find(params[:id])\n end", "def update\n respond_to do |format|\n if @tv_series.update(tv_series_params)\n format.html { redirect_to root_path, notice: 'Сериал отредактирован!' }\n format.json { render :index, status: :ok, location: root_path }\n else\n format.html { render :edit }\n format.json { render json: @tv_series.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to @chart, notice: 'Chart was successfully created.' }\n format.json { render json: @chart, status: :created, location: @chart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => \"charts\", :action => \"area_chart\") }\n format.xml { head :ok }\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @series_type = SeriesType.find(params[:id])\n\n respond_to do |format|\n if @series_type.update_attributes(params[:series_type])\n format.html { redirect_to @series_type, notice: 'Series type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @series_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n# @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to charts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @todolist_chart = TodolistChart.find(params[:id])\n @todolist_chart.destroy\n\n respond_to do |format|\n format.html { redirect_to(todolist_charts_url) }\n format.xml { head :ok }\n end\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def update\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to @dataset, notice: 'Dataset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dataset.update(dataset_params)\n format.html { redirect_to @dataset, notice: 'Dataset was successfully updated.' }\n format.json { render :show, status: :ok, location: @dataset }\n else\n format.html { render :edit }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @chart = Chart.new(params[:chart])\n flash[:notice] = 'Chart was successfully created.' if @chart.save\n respond_with(@chart)\n end", "def update\n @techaxis = Techaxis.find(params[:id])\n\n respond_to do |format|\n if @techaxis.update_attributes(params[:techaxis])\n format.html { redirect_to techaxis_type_techaxis_path, :notice => t('controllermessage.update') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @techaxis.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_axis2XML(carbon_home,http_port,https_port) \n\n\tFile.open(File.join(carbon_home , 'conf','axis2.xml')) do |config_file|\n\t\t# Open the document and edit the port (axis2.xml)\n\t\tconfig = Document.new(config_file)\n\t\t\n\t\tconfig.root.elements[25].elements[1].text=http_port\n\t\tconfig.root.elements[26].elements[1].text=https_port\n\t\n\t\t\n\t\t# Write the result to a new file.\n\t\tformatter = REXML::Formatters::Default.new\n\t\tFile.open(File.join(carbon_home , 'conf','result_axis2.xml'), 'w') do |result|\n\t\tformatter.write(config, result)\n\t\tend\n\tend \n\tFile.delete(File.join(carbon_home , 'conf','axis2.xml'))\n\tFile.rename( File.join(carbon_home , 'conf','result_axis2.xml'),File.join(carbon_home , 'conf','axis2.xml') )\n\nend", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def update\n @serial.update(serial_params)\n render json: {success: \"true\", message: \"Series has been updated\", series: @serial}\n end", "def update\n gantt = Gantt.find_by(\"id\" => params[\"id\"])\n the_project_name = params[\"project_name\"]\n the_project_id = Project.find_by(\"project_name\" => the_project_name)\n\n gantt.update(\"gantt_url\" => params[\"url\"], \"project_id\" => the_project_id[\"id\"])\n redirect_to \"/admin\", :notice => \"Chart Updated\"\n end", "def update\n respond_to do |format|\n if @api_v1_canvas.update(api_v1_canvas_params)\n format.html do\n redirect_to @api_v1_canvas, notice: 'Canvas was successfully updated.'\n end\n\n format.json { render :show, status: :ok, location: @api_v1_canvas }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_canvas.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def create\n @travel_chart = Travel::Chart.new(params[:travel_chart])\n\n respond_to do |format|\n if @travel_chart.save\n format.html { redirect_to @travel_chart, notice: 'Travel chart was successfully created.' }\n format.json { render json: @travel_chart, status: :created, location: @travel_chart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @travel_chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tree_plot.update(tree_plot_params)\n # format.html { redirect_to @tree_plot, notice: 'Tree plot was successfully updated.' }\n format.html { redirect_to tree_plots_path, notice: 'Tree plot was successfully updated.' }\n format.json { render :show, status: :ok, location: @tree_plot }\n else\n format.html { render :edit }\n format.json { render json: @tree_plot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tick.update(tick_params)\n format.html { redirect_to @tick, notice: 'Tick was successfully updated.' }\n format.json { render :show, status: :ok, location: @tick }\n else\n format.html { render :edit }\n format.json { render json: @tick.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gauge_graph.update(gauge_graph_params)\n format.html { redirect_to edit_gauge_graph_path(@gauge_graph), notice: 'Gauge graph was successfully updated.' }\n format.json { render :edit, status: :ok, location: @gauge_graph }\n else\n format.html { render :edit }\n format.json { render json: @gauge_graph.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @timechart = Timechart.find(params[:id])\n @timechart.destroy\n\n respond_to do |format|\n format.html { redirect_to timecharts_url }\n format.json { head :no_content }\n end\n end", "def add_chart(chartType, upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn)\n begin\n if(@filename=='')\n raise \"Base file not specified\"\n end\n if(@worksheetname=='')\n raise \"Worksheet is not specified\"\n end\n str_uri = $productURI + \"/cells/\" + @filename + \"/worksheets/\" + @worksheetname + \"/charts?chartType=\" +\n chartType.to_s + \"&upperLeftRow=\" + upperLeftRow.to_s + \"&upperLeftColumn=\" +\n upperLeftColumn.to_s + \"&lowerRightRow=\" + lowerRightRow.to_s + \n \"&lowerRightColumn=\" + lowerRightColumn.to_s\n signed_uri = Common::Utils.sign(str_uri)\n \n response = RestClient.put signed_uri,'', {:accept => 'application/json'}\n v_output = Common::Utils.validate_output(response)\n if(v_output==nil || v_output=='')\n folder = SaasposeStorage::Folder.new\n outputstream = folder.getfile(@filename)\n outputstream\n outputpath = $OutPutLocation + @filename\n Common::Utils.saveFile(outputstream, outputpath)\n return \"Chart added\"\n else\n return v_output\n end\n rescue Exception=>e\n print e\n end\n end", "def chart=(v) DataTypeValidator.validate \"Series.chart\", Chart, v; @chart = v; end", "def update\n prep_dataset_form\n @dataset.update_attributes!(params[:dataset])\n publish_press_item(\"Dataset updated: #{@dataset.title}\") if attachments_updated?\n \n respond_to do |wants|\n flash[:notice] = 'Dataset was successfully updated.'\n wants.html { redirect_to(@dataset) }\n wants.xml { head :ok }\n end\n end", "def update\n @sensor = Sensor.find(params[:id])\n\n if @sensor.update(params[:sensor])\n head :no_content\n $redis.publish('sensors.update', { :name => @sensor.name, :value => @sensor.value, :id => @sensor.id}.to_json)\n else\n render json: @sensor.errors, status: :unprocessable_entity\n end\n end", "def update\n @graph_point = GraphPoint.find(params[:id])\n\n respond_to do |format|\n if @graph_point.update_attributes(params[:graph_point])\n format.html { redirect_to(@graph_point, :notice => 'Graph point was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => @graph_point }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @graph_point.errors, :status => :unprocessable_entity }\n format.json { render :json => @graph_point.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @serie = Serie.find(params[:id])\n\n respond_to do |format|\n if @serie.update_attributes(serie_params)\n format.html { redirect_to(@serie, :notice => 'Serie was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # raise(\"boobies!\")\n @dataset = Dataset.find(params[:id])\n # raise(params[:dataset][:dataset_variables_attributes][\"0\"].class.to_s)\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n flash[:notice] = 'Dataset was successfully updated.'\n format.html { redirect_to(@dataset) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_series\n @serie = Serie.find(params[:id])\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_visualization(params, id, space_id = \"\")\n update_saved_object(params, \"visualization\", id, space_id)\n end", "def update\n respond_to do |format|\n if @velocity.update(velocity_params)\n format.html { redirect_to @velocity.chart, notice: 'Velocity was successfully updated.' }\n format.json { render :show, status: :ok, location: @velocity.chart }\n else\n format.html { render :edit }\n format.json { render json: @velocity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n @product_series = ProductSeries.find(params[:id])\n\n respond_to do |format|\n if @product_series.update_attributes(params[:product_series])\n format.html { redirect_to [:admin, @product_series], notice: 'Product series was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series].merge({:version_attributes=>{},:thumbnail_attributes=>{:name=>params[:series][:name],:original_link=>params[:series][:thumbnail_link],:remote_image_url=>params[:series][:thumbnail_link]} }))\n format.html { redirect_to @series, :notice => 'Series was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @series.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@data_set = DataSet.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @data_set.update_attributes(params[:data_set])\n\t\t\t\tformat.html { redirect_to @data_set, notice: 'Data set was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @data_set.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @trace.import_points(points_data)\n @trace.reload\n\n render json: @trace\n end", "def update\n respond_to do |format|\n if @scale.update(scale_params)\n format.html { redirect_to scales_path, notice: 'Escala Atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @scale.errors, status: :unprocessable_entity }\n end\n end\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 destroy\n @chart.destroy\n respond_to do |format|\n format.html { redirect_to charts_path, notice: '削除しました' }\n format.json { head :no_content }\n end\n end" ]
[ "0.6449991", "0.6297368", "0.6296782", "0.62869847", "0.62565005", "0.60187995", "0.5938625", "0.58949643", "0.58259284", "0.5767014", "0.5705839", "0.5652434", "0.5622406", "0.55728036", "0.55679613", "0.55430096", "0.5536842", "0.55357033", "0.55357033", "0.55357033", "0.5521931", "0.5489947", "0.54565066", "0.544389", "0.544389", "0.54226273", "0.542187", "0.540725", "0.5398189", "0.5382123", "0.5350209", "0.5350209", "0.5350209", "0.5342219", "0.533973", "0.5323636", "0.52848977", "0.5259179", "0.525828", "0.5254877", "0.5254178", "0.52539486", "0.52388567", "0.52354205", "0.52326053", "0.5213658", "0.52080685", "0.5207554", "0.5184036", "0.5184036", "0.51795995", "0.51764303", "0.51748276", "0.5151951", "0.51347554", "0.51229495", "0.5118358", "0.51025075", "0.51004004", "0.5097091", "0.50957125", "0.5094603", "0.50821066", "0.5081026", "0.5080013", "0.50720847", "0.5065996", "0.5060841", "0.505216", "0.5043602", "0.5042285", "0.5033375", "0.5031101", "0.5022597", "0.50214505", "0.5001405", "0.5000355", "0.49970573", "0.4997018", "0.49941176", "0.49848488", "0.49839488", "0.49834955", "0.4981267", "0.49811718", "0.49783337", "0.49634686", "0.49475834", "0.4945681", "0.49450588", "0.49427402", "0.49407732", "0.49345213", "0.49230298", "0.49222067", "0.4916906", "0.4913049", "0.4912839" ]
0.6627718
2
DELETE /charts/1 DELETE /charts/1.xml
def destroy @chart = Chart.find(params[:id]) @chart.destroy respond_to do |format| format.html { redirect_to(:controller => "charts", :action => "area_chart") } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to(charts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.chartnodes.destroy_all\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to charts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chart.destroy\n respond_to do |format|\n format.html { redirect_to charts_path, notice: '削除しました' }\n format.json { head :no_content }\n end\n end", "def destroy\n# @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to charts_url }\n format.json { head :no_content }\n end\n end", "def delete_chart(chart_index)\n begin\n if(@filename=='')\n raise \"Base file not specified\"\n end\n if(@worksheetname=='')\n raise \"Worksheet is not specified\"\n end\n str_uri = $productURI + \"/cells/\" + @filename + \"/worksheets/\" + @worksheetname + \"/charts/\" + chart_index.to_s\n signed_uri = Common::Utils.sign(str_uri)\n \n response = RestClient.delete signed_uri, {:accept => 'application/json'}\n v_output = Common::Utils.validate_output(response)\n if(v_output==nil || v_output=='')\n folder = SaasposeStorage::Folder.new\n outputstream = folder.getfile(@filename)\n outputstream\n outputpath = $OutPutLocation + @filename\n Common::Utils.saveFile(outputstream, outputpath)\n return \"Chart deleted\"\n else\n return v_output\n end\n rescue Exception=>e\n print e\n end\n end", "def destroy\n @todolist_chart = TodolistChart.find(params[:id])\n @todolist_chart.destroy\n\n respond_to do |format|\n format.html { redirect_to(todolist_charts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.destroy\n respond_with(@chart)\n end", "def destroy\n @travel_chart = Travel::Chart.find(params[:id])\n @travel_chart.destroy\n\n respond_to do |format|\n format.html { redirect_to travel_charts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chart.destroy\n respond_to do |format|\n format.html { redirect_to charts_url, notice: 'Chart was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \t#chart = Chart.find(params[:chart_id])\n \tchart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n \tdata_set = chart.data_sets.find(params[:id])\n \tdata_set.destroy\n\n respond_with(data_set) do |format|\n format.json { render json: { success: data_set.destroyed? } }\n end\n end", "def destroy\n @timechart = Timechart.find(params[:id])\n @timechart.destroy\n\n respond_to do |format|\n format.html { redirect_to timecharts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @performance_chart.destroy\n respond_to do |format|\n format.html { redirect_to performance_charts_url, notice: 'Performance chart was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rescue_time_chart.destroy\n respond_to do |format|\n format.html { redirect_to rescue_time_charts_url }\n format.json { head :no_content }\n end\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 destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to datasets_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @axis.destroy\n respond_to do |format|\n format.html { redirect_to axes_url, notice: 'Axis was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataset.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(datasets_url) }\n wants.xml { head :ok }\n end\n end", "def delete_complete\n @todolist_chart = TodolistChart.find(:all, :conditions => {:status => \"completed\"})\n \n @todolist_chart.each do |todolist_chart|\n todolist_chart.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to(todolist_charts_url) }\n format.xml { head :ok }\n end\n end", "def delete\n result = Base.redis.hdel(:charts, name)\n if result == 1\n delete_all_inputs\n Log.info \"Deleting Chart object from Redis: #{name}\"\n else\n raise UnknownChart, \"Cannot delete non-existent Chart object in Redis: #{name}\"\n end\n result\n end", "def destroy\n DeleteMultiYearChart.call(\n engine_client,\n current_user.multi_year_charts.find(params.require(:id))\n )\n\n redirect_to multi_year_charts_path\n end", "def destroy\n @data_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_sets_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @connection.call('GRAPH.DELETE', @graphname)\n rescue Redis::CommandError => e\n raise DeleteError, e\n end", "def destroy\n @series = Series.find(params[:id])\n @series.destroy\n\n respond_to do |format|\n format.html { redirect_to(series_index_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end", "def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @bar_graph.destroy\n respond_to do |format|\n format.html { redirect_to bar_graphs_url, notice: 'Bar graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => :plan_chart }\n format.xml { head :ok }\n end\n end", "def destroy\n @predict_chart.destroy\n respond_to do |format|\n format.html { redirect_to predict_charts_url, notice: 'Predict chart was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n tempfio = @employee.fio\n chartsalary = tempfio + \" salary to pay\"\n @employee.destroy\n @chart_to_del = Chart.where(\"content = ?\",chartsalary)\n idstart = @chart_to_del.first.id\n idfinish = idstart + 5\n @charts_to_del = Chart.where(\"id >= ? and id <= ?\",idstart,idfinish)\n @charts_to_del.each do |d|\n d.destroy\n end\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @serie = Serie.find(params[:id])\n @serie.destroy\n\n respond_to do |format|\n format.html { redirect_to(series_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @graph.destroy\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @graph.destroy\n\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scale.destroy\n respond_to do |format|\n format.html { redirect_to scales_url }\n format.xml { head :ok }\n end\n end", "def destroy\n DeleteMultiYearChart.call(\n current_user.multi_year_charts.find(params.require(:id))\n )\n\n redirect_to multi_year_charts_path\n end", "def destroy\n @api_v1_graph.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_graphs_url, notice: 'Graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.get(params[:id])\n @ganglia_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to(ganglia_graphs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @graph_point = GraphPoint.find(params[:id])\n @graph_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(graph_points_url) }\n format.xml { head :ok }\n format.json { render :nothing => true }\n end\n end", "def destroy\n @diagramm = Diagramm.find(params[:id])\n @diagramm.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagramme_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image_dataset = ImageDataset.find(params[:id])\n @image_dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_datasets_url) }\n format.xml { head :ok }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @quartz = Quartz.find(params[:id])\n @quartz.destroy\n\n respond_to do |format|\n format.html { redirect_to(quartzs_url) }\n format.xml { head :ok }\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n @qx = Qx.find(params[:id])\n @qx.destroy\n\n respond_to do |format|\n format.html { redirect_to(qxes_url) }\n format.xml { 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\t\t@data_set = DataSet.find(params[:id])\n\t\t@data_set.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to data_sets_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "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 @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def destroy\n @page_title = \"Data Points\"\n @data_point = DataPoint.find(params[:id])\n @data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_points_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @graph = Graph.find(params[:id])\n @graph.destroy\n \n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Graph was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @dailyreport = Dailyreport.find(params[:id])\n @dailyreport.destroy\n\n respond_to do |format|\n format.html { redirect_to(dailyreports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @conditioninfograph = Conditioninfograph.find(params[:id])\n @conditioninfograph.destroy\n\n respond_to do |format|\n format.html { redirect_to conditioninfographs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @design_detail_data_point = DesignDetailDataPoint.find(params[:id])\n @design_detail_data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(design_detail_data_points_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n success = ActiveRecord::Base.transaction do\n @graph.destroy\n @graph = $mfclient.delete_graph(@graph.path) rescue nil\n end\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataset_datum.destroy\n respond_to do |format|\n format.html { redirect_to dataset_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @serialize = Serialize.find(params[:id])\n @serialize.destroy\n\n respond_to do |format|\n format.html { redirect_to(serializes_url) }\n format.xml { head :ok }\n end\n end", "def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend", "def destroy\n @charts_account.destroy\n end", "def destroy\n @series = Series.find(params[:id])\n @series.destroy\n\n respond_to do |format|\n format.html { redirect_to series_index_url }\n format.json { head :ok }\n end\n end", "def destroy\n @datashows = Datashow.find(params[:id])\n @datashows.destroy\n\n respond_to do |format|\n format.html { redirect_to(datashows_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @series = Series.find(params[:id])\n @series.destroy\n\n respond_to do |format|\n format.html { redirect_to series_index_url }\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 service_group_delete(a10, name)\n a10.send(:axapi, 'slb.service_group.delete', 'post', {name: name, format: 'json'})\nend", "def destroy\n @series.destroy\n respond_to do |format|\n format.html { redirect_to series_url }\n format.json { head :no_content }\n end\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\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()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @quay = Quay.find(params[:id])\n @quay.destroy\n\n respond_to do |format|\n format.html { redirect_to(quays_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @datapoint.destroy\n respond_to do |format|\n format.html { redirect_to datapoints_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @measurement = Measurement.find(params[:id])\n @measurement.destroy\n\n respond_to do |format|\n format.html { redirect_to(measurements_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tree_plot.destroy\n respond_to do |format|\n format.html { redirect_to tree_plots_url, notice: 'Tree plot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @clique = Clique.find(params[:id])\n @clique.destroy\n\n respond_to do |format|\n format.html { redirect_to(cliques_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @history.destroy\n\n respond_to do |format|\n format.html { redirect_to(histories_url, :notice => \"削除しました\") }\n format.xml { head :ok }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @svgpost = Svgpost.find(params[:id])\n @svgpost.destroy\n\n respond_to do |format|\n format.html { redirect_to svgposts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_statistic = DailyStatistic.find(params[:id])\n @daily_statistic.destroy\n\n head :no_content\n end", "def destroy\n @svg_file = Cmtool::SvgFile.find(params[:id])\n @svg_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(cmtool.svg_files_url, notice: I18n.t('cmtool.action.destroy.successful', model: Cmtool::SvgFile.model_name.human)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @server_group = ServerGroup.find(params[:id])\n xml=@server_group.to_xml\n json=@server_group.to_json\n @server_group.update_attribute('historical', true)\n\tAsyncExec.run_job(MakeGroupHistorical, @server_group.id)\n\n respond_to do |format|\n format.html { redirect_to(server_groups_url) }\n format.json { render :json => json }\n format.xml { render :xml => xml }\n end\n\n end", "def destroy\n @trace = Trace.find(params[:id])\n @trace.destroy\n\n respond_to do |format|\n format.html { redirect_to(traces_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cluster = Cluster.find(params[:id])\n @cluster.destroy\n\n respond_to do |format|\n format.html { redirect_to(clusters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @trace = Trace.find(params[:id])\n @trace.destroy\n\n respond_to do |format|\n format.html { redirect_to(traces_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset.destroy\n redirect_to datasets_url\n flash[:success] = \"Dataset was successfully deleted.\"\n end", "def destroy\n @indicator_set = IndicatorSet.find(params[:id])\n @indicator_set.destroy\n\n respond_to do |format|\n format.html { redirect_to indicator_sets_url }\n format.json { head :no_content }\n end\n end", "def delete()\n sql = \"DELETE FROM stock_items WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end", "def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end", "def destroy\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n @calidadtiposdocumento.destroy\n\n respond_to do |format|\n format.html { redirect_to(calidadtiposdocumentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @time_series.destroy\n\n respond_to do |format|\n format.html { redirect_to time_series_index_url(@owner), flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.time_series.one'))} }\n format.json { head :no_content }\n end\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end" ]
[ "0.7517604", "0.7406817", "0.70356894", "0.70292705", "0.70213526", "0.7007386", "0.6971715", "0.67867607", "0.67440975", "0.6674559", "0.66329294", "0.6537913", "0.6527878", "0.6490176", "0.6455502", "0.6455502", "0.64321643", "0.64310485", "0.6427718", "0.6420352", "0.640196", "0.6367754", "0.63627666", "0.63399965", "0.6319728", "0.63000363", "0.625268", "0.62524736", "0.6239642", "0.62371516", "0.6217664", "0.6206498", "0.6189317", "0.6172346", "0.61679703", "0.61644286", "0.6156515", "0.6154717", "0.6153925", "0.6151736", "0.6120734", "0.60858065", "0.6075869", "0.6031495", "0.60283333", "0.6022562", "0.60090584", "0.599798", "0.59847546", "0.59797186", "0.59785396", "0.5973015", "0.5963967", "0.59573907", "0.595102", "0.59480333", "0.59271175", "0.5921819", "0.5898201", "0.5896871", "0.58952653", "0.5883262", "0.5878327", "0.58767205", "0.5874683", "0.58695567", "0.5864776", "0.58636266", "0.58627725", "0.5861004", "0.5856411", "0.5856411", "0.5856411", "0.5856411", "0.5853532", "0.584905", "0.5843382", "0.5840012", "0.5838071", "0.5836827", "0.5836627", "0.5836028", "0.58343124", "0.5831315", "0.5828197", "0.582572", "0.58230525", "0.58226097", "0.5816879", "0.5816434", "0.581599", "0.5814127", "0.5810094", "0.58097446", "0.58056235", "0.5803106", "0.58007306", "0.5785581", "0.57794046", "0.57770556" ]
0.7183303
2
GET /welcome/home GET /welcome/home.xml
def home @page_title = "Spendy! Home" respond_to do |format| format.html # home.html.erb format.xml { head :ok } format.iphone do # home.iphone.erb @panel_title = @page_title render :layout => false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homepage\n get '/Pages/Default.aspx'\n end", "def info\n get '/'\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @welcome_images }\n end\n end", "def root\n get \"/\"\n end", "def root\n get \"/\"\n end", "def root\n get '/'\n end", "def index\n name = @xml.elements['/name'].text\n @sentence = \"Hello #{name} !\"\n render_xml\n end", "def list\n get('/')\n end", "def homepage\n end", "def homepage\n end", "def show\n @welcome = Welcome.find(params[:id])\n # render :layout => 'admin'\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @welcome }\n end\n end", "def index\n @tutorials = Tutorial.all\n @title = \"A collection of Ruby on Rails tutorials\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tutorials }\n end\n end", "def show\n @homepage = Homepage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @homepage }\n end\n end", "def home\n\t\t# Home Page\n\tend", "def homepage\n end", "def homepage\n end", "def GET; end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @welcome_image }\n end\n end", "def url_home\n\tvisit url_visit\n end", "def index\n\t\trender 'home'\n\tend", "def home\n respond_to do |format|\n format.html { render :home }\n end\n end", "def about\n respond_to do |format|\n format.html # about.html.erb\n format.xml { render :xml => nil }\n end\n end", "def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json { render :json => @hikiyamas }\n end\n end", "def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => \"\" }\n end\n end", "def index\n @node = Fedora.rest('rest/')\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n\t\t\n\tend", "def home\n\t\t\n\tend", "def home \n\tend", "def home\n\tend", "def show\n @haiku = Haiku.find(params[:id])\n\n respond_to { |format|\n format.html # show.rhtml\n format.xml {\n\trender :xml => @haiku.to_xml\n }\n }\n end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def index\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def home\n respond_to do |format|\n format.html #home.erb.html \n end\n end", "def root; get(\"\"); end", "def new\n @homepage = Homepage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @homepage }\n end\n end", "def index\n headers['Content-Type'] = 'application/xml'\n @routes = website_routes + @opportunity_routes\n @blog_sitemap_route = buttercms_blog_sitemap_url\n end", "def homepage(request)\n \"#{request.protocol}#{request.host}:#{request.port}\"\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def index\n @helibases = Helibase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @helibases }\n end\n end", "def index\n @servers = Server.beating\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @servers }\n end\n end", "def home\n\n end", "def home\n\n end", "def home\n\n end", "def home\n\n end", "def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend", "def index\n @welcome_pages = WelcomePage.all\n end", "def show\n @home_controller = HomeController.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @home_controller }\n end\n end", "def index\n @ganhos = Ganho.find_by_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganhos }\n end\n end", "def home\nend", "def handle_GET(initial)\n\trequest_path = get_Path(initial)\n\trequest_path = request_path[1..-1] if request_path[0] == '/'\n\tif File.exist?(request_path)\n\t\tcreate_Found_Response(request_path)\n\telse\n\t\tcreate_Not_Found_Response(request_path)\n\tend\nend", "def show\n @iq_home = IQHome.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @iq_home }\n end\n end", "def welcome\n # show welcome\n end", "def home\r\n \r\n end", "def welcome\r\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @directories }\n end\n end", "def index\n @tutorials = Tutorials.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tutorials }\n end\n end", "def index\r\n @homes = Home.find(:all)\r\n render :back => '/app'\r\n end", "def index\n#\t\t@pages = Page.find(:all)\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml\t{ render :xml => @pages }\n\t\tend\n\tend", "def index\n @users = User.all\n render :xml => @users\n end", "def welcome\n\tend" ]
[ "0.65853876", "0.6351047", "0.6247749", "0.61689335", "0.61689335", "0.6157365", "0.614441", "0.60804194", "0.6058407", "0.6058407", "0.6019937", "0.5999139", "0.5997893", "0.599277", "0.59579474", "0.59579474", "0.5949235", "0.5944733", "0.5912214", "0.5902114", "0.5885626", "0.5877711", "0.58712864", "0.5839893", "0.58334625", "0.5825043", "0.58230597", "0.58230597", "0.58230597", "0.58230597", "0.58211285", "0.58211285", "0.58181036", "0.5813817", "0.5811817", "0.57920825", "0.5790775", "0.5781795", "0.57655615", "0.57566345", "0.57432735", "0.5733393", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.5725303", "0.57175535", "0.5713463", "0.5712217", "0.5712217", "0.5712217", "0.5712217", "0.57102245", "0.57032657", "0.57023525", "0.5697809", "0.5696249", "0.5689176", "0.5687034", "0.56728077", "0.56604725", "0.56497014", "0.5641753", "0.56415784", "0.5625656", "0.56209105", "0.5612985", "0.55984116" ]
0.0
-1
Creates a connection manager with an empty set of connections. This class is intended to be used as a singleton, so use the `instance` class method instead.
def initialize # This hash stores the connections that have already been created. The keys of the hash will be the # identifiers of the EMSs, and the values will be instances of the `Entry` class. @registry = {} # Load from the configuration the settings that control how often we purge connections that correspond to # EMSs that no longer exist: @purge_interval = settings.purge_interval.to_i_with_method @purge_time = Time.current # Make sure that all connections will be closed when the process finishes: at_exit do $rhevm_log.info("Closing all connections before exit.") clear end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_connection_manager\n ThreadSafeClientConnManager.new( @mparams, @scheme_registry )\n end", "def empty_connection_pools!; end", "def initialize\n bootstrap_connections unless File.exist?(connections_file)\n load_connections\n end", "def connections\n @connections ||= []\n end", "def connections\n @connections ||= {}\n end", "def create_connection_manager(ds)\n end", "def connections\n @_connections ||= {}\n end", "def connection_manager\n @connection_manager ||= TOAMQP::ConnectionManager.new\n end", "def connections\n @connections ||= {}\n end", "def initialize(conn = nil)\n self.conn = conn || self.class.default_conn\n end", "def empty_connection_pools!\n Seahorse::Client::NetHttp::ConnectionPool.pools.each do |pool|\n pool.empty!\n end\n end", "def setup\n return unless connection_pool_enabled?\n\n @connection_pool = ::Queue.new\n\n start_pool_size.times { @connection_pool.push(new_client) }\n\n @created_connections = start_pool_size\n end", "def initialize(config = {})\n @connection = nil\n init_config(config)\n end", "def connection_manager\n @manager ||= (connection_base? ? Redis::ConnectionManager.new(@connection_specification) : superclass.connection_manager)\n end", "def grab_connections\n connections = []\n connections << @host\n end", "def clear_active_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:release_connection)\n end", "def initialize(opts)\n super()\n\n connection_opts = opts.dup\n @checkout_timeout = opts.delete(:checkout_timeout) || 5\n @size = opts.delete(:pool) || 5\n @auto_connect = opts.delete(:auto_connect) || true\n\n @connection_options = connection_opts\n\n # The cache of reserved connections mapped to threads\n @reserved_connections = ThreadSafe::Cache.new(initial_capacity: @size)\n\n @connections = []\n\n @available = Queue.new self\n end", "def connection\n @connection ||= Connection.new(nil)\n end", "def initialize\n @starling_urls = Workling::Starling.config[:listens_on].split(',').map { |url| url ? url.strip : url }\n options = [@starling_urls, Workling::Starling.config[:memcache_options]].compact\n @connection = ::MemCache.new(*options)\n \n raise_unless_connected!\n end", "def initialize\r\n @connection = nil\r\n end", "def connect\n Connection.new\n end", "def connection\n @connection ||= make_connection\n end", "def connections\n @connection_pool\n end", "def connection_pool(options = {}, &block)\n options = valid_options.merge(options)\n initialize_connection_pool(options) unless defined?(@connection_pool)\n\n if block_given?\n @connection_pool.with(&block)\n else\n @connection_pool\n end\n end", "def redis_connections\n @redis_connections ||= Stockpile::RedisConnectionsFactory.build_connections\n end", "def all_active_connections\n super\n end", "def __build_connections\n Connections::Collection.new \\\n :connections => hosts.map { |host|\n host[:protocol] = host[:scheme] || DEFAULT_PROTOCOL\n host[:port] ||= DEFAULT_PORT\n\n client = ::Curl::Easy.new\n client.headers = {'User-Agent' => \"Curb #{Curl::CURB_VERSION}\"}\n client.url = __full_url(host)\n\n if host[:user]\n client.http_auth_types = host[:auth_type] || :basic\n client.username = host[:user]\n client.password = host[:password]\n end\n\n client.instance_eval &@block if @block\n\n Connections::Connection.new :host => host, :connection => client\n },\n :selector_class => options[:selector_class],\n :selector => options[:selector]\n end", "def initialize(opts = {}, &block)\n @opts = opts\n \n # Determine if the DB is single threaded or multi threaded\n @single_threaded = opts[:single_threaded] || @@single_threaded\n # Construct pool\n if @single_threaded\n @pool = SingleThreadedPool.new(&block)\n else\n @pool = ConnectionPool.new(opts[:max_connections] || 4, &block)\n end\n @pool.connection_proc = block || proc {connect}\n\n @logger = opts[:logger]\n ::Sequel::DATABASES.push(self)\n end", "def initialize(options = {}, &block)\n @connections, @busy_connections, @queue = [], {},[]\n @connection_proc = block\n @size = options[:size] || 8\n if options[:eager]\n @size.times do\n @connections << @connection_proc.call\n end\n end\n end", "def connection\n @connection = create_connection! unless connected?\n @connection\n end", "def establish_connections\n klass = Struct.new(:ip,:port)\n if t_servers = BackgrounDRb::BDRB_CONFIG[:client]\n connections = t_servers.split(',')\n connections.each do |conn_string|\n ip = conn_string.split(':')[0]\n port = conn_string.split(':')[1].to_i\n @bdrb_servers << klass.new(ip,port)\n end\n end\n @bdrb_servers << klass.new(BackgrounDRb::BDRB_CONFIG[:backgroundrb][:ip],BackgrounDRb::BDRB_CONFIG[:backgroundrb][:port].to_i)\n @bdrb_servers.each_with_index do |connection_info,index|\n next if @backend_connections.detect { |x| x.server_info == \"#{connection_info.ip}:#{connection_info.port}\" }\n @backend_connections << Connection.new(connection_info.ip,connection_info.port,self)\n end\n end", "def connections\n connections = @mutex.synchronize { connections = @connections.dup }\n connections.delete_if { |c| c.kind_of?(Thread) }\n connections.freeze\n connections\n end", "def initialize(options={})\n @connection = Connection.new(options)\n end", "def initialize(*args)\n # FIXME symbolify\n @connect_args = args[0]\n @connected = true\n @mutex = Mutex.new\n @in_transaction = 0\n self.open_statements = []\n end", "def new_connection; end", "def connect\n @connection_manager.connect\n return self\n end", "def preconnect(concurrent = false)\n enum = (max_size - _size).times\n\n conns = if concurrent\n enum.map{Thread.new{make_new(:default)}}.map(&:value)\n else\n enum.map{make_new(:default)}\n end\n\n sync{conns.each{|conn| checkin_connection(conn)}}\n end", "def db_conn\n @db_conn_pool ||= ConnectionPool.new(size: 4, timeout: 2) do\n Mysql2::Client.new(self.db_settings)\n end\n end", "def initialize(db, opts = OPTS)\n super\n @max_size = Integer(opts[:max_connections] || 4)\n raise(Sequel::Error, ':max_connections must be positive') if @max_size < 1\n @mutex = Mutex.new \n @connection_handling = opts[:connection_handling]\n @available_connections = []\n @allocated = {}\n @allocated.compare_by_identity\n @timeout = Float(opts[:pool_timeout] || 5)\n @waiter = ConditionVariable.new\n end", "def init(size)\n conn = []\n size.times do\n conn << []\n end\n return conn\nend", "def initialize(address=nil)\n @connection = Connection.new(address)\n end", "def remote_connections\n @remote_connections || @mutex.synchronize { @remote_connections ||= RemoteConnections.new(self) }\n end", "def connection_pool_default_options\n o = super.dup\n # Default to only a single connection if a memory database is used,\n # because otherwise each connection will get a separate database\n o[:max_connections] = 1 if @opts[:database] == ':memory:' || blank_object?(@opts[:database])\n o\n end", "def connect\n @connection_pool.get_connection\n end", "def initialize(opts = {}, &block)\n @opts = opts\n \n @quote_identifiers = opts[:quote_identifiers] || @@quote_identifiers\n @single_threaded = opts[:single_threaded] || @@single_threaded\n @schemas = nil\n @pool = (@single_threaded ? SingleThreadedPool : ConnectionPool).new(connection_pool_default_options.merge(opts), &block)\n @pool.connection_proc = proc {connect} unless block\n\n @loggers = Array(opts[:logger]) + Array(opts[:loggers])\n ::Sequel::DATABASES.push(self)\n end", "def connection\n @connection || Connection.new\n end", "def initialize(db, opts = OPTS)\n super\n @max_size = Integer(opts[:max_connections] || 4)\n raise(Sequel::Error, ':max_connections must be positive') if @max_size < 1\n @mutex = Mutex.new \n # Size inside array so this still works while the pool is frozen.\n @size = [0]\n @allocated = {}\n @allocated.compare_by_identity\n @timeout = Float(opts[:pool_timeout] || 5)\n @queue = Queue.new\n end", "def all_connections\n hold do |c|\n sync do\n yield c\n @available_connections.each{|conn| yield conn}\n end\n end\n end", "def all_connections\n hold do |c|\n sync do\n yield c\n @available_connections.each{|conn| yield conn}\n end\n end\n end", "def clear\n connections.synchronize do\n connections.map(&:last).each(&closer)\n connections.clear\n end\n end", "def connections\n @mutex.synchronize do\n @connections.values.inject(0, &:+)\n end\n end", "def connection(options={})\n raise NoToken if @token.to_s.empty?\n\n @connections ||= {}\n\n cached_connection? && !protocol_changed? ? cached_connection : new_connection\n end", "def clear_active_connections!\n clear_cache!(@@active_connections) do |name, conn|\n conn.disconnect!\n end\n end", "def bootstrap_connections\n FileUtils.touch(connections_file)\n end", "def all_connections\n yield @conn.first if @conn\n end", "def initialize(missed_connections_hash)\n missed_connections_hash.each {|k,v| self.send(\"#{k}=\",v)}\n @@all << self\n end", "def redis_pool\n @redis ||= Redlics::Connection.create(config.to_h)\n end", "def connect\n @connection.create\n end", "def connection\n @connection ||= build_connection\n end", "def __build_connections\n region = options[:region]\n access_key_id = options[:aws_access_key_id] || nil\n secret_access_key = options[:aws_secret_access_key] || nil\n session_token = options[:session_token] || nil\n profile = options[:profile] || 'default'\n instance_cred_retries = options[:instance_profile_credentials_retries] || 0\n instance_cred_timeout = options[:instance_profile_credentials_timeout] || 1\n \n credential_config = CredentialConfig.new(access_key_id, secret_access_key, session_token, profile,\n instance_cred_retries, instance_cred_timeout, region)\n credentials = Aws::CredentialProviderChain.new(credential_config).resolve\n\n Connections::Collection.new \\\n :connections => hosts.map { |host|\n host[:protocol] = host[:scheme] || DEFAULT_PROTOCOL\n host[:port] ||= DEFAULT_PORT\n url = __full_url(host)\n \n aes_connection = ::Faraday::Connection.new(url, (options[:transport_options] || {})) do |faraday|\n faraday.request :aws_v4_signer,\n credentials: credentials,\n service_name: 'es',\n region: region\n faraday.adapter :manticore\n end\n \n Connections::Connection.new \\\n :host => host,\n :connection => aes_connection\n },\n :selector_class => options[:selector_class],\n :selector => options[:selector]\n end", "def manager\n @manager ||= FastlyNsq::Manager.new\n end", "def initialize(options={})\n @multi_message_max_count = 0\n \n self.host = options[:host] || DEFAULT_HOST\n self.port = options[:port] || DEFAULT_PORT\n end", "def create_pool(node)\n ConnectionPool.new(\n size: node.options[:pool_size] || POOL_SIZE,\n timeout: node.options[:pool_timeout] || TIMEOUT\n ) do\n Connection.new(\n node.address.ip,\n node.address.port,\n node.options[:timeout] || Connection::TIMEOUT,\n node.options\n )\n end\n end", "def clear_reloadable_connections!\n synchronize do\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n end\n\n @connections.delete_if(&:finished?)\n\n @available.clear\n @connections.each do |conn|\n @available.add conn\n end\n end\n end", "def conn()\n @@connections ||= {}\n\n config = env_config\n\n thrift_client_options = {:timeout => RightSupport::DB::CassandraModel::DEFAULT_TIMEOUT}\n thrift_client_options.merge!({:protocol => Thrift::BinaryProtocolAccelerated})\\\n if defined? Thrift::BinaryProtocolAccelerated\n\n @@connections[self.keyspace] ||= Cassandra.new(self.keyspace, config[\"server\"], thrift_client_options)\n @@connections[self.keyspace].disable_node_auto_discovery!\n @@connections[self.keyspace]\n end", "def initialize\n @clients = {}\n @beanstalk_servers = []\n BeanCounter.beanstalkd_url.each do |url|\n server = GemeraldBeanstalk::Server.new(*parse_url(url))\n @clients[server.beanstalk] = server.beanstalk.direct_connection_client\n @beanstalk_servers << server\n end\n end", "def initialize_pools(members)\n members.each do |member|\n @hosts << member.host_string\n\n if member.primary?\n @primary = member.host_port\n @primary_pool = Pool.new(self.connection, member.host, member.port,\n :size => self.connection.pool_size,\n :timeout => self.connection.connect_timeout,\n :node => member)\n elsif member.secondary? && !@secondaries.include?(member.host_port)\n @secondaries << member.host_port\n @secondary_pools << Pool.new(self.connection, member.host, member.port,\n :size => self.connection.pool_size,\n :timeout => self.connection.connect_timeout,\n :node => member)\n end\n end\n\n @max_bson_size = members.first.config['maxBsonObjectSize'] ||\n Mongo::DEFAULT_MAX_BSON_SIZE\n @arbiters = members.first.arbiters\n choose_read_pool\n end", "def conn\n\t\treturn @conn ||= self.connect\n\tend", "def new(*args)\n my = self.init\n my.connect(*args)\n end", "def initialize opts = {}\n\t\t\t\t# Set defaults\n\t\t\t\topts[:port] = 5643 unless opts.has_key? :port\n\n\t\t\t\t# Define default instance variables\n\t\t\t\t@workers = []\n\t\t\t\t@queue = Queue.new\n\n\t\t\t\t# Open server\n\t\t\t\t@server = TCPServer.open opts[:port]\n\n\t\t\t\t# Create thread to accept connections\n\t\t\t\tThread.start do \n\t\t\t\t\tclient = @server.accept\n\t\t\t\t\tworkerConnection = WorkerConnection.new self, client\n\t\t\t\t\t@workers.push workerConnection\n\t\t\t\tend\n\t\t\tend", "def delete_all_active_connections\n super\n end", "def managed_connections\n @@managed_connections\n end", "def create_connection\n self.setup\n RfmAdaptor::Connection.new(self.server_name)\n end", "def connection_for host, options = {}, &block\n connection = Connection.new(self, host, options)\n yield(connection) if block_given?\n connection\n end", "def initialize\n @clients = []\n end", "def configure\n yield self\n\n pool_size = 5\n host = @host.nil? ? 'minfraud.maxmind.com' : @host\n @connection_pool = ConnectionPool.new(size: pool_size) do\n make_http_client.persistent(\"https://#{host}\")\n end\n end", "def connection_pool_default_options\n {}\n end", "def redis_connection_pool\n @redis_connection_pool ||= Stockpile::RedisConnection.connection_pool\n end", "def clear_reloadable_connections!\n @reserved_connections.each do |name, conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect! if conn.requires_reloading?\n end\n @connections = []\n end", "def connect\n @connection_manager.connect\n end", "def initialize(\n connection_pool: Rails.configuration.redis_pool\n )\n @connection_pool = connection_pool\n end", "def connect\n @redis ||= create\n end", "def initialize(opts = {})\n @storage = opts[:storage]\n # Conn must respond to #send\n @conn = opts[:conn]\n @subscriptions = []\n end", "def connect_if_connection_initialized\n connection.connect if connection.initialized?\n end", "def initialize(opts = {})\n @config = DEFAULTS.merge(opts)\n @buffer = Buffer.new\n @mutex = Mutex.new\n reconnect!\n end", "def initialize(config=nil)\n @clients = Array.new\n if !config.nil?\n apply_grip_config(config)\n end\n end", "def initialize\n @connector=ConnectionManager.instance\n @connector.add_observer(self)\n end", "def conn\n @conn ||= connect\n if block_given?\n yield @conn\n else\n @conn\n end\n rescue *HttpExceptions\n @conn = connect\n return if defined?(once)\n once = true && retry\n end", "def initialize(*servers)\n @servers = parse_servers(servers)\n set_current_server\n @mutex = Mutex.new\n connect\n end", "def pool\n pool_connection = ConnectionPool.new(size: 10, timeout: 5) do \n Redis.new :db=> redis_db_index, :password=> redis_instance.password, :host=> redis_instance.host, :port=> redis_instance.port\n end \n return pool_connection \n end", "def initialize(options={})\n @server_list = ServerList.new\n @groups = Hash.new { |h,k| h[k] = ServerList.new }\n @gateway = nil\n @open_groups = []\n @connect_threads = []\n @on_error = :fail\n @default_user = ENV['USER'] || ENV['USERNAME'] || \"unknown\"\n\n @open_connections = 0\n @pending_sessions = []\n @session_mutex = Mutex.new\n\n options.each { |opt, value| send(\"#{opt}=\", value) }\n end", "def conn()\n @@connections ||= {}\n\n # TODO remove hidden dependency on ENV['RACK_ENV'] (maybe require config= to accept a sub hash?)\n config = @@config[ENV[\"RACK_ENV\"]]\n raise MissingConfiguration, \"CassandraModel config is missing a '#{ENV['RACK_ENV']}' section\" unless config\n\n thrift_client_options = {:timeout => RightSupport::DB::CassandraModel::DEFAULT_TIMEOUT}\n thrift_client_options.merge!({:protocol => Thrift::BinaryProtocolAccelerated})\\\n if defined? Thrift::BinaryProtocolAccelerated\n\n @@connections[self.keyspace] ||= Cassandra.new(self.keyspace, config[\"server\"], thrift_client_options)\n @@connections[self.keyspace].disable_node_auto_discovery!\n @@connections[self.keyspace]\n end", "def initialize(url: nil, connection: nil, concurrency: 1, confirms: false, mandatory: false)\n url_or_connection = url || connection\n self.connect(url_or_connection) if url_or_connection\n\n @confirms = confirms\n @mandatory = mandatory\n @publish_timeout = 5\n @shutdown_timeout = 15\n\n @handlers = {}\n @handler_pool = Concurrent::FixedThreadPool.new concurrency\n @consumers = []\n\n self.class.default_server ||= self\n end", "def clear_reloadable_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:clear_reloadable_connections!)\n end", "def all_connections\n hold do |conn|\n yield conn\n\n # Use a hash to record all connections already seen. As soon as we\n # come across a connection we've already seen, we stop the loop.\n conns = {}\n conns.compare_by_identity\n while true\n conn = nil\n begin\n break unless (conn = @queue.pop(timeout: 0)) && !conns[conn]\n conns[conn] = true\n yield conn\n ensure\n @queue.push(conn) if conn\n end\n end\n end\n end", "def connection\n Connection.new(conn_spec)\n end", "def initialize\n @status = {}\n @last_update = nil\n @server_status = Overwatch::ServerStatus.new skip_query: true\n @mutex = Mutex.new\n\n populate_servers\n end", "def connection\n Connection.new(conn_spec)\n end", "def clear_reloadable_connections!\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n conn.disconnect! if conn.requires_reloading?\n end\n @connections.delete_if do |conn|\n conn.requires_reloading?\n end\n @available.clear\n @connections.each do |conn|\n @available.add conn\n end\n end", "def default_connections(opts = {})\n data, _status_code, _headers = default_connections_with_http_info(opts)\n data\n end", "def make_dbconnection_instance(schezer)\n schezer.instance_eval do\n return @conn.dup\n end\n end" ]
[ "0.68826705", "0.6653651", "0.6432107", "0.6380911", "0.62814766", "0.6249917", "0.6229978", "0.6208591", "0.6195679", "0.6056034", "0.60286254", "0.59706455", "0.5960879", "0.59563905", "0.5942803", "0.5937572", "0.5929709", "0.58996505", "0.5872333", "0.583394", "0.5832141", "0.577947", "0.5758632", "0.5732153", "0.5709738", "0.57020354", "0.56884474", "0.56758386", "0.56589025", "0.56484437", "0.5643357", "0.5639787", "0.5634747", "0.56082493", "0.5588594", "0.55821896", "0.5532554", "0.5532102", "0.5528749", "0.5518537", "0.5509888", "0.5499454", "0.5498318", "0.5490421", "0.54890126", "0.54820335", "0.5476768", "0.5457281", "0.5457281", "0.54542816", "0.5442212", "0.5436722", "0.5435233", "0.5432913", "0.5422489", "0.54154676", "0.541131", "0.5400558", "0.5393072", "0.53858286", "0.5365645", "0.53607386", "0.53560936", "0.5346464", "0.5344083", "0.53416646", "0.5334407", "0.53235257", "0.5321246", "0.5318307", "0.5312513", "0.53095907", "0.5301942", "0.5301235", "0.52932286", "0.52910477", "0.5290027", "0.5285967", "0.52857107", "0.52846205", "0.5282124", "0.52533805", "0.52466923", "0.5244103", "0.5221908", "0.52212924", "0.52148056", "0.52141315", "0.5213858", "0.5202848", "0.5195839", "0.5190434", "0.51903707", "0.5167726", "0.5162523", "0.5161363", "0.5153405", "0.51480407", "0.51449656", "0.51435494", "0.51378137" ]
0.0
-1
Returns the connection that corresponds to the given EMS identifier and options. The connection will be created if doesn't exist yet. If the connection already exists, but the given options are different to the options that were used to create it, then it will be closed and created again. This is intended to support updates to the credentials, for example changes of user names or passwords.
def get(id, opts) # Purge connections if needed: purge if purge? # Find the entry for the given id and return it if the options are compatible: entry = @registry[id] return entry.connection if entry && entry.compatible?(opts) # If there is an entry but it isn't compatible, then close and remove it: if entry $rhevm_log.info( "Existing connection for EMS with identifier '#{id}' and URL '#{entry.options[:url]}' isn't compatible " \ "with the requested options, will close it and create a new one." ) close(id) end # At this point we know that either there was no connection or else it needs to be created again: $rhevm_log.info("Creating new connection for EMS with identifier '#{id}' and URL '#{opts[:url]}'.") connection = OvirtSDK4::Connection.new(opts) entry = Entry.new(opts, connection) @registry[id] = entry # Return the new connection: connection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection(options={})\n raise NoToken if @token.to_s.empty?\n\n @connections ||= {}\n\n cached_connection? && !protocol_changed? ? cached_connection : new_connection\n end", "def create_new_connection(options, &block)\n if @connection\n logger.debug(\"[WinRM] shutting previous connection #{@connection}\")\n @connection.close\n end\n\n @connection_options = options\n @connection = Kitchen::Transport::Winrm::Connection.new(options, &block)\n end", "def mongodb_connection(options={}, &block)\n return @mongodb_conncetion if @mongodb_connection and !block_given?\n options.stringify_keys!\n options['adapter'] ||= 'mongodb'\n @mongodb_connection = no_sql_connection(options, &block)\n end", "def new_db(options = {})\n cached = find_cached(options)\n return cached if cached && !options[:force_new]\n @cache[options] = ConnectionMaker.new(options).connection\n end", "def create_new_connection(options, &block)\n if defined?(@connection)\n logger.debug(\"[SSH] shutting previous connection #{@connection}\")\n @connection.close\n end\n\n @connection_options = options\n conn = Connection.new(options, &block)\n\n # Cisco IOS requires a special implementation of `Net:SSH`. This uses the\n # SSH transport to identify the platform, but then replaces SSHConnection\n # with a CiscoIOSConnection in order to behave as expected for the user.\n if defined?(conn.platform.cisco_ios?) && conn.platform.cisco_ios?\n ios_options = {}\n ios_options[:host] = @options[:host]\n ios_options[:user] = @options[:user]\n # The enable password is used to elevate privileges on Cisco devices\n # We will also support the sudo password field for the same purpose\n # for the interim. # TODO\n ios_options[:enable_password] = @options[:enable_password] || @options[:sudo_password]\n ios_options[:logger] = @options[:logger]\n ios_options.merge!(@connection_options)\n conn = CiscoIOSConnection.new(ios_options)\n end\n\n @connection = conn unless conn.nil?\n end", "def connection\n connection_id = current_connection_id\n unless conn = @reserved_connections.fetch(connection_id, nil)\n synchronize do\n conn = ( @reserved_connections[connection_id] ||= checkout )\n end\n end\n conn\n end", "def create_new_connection(options, &block)\n if @connection\n logger.debug(\"[Dokken] shutting previous connection #{@connection}\")\n @connection.close\n end\n\n @connection = Kitchen::Transport::Dokken::Connection.new(options, &block)\n end", "def connection\n if conn = @reserved_connections[current_connection_id]\n conn\n else\n @reserved_connections[current_connection_id] = checkout\n end\n end", "def connect(options=nil, second_options=nil, third_options={})\n if options.is_a? Hash\n fail 'You have to provide login and password' if ((options[:login].nil? || options[:login].empty?) && (options[:password].nil? || options[:password].empty?))\n threaded[:connection] = Connection.new(options[:login], options[:password], options)\n GoodData.project = options[:project] if options[:project]\n elsif options.is_a?(String) && second_options.is_a?(String)\n fail 'You have to provide login and password' if ((options.nil? || options.empty?) && (second_options.nil? || second_options.empty?))\n threaded[:connection] = Connection.new(options, second_options, third_options)\n end\n\n return threaded[:connection]\n end", "def connect(options = {})\n conn = self.connection(options[:handler])\n conn.container = self.container_id || generate_uuid\n connector = Connector.new(conn)\n conn.overrides = connector\n if !options[:url].nil?\n connector.address = URLs.new([options[:url]])\n elsif !options[:urls].nil?\n connector.address = URLs.new(options[:urls])\n elsif !options[:address].nil?\n connector.address = URLs.new([Qpid::Proton::URL.new(options[:address])])\n else\n raise ::ArgumentError.new(\"either :url or :urls or :address required\")\n end\n\n connector.heartbeat = options[:heartbeat] if !options[:heartbeat].nil?\n if !options[:reconnect].nil?\n connector.reconnect = options[:reconnect]\n else\n connector.reconnect = Backoff.new()\n end\n\n connector.ssl_domain = SessionPerConnection.new # TODO seems this should be configurable\n\n conn.open\n\n return conn\n end", "def db_connect\n database_connect_options = @options['database']\n db_connector = DatabaseConnector.new(database_connect_options)\n return db_connector.client\n end", "def establish_connection(database_url_or_options = {}, options = {})\n\n case database_url_or_options\n when String\n uri = URI.parse(database_url_or_options)\n @table_name = options.fetch(:table_name, \"application_cache\").freeze\n @pg = PG::Connection.new(\n host: uri.host,\n port: uri.port,\n user: uri.user,\n password: uri.password,\n dbname: uri.path.tr(\"/\",\"\"),\n sslmode: \"prefer\",\n )\n else\n @table_name = database_url_or_options.fetch(:table_name, \"application_cache\").freeze\n @pg = PG::Connection.new(\n host: database_url_or_options[:host],\n port: database_url_or_options[:port],\n user: database_url_or_options[:username],\n password: database_url_or_options[:password],\n dbname: database_url_or_options[:database],\n sslmode: \"prefer\",\n )\n end\n\n end", "def create_new_connection(options, &block)\n cleanup!\n @connection_options = options\n @connection = Kitchen::Transport::Ssh::Connection.new(options, &block)\n end", "def connection(options = {})\n\n options = self.connection_options(options)\n \n if @connection_options != options\n @connection = nil\n @connection_options = options\n end\n\n @connection ||= Faraday.new(@connection_options.merge(:builder => self.stack))\n end", "def connection\n if defined?(@active_connection_name) && (conn = active_connections[@active_connection_name])\n conn\n else\n # retrieve_connection sets the cache key.\n conn = retrieve_connection\n active_connections[@active_connection_name] = conn\n end\n end", "def generate_redis_connection!\n redis_options ? Redis.new(**redis_options) : Redis.current\n end", "def connection(options = {})\n @connection ||= Net::SSH::Connection::Session.new(transport(options), options)\n end", "def establish_connection(options = {}) # :yields: current_context\r\n\t\t\t establish_connection!(options)\r\n\t\t\t if (block_given?)\r\n \t\t\t\t begin \r\n \t\t\t\t return yield\r\n \t\t\t\t ensure\r\n \t\t\t\t @connections.pop() if connected?\r\n \t\t\t\t end\r\n \t\t\t\tend\r\n\t\t\t\tend", "def connection\n self.class.connection[id] unless new_record?\n end", "def get_db_connection\n config = read_database_config\n if config.dig(:adapter) == 'postgresql'\n config[:user] = config.delete(:username) if config[:username]\n config[:dbname] = config.delete(:database) if config[:database]\n config.delete(:adapter)\n valid_param_keys = PG::Connection.conndefaults_hash.keys + [:requiressl]\n config.slice!(*valid_param_keys)\n @db ||= PG::Connection.new(config)\n elsif config.dig(:adapter) == 'mysql2'\n @db ||= Mysql2::Client.new(config)\n else\n @db ||= SQLite3::Database.open(\"spectacles-#{Rails.env}.db\")\n end\n end", "def connect(options = {})\n return @pool = options[:pool] if options[:pool]\n options = options.dup\n timeout = options.delete(:timeout) || 5\n pool_size = options.delete(:pool_size) || 1\n @pool = Squirm::Pool.new(timeout)\n pool_size.times do\n conn = PG::Connection.open(options)\n yield conn if block_given?\n @pool.checkin conn\n end\n end", "def connection_pool(options = {}, &block)\n options = valid_options.merge(options)\n initialize_connection_pool(options) unless defined?(@connection_pool)\n\n if block_given?\n @connection_pool.with(&block)\n else\n @connection_pool\n end\n end", "def connection\n @reserved_connections[current_connection_id] ||= checkout\n end", "def get_connection(config, &connector)\n @connections ||= {}\n\n connection = @connections[config]\n\n return connection if connection\n\n begin\n @connections[config] = connector.call(config)\n rescue => e\n ::NewRelic::Agent.logger.error(\"Caught exception trying to get connection to DB for explain.\", e)\n nil\n end\n end", "def connection(extra_opts={}, legacy = false, sharded = false)\n opts = connection_options.merge!(extra_opts)\n if(legacy)\n if replicaset?\n ReplSetConnection.new(node_strings, opts)\n else\n Connection.new(host, port, opts)\n end\n else\n if sharded\n MongoShardedClient.new(node_strings, opts)\n elsif replicaset?\n MongoReplicaSetClient.new(node_strings, opts)\n else\n MongoClient.new(host, port, opts)\n end\n end\n end", "def create\n @connection = Crm::Connection.new params[:connection]\n _create_or_update\n end", "def connection_for host, options = {}, &block\n connection = Connection.new(self, host, options)\n yield(connection) if block_given?\n connection\n end", "def set_or_create_clients(options)\n client = options[:client]\n @key_vault_client = if options[:key_vault_client]\n options[:key_vault_client]\n elsif client.options[:max_pool_size] == 0\n client\n else\n internal_client(client)\n end\n\n @metadata_client = if options[:bypass_auto_encryption]\n nil\n elsif client.options[:max_pool_size] == 0\n client\n else\n internal_client(client)\n end\n end", "def connection_options\n CONNECTION_OPTIONS\n end", "def connection(options = {})\n conn_options = default_options(options).keep_if { |k, _| ALLOWED_OPTIONS.include?(k) }\n clear_cache unless options.empty?\n puts \"OPTIONS:#{conn_options.inspect}\" if ENV[\"DEBUG\"]\n\n Faraday.new(conn_options.merge(builder: stack(options)))\n end", "def new_connection\n old_db_id = @db.nil? ? 0 : @db.object_id\n @db.disconnect! unless @db.nil?\n\n @db = ActiveRecord::Base.mysql2_connection(@db_config)\n\n new_db_id = @db.object_id\n logger.info(\"New cache db connection - old db id was: #{old_db_id} -- new db id is: #{new_db_id}\")\n\n return @db\n end", "def connection\n @connection = create_connection! unless connected?\n @connection\n end", "def create_connection\n Fog::Compute.new({\n :provider => 'OpenStack',\n :openstack_api_key => @os_password,\n :openstack_username => @os_username,\n :openstack_auth_url => @os_auth_url,\n :openstack_tenant => @os_tenant,\n })\n rescue Excon::Errors::Unauthorized => ex\n @log.error 'Invalid OpenStack Credentials' + ex.message\n @log.error ex.backtrace\n exit 1\n rescue Excon::Errors::BadRequest => ex\n @log.error 'Malformed connection options' + ex.message\n if ex.response.body\n @log.error JSON.parse(ex.response.body)['badRequest']['message']\n end\n @log.error ex.backtrace\n end", "def clone_conn(args = {})\r\n conn = Knj::Db.new(@opts.clone.merge(args))\r\n \r\n if block_given?\r\n begin\r\n yield(conn)\r\n ensure\r\n conn.close\r\n end\r\n \r\n return nil\r\n else\r\n return conn\r\n end\r\n end", "def reuse_connection\n logger.debug(\"[WinRM] reusing existing connection #{@connection}\")\n yield @connection if block_given?\n @connection\n end", "def connection\n @connection ||= build_connection\n end", "def open_connection\n if @sslca then\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name,\n sslca: @sslca)\n else\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name)\n end\n end", "def open(options={}, &block)\n begin\n # Call the appropriate client's open method.\n if self.client\n self.client.open(options)\n else\n if self.uri\n raise Retrieve::NoClientError,\n \"No client was registered to handle the \" +\n \"'#{self.uri.scheme}' scheme.\"\n else\n raise Retrieve::NoClientError,\n \"Cannot find a client without a URI scheme.\"\n end\n end\n if block\n # If we were supplied a block, yield to it, then close.\n yield self\n else\n self\n end\n ensure\n # Make sure we close if there's a block.\n self.close if block rescue nil\n end\n end", "def connection\n Connection.new(conn_spec)\n end", "def connection\n return @connection if @connection\n\n unless session = cached_session\n Logger.info \"Creating a new session!\"\n session = create_write_and_return_new_session!\n end\n\n # will raise an error if session not authorized\n @connection = DropboxClient.new(session, access_type)\n\n rescue => err\n raise Errors::Storage::Dropbox::ConnectionError.wrap(err)\n end", "def connection\n Connection.new(conn_spec)\n end", "def open(options)\n @db ||= options[:connection]\n return @db if @db\n\n if options[:path] && !File.exist?(options[:path])\n @db = SQLite3::Database.new(options[:path])\n setup\n end\n\n raise StoreException.new(\"Attempt to open missing database file #{options[:path]}\") unless File.exist?(options[:path])\n @db = SQLite3::Database.new(options[:path])\n end", "def connection\n @connection || Connection.new\n end", "def connection\n retrieve_connection\n end", "def new_redshift_connection(connection_options={})\n merged_options = merge_options(connection_options)\n\n @redshift_conn = PG.connect(\n :host => merged_options[:redshift_host],\n :port => merged_options[:redshift_port],\n :dbname => merged_options[:redshift_dbname],\n :user => merged_options[:redshift_user],\n :password => merged_options[:redshift_password])\n\n return @redshift_conn\n end", "def connect_via_sentinel(options, &block)\n sentinel = Sentinel.new(options)\n sentinel.resolve do |host, port|\n redis = EM.connect(host, port, Client, options)\n redis.sentinel = sentinel\n block.call(redis)\n end\n end", "def connect(options = {})\n raise MiqException::MiqHostError, \"No credentials defined\" if missing_credentials?(options[:auth_type])\n\n auth_token = authentication_token(options[:auth_type])\n username = options[:user] || authentication_userid(options[:auth_type])\n password = options[:pass] || authentication_password(options[:auth_type])\n host = options[:host] || address\n port = options[:port] || self.port\n self.class.raw_connect(username, password, host, port).login\n end", "def connection\n @connection ||= make_connection\n end", "def connection\n raise ConnectionNotEstablished unless @@connection\n return @@connection\n end", "def connection\n @connection ||= Connection.new(nil)\n end", "def connection\n # Create connection\n # rubocop:disable UselessAssignment\n @connection ||= begin\n connection = Fog::Compute.new(\n provider: 'AWS',\n aws_access_key_id: @api_user,\n aws_secret_access_key: @api_password,\n region: @aws_region\n )\n end\n # rubocop:enable UselessAssignment\n end", "def new_connection(config)\n username = nil\n\n if config[:jndi]\n jndi = config[:jndi].to_s\n ctx = javax.naming.InitialContext.new\n ds = nil\n\n # tomcat needs first lookup method, oc4j (and maybe other application servers) need second method\n begin\n env = ctx.lookup(\"java:/comp/env\")\n ds = env.lookup(jndi)\n rescue\n ds = ctx.lookup(jndi)\n end\n\n # check if datasource supports pooled connections, otherwise use default\n if ds.respond_to?(:pooled_connection)\n @raw_connection = ds.pooled_connection\n else\n @raw_connection = ds.connection\n end\n\n # get Oracle JDBC connection when using DBCP in Tomcat or jBoss\n if @raw_connection.respond_to?(:getInnermostDelegate)\n @pooled_connection = @raw_connection\n @raw_connection = @raw_connection.innermost_delegate\n elsif @raw_connection.respond_to?(:getUnderlyingConnection)\n @pooled_connection = @raw_connection\n @raw_connection = @raw_connection.underlying_connection\n end\n\n # Workaround FrozenError (can't modify frozen Hash):\n config = config.dup\n config[:driver] ||= @raw_connection.meta_data.connection.java_class.name\n username = @raw_connection.meta_data.user_name\n else\n # to_s needed if username, password or database is specified as number in database.yml file\n username = config[:username] && config[:username].to_s\n password = config[:password] && config[:password].to_s\n database = config[:database] && config[:database].to_s || \"XE\"\n host, port = config[:host], config[:port]\n privilege = config[:privilege] && config[:privilege].to_s\n\n # connection using TNS alias, or connection-string from DATABASE_URL\n using_tns_alias = !host && !config[:url] && ENV[\"TNS_ADMIN\"]\n if database && (using_tns_alias || host == \"connection-string\")\n url = \"jdbc:oracle:thin:@#{database}\"\n else\n unless database.match?(/^(:|\\/)/)\n # assume database is a SID if no colon or slash are supplied (backward-compatibility)\n database = \"/#{database}\"\n end\n url = config[:url] || \"jdbc:oracle:thin:@//#{host || 'localhost'}:#{port || 1521}#{database}\"\n end\n\n prefetch_rows = config[:prefetch_rows] || 100\n # get session time_zone from configuration or from TZ environment variable\n time_zone = config[:time_zone] || ENV[\"TZ\"] || java.util.TimeZone.default.getID\n\n properties = java.util.Properties.new\n raise \"username not set\" unless username\n raise \"password not set\" unless password\n properties.put(\"user\", username)\n properties.put(\"password\", password)\n properties.put(\"defaultRowPrefetch\", \"#{prefetch_rows}\") if prefetch_rows\n properties.put(\"internal_logon\", privilege) if privilege\n\n if config[:jdbc_connect_properties] # arbitrary additional properties for JDBC connection\n raise \"jdbc_connect_properties should contain an associative array / hash\" unless config[:jdbc_connect_properties].is_a? Hash\n config[:jdbc_connect_properties].each do |key, value|\n properties.put(key, value)\n end\n end\n\n begin\n @raw_connection = java.sql.DriverManager.getConnection(url, properties)\n rescue\n # bypass DriverManager to work in cases where ojdbc*.jar\n # is added to the load path at runtime and not on the\n # system classpath\n @raw_connection = ORACLE_DRIVER.connect(url, properties)\n end\n\n # Set session time zone to current time zone\n if ActiveRecord.default_timezone == :local\n @raw_connection.setSessionTimeZone(time_zone)\n elsif ActiveRecord.default_timezone == :utc\n @raw_connection.setSessionTimeZone(\"UTC\")\n end\n\n if config[:jdbc_statement_cache_size]\n raise \"Integer value expected for :jdbc_statement_cache_size\" unless config[:jdbc_statement_cache_size].instance_of? Integer\n @raw_connection.setImplicitCachingEnabled(true)\n @raw_connection.setStatementCacheSize(config[:jdbc_statement_cache_size])\n end\n\n # Set default number of rows to prefetch\n # @raw_connection.setDefaultRowPrefetch(prefetch_rows) if prefetch_rows\n end\n\n cursor_sharing = config[:cursor_sharing] || \"force\"\n exec \"alter session set cursor_sharing = #{cursor_sharing}\" if cursor_sharing\n\n # Initialize NLS parameters\n OracleEnhancedAdapter::DEFAULT_NLS_PARAMETERS.each do |key, default_value|\n value = config[key] || ENV[key.to_s.upcase] || default_value\n if value\n exec \"alter session set #{key} = '#{value}'\"\n end\n end\n\n OracleEnhancedAdapter::FIXED_NLS_PARAMETERS.each do |key, value|\n exec \"alter session set #{key} = '#{value}'\"\n end\n\n self.autocommit = true\n\n schema = config[:schema] && config[:schema].to_s\n if schema.blank?\n # default schema owner\n @owner = username.upcase unless username.nil?\n else\n exec \"alter session set current_schema = #{schema}\"\n @owner = schema\n end\n\n @raw_connection\n end", "def create_new_persistent_connection\n app_name = if @data[:options][:connection_ca_file] ||\n @data[:credentials][:cert] ||\n @data[:credentials][:key]\n 'right_cloud_api_gem_%s' % Utils::generate_token\n else\n 'right_cloud_api_gem'\n end\n connection = Net::HTTP::Persistent.new(app_name)\n set_persistent_connection_options!(connection)\n # Register a callback to close current connection\n @data[:callbacks][:close_current_connection] = Proc::new do |reason|\n connection.shutdown\n log \"Current connection closed: #{reason}\"\n end\n connection\n end", "def client_options\n opts = uri_options.tap do |opts|\n opts[:database] = @database if @database\n end\n\n @user ? opts.merge(credentials) : opts\n end", "def __build_connections\n region = options[:region]\n access_key_id = options[:aws_access_key_id] || nil\n secret_access_key = options[:aws_secret_access_key] || nil\n session_token = options[:session_token] || nil\n profile = options[:profile] || 'default'\n instance_cred_retries = options[:instance_profile_credentials_retries] || 0\n instance_cred_timeout = options[:instance_profile_credentials_timeout] || 1\n \n credential_config = CredentialConfig.new(access_key_id, secret_access_key, session_token, profile,\n instance_cred_retries, instance_cred_timeout, region)\n credentials = Aws::CredentialProviderChain.new(credential_config).resolve\n\n Connections::Collection.new \\\n :connections => hosts.map { |host|\n host[:protocol] = host[:scheme] || DEFAULT_PROTOCOL\n host[:port] ||= DEFAULT_PORT\n url = __full_url(host)\n \n aes_connection = ::Faraday::Connection.new(url, (options[:transport_options] || {})) do |faraday|\n faraday.request :aws_v4_signer,\n credentials: credentials,\n service_name: 'es',\n region: region\n faraday.adapter :manticore\n end\n \n Connections::Connection.new \\\n :host => host,\n :connection => aes_connection\n },\n :selector_class => options[:selector_class],\n :selector => options[:selector]\n end", "def connect_options(options)\n connect_options = {:ssh_options=>{}}\n if options[:port]\n connect_options[:ssh_options][:port] = options[:port]\n end\n if options[:ip]\n connect_options[:ssh_options][:host_name] = options[:ip]\n end\n return connect_options\n end", "def connection\n @connection ||= begin\n active_record = Class.new(_orel_options.active_record)\n Orel::Connection.new(active_record)\n end\n end", "def ds_credential_connection\n Docusign::Credential::CredentialSoap.new.tap do |c|\n c.endpoint_url = Docusign::Config[:credential_endpoint_url]\n end\n end", "def get_connection(timeout)\n loop do\n conn = @connections.poll\n if conn.connected?\n conn.timeout = timeout.to_f\n return conn\n end\n end\n end", "def connection(retry_options = {})\n @connection ||= begin\n opts = {\n retry_limit: connection_retries.to_i,\n retry_delay: connection_retry_sleep.to_i,\n }.merge(retry_options)\n\n ::WinRM::Connection.new(options.merge(opts)).tap do |conn|\n conn.logger = logger\n end\n end\n end", "def connection(_instance_opts = nil)\n # Typical practice is to cache the connection as an instance variable.\n # Do what makes sense for your platform.\n # @options here is the parsed options that the calling\n # app handed to us at process invocation. See the Connection class\n # for more details.\n @connection ||= TrainPlugins::Aws::Connection.new(@options)\n end", "def open_connection\n # DataObjects::Connection.new(uri) will give you back the right\n # driver based on the DataObjects::URI#scheme\n connection = connection_stack.last || DataObjects::Connection.new(normalized_uri)\n connection_stack << connection\n connection\n end", "def get_connection\n return @db_connection if @db_connection\n mongo_client = MongoClient.new(\"localhost\", 27017)\n @db_connection = mongo_client.db(\"robocoder2\")\n end", "def identity_service_connection\n @identity_service_connection = HTTP::CardsServiceConnection.new(\n nil,\n self.identity_service_url\n )\n\n end", "def load_persistent_connection_adapter(options={})\n adapter_config = {\n name: \"oanda_api\",\n idle_timeout: 10,\n keep_alive: 30,\n warn_timeout: 2,\n pool_size: OandaAPI.configuration.connection_pool_size,\n verify_mode: OpenSSL::SSL::VERIFY_PEER\n }.merge options\n\n Client.persistent_connection_adapter adapter_config\n end", "def mongo_connection\n # Returns the connection if it is already established\n return $db_connection if $db_connection\n\n db = URI.parse(ENV['MONGOHQ_URL'])\n db_name = db.path.gsub(/^\\//, '')\n $db_connection = Mongo::Connection.new(db.host, db.port).db(db_name)\n\n unless db.user.nil? || db.password.nil?\n $db_connection.authenticate(db.user, db.password)\n end\n\n $db_connection\nend", "def connection\n if @connection.nil? || @connection.disconnected?\n options = connection_args.first\n @connection = Net::IMAP.new(options[:host], options[:port], options[:use_ssl])\n @connection.login options[:user], options[:password]\n end\n @connection\n end", "def initialize(options = {})\n if options.is_a?(String)\n @options = YAML.load_file(options)\n else\n @options = options\n end\n @options.symbolize_keys!\n\n if ENV['DATABASE_COM_URL']\n url = URI.parse(ENV['DATABASE_COM_URL'])\n url_options = Hash[url.query.split(\"&\").map{|q| q.split(\"=\")}].symbolize_keys!\n self.host = url.host\n self.client_id = url_options[:oauth_key]\n self.client_secret = url_options[:oauth_secret]\n self.username = url_options[:user]\n self.password = url_options[:password]\n else\n self.client_id = ENV['DATABASEDOTCOM_CLIENT_ID'] || @options[:client_id]\n self.client_secret = ENV['DATABASEDOTCOM_CLIENT_SECRET'] || @options[:client_secret]\n self.host = ENV['DATABASEDOTCOM_HOST'] || @options[:host] || \"login.salesforce.com\"\n end\n self.debugging = ENV['DATABASEDOTCOM_DEBUGGING'] || @options[:debugging]\n self.version = ENV['DATABASEDOTCOM_VERSION'] || @options[:version]\n self.version = self.version.to_s if self.version\n self.sobject_module = ENV['DATABASEDOTCOM_SOBJECT_MODULE'] || @options[:sobject_module]\n end", "def initialize options\n host = options['host'] || 'localhost'\n port = options['port'] || 5432\n database = options['database']\n username = options['username']\n\n # always reuse an existing connection if it matches on these connection options\n conn_options = {:host => host, :port => port, :database => database, :username => username}\n existing_connection = self.class.persisted_connection(conn_options)\n\n if existing_connection.nil?\n # create and persist a new connection\n @connection = PG::Connection.new(\n host,\n port,\n nil,\n nil,\n database,\n username,\n options['password'] || ''\n )\n @connection.set_notice_processor do |msg|\n if msg =~ /^ERROR:/\n LOG.error('psql') { msg.gsub(/\\n/,'; ') }\n else\n LOG.info('psql') { msg.gsub(/\\n/,'; ') }\n end\n end\n self.class.persist_connection(@connection, conn_options)\n else\n # reuse an existing connection\n @connection = existing_connection\n end\n\n # set up trackig if it isn't set up already\n set_up_tracking if !tracking_tables?\n end", "def connection\n @connection ||= begin\n conn = Faraday.new(site, options[:connection_opts])\n conn.build do |b|\n options[:connection_build].call(b)\n end if options[:connection_build]\n conn\n end\n end", "def connector_for(host, options = {})\n connector = options[:connector].to_s\n\n if !VALID_CONNECTORS.include?(connector)\n log.debug { \"Connector '#{connector}' is not one of #{VALID_CONNECTORS}. Determining connector...\" }\n connector = nil\n end\n\n if (connector == DEFAULT_WINDOWS_CONNECTOR || connector.nil?) && winrm.connector_port_open?(host, options)\n winrm\n elsif (connector == DEFAULT_LINUX_CONNECTOR || connector.nil?) && ssh.connector_port_open?(host, options)\n ssh\n else\n nil\n end\n end", "def reuse_connection\n logger.debug(\"[Dokken] reusing existing connection #{@connection}\")\n yield @connection if block_given?\n @connection\n end", "def connection\n # this is correctly done double-checked locking\n # (ThreadSafe::Cache's lookups have volatile semantics)\n @reserved_connections[current_connection_id] || synchronize do\n @reserved_connections[current_connection_id] ||= checkout\n end\n end", "def connection\n @options[:path] = API_VERSION2 + @options[:path]\n encoded_api_header = encode_header(@options)\n @options[:headers] = HEADERS.merge(X_Megam_HMAC => encoded_api_header[:hmac],\n X_Megam_DATE => encoded_api_header[:date], X_Megam_ORG => \"#{@org_id}\").merge(@options[:headers])\n @options[:headers] = @options[:headers].merge('X-Megam-PUTTUSAVI' => \"true\") unless (@password == \"\" || @password.nil?)\n Megam::Log.debug('HTTP Request Data:')\n Megam::Log.debug(\"> HTTP #{@options[:scheme]}://#{@options[:host]}\")\n @options.each do |key, value|\n Megam::Log.debug(\"> #{key}: #{value}\")\n end\n Megam::Log.debug('End HTTP Request Data.')\n if @options[:scheme] == 'https'\n @connection = Excon.new(\"#{@options[:scheme]}://#{@options[:host]}\", @options)\n else\n Excon.defaults[:ssl_verify_peer] = false\n @connection = Excon.new(\"#{@options[:scheme]}://#{@options[:host]}:9000\", @options)\n end\n @connection\n end", "def get_remote_connection\n retun db_connection if db_connection\n db = URI..parse(ENV['MONGOHQ_URl'])\n db_name = db.path.gsub(/^\\//, '')\n db_connection = Mongo::Connection.new(db.host, db.port).db(db_name)\n db_connection.authenticate(db.user, db.password) unless db.user.nil?\n db_connection\n #check incoming message\n end", "def new_connection(params)\n Pod4.logger.info(__FILE__){ \"Connecting to DB\" }\n client = TinyTds::Client.new(params)\n raise \"Bad Connection\" unless client.active?\n\n client.execute(\"use [#{self.class.db}]\").do\n\n client\n\n rescue => e\n handle_error(e)\n end", "def redis_connection(name)\n name = name.to_s\n config = redis_config_by_name(name)\n ConnectionWrapper.new(self, name, config)\n end", "def get_conn_params\n\n # Excon.defaults[:read_timeout] = 10\n # Excon.defaults[:write_timeout] = 10\n # Excon.defaults[:ssl_verify_peer] = false\n\n params = {}\n open_rc = read_prop_file('/etc/openrc')\n provider = @options['provider']\n case provider\n when 'openstack'\n params[:provider] = provider\n params[:openstack_username] = @options['OS_USERNAME'] || open_rc['OS_USERNAME'] || ENV['OS_USERNAME']\n params[:openstack_api_key] = @options['OS_PASSWORD'] || open_rc['OS_PASSWORD'] || ENV['OS_PASSWORD']\n params[:openstack_auth_url] = (@options['OS_AUTH_URL'] || open_rc['OS_AUTH_URL'] || ENV['OS_AUTH_URL']).to_s + '/tokens'\n else\n exit_with_error \"Cloud provider: #{provider} not supported!\"\n end\n puts \"Cloud connection params: #{params}\" if @options['verbose']\n params\nend", "def connection\n @conn ||= ETL::Engine.connection(dimension_target)\n end", "def slave_connection_holder\n @slave_connection_holder ||= Class.new(ActiveRecord::Base) {\n self.abstract_class = true\n\n def self.name\n \"SlaveConnectionHolder\"\n end\n\n spec = [Slavery.spec_key, Slavery.env].find do |spec_key|\n ActiveRecord::Base.configurations[spec_key]\n end or raise Error.new(\"#{Slavery.spec_key} or #{Slavery.env} must exist!\")\n\n establish_connection spec.to_sym\n }\n end", "def manage(options)\n options = {:peername => options} if options.kind_of?(String)\n sessions << Session.open(options)\n \"Opened session to manage peer: #{options[:peername]}\"\n end", "def connections_id_get(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connections_id_get\" if id.nil?\n \n # resource path\n path = \"/connections/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\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 = ['application/json']\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 = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, 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 => 'inline_response_200_6')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectionApi#connections_id_get. Result: #{result.inspect}\"\n end\n return result\n end", "def make_conn(spec)\n case @handling_mode\n when :cache\n cache_connect(spec)\n when :pool\n # not yet implemented\n nil\n else\n nil\n end\n end", "def open_connection\n # FIXME il timeout serve solamente nella versione tcp\n # FIXME perchè utilizzare un'istanza di classe? non sarebbe meglio avere un metodo che genera il transport\n # e successivamente viene utilizzato sempre quello?\n Timeout.timeout @timeout do\n case @transport\n when :tcp\n @connection = KonoEppClient::Transport::TcpTransport.new(server, port)\n when :http\n @connection = KonoEppClient::Transport::HttpTransport.new(server, port,\n ssl_version: ssl_version,\n cookie_file: \"#{@tag.downcase}.cookies.pstore\"\n )\n end\n end\n end", "def connection\n @connection || ActiveSdb::connection\n end", "def connect(options)\n @api_client = establish_remote_appliance_connection(options.merge({:no_prompt => true, :skip_verify_access_token => true, :skip_login => true}))\n # automatically get @appliance_name, @appliance_url, @wallet\n if !@appliance_name\n raise_command_error \"#{command_name} requires a remote to be specified, use -r [remote] or set the active remote with `remote use`\"\n end\n if !@appliance_url\n unless options[:quiet]\n print red,\"Unable to determine remote appliance url. Review your remote configuration.#{reset}\\n\"\n end\n return 1\n end\n #@wallet = Morpheus::Cli::Credentials.new(@appliance_name, @appliance_url).load_saved_credentials()\n if @wallet.nil? || @wallet['access_token'].nil?\n unless options[:quiet]\n print_error yellow,\"You are not currently logged in to #{display_appliance(@appliance_name, @appliance_url)}\",reset,\"\\n\"\n print_error yellow,\"Use `login` to authenticate or try passing the --username option.\",reset,\"\\n\"\n end\n return 1\n end\n return 0\n end", "def get_legacy_db_conn\n Mysql2::Client.new(:host => ENV[\"SDBMSS_LEGACY_DB_HOST\"],\n :username => ENV[\"SDBMSS_LEGACY_DB_USER\"],\n :database => ENV[\"SDBMSS_LEGACY_DB_NAME\"],\n :password => ENV[\"SDBMSS_LEGACY_DB_PASSWORD\"],\n )\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 get_session(options = {})\n get_session!(options)\n rescue Error::SessionsNotSupported\n nil\n end", "def conn\n @conn ||= Faraday.new(url: authentication_uri.to_s) do |builder|\n builder.adapter Faraday.default_adapter\n end\n end", "def kestrel_connection(name)\n name = name.to_s\n config = kestrel_config_by_name(name)\n ConnectionWrapper.new(self, name, config)\n end", "def conn\n #if @conn exists and is open\n if @conn and begin @conn.status rescue PGError false end then\n return @conn\n else\n return @conn = connect_to_database\n end\n end", "def db_conn\n @db_conn_pool ||= ConnectionPool.new(size: 4, timeout: 2) do\n Mysql2::Client.new(self.db_settings)\n end\n end", "def conn\n\t\treturn @conn ||= self.connect\n\tend", "def connect(url, opts = {})\n # Backwards compatible with old connect(options)\n if url.is_a? Hash and opts.empty?\n opts = url\n url = nil\n end\n conn = self.connection(opts[:handler])\n conn.container = self.container_id || generate_uuid\n connector = Connector.new(conn, url, opts)\n return conn\n end", "def initialize(options={})\n @connection = Connection.new(options)\n end", "def connect\n config = @connection_options\n @connection = case config[:mode]\n when :dblib\n appname = config[:appname] || configure_application_name || Rails.application.class.name.split('::').first rescue nil\n login_timeout = config[:login_timeout].present? ? config[:login_timeout].to_i : nil\n timeout = config[:timeout].present? ? config[:timeout].to_i/1000 : nil\n encoding = config[:encoding].present? ? config[:encoding] : nil\n TinyTds::Client.new({\n :dataserver => config[:dataserver],\n :host => config[:host],\n :port => config[:port],\n :username => config[:username],\n :password => config[:password],\n :database => config[:database],\n :appname => appname,\n :login_timeout => login_timeout,\n :timeout => timeout,\n :encoding => encoding,\n :azure => config[:azure]\n }).tap do |client|\n if config[:azure]\n client.execute(\"SET ANSI_NULLS ON\").do\n client.execute(\"SET CURSOR_CLOSE_ON_COMMIT OFF\").do\n client.execute(\"SET ANSI_NULL_DFLT_ON ON\").do\n client.execute(\"SET IMPLICIT_TRANSACTIONS OFF\").do\n client.execute(\"SET ANSI_PADDING ON\").do\n client.execute(\"SET QUOTED_IDENTIFIER ON\")\n client.execute(\"SET ANSI_WARNINGS ON\").do\n else\n client.execute(\"SET ANSI_DEFAULTS ON\").do\n client.execute(\"SET CURSOR_CLOSE_ON_COMMIT OFF\").do\n client.execute(\"SET IMPLICIT_TRANSACTIONS OFF\").do\n end\n client.execute(\"SET TEXTSIZE 2147483647\").do\n end\n when :odbc\n if config[:dsn].include?(';')\n driver = ODBC::Driver.new.tap do |d|\n d.name = config[:dsn_name] || 'Driver1'\n d.attrs = config[:dsn].split(';').map{ |atr| atr.split('=') }.reject{ |kv| kv.size != 2 }.inject({}){ |h,kv| k,v = kv ; h[k] = v ; h }\n end\n ODBC::Database.new.drvconnect(driver)\n else\n ODBC.connect config[:dsn], config[:username], config[:password]\n end.tap do |c|\n begin\n c.use_time = true\n c.use_utc = ActiveRecord::Base.default_timezone == :utc\n rescue Exception => e\n warn \"Ruby ODBC v0.99992 or higher is required.\"\n end\n end\n end\n @spid = _raw_select('SELECT @@SPID', fetch: :rows).first.first\n configure_connection\n rescue\n raise unless @auto_connecting\n end", "def connection_identifier; end", "def reuse_connection\n logger.debug(\"[SSH] reusing existing connection #{@connection}\")\n yield @connection if block_given?\n @connection\n end", "def open\n @ole_connection.Open(connection_string)\n end" ]
[ "0.61312765", "0.5736034", "0.56035495", "0.55937487", "0.550592", "0.549464", "0.54722667", "0.5441871", "0.535668", "0.52862924", "0.52640533", "0.52551687", "0.5240386", "0.5175389", "0.5153329", "0.5129178", "0.5091268", "0.50633556", "0.5057974", "0.5056725", "0.5048977", "0.50488484", "0.5046786", "0.4939476", "0.49333516", "0.49268612", "0.49225244", "0.48938724", "0.4893282", "0.48804662", "0.48757106", "0.48586825", "0.48570082", "0.48464236", "0.4845053", "0.48307574", "0.4819817", "0.48155478", "0.4810058", "0.4804472", "0.48038626", "0.48033118", "0.48026946", "0.47993612", "0.47927296", "0.47668272", "0.47649875", "0.4764756", "0.4752959", "0.4750781", "0.47391427", "0.4734662", "0.4730934", "0.47283998", "0.47252163", "0.47197035", "0.47133437", "0.4709295", "0.46909115", "0.46840265", "0.46765968", "0.46704912", "0.46679977", "0.46468738", "0.4638545", "0.46369755", "0.46345916", "0.4632712", "0.46264088", "0.46250606", "0.46161318", "0.46157184", "0.46132636", "0.4607661", "0.45966116", "0.4593091", "0.45875153", "0.45841375", "0.45833346", "0.4583071", "0.4580848", "0.45735765", "0.455624", "0.45524177", "0.45450428", "0.4544653", "0.45425013", "0.45408183", "0.45318657", "0.45268047", "0.45176208", "0.451438", "0.45066807", "0.45030338", "0.45022777", "0.4499153", "0.44973314", "0.4493626", "0.4489802", "0.4485623" ]
0.72336143
0
Closes the connection associated to the given EMS id.
def close(id) entry = @registry.delete(id) return unless entry begin $rhevm_log.info("Closing connection for EMS with identifier '#{id}' and URL '#{entry.options[:url]}'.") entry.connection.close rescue OvirtSDK4::Error => error $rhevm_log.warn( "Error while closing connection for EMS with identifier '#{id}' and URL '#{entry.options[:url]}', " \ "backtrace follows." ) $rhevm_log.warn(error.message) error.backtrace.each do |line| $rhevm_log.warn(line) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(id)\n wf_event_id?(id)\n api.post([id, 'close'].uri_concat)\n end", "def close\n @connection.close # Close the active mailbox\n @connection.logout # Send the logout command\n @connection.disconnect # Close the actual connection\n end", "def close_connection\n current_connection.logout if current_connection?\n current_connection = nil\n end", "def close()\n @connection.disconnect\n @connection = nil\n end", "def close\n @conn.disconnect\n end", "def closeMQTTConn()\n\n if ( !@mqtt_client.nil? )\n begin\n @mqtt_client.disconnect(send_msg = false)\n rescue Exception => e\n #ignore it\n end\n end\n end", "def close()\r\n _dprint(\"Closing Auth_WiKID connection ...\")\r\n unless $sslsocket.nil?\r\n unless $sslsocket.closed?\r\n $sslsocket.puts(\"QUIT\");\r\n $sslsocket.flush\r\n $sslsocket.close\r\n end\r\n $sslsocket = nil\r\n @socket.shutdown\r\n end\r\n @isConnected = false\r\n end", "def close_connection\n @endpoint.close\n end", "def close()\n\t\t@connection.disconnect\n\t\t@connection = nil\n\tend", "def close\n inactive!\n close_connections\n end", "def close\n close_connection(CLOSED, true)\n end", "def close\n conn.write(\"(api-quit)\") if connected?\n rescue Errno::ECONNRESET\n ensure\n self.conn = nil\n end", "def close\n @channel.close\n @conn.close\n end", "def close\n @ole_connection.Close\n end", "def data_connection_closed(connection_id)\n return unless @connections.delete(connection_id)\n D \"Connection #{connection_id} closed by this end\"\n send_command CloseConnectionCommand.new(connection_id)\n end", "def close\n\t\t@conn.disconnect\n\tend", "def close_connection\n @connection.expunge\n @connection.logout\n @connection.disconnect\n end", "def close\n copy self.class.close(@id)\n true\n end", "def close\n statement = \"close #{@name}\"\n @connection.exec(statement)\n end", "def close\n @mutex.synchronize { @conn.close }\n end", "def close\n @mutex.synchronize { @conn.close }\n end", "def close\n @logger.debug(@host) { 'Closing session' }\n @transport.close\n @transport = nil\n end", "def conn_close(key)\n c = get_connection_by_key(key)\n c && c.close_connection_after_writing\n end", "def disconnect!\n @connection.close rescue nil\n end", "def close\n log \"Closing connection\", level: :warning\n close_stream\n close_socket\n stop_reader\n set_state :disconnected\n notify_error DisconnectError.new(\"Connection was closed\")\n\n # stop timer\n # as we're running inside the timer, code after stop_timer() will not be called,\n # unless it's in the ensure block\n stop_timer\n end", "def close\n if connected? && @soap_client\n @soap_client.EndSession(@ticket)\n @soap_client.CloseConnection\n @soap_client = nil\n @ticket = nil\n end \n end", "def close\n write_message(Vertica::Protocol::Terminate.new)\n ensure\n close_socket\n end", "def close\n @channel.close\n @connection.close\n end", "def close\n @connection_manager.close\n end", "def close(context)\n context.debug('Logout connection')\n @connection_info = nil\n @client.logout\n @client = nil\n @system = nil\n end", "def disconnect!\n @client&.close\n rescue StandardError\n nil\n end", "def close \n begin\n @socket.close\n rescue IOError\n end\n Client.del_socket conn_id()\n true\n end", "def close_connection\n @connection.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def close\n connection.close\n end", "def cmd_close(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\n\t\t\t\t\"Usage: close channel_id\\n\\n\" +\n\t\t\t\t\"Closes the supplied channel.\")\n\t\t\treturn true\n\t\tend\n\n\t\tcid = args[0].to_i\n\t\tchannel = client.find_channel(cid)\n\n\t\tif (!channel)\n\t\t\tprint_error(\"Invalid channel identifier specified.\")\n\t\t\treturn true\n\t\telse\n\t\t\tchannel._close # Issue #410\n\n\t\t\tprint_status(\"Closed channel #{cid}.\")\n\t\tend\n\tend", "def close\n @connection.close\n end", "def close\n @connection.close\n end", "def disconnect\n _logout\n @connection.close\n end", "def close\n @registry[:transport][:session].close if @open\n @open = false\n end", "def close\n return unless @target\n\n target.reload\n target.close\n rescue *CONNECTION_CLEAR_ERRORS => e\n Karafka.monitor.notice_error(self.class, e)\n ensure\n @target = nil\n end", "def close\n @connection.close\n end", "def close\n @connection.close\n end", "def close_target(target_id:)\n {\n method: \"Target.closeTarget\",\n params: { targetId: target_id }.compact\n }\n end", "def close\n @transport.close\n @transport = nil\n @close_handler and @close_handler.call\n end", "def close\n @log.info { \"Closing connection to client #{@ip}\" }\n @socket.close\n end", "def close\n log 'closing connection'\n @ssh.close\n end", "def close\n @conn.close\n end", "def disconnect; @connection.close end", "def connection_closed\n close\n end", "def close()\n if isConnected()\n if @sentConnect\n @sentConnect = false # set in connect()\n @signedOn=false # set in signOn() inside connect()\n bye = VistaRPC.new(\"#BYE#\", RPCResponse::SINGLE_VALUE, true)\n retval = execute(bye)\n @socket.close()\n @socket = nil\n @duz = \"0\"\n @lastvistaerror = nil\n @currentContext = nil\n return retval\n end\n end\n end", "def close\n @timer.detach if @timer.attached?\n @reqtable = {}\n @transport.close\n @seqid = 0\n self\n end", "def close(ctx = nil)\n unless ctx.nil?\n peer = Wrapper::dtls_get_peer(ctx.to_ffi, @session)\n Wrapper::dtls_reset_peer(ctx.to_ffi, peer) unless peer.null?\n end\n\n Wrapper::dtls_free_session(@session)\n @session = nil\n end", "def close\n @transport.close\n end", "def close\n info { \"closing connection\" }\n socket.shutdown\n end", "def close\n @closing = true\n cancel_ping_timer\n cancel_reconnect_timer\n close_connection_after_writing if connected?\n process_disconnect if reconnecting?\n end", "def close\n close_client_connections\n @event_file.close\n end", "def close\n connection.close if connection\n end", "def close(&block)\n on_close(&block)\n\n logger.debug { \"#{self.class.name}: close called, closed? #{closed?} running? #{running?}\" }\n\n if @_running\n @start_stop_mutex.synchronize do\n @_running = false\n end\n\n if @em_connection\n EM.next_tick do\n @em_connection.detach do\n logger.debug { \"#{self.class.name}: connection unbound, continuing with shutdown\" }\n finish_closing\n end\n end\n else\n logger.debug { \"#{self.class.name}: em_connection was never set up, finish closing\" }\n finish_closing\n end\n else\n logger.debug { \"#{self.class.name}: we are not running, so returning on_close deferred\" }\n end\n\n on_close\n end", "def close\n @socket.close\n end", "def close\n @socket.close\n end", "def close\n self.client.close(self.file_id, self.tree_id)\n end", "def close\n @socket.close\n end", "def close\r\n unbind\r\n # try to stop eventmachine loop\r\n EM.stop rescue\r\n @on_close.call if @on_close\r\n WinRM::Log.debug(\":session => :close\")\r\n end", "def close\n lib.tcidbclose( @db ) || raise_error\n\n lib.tcidbdel( @db )\n\n @db = nil\n end", "def close(headers={})\n @connection.disconnect(headers)\n end", "def close_connection; end", "def disconnect\n super\n\n @transport.close rescue nil\n @transport = nil\n \n debug 'connections closed'\n end", "def close_session(session_id)\n @allocator.release_id session_id\n end", "def disconnect\n @conn.close\nend", "def close_connection\n @db.close if @db\n end", "def close\n client.close\n @client = nil\n end", "def close\n @client.session.close unless @client.session.closed?\n end", "def close\n subscriptions.keys.each do |id| \n channel, sig = id.to_a.flatten\n Channel[app_id => channel].unsubscribe(subscriptions.delete(channel => sig))\n end\n end", "def close\n @socket&.close\n end", "def close\n @update_manager.stop\n TD::Api.client_destroy(@td_client)\n end", "def disconnect\n @tcp_socket.close\n end", "def close\n return if @conn.nil?\n @conn.close\n @conn = nil\n end", "def close!\n ssl_socket.close\n end", "def close\n stop_monitoring_connection\n close_connection\n end", "def close_connection\n @connection.finish\n end", "def disconnect\n @socket.close\n end", "def op_close_connection\n return 'Close error: invalid ticket' unless valid?\n\n @ticket.update!(state: 'Finished') unless ['ConnectionError', 'RequestError'].include?(@ticket.state)\n log \"Closed connection with QuickBooks\"\n\n 'OK'\n end", "def close\n @session.connection.close\n end", "def close\n self.disconnect\n end", "def close\n if @connection\n @connection.close unless @connection.closed?\n end\n @connection = nil\n end", "def session_close\n begin\n auth.globals[:headers]['Cookie'] = \"SID=\\\"#{session_id}\\\"\"\n auth.call(:close_session)\n rescue Savon::SOAPFault => e\n # Savon::SOAPFault: (soap:Server) No matches returned for SessionID\n logger.warn(e.inspect)\n end\n session_reset\n end", "def close\n @socket.close if @socket\n end", "def close\r\n\t\t@connection.Close\r\n\tend", "def force_close_connection\n destroy_transport\n connection.transition_state_machine :closed\n end", "def close\n @client.close\n end", "def close\n @client.close\n end", "def close &on_disconnect\n @heartbeat_timer.cancel if @heartbeat_timer\n @heartbeat_timer = nil\n if on_disconnect\n @closing = true\n @on_disconnect = proc{\n on_disconnect.call\n @closing = false\n }\n end\n\n callback{ |c|\n if c.channels.any?\n c.channels.each do |ch, mq|\n mq.close\n end\n else\n send Protocol::Connection::Close.new(:reply_code => 200,\n :reply_text => 'Goodbye',\n :class_id => 0,\n :method_id => 0)\n end\n }\n end", "def close &on_disconnect\n @on_disconnect = on_disconnect if on_disconnect\n\n callback{ |c|\n if c.channels.any?\n c.channels.each do |ch, mq|\n mq.close\n end\n else\n send Protocol::Connection::Close.new(:reply_code => 200,\n :reply_text => 'Goodbye',\n :class_id => 0,\n :method_id => 0)\n end\n }\n end", "def closeDBConn()\n if ( !@db_conn.nil? )\n begin\n @db_conn.finish()\n rescue Exception => e\n #ignore it\n end\n end\n end", "def close\n @closed = true\n @on_close and @on_close.call\n end", "def close(event)\n if event && !event.target.kind_of?(Faye::WebSocket::Client) then\n logger.debug { \"closed connection from #{event.target.env[\"REMOTE_ADDR\"]} (code=#{event.code}; reason=\\\"#{event.reason}\\\")\" }\n end\n if @connected then\n @connected = false\n @handler.new(nil).disconnect(self)\n end\n end" ]
[ "0.64190793", "0.6231773", "0.6159994", "0.6136389", "0.6118631", "0.6106486", "0.60919684", "0.60472023", "0.60431606", "0.6028157", "0.5995724", "0.59579116", "0.59545505", "0.5945803", "0.5933718", "0.59191465", "0.58832866", "0.5883167", "0.58707285", "0.58483255", "0.58483255", "0.58050317", "0.5759761", "0.5755904", "0.57549924", "0.5753143", "0.5744099", "0.5743688", "0.57398343", "0.57307166", "0.57165194", "0.5713765", "0.5701316", "0.56969947", "0.56969947", "0.56969947", "0.56969947", "0.56899595", "0.56885165", "0.56830955", "0.56830955", "0.5676876", "0.5662105", "0.5650725", "0.564534", "0.564534", "0.56446207", "0.5643159", "0.5639674", "0.5639346", "0.56342256", "0.56178635", "0.5596298", "0.55924577", "0.55833554", "0.55797267", "0.5578604", "0.557261", "0.55612326", "0.554205", "0.5539124", "0.5527736", "0.5527717", "0.5527717", "0.5522259", "0.55162936", "0.55083483", "0.5504703", "0.5494554", "0.54935795", "0.54906875", "0.5485145", "0.5483213", "0.5478795", "0.5478058", "0.54772514", "0.5471518", "0.5462558", "0.5460712", "0.54587746", "0.5455346", "0.54542845", "0.54521143", "0.5451832", "0.5447582", "0.5444435", "0.5444335", "0.5433703", "0.54321223", "0.5429811", "0.5427805", "0.5426843", "0.5416634", "0.541404", "0.541404", "0.54135036", "0.5406767", "0.5394958", "0.5393782", "0.53896976" ]
0.8365954
0
Closes and forgets all the connections. Note that the manager can still be used, it will create the connections again when needed.
def clear @registry.keys.each { |id| close(id) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n @connection_manager.close\n end", "def close_all\n @connections.close_all\n end", "def dispose\n return if @connection_pool.nil?\n\n until @connection_pool.empty?\n conn = @connection_pool.pop(true)\n conn&.close\n end\n\n @connection_pool = nil\n end", "def close\n # by default do nothing - close any cached connections\n end", "def close\n inactive!\n close_connections\n end", "def closeConnections()\n #N Without this, the connections won't be closed\n @sshAndScp.close()\n end", "def clear_active_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:release_connection)\n end", "def close_connections\n @connections.values.each(&:close)\n end", "def closeConnections\n #N Without this the cached connections won't get closed\n @contentHost.closeConnections()\n end", "def shutdown\n @connection_manager.shutdown if @connection_manager\n @client = nil\n @connection_manager = nil\n end", "def close_client_connections\n @pending_data.each_key(&:close)\n @pending_data.clear\n end", "def clear_all_connections!\n disconnect_read_pool!\n @original_handler.clear_all_connections!\n end", "def close\n\t\t@manager.close\n\tend", "def close\n @clients.each { |c| c.reset(); c.close() } if @clients\n end", "def clear\n connections.synchronize do\n connections.map(&:last).each(&closer)\n connections.clear\n end\n end", "def disconnect_all\n @connections.clear\n @readers.clear\n end", "def close\n @http_client.reset_all\n end", "def close\n @http_client.reset_all\n end", "def close\n @mutex.lock do\n unless @connection_pool.nil? or @connection_pool.is_closed\n @connection_pool.close\n @connection_pool = nil\n end\n end\n end", "def close()\n\t\t@connection.disconnect\n\t\t@connection = nil\n\tend", "def disconnect\n disconnect_all\n end", "def close_connections\n @connections ||= {}\n @connections.values.each do |connection|\n begin\n connection.disconnect!\n rescue\n end\n end\n\n @connections = {}\n end", "def __close_connections\n # to be implemented by specific transports\n end", "def close()\n @connection.disconnect\n @connection = nil\n end", "def close\n #active record should do our connections for us so just set to nil\n @connection = nil\n # Remove this connection from the list of open connections.\n #@@open_connection = @@open_connections.reject { |c| c[:db_url] == @db_url }\n Log.instance.debug \"Disconnected from #@db_url\"\n end", "def clear_active_connections!\n clear_cache!(@@active_connections) do |name, conn|\n conn.disconnect!\n end\n end", "def close\n @conn.disconnect\n end", "def close\n\t\t@conn.disconnect\n\tend", "def close(opts={})\n if opts[:soft]\n @manager.close(:soft => true) if @manager\n else\n @manager.close if @manager\n end\n\n # Clear the reference to this object.\n thread_local[:managers].delete(self)\n unpin_pool\n\n @connected = false\n end", "def clean_up()\n puts \"Closing MQTT and DB connections\"\n closeMQTTConn()\n closeDBConn()\n end", "def close\n if self.conn && !self.conn.closed?\n self.conn.shutdown\n self.conn.close\n end\n\n self.conn = nil\n end", "def close\n @sockets.each do |sock|\n sock.close\n end\n @host = @port = nil\n @sockets.clear\n @checked_out.clear\n end", "def close\n\n @db.connection.close\n end", "def close\n @pool.each do |s|\n #@pool.remove(s)\n s.close\n #@pool.remove(s)\n end\n end", "def close\n @dbman.close\n @dbprot.clear\n end", "def close\n @mysql.close\n @mysql = nil\n end", "def close_connection\n @db.close if @db\n end", "def close\n if @connection\n @connection.close unless @connection.closed?\n end\n @connection = nil\n end", "def disconnect!\n clear_cache!(new_connection: true)\n reset_transaction\n @raw_connection_dirty = false\n end", "def clear_reloadable_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:clear_reloadable_connections!)\n end", "def close\n @pool.dispose\n end", "def close\n\t\t\t@clients.map(&:close)\n\t\t\t@clients = nil\n\t\tend", "def close\n @conn.close if @conn && !@conn.closed?\n @conn = nil\n end", "def disconnect\n database.close if connected?\n @@connections[name][db_name] = nil\n end", "def closeConnections\n #N Without this, cached SSH connections to the remote system won't get closed\n destinationLocation.closeConnections()\n end", "def finish\n @connections.each_value do |connection|\n begin\n connection.finish\n rescue Exception => e\n logger.error(\"Failed to close metadata http connection: #{e.backtrace.join(\"\\n\")}\")\n end\n end\n @connections = {}\n end", "def close\r\n\t\t@connection.Close\r\n\tend", "def close\n @mutex.synchronize { @conn.close }\n end", "def close\n @mutex.synchronize { @conn.close }\n end", "def close\n return if @conn.nil?\n @conn.close\n @conn = nil\n end", "def close\n @connection.close\n end", "def close\n @connection.close\n end", "def disconnect!\n @reserved_connections.each do |name,conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect!\n end\n @connections = []\n end", "def close\n @conn.close\n super\n end", "def close\n @conn.close\n end", "def close\n @update_manager.stop\n TD::Api.client_destroy(@td_client)\n end", "def release\n chk_conn\n @connected = false\n @db.release(self)\n end", "def disconnect\n return unless pool\n pool.map(&:close)\n @pool = nil\n end", "def close\n @connection.close\n end", "def close\n @connection.close\n end", "def delete_all_active_connections\n super\n end", "def close\n @work_queue.shutdown if @work_queue\n @connection.close\n end", "def close\n\t\t\t@conn.close\n\t\tend", "def release()\n fiber = Fiber.current\n if fiber[connection_pool_key]\n @busy_connections.delete(fiber)\n @connections << fiber[connection_pool_key]\n fiber[connection_pool_key] = nil\n end\n end", "def close_connection\n @connection.expunge\n @connection.logout\n @connection.disconnect\n end", "def close\n @channel.close\n @conn.close\n end", "def shutdown\n\n @db.connection.close\n end", "def disconnect!\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n conn.disconnect!\n end\n @connections = []\n @available.clear\n end", "def flush\n manager.flush\n end", "def disconnect!() @connections.each_value(&:disconnect) end", "def close\n return unless @target\n\n target.reload\n target.close\n rescue *CONNECTION_CLEAR_ERRORS => e\n Karafka.monitor.notice_error(self.class, e)\n ensure\n @target = nil\n end", "def close_connection\n current_connection.logout if current_connection?\n current_connection = nil\n end", "def close\n server_list.each { |server| server.close_channels }\n loop(0) { busy?(true) }\n server_list.each { |server| server.close }\n default_gateway.shutdown! if default_gateway\n end", "def closeDBConn()\n if ( !@db_conn.nil? )\n begin\n @db_conn.finish()\n rescue Exception => e\n #ignore it\n end\n end\n end", "def cleanup_connections\n @connections.keep_if do |thread, conns|\n thread.alive?\n end\n end", "def disconnect_all\n refine_exceptions do\n do_disconnect_all\n end\n end", "def close\n pool.checkin self\n end", "def close\n pool.checkin self\n end", "def close\n @mutex.synchronize do\n unless @closed\n @closed = true\n @htable_pool.close if use_table_pool?\n @connection.close\n\n # To be deprecated\n begin\n HConnectionManager.deleteConnection(@config)\n rescue ArgumentError\n # HBase 0.92 or below\n HConnectionManager.deleteConnection(@config, true)\n end if use_table_pool?\n end\n end\n\n thread_local.delete self\n\n nil\n end", "def reset_connection!\n @connection = nil\n end", "def close\n @db.close\n end", "def close()\n @db.close()\n end", "def close\n @closing = true\n cancel_ping_timer\n cancel_reconnect_timer\n close_connection_after_writing if connected?\n process_disconnect if reconnecting?\n end", "def close\n close_connection(CLOSED, true)\n end", "def connection\n begin\n @connections.hold { |dbh| yield(dbh) }\n rescue Mysql::Error => me\n \n @configuration.log.fatal(me)\n \n @connections.available_connections.each do |sock|\n begin\n sock.close\n rescue => se\n @configuration.log.error(se)\n end\n end\n \n @connections.available_connections.clear\n raise me\n end\n end", "def close\n\t\t\t\t@workers.each do |x|\n\t\t\t\t\tx.close\n\t\t\t\t\t@workers.delete x\n\t\t\t\tend\n\n\t\t\t\t@server.close\n\t\t\t\t@server = nil\n\t\t\tend", "def empty_connection_pools!; end", "def close_session\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsOrders)\n close_prepared_statement(@MySQLConnection, @StatementDeleteFromStatsOrders)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsLocations)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsCategories)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsObjects)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsValues)\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsValues)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsBinaryValues)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsOrders)\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsLastKeys)\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsBinaryValues)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsLastKeys)\n close_prepared_statement(@MySQLConnection, @StatementUpdateStatsLastKeys)\n close_mysql(@MySQLConnection)\n end", "def teardown\n @db.close\n super\n end", "def disconnect!\n synchronize do\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n $DEBUG && warn(\"Closing pg connection: #{conn.object_id}\")\n conn.close\n end\n @connections = []\n @available.clear\n end\n end", "def close\n @pool.close\n end", "def close\n self.disconnect\n end", "def clear_reloadable_connections!\n @reserved_connections.each do |name, conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect! if conn.requires_reloading?\n end\n @connections = []\n end", "def close_connection\n @connection.close\n end", "def reap\n stale_connections = @connections.select do |conn|\n conn.in_use? && !conn.owner.alive?\n end\n\n stale_connections.each do |conn|\n if conn.active?\n conn.reset!\n checkin conn\n else\n remove conn\n end\n end\n end", "def force_close_connection\n destroy_transport\n connection.transition_state_machine :closed\n end", "def close\n @mutex.synchronize do\n @thread.kill\n @store.each_value do |value|\n sess, _ = value\n sess.close(@context)\n end\n end\n end", "def disconnect!\n clear_cache!\n reset_transaction\n end", "def reset!\n clear_cache!(new_connection: true)\n reset_transaction\n configure_connection\n end", "def cleanup\n super\n disconnect\n end", "def disconnect_all\n @cache.values.map(&:clear_all_connections!)\n end" ]
[ "0.7668497", "0.7450589", "0.70779496", "0.70193243", "0.69711995", "0.6834777", "0.6828846", "0.6814725", "0.6800203", "0.6688958", "0.6661373", "0.66588235", "0.66120976", "0.6569933", "0.64764404", "0.6437694", "0.64314955", "0.64314955", "0.6409354", "0.63321674", "0.63131356", "0.63021505", "0.6292853", "0.62883955", "0.6277568", "0.6243413", "0.6240699", "0.6221651", "0.6217604", "0.62038285", "0.6179281", "0.6147305", "0.6147282", "0.6122747", "0.6113881", "0.6095594", "0.6072593", "0.6067455", "0.6065603", "0.6064368", "0.60453665", "0.60446024", "0.6038473", "0.60313183", "0.60311043", "0.6027432", "0.59967643", "0.59964734", "0.59964734", "0.5992429", "0.59859437", "0.59859437", "0.5985695", "0.5975204", "0.5960363", "0.5958641", "0.5945897", "0.59384537", "0.59375495", "0.59375495", "0.59346414", "0.59291905", "0.59236753", "0.5920578", "0.5917972", "0.5915556", "0.5907324", "0.58977634", "0.5891684", "0.5878942", "0.5862501", "0.5859019", "0.5840334", "0.5824585", "0.5819156", "0.5811433", "0.5811282", "0.5811282", "0.5804706", "0.5803234", "0.5796458", "0.57911235", "0.57891685", "0.5785216", "0.57836664", "0.57796127", "0.57793593", "0.5778776", "0.574542", "0.5744361", "0.57387835", "0.5732283", "0.57320327", "0.57295966", "0.5727886", "0.5719089", "0.5717868", "0.5716835", "0.57107604", "0.57077205", "0.5688456" ]
0.0
-1
Creates a new object describing a connection.
def initialize(options, connection) @options = options @connection = connection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new(connection_attributes)\n validate_mandatory_attributes(connection_attributes)\n HwfHmrcApi::Connection.new(connection_attributes)\n end", "def connection\n Connection.new(conn_spec)\n end", "def connection\n Connection.new(conn_spec)\n end", "def new_connection; end", "def connect\n if connection_in_info?\n OpenStruct.new(info.ood_connection_info || {})\n else\n OpenStruct.new YAML.safe_load(connect_file.read)\n end\n end", "def initialize(connection, meta)\n @connection, @meta = connection, meta\n end", "def connect\n Connection.new\n end", "def initialize(options={})\n @connection = Connection.new(options)\n end", "def connect\n @connection.create\n end", "def make_conn(conn)\n conn.h_conn = @dbm.make_conn(conn.spec)\n end", "def connection\n @connection ||= build_connection\n end", "def initialize(connection)\n @connection = connection\n end", "def initialize(address=nil)\n @connection = Connection.new(address)\n end", "def create_new_connection(options, &block)\n if defined?(@connection)\n logger.debug(\"[SSH] shutting previous connection #{@connection}\")\n @connection.close\n end\n\n @connection_options = options\n conn = Connection.new(options, &block)\n\n # Cisco IOS requires a special implementation of `Net:SSH`. This uses the\n # SSH transport to identify the platform, but then replaces SSHConnection\n # with a CiscoIOSConnection in order to behave as expected for the user.\n if defined?(conn.platform.cisco_ios?) && conn.platform.cisco_ios?\n ios_options = {}\n ios_options[:host] = @options[:host]\n ios_options[:user] = @options[:user]\n # The enable password is used to elevate privileges on Cisco devices\n # We will also support the sudo password field for the same purpose\n # for the interim. # TODO\n ios_options[:enable_password] = @options[:enable_password] || @options[:sudo_password]\n ios_options[:logger] = @options[:logger]\n ios_options.merge!(@connection_options)\n conn = CiscoIOSConnection.new(ios_options)\n end\n\n @connection = conn unless conn.nil?\n end", "def initialize_connection(conn)\n conn.comm_inactivity_timeout = config.timeout.to_i\n conn.start_tls(config.ssl ? config.ssl.serializable_hash : {}) if ssl?\n # Create a new request\n req = new_request(conn)\n # Connected event\n connect!(req, conn)\n end", "def create_connection(name, connection)\n repo.add(name, connection)\n write \"Loaded a new round called #{name}.\"\n save!\n end", "def create_connection\n self.setup\n RfmAdaptor::Connection.new(self.server_name)\n end", "def new(*args)\n my = self.init\n my.connect(*args)\n end", "def initialize(options={})\n @connection = OctocatHerder::Connection.new(options)\n end", "def create_new_connection(options, &block)\n cleanup!\n @connection_options = options\n @connection = Kitchen::Transport::Ssh::Connection.new(options, &block)\n end", "def initialize(conn = nil)\n self.conn = conn || self.class.default_conn\n end", "def initialize(connection, options)\n self.connection = connection\n self.options = options.clone\n end", "def connection\n @connection ||= make_connection\n end", "def connection\n raise NotImplementedError, \"Implement #{__callee__} in #{self.class.to_s}\"\n end", "def new_connection(relation_name, other_object, bidi)\n return Relation.create(relation_name, self.node, other_object.node, bidi)\n end", "def initialize (reference, name, description, connections)\n\t\t\t@reference = reference\n\t\t\t@name = name\n\t\t\t@description = description\n\t\t\t@connections = connections\n\t\tend", "def initialize(connection)\n super connection\n self.header = Header.new\n self.message = Message.new\n self.body = \"\"\n end", "def initialize(conn_spec)\n @conn_spec = conn_spec\n end", "def connection\n @connection = create_connection! unless connected?\n @connection\n end", "def create_client_connection(host, port, db)\n Connection.new(host, port, db, @handle)\n end", "def initialize(connection, name)\n @connection = connection\n @name = name\n logger.debug \"Successfully initialized #{description}\"\n end", "def connection\n @connection ||= Connection.new(nil)\n end", "def create_new_connection(options, &block)\n if @connection\n logger.debug(\"[Dokken] shutting previous connection #{@connection}\")\n @connection.close\n end\n\n @connection = Kitchen::Transport::Dokken::Connection.new(options, &block)\n end", "def create_connection(body)\n raise Auth0::InvalidParameter, 'Must specify a body to create a connection' if body.to_s.empty?\n request_params = body\n post(connections_path, request_params)\n end", "def create_new_persistent_connection\n app_name = if @data[:options][:connection_ca_file] ||\n @data[:credentials][:cert] ||\n @data[:credentials][:key]\n 'right_cloud_api_gem_%s' % Utils::generate_token\n else\n 'right_cloud_api_gem'\n end\n connection = Net::HTTP::Persistent.new(app_name)\n set_persistent_connection_options!(connection)\n # Register a callback to close current connection\n @data[:callbacks][:close_current_connection] = Proc::new do |reason|\n connection.shutdown\n log \"Current connection closed: #{reason}\"\n end\n connection\n end", "def initialize(in_conn_parms)\n conn_parms = FFI::MemoryPointer.new(API::ConnectParams, 1, true)\n @connect_params = conn_parms\n set_param(in_conn_parms, :vmxSpec)\n # Increment structure pointer to server_name\n set_param(in_conn_parms, :serverName)\n # Increment structure pointer to thumbPrint\n set_param(in_conn_parms, :thumbPrint)\n # Increment structure pointer to privateUse\n conn_parms = @connect_params + API::ConnectParams.offset_of(:privateUse)\n conn_parms.write_long(in_conn_parms[:privateUse]) unless in_conn_parms[:privateUse].nil?\n # Increment structure pointer to credType\n cred_type = in_conn_parms[:credType]\n conn_parms = @connect_params + API::ConnectParams.offset_of(:credType)\n conn_parms.write_int(cred_type) unless cred_type.nil?\n get_safe_creds(cred_type, in_conn_parms, @connect_params + API::ConnectParams.offset_of(:creds))\n conn_parms = @connect_params + API::ConnectParams.offset_of(:port)\n conn_parms.write_uint32(in_conn_parms[:port]) unless in_conn_parms[:port].nil?\n conn_parms.write_uint32(0) if API::VERSION_MAJOR > 5\n @connect_params\n end", "def initialize(connection_to_socket, args = {})\n @connection = connection_to_socket\n @user = args[:user]\n @password = args[:password]\n\n srv = connection.protocol::Connect.new(\n protocol: 19,\n user: args[:user],\n password: args[:password]\n ).process(connection)\n\n @session = srv[:session] || OrientdbBinary::OperationTypes::NEW_SESSION\n end", "def initialize(connection_details)\n @connection_details = connection_details\n end", "def open_connection\n # FIXME il timeout serve solamente nella versione tcp\n # FIXME perchè utilizzare un'istanza di classe? non sarebbe meglio avere un metodo che genera il transport\n # e successivamente viene utilizzato sempre quello?\n Timeout.timeout @timeout do\n case @transport\n when :tcp\n @connection = KonoEppClient::Transport::TcpTransport.new(server, port)\n when :http\n @connection = KonoEppClient::Transport::HttpTransport.new(server, port,\n ssl_version: ssl_version,\n cookie_file: \"#{@tag.downcase}.cookies.pstore\"\n )\n end\n end\n end", "def connect_using conn\n @connection = conn\n end", "def initialize\n # we create this particular socket connection just to keep it open\n @soc = dtnsoc\n end", "def connection\n @connection ||= Connection.new(RESOURCE_PATH)\n end", "def connection\n @connection ||= Connection.new(RESOURCE_PATH)\n end", "def connection\n @connection ||= Connection.new(RESOURCE_PATH)\n end", "def connection\n @connection ||= Connection.new(RESOURCE_PATH)\n end", "def build_connection(host, port, queue)\n begin\n connection = Connection.new(\n :host => host,\n :port => port,\n :queue => queue,\n :topic => topic,\n :channel => channel,\n :notifier => notifier,\n :features => connection_options[:features],\n :features_args => connection_options[:config],\n :callbacks => {\n :handle => {\n :actor => current_actor,\n :method => :process_message\n },\n :reconnect => {\n :actor => current_actor,\n :method => :connection_reconnect\n }\n }\n )\n rescue => e\n error \"Failed to build connection (host: #{host} port: #{port} queue: #{queue}) - #{e.class}: #{e}\"\n debug \"#{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n nil\n end\n end", "def create\n conn = EM::Hiredis::Client.new(@host, @port, @password, @database)\n conn.connect\n conn\n end", "def initialize(connection, text)\n raise ArgumentError.new(\"+connection+ must be a DataObjects::Connection\") unless DataObjects::Connection === connection\n @connection, @text = connection, text\n end", "def initialize(connection, text)\n raise ArgumentError.new(\"+connection+ must be a DataObjects::Connection\") unless DataObjects::Connection === connection\n @connection, @text = connection, text\n end", "def new_connection(config)\n username = nil\n\n if config[:jndi]\n jndi = config[:jndi].to_s\n ctx = javax.naming.InitialContext.new\n ds = nil\n\n # tomcat needs first lookup method, oc4j (and maybe other application servers) need second method\n begin\n env = ctx.lookup(\"java:/comp/env\")\n ds = env.lookup(jndi)\n rescue\n ds = ctx.lookup(jndi)\n end\n\n # check if datasource supports pooled connections, otherwise use default\n if ds.respond_to?(:pooled_connection)\n @raw_connection = ds.pooled_connection\n else\n @raw_connection = ds.connection\n end\n\n # get Oracle JDBC connection when using DBCP in Tomcat or jBoss\n if @raw_connection.respond_to?(:getInnermostDelegate)\n @pooled_connection = @raw_connection\n @raw_connection = @raw_connection.innermost_delegate\n elsif @raw_connection.respond_to?(:getUnderlyingConnection)\n @pooled_connection = @raw_connection\n @raw_connection = @raw_connection.underlying_connection\n end\n\n # Workaround FrozenError (can't modify frozen Hash):\n config = config.dup\n config[:driver] ||= @raw_connection.meta_data.connection.java_class.name\n username = @raw_connection.meta_data.user_name\n else\n # to_s needed if username, password or database is specified as number in database.yml file\n username = config[:username] && config[:username].to_s\n password = config[:password] && config[:password].to_s\n database = config[:database] && config[:database].to_s || \"XE\"\n host, port = config[:host], config[:port]\n privilege = config[:privilege] && config[:privilege].to_s\n\n # connection using TNS alias, or connection-string from DATABASE_URL\n using_tns_alias = !host && !config[:url] && ENV[\"TNS_ADMIN\"]\n if database && (using_tns_alias || host == \"connection-string\")\n url = \"jdbc:oracle:thin:@#{database}\"\n else\n unless database.match?(/^(:|\\/)/)\n # assume database is a SID if no colon or slash are supplied (backward-compatibility)\n database = \"/#{database}\"\n end\n url = config[:url] || \"jdbc:oracle:thin:@//#{host || 'localhost'}:#{port || 1521}#{database}\"\n end\n\n prefetch_rows = config[:prefetch_rows] || 100\n # get session time_zone from configuration or from TZ environment variable\n time_zone = config[:time_zone] || ENV[\"TZ\"] || java.util.TimeZone.default.getID\n\n properties = java.util.Properties.new\n raise \"username not set\" unless username\n raise \"password not set\" unless password\n properties.put(\"user\", username)\n properties.put(\"password\", password)\n properties.put(\"defaultRowPrefetch\", \"#{prefetch_rows}\") if prefetch_rows\n properties.put(\"internal_logon\", privilege) if privilege\n\n if config[:jdbc_connect_properties] # arbitrary additional properties for JDBC connection\n raise \"jdbc_connect_properties should contain an associative array / hash\" unless config[:jdbc_connect_properties].is_a? Hash\n config[:jdbc_connect_properties].each do |key, value|\n properties.put(key, value)\n end\n end\n\n begin\n @raw_connection = java.sql.DriverManager.getConnection(url, properties)\n rescue\n # bypass DriverManager to work in cases where ojdbc*.jar\n # is added to the load path at runtime and not on the\n # system classpath\n @raw_connection = ORACLE_DRIVER.connect(url, properties)\n end\n\n # Set session time zone to current time zone\n if ActiveRecord.default_timezone == :local\n @raw_connection.setSessionTimeZone(time_zone)\n elsif ActiveRecord.default_timezone == :utc\n @raw_connection.setSessionTimeZone(\"UTC\")\n end\n\n if config[:jdbc_statement_cache_size]\n raise \"Integer value expected for :jdbc_statement_cache_size\" unless config[:jdbc_statement_cache_size].instance_of? Integer\n @raw_connection.setImplicitCachingEnabled(true)\n @raw_connection.setStatementCacheSize(config[:jdbc_statement_cache_size])\n end\n\n # Set default number of rows to prefetch\n # @raw_connection.setDefaultRowPrefetch(prefetch_rows) if prefetch_rows\n end\n\n cursor_sharing = config[:cursor_sharing] || \"force\"\n exec \"alter session set cursor_sharing = #{cursor_sharing}\" if cursor_sharing\n\n # Initialize NLS parameters\n OracleEnhancedAdapter::DEFAULT_NLS_PARAMETERS.each do |key, default_value|\n value = config[key] || ENV[key.to_s.upcase] || default_value\n if value\n exec \"alter session set #{key} = '#{value}'\"\n end\n end\n\n OracleEnhancedAdapter::FIXED_NLS_PARAMETERS.each do |key, value|\n exec \"alter session set #{key} = '#{value}'\"\n end\n\n self.autocommit = true\n\n schema = config[:schema] && config[:schema].to_s\n if schema.blank?\n # default schema owner\n @owner = username.upcase unless username.nil?\n else\n exec \"alter session set current_schema = #{schema}\"\n @owner = schema\n end\n\n @raw_connection\n end", "def initialize(args={})\n @connection_name = args[:connection_name] || nil\n end", "def initialize_connection(lobby, options={})\n options = DEFAULT_CONNECTION_OPTIONS.merge(options)\n url = URI.parse(url_for(lobby, options))\n @connection = {\n :host => url.host,\n :port => url.port,\n :ssl => ssl?(url.scheme)\n }\n self.new(lobby)\n end", "def create_new_connection(options, &block)\n if @connection\n logger.debug(\"[WinRM] shutting previous connection #{@connection}\")\n @connection.close\n end\n\n @connection_options = options\n @connection = Kitchen::Transport::Winrm::Connection.new(options, &block)\n end", "def create_connection\n\t\t@connection = Faraday.new(:url => @base_url) do |faraday|\n\t\t\tfaraday.headers['Accept'] = 'application/json'\n\t\t\tfaraday.adapter Faraday.default_adapter\n\t\tend\n\tend", "def initialize options\n host = options['host'] || 'localhost'\n port = options['port'] || 5432\n database = options['database']\n username = options['username']\n\n # always reuse an existing connection if it matches on these connection options\n conn_options = {:host => host, :port => port, :database => database, :username => username}\n existing_connection = self.class.persisted_connection(conn_options)\n\n if existing_connection.nil?\n # create and persist a new connection\n @connection = PG::Connection.new(\n host,\n port,\n nil,\n nil,\n database,\n username,\n options['password'] || ''\n )\n @connection.set_notice_processor do |msg|\n if msg =~ /^ERROR:/\n LOG.error('psql') { msg.gsub(/\\n/,'; ') }\n else\n LOG.info('psql') { msg.gsub(/\\n/,'; ') }\n end\n end\n self.class.persist_connection(@connection, conn_options)\n else\n # reuse an existing connection\n @connection = existing_connection\n end\n\n # set up trackig if it isn't set up already\n set_up_tracking if !tracking_tables?\n end", "def initialize(args)\n raise ArgumentError, \"Connection#new needs a Hash\" unless args.is_a? Hash\n raise ArgumentError, \"You must pass a Pod4::Interface\" \\\n unless args[:interface] \\\n && args[:interface].is_a?(Class) \\\n && args[:interface].ancestors.include?(Interface)\n\n @interface_class = args[:interface]\n @data_layer_options = nil\n @client = nil\n @options = nil\n end", "def connection_information\n super\n end", "def connection\n @connection ||= Oedipus::Connection.new(host: \"127.0.0.1\", port: 9399, verify: false)\n end", "def create_connection(region)\n \n # If we already have a connection object then return early.\n if @cf.has_key?(region) then\n return\n end\n\n debug(\"Creating new persistent aws connection for region #{region}.\") \n \n # Check this is a valid aws region.\n if not is_aws_region_name?(region)\n # If we don't have a region specified then the cloudformation endpoint will be malformed\n # resulting in networking errors.\n # Fail now with a proper error mesage.\n error_message = \"[cloudformation_backend]: AWS Region #{region} is invalid.\"\n Hiera.warn(error_message)\n raise Exception, error_message\n end\n\n # Create an AWS connecton object for this region.\n @cf[region] = AWS::CloudFormation.new(\n :access_key_id => @@aws_config['access_key_id'],\n :secret_access_key => @@aws_config['secret_access_key'],\n :region => region\n )\n end", "def initialize(params = {})\n @pid = Process.pid\n @data = Excon.defaults.dup\n # merge does not deep-dup, so make sure headers is not the original\n @data[:headers] = @data[:headers].dup\n\n # the same goes for :middlewares\n @data[:middlewares] = @data[:middlewares].dup\n\n @data.merge!(params)\n validate_params(:connection, @data, @data[:middlewares])\n\n if @data.key?(:host) && !@data.key?(:hostname)\n Excon.display_warning('hostname is missing! For IPv6 support, provide both host and hostname: Excon::Connection#new(:host => uri.host, :hostname => uri.hostname, ...).')\n @data[:hostname] = @data[:host]\n end\n\n setup_proxy\n\n if ENV.has_key?('EXCON_STANDARD_INSTRUMENTOR')\n @data[:instrumentor] = Excon::StandardInstrumentor\n end\n\n if @data[:debug] || ENV.has_key?('EXCON_DEBUG')\n @data[:debug_request] = @data[:debug_response] = true\n @data[:instrumentor] = Excon::StandardInstrumentor\n end\n\n if @data[:scheme] == UNIX\n # 'uri' >= v0.12.0 returns an empty string instead of nil for no host.\n # So treat the parameter as present if and only if it is both non-nill and non-empty.\n if @data[:host] && !@data[:host].empty?\n raise ArgumentError, \"The `:host` parameter should not be set for `unix://` connections.\\n\" +\n \"When supplying a `unix://` URI, it should start with `unix:/` or `unix:///`.\"\n elsif !@data[:socket]\n raise ArgumentError, 'You must provide a `:socket` for `unix://` connections'\n else\n @socket_key = \"#{@data[:scheme]}://#{@data[:socket]}\"\n end\n else\n @socket_key = \"#{@data[:scheme]}://#{@data[:host]}#{port_string(@data)}\"\n end\n reset\n end", "def initialize_connection(env)\n end", "def connection\n @connection || Connection.new\n end", "def initialize(connection_to_socket, args = {})\n @connection = connection_to_socket\n\n @user = args[:user]\n @password = args[:password]\n @name = args[:name]\n @storage = args[:storage]\n\n open\n end", "def initialize(connection, host, port, opts={})\n @connection = connection\n\n @host, @port = host, port\n\n # Pool size and timeout.\n @size = opts[:size] || 1\n @timeout = opts[:timeout] || 5.0\n\n # Operations to perform on a socket\n @socket_ops = Hash.new { |h, k| h[k] = [] }\n\n @all = []\n @reserved = {} # map of in-progress connections\n @available = [] # pool of free connections\n @pending = [] # pending reservations (FIFO)\n\n setup_pool!(host, port)\n end", "def new\n @host = Host.new\n end", "def create_connection(model)\n credentials = [@options[:socket] || @options.values_at(:host, :port)]\n Rufus::Tokyo::TyrantTable.new(*credentials.flatten)\n end", "def initialize(conn)\n\t\t\t@level = @poses = nil\n\t\t\t@conn = IridiumConnection.new\n\t\t\t@conn.register(self)\n\t\t\t@conn.connect(conn)\n\t\tend", "def create\n @connection = Connection.new(connection_params)\n\n respond_to do |format|\n if @connection.save\n format.html { redirect_to @connection, notice: 'Connection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @connection }\n else\n format.html { render action: 'new' }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end", "def connection(options = {})\n @connection ||= Net::SSH::Connection::Session.new(transport(options), options)\n end", "def initialize( name, conn )\n @conn = conn\n # RestAuth >> Server: Bug #6\n # username owning properties is case-sensitive\n @name = name.downcase \n end", "def initialize(connection_hash)\n @ole_connection = SQLOLE.get_connection\n @connection_hash = connection_hash || {}\n# TODO: move this base hash to the non-public method and return the full hash\n# look at refactoring the send method goodies\n @connection_params =\n {\n :provider => \"Provider=SQLOLEDB.1\",\n :library => \"Network Library=dbmssocn\"\n }\n set_connection_params(@connection_hash)\n end", "def mk_conn(path, headers = {})\n url = format('%s://%s%s', net[:scheme], net[:endpoint],\n [net[:api_base], path].uri_concat)\n Faraday.new(url: Addressable::URI.encode(url),\n headers: net[:headers].merge(headers))\n end", "def initialize(connection, type, local_id, max_pkt_size = T.unsafe(nil), max_win_size = T.unsafe(nil), &on_confirm_open); end", "def connection(options={})\n raise NoToken if @token.to_s.empty?\n\n @connections ||= {}\n\n cached_connection? && !protocol_changed? ? cached_connection : new_connection\n end", "def initialize(connection = nil)\n self.connection ||= connection || ParcelApi::Client.connection\n end", "def initialize(connection, aliases)\n @aliases = aliases\n @connection = connection\n end", "def create\n @connection = Connection.new(connection_params)\n\n respond_to do |format|\n if @connection.save\n format.html { redirect_to @connection, notice: \"Connection was successfully created.\" }\n format.json { render :show, status: :created, location: @connection }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end", "def connection\n @connection ||= KJess::Connection.new( host, port )\n end", "def connect(options = {})\n @connection ||= ::RbRouting::Connection.new(options)\n end", "def initialize(config: nil, connection: nil, context: nil)\n super(config: config, connection: connection, context: context)\n end", "def initialize(host = nil, port = ONKYO_PORT)\n if host == nil\n if first_rec = self.class.discover[0]\n host = first_rec[1]\n set_info first_rec[0]\n else\n raise Exception\n end\n end\n @host = Resolv.getaddress host\n @port = port\n unless @model\n set_info get_ecn\n end\n end", "def initialize(connection = nil)\n @connection = connection || PayTrace.configuration.connection\n end", "def initialize(server, username, password)\n @connection = Connection.new(server, username, password)\n end", "def new_connection(params)\n Pod4.logger.info(__FILE__){ \"Connecting to DB\" }\n client = TinyTds::Client.new(params)\n raise \"Bad Connection\" unless client.active?\n\n client.execute(\"use [#{self.class.db}]\").do\n\n client\n\n rescue => e\n handle_error(e)\n end", "def __build_connection(host, options={}, block=nil)\n client = ::Faraday::Connection.new(__full_url(host), options, &block)\n Connections::Connection.new :host => host, :connection => client\n end", "def build_connection(host, port, queue)\n begin\n connection = Connection.new(\n :host => host,\n :port => port,\n :queue => queue,\n :topic => topic,\n :channel => channel,\n :notifier => notifier,\n :features => connection_options[:features],\n :features_args => connection_options[:config],\n :callbacks => {\n :handle => {\n :actor => current_actor,\n :method => :process_message\n }\n }\n )\n queue.register_connection(connection)\n connection\n rescue => e\n error \"Failed to build connection (host: #{host} port: #{port} queue: #{queue}) - #{e.class}: #{e}\"\n debug \"#{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n nil\n end\n end", "def initialize(connection=nil)\n @connection ||= connection || ParcelApi::Client.connection\n end", "def initialize(connection=nil)\n @connection ||= connection || ParcelApi::Client.connection\n end", "def create_connection\n Fog::Compute.new({\n :provider => 'OpenStack',\n :openstack_api_key => @os_password,\n :openstack_username => @os_username,\n :openstack_auth_url => @os_auth_url,\n :openstack_tenant => @os_tenant,\n })\n rescue Excon::Errors::Unauthorized => ex\n @log.error 'Invalid OpenStack Credentials' + ex.message\n @log.error ex.backtrace\n exit 1\n rescue Excon::Errors::BadRequest => ex\n @log.error 'Malformed connection options' + ex.message\n if ex.response.body\n @log.error JSON.parse(ex.response.body)['badRequest']['message']\n end\n @log.error ex.backtrace\n end", "def initialize\n @connection = Bunny.new\n @connection.start\n @channel = @connection.create_channel\n end", "def create\n @connection = Connection.new(params[:connection])\n @connection.user = current_user\n @connection.database_type = 'mysql'\n\n if @connection.port.nil?\n @connection.port = '3306'\n end\n\n respond_to do |format|\n if @connection.save\n redirect_path = param(:redirect, connections_path)\n\n format.html { redirect_to redirect_path, notice: 'Connection was successfully created.' }\n format.json { render json: @connection, status: :created, location: @connection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end", "def connection(&blk)\n @connection ||= Connection.build endpoint.secret, &blk\n end", "def connection_for host, options = {}, &block\n connection = Connection.new(self, host, options)\n yield(connection) if block_given?\n connection\n end", "def description\n \"Derelict::Connection at '#{path}' using #{instance.description}\"\n end", "def connection\n\n @hash_connection = {\n :connection => {\n :domain => @domain,\n :store_id => @profile,\n :service_user => @seller_profile,\n :service_password => @password\n }\n }\n\n end", "def initialize(config = {})\n @connection = nil\n init_config(config)\n end", "def establish_connection\n end", "def connection\n return @connection if defined? @connection\n\n options = {\n request: {\n timeout: Nominatim.config.timeout\n }\n }\n\n @connection = Faraday.new Nominatim.config.endpoint, options do |builder|\n builder.use Nominatim::Response::ParseJson\n builder.adapter Faraday.default_adapter\n end\n\n @connection.params[:format] = 'json'\n @connection.params[:email] = Nominatim.config.email if Nominatim.config.email\n @connection.params[:key] = Nominatim.config.key if Nominatim.config.key\n\n @connection.headers[:user_agent] = Nominatim.config.user_agent\n @connection.headers[:\"accept-language\"] = Nominatim.config.accept_language\n\n @connection\n end", "def connection(refresh = false)\n if defined?(@connection) || superclass == Object\n @connection = Connection.new(site) if refresh || @connection.nil?\n @connection.namespace = namespace\n @connection.user = user if user\n @connection.password = password if password\n @connection\n else\n superclass.connection\n end\n end", "def initialize(connect_options)\n connect_options = keys_to_symbol(connect_options)\n\n raise ArgumentError, 'database adapter is required' unless connect_options.has_key?(:adapter)\n raise ArgumentError, 'database host is required' unless connect_options.has_key?(:host)\n raise ArgumentError, 'database port is required' unless connect_options.has_key?(:port)\n raise ArgumentError, 'database username is required' unless connect_options.has_key?(:username)\n raise ArgumentError, 'database password is required' unless connect_options.has_key?(:password)\n raise ArgumentError, 'database database is required' unless connect_options.has_key?(:database)\n\n if connect_options[:adapter].eql? \"mysql2\"\n @client = Mysql2::Client.new(\n host: connect_options[:host],\n port: connect_options[:port],\n username: connect_options[:username],\n password: connect_options[:password],\n database: connect_options[:database]\n )\n else\n raise ArgumentError, 'for a while only mysql2 adapter is supported'\n end\n \n end" ]
[ "0.7004096", "0.6789055", "0.677971", "0.66304564", "0.66045743", "0.6581394", "0.648485", "0.6459519", "0.64401376", "0.6385079", "0.6382361", "0.63795316", "0.6378691", "0.63023454", "0.6283964", "0.6256638", "0.6248066", "0.6243992", "0.6237161", "0.6209522", "0.62080103", "0.6191296", "0.6142177", "0.61330706", "0.6132609", "0.61291176", "0.6109301", "0.6067351", "0.60502666", "0.6029944", "0.59674174", "0.59648794", "0.5953024", "0.5890922", "0.5890159", "0.5887588", "0.5878594", "0.58727354", "0.5867942", "0.58140695", "0.57997334", "0.57977587", "0.57977587", "0.57977587", "0.57977587", "0.57920986", "0.5787377", "0.57735103", "0.57735103", "0.57698864", "0.57621753", "0.5754633", "0.57269275", "0.57154584", "0.57098746", "0.56988573", "0.56923854", "0.5692312", "0.568508", "0.5684787", "0.5682914", "0.5681809", "0.5677157", "0.56647545", "0.5658323", "0.56574893", "0.5652282", "0.565083", "0.5633715", "0.5625067", "0.56240827", "0.5617006", "0.56139445", "0.56078744", "0.56075805", "0.560599", "0.5605248", "0.5605242", "0.5605127", "0.5598547", "0.5596597", "0.5574207", "0.5572671", "0.5568994", "0.55674326", "0.55653363", "0.55652666", "0.55652666", "0.5549318", "0.55489886", "0.55476844", "0.5547678", "0.5546018", "0.554461", "0.5541874", "0.5538718", "0.55327255", "0.55307007", "0.55303925", "0.55296767" ]
0.59946674
30
Checks if the this entry is compatible with the given options. A connection is compatible if it the options that were used to create it are exactly the same than the given options.
def compatible?(opts) opts == @options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compatible?(other)\n false\n end", "def check_options\n unless @options[:stub]\n STDERR.puts \"Please specify a host to connect to using --host\" unless @options[:host]\n STDERR.puts \"Please specify a model to check using --model\" unless @options[:model]\n return false unless @options[:host] && @options[:model]\n end\n\n true\n end", "def same_options?(opts)\n opts.hash == options.hash\n end", "def same_options?(opts)\n opts.hash == options.hash\n end", "def same_options?(opts)\n opts.hash == options.hash\n end", "def same_options?(opts)\n opts.hash == options.hash\n end", "def same_options?(opts)\n opts.hash == options.hash\n end", "def same_options?(opts)\n opts.hash == options.hash\n end", "def same_options?(opts)\n opts.hash == options.hash\n end", "def same_options?(opts)\n opts.hash == options.hash\n end", "def same_options?(opts)\n opts.hash == options.hash\n end", "def same_options?(opts)\n opts.hash == options.hash\n end", "def same_options?(opts)\n opts.length == 0 || opts.hash == options.hash\n end", "def has_connection_fields?\n !!(connection_network_type && connection_address_type &&\n connection_address)\n end", "def has_connection_fields?\n !!(connection_network_type && connection_address_type &&\n connection_address)\n end", "def has_connection_fields?\n !!(connection_network_type && connection_address_type &&\n connection_address)\n end", "def check_options(options, *supported)\n unsupported = options.to_hash.keys - supported.flatten\n raise ArgumentError, \"No such option: #{unsupported.join(' ')}\" unless unsupported.empty?\n end", "def compatible?(mod)\n\t\tch = nil\n\n\t\t# Invalid module? Shoot, we can't compare that.\n\t\treturn true if (mod == nil)\n\n\t\t# Determine which hash to used based on the supplied module type\n\t\tif (mod.type == MODULE_ENCODER)\n\t\t\tch = self.compat['Encoder']\n\t\telsif (mod.type == MODULE_NOP)\n\t\t\tch = self.compat['Nop']\n\t\telsif (mod.type == MODULE_PAYLOAD)\n\t\t\tch = self.compat['Payload']\n\t\telse\n\t\t\treturn true\n\t\tend\n\n\t\t# Enumerate each compatibility item in our hash to find out\n\t\t# if we're compatible with this sucker.\n\t\tch.each_pair do |k,v|\n\n\t\t\t# Get the value of the current key from the module, such as\n\t\t\t# the ConnectionType for a stager (ws2ord, for instance).\n\t\t\tmval = mod.module_info[k]\n\n\t\t\t# Reject a filled compat item on one side, but not the other\n\t\t\treturn false if (v and not mval)\n\n\t\t\t# Track how many of our values matched the module\n\t\t\tmcnt = 0\n\n\t\t\t# Values are whitespace separated\n\t\t\tsv = v.split(/\\s+/)\n\t\t\tmv = mval.split(/\\s+/)\n\n\t\t\tsv.each do |x|\n\n\t\t\t\tdlog(\"Checking compat [#{mod.refname} with #{self.refname}]: #{x} to #{mv.join(\", \")}\", 'core', LEV_3)\n\n\t\t\t\t# Verify that any negate values are not matched\n\t\t\t\tif (x[0,1] == '-' and mv.include?(x[1, x.length-1]))\n\t\t\t\t\tdlog(\"Module #{mod.refname} is incompatible with #{self.refname} for #{k}: limiter was #{x}, value was #{mval}\", 'core', LEV_1)\n\t\t\t\t\treturn false\n\t\t\t\tend\n\n\t\t\t\tmcnt += 1 if mv.include?(x)\n\t\t\tend\n\n\t\t\t# No values matched, reject this module\n\t\t\tif (mcnt == 0)\n\t\t\t\tdlog(\"Module #{mod.refname} is incompatible with #{self.refname} for #{k}: limiter was #{v}, value was #{mval}\", 'core', LEV_1)\n\t\t\t\treturn false\n\t\t\tend\n\n\t\tend\n\n\t\t# If we get here, we're compatible.\n\t\treturn true\n\tend", "def compute_integrity?(options); end", "def compute_integrity?(options); end", "def validate_new_options!(opts)\n return Options::Redacted.new unless opts\n if opts[:read_concern]\n # Raise an error for non user-settable options\n if opts[:read_concern][:after_cluster_time]\n raise Mongo::Error::InvalidReadConcern.new(\n 'The after_cluster_time read_concern option cannot be specified by the user'\n )\n end\n\n given_keys = opts[:read_concern].keys.map(&:to_s)\n allowed_keys = ['level']\n invalid_keys = given_keys - allowed_keys\n # Warn that options are invalid but keep it and forward to the server\n unless invalid_keys.empty?\n log_warn(\"Read concern has invalid keys: #{invalid_keys.join(',')}.\")\n end\n end\n\n if server_api = opts[:server_api]\n unless server_api.is_a?(Hash)\n raise ArgumentError, \":server_api value must be a hash: #{server_api}\"\n end\n\n extra_keys = server_api.keys - %w(version strict deprecation_errors)\n unless extra_keys.empty?\n raise ArgumentError, \"Unknown keys under :server_api: #{extra_keys.map(&:inspect).join(', ')}\"\n end\n\n if version = server_api[:version]\n unless VALID_SERVER_API_VERSIONS.include?(version)\n raise ArgumentError, \"Unknown server API version: #{version}\"\n end\n end\n end\n\n Lint.validate_underscore_read_preference(opts[:read])\n Lint.validate_read_concern_option(opts[:read_concern])\n opts.each.inject(Options::Redacted.new) do |_options, (k, v)|\n key = k.to_sym\n if VALID_OPTIONS.include?(key)\n validate_max_min_pool_size!(key, opts)\n validate_max_connecting!(key, opts)\n validate_read!(key, opts)\n if key == :compressors\n compressors = valid_compressors(v)\n\n if compressors.include?('snappy')\n validate_snappy_compression!\n end\n\n if compressors.include?('zstd')\n validate_zstd_compression!\n end\n\n _options[key] = compressors unless compressors.empty?\n elsif key == :srv_max_hosts\n if v && (!v.is_a?(Integer) || v < 0)\n log_warn(\"#{v} is not a valid integer for srv_max_hosts\")\n else\n _options[key] = v\n end\n else\n _options[key] = v\n end\n else\n log_warn(\"Unsupported client option '#{k}'. It will be ignored.\")\n end\n _options\n end\n end", "def validate_options(options, attrs)\n matched_attrs = options.keys & attrs\n if matched_attrs.to_set != attrs.to_set\n raise HelpScoutDocs::Error::OptionsError.new(\"#{(attrs - matched_attrs).join(\", \")} required options are missing\")\n end\n end", "def actual_options?(options)\n return false if options.nil?\n\n if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?\n true\n else\n false\n end\n end", "def compatible_with?(other)\n composition == other.composition\n end", "def validate_options!(addresses = nil, is_srv: nil)\n if options[:write] && options[:write_concern] && options[:write] != options[:write_concern]\n raise ArgumentError, \"If :write and :write_concern are both given, they must be identical: #{options.inspect}\"\n end\n\n connect = options[:connect]&.to_sym\n\n if connect && !%i(direct replica_set sharded load_balanced).include?(connect)\n raise ArgumentError, \"Invalid :connect option value: #{connect}\"\n end\n\n if options[:direct_connection]\n if connect && connect != :direct\n raise ArgumentError, \"Conflicting client options: direct_connection=true and connect=#{connect}\"\n end\n # When a new client is created, we get the list of seed addresses\n if addresses && addresses.length > 1\n raise ArgumentError, \"direct_connection=true cannot be used with multiple seeds\"\n end\n # When a client is copied using #with, we have a cluster\n if cluster && !cluster.topology.is_a?(Mongo::Cluster::Topology::Single)\n raise ArgumentError, \"direct_connection=true cannot be used with topologies other than Single (this client is #{cluster.topology.class.name.sub(/.*::/, '')})\"\n end\n end\n\n if options[:load_balanced]\n if addresses && addresses.length > 1\n raise ArgumentError, \"load_balanced=true cannot be used with multiple seeds\"\n end\n\n if options[:direct_connection]\n raise ArgumentError, \"direct_connection=true cannot be used with load_balanced=true\"\n end\n\n if connect && connect != :load_balanced\n raise ArgumentError, \"connect=#{connect} cannot be used with load_balanced=true\"\n end\n\n if options[:replica_set]\n raise ArgumentError, \"load_balanced=true cannot be used with replica_set option\"\n end\n end\n\n if connect == :load_balanced\n if addresses && addresses.length > 1\n raise ArgumentError, \"connect=load_balanced cannot be used with multiple seeds\"\n end\n\n if options[:replica_set]\n raise ArgumentError, \"connect=load_balanced cannot be used with replica_set option\"\n end\n end\n\n if options[:direct_connection] == false && connect && connect == :direct\n raise ArgumentError, \"Conflicting client options: direct_connection=false and connect=#{connect}\"\n end\n\n %i(connect_timeout socket_timeout).each do |key|\n if value = options[key]\n unless Numeric === value\n raise ArgumentError, \"#{key} must be a non-negative number: #{value}\"\n end\n if value < 0\n raise ArgumentError, \"#{key} must be a non-negative number: #{value}\"\n end\n end\n end\n\n if value = options[:bg_error_backtrace]\n case value\n when Integer\n if value <= 0\n raise ArgumentError, \":bg_error_backtrace option value must be true, false, nil or a positive integer: #{value}\"\n end\n when true\n # OK\n else\n raise ArgumentError, \":bg_error_backtrace option value must be true, false, nil or a positive integer: #{value}\"\n end\n end\n\n if libraries = options[:wrapping_libraries]\n unless Array === libraries\n raise ArgumentError, \":wrapping_libraries must be an array of hashes: #{libraries}\"\n end\n\n libraries = libraries.map do |library|\n Utils.shallow_symbolize_keys(library)\n end\n\n libraries.each do |library|\n unless Hash === library\n raise ArgumentError, \":wrapping_libraries element is not a hash: #{library}\"\n end\n\n if library.empty?\n raise ArgumentError, \":wrapping_libraries element is empty\"\n end\n\n unless (library.keys - %i(name platform version)).empty?\n raise ArgumentError, \":wrapping_libraries element has invalid keys (allowed keys: :name, :platform, :version): #{library}\"\n end\n\n library.each do |key, value|\n if value.include?('|')\n raise ArgumentError, \":wrapping_libraries element value cannot include '|': #{value}\"\n end\n end\n end\n end\n\n if options[:srv_max_hosts] && options[:srv_max_hosts] > 0\n if options[:replica_set]\n raise ArgumentError, \":srv_max_hosts > 0 cannot be used with :replica_set option\"\n end\n\n if options[:load_balanced]\n raise ArgumentError, \":srv_max_hosts > 0 cannot be used with :load_balanced=true\"\n end\n end\n\n unless is_srv.nil? || is_srv\n if options[:srv_max_hosts]\n raise ArgumentError, \":srv_max_hosts cannot be used on non-SRV URI\"\n end\n\n if options[:srv_service_name]\n raise ArgumentError, \":srv_service_name cannot be used on non-SRV URI\"\n end\n end\n end", "def match?(options)\n options.all? { |key, value| self[key] == value }\n end", "def queue_valid?(options = to_options)\n Retain::Cq.valid?(retain_user_connection_parameters, options)\n end", "def options_ok?\n end", "def convert_options?\n !@convert_options.nil? && !@convert_options.empty?\n end", "def eql?(other)\n self.class.equal?(other.class) &&\n @command == other.command &&\n @options == other.options\n end", "def valid_connection?\n @connection && @connection.valid?\n end", "def compare(object, options)\n options.keys.each do |key|\n return false unless object[key] == options[key]\n end\n\n true\n end", "def validate_options!(_options)\n raise(NotImplemetedError, \"subclass responsability\")\n end", "def check(tile_1, tile_2, direction)\n @compatibilities.include?([tile_1, tile_2, direction])\n end", "def compatible?(other_definition)\n return true if meta_data.nil? && other_definition.meta_data.nil?\n return true if meta_data && meta_data.same_keys?(other_definition.meta_data)\n false\n end", "def validate_options!(options)\n if options[:chef_api] == :config\n return true\n end\n\n missing_options = [:node_name, :client_key] - options.keys\n\n unless missing_options.empty?\n missing_options.collect! { |opt| \"'#{opt}'\" }\n msg = \"Source '#{name}' is a 'chef_api' location with a URL for it's value\"\n msg << \" but is missing options: #{missing_options.join(', ')}.\"\n\n raise Berkshelf::InvalidChefAPILocation, msg\n end\n\n self.class.validate_node_name!(options[:node_name])\n self.class.validate_client_key!(options[:client_key])\n self.class.validate_uri!(options[:chef_api])\n end", "def bump_option?(options)\n options[:major] || options[:minor] || options[:patch] || options[:commit] || options[:preid] || options[:release]\n end", "def valid?(options)\n (@required_options - options.keys).size == 0\n end", "def adapter_supported?(a = cache_conn_instance.get(cache_name).class)\n return !unsupported_adapters.include?(a)\n end", "def options?\n options.is_a?(Hash)\n end", "def validate_options!(options)\n return if options[:help] || options[:version]\n validate_date(options)\n raise MissingArgument, \"--repository or --config\" unless\n options[:repository] || options[:config]\n end", "def validate_options(options)\n unless options.kind_of?(Hash)\n raise ArgumentError, \"You must pass a Hash, not: #{options.inspect}\"\n end\n\n options.assert_valid_keys(:visibility, :prefix, :delegate, :unknown_fields, :compress, :header)\n\n unless [ nil, :private, :public ].include?(options[:visibility])\n raise ArgumentError, \"Invalid value for :visibility: #{options[:visibility.inspect]}\"\n end\n\n unless [ :delete, :preserve, nil ].include?(options[:unknown_fields])\n raise ArgumentError, \"Invalid value for :unknown_fields: #{options[:unknown_fields].inspect}\"\n end\n\n unless [ true, false, nil ].include?(options[:compress]) || options[:compress].kind_of?(Integer)\n raise ArgumentError, \"Invalid value for :compress: #{options[:compress].inspect}\"\n end\n\n unless [ true, false, nil ].include?(options[:header])\n raise ArgumentError, \"Invalid value for :header: #{options[:header].inspect}\"\n end\n\n case options[:prefix]\n when nil then nil\n when String, Symbol then nil\n else raise ArgumentError, \"Invalid value for :prefix: #{options[:prefix].inspect}\"\n end\n\n unless [ nil, true, false, :private, :public ].include?(options[:delegate])\n raise ArgumentError, \"Invalid value for :delegate: #{options[:delegate].inspect}\"\n end\n\n if options[:visibility] == :private && options[:delegate] == :public\n raise ArgumentError, \"You can't have public delegation if methods in the flex column are private; this makes no sense, as methods in the model class would have *greater* visibility than methods on the flex column itself\"\n end\n end", "def valid?(options = {})\n options = normalize_options(options)\n validate(options)\n return true\n rescue\n false\n end", "def valid?(_options = {})\n latest? || semantic? || timestamp?\n end", "def check_compatibility\n linux = '0'\n windows = '0'\n mac = '0'\n\n versions.each do |v|\n compat = v.check_compat\n linux = v.check_linux(compat)\n windows = v.check_windows(compat)\n mac = v.check_mac(compat)\n end\n\n compatibility = linux + windows + mac\n update compatibility: compatibility\n end", "def supports_options?\n return true\n end", "def sh_opts_equal?( o1, o2 )\n SH_OPT_KEYS.each do |k|\n return false if o1[k] != o2[k]\n end\n true\n end", "def check_opts(opts)\n raise ArgumentError, 'null_replacement option cannot contain single quotes' if opts[:null_replacement] && opts[:null_replacement].include?(\"'\")\n raise ArgumentError, 'truncation_length must be an integer' if opts[:truncation_length] && !opts[:truncation_length].is_a?(Integer)\n end", "def supports_insert_conflict?\n server_version >= 90500\n end", "def validate_comparison_options(args, options)\n\n if args.empty?\n $stderr.puts(\"You have to provide benchmark files (*.csv) to analyze.\")\n exit!\n end\n\n if options.recwindow < 0\n $stderr.puts(\"Error in --recwindow flag: TCP standard receive window must be >= 0 bytes.\\n\")\n exit!\n end\n\n if options.yaxis_max < 0\n $stderr.puts(\"Error in --yaxis_max flag: Maximum value on yaxis must be >= 0.\\n\")\n end\n\n if options.xaxis_max < 0\n $stderr.puts(\"Error in --xaxis_max flag: Maximum value on xaxis must be >= 0.\\n\")\n exit!\n end\n\n if options.xaxis_steps <= 0\n $stderr.puts(\"Error in --xaxis_steps flag: You must provide a positive step > 0.\\n\")\n exit!\n end\n\nend", "def validate_opts(opts)\n e = Exceptions::InvalidOptions\n raise(e, 'Is not Hash-like') unless opts.respond_to?(:[]) && opts.respond_to?(:key?)\n\n validate_server(opts[:server])\n if opts.key?(:base_uri)\n begin\n URI.parse(opts[:base_uri])\n rescue URI::InvalidURIError => e\n raise(e, \"Invalid base_uri: #{e}\")\n end\n end\n\n validate_creds(opts, e)\n true\n end", "def has_options?(opts = {})\n opts.each do |key, value|\n this_value = self[key.to_sym]\n return false if (this_value != value)\n end\n return true\n end", "def validate_options(options)\n raise TypeError.new(\"provided options must be a Hash\") unless options.is_a?(Hash)\n check_for_illegal_keys!(options)\n options = set_deduct_call_time_based_on_metric(DEFAULT_SETTINGS.merge(options))\n check_for_push_scope_and_metric(options)\n options\n end", "def validate_opts(opts)\n e = Exceptions::InvalidOptions\n raise(e, 'Is not Hash-like') unless opts.respond_to?(:[]) && opts.respond_to?(:key?)\n validate_server(opts[:server])\n if opts.key?(:base_uri)\n begin\n URI.parse(opts[:base_uri])\n rescue URI::InvalidURIError => e\n raise(e, \"Invalid base_uri: #{e}\")\n end\n end\n\n validate_creds(opts, e)\n true\n end", "def options_changeable?\n network_state = @model_net_data.network_state\n if network_state == :state_on_localgame or\n network_state == :state_on_netgame\n return false\n else\n return true\n end\n end", "def validate_options(options, klass)\n raise(ArgumentError, \"Options cannot be \" + options.class.name) unless options.is_a?(klass) || options.is_a?(Hash)\n options.is_a?(Glassfrog::Base) ? options.hashify : options\n end", "def cross_schema_support?\n @cross_schema_support ||= (config[:adapter] =~ /(mysql)|(postgres)|(sqlserver)/i)\n end", "def invalid_options?\n options[:api_key].nil? || options[:blog].nil?\n end", "def compatible_with?(sub_request)\n CompatibilityEngine.compute_compatibility(self, sub_request)\n end", "def validate_holding_options!(options)\n unpermitted_params = []\n required_params = {}\n\n case holding_opts[:on_hand_type]\n when :closed\n required_params[:amount] = [Integer]\n when :open\n required_params[:amount] = [Integer]\n when :none\n unpermitted_params << :amount\n end\n\n # Actual validation\n unpermitted_params = unpermitted_params.select { |p| options.key?(p) }\n .map { |p| \"'#{p}'\" }\n\n wrong_types = required_params\n .select { |k, v| options.key?(k) && v.select { |type| options[k].is_a?(type) }.length.zero? }\n .map { |k, v| \"'#{k}' must be a '#{v.join(' or ')}' but '#{options[k].class}' found\" }\n\n required_params = required_params.reject { |k, _v| options.key?(k) }\n .map { |k, _v| \"'#{k}'\" }\n\n # Raise OptionsInvalid if some invalid parameters were found\n if (unpermitted_params.length + required_params.length + wrong_types.length).positive?\n message = ''\n message << \" unpermitted parameters: #{unpermitted_params.join(',')}.\" unless unpermitted_params.empty?\n message << \" missing parameters: #{required_params.join(',')}.\" unless required_params.empty?\n message << \" parameters type mismatch: #{wrong_types.join(',')}\" unless wrong_types.empty?\n raise ActsAsHoldable::OptionsInvalid.new(self, message)\n end\n true\n end", "def compatible?(subject, schema, version = 'latest')\n response = post \"/compatibility/subjects/#{subject}/versions/#{version}\",\n expects: [200, 404],\n body: { schema: schema.to_s }\n data = response.to_json\n data.fetch('is_compatible', false) unless data.key?('error_code')\n end", "def supports_deferrable_constraints?\n server_version >= 90000\n end", "def check_option_support\n assert_option_supported(:foodcritic) &&\n assert_option_supported(:scmversion, 'thor-scmversion') &&\n assert_default_supported(:no_bundler, 'bundler')\n end", "def available?\n options[:force] || true\n end", "def compatible_handoff?(other)\n (normal? and other.normal?) or\n ((not normal?) and (not other.normal?))\n end", "def check_validity!\n keys = CHECKS.keys\n options.slice(*keys).each do |option, value|\n next if is_time?(value) || value.is_a?(Proc) || value.is_a?(Symbol) || (defined?(ActiveSupport::TimeWithZone) and value.is_a? ActiveSupport::TimeWithZone)\n raise ArgumentError, \":#{option} must be a time, a date, a time_with_zone, a symbol or a proc\"\n end\n end", "def eql?(other)\n self.class == other.class &&\n self.url == other.url &&\n fuzzy_hash_eql?(self.options, other.options)\n end", "def non_sql_option?(key)\n super || key == :cursor || key == :insert_conflict\n end", "def can?(source, target)\n !conversions[source, target].nil?\n rescue NoTypeConversionAvailableError\n false\n end", "def check_options_requirements(runtime_options)\n required_options = options[:requires] || options[:require]\n return true unless required_options\n\n ([required_options].flatten - runtime_options.keys).size == 0\n end", "def ==(obj)\n unless self.compatible? obj\n raise ArgumentError, \"first argument (#{self}) must be compatible with second argument (#{obj}) in order to compare them.\"\n end\n \n \n end", "def validate_options\n true\n end", "def validate_options(api, options = {})\n options = options.symbolize_keys\n version_args = ARGS[@version.to_sym]\n \n if !version_args\n raise ArgumentError.new(\"Invalid version API call: #{@version}, #{api}\")\n elsif version_args.has_key?(api) && !Set.new(options.keys).subset?(version_args[api])\n raise ArgumentError.new(\"Valid options for #{api} are: #{version_args[api].to_a.join(', ')}, provided: #{options.keys.join(', ')}\")\n end\n end", "def validate_options!(options)\n unless @config.environments.include?(options[:environment].downcase.to_sym)\n say \"Invalid environment. Run `#{$0} environments` for a list of available environments.\", :red\n abort\n end\n\n unless @config.browsers.include?(options[:browser].downcase.to_sym)\n say \"Invalid browser. Run `#{$0} browsers` for a list of available browsers.\", :red\n abort\n end\n end", "def validate_options(options = {})\n base_unity_url = options.fetch(:base_unity_url, @base_unity_url)\n username = options.fetch(:username, @username)\n password = options.fetch(:password, @password)\n appname = options.fetch(:appname, @appname)\n\n raise ArgumentError, 'base_unity_url can not be nil' if base_unity_url.nil?\n raise ArgumentError, 'username can not be nil' if username.nil?\n raise ArgumentError, 'password can not be nil' if password.nil?\n raise ArgumentError, 'appname can not be nil' if appname.nil?\n end", "def connection_in_info?\n info.respond_to?(:ood_connection_info)\n end", "def option_combinations_valid?\n # TO DO - implement your real logic here\n true \n end", "def check_unknown_options?(config) #:nodoc:\n options = check_unknown_options\n return false unless options\n\n command = config[:current_command]\n return true unless command\n\n name = command.name\n\n if subcommands.include?(name)\n false\n elsif options[:except]\n !options[:except].include?(name.to_sym)\n elsif options[:only]\n options[:only].include?(name.to_sym)\n else\n true\n end\n end", "def validate_options(opts)\n unless opts.branch_regex || opts.tag_regex\n # If git branches/tags are given, the source path might exist in the branch/tag, thus only check this\n # for non-git executions\n raise OptionParser::InvalidArgument, \"Could not find source path #{opts.srcdir}\" unless opts.srcdir.exist?\n end\n\n if opts.web_path\n raise OptionParser::InvalidArgument, \"The '-w/--web-path' flag is DEPRECATED. Use the --server-css-path and --server--search-path flags instead.\"\n end\n\n if opts.server_css && (opts.resource_dir || opts.style_name)\n raise OptionParser::InvalidArgument, \"The '-w' flag can not be used with either of the '-r' or '-s' flags\"\n end\n\n if opts.server_css && opts.format != \"html\"\n raise OptionParser::InvalidArgument, \"The '-w' flag can only be used for the 'html' format flags\"\n end\n\n if opts.style_name && opts.resource_dir.nil?\n raise OptionParser::InvalidArgument, \"The '-s' flag requires the use of the '-r' flag as well.\"\n end\n\n # if opts.resource_dir.nil? ^ opts.style_name.nil?\n # raise OptionParser::InvalidArgument, \"Either both '-s' and '-r' flags must be given or none of them.\"\n # end\n\n if opts.resource_dir && !opts.resource_dir.exist?\n raise OptionParser::InvalidArgument, \"Could not find resource path #{opts.resource_dir}\"\n end\n\n if opts.make_searchable && opts.format != \"html\"\n raise OptionParser::InvalidArgument, \"Error: The --make-searchable option \" \\\n \"is only supported for html rendering.\"\n end\n\n if opts.search_action_path && !opts.make_searchable\n raise OptionParser::InvalidArgument, \"Error: The --server-search-path \" \\\n \"flag is only supported in combination with the --make-searchable (-m) flag.\"\n end\n end", "def compatible?(target)\n quantity == target.quantity\n end", "def equals(other)\n return false if not super(other)\n return self.opts == other.opts\n end", "def convert_to_openstruct?(options) # :nodoc:\n @@use_openstruct ? Options.new(options) : options\n end", "def validate_options(options)\n options.assert_valid_keys(:visibility, :null, :enum, :limit, :json)\n\n case options[:visibility]\n when nil then nil\n when :public then nil\n when :private then nil\n else raise ArgumentError, \"Invalid value for :visibility: #{options[:visibility].inspect}\"\n end\n\n case options[:json]\n when nil, String, Symbol then nil\n else raise ArgumentError, \"Invalid value for :json: #{options[:json].inspect}\"\n end\n\n unless [ nil, true, false ].include?(options[:null])\n raise ArgumentError, \"Invalid value for :null: #{options[:null].inspect}\"\n end\n end", "def validate_option_keys(options)\n raise TinyDyno::Errors::HashKeyOnly.new(klass: self.class, name: 'primary_key') if primary_key.nil?\n options.keys.each do |key|\n raise TinyDyno::Errors::InvalidSelector.new(klass: self.class, name: key) unless valid_field_selector?(field_name: key.to_s)\n end\n end", "def allow_inconsistency?\n @allowed_inconsistencies ||= (@result_set.size * @options[:error_pct]).floor\n if @allowed_inconsistencies > 0\n @allowed_inconsistencies -= 1\n true\n else\n false\n end\n end", "def option_configs_valid?\n self.class.options_provider.configs_valid?(self)\n end", "def check_hash_options(options)\r\n raise TransactionSupportError, \"Options is nil\" if options.nil?\r\n opt = options.kind_of?(::HashWithIndifferentAccess) ? options : options.symbolize_keys\r\n\r\n [:pos_id, :session_id, :ts, :sig].each do |key|\r\n raise TransactionSupportError, \"There is no value for key='#{key}'\" unless options.has_key?(key.to_s)\r\n end\r\n # sprawdzenie czy pos_id jest mi znany\r\n raise TransactionSupportError, \"Given pos_id='#{opt[:pos_id]}' is not valid\" unless @parameters.pos_id.to_a.include?(opt[:pos_id])\r\n\r\n # sprawdzenie poprawnosci podpisu\r\n local_sign = sign(opt[:pos_id], opt[:session_id], opt[:ts], @parameters.key2)\r\n raise TransactionSupportError, \"Wrong sign\" if local_sign!=opt[:sig]\r\n end", "def supports_option_version_downgrade\n data.supports_option_version_downgrade\n end", "def options?\n @supports_options\n end", "def valid?\n return false unless @adapter\n if sqlite_adapter?\n return true if @database\n else\n return super\n end\n false\n end", "def sanitize_opts!\n @opts.each_key do |key|\n unless VALID_OPTS.include? key\n raise Monga::Exceptions::InvalidClientOption, \"`#{key}` is invalid option for Client. Following options are valid: #{VALID_OPTS * ', '}\"\n end\n end\n end", "def compatible?(other_oriented_from, other_oriented_to, other_overlap = [],\n equivalent = true)\n other_overlap = other_overlap.to_cigar\n is_direct = compatible_direct?(other_oriented_from, other_oriented_to,\n other_overlap)\n if is_direct\n return true\n elsif equivalent\n return compatible_reverse?(other_oriented_from, other_oriented_to,\n other_overlap)\n else\n return false\n end\n end", "def ==(o)\n o.is_a?(self.class) && db == o.db && opts == o.opts\n end", "def compatible?(other_oriented_from, other_oriented_to, other_overlap = [],\n equivalent = true)\n other_overlap = other_overlap.to_cigar\n is_direct = compatible_direct?(other_oriented_from, other_oriented_to,\n other_overlap)\n if is_direct\n return true\n elsif equivalent\n return compatible_complement?(other_oriented_from, other_oriented_to,\n other_overlap)\n else\n return false\n end\n end", "def eql?(other)\n self.class == other.class &&\n self.base_url == other.base_url &&\n fuzzy_hash_eql?(self.options, other.options)\n end", "def connection_valid?\n if status.untested? or (changed? and (changes.keys & @@status_fields).empty?)\n begin\n test_connection\n status.success!\n rescue => e\n error_str = map_connection_exception_to_error(e)\n status.fail!(error_str)\n end\n end\n status.success?\n end", "def arguments_valid?\n return false if (@options[:partition_class] and @options[:rmcls])\n\n if @options[:rmcls]\n return false unless (@options[:cls_file] and @options[:lrn_file])\n elsif @options[:partition_class]\n return false unless (@options[:cls_file] and @options[:name_file] and @options[:fasta_file])\n end\n true\n end", "def validate\n opts = options.dup\n opts[0] = \"1\"\n set(options: opts)\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n opt_id == o.opt_id &&\n wallet_payer == o.wallet_payer &&\n wallet_receiver == o.wallet_receiver &&\n total_amount == o.total_amount &&\n commission_amount == o.commission_amount &&\n comment == o.comment &&\n return_url == o.return_url &&\n cancel_url == o.cancel_url &&\n error_url == o.error_url &&\n first_name_payer == o.first_name_payer &&\n last_name_payer == o.last_name_payer &&\n email_payer == o.email_payer &&\n style == o.style &&\n atos_style == o.atos_style &&\n notif_url == o.notif_url &&\n options == o.options\n end", "def valid?\n return false if @info.nil?\n return false if @schema_version.nil?\n true\n end" ]
[ "0.6074165", "0.6045599", "0.56833667", "0.56833667", "0.56833667", "0.56833667", "0.56833667", "0.56833667", "0.56833667", "0.56833667", "0.56833667", "0.56833667", "0.561666", "0.5525309", "0.5525309", "0.5525309", "0.5499034", "0.544034", "0.54343796", "0.54343796", "0.5421998", "0.53785706", "0.5375716", "0.5367066", "0.53389746", "0.53240407", "0.5314657", "0.5313621", "0.53088844", "0.5298522", "0.5256184", "0.52249384", "0.52205753", "0.5187868", "0.51840025", "0.5182177", "0.51232344", "0.512225", "0.5118448", "0.5115233", "0.51043093", "0.5086016", "0.5069297", "0.5065902", "0.5058479", "0.5056446", "0.5053189", "0.50528526", "0.503928", "0.50326085", "0.5021285", "0.501596", "0.50156575", "0.50044125", "0.50040835", "0.50027525", "0.49993813", "0.4995766", "0.49865755", "0.49826849", "0.49499655", "0.49482083", "0.4945592", "0.4929063", "0.49240637", "0.49230203", "0.49212068", "0.49159265", "0.4900145", "0.4871291", "0.4865044", "0.48615962", "0.486117", "0.48498598", "0.48475632", "0.4832097", "0.48300052", "0.48210692", "0.48190898", "0.48035866", "0.48013538", "0.47988474", "0.47934538", "0.47906622", "0.47899887", "0.47883165", "0.47876963", "0.47824717", "0.47817132", "0.4776138", "0.4774078", "0.4772764", "0.47707185", "0.4768946", "0.4768734", "0.47682628", "0.47662205", "0.47537762", "0.47504753", "0.47430843" ]
0.75475293
0
Checks if it is time to purge connections that correspond to EMSs that no longer exist in the database.
def purge? Time.current - @purge_time > @purge_interval end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purge\n # Get the identifiers of the EMS from the database and from the registry, and calculate the difference:\n database_ids = ManageIQ::Providers::Ovirt::InfraManager.pluck(:id)\n registry_ids = @registry.keys\n purged_ids = registry_ids - database_ids\n\n # Close the connections:\n purged_ids.each do |id|\n $rhevm_log.info(\n \"The EMS with identifier '#{id}' no longer exists in the database, the connection will be closed.\"\n )\n close(id)\n end\n\n # Update the purge time:\n @purge_time = Time.current\n end", "def cleanup\n delete!\n return true\n rescue PoolNode::Conflict\n # still in use\n return false\n end", "def check_connection_health\n begin\n seeds = @connection['config']['mongos'].find.to_a.map{|doc| doc['_id']}\n if @seeds != seeds\n @seeds = seeds\n @refresh_required = true\n end\n rescue Mongo::OperationFailure\n @refresh_required = true\n end\n end", "def check_idle_servers!\n\t\tmust_not_be_in_synchronize_block\n\t\t@lock.synchronize do\n\t\t\t@next_cleaning_time = Time.now - 60 * 60\n\t\t\t@cond.signal\n\t\tend\n\tend", "def outdated?\n Time.now - @last_used > MAX_CONN_AGE\n end", "def cleanup\n Authie.notify(:cleanup) do\n # Invalidate transient sessions that haven't been used\n active.where('expires_at IS NULL AND last_activity_at < ?',\n Authie.config.session_inactivity_timeout.ago).each(&:invalidate!)\n # Invalidate persistent sessions that have expired\n active.where('expires_at IS NOT NULL AND expires_at < ?', Time.now).each(&:invalidate!)\n end\n true\n end", "def eligable_for_cleanup?(server)\n\t\treturn server.max_idle_time && server.max_idle_time != 0\n\tend", "def graceful_shutdown_check\n EventMachine.next_tick do\n count = EventMachine.connection_count\n if count == 0\n EventMachine.stop_event_loop\n else\n @wait_count ||= count\n Thread.new{ logger.info \"Waiting for #{EventMachine.connection_count} connections to finish.\" if @wait_count != count }\n EventMachine.next_tick self.method(:graceful_shutdown_check)\n end\n end\n end", "def cleanup_feeds()\n status = Status.get_status('feed_item_cleanup')\n last_update = Time.at(status.value.to_i).to_i\n now = Time.now.to_i\n if (last_update + (24*60*60) < now)\n # Save the new status time first, since this could be a long cleanup.\n status.value = now.to_s\n status.save\n\n puts \"Running garbage collection on feeds_items table.\"\n delete_count = 0;\n FeedsItems.find_each(:batch_size => 2000) do |feed_item|\n unless feed_item.feed.user_id.nil? \n user = feed_item.feed.user rescue user = nil\n item = feed_item.item rescue item = nil\n if user.nil? || item.nil? || !item.acl_check?(user)\n puts \"Destroying: #{feed_item.inspect}\"\n feed_item.destroy\n delete_count = delete_count + 1\n end\n end\n end\n puts \"Done. Delete #{delete_count} feeds_items.\"\n else\n puts \"Skipping GC of feeds_items table.\"\n end\n end", "def dropped?\n return (@terminate_count != nil)\n end", "def purge_old\n @db.execute \"DELETE FROM requests WHERE first_seen < ?\", $config.periodic['purge'].minutes.ago.to_i\n end", "def routing_table_aged?\n @mutex.with_read_lock { @routing_table.has_been_stale_for?(@routing_table_purge_delay) }\n end", "def remove_expired_nodes(node_expire_timeout)\n node_array = get_data.fetch_all_objects(:node)\n node_array.each { |node|\n next if node_status(node) == \"bound\"\n elapsed_time = Time.now.to_i - node.timestamp.to_i\n if elapsed_time > node_expire_timeout\n node_uuid = node.uuid\n if get_data.delete_object(node)\n logger.info \"expired node '#{node_uuid}' successfully removed from db\"\n else\n logger.info \"expired node '#{node_uuid}' could not be removed from db\"\n end\n end\n }\n end", "def verify_active_connections! #:nodoc:\n clear_stale_cached_connections!\n @connections.each do |connection|\n connection.verify!\n end\n end", "def purge\n limit = Time.now.to_i - (@conf[:obsolete] * 60) # conf in minutes\n\n @db.execute(\"DELETE FROM #{@dataset} WHERE timestamp < #{limit}\")\n end", "def check_connection_state\n # Has the connection been established in the meantime? If yes, shut\n # down the work queues thread, all work will be done in this thread \n # from now on. \n if cached_connection_established?\n @work_queue.shutdown\n end\n end", "def clean_db\n Mongoid::Sessions.default.collections.select {|c| c.name !~ /system/}.each {|c| c.find.remove_all}\n end", "def is_stale?\n remaining() > @lifetime\n end", "def resurrect_dead_connections!\n connections.dead.each { |c| c.resurrect! }\n end", "def purge?\n return false unless current_backend\n current_backend != fresh_backend\n end", "def flush_expired\n if gc_last && gc_time && gc_last+gc_time <= Time.now\n flush_expired!\n end\n end", "def purge_expired_workers\n @services.purge_expired_workers\n end", "def clean_subscriptions\n\t if @subscription = self.subscription\n\t \tunless @subscription.active?\n\t \t recatch_time = ((Time.now - @subscription.deactivated_at) / 1.hour).round\n\t \t if recatch_time > 24 \n\t \t \t@subscription.remove\n\t \t end\n\t \tend\n\t end\n\tend", "def cleanup\n return if @max_age == 0\n timeout = Time.now - @max_age\n conditions = ['last_send_attempt > 0 and created_on < ?', timeout]\n mail = ActionMailer::Base.email_class.destroy_all conditions\n\n log \"expired #{mail.length} emails from the queue\"\n end", "def cleanup_connections\n @connections.keep_if do |thread, conns|\n thread.alive?\n end\n end", "def clean\n @lock.synchronize do\n now = Time.now\n dtime = Global.tuple_space_disconnection_time\n @tuple_space.delete_if {|_, holder| (now - holder[:last_time]) > dtime}\n end\n end", "def will_expire_on\n cfm = AWS::CloudFormation.new # calling aws cloudformation api\n if self.users.length > 0 # users length is more then 0\n self.users.each do |user| \n if user.stacks.length > 0\n user.stacks.each do |stack|\n stackaws = cfm.stacks[\"#{stack.stack_name}\"] # get that stack from aws \n if stackaws.exists? \n stackaws.delete # delete that aws stack\n sleep (1) # delay or sleep for 1 second\n end\n stack.destroy # delete that stack now from database\n end\n end\n end\n end\t\n end", "def destroy_all\n c = self.get_connection\n c.servers.each do |s|\n server = c.get_server(s[:id])\n if !server.delete!\n Rails.logger.error \"Unable to delete server on backend: #{server.inspect}\"\n return false\n end\n end\n self.instances.each do |i|\n if not i.update_attributes(:deployment_completed => false, :deployment_started => false, :reachable => false)\n Rails.logger.error \"Unable to update instance after destroying on backend: #{i.inspect}\"\n return false\n end\n end\n return true\n end", "def destroy_all\n c = self.get_connection\n c.servers.each do |s|\n server = c.get_server(s[:id])\n if !server.delete!\n Rails.logger.error \"Unable to delete server on backend: #{server.inspect}\"\n return false\n end\n end\n self.instances.each do |i|\n if not i.update_attributes(:deployment_completed => false, :deployment_started => false, :reachable => false)\n Rails.logger.error \"Unable to update instance after destroying on backend: #{i.inspect}\"\n return false\n end\n end\n return true\n end", "def expired?\n !@conn_expires_at || @conn_expires_at < Time.now\n end", "def outstanding?(config, connection)\r\n db_hash(config, connection) ? false : true\r\n end", "def collect_garbage!\n find_including_new_records(:all, :conditions => ['as_new = ? AND created_at < ?', true, Time.now - 1.week]).each(&:destroy)\n end", "def connection_timeout?(ttl)\n @tasks.synchronize {\n __connection_timeout?(ttl)\n }\n end", "def cleanup_abandoned\n Reservation.all(:conditions => [ \"CONFIRM = ? and updated_at < ? and archived = ?\", false, 30.minutes.ago, false]).each do |r|\n debug \"cleanup_abandoned: deleting #{r.id}\"\n Reason.close_reason_is \"abandoned\"\n begin\n\tr.archive\n rescue RuntimeError => err\n\terror 'Cleanup: ' + err.to_s\n rescue ActiveRecord::StaleObjectError => err\n\terror 'Cleanup: ' + err.to_s\n\tlocking_error(r)\n end\n end\n end", "def delete_all_active_connections\n super\n end", "def cleanup\n\t\tcurrent_time = current_date_time\n\n\t\tputs current_time\n\n\t\t# delete all sessions that are older than 30 minutes\n\t\tActiveRecord::Base.connection.execute(\"DELETE FROM sessions WHERE updated_at < '#{current_time}'\")\n\tend", "def del?(con)\n con.del(unique_check_key) == 1\n end", "def offline?\n return (Time.now - self.time_of_last_connection) > threshold_for_offline\n end", "def reap\n stale_connections = @connections.select do |conn|\n conn.in_use? && !conn.owner.alive?\n end\n\n stale_connections.each do |conn|\n if conn.active?\n conn.reset!\n checkin conn\n else\n remove conn\n end\n end\n end", "def cleanup!(redis)\n max_score = Time.now.to_i - @timeout\n expired = redis.zremrangebyscore(key, \"-inf\", max_score)\n expired > 0 ? true : false\n end", "def close_expired_connections\n raise NotImplementedError\n end", "def coached_session_changed?\n coach_connections.any? && timeslot_changed?\n end", "def release_stale_reservations\n unreserved_count = @mongo.db('weather').collection('queue').find({:reserved_at=>0}).count\n reserved_count = @mongo.db('weather').collection('queue').find({:reserved_at=>{:$gt=>0}}).count\n log_yellow \"Unreserved: #{unreserved_count}, Reserved: #{reserved_count}\"\n\n res = @mongo.db('weather').collection('queue').update(\n {:reserved_at=>{:$lt=>Time.now.to_i-30, :$gt=>0}},\n {:$set=>{:reserved_at=>0}},\n {:multi=>true, :safe=>true});\n log_yellow \"Released #{res['n']} stale reservations.\"\n end", "def clean(rate_limit_time = nil)\n rate_limit_time ||= Time.now\n\n @bucket.delete_if do |_, limit_hash|\n # Time limit has not run out\n return false if @time_span && rate_limit_time < (limit_hash[:set_time] + @time_span)\n\n # Delay has not run out\n return false if @delay && rate_limit_time < (limit_hash[:last_time] + @delay)\n\n true\n end\n end", "def remaining?\n return true if max_times.zero?\n registrations.count < max_times\n end", "def stale?\n prices.empty? || prices.keys.last - Time.now < 25_200\n end", "def is_stale?\n frequency = dispatchable.frequency.name\n created_at < time_for_interval(frequency)\n end", "def purge\n t = Time.now\n expired = []\n @queue.each do |identity,worker|\n expired << identity if t > worker.expiry\n end\n expired.each do |identity|\n @queue.delete identity\n end\n end", "def update_required?(hosts)\n if !@refresh_node || !@refresh_node.active?\n begin\n @refresh_node = get_valid_seed_node\n rescue ConnectionFailure\n warn \"Could not refresh config because no valid seed node was available.\"\n return\n end\n end\n node = @refresh_node\n\n node_list = node.node_list\n\n unconnected_nodes = node_list - hosts\n removed_nodes = hosts - node_list\n\n if unconnected_nodes.empty? && removed_nodes.empty?\n return false\n else\n {:unconnected => unconnected_nodes, :removed => removed_nodes}\n end\n end", "def reap\n stale_connections = synchronize do\n @connections.select do |conn|\n conn.in_use? && !conn.owner.alive?\n end\n end\n\n stale_connections.each do |conn|\n synchronize do\n if conn.active?\n conn.reset!\n checkin conn\n else\n remove conn\n end\n end\n end\n end", "def healthy_database?\n return true unless Gitlab::Database.postgresql?\n\n !Postgresql::ReplicationSlot.lag_too_great?\n end", "def reexecute_connections?\n return true\n end", "def expire\n if in_use?\n if @owner != ActiveSupport::IsolatedExecutionState.context\n raise ActiveRecordError, \"Cannot expire connection, \" \\\n \"it is owned by a different thread: #{@owner}. \" \\\n \"Current thread: #{ActiveSupport::IsolatedExecutionState.context}.\"\n end\n\n @idle_since = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n @owner = nil\n else\n raise ActiveRecordError, \"Cannot expire connection, it is not currently leased.\"\n end\n end", "def reap_expired_sessions\n @timestamps.each do |session_id,stamp|\n delete_session(session_id) if (stamp + @session_ttl) < Time.now \n end\n GC.start\n end", "def clear_reloadable_connections!\n @reserved_connections.each do |name, conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect! if conn.requires_reloading?\n end\n @connections = []\n end", "def free?\n time_now >= end_time\n end", "def active_connections?\n self.ensure_ready\n self.connection_pool_list.any?(&:active_connection?)\n end", "def expire\n if in_use?\n if @owner != Thread.current\n raise ActiveRecordError, \"Cannot expire connection, \" \\\n \"it is owned by a different thread: #{@owner}. \" \\\n \"Current thread: #{Thread.current}.\"\n end\n\n @idle_since = Concurrent.monotonic_time\n @owner = nil\n else\n raise ActiveRecordError, \"Cannot expire connection, it is not currently leased.\"\n end\n end", "def clear_reloadable_connections!\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n conn.disconnect! if conn.requires_reloading?\n end\n @connections.delete_if do |conn|\n conn.requires_reloading?\n end\n @available.clear\n @connections.each do |conn|\n @available.add conn\n end\n end", "def cleanup\n @keys.each { |key, time|\n if expired_kalive?(key, 300)\n delete_key(key)\n end\n\n if expired_unlocked?(key, 60)\n unblock_key(key)\n end\n }\n \n end", "def connection_timeout?(connection_ttl)\n @taskbox.connection_timeout?(connection_ttl)\n end", "def clear_reloadable_connections!\n synchronize do\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n end\n\n @connections.delete_if(&:finished?)\n\n @available.clear\n @connections.each do |conn|\n @available.add conn\n end\n end\n end", "def purge()\n time = Time.now\n @data.each do |key, item|\n if item.expiration < time\n @data.delete(key)\n puts \"DELETE #{item.value}\"\n end\n end\n end", "def destroy\n # Delete all associated aliases first\n MysqlAdapter.delete \"DELETE FROM #{Alias.table_name} WHERE domain = '#{name}'\"\n\n # Delete all associated mailboxes first\n MysqlAdapter.delete \"DELETE FROM #{Mailbox.table_name} WHERE domain = '#{name}'\"\n\n super\n rescue Mysql::Error\n false\n end", "def delete_all_expired_for(time)\n expired_for(time).delete_all\n end", "def clean_sessions\n self.log_puts(\"Cleaning sessions on appserver.\") if @debug\n \n #Clean up various inactive sessions.\n session_not_ids = []\n time_check = Time.now.to_i - 300\n @sessions.delete_if do |session_hash, session_data|\n session_data[:dbobj].flush\n \n if session_data[:dbobj].date_lastused.to_i > time_check\n session_not_ids << session_data[:dbobj].id\n false\n else\n true\n end\n end\n \n self.log_puts(\"Delete sessions...\") if @debug\n @ob.list(:Session, {\"id_not\" => session_not_ids, \"date_lastused_below\" => (Time.now - 5356800)}) do |session|\n idhash = session[:idhash]\n self.log_puts(\"Deleting session: '#{session.id}'.\") if @debug\n @ob.delete(session)\n @sessions.delete(idhash)\n end\n \n #Clean database weak references from the tables-module.\n @db.clean\n \n #Clean the object-handler.\n @ob.clean_all\n \n #Call various user-connected methods.\n @events.call(:on_clean) if @events\n end", "def unavailable_servers_check\n # Return unless there are servers that are unavailable.\n return unless @unavailable_servers&.positive?\n\n LOGGER.warn(\"#{@unavailable_servers} servers haven't been cached yet.\")\n LOGGER.warn('Servers may be unavailable due to an outage, or your bot is on very large servers that are taking a while to load.')\n end", "def clean_expired!\n sessions.remove( { :expire => { '$lt' => Time.now } } )\n end", "def clear_active_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:release_connection)\n end", "def purge_db\n\tUser.delete_all\n\tSubscription.delete_all\n\tDorkus.delete_all\nend", "def empty_connection_pools!; end", "def teardown_cleanup\n [reader, writer].each do |r_con|\n if(r_con && r_con.alive?)\n begin\n r_con.terminate\n rescue Celluloid::Task::TerminatedError\n warn 'Terminated task error when cleaning NSQ connections. Moving on.'\n end\n end\n end\n super\n end", "def stale?\n return false if failed\n return false if en_route\n return false if received\n return false unless assigned\n time_alive > max_age || force_stale\n end", "def clean\n transaction do\n connection.delete \"DELETE FROM line_items WHERE event_id IN (SELECT id FROM events WHERE subscription_id = #{id})\"\n connection.delete \"DELETE FROM account_items WHERE event_id IN (SELECT id FROM events WHERE subscription_id = #{id})\"\n connection.delete \"DELETE FROM tagged_items WHERE event_id IN (SELECT id FROM events WHERE subscription_id = #{id})\"\n\n connection.delete \"DELETE FROM buckets WHERE account_id IN (SELECT id FROM accounts WHERE subscription_id = #{id})\"\n connection.delete \"DELETE FROM statements WHERE account_id IN (SELECT id FROM accounts WHERE subscription_id = #{id})\"\n\n connection.delete \"DELETE FROM actors WHERE subscription_id = #{id}\"\n connection.delete \"DELETE FROM events WHERE subscription_id = #{id}\"\n connection.delete \"DELETE FROM accounts WHERE subscription_id = #{id}\"\n connection.delete \"DELETE FROM tags WHERE subscription_id = #{id}\"\n end\n end", "def purge\n begin\n purge!\n rescue API::VersionMismatch\n false\n end\n end", "def purge\n begin\n purge!\n rescue API::VersionMismatch\n false\n end\n end", "def cleanup\n logger.info(\"Cleaning up expired sessions...\", :cleanup, { state: :starting })\n begin\n count = CacheStore.cleanup(ttl: SESSION_TTL)\n logger.info(\"Deleted #{count} expired sessions.\", :cleanup, { state: :success, count: count })\n rescue StandardError => e\n logger.info(\"Failed to clean up expired sessions.\", :cleanup, { state: :error, message: e.message })\n\n # Reraise (calling `raise` without arguments will reraise last error)\n raise\n end\n end", "def shutdown_signal_sent_before?\n @shutdown_signal_sent_at && @shutdown_signal_sent_at - Time.now > 60\n end", "def can_destroyed?\n # return false unless self.modem_short_messages.any? { |short_message| %w(RECEIVED).include?(short_message.status) }\n \n=begin\n # list of associations to check (automatic)\n has_assocs = []\n self.class.reflections.each do |r_name, r|\n has_assocs << r_name if [:has_one, :has_many, :has_and_belongs_to_many].include? r.macro\n end\n\n # check for emptyness\n has_assocs.each do |r_name|\n assoc = self.send(r_name)\n nothing = assoc.respond_to?('empty?') ? assoc.empty? : assoc.nil?\n return false unless nothing\n end\n=end\n true\n end", "def evict\n # Peek at the first connection to see if it is still fresh. If so, we can\n # return right away without needing to use `synchronize`.\n first_expires_at, first_conn = connections.first\n return if (first_expires_at.nil? || fresh?(first_expires_at)) && !closed?(first_conn)\n\n connections.synchronize do\n fresh, stale = connections.partition do |expires_at, conn|\n fresh?(expires_at) && !closed?(conn)\n end\n connections.replace(fresh)\n stale.each { |_, conn| closer.call(conn) }\n end\n end", "def close_expired_connections\n # By default the keep alive timeout is 15 sec, which is the HTTP 1.1\n # standard. To change the value, use keep_alive_timeout= method\n # do nothing, handled by HTTPClient\n end", "def close_expired_connections\n # By default the keep alive timeout is 15 sec, which is the HTTP 1.1\n # standard. To change the value, use keep_alive_timeout= method\n # do nothing, handled by HTTPClient\n end", "def after_destroy\n if self.feed.users.count == 0\n Rails.logger.warn \"no more users subscribed to feed #{self.feed.id} - #{self.feed.fetch_url} . Removing it from the database\"\n self.feed.destroy\n end\n end", "def should_be_offline?\n time_ago = (update_frequency.seconds * 4.8).ago\n # Provides leeway for new stations\n if created_at > time_ago\n return false\n end\n observations.since(time_ago).order(created_at: :desc).count < 3\n end", "def shutdown_more_emails_sent_than_defined_in_user_profile?\n notifications_delivered > notifications_for_shutdown\n end", "def active_connection?\n @reserved_connections.fetch(current_connection_id) { return false }.in_use?\n end", "def flush_expired!\n Dir[ File.join( store, \"*.cache\" ) ].each do |f|\n if (File.mtime(f)+timeout) <= Time.now\n File.delete(f)\n end\n end\n @gc_last = Time.now\n end", "def purge_instances!\n @@instances = [] and true\n end", "def refetch_hosts?\n return false unless vima?\n return true if hosts_updated_at.nil?\n\n hosts_updated_at < Archiving.settings[:skip_host_fetch_time_period].ago\n end", "def confirmation_period_expired?\n self.class.activate_within && self.confirmation_sent_at && (Time.now > self.confirmation_sent_at + self.class.activate_within)\n end", "def postgres_keep_alive\n stat = @connection.status()\n rescue PGError => e\n @logger.info(\"Postgresql connection lost: #{e}\")\n @connection = postgres_connect\n if (stat = PGconn.CONNECTION_BAD) then\n @logger.info(\"Postgresql connection lost. Reconnect.\")\n @connection = postgres_connect\n end\n end", "def garbage_collect\n $redis.keys(\"#{remote_ip}.*\").each do |key|\n $redis.del(key) unless key =~ /#{session}/ || key =~ /hidden/\n end\n end", "def active_connection?\n synchronize do\n @reserved_connections.fetch(current_connection_id) do\n return false\n end\n end\n end", "def cleanup\n return if @cleanup_skip\n return unless @device && @operator\n dputs_func\n\n if @device.connection_status == Device::DISCONNECTED\n if ips_connected.length > 0\n if @operator.connection_type != Operator::CONNECTION_ALWAYS\n log_ \"Disconnecting everybody as we're not connected\"\n users_disconnect_all\n else\n log_ 'Keeping users while we hope for a return of the connection'\n end\n end\n end\n\n log \"ips_connected is #{ips_connected.inspect}\"\n if ips_connected.length == 0\n @device.connection_stop if @operator.connection_type == Operator::CONNECTION_ONDEMAND\n else\n ips_connected.each { |ip|\n packets = packets_count ip\n log \"Checking ip #{ip} - has #{packets} packets - \" +\n \"keep_idle_minutes is #{@keep_idle_minutes.inspect}\"\n if packets == 0\n if min = @ips_idle[ip]\n if @ips_idle[ip] == 0\n log_ \"No packets from #{ip} for #{@keep_idle_minutes}, kicking\"\n user_disconnect_ip ip\n @ips_idle.delete ip\n else\n @ips_idle[ip] -= min.abs / min\n end\n log_ \"ips_idle for #{ip} is now #{@ips_idle.inspect}\"\n else\n log_ \"#{ip} is idle, adding to list for #{@keep_idle_minutes}\"\n @ips_idle[ip] = @keep_idle_minutes\n end\n else\n @ips_idle.delete ip\n end\n }\n end\n\n log 'Clearing counters'\n iptables '-Z FCAPTIVE'\n end", "def clean_database\n\t\t\t\tbegin\n\t\t\t\t\tupdate_all(XSSF_VICTIM_DB, XSSF_VICTIM_HASH, {\"CURRENT_ATTACK_URL\" => nil, \"TUNNELED\" => false})\n\t\t\t\t\tdelete_all(XSSF_WAITING_ATTACKS_DB) \n\t\t\t\trescue\n\t\t\t\t\tprint_error(\"Error 10: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\tend", "def valid_for_removal\n if timetable_in_use.include?(id)\n return false\n else\n return true\n end\n end", "def checkin(connection)\n @mutex.synchronize do\n @checked_out.delete(connection)\n if @pool_size < @connections.size\n remove_and_close(connection)\n @logger.info \"#{@name}: Checkin connection #{connection}(#{connection.object_id}) has been removed due to pool size reduction\"\n else\n connection._last_used = Time.now\n @condition.signal\n end\n end\n @logger.debug {\"#{@name}: Checkin connection #{connection}(#{connection.object_id}) self=#{self}\"}\n end", "def clear_active_connections!\n clear_cache!(@@active_connections) do |name, conn|\n conn.disconnect!\n end\n end", "def garbage?\n return self.cluster_targeting_id == \"garbage\"\n end", "def garbage?\n return self.cluster_targeting_id == \"garbage\"\n end" ]
[ "0.70933026", "0.61687094", "0.6096776", "0.590582", "0.5902677", "0.58976835", "0.58303976", "0.57569265", "0.5739425", "0.57245564", "0.5702364", "0.5696099", "0.56932616", "0.5691575", "0.5691043", "0.5627115", "0.5594837", "0.55646896", "0.55571216", "0.55569404", "0.55415064", "0.5540498", "0.5533406", "0.5501348", "0.54854745", "0.54797506", "0.5462977", "0.5451416", "0.5451416", "0.5431857", "0.54228497", "0.5397208", "0.537871", "0.5378102", "0.5370599", "0.5357266", "0.5355181", "0.53549683", "0.53422195", "0.5335911", "0.53323054", "0.53153944", "0.53117335", "0.5302165", "0.5248337", "0.524596", "0.5244703", "0.52385473", "0.52372485", "0.52281374", "0.52129674", "0.5209665", "0.5206345", "0.5204569", "0.5203459", "0.519295", "0.51927537", "0.518869", "0.5169497", "0.5162371", "0.5155446", "0.51461303", "0.51456636", "0.5140616", "0.5139821", "0.5139297", "0.5137768", "0.5137506", "0.51363987", "0.51336336", "0.51333016", "0.51307", "0.5125128", "0.51213574", "0.5121086", "0.5121086", "0.5111959", "0.5110972", "0.5105944", "0.5098014", "0.5096557", "0.5096557", "0.5089956", "0.5076284", "0.5076033", "0.5062864", "0.5062025", "0.5060426", "0.5052984", "0.5052486", "0.5051905", "0.505097", "0.5049326", "0.5044231", "0.50440425", "0.50413567", "0.50412494", "0.50362664", "0.50269586", "0.50269586" ]
0.63257563
1
Closes all the connections that correspond that EMSs that no longer exist in the database.
def purge # Get the identifiers of the EMS from the database and from the registry, and calculate the difference: database_ids = ManageIQ::Providers::Ovirt::InfraManager.pluck(:id) registry_ids = @registry.keys purged_ids = registry_ids - database_ids # Close the connections: purged_ids.each do |id| $rhevm_log.info( "The EMS with identifier '#{id}' no longer exists in the database, the connection will be closed." ) close(id) end # Update the purge time: @purge_time = Time.current end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_all\n @connections.close_all\n end", "def close_connections\n @connections.values.each(&:close)\n end", "def closeConnections\n #N Without this the cached connections won't get closed\n @contentHost.closeConnections()\n end", "def closeConnections()\n #N Without this, the connections won't be closed\n @sshAndScp.close()\n end", "def close\n inactive!\n close_connections\n end", "def close_connections\n @connections ||= {}\n @connections.values.each do |connection|\n begin\n connection.disconnect!\n rescue\n end\n end\n\n @connections = {}\n end", "def close\n #active record should do our connections for us so just set to nil\n @connection = nil\n # Remove this connection from the list of open connections.\n #@@open_connection = @@open_connections.reject { |c| c[:db_url] == @db_url }\n Log.instance.debug \"Disconnected from #@db_url\"\n end", "def disconnect\n database.close if connected?\n @@connections[name][db_name] = nil\n end", "def close_client_connections\n @pending_data.each_key(&:close)\n @pending_data.clear\n end", "def close_database\n @database = nil\n @writable_database = nil\n GC.start\n end", "def close_database\n @database = nil\n @writable_database = nil\n GC.start\n end", "def close_connection\n @db.close if @db\n end", "def close\n @dbman.close\n @dbprot.clear\n end", "def close\n @connection_manager.close\n end", "def clean_up()\n puts \"Closing MQTT and DB connections\"\n closeMQTTConn()\n closeDBConn()\n end", "def closeConnections\n #N Without this, cached SSH connections to the remote system won't get closed\n destinationLocation.closeConnections()\n end", "def close\n @pool.each do |s|\n #@pool.remove(s)\n s.close\n #@pool.remove(s)\n end\n end", "def disconnect_all\n refine_exceptions do\n do_disconnect_all\n end\n end", "def close\n @database.close if @database\n end", "def close\n @database.close if @database\n end", "def close\n\n @db.connection.close\n end", "def closeDBConn()\n if ( !@db_conn.nil? )\n begin\n @db_conn.finish()\n rescue Exception => e\n #ignore it\n end\n end\n end", "def disconnect_all\n @connections.clear\n @readers.clear\n end", "def close()\n @db.close()\n end", "def __close_connections\n # to be implemented by specific transports\n end", "def clear_active_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:release_connection)\n end", "def delete_all_active_connections\n super\n end", "def shutdown\n\n @db.connection.close\n end", "def close\n # by default do nothing - close any cached connections\n end", "def close\n @clients.each { |c| c.reset(); c.close() } if @clients\n end", "def teardown_connections_to(servers)\n servers.each do |server|\n sessions[server].close\n sessions.delete(server)\n end\n end", "def clear_active_connections!\n clear_cache!(@@active_connections) do |name, conn|\n conn.disconnect!\n end\n end", "def close\n @sockets.each do |sock|\n sock.close\n end\n @host = @port = nil\n @sockets.clear\n @checked_out.clear\n end", "def disconnect\n unless self.open_statements.empty?\n warn \"[RDBI] Open statements during disconnection -- automatically finishing. You should fix this.\"\n self.open_statements.each(&:finish)\n end\n self.open_statements = []\n @connected = false\n end", "def close_expired_connections\n raise NotImplementedError\n end", "def close\n @db.close\n end", "def close\n IBM_DB.close(@conn)\n end", "def db_close\n @dbh and @dbh.close\n @dbh = nil\n end", "def db_close\n @dbh and @dbh.close\n @dbh = nil\n end", "def close\n @mutex.synchronize do\n @thread.kill\n @store.each_value do |value|\n sess, _ = value\n sess.close(@context)\n end\n end\n end", "def close()\n\t\t@connection.disconnect\n\t\t@connection = nil\n\tend", "def close!\n live_queries = @volt_app.channel_live_queries[@channel]\n\n if live_queries\n live_queries.each do |live_query|\n live_query.remove_channel(@channel)\n end\n end\n\n @volt_app.channel_live_queries.delete(@channel)\n end", "def close\n @mysql.close\n @mysql = nil\n end", "def close\n db.close\n end", "def close_clients\n verify_not_closed\n @clients.each do |pub|\n pub.close()\n end\n @closed = true\n end", "def cleanup\n @sessions.each_value do |session|\n session.close if session.expired?\n end\n rescue => e\n log.error(\"Expired session cleanup failed: #{e}\")\n end", "def close\n statement = \"close #{@name}\"\n @connection.exec(statement)\n end", "def close()\n @connection.disconnect\n @connection = nil\n end", "def disconnect!\n @reserved_connections.each do |name,conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect!\n end\n @connections = []\n end", "def close\n @conn.disconnect\n end", "def close_tcp_sockets()\n\n if (@tcp_sockets.length > 0)\n\n @tcp_sockets.each do |tcp_socket|\n begin\n tcp_socket.close\n rescue Exception => e\n puts \"close_tcp_sockets:exception: #{e}\"\n end\n end\n\n end\n\n end", "def disconnect_db\n ActiveRecord::Base.connection_handler.clear_active_connections!\n ActiveRecord::Base.connection.disconnect!\n ActiveRecord::Base.connection.close\n log(\"Disconnected from database\")\nrescue => e\n fatal(\"Failed to disconnect from the database: #{e}\")\n exit\nend", "def clear_all_connections!\n disconnect_read_pool!\n @original_handler.clear_all_connections!\n end", "def close_db_connection\n if ActiveRecord::Base.connection\n ActiveRecord::Base.connection.close\n end\n end", "def delete_all_connections!\n @connections.each { |cnx| cnx.parent = nil }\n @connections = []\n end", "def close\n\t\t@conn.disconnect\n\tend", "def close_expired_connections\n # By default the keep alive timeout is 15 sec, which is the HTTP 1.1\n # standard. To change the value, use keep_alive_timeout= method\n # do nothing, handled by HTTPClient\n end", "def close_expired_connections\n # By default the keep alive timeout is 15 sec, which is the HTTP 1.1\n # standard. To change the value, use keep_alive_timeout= method\n # do nothing, handled by HTTPClient\n end", "def disconnect!() @connections.each_value(&:disconnect) end", "def close(server,purge=false)\n if(server.nil?)\n if(purge)\n @connectors.each_key{|s|\n @quited.push(s)\n }\n end\n @connectors.each_value{|conn|\n conn.close\n }\n else\n unless(server.instance_of?(Array))\n server=[String(server)]\n end\n if(purge)\n server.each{|s|\n @quited.push(s)\n }\n end\n server.each{|s|\n if(@connectors.has_key?(s))\n @connectors[s].close\n end\n }\n end\n end", "def disconnect\n disconnect_all\n end", "def dispose\n return if @connection_pool.nil?\n\n until @connection_pool.empty?\n conn = @connection_pool.pop(true)\n conn&.close\n end\n\n @connection_pool = nil\n end", "def finish\n @connections.each_value do |connection|\n begin\n connection.finish\n rescue Exception => e\n logger.error(\"Failed to close metadata http connection: #{e.backtrace.join(\"\\n\")}\")\n end\n end\n @connections = {}\n end", "def on_close(env)\n @connection.destroy if @connection\n end", "def close_session\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsOrders)\n close_prepared_statement(@MySQLConnection, @StatementDeleteFromStatsOrders)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsLocations)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsCategories)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsObjects)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsValues)\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsValues)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsBinaryValues)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsOrders)\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsLastKeys)\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsBinaryValues)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsLastKeys)\n close_prepared_statement(@MySQLConnection, @StatementUpdateStatsLastKeys)\n close_mysql(@MySQLConnection)\n end", "def clear\n connections.synchronize do\n connections.map(&:last).each(&closer)\n connections.clear\n end\n end", "def clean_db\n Mongoid::Sessions.default.collections.select {|c| c.name !~ /system/}.each {|c| c.find.remove_all}\n end", "def clean_up()\n puts \"Closing MQTT and DB connections\"\n closeMQTTConn($mqtt_client)\n closeDBConn($db_conn)\nend", "def close\n @ole_connection.Close\n end", "def close\n lib.tcidbclose( @db ) || raise_error\n\n lib.tcidbdel( @db )\n\n @db = nil\n end", "def close\n\t\t\t@clients.map(&:close)\n\t\t\t@clients = nil\n\t\tend", "def connection_closed\n close\n end", "def close_sandbox!\n orm_modules.each { |orm| orm.close_sandbox! if orm.respond_to?(:close_sandbox!) }\n puts \"Modifications have been rolled back\"\n end", "def close\n close_connection(CLOSED, true)\n end", "def close_connection\n @connection.expunge\n @connection.logout\n @connection.disconnect\n end", "def teardown\n @db.close\n super\n end", "def close_tcp_sockets()\n logger.info \"close_tcp_sockets:start: tcp sockets list = #{@tcp_sockets}\"\n\n if (@tcp_sockets.length > 0)\n\n @tcp_sockets.each do |tcp_socket|\n begin\n tcp_socket.close\n rescue Exception => e\n logger.error \"close_tcp_sockets:exception: #{e}\"\n end\n end\n\n end\n\n logger.info 'close_tcp_sockets:end: Completed'\n\n end", "def teardown_cleanup\n [reader, writer].each do |r_con|\n if(r_con && r_con.alive?)\n begin\n r_con.terminate\n rescue Celluloid::Task::TerminatedError\n warn 'Terminated task error when cleaning NSQ connections. Moving on.'\n end\n end\n end\n super\n end", "def close_idle_sockets\n return if closed?\n return unless max_idle_time\n\n @lock.synchronize do\n i = 0\n while i < @available_connections.length\n connection = @available_connections[i]\n if last_checkin = connection.last_checkin\n if (Time.now - last_checkin) > max_idle_time\n connection.disconnect!(reason: :idle)\n @available_connections.delete_at(i)\n @populate_semaphore.signal\n next\n end\n end\n i += 1\n end\n end\n end", "def close_connection\n current_connection.logout if current_connection?\n current_connection = nil\n end", "def close\n @channels.each{|channel,omegle|\n omegle.send(\"You have been connected to a message bridge, which is now shutting down. Goodbye.\")\n omegle.disconnect\n }\n end", "def database_reset\n @database = nil\n end", "def resurrect_dead_connections!\n connections.dead.each { |c| c.resurrect! }\n end", "def close\n #import\n @insert_point.close if !@insert_point.nil?\n @check_md5.close if !@check_md5.nil?\n @insert_md5.close if !@insert_md5.nil?\n #export\n @export_point_page.close if !@export_point_page.nil?\n @export_point_all.close if !@export_point_all.nil?\n @db.close\n end", "def cleanup_connections\n @connections.keep_if do |thread, conns|\n thread.alive?\n end\n end", "def cleanup \n # close the sockets \n @servers.each{ |server| server[:listner].stop }\n @monitor.close\n end", "def close\n\t\t\t\t@workers.each do |x|\n\t\t\t\t\tx.close\n\t\t\t\t\t@workers.delete x\n\t\t\t\tend\n\n\t\t\t\t@server.close\n\t\t\t\t@server = nil\n\t\t\tend", "def close\n @shutdown_mutex.lock\n @queues.each_pair do |name,queue|\n queue.close\n @queues.delete(name)\n end\n end", "def close\n @conn.close\n end", "def closeDBConn(dbConn)\n if ( !dbConn.nil? )\n begin\n dbConn.finish()\n rescue Exception => e\n #ignore it\n end\n end\nend", "def close\n @mutex.synchronize { @conn.close }\n end", "def close\n @mutex.synchronize { @conn.close }\n end", "def close!\n storages.each_value(&:close) and @storages = {}\n nil\n end", "def close(id)\n entry = @registry.delete(id)\n return unless entry\n begin\n $rhevm_log.info(\"Closing connection for EMS with identifier '#{id}' and URL '#{entry.options[:url]}'.\")\n entry.connection.close\n rescue OvirtSDK4::Error => error\n $rhevm_log.warn(\n \"Error while closing connection for EMS with identifier '#{id}' and URL '#{entry.options[:url]}', \" \\\n \"backtrace follows.\"\n )\n $rhevm_log.warn(error.message)\n error.backtrace.each do |line|\n $rhevm_log.warn(line)\n end\n end\n end", "def clear_reloadable_connections!\n @reserved_connections.each do |name, conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect! if conn.requires_reloading?\n end\n @connections = []\n end", "def close\n server_list.each { |server| server.close_channels }\n loop(0) { busy?(true) }\n server_list.each { |server| server.close }\n default_gateway.shutdown! if default_gateway\n end", "def close\r\n\t\t@connection.Close\r\n\tend", "def disconnect!\n synchronize do\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n $DEBUG && warn(\"Closing pg connection: #{conn.object_id}\")\n conn.close\n end\n @connections = []\n @available.clear\n end\n end", "def disconnect_all\n @cache.values.map(&:clear_all_connections!)\n end", "def close\n @w.each{|w|\n w.close\n }\n end" ]
[ "0.7711901", "0.73530525", "0.6947571", "0.69461405", "0.69093853", "0.6802882", "0.67584205", "0.6690401", "0.66065574", "0.6506693", "0.6506693", "0.6461829", "0.6452855", "0.64227253", "0.64010775", "0.6378468", "0.6346231", "0.6337507", "0.6320681", "0.6320681", "0.6310962", "0.6301929", "0.62866384", "0.6282695", "0.6279803", "0.6258235", "0.62550205", "0.62513536", "0.62440157", "0.62371755", "0.6199855", "0.6194976", "0.6166245", "0.61617106", "0.6155431", "0.61528486", "0.611773", "0.61071", "0.61071", "0.6097677", "0.6095132", "0.6074069", "0.60632235", "0.6063109", "0.60540265", "0.6042565", "0.6039692", "0.60306704", "0.6010844", "0.600661", "0.6004694", "0.5999066", "0.5984503", "0.5983857", "0.5974885", "0.59696406", "0.59493965", "0.59493965", "0.59460324", "0.5927386", "0.59160733", "0.5914717", "0.5910411", "0.5909772", "0.5901086", "0.58907634", "0.5883479", "0.58805233", "0.5855301", "0.58535314", "0.58378965", "0.58271044", "0.5804071", "0.57961816", "0.5788234", "0.57654893", "0.57555217", "0.57548225", "0.5726114", "0.57188946", "0.57184476", "0.57182086", "0.5695052", "0.5691218", "0.5687817", "0.56814724", "0.56738526", "0.56699145", "0.5660838", "0.5655818", "0.5654633", "0.5654633", "0.5650524", "0.56382906", "0.5614284", "0.5606841", "0.5599942", "0.55984855", "0.55856436", "0.5577439" ]
0.66014004
9
Returns the settings of the connection manager.
def settings ::Settings.ems.ems_ovirt.connection_manager end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings\n @settings_manager\n end", "def get_settings\n settings.get\n end", "def get_settings\n @bridge.get_settings\n end", "def settings\n return @settings\n end", "def settings\n return @settings\n end", "def settings\r\n @@settings\r\n end", "def connection_options\n CONNECTION_OPTIONS\n end", "def settings\n self.class.settings\n end", "def settings\n # JSONSettingDataSource.file_semaphore.synchronize do\n return @settings\n # end\n end", "def get_settings\n return @client.raw(\"get\", \"/config/settings\")\n end", "def get_all_settings\n return @db[:settings].as_hash(:name, :body) if onblock(:u, -1, @client).admin?\n end", "def connection\n settings.connection\n end", "def settings( params={} )\n settings = get_connections(\"settings\", params)\n return map_connections settings, :to => Facebook::Graph::Setting\n end", "def settings\n self.network[self.class]\n end", "def get_settings\n request :get, \"_settings\"\n end", "def get_settings\n request :get, \"_settings\"\n end", "def settings\n @settings ||= get('/settings')['settings']\n end", "def settings\n @settings ||= {}\n end", "def settings\n @settings ||= {}\n end", "def settings\n @cmd.settings\n end", "def available_settings\n instance.available_settings\n end", "def settings\n adapter_id = self.const_get(:ADAPTER_ID)\n @adapter_settings = []\n Octo::Enterprise.all.each do |enterprise|\n opt = {\n enterprise_id: enterprise.id,\n adapter_id: adapter_id,\n enable: true\n }\n @adapter_settings << Octo::AdapterDetails.get_cached(opt)\n end\n end", "def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end", "def settings\n @settings\n end", "def settings\n @settings ||= {}\n end", "def conndefaults\n\t\treturn self.class.conndefaults\n\tend", "def conndefaults\n\t\treturn self.class.conndefaults\n\tend", "def settings\n @settings ||= DriverSettings.new(@bridge)\n end", "def get_settings(params = {})\n response = client.get \"/_cluster/settings\", params.merge(action: \"cluster.get_settings\", rest_api: \"cluster.get_settings\")\n response.body\n end", "def settings\n base_configuration.settings + self.class.settings\n end", "def settings\n @settings ||= self.class.settings.dup\n end", "def settings\n cmd.settings\n end", "def managed_connections\n @@managed_connections\n end", "def db_settings\n cx = ActiveRecord::Base.connection_config.dup\n cx[:password] = '(hidden)'\n {\n current_database: Admin::MigrationGenerator.current_database,\n current_search_paths: Admin::MigrationGenerator.current_search_paths.join(', '),\n connection: cx\n }\n end", "def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end", "def settings\n @settings ||= OpenStruct.new(opts[:dm_config].first)\n # dm_js_location, dm_css_location\n # dm_js_location: javascripts\n # dm_css_location: stylesheets\n end", "def settings\n @settings ||= settings_class&.new(self)\n end", "def connections\n @connection_pool\n end", "def get_smart_proxy_settings\n response = nexus.get(nexus_url(\"service/local/smartproxy/settings\"), :header => DEFAULT_ACCEPT_HEADER)\n case response.status\n when 200\n return response.content\n else\n raise UnexpectedStatusCodeException.new(response.status)\n end\n end", "def settings\n @scope.settings\n end", "def settings\r\n Mutable[self]\r\n end", "def settings\n @settings ||= EbanqApi::Settings.new(self)\n end", "def settings\n MailSettings.new.mail_server_settings\n end", "def settings\n # TODO\n {}\n end", "def settings_list\n setting.list\n end", "def config\n Config.new(connection)\n end", "def settings\n @settings ||= {}\n end", "def settings\n {\n name: @client.self.name,\n team: @client.team.name,\n domain: @client.team.domain\n }\n end", "def conndefaults_hash\n\t\treturn self.class.conndefaults_hash\n\tend", "def conndefaults_hash\n\t\treturn self.class.conndefaults_hash\n\tend", "def settings\n attributes.fetch(:settings)\n end", "def settings\n settings_name = self.class.settings_name\n unless settings_name\n raise Exception.new(\"settings_name undefined for #{self.class}\")\n end\n if Settings.instance[settings_name].nil?\n Settings.instance[settings_name] = self.class.default_settings\n end\n return Settings.instance[settings_name]\n end", "def get_settings\n settings = {}\n settings['sharing_scope'] = self.sharing_scope\n settings['access_type'] = self.access_type\n settings['use_custom_sharing'] = self.use_custom_sharing\n settings['use_whitelist'] = self.use_whitelist\n settings['use_blacklist'] = self.use_blacklist\n return settings\n end", "def configuration_manager_data_connector_configured\n return @configuration_manager_data_connector_configured\n end", "def query_settings(options={})\n path = \"/api/v2/settings\"\n get(path, options)\n end", "def appl_settings\n @appl_settings\n end", "def connection_settings\n \"\\0%s\\0%s\\0%s/%d\\0\" % [\n @client_user_name, @server_user_name, @terminal_type, @speed\n ]\n end", "def inheritable_settings\n return @inheritable_settings\n end", "def settings\n @settings ||= Settings.new\n end", "def settings\n @settings ||= Settings.new\n end", "def settings\n CircleCi.request(conf, \"#{base_path}/settings\").get\n end", "def settings\n @settable.settings(:components)\n end", "def available_settings\n return @@settings_by_type[self.resource_type]\n end", "def synchronization_job_settings\n return @synchronization_job_settings\n end", "def settings(svc_name = @service_name)\n\t\tif @settings.nil?\n\t\t\t$log.debug(\"#{self.class}.#{__method__}() - caching settings for #{svc_name}\")\n\t\t\t@settings = self.class.dictionaryFromServeradmin(svc_name)\n\t\tend\n\t\treturn @settings\n\tend", "def active_directory_settings\n MsRestAzure::ActiveDirectoryServiceSettings.get_azure_settings\n end", "def get_settings(opts = {})\n data, _status_code, _headers = get_settings_with_http_info(opts)\n data\n end", "def get_settings(options = {}, request_options = {})\n options['getVersion'] = 2 if !options[:getVersion] && !options['getVersion']\n client.get(Protocol.settings_uri(name, options).to_s, :read, request_options)\n end", "def opts\n adapter_connection.opts\n end", "def settings\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/account/settings').settings\n end", "def requestor_settings\n return @requestor_settings\n end", "def settings\n return @settings if instance_variable_defined?(:@settings)\n\n @settings = Settings.load_for_slice(self)\n end", "def current_pool_settings\n pool.symbolize_keys.reverse_merge(POOL.dup)\n end", "def available_settings\n []\n end", "def connection_manager\n @connection_manager ||= TOAMQP::ConnectionManager.new\n end", "def automatic_request_settings\n return @automatic_request_settings\n end", "def connection_config(connection = nil)\n unless defined? @connection_config\n if connection.raw_connection && connection.raw_connection.respond_to?(:query_options)\n # you have a mysql client\n @connection_config = connection.raw_connection.query_options\n else\n # Rails 6.2 will deprecate ActiveRecord::Base.connection_config\n @connection_config = ActiveRecord::Base.try(:connection_db_config)&.configuration_hash ||\n ActiveRecord::Base.connection_config\n end\n end\n\n @connection_config\n end", "def settings(options = {})\n ensure_config_loaded!\n setting_class.all_keys(options)\n end", "def getOptions\n rOptions = nil\n\n if (@ConfigPanel != nil)\n rOptions = @ConfigPanel.getData\n end\n\n return rOptions\n end", "def connection_status_client_setting; end", "def enforced_settings\n return @enforced_settings\n end", "def connections\n attributes[:connections]\n end", "def implicit_grant_settings\n return @implicit_grant_settings\n end", "def connection\n @connection_pool\n end", "def settings\n get('/account/settings.json')\n end", "def settings\n {}\n end", "def get_request_settings(opts = {})\n data, _status_code, _headers = get_request_settings_with_http_info(opts)\n data\n end", "def settings\n\t\traise NotImplementedError\n\tend", "def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end", "def configuration\n Configuration::get\n end", "def configuration\n Configuration::get\n end", "def connect_settings\n sanitize_environment_report\n settings = {\n :pid => $$,\n :port => ::TingYun::Agent.config[:port],\n :host => local_host,\n :appName => ::TingYun::Agent.config.app_names,\n :language => 'Ruby',\n :agentVersion => ::TingYun::VERSION::STRING,\n :env => @environment_report,\n :config => ::TingYun::Agent.config.to_collector_hash\n }\n settings\n end", "def settings\n CircleCi.request(@conf, \"/project/#{username}/#{project}/settings\").get\n end", "def connections\n return @connectors.keys\n end", "def configs\n # Caching here is not necessary or preferred as configurations are\n # cached on the class (which allows late inclusion of configurable\n # modules to work properly).\n bound? ? receiver.class.configs : EMPTY_HASH\n end", "def get_cache_settings(opts = {})\n data, _status_code, _headers = get_cache_settings_with_http_info(opts)\n data\n end", "def settings\n Thread.current[:shoppe_settings] ||= Shoppe::Settings.new(Shoppe::Setting.to_hash)\n end", "def persistent_config_manager_class\n self.class.persistent_config_manager_class\n end", "def setting\n return @setting\n end", "def api_connector_configuration\n return @api_connector_configuration\n end" ]
[ "0.7442025", "0.6843902", "0.6825964", "0.6815452", "0.6815452", "0.6766492", "0.67414266", "0.6664022", "0.66578126", "0.6616409", "0.6517596", "0.6456353", "0.6438402", "0.64383745", "0.63868517", "0.63868517", "0.638044", "0.6369448", "0.6369448", "0.6365058", "0.6349014", "0.634028", "0.6322474", "0.62656385", "0.62552583", "0.6242022", "0.6242022", "0.6231464", "0.6217932", "0.6185755", "0.6181683", "0.6153085", "0.6147046", "0.61401445", "0.61216253", "0.60823053", "0.607284", "0.60700506", "0.6059461", "0.605645", "0.6040365", "0.6017734", "0.60166436", "0.5999176", "0.5983026", "0.5967792", "0.59485143", "0.5947815", "0.5931034", "0.5931034", "0.5930907", "0.5925872", "0.59013337", "0.58879", "0.5886202", "0.5873074", "0.58723503", "0.5865648", "0.58629113", "0.58629113", "0.5859305", "0.5849742", "0.58449364", "0.5837283", "0.5831822", "0.5826399", "0.58053285", "0.5790742", "0.5780549", "0.57803077", "0.5764033", "0.57627594", "0.5760542", "0.573912", "0.5727104", "0.5708197", "0.56652033", "0.56588835", "0.5625318", "0.5623126", "0.5611331", "0.5601155", "0.5586291", "0.55822027", "0.5573128", "0.5569406", "0.5566872", "0.55601996", "0.5555698", "0.5553315", "0.5553315", "0.55390567", "0.55320793", "0.553073", "0.5528043", "0.5524214", "0.5523535", "0.5510285", "0.5509433", "0.5506386" ]
0.71007746
1
gets distance between two cities
def cost(shake, cities) distance = 0 shake.each_with_index do |c1, i| c2 = (i == (shake.size - 1)) ? shake[0] : shake[i + 1] # +++ get distance between two cities distance += euc_2d cities[c1], cities[c2] end distance end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_between(city_1, city_2)\n Math.hypot(city_2.x - city_1.x, city_2.y - city_1.y)\nend", "def distance(city1, city2) # haversine formula to compute great circle distances\n # nb need convert to radians\n lon1 = city1.lon * RAD_PER_DEG\n lat1 = city1.lat * RAD_PER_DEG\n lon2 = city2.lon * RAD_PER_DEG\n lat2 = city2.lat * RAD_PER_DEG\n dlon = lon2 - lon1\n dlat = lat2 - lat1\n\n a = Math.sin(dlat/2)**2 + Math.cos(lat1) * Math.cos(lat2) * Math.sin(dlon/2)**2\n c = 2 * Math.asin( Math.sqrt(a))\n\n return Rmiles * c # distance between the two points in miles\nend", "def get_distance(city_code1, city_code2)\n if @metros.has_key?(city_code1)\n dest = @metros[city_code1].destination\n if dest.has_key?(city_code2)\n return dest[city_code2]\n end\n end\n return -1\n end", "def distance(from_city,to_city)\n f = city(from_city)\n t = city(to_city)\n\n # r in km\n r = 6371\n dLat = to_rad(t.lat - f.lat)\n dLon = to_rad(t.long - f.long)\n lat1 = to_rad(f.lat)\n lat2 = to_rad(t.lat)\n\n a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2)\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))\n r * c;\n end", "def total_distance\n sum = 0\n previous_city = nil\n @city_names.each do |city|\n sum += @fully_connected_map.get_distance(previous_city, city) if previous_city\n previous_city = city\n end\n \n return sum\n end", "def get_node_distance(node_city)\n @nodes[node_city].distance\n end", "def distance\n diff_longitude = @longitude_b - @longitude_a\n diff_latitude = @latitude_b - @latitude_a\n\n angle_a = (Math.sin(radius_to_degree(diff_latitude)/2.0)) ** 2 +\n Math.cos(radius_to_degree(@latitude_a)) *\n Math.cos(radius_to_degree(@latitude_b)) *\n (Math.sin(radius_to_degree(diff_longitude)/2.0)) ** 2\n angle_c = 2 * Math.atan2(Math.sqrt(angle_a), Math.sqrt(1-angle_a))\n\n (EARTH_RADIUS * angle_c) / 1000 # Returns the distance in kilometers\n end", "def distance(loc1, loc2)\n\n lat1 = loc1[0].to_f\n lon1 = loc1[1].to_f\n\n lat2 = loc2[0].to_f\n lon2 = loc2[1].to_f\n\n dLat = conv_deg_rad(lat2 - lat1)\n dLon = conv_deg_rad(lon2 - lon1)\n\n a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1/180 * Math::PI) * Math.cos(lat2/180 * Math::PI) *\n Math.sin(dLon/2) * Math.sin(dLon/2)\n\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))\n\n d = 6371e3 * c #meters\n\n return d\n end", "def getGeoDistance(c1,c2)\n # atan2 raises domain error.\n if equalCoordinates?(c1,c2)\n return 0.0\n end\n ca = getCentralAngle(c1,c2)\n dist = EARTH_RADIUS_FEET * ca\n return abs(dist)\n end", "def distance_between(planet1, planet2)\n\n planet1 = find_by_name(planet1)\n distance1 = planet1.distance_from_sun_km\n planet2 = find_by_name (planet2)\n distance2 = planet2.distance_from_sun_km\n\n return (distance1 - distance2).abs\n end", "def get_distance(lat1, long1, lat2, long2)\n\tdistance = 0\n\tdistance = Math.sqrt((lat2 - lat1)**2 + (long2-long1)**2)\n\treturn distance\nend", "def distance\n return nil unless @locations.size > 1\n locations.each_cons(2).reduce(0) do |acc, (loc1, loc2)|\n acc + loc1.distance_to(loc2)\n end\n end", "def distance(other_location)\n Geocoder::Calculations.distance_between([latitude, longitude], [other_location.latitude, other_location.longitude])\n end", "def distance_between(planet_other)\n return (@distance_from_the_sun - planet_other.distance_from_the_sun).abs.round(2)\n end", "def distance_from_the_planet other_planet\n return (@distance_from_the_sun - other_planet.distance_from_the_sun).abs.round(2)\n end", "def distance_between(planet_one, planet_two)\n\t\treturn (find_planet_by_name(planet_one).distance_from_sun_km - find_planet_by_name(planet_two).distance_from_sun_km).abs\n\tend", "def distance_from other_loc\n rad_per_deg = Math::PI/180 # PI / 180\n rkm = 6371 # Earth radius in kilometers\n rm = rkm * 1000 # Radius in meters\n\n dlat_rad = (self[:latitude]-other_loc[:latitude]) * rad_per_deg # Delta, converted to rad\n dlon_rad = (self[:longitude]-other_loc[:longitude]) * rad_per_deg\n\n lat1_rad = self[:latitude] * rad_per_deg\n lon1_rad = self[:longitude] * rad_per_deg\n lat2_rad = other_loc[:latitude] * rad_per_deg\n lon2_rad = other_loc[:longitude] * rad_per_deg\n\n #lat1_rad, lon1_rad = loc1.map {|i| i * rad_per_deg }\n #lat2_rad, lon2_rad = loc2.map {|i| i * rad_per_deg }\n\n a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n\n rm * c # Delta in meters\n end", "def distance_between(planet_name_1, planet_name_2)\n planet_1 = find_planet_by_name(planet_name_1)\n planet_2 = find_planet_by_name(planet_name_2)\n puts (planet_1.distance_from_sun_km - planet_2.distance_from_sun_km).abs\n end", "def distance(loc1, loc2)\n rad_per_deg = Math::PI / 180 # PI / 180\n rkm = 6371 # Earth radius in kilometers\n dlat_rad = (loc2[0] - loc1[0]) * rad_per_deg # Delta, converted to rad\n dlon_rad = (loc2[1] - loc1[1]) * rad_per_deg\n lat1_rad, lon1_rad = loc1.map { |i| i * rad_per_deg }\n lat2_rad, lon2_rad = loc2.map { |i| i * rad_per_deg }\n a = Math.sin(dlat_rad / 2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad / 2)**2\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))\n rkm * c # Delta in kilometers\n end", "def dist(cities)\n @possible_distances = []\n shuffle_cities(cities).each do |array_of_array| \n @possible_distances.push(move_count(array_of_array))\n end\n @possible_distances.min\n end", "def distance(p1, p2)\n dx = ED * (p1['lat']-p2['lat'])\n dy = ED * Math::cos(Math::PI*p1['lat']/180)*(p1['lon']-p2['lon'])\n return (dx**2 + dy**2)**0.5\nend", "def distance_from(other)\n\t\t\trlong1 = self.longitude * D2R\n\t\t\trlat1 = self.latitude * D2R\n\t\t\trlong2 = other.longitude * D2R\n\t\t\trlat2 = other.latitude * D2R\n\t\t\t\n\t\t\tdlon = rlong1 - rlong2\n\t\t\tdlat = rlat1 - rlat2\n\t\t\t\n\t\t\ta = Math::sin(dlat/2) ** 2 + Math::cos(rlat1) * Math::cos(rlat2) * Math::sin(dlon/2) ** 2\n\t\t\tc = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n\t\t\td = R * c\n\t\t\t\n\t\t\treturn d\n\t\tend", "def distance(loc1, loc2)\n rad_per_deg = Math::PI/180 # PI / 180\n rkm = 6371 # Earth radius in kilometers\n rm = rkm * 1000 # Radius in meters\n\n dlat_rad = (loc2[0]-loc1[0]) * rad_per_deg # Delta, converted to rad\n dlon_rad = (loc2[1]-loc1[1]) * rad_per_deg\n\n lat1_rad, lon1_rad = loc1.map {|i| i * rad_per_deg }\n lat2_rad, lon2_rad = loc2.map {|i| i * rad_per_deg }\n\n a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n\n rm * c # Delta in meters\n end", "def calc_distance_from_other(planet1, planet2)\n planet1_distance = 0\n planet2_distance = 0\n @array_of_planets.each do |search|\n if search.name == planet1\n planet1_distance = search.distance_from_sun\n end\n if search.name == planet2\n planet2_distance = search.distance_from_sun\n end\n end\n puts \"#{planet1} is #{(planet1_distance - planet2_distance).round(2).abs} million miles from #{planet2}.\\n\"\n end", "def distance(loc1, loc2)\n rad_per_deg = Math::PI/180 # PI / 180\n rkm = 6371 # Earth radius in kilometers\n rm = rkm * 1000 # Radius in meters\n\n dlat_rad = (loc2[0]-loc1[0]) * rad_per_deg # Delta, converted to rad\n dlon_rad = (loc2[1]-loc1[1]) * rad_per_deg\n\n lat1_rad, lon1_rad = loc1.map {|i| i * rad_per_deg }\n lat2_rad, lon2_rad = loc2.map {|i| i * rad_per_deg }\n\n a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n\n rm * c # Delta in meters\n end", "def distance loc1, loc2\n lat1, lon1 = loc1\n lat2, lon2 = loc2\n dLat = (lat2-lat1).to_rad;\n dLon = (lon2-lon1).to_rad;\n a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.to_rad) * Math.cos(lat2.to_rad) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n d = 6371 * c; # Multiply by 6371 to get Kilometers\nend", "def distance_to(other)\n latitude_rad = to_rad(latitude)\n longitude_rad = to_rad(longitude)\n\n other_latitude_rad = other.latitude * RAD_PER_DEG\n other_longitude_rad = other.longitude * RAD_PER_DEG\n\n # Deltas, converted to rad\n delta_longitude_rad = longitude_rad - other_longitude_rad\n delta_latitude_rad = latitude_rad - other_latitude_rad\n\n distance_rad = Math.sin(delta_latitude_rad / 2)**2 +\n Math.cos(latitude_rad) * Math.cos(other_latitude_rad) * Math.sin(delta_longitude_rad / 2)**2\n\n 2 * Math.asin(Math.sqrt(distance_rad)) * EARTH_RADIUS\n end", "def distance\n self.distance_from(@origin) * 1.609344\n end", "def distance_between\n # convert to coord arrays\n point1 = extract_coords([user.current_latitude, user.current_longitude])\n point2 = extract_coords([connection.current_latitude, connection.current_longitude])\n\n # convert degrees to radians\n point1 = to_radians(point1)\n point2 = to_radians(point2)\n\n # compute deltas\n dlat = point2[0] - point1[0]\n dlon = point2[1] - point1[1]\n\n a = (Math.sin(dlat / 2)) ** 2 + Math.cos(point1[0]) *\n (Math.sin(dlon / 2)) ** 2 * Math.cos(point2[0])\n c = 2 * Math.atan2( Math.sqrt(a), Math.sqrt(1-a))\n c * earth_radius\n end", "def find_distance(planet1_name, planet2_name)\n planet1 = find_planet(planet1_name)\n planet2 = find_planet(planet2_name)\n if !planet1.nil? && !planet1.nil?\n return (planet1.sun_distance - planet2.sun_distance).abs\n end\n return nil\n end", "def distance loc1, loc2\n rad_per_deg = Math::PI/180 \n rkm = 6371 \n rm = rkm * 1000 \n\n dlat_rad = (loc2[0]-loc1[0]) * rad_per_deg \n dlon_rad = (loc2[1]-loc1[1]) * rad_per_deg\n\n lat1_rad, lon1_rad = loc1.map {|i| i * rad_per_deg }\n lat2_rad, lon2_rad = loc2.map {|i| i * rad_per_deg }\n\n a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n\n rm * c \nend", "def dijkstra(city1, city2)\n #if city's distance is the same\n if city1==city2\n return 0\n end\n #set up dijkstra\n\n active = []\n distance = Hash.new\n previous = Hash.new\n\n @metros.each do |city_code, metro|\n distance[city_code] = Float::INFINITY\n previous[city_code] = nil\n active.push(city_code)\n end\n\n distance[city1] = 0\n until active.empty?\n #remove the min from dis\n min_city = active[0]\n min_dist = distance[min_city]\n active.each do |city|\n if distance[city]<min_dist\n min_dist = distance[min_city]\n min_city = city\n end\n end\n active.delete(min_city)\n this_city = min_city\n\n #for all the neighbor\n dest = @metros[this_city].destination\n dest.each do |next_city, dist|\n current_distance = get_distance(this_city, next_city)\n total_distance = distance[this_city]+current_distance\n if total_distance < distance[next_city]\n distance[next_city] = total_distance\n previous[next_city] = this_city\n end\n end\n end\n #return a list of prebious cities\n return previous, distance\n\n end", "def distance(a,b)\n\t(a-b).abs\nend", "def distance other, units = :km\n other = subtrahend other\n\n dlat = (other.lat.to_f - @lat.to_f).to_radians\n dlon = (other.lon.to_f - @lon.to_f).to_radians\n lat1 = @latitude.to_f.to_radians\n lat2 = other.lat.to_f.to_radians\n\n a = Math::sin(dlat/2)**2 + Math::sin(dlon/2)**2 * Math::cos(lat1) * Math::cos(lat2)\n (EARTH_RADIUS[units] * 2.0 * Math::atan2(Math.sqrt(a), Math.sqrt(1-a))).abs\n end", "def jaro_distance(s1, s2)\n result = C::jaro_distance(s1, s2)\n raise(\"memory allocation error\") if result < 0.0\n result\n end", "def distance(c1,c2)\n x = c1[0] - c2[0]\n y = c1[1] - c2[1]\n y = y <= -180 ? y + 360 : y\n y = y >= 180 ? y - 360 : y\n return Math.sqrt(x*x+y*y)\n end", "def distance a, b\n (a[0] - b[0]).abs + (a[1] - b[1]).abs\n end", "def geo_dist(from, to)\n return 40000 if [from.lat, from.lon, to.lat, to.lon].any?(&:nil?)\n EARTH_DIAMETER * Math.asin(Math.sqrt(\n Math.cos(from.lat) * Math.cos(to.lat) *\n Math.sin((from.lon - to.lon)/2) ** 2 +\n Math.sin((from.lat - to.lat)/2) ** 2\n ))\nend", "def distance x1, y1, x2, y2\n ((x1-x2)**2+(y1-y2)**2)**0.5\nend", "def distance_between(lat1, lon1, lat2, lon2)\n lat1_rad, lat2_rad = lat1 * RAD_PER_DEG, lat2 * RAD_PER_DEG\n lon1_rad, lon2_rad = lon1 * RAD_PER_DEG, lon2 * RAD_PER_DEG\n\n a = Math.sin((lat2_rad - lat1_rad) / 2) ** 2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin((lon2_rad - lon1_rad) / 2) ** 2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1 - a))\n\n RM * c # Delta in meters\nend", "def distance(x1,x2,y1,y2)\r\n xdistance = x2-x1\r\n ydistance = y2-y1\r\n distance = ydistance + xdistance\r\n return distance\r\n end", "def distance(x1, y1, x2, y2)\n Math.sqrt((y2 - y1)**2 + (x2 - x1)**2)\n end", "def jaro_distance( s1, s2 )\n jaro_distance_internal( Input.new( s1, s2 ) )\n end", "def distance_between(lat1, lon1, lat2, lon2, options = {})\n\n # set default options\n options[:units] ||= :mi\n\n # define conversion factors\n conversions = { :mi => 3956, :km => 6371 }\n\n # convert degrees to radians\n lat1 = to_radians(lat1)\n lon1 = to_radians(lon1)\n lat2 = to_radians(lat2)\n lon2 = to_radians(lon2)\n\n # compute distances\n dlat = (lat1 - lat2).abs\n dlon = (lon1 - lon2).abs\n\n a = (Math.sin(dlat / 2))**2 + Math.cos(lat1) *\n (Math.sin(dlon / 2))**2 * Math.cos(lat2)\n c = 2 * Math.atan2( Math.sqrt(a), Math.sqrt(1-a))\n c * conversions[options[:units]]\n end", "def distance(point2)\n end", "def planets_distance(planet_one, planet_two)\n distance = (@all_planets[planet_one].distance-@all_planets[planet_two].distance).abs\n puts \"#{@all_planets[planet_one].name} and #{@all_planets[planet_two].name} are #{distance/1000000.0} million miles apart.\"\n end", "def distance_to(other)\n # using Spherical Law of Cosines formula to calculate 'great circle' distance\n # http://www.movable-type.co.uk/scripts/latlong.html\n # assumes a spherical moon\n # result in is metres\n lat1_r = to_rad(self.lat)\n lat2_r = to_rad(other.lat)\n delta = to_rad(other.long - self.long)\n Math.acos(\n Math.sin(lat1_r) * Math.sin(lat2_r) +\n Math.cos(lat1_r) * Math.cos(lat2_r) * Math.cos(delta)\n ) * RADIUS\n end", "def calculate_distance(latitude, longitude)\n self.distance_to([latitude, longitude])\n end", "def distance_from_other_planets(first_planet, second_planet)\n puts \"\\n#{first_planet.name} is #{(first_planet.distance_from_the_sun_in_miles - second_planet.distance_from_the_sun_in_miles).abs} miles from #{second_planet.name}.\\n\\n\"\n end", "def distance_to(other)\n point.distance_to(other)\n end", "def distance_from_planet(selection1, selection2)\n planet1 = @planets[selection1-1]\n planet2 = @planets[selection2-1]\n return \"#{planet1.name} and #{planet2.name} are #{(planet1.distance_from_sun-planet2.distance_from_sun).abs.round(2)} million miles from each other\"\n end", "def distance(p1, p2)\n a = [p1[:lat], p1[:lon]]\n b = [p2[:lat], p2[:lon]]\n\n rad_per_deg = Math::PI/180 # PI / 180\n rkm = 6371 # Earth radius in kilometers\n rm = rkm * 1000 # Radius in meters\n\n dlon_rad = (b[1]-a[1]) * rad_per_deg # Delta, converted to rad\n dlat_rad = (b[0]-a[0]) * rad_per_deg\n\n lat1_rad, lon1_rad = a.map! {|i| i * rad_per_deg }\n lat2_rad, lon2_rad = b.map! {|i| i * rad_per_deg }\n\n a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n rm * c # Delta in meters\nend", "def distance(p1, p2)\n a = [p1[:lat], p1[:lon]]\n b = [p2[:lat], p2[:lon]]\n\n rad_per_deg = Math::PI/180 # PI / 180\n rkm = 6371 # Earth radius in kilometers\n rm = rkm * 1000 # Radius in meters\n\n dlon_rad = (b[1]-a[1]) * rad_per_deg # Delta, converted to rad\n dlat_rad = (b[0]-a[0]) * rad_per_deg\n\n lat1_rad, lon1_rad = a.map! {|i| i * rad_per_deg }\n lat2_rad, lon2_rad = b.map! {|i| i * rad_per_deg }\n\n a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n rm * c # Delta in meters\nend", "def distance(lat1, lon1, lat2, lon2)\n phi1 = lat1.to_rad\n phi2 = lat2.to_rad\n dphi = (lat2 - lat1).to_rad\n dlambda = (lon2 - lon1).to_rad\n a = Math.sin(dphi / 2) * Math.sin(dphi / 2) + Math.cos(phi1) * Math.cos(phi2) * Math.sin(dlambda / 2) * Math.sin(dlambda / 2)\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))\n return Run::R * c\n end", "def distance(lat1, lon1, lat2, lon2)\n phi1 = lat1.to_rad\n phi2 = lat2.to_rad\n dphi = (lat2 - lat1).to_rad\n dlambda = (lon2 - lon1).to_rad\n a = Math.sin(dphi / 2) * Math.sin(dphi / 2) + Math.cos(phi1) * Math.cos(phi2) * Math.sin(dlambda / 2) * Math.sin(dlambda / 2)\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))\n return Run::R * c\n end", "def distance(start_lat, start_lon, other_lat, other_lon)\n latitude1 = start_lat.to_f * Math::PI/180 #in radian\n longitude1 = start_lon.to_f * Math::PI/180 #in radian\n latitude2 = other_lat.to_f * Math::PI/180 #in radian\n longitude2 = other_lon.to_f * Math::PI/180 #in radian\n cLa1 = Math.cos( latitude1 );\n x_A = RADIUS_EARTH * cLa1 * Math.cos( longitude1 )\n y_A = RADIUS_EARTH * cLa1 * Math.sin( longitude1 )\n z_A = RADIUS_EARTH * Math.sin( latitude1 );\n\n cLa2 = Math.cos( latitude2 );\n x_B = RADIUS_EARTH * cLa2 * Math.cos( longitude2 )\n y_B = RADIUS_EARTH * cLa2 * Math.sin( longitude2 )\n z_B = RADIUS_EARTH * Math.sin( latitude2 )\n \n #in meters\n distance = Math.sqrt( ( x_A - x_B ) * ( x_A - x_B ) + ( y_A - y_B ) * ( y_A - y_B ) + ( z_A - z_B ) * ( z_A - z_B ) )\nend", "def distance\n distance_and_arc[:distance]\n end", "def distance\n distance_and_arc[:distance]\n end", "def distance(a, b)\n Math.sqrt(((a.x - b.x) ** 2) + ((a.y - b.y) ** 2).abs)\n end", "def getDistanceBetween(lat1, lon1, lat2, lon2)\r\n rad_lat1 = lat1.to_f * Math::PI / 180.0\r\n rad_lat2 = lat2.to_f * Math::PI / 180.0\r\n rad_lon1 = lon1.to_f * Math::PI / 180.0\r\n rad_lon2 = lon2.to_f * Math::PI / 180.0\r\n\r\n dLat = (rad_lat2 - rad_lat1)\r\n dLon = (rad_lon2 - rad_lon1)\r\n\r\n a = Math.sin(dLat/2.0) * Math.sin(dLat/2.0) + Math.cos(rad_lat1) * Math.cos(rad_lat2) * Math.sin(dLon/2.0) * Math.sin(dLon/2.0)\r\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))\r\n d = EARTH_RAD_M * c\r\n\r\n return d\r\n end", "def get_distance(lat1, long1, lat2, long2)\n term1 = (Math.sin((lat2 - lat1) * Math::PI / 360 )) ** 2\n term2 = Math.cos(lat1 * Math::PI / 180) * Math.cos(lat2 * Math::PI / 180)\n term3 = (Math.sin((long2 - long1) * Math::PI / 360 )) ** 2\n distance = (2 * 3959 * Math.asin(Math.sqrt(term1 + term2 * term3))).round(1) \n end", "def calc_geo_distance(loc1, loc2)\n rad_per_deg = Math::PI/180 # PI / 180\n rkm = 6371 # Earth radius in kilometers\n rm = rkm * 1000 # Radius in meters\n\n dlat_rad = (loc2[:lat]-loc1[:lat]) * rad_per_deg # Delta, converted to rad\n dlon_rad = (loc2[:lng]-loc1[:lng]) * rad_per_deg\n\n lat1_rad = loc1[:lat] * rad_per_deg\n lng1_rad = loc1[:lng] * rad_per_deg\n lat2_rad = loc2[:lat] * rad_per_deg\n lng2_rad = loc2[:lng] * rad_per_deg\n\n a = Math.sin(dlat_rad/2)**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin(dlon_rad/2)**2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a))\n\n rm * c # Delta in meters\nend", "def distance\n distance = 0\n @solution.each { |route| distance += route.distance }\n return distance\n end", "def distance(lon1, lat1, lon2, lat2)\n Math.acos( Math.sin(lat1 * (Math::PI/180))*Math.sin(lat2*(Math::PI/180)) + Math.cos(lat1*Math::PI/180) * Math.cos(lat2*(Math::PI/180))*Math.cos((lon2 * Math::PI/180)-(lon1*Math::PI/180)) ) * 6371000\n end", "def distance_between (long1, long2, lat1, lat2)\n radlat1 = Math.PI * lat1/180\n \tradlat2 = Math.PI * lat2/180\n \ttheta = lon1-lon2\n \tradtheta = Math.PI * theta/180\n \tdist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n \tdist = Math.acos(dist)\n \tdist = dist * 180/Math.PI\n \tdist = dist * 60 * 1.1515\n dist = dist * 1.609344\n \treturn dist\n end", "def distance(node1, node2)\n distance = 0\n self.each_edge_in_path(node1, node2) do |source, target, edge|\n distance += get_edge_distance(edge)\n end\n distance\n end", "def distance(x1,y1,x2,y2)\n return ((x2 - x1)**2 + (y2 - y1)**2)**0.5\nend", "def distance(other)\n (other - self).magnitude.abs\n end", "def distance_to(other)\n pyth(self.x, self.y, other.x, other.y)\n \n# Math.sqrt((other.x - self.x) ** 2 + (other.y - self.y) ** 2)\n end", "def dist(a, b)\n ax, ay, _ = a\n bx, by, _ = b\n\n (ax-bx).abs + (ay-by).abs\nend", "def distance(g0, g1)\n Math::sqrt( ((g1.lat-g0.lat).abs**2) + ((g1.lon-g0.lon).abs**2) )\n end", "def distance object\n GeographyHelper.distance latitude, longitude, object.latitude, object.longitude\n end", "def distance(a, b)\n (a.x - b.x).abs + (a.y - b.y).abs\n end", "def distance_from(venue_2)\n # returns distance in miles\n parse_coordinates.present? && venue_2.parse_coordinates.present? ? Geocoder::Calculations.distance_between(parse_coordinates, venue_2.parse_coordinates) : 'NA'\n end", "def distance(p0, p1)\n a = factory.point(p0.x, p0.y)\n b = factory.point(p1.x, p1.y)\n\n a.distance(b) / 1000.0\n end", "def distance_to(x, y)\n return Math.hypot(x - @x, y - @y)\n end", "def distance(a, b)\n Integer(Math.sqrt(((b[0] - a[0])**2 + (b[1] - a[1])**2)))\n end", "def calculateDistance(r1,c1,r2,c2)\r\n\treturn Math.sqrt(((c1-c2) ** 2 + (r1 -r2) ** 2))\r\nend", "def distance_from_lat_lon(a, b)\n lat1 = a['lat']\n lon1 = a['lng']\n lat2 = b['lat']\n lon2 = b['lng']\n radlat1 = Math::PI * lat1/180\n radlat2 = Math::PI * lat2/180\n radlon1 = Math::PI * lon1/180\n radlon2 = Math::PI * lon2/180\n theta = lon1-lon2\n radtheta = Math::PI * theta/180\n dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = [[dist, -1.0].max, 1.0].min\n dist = Math.acos(dist)\n dist = dist * 180/Math::PI\n # seconds-in-a-degree * statute-miles-in-a-nautical-mile * kilometers-in-a-mile * meters-in-a-kilometer!\n # See http://stackoverflow.com/questions/389211/geospatial-coordinates-and-distance-in-kilometers-updated-again\n dist = dist * 60 * 1.1515 * 1.609344 * 1000\n dist\nend", "def distance(p1, p2)\n\t\tc = p1.count\n\t\tt = 0\n\t\tc.times do \t|n|\n\t\t\te = (p1[n] - p2[n]) ** 2\n\t\t\tt = t + e\t\t\n\t\tend\t\n\t\tt = Math.sqrt(t)\n\tend", "def distance_to(loc2)\n self.point.ellipsoidal_distance(loc2.point)/1000\n end", "def distance(value1, value2)\n n1_path = path(value1)\n return -1 if n1_path.empty?\n n2_path = path(value2)\n return -1 if n2_path.empty?\n lca = n1_path & n2_path\n return -1 if lca.empty?\n n1_path.length + n2_path.length - (2* lca.length)\n end", "def\t_calc_geo_distance(lon1, lat1, lon2, lat2)\n\t\t# Radius of the Earth [km]\n\t\tr = 6371 \n\t\td_lat = _deg2rad(lat1-lat2)\n\t\td_lon = _deg2rad(lon1-lon2)\n\t\ta = Math.sin(d_lat/2) * Math.sin(d_lat/2) +\n\t\tMath.cos(_deg2rad(lat1)) * Math.cos(_deg2rad(lat2)) *\n\t\tMath.sin(d_lon/2) * Math.sin(d_lon/2)\n\n\n\t\tc = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))\n\t\td = r * c\n\t\treturn d * 1000\n\tend", "def distance(a, b)\n if a.is_a?(String) && b.is_a?(String)\n Twins::Utilities.string_distance(a, b) * -1\n elsif a.is_a?(Numeric) && b.is_a?(Numeric)\n Twins::Utilities.numeric_distance(a, b)\n else\n raise StandardError, \"Distance can only be determined between two elements of kind 'String' or 'Numeric'\"\n end\n end", "def distance_between(p1, p2)\n Math.sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2)\n end", "def distance(a, b)\n return @distance_function.call(a, b) if @distance_function\n return euclidean_distance(a, b)\n end", "def dist(r1, c1, r2, c2)\r\n return Math.sqrt((c1-c2)**2 + (r1-r2)**2)\r\nend", "def dist (x1, y1, x2, y2)\n return (x1 - x2) ** 2 + (y1 - y2) ** 2\nend", "def find_distance_between_planets(planet_1, planet_2)\n information_hash = {}\n information_hash[:planet_1] = @planets[planet_1.to_i].name\n information_hash[:planet_2] = @planets[planet_2.to_i].name\n distance = @planets[planet_1.to_i].distance_from_sun - @planets[planet_2.to_i].distance_from_sun\n information_hash[:distance] = distance.abs\n\n information_hash\n end", "def distance( origin, destination )\n return @graph[origin][destination]\n end", "def distance(other)\n\t\treturn ((other.x-@x).abs + (other.y-@y).abs + (other.z-@z).abs)/2\n\tend", "def distance(start_point, end_point)\n result = prepare_url(start_point, end_point)\n return result[\"routes\"].first[\"legs\"].first[\"distance\"][\"value\"]/1000\n end", "def calculate_distance(lat1,long1,lat2,long2)\n\t\tdelta_long = convert_degrees_to_radians(long2 - long1)\n\t\tdelta_lat = convert_degrees_to_radians(lat2 - lat1)\n\t\t\n\t\ta = (Math.sin(delta_lat / 2) * Math.sin(delta_lat / 2)) + Math.cos(convert_degrees_to_radians(lat1)) * Math.cos(convert_degrees_to_radians(lat2)) * (Math.sin(delta_long / 2) * Math.sin(delta_long / 2))\n\t\tangle = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))\n\t\treturn angle * RADIUS_OF_EARTH_KM\n\tend", "def distance(long1, lat1, long2, lat2)\n theta = long1 - long2\n rad_per_deg = Math::PI/180 # PI / 180\n dlat1 = lat1 * rad_per_deg\n dlat2 = lat2 * rad_per_deg\n dlon_diff = theta *rad_per_deg\n dist = (Math.sin(dlat1) * Math.sin(dlat2)) + (Math.cos(dlat1) * Math.cos(dlat2) * Math.cos(dlon_diff))\n dist_acos = Math.acos(dist)\n dist_deg = dist_acos * (180 / Math::PI)\n dist_deg * 69.09 * 1.6093 # to convert mile in Kilometers\n \n end", "def find_shortest_distance(from_city,to_city)\n\n # store the intermediate cities in Queue\n intermedite_cities = Queue.new\n\n # Store the start city\n intermedite_cities.push [from_city,0]\n \n minimum_distance =0\n\n #Find distance till target city reached\n until intermedite_cities.empty?\n #pop up the first element\n city = intermedite_cities.pop\n\n if city.first == to_city\n minimum_distance = city.last.to_i if (minimum_distance > city.last.to_i)|| minimum_distance==0\n next\n end\n\n #store adjucent cities in queue\n old_distance = city.last.to_i\n for adjust_city in adjucent_cities(city.first)\n if (minimum_distance > old_distance+adjust_city.last.to_i) || minimum_distance==0\n intermedite_cities.push [adjust_city.first,old_distance+adjust_city.last.to_i]\n end\n end\n end\n minimum_distance\n end", "def distance_from_origin(origin)\n calculate_distance_from_origin(origin)\n end", "def distance\n return \"\" if @establishments.empty?\n (@establishments.first[\"Distance\"].to_f * METRES_IN_A_MILE).to_i\n end", "def get_distance(lat1, lng1, lat2, lng2)\n validate_lat_lngs(lat1, lng1)\n validate_lat_lngs(lat2, lng2)\n\n lat1 = to_radians(lat1)\n lng1 = to_radians(lng1)\n lat2 = to_radians(lat2)\n lng2 = to_radians(lng2)\n\n distance = Math.acos(Math.sin(lat1) *\n Math.sin(lat2) + Math.cos(lat1) *\n Math.cos(lat2) * Math.cos(lng1 - lng2))\n (distance * EARTH_RADIUS).round\n end", "def find_distance(type: :min)\n distance = @cities.permutation(@cities.size).map do |path|\n path.each_cons(2).reduce(0) do |sum, pair|\n sum + @distances[distance_key(pair[0], pair[1])]\n end\n end.send(type)\n end", "def get_distance(atomid1, atomid2)\n # calculate distance matrix on request\n if not @distance_matrix\n calculate_distancematrix\n end\n\n return @distance_matrix.get_value(atomid1, atomid2)\n end" ]
[ "0.8227443", "0.7703495", "0.7438826", "0.74112356", "0.71867234", "0.71397513", "0.7052167", "0.69245255", "0.69197166", "0.68925357", "0.68689406", "0.6844648", "0.6843373", "0.6812917", "0.68090725", "0.6795379", "0.67788523", "0.6722451", "0.6704945", "0.66986805", "0.6685644", "0.6665823", "0.6660441", "0.6638828", "0.66313595", "0.6629995", "0.66084117", "0.6607183", "0.6602592", "0.6593717", "0.6584782", "0.6553378", "0.65500456", "0.6547575", "0.6546609", "0.6525051", "0.6523756", "0.6521078", "0.651246", "0.6511637", "0.6507742", "0.6507679", "0.65026426", "0.6447051", "0.6445821", "0.6433143", "0.64158016", "0.6415783", "0.6412994", "0.64118236", "0.64110667", "0.6410085", "0.6410085", "0.63836306", "0.63836306", "0.63813263", "0.63669956", "0.63669956", "0.63641447", "0.6345615", "0.63445294", "0.6340195", "0.63375336", "0.63272923", "0.6325049", "0.6324481", "0.6319237", "0.6313702", "0.6313118", "0.6312632", "0.6308474", "0.630654", "0.6302442", "0.6288707", "0.6286468", "0.6282658", "0.6271625", "0.62651294", "0.6259486", "0.62533635", "0.6250517", "0.6242453", "0.6232097", "0.6224669", "0.621817", "0.6216331", "0.6215012", "0.6211663", "0.6208482", "0.6206426", "0.62032783", "0.61900485", "0.618186", "0.61807424", "0.6180325", "0.615765", "0.6153327", "0.61505336", "0.6133646", "0.613286" ]
0.6485588
43
gets reverse in range
def two_opt(shake) perm = Array.new(shake) c1, c2 = rand(perm.size), rand(perm.size) collection = [c1] collection << ((c1 == 0 ? perm.size - 1 : c1 - 1)) collection << ((c1 == perm.size - 1) ? 0 : c1 + 1) c2 = rand(perm.size) while collection.include? (c2) c1, c2 = c2, c1 if c2 < c1 # +++ reverses in range perm[c1...c2] = perm[c1...c2].reverse perm end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_range(min, max)\n reversed = [] \n \n index = max - 1 \n \n while index > min \n reversed << index \n index -= 1\n end \n \n return reversed \n \nend", "def reverse_range(min, max)\n\ti = max\n \tarry = []\n \twhile i > min + 1\n i -=1\n arry << i\n end\n return arry\n\nend", "def reverse_range(min, max)\n\ti = max-1\n \tarr = []\n while i > min\n\t\tarr << i\n \ti -= 1\n end\n \treturn arr\nend", "def reverse_range(min, max)\n # Write your code here\nend", "def reverse_range(min, max)\n\trange = []\n \n\ti = max - 1\n\twhile i > min\n\t\trange << i\n\t\ti -= 1\n end\n \n\treturn range\nend", "def reverse_range(min, max)\n nums = []\n \n i = max - 1\n while i > min\n nums << i\n \n i -= 1\n end\n \n return nums\n end", "def reverse_range(min, max)\n reverse_numbers = []\n \n i = max - 1\n while i > min\n reverse_numbers << i\n \n i -= 1\n end\n \n return reverse_numbers\nend", "def reverse_range(min, max)\n nums = []\n i = max\n while i > min\n if\n i == max\n i -= 1\n next\n end\n nums << i\n i -= 1\n end\n return nums\n end", "def reverse_range(min, max)\n reverse_arr = []\n\n i = max -1\n while i > min\n reverse_arr << i\n i -= 1\n end\n return reverse_arr\nend", "def reverse_range(min, max)\n newArr = []\n i = max - 1\n while i >= min +1\n newArr << i\n i -= 1\n end\n return newArr\n end", "def reverse_range(min, max)\n new_arr = []\n\n i = max-1\n while i >= min+1 # i > min\n # reverse\n # exclude\n new_arr << i\n i -= 1\n end\n\n return new_arr\n\nend", "def reverse_range(min, max) # Define method\n \n i = max - 1 # Because we are trying to reverse the order of array we have to start with the max value; minus one because it does not include min or max\n \n new_array = [] # Create an empty array to shovel values into\n \n while i > min # We have to start from the max value which will be in i, minus one of course, so for the loop to run i has to always be greater than min which will be the last iteration\n\n new_array << i # Shovels the value of i into new array\n \n i -= 1 # When we want to go up in numbers we use plus equals, since we are going down in numbers we use -=\n end\n return new_array # REturns new array values after the end of while loop\n\nend", "def zrevrange(key, start, stop, **options); end", "def get_range_by_reverse_rank(from, to, options = {})\n connection.zrange(key_label, from, to, options)\n end", "def reverse() end", "def reverse() end", "def zrevrange(key, start, stop, withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def zrevrange(key, start, stop, **options)\n node_for(key).zrevrange(key, start, stop, **options)\n end", "def xrevrange(key, range_end = T.unsafe(nil), start = T.unsafe(nil), count: T.unsafe(nil)); end", "def reverse!\n low = 0\n high = self.__size - 1\n while low < high\n a = self.__at(low)\n b = self.__at(high)\n self.__at_put(high, a)\n self.__at_put(low, b)\n low = low + 1\n high = high - 1\n end\n self\n end", "def zrevrange(key, start, stop, options = {})\n args = [:zrevrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def zrevrangebylex(key, max, min, limit: T.unsafe(nil)); end", "def reverse_number_to_start_from_right(array)\n array = array.reverse\n return array\n end", "def reverse; end", "def reverse; end", "def rslice(range, options = {})\n start, finish = range_pair(range)\n fetch_range :zrevrange, start, finish, options\n end", "def get_range_by_rank(from, to, options = {})\n connection.zrevrange(key_label, from, to, options)\n end", "def reverse!\n @upwards = !@upwards\n skip!(2)\n end", "def reverse!() end", "def reverse!() end", "def range(start_num, end_num)\n return [] if end_num =< start_num\n range(start_num, end_num - 1) << end_num - 1\nend", "def get_upper_limit_of(range)\n\tn = 1..20\n\tn.last\nend", "def reverse(input); end", "def range(start,ending)\r\n return [] if ending <= start\r\n\r\n range(start, ending-1) << ending -1\r\nend", "def range\n from_truncated..to_truncated\n end", "def sequence_2(num)\n num > 0 ? (1..num).to_a : (num..-1).to_a.reverse\nend", "def zrevrangebylex(key, max, min, options = {})\n args = [:zrevrangebylex, key, min, max]\n\n limit = options[:limit]\n args.concat(['LIMIT'] + limit) if limit\n\n call(key, args, read: true)\n end", "def get_range(from, to, options = {})\n if options.delete(:include_boundaries)\n connection.zrevrangebyscore(key_label, to, from, options)\n else\n connection.zrevrangebyscore(key_label, \"(#{to}\", \"(#{from}\", options)\n end\n end", "def backwards(input)\n input.reverse\nend", "def reverse\n end", "def reverse\n end", "def range(start, last)\n return [] if last < start\n range(start, last - 1) << last - 1\nend", "def reverse_sequence\n revcom(sequence)\n end", "def reversed_number(num)\n\nend", "def seek_reverse(amount = opts[:seek_size])\n seek_by(-amount)\n end", "def range(input); end", "def range(arr)\n arr = arr.sort \n return arr[arr.length-1] - arr[0]\nend", "def reverse(string, start ,last)\n i = start\n j = last\n\n while i < j\n string[j], string[i] = string[i], string[j]\n i += 1\n j -= 1\n end\n return string\nend", "def reverse(s)\n\tmid = s.length / 2\n\n\t# alt: mid.times do |i|\n\t# alt: for i in (0..mid-1)\n\t0.upto(mid - 1) do |i|\n\t\ts[i], s[-i-1] = s[-i-1], s[i]\n\tend\n\n\ts\nend", "def range(arr)\n arr.sort[-1] - arr.sort[0]\nend", "def auto_range(direction); end", "def fliplr\n reverse(1)\n end", "def string_reverse(my_string, beginning, ending)\n front_index = beginning\n back_index = ending\n\n while front_index < back_index\n front_value = my_string[front_index]\n back_value = my_string[back_index]\n\n my_string[front_index] = back_value\n my_string[back_index] = front_value\n\n front_index += 1\n back_index -= 1\n end\nend", "def reverse(my_words, start_index, end_index)\n while start_index < end_index\n temp = my_words[start_index]\n my_words[start_index] = my_words[end_index]\n my_words[end_index] = temp\n start_index += 1\n end_index -= 1\n end\n return my_words\nend", "def range\n @from..@to\n end", "def reverse_seq(n)\n # long solution\n # arr = []\n # for i in 1..n do\n # arr.unshift(i)\n # end\n # p arr\n # sort solution\n p Array(1..n).reverse\n end", "def rev(n)\n n.to_s.chars.reverse.join('').to_i\nend", "def integer_reverse (i)\n y = 0\n #reversed = []\n\n while i > 0 do\n y = y*10\n y += (i%10)\n i /= 10\n #reversed << y\n end\n\n #return reversed[-1]\n return y\nend", "def get_upper_limit_of(range)\n range.last\nend", "def sequence(num)\n num > 0 ? (1..num).to_a : (num..1).to_a.reverse\nend", "def sequence(num)\n num > 0 ? (1..num).to_a : (num..1).to_a.reverse\nend", "def reverse()\n #This is a stub, used for indexing\nend", "def range(*args)\n value = \"[\"\n args.each_slice(2) do |from, to|\n from = sanitize(from)\n to = sanitize(to)\n value += \"#{from}-#{to}\"\n end\n value += \"]\"\n append value\n end", "def range; end", "def range; end", "def range; end", "def reverse(x)\n if x >= 0\n arr = x.to_s.chars.map(&:to_i).reverse.join.to_i\n puts(arr)\n else\n arr = x.to_s.chars.map(&:to_i)\n arr.shift\n arr = -(arr.reverse.join.to_i)\n puts(arr)\n end\nend", "def range_rc(start_num, end_num)\n\n return [] if end_num <= start_num\n range_rc(start_num, end_num - 1) + [end_num - 1]\nend", "def reverse(x)\n if x >= 0\n return arr = x.to_s.chars.map(&:to_i).reverse.join.to_i\n else\n arr = x.to_s.chars.map(&:to_i)\n return arr.shift\n end\nend", "def increment_upper\n Range.new(self.begin, self.end + 1)\n end", "def range(start,final)\n return [] if start >= final\n return [final - 1] if start == final - 1\n\n arr = []\n result = range(start,final-1)\n arr.concat(result)\n arr.push ( final - start )\n arr\nend", "def range(start, finish)\n return [] if finish < start\n return [start] if finish - 1 == start\n range(start, finish - 1) + [finish - 1]\nend", "def sequence(num)\n\n if num > 0\n (1..num).to_a\n elsif num < 0\n (num..-1).to_a.reverse\n else\n num\n end \nend", "def my_reverse(arr)\n result = []\n for i in (0..arr.length-1).reverse_each #maybe this is cheating?\n result << arr[i]\n end\n result\nend", "def rec_range(start,last)\r\n return [] if last < start\r\n return [start] if start == last-1\r\n \r\n rec_range(start,last-1) << last-1\r\n\r\nend", "def range(start,last) # recursive Version\n return [] if start >= last\n [start] + range(start+1,last)\nend", "def xrevrange(key, range_end = '+', start = '-', count: nil)\n args = [:xrevrange, key, range_end, start]\n args.concat(['COUNT', count]) if count\n send_command(args, &HashifyStreamEntries)\n end", "def reverse\n cursor = @tail\n @head = cursor\n until !cursor.prev do\n\n temp = cursor.next\n cursor.next = cursor.prev\n cursor.prev = temp\n cursor = cursor.next\n \n end\n cursor.prev = cursor.next\n cursor.next = nil\n\n @tail = cursor \n \n end", "def my_reverse(string)\n\t\ta = string.length - 1\n\t\t@new_string = \"\"\n\t\ta.downto(0) { |i| @new_string << string[i] }\n\t\tprint @new_string\n\tend", "def range\n @range ||= 0.upto(@limit)\n end", "def zrange(key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def test_Range_InstanceMethods_last\n\t\tassert_equal('bb', ('aa'..'bb').last)\n\t\tassert_equal(['ax','ay','az','ba','bb'], ('aa'..'bb').last(5))\n\tend", "def range(s, e)\n (s...e).to_a\nend", "def rev\n end", "def down\n self.x = (x+1)%10\n end", "def string_reverse(my_string, start_index, end_index)\n i = start_index\n j = end_index\n while i < j\n #flipflop characters using holding variable as a place to put one character while the other goes in its place.\n holding = my_string[i]\n my_string[i] = my_string[j]\n my_string[j] = holding\n\n #move up and move down the string.\n i += 1\n j -= 1\n end\n return my_string\nend", "def get_sequence(low, high)\n (low..high).to_a\nend", "def reverse!(list)\n times_to_loop = (list.size / 2)\n times_to_loop.times do |num|\n list[0 + num], list[-1 + (-num)] = list[-1 + (-num)], list[0 + num]\n end\n list\nend", "def translate_range(first, last)\n (TurkishRanges::TrText.new(first)..TurkishRanges::TrText.new(last)).to_a.join \\\n complement_range(first, last)\n end", "def reverse_int(int)\nend", "def shorten_range( range_list )\n int_range = range_list.map { |item| item.to_i }\n first_val = nil\n last_val = nil\n ret_list = []\n int_range.sort.each { |current_val|\n first_val = current_val if first_val == nil\n if last_val == nil\n # no values seen yet\n last_val = current_val\n elsif current_val == last_val + 1\n # next in sequence? ... if so then just iterate\n last_val = current_val\n else\n # not next, then close old sequence\n if first_val != last_val and last_val != nil\n ret_list.push( \"#{first_val}-#{last_val}\" )\n else\n ret_list.push( \"#{first_val}\" )\n end\n first_val = current_val\n last_val = current_val \n end\n }\n # Sequence not closed\n if first_val != nil\n if first_val != last_val and last_val != nil\n ret_list.push( \"#{first_val}-#{last_val}\" )\n else\n ret_list.push( \"#{first_val}\" )\n end\n end\n return ret_list.join(\", \")\n end", "def using_reverse(array)\narray.reverse\nend", "def using_reverse(array)\narray.reverse\nend", "def range(arr)\n\nend", "def range\n (@from..@to)\n end", "def range(start,finish)\n if start == finish\n return [start]\n end\n\n prev_arr = range(start+1, finish)\n prev_arr << start\n return prev_arr\nend", "def range(start, finish)\n return [] if start >= finish\n [start + 1] + range(start + 1, finish)\nend", "def get_upper_limit_of(range)\n range.end\nend", "def reverse(a)\n new = []\n (0...a.size).each { |i| new << a[a.size - i - 1] }\n new\nend", "def reverse(x)\n int_str = x.to_s\n res_str = String.new\n if int_str[0] == '-'\n res_str << int_str[0]\n int_str.slice!(0)\n end\n i = int_str.size - 1\n int_str.size.times do\n res_str << int_str[i]\n i -= 1\n end\n res = res_str.to_i\n res.between?(-2**31, 2**31 - 1) ? res : 0\nend", "def to_range\n min .. max\n end" ]
[ "0.7990748", "0.7750124", "0.77284634", "0.7728301", "0.77241874", "0.7718352", "0.7688151", "0.7674692", "0.7667949", "0.76237965", "0.7498455", "0.7486348", "0.7342698", "0.7119615", "0.7099041", "0.7099041", "0.69748014", "0.68238634", "0.6802179", "0.6758775", "0.6694144", "0.6685659", "0.6666161", "0.66637856", "0.66637856", "0.66400963", "0.6624634", "0.6623815", "0.6622297", "0.6622297", "0.65465903", "0.6525214", "0.6509822", "0.650016", "0.647545", "0.64437276", "0.64337796", "0.64297706", "0.6407249", "0.63887554", "0.63887554", "0.6387105", "0.63693565", "0.63321394", "0.6329751", "0.63176763", "0.6301275", "0.62883836", "0.6274855", "0.62724566", "0.6258994", "0.62534696", "0.62327", "0.61982554", "0.61914515", "0.6181825", "0.6173486", "0.61666816", "0.6157038", "0.61396676", "0.61396676", "0.61394584", "0.61272883", "0.612486", "0.612486", "0.612486", "0.6117067", "0.61136585", "0.6107588", "0.61047995", "0.6097208", "0.60878515", "0.60841155", "0.60724753", "0.60678715", "0.60635626", "0.60516495", "0.60328054", "0.6029869", "0.60273594", "0.6026808", "0.6022909", "0.60227615", "0.6021875", "0.6021077", "0.6019414", "0.6017526", "0.59931403", "0.5991988", "0.59832877", "0.5980824", "0.59723455", "0.59723455", "0.5956882", "0.59563607", "0.59475243", "0.59470654", "0.5943418", "0.5941448", "0.59376216", "0.59354293" ]
0.0
-1
GET /construction_expenses GET /construction_expenses.json
def index @construction_expenses = ConstructionExpense.all.order("created_at DESC") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @expenses = find_expenses.all\n render json: @expenses\n end", "def create\n @construction_expense = ConstructionExpense.new(construction_expense_params)\n\n respond_to do |format|\n if @construction_expense.save\n format.html { redirect_to root_path, notice: 'Construction expense was successfully created.' }\n format.json { render :show, status: :created, location: @construction_expense }\n else\n format.html { render :new }\n format.json { render json: @construction_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def set_construction_expense\n @construction_expense = ConstructionExpense.find(params[:id])\n end", "def index\n @api_v1_expenses = Api::V1::Expense.all\n end", "def show\n @expense = current_user.organization.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def index\n @creatives = @org.creatives\n end", "def index\n @expenses = Expense.all\n end", "def show\n @construction = Construction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @construction }\n end\n end", "def index\n @expenses = Expense.all\n respond_with @expenses\n end", "def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end", "def index\n @expenses_props = Expense.all\n end", "def index\n @expenses = get_class.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end", "def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def expenses\n @expenses ||= Harvest::API::Expenses.new(credentials)\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def index\n @defenses = Defense.all\n end", "def index\n @expenses = Expense.search(params[:search])\n end", "def index\n @expenses = Expense.includes(:place, :account, sub_category: :category).order('paid_at DESC').page(params[:page])\n end", "def index\n @dispenses = Dispense.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def new\n @construction = Construction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction }\n end\n end", "def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @competence_center = CompetenceCenter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competence_center }\n end\n end", "def index\n @rec_expenses = RecExpense.all\n end", "def new\n @competence_center = CompetenceCenter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competence_center }\n end\n end", "def index\n @office_expenses = OfficeExpense.all\n end", "def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end", "def index\n @offenses = Offense.all\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @expenses = Expense.limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end", "def index\n @lincenses = Lincense.all\n end", "def show\n @expenses = @expenses_file.expenses.select(\"strftime('%m', date) as month, strftime('%Y', date) as year, SUM(tax_amount) + SUM(pre_tax_amount) AS total\").\n group('month, year').order('year, month').as_json\n end", "def index\n @civilizations = Civilization.all\n end", "def show\n @expense = Expense.find(params[:id])\n index\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def new\n @expense = Expense.new\n @workflow = Workflow.find(params[:wid])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def index\n @calorie_consumptions = CalorieConsumption.all\n end", "def new\n @expansion = Expansion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expansion }\n end\n end", "def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end", "def show\n render json: @petty_cash_expense\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def show\n @cold_production_year = ColdProductionYear.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cold_production_year }\n end\n end", "def index\n @livingexpenses = Livingexpense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @livingexpenses }\n end\n end", "def show\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluable_competency }\n end\n end", "def index\n @sunshine_center_other_expenses = SunshineCenterOtherExpense.all\n end", "def index\n @record_expenses = RecordExpense.all\n end", "def new\n @exprience = Exprience.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exprience }\n end\n end", "def show\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_state }\n end\n end", "def update\n respond_to do |format|\n if @construction_expense.update(construction_expense_params)\n format.html { redirect_to @construction_expense, notice: 'Construction expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @construction_expense }\n else\n format.html { render :edit }\n format.json { render json: @construction_expense.errors, status: :unprocessable_entity }\n end\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 index\n @marketing_expenses = MarketingExpense.all\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @expense }\n format.js\n end\n end", "def show\n @construction_style = ConstructionStyle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @construction_style }\n end\n end", "def show\n @civilization = Civilization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @civilization }\n end\n end", "def index\n @digital_editions = DigitalEdition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @digital_editions }\n end\n end", "def index\n @expenses = Expense.get_expenses(\n current_user[:id],\n session[:budget]['dateStart'],\n session[:budget]['dateEnd'],\n sort\n )\n\n get_tag_forms\n\n @expenses_sum = calculate_expenses_sum @expenses\n\n get_charts_and_tags @expenses\n end", "def index\n get_contracts\n end", "def new\n @constitution = Constitution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @constitution }\n end\n end", "def index\n redirect_to home_entries_path\n\n @entries = current_user.entries.expenses\n end", "def show\n render json: @citation\n end", "def show\n render json: @citation\n end", "def index\n @cetegories = Cetegory.all\n end", "def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end", "def show\n @complexity = Complexity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complexity }\n end\n end", "def new\n @cold_production_year = ColdProductionYear.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cold_production_year }\n end\n end", "def new\n @civilization = Civilization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @civilization }\n end\n end", "def index\n @educations = Education.all\n render json: @educations\n end", "def show\n @congressional_district = CongressionalDistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @congressional_district }\n end\n end", "def show\n @explaination = Explaination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @explaination }\n end\n end", "def show\n @expansion = Expansion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expansion }\n end\n end", "def index\n @shared_expenses = SharedExpense.all\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def new\n @construction_style = ConstructionStyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction_style }\n end\n end", "def show\n @mostsmallconstruction = Mostsmallconstruction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallconstruction }\n end\n end", "def show\n cf_get(path: \"/organizations/#{org_id}\")\n end", "def show\n @charge = Charge.find(params[:id])\n @competences = @charge.competences\n @title = \"Cargo\"\n \n end", "def index\n @contracts = @project.contracts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contracts }\n end\n end", "def new\n @statement = Statement.find(params[:statement_id])\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def index\n @discipline = Discipline[params[\"discipline\"]]\n @discipline_names = Discipline.names\n @calculations = Calculations::V3::Calculation.where(year: @year).includes(:event)\n\n respond_to do |format|\n format.html\n format.xml do\n fresh_when RacingAssociation.current, public: true\n all_events\n end\n end\n end", "def index\n @contracts = Contract.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contracts }\n end\n end", "def new\n @occasion = Occasion.new\n @ocats = Ocat.all\n @products = Product.all\n @productcats = ProductCat.all\n @category_product_link = CategoryProductLink.all\n @gift_types = GiftType.all\n @occasion.date ||= params[:date]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @occasion }\n end\n end", "def show\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_evaluation }\n end\n end", "def index\n @content_explores = ContentExplore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_explores }\n end\n end", "def show\n @ecg = Ecg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ecg }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @life_insurance }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end", "def index\n\n # authenticate request\n if auth_user\n\n # check user has data to show\n if Expense.user(@user).count ==0\n render json: { message: \"You have no data - please submit date via a POST request\" }, status: 401\n else\n\n # retrieve paramaters\n # set start and end date to data min/max if not provided \n start_date = params[:start_date].respond_to?(:to_date) ? params[:start_date].to_date : Expense.user(@user).min_by(&:date).date\n end_date = params[:end_date].respond_to?(:to_date) ? params[:end_date].to_date : Expense.user(@user).max_by(&:date).date\n category = params[:category]\n\n # request category if provided (uses scopes defined in Expense model)\n if category == nil\n @expenses = Expense.user(@user).after_date(start_date).before_date(end_date)\n else\n @expenses = Expense.user(@user).after_date(start_date).before_date(end_date).category(category)\n end\n end\n\n else\n # request not authenticated\n return render json: { message: \"Invalid Token\", status: 400}, status: 400\n end\n end", "def index\n authorize(@project, policy_class: CitationPolicy)\n @citations = CitationSupplyingService.new.find_by_project_id(@project.id)\n respond_to do |format|\n format.fhir_xml { render xml: @citations }\n format.fhir_json { render json: @citations }\n format.html { render json: @citations }\n format.json { render json: @citations }\n format.xml { render xml: @citations }\n format.all { render text: 'Only HTML, JSON and XML are currently supported', status: 406 }\n end\n end", "def new\n @expense_state = ExpenseState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense_state }\n end\n end", "def new\n @expense = Expense.new\n\n respond_to do |format|\n format.json { render json: @expense }\n format.js\n end\n end", "def index\n @incomes = current_company.incomes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @incomes }\n end\n end", "def index\n @climber_educations = ClimberEducation.all\n end", "def agency_chart\n if(params[ :year ].nil?)\n params[ :year ] = '2015'\n else\n # Nothing to do.\n end\n expenses_of_public_agency = HelperController.expenses_year( \n params[ :id ].to_i, params[ :year ] )\n expenses_list = change_type_list_expenses( \n expenses_of_public_agency, params[ :year ] )\n\n respond_to do |format|\n format.json { render json: expenses_list }\n end\n end", "def show\n @thermo_oil_production = ThermoOilProduction.find(params[:id])\n @thermo_oil_production_years = ThermoOilProductionYear.find_all_by_thermoOilProduction_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thermo_oil_production }\n end\n end" ]
[ "0.6659299", "0.6520159", "0.65055424", "0.64795685", "0.6426143", "0.6382438", "0.63674146", "0.63465184", "0.62532586", "0.6242231", "0.62382334", "0.6213262", "0.6213234", "0.6207032", "0.6184197", "0.61797196", "0.61617935", "0.61617935", "0.61617935", "0.61617935", "0.61617935", "0.61454386", "0.6078951", "0.60648024", "0.6054186", "0.60456926", "0.60420597", "0.6026583", "0.59829146", "0.59655464", "0.5951837", "0.59441817", "0.59208894", "0.5900124", "0.5898394", "0.5880948", "0.5873989", "0.5873389", "0.5863724", "0.5844708", "0.58416325", "0.5840732", "0.58367896", "0.5833611", "0.58287615", "0.5824341", "0.5823213", "0.5821206", "0.5803113", "0.5801346", "0.5790705", "0.57879734", "0.578146", "0.5777556", "0.5776275", "0.57727253", "0.5762457", "0.5760568", "0.5758796", "0.5757261", "0.57538414", "0.5746248", "0.5740619", "0.573924", "0.57334447", "0.57322264", "0.57322264", "0.5729079", "0.5720131", "0.5715661", "0.5714881", "0.5703015", "0.5700676", "0.56996226", "0.56993186", "0.56968373", "0.56950486", "0.56929296", "0.56900454", "0.5688405", "0.5684885", "0.56790143", "0.5677756", "0.56757027", "0.5674905", "0.5672555", "0.5660862", "0.5653163", "0.56507266", "0.5647129", "0.5647074", "0.5638214", "0.56365657", "0.56331515", "0.56329757", "0.5631159", "0.5629356", "0.5624955", "0.5621317", "0.5614759" ]
0.6559654
1
GET /construction_expenses/1 GET /construction_expenses/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @expense = current_user.organization.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def set_construction_expense\n @construction_expense = ConstructionExpense.find(params[:id])\n end", "def index\n @expenses = find_expenses.all\n render json: @expenses\n end", "def index\n @api_v1_expenses = Api::V1::Expense.all\n end", "def create\n @construction_expense = ConstructionExpense.new(construction_expense_params)\n\n respond_to do |format|\n if @construction_expense.save\n format.html { redirect_to root_path, notice: 'Construction expense was successfully created.' }\n format.json { render :show, status: :created, location: @construction_expense }\n else\n format.html { render :new }\n format.json { render json: @construction_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @construction_expenses = ConstructionExpense.all.order(\"created_at DESC\")\n end", "def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def index\n @expenses = Expense.all\n end", "def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n @construction = Construction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @construction }\n end\n end", "def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def index\n @creatives = @org.creatives\n end", "def index\n @expenses_props = Expense.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def new\n @expense = Expense.new\n @workflow = Workflow.find(params[:wid])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end", "def index\n @expenses = get_class.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def index\n @expenses = Expense.all\n respond_with @expenses\n end", "def show\n @expense = Expense.find(params[:id])\n index\n end", "def expenses\n @expenses ||= Harvest::API::Expenses.new(credentials)\n end", "def index\n @dispenses = Dispense.all\n end", "def index\n @defenses = Defense.all\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 new\n @construction = Construction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction }\n end\n end", "def show\n @competence_center = CompetenceCenter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competence_center }\n end\n end", "def index\n @expenses = Expense.includes(:place, :account, sub_category: :category).order('paid_at DESC').page(params[:page])\n end", "def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end", "def index\n @rec_expenses = RecExpense.all\n end", "def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end", "def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end", "def new\n @expansion = Expansion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expansion }\n end\n end", "def show\n @expenses = @expenses_file.expenses.select(\"strftime('%m', date) as month, strftime('%Y', date) as year, SUM(tax_amount) + SUM(pre_tax_amount) AS total\").\n group('month, year').order('year, month').as_json\n end", "def new\n @exprience = Exprience.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exprience }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @expense }\n format.js\n end\n end", "def show\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_state }\n end\n end", "def index\n @expenses = Expense.search(params[:search])\n end", "def show\n @explaination = Explaination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @explaination }\n end\n end", "def new\n @statement = Statement.find(params[:statement_id])\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def show\n render json: @petty_cash_expense\n end", "def show\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluable_competency }\n end\n end", "def new\n @competence_center = CompetenceCenter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competence_center }\n end\n end", "def show\n @expansion = Expansion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expansion }\n end\n end", "def show\n @cold_production_year = ColdProductionYear.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cold_production_year }\n end\n end", "def index\n @offenses = Offense.all\n end", "def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end", "def show\n @initiative = Initiative.find(params[:id])\n\n respond_to do |format|\n format.html # _show.html.erb\n format.json { render json: @initiative }\n end\n end", "def index\n @expenses = Expense.limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end", "def update\n respond_to do |format|\n if @construction_expense.update(construction_expense_params)\n format.html { redirect_to @construction_expense, notice: 'Construction expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @construction_expense }\n else\n format.html { render :edit }\n format.json { render json: @construction_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @office_expenses = OfficeExpense.all\n end", "def index\n @record_expenses = RecordExpense.all\n end", "def new\n @constitution = Constitution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @constitution }\n end\n end", "def show\n @expenditure = Expenditure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expenditure }\n end\n end", "def show\n @construction_style = ConstructionStyle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @construction_style }\n end\n end", "def show\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_evaluation }\n end\n end", "def show\n @complexity = Complexity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complexity }\n end\n end", "def show\n @charge = Charge.find(params[:id])\n @competences = @charge.competences\n @title = \"Cargo\"\n \n end", "def index\n @shared_expenses = SharedExpense.all\n end", "def new\n @occasion = Occasion.new\n @ocats = Ocat.all\n @products = Product.all\n @productcats = ProductCat.all\n @category_product_link = CategoryProductLink.all\n @gift_types = GiftType.all\n @occasion.date ||= params[:date]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @occasion }\n end\n end", "def show\n @mostsmallconstruction = Mostsmallconstruction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallconstruction }\n end\n end", "def index\n @lincenses = Lincense.all\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def new\n @expense = Expense.new\n\n respond_to do |format|\n format.json { render json: @expense }\n format.js\n end\n end", "def show\n @civilization = Civilization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @civilization }\n end\n end", "def show\n @livingexpense = Livingexpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @livingexpense }\n end\n end", "def new\n @explaination = Explaination.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @explaination }\n end\n end", "def show\n @recipy = Recipy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipy }\n end\n end", "def show\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_expense_type }\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 @livingexpenses = Livingexpense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @livingexpenses }\n end\n end", "def new\n @expense_state = ExpenseState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense_state }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @life_insurance }\n end\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def show\n @exp = Exp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exp }\n end\n end", "def show\n respond_with @expense\n end", "def show\n @congressional_district = CongressionalDistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @congressional_district }\n end\n end", "def index\n @calorie_consumptions = CalorieConsumption.all\n end", "def show\n @contract_doc_category = ContractDocCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_doc_category }\n end\n end", "def set_api_v1_expense\n @api_v1_expense = Api::V1::Expense.find(params[:id])\n end", "def show\n @expense = TblReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end", "def new\n @cold_production_year = ColdProductionYear.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cold_production_year }\n end\n end", "def index\n @marketing_expenses = MarketingExpense.all\n end", "def create\n\n @expense = Expense.new(expense_params)\n\n b_id = Building.search(@expense.buildinginfo)\n Building.find_by(id: b_id).expenses << @expense\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @construction_style = ConstructionStyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction_style }\n end\n end", "def show\n @operating_expense = OperatingExpense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @operating_expense }\n end\n end", "def index\n redirect_to home_entries_path\n\n @entries = current_user.entries.expenses\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expense }\n end\n end", "def new\n @civilization = Civilization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @civilization }\n end\n end", "def index\n @sunshine_center_other_expenses = SunshineCenterOtherExpense.all\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def show\n @thermo_oil_production = ThermoOilProduction.find(params[:id])\n @thermo_oil_production_years = ThermoOilProductionYear.find_all_by_thermoOilProduction_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thermo_oil_production }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense_group }\n end\n end", "def new\n @economia4 = Economia4.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @economia4 }\n end\n end", "def new\n @oase = Oasis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @oase }\n end\n end", "def show\n render json: @citation\n end" ]
[ "0.66751117", "0.6669506", "0.66435164", "0.6616033", "0.6598347", "0.657494", "0.6564787", "0.65063477", "0.65063477", "0.65063477", "0.65063477", "0.65063477", "0.6410001", "0.6399676", "0.6324974", "0.63197803", "0.6302435", "0.6291151", "0.6268371", "0.62529576", "0.6220105", "0.6216533", "0.62080526", "0.6191648", "0.61755204", "0.61253965", "0.6107278", "0.60868275", "0.6086692", "0.6079462", "0.6072302", "0.60669094", "0.6059255", "0.6052929", "0.60421056", "0.60411584", "0.6034534", "0.603278", "0.6026901", "0.60166883", "0.6013713", "0.6006395", "0.59975123", "0.59948206", "0.59919983", "0.5990045", "0.59557575", "0.5947475", "0.59416515", "0.5934227", "0.59218395", "0.5921194", "0.59192836", "0.59172654", "0.5914683", "0.5902673", "0.58989257", "0.58979934", "0.5887513", "0.5887408", "0.5885466", "0.587351", "0.58701533", "0.5862575", "0.5857257", "0.58551186", "0.58538455", "0.58503354", "0.58485943", "0.58373916", "0.5831239", "0.58261204", "0.582401", "0.58165514", "0.5810693", "0.580287", "0.5802477", "0.58013076", "0.5791607", "0.57864267", "0.578144", "0.5779626", "0.57706916", "0.5764708", "0.57569534", "0.5752156", "0.57520026", "0.5751686", "0.57479584", "0.57428515", "0.5742251", "0.5742251", "0.5742251", "0.57414263", "0.5736463", "0.57286656", "0.57280207", "0.57254624", "0.5722601", "0.57182586", "0.5715873" ]
0.0
-1
POST /construction_expenses POST /construction_expenses.json
def create @construction_expense = ConstructionExpense.new(construction_expense_params) respond_to do |format| if @construction_expense.save format.html { redirect_to root_path, notice: 'Construction expense was successfully created.' } format.json { render :show, status: :created, location: @construction_expense } else format.html { render :new } format.json { render json: @construction_expense.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n @expense = Expense.new(expense_params)\n\n b_id = Building.search(@expense.buildinginfo)\n Building.find_by(id: b_id).expenses << @expense\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense, status: :created, location: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_expense = Api::V1::Expense.new(api_v1_expense_params)\n\n respond_to do |format|\n if @api_v1_expense.save\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_expense }\n else\n format.html { render :new }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expensesbasis = @post.expensesbases.new(expensesbasis_params)\n\n respond_to do |format|\n if @expensesbasis.save\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully created.' }\n format.json { render :show, status: :created, location: @expensesbasis }\n else\n format.html { render :new }\n format.json { render json: @expensesbasis.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_construction_expense\n @construction_expense = ConstructionExpense.find(params[:id])\n end", "def create\n @petty_cash_expense = PettyCashExpense.new(petty_cash_expense_params)\n\n respond_to do |format|\n if @petty_cash_expense.save\n format.json { render :show, status: :created, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @expense = Expense.new\n @assigned_categories = \"\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def create\n @expense = Expense.new(expense_params)\n @gastos = Gasto.all \n @documents = Document.all\n \n respond_to do |format|\n if @expense.save\n @expense.correlativo\n \n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n puts \"********* creating an expense\"\n if @expense.save\n puts \"** expense saved\"\n puts @expense.id.to_s\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n puts \"** expense not saved\"\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n @dispense = Dispense.new(dispense_params)\n\n respond_to do |format|\n if @dispense.save\n format.html { redirect_to @dispense, notice: 'Dispense was successfully created.' }\n format.json { render :show, status: :created, location: @dispense }\n else\n format.html { render :new }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @solideo_depense = SolideoDepense.new(solideo_depense_params)\n\n respond_to do |format|\n if @solideo_depense.save\n format.html { redirect_to solideo_depenses_path, notice: 'Solideo depense was successfully created.' }\n format.json { render :show, status: :created, location: @solideo_depense }\n else\n format.html { render :new }\n format.json { render json: @solideo_depense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(expense_params)\n @expense.source = :webapp\n respond_to do |format|\n if @expense.save\n format.html { redirect_to :back, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n if @expense.save\n if !params[:expense_category].blank?\n category = ExpenseCategory.find_by name: params[:expense_category]\n if !category.nil?\n @expense.update(expense_category: category)\n if params[:expense_category] == \"Diesel\"\n company = DieselCompany.find(params[:diesel_company])\n DieselExpense.create! expense: @expense, diesel_company: company, litres: @expense.quantity\n end\n end\n # cash = Cash.today.first\n # cash.update(amount_out: (cash.amount_out + @expense.amount), balance: (cash.balance - @expense.amount))\n end\n format.html { redirect_to expenses_path, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n data = params[:expense]\n\n @expense = current_user.expenses.build(params[:expense])\n if @expense.save\n flash[:success] = \"Expense created!\"\n redirect_to root_url\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n #@expense = Expense.new(params[:expense])\n #\n #respond_to do |format|\n # if @expense.save\n # format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n # format.json { render json: @expense, status: :created, location: @expense }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @expense.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def construction_expense_params\n params.require(:construction_expense).permit(:material_description, :amount, :owner)\n end", "def create\n @dog_expense = DogExpense.new(dog_expense_params)\n\n respond_to do |format|\n if @dog_expense.save\n format.html { redirect_to @dog_expense, notice: 'Dog expense was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dog_expense }\n else\n format.html { render action: 'new' }\n format.json { render json: @dog_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(expense_params)\n authorize @expense\n @expense.created_by = current_user\n @expense.expense_by = current_user unless policy(@expense).can_assign?\n respond_to do |format|\n if @expense.save\n format.html { redirect_back_or_default expenses_url, t('Record has been saved') }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tuser = User.find_by(id: expense_params['user_id'])\n\t\tdebt = Debt.find_by(id: expense_params['debt_id'])\n\t\texpense = user.expenses.build(expense_params)\n\t\tif expense.save \n\t\t\tif debt\n\t\t\t\tdebt.expenses << expense\n\t\t\tend\n\t\t\trender json: user\n\t\telse\n\t\t\trender json: expense.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def create\n @marketing_expense = MarketingExpense.new(marketing_expense_params)\n\n respond_to do |format|\n if @marketing_expense.save\n format.html { redirect_to @marketing_expense, notice: 'Marketing expense was successfully created.' }\n format.json { render :show, status: :created, location: @marketing_expense }\n else\n format.html { render :new }\n format.json { render json: @marketing_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rec_expense = RecExpense.new(rec_expense_params)\n\n respond_to do |format|\n if @rec_expense.save\n format.html { redirect_to @rec_expense, notice: 'Rec expense was successfully created.' }\n format.json { render :show, status: :created, location: @rec_expense }\n else\n format.html { render :new }\n format.json { render json: @rec_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expansion = Expansion.new(params[:expansion])\n\n respond_to do |format|\n if @expansion.save\n format.html { redirect_to @expansion, notice: 'Expansion was successfully created.' }\n format.json { render json: @expansion, status: :created, location: @expansion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expansion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @defense = Defense.new(defense_params)\n\n respond_to do |format|\n if @defense.save\n format.html { redirect_to @defense, notice: 'Defense was successfully created.' }\n format.json { render :show, status: :created, location: @defense }\n else\n format.html { render :new }\n format.json { render json: @defense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expansion = Expansion.new(expansion_params)\n\n respond_to do |format|\n if @expansion.save\n format.html { redirect_to @expansion, notice: 'Expansion was successfully created.' }\n format.json { render :show, status: :created, location: @expansion }\n else\n format.html { render :new }\n format.json { render json: @expansion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @record_expense = RecordExpense.new(record_expense_params)\n\n respond_to do |format|\n if @record_expense.save\n format.html { redirect_to @record_expense, notice: 'New expense successfully created.' }\n format.json { render :show, status: :created, location: @record_expense }\n else\n format.html { render :new }\n format.json { render json: @record_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n recurring = params[:expense].delete(:recurring)\n statement = Statement.find(params[:statement_id])\n @expense = Expense.new(params[:expense])\n @expense.statement = statement\n @expense.recurring = recurring\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense.statement, notice: 'Statement expense was successfully created.' }\n format.json { render json: @expense, status: :created, location: @expense }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lincense = Lincense.new(lincense_params)\n\n respond_to do |format|\n if @lincense.save\n format.html { redirect_to @lincense, notice: 'Licensia fue exitosamente creada.' }\n format.json { render :show, status: :created, location: @lincense }\n else\n format.html { render :new }\n format.json { render json: @lincense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense_owner = ExpenseOwner.new(expense_owner_params)\n\n respond_to do |format|\n if @expense_owner.save\n format.html { redirect_to @expense_owner, notice: 'Expense owner was successfully created.' }\n format.json { render :show, status: :created, location: @expense_owner }\n else\n format.html { render :new }\n format.json { render json: @expense_owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expression_of_interest = ExpressionOfInterest.new(expression_of_interest_params)\n\n respond_to do |format|\n if @expression_of_interest.save\n format.html { redirect_to @expression_of_interest, notice: 'Expression of interest was successfully created.' }\n format.json { render :show, status: :created, location: @expression_of_interest }\n else\n format.html { render :new }\n format.json { render json: @expression_of_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sunshine_center_other_expense = SunshineCenterOtherExpense.new(sunshine_center_other_expense_params)\n\n respond_to do |format|\n if @sunshine_center_other_expense.save\n format.html { redirect_to @sunshine_center_other_expense, notice: 'Sunshine center other expense was successfully created.' }\n format.json { render :show, status: :created, location: @sunshine_center_other_expense }\n else\n format.html { render :new }\n format.json { render json: @sunshine_center_other_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(params[:expense])\n if params[:expense][:item_id].present?\n @expense.categorie_id = Item.find(params[:expense][:item_id]).categorie_id\n end\n @expense.dossier_id = params[:dossier]\n \n if params[:activite_id].present?\n @expense.activite_id = params[:activite_id]\n end\n \n @expense.save\n respond_to do |format|\n format.json { render :json => { :success => true, :message => \"Created Expense #{@expense.id}\", :data => @expense.attributes.merge(:total_ht => @expense.total, :total_ttc => @expense.total_ttc, :activite_name => @expense.activite.try(:description))}}\n end\n \n end", "def create\n @expense = Expense.new(params[:expense])\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to(@expense, :notice => 'Expense was successfully created.') }\n format.xml { render :xml => @expense, :status => :created, :location => @expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(expense_params)\n\n if request.xhr?\n if @expense.save\n card = render_to_string('_card', locals: {expense: @expense}, layout: false)\n render json: {html: card, success: true}\n else\n form = render_to_string('_form', layout: false)\n render json: {html: form, success: false}\n end\n else\n if @expense.save\n redirect_to @expense, notice: 'Expense was successfully created.'\n else\n render action: 'new'\n end\n end\n end", "def create\n @operating_expense = OperatingExpense.new(params[:operating_expense])\n\n respond_to do |format|\n if @operating_expense.save\n format.html { redirect_to(@operating_expense, :notice => 'Operating expense was successfully created.') }\n format.xml { render :xml => @operating_expense, :status => :created, :location => @operating_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @operating_expense.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @name_expense = NameExpense.new(name_expense_params)\n\n respond_to do |format|\n if @name_expense.save\n format.html { redirect_to @name_expense, notice: 'Name expense was successfully created.' }\n format.json { render :show, status: :created, location: @name_expense }\n else\n format.html { render :new }\n format.json { render json: @name_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @explaination = Explaination.new(params[:explaination])\n\n respond_to do |format|\n if @explaination.save\n format.html { redirect_to @explaination, notice: 'Explaination was successfully created.' }\n format.json { render json: @explaination, status: :created, location: @explaination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @explaination.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(expense_params)\n if @expense.save\n\t flash[:success] = \"Expense record created\"\n redirect_to @expense\n else\n render 'new'\n end\n end", "def create\n @fixed_exp = FixedExp.new(fixed_exp_params)\n\n respond_to do |format|\n if @fixed_exp.save\n format.html { redirect_to @fixed_exp, notice: 'Fixed exp was successfully created.' }\n format.json { render :show, status: :created, location: @fixed_exp }\n else\n format.html { render :new }\n format.json { render json: @fixed_exp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(params[:expense])\n\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to expense_url(@expense) }\n format.xml { head :created, :location => expense_url(@expense) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors.to_xml }\n end\n end\n end", "def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def create\n expense_details = expense_params\n\n expense_details[:amount] = correct_value(expense_details[:amount])\n\n @expense = Expense.new(expense_details)\n\n if @expense.save\n\n association = {\n :expense_id => @expense[:id],\n :tag_id => tag_params[:id],\n }\n\n expense_tag_association = ExpensesTagsAssociation.new(association)\n expense_tag_association.save\n\n redirect_to expenses_path, notice: (I18n.t 'Expense was successfully created.')\n else\n render action: \"new\"\n end\n end", "def create\n @expense_type = ExpenseType.new(expense_type_params)\n\n respond_to do |format|\n if @expense_type.save\n format.html { redirect_to @expense_type, notice: 'Expense type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @expense_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @expense_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shared_expense = SharedExpense.new(shared_expense_params)\n\n respond_to do |format|\n if @shared_expense.save\n format.html { redirect_to root_url, notice: 'Shared expense was successfully created.' }\n format.json { render :show, status: :created, location: @shared_expense }\n else\n format.html { render :new }\n format.json { render json: @shared_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @monthly_expense = MonthlyExpense.new(monthly_expense_params)\n\n respond_to do |format|\n if @monthly_expense.save\n format.html { redirect_to @monthly_expense, notice: \"Monthly expense was successfully created.\" }\n format.json { render :show, status: :created, location: @monthly_expense }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @monthly_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def expense_params\n params.require(:expense).permit(:code, :gasto_id, :documento, :descrip, :importe, :fecha, :document_id,:turno)\n end", "def create\n @utility_expense = UtilityExpense.new(utility_expense_params)\n\n respond_to do |format|\n if @utility_expense.save\n format.html { redirect_to @utility_expense, notice: 'Utility expense was successfully created.' }\n format.json { render :show, status: :created, location: @utility_expense }\n else\n format.html { render :new }\n format.json { render json: @utility_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @economic = Economic.new(economic_params)\n\n respond_to do |format|\n if @economic.save\n format.html { redirect_to @economic, notice: 'Economic was successfully created.' }\n format.json { render :show, status: :created, location: @economic }\n else\n format.html { render :new }\n format.json { render json: @economic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense_state = ExpenseState.new(params[:expense_state])\n\n respond_to do |format|\n if @expense_state.save\n format.html { redirect_to @expense_state, notice: 'Expense state was successfully created.' }\n format.json { render json: @expense_state, status: :created, location: @expense_state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @descuento_adicional = DescuentoAdicional.new(descuento_adicional_params)\n\n respond_to do |format|\n if @descuento_adicional.save\n format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional was successfully created.' }\n format.json { render :show, status: :created, location: @descuento_adicional }\n else\n format.html { render :new }\n format.json { render json: @descuento_adicional.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @construction = Construction.new(params[:construction])\n\n respond_to do |format|\n if @construction.save\n format.html { redirect_to @construction, notice: 'Construction was successfully created.' }\n format.json { render json: @construction, status: :created, location: @construction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @construction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = get_class.new(params[get_type])\n @expense.creator_id = current_user.id\n\n respond_to do |format|\n if @expense.save and @expense.create_expense_posting(price: @expense.calc_expense_posting_price)\n format.html { redirect_to @expense, notice: 'Udalosť bola úspešne vytvorená.' }\n format.json { render json: @expense, status: :created, location: @expense }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_expense_type = Admin::ExpenseType.new(params[:admin_expense_type])\n\n respond_to do |format|\n if @admin_expense_type.save\n format.html { redirect_to admin_expense_types_url }\n format.json { render json: @admin_expense_type, status: :created, location: @admin_expense_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_expense_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @expense = Expense.new(params[:expense])\n @expense.user = current_user\n\n respond_to do |format|\n if @expense.save\n format.json { render json: @expense, status: :created, location: @expense }\n format.js\n else\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def new\n @expense = Expense.new\n\n respond_to do |format|\n format.json { render json: @expense }\n format.js\n end\n end", "def create\n @bid_expense = BidExpense.new(bid_expense_params)\n\n respond_to do |format|\n if @bid_expense.save\n format.html { redirect_to bid_expenses_path, notice: 'Bid expense was successfully created.' }\n format.json { render :show, status: :created, location: @bid_expense }\n else\n format.html { render :new }\n format.json { render json: @bid_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @statement = Statement.find(params[:statement_id])\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def expense_params\n params.require(:expense).permit(:date, :description, :amount, :category_id)\n end", "def new\n @expansion = Expansion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expansion }\n end\n end", "def create\n @financial_objects_expense = manager.create(financial_objects_expense_params, current_user)\n\n respond_to do |format|\n if @financial_objects_expense.valid?\n format.html { redirect_to @financial_objects_expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @financial_objects_expense }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @financial_objects_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exp = Exp.new(params[:exp])\n\n respond_to do |format|\n if @exp.save\n format.html { redirect_to @exp, notice: 'Article was successfully posted.' }\n format.json { render json: @exp, status: :created, location: @exp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(expense_params)\n @expense.user_id = current_user.id\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render action: 'show', status: :created, location: @expense }\n else\n format.html { render action: 'new' }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @etat_depense = EtatDepense.new(etat_depense_params)\n @etat_depense.date = @etat_depense.date.change(month: 1, day: 1)\n respond_to do |format|\n if @etat_depense.save\n format.html { redirect_to etat_depenses_path, notice: 'Etat depense was successfully created.' }\n format.json { render :show, status: :created, location: @etat_depense }\n else\n format.html { render :new }\n format.json { render json: @etat_depense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(expense_params)\n respond_to do |format|\n\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.html { render :show, status: :created, location: @expense }\n end\n\n if expense_params.key?('insurance_attributes') == false &&\n expense_params.key?('break_attributes') == false &&\n expense_params.key?('damage_attributes') == false &&\n expense_params.key?('owner_take_attributes') == false\n format.html { render :new }\n end\n if expense_params.key?('insurance_attributes')\n format.html { render :insurance_fields }\n end\n if expense_params.key?('break_attributes')\n format.html { render :break_fields }\n end\n if expense_params.key?('damage_attributes')\n format.html { render :damage_fields }\n end\n if expense_params.key?('owner_take_attributes')\n format.html { render :owner_take_fields }\n end\n\n end\n end", "def update\n respond_to do |format|\n if @construction_expense.update(construction_expense_params)\n format.html { redirect_to @construction_expense, notice: 'Construction expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @construction_expense }\n else\n format.html { render :edit }\n format.json { render json: @construction_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def expense_params\n params.require(:expense).permit(:description, :category_id)\n end", "def expense_params\n params.require(:expense).permit(:expense, :cost, :category_id, :amount, :gains, :date, :descripton)\n end", "def create\n @pedagogy_innovation = @_current_user.pedagogy_innovations.new(pedagogy_innovation_params)\n\n respond_to do |format|\n if not @pedagogy_innovation.save\n format.html { redirect_to @pedagogy_innovation, notice: 'Pedagogy innovation was successfully created.' }\n format.json { render :show, status: :created, location: @pedagogy_innovation }\n else\n format.html { render :new }\n format.json { render json: @pedagogy_innovation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n load_arrays_for_create\n @expenditure = Expenditure.new(expenditure_params)\n\n respond_to do |format|\n if @expenditure.save\n format.html { redirect_to expenditures_path, notice: 'Expenditure was successfully created.' }\n format.json { render :show, status: :created, location: @expenditure }\n else\n format.html { render :new }\n format.json { render json: @expenditure.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expediente = Expediente.new(params[:expediente])\n \n respond_to do |format|\n if @expediente.save\n format.html { redirect_to @expediente, notice: 'Expediente was successfully created.' }\n format.json { render json: @expediente, status: :created, location: @expediente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expediente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person_expense_record = PersonExpenseRecord.new(person_expense_record_params)\n\n if @person_expense_record.save\n render json: @person_expense_record, status: :created, location: @person_expense_record\n else\n render json: @person_expense_record.errors, status: :unprocessable_entity\n end\n end", "def create\n @expenditure = Expenditure.new(params[:expenditure])\n\n respond_to do |format|\n if @expenditure.save\n format.html { redirect_to @expenditure, notice: 'Expenditure was successfully created.' }\n format.json { render json: @expenditure, status: :created, location: @expenditure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expenditure.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @accident_vehicle_expense = AccidentVehicleExpense.new(params[:accident_vehicle_expense])\n\n respond_to do |format|\n if @accident_vehicle_expense.save\n format.html { redirect_to(@accident_vehicle_expense, :notice => 'Accident vehicle expense was successfully created.') }\n format.xml { render :xml => @accident_vehicle_expense, :status => :created, :location => @accident_vehicle_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @accident_vehicle_expense.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @estadocivil = Estadocivil.new(estadocivil_params)\n\n respond_to do |format|\n if @estadocivil.save\n format.html { redirect_to @estadocivil, notice: 'Estadocivil was successfully created.' }\n format.json { render :show, status: :created, location: @estadocivil }\n else\n format.html { render :new }\n format.json { render json: @estadocivil.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @occasion = Occasion.new\n @ocats = Ocat.all\n @products = Product.all\n @productcats = ProductCat.all\n @category_product_link = CategoryProductLink.all\n @gift_types = GiftType.all\n @occasion.date ||= params[:date]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @occasion }\n end\n end", "def create\n @explc = Explc.new(explc_params)\n\n respond_to do |format|\n if @explc.save\n format.html { redirect_to @explc, notice: 'Explc was successfully created.' }\n format.json { render :show, status: :created, location: @explc }\n else\n format.html { render :new }\n format.json { render json: @explc.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @construction = Construction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction }\n end\n end", "def create\n @accident_assignee_expense = AccidentAssigneeExpense.new(params[:accident_assignee_expense])\n\n respond_to do |format|\n if @accident_assignee_expense.save\n format.html { redirect_to(@accident_assignee_expense, :notice => 'Accident assignee expense was successfully created.') }\n format.xml { render :xml => @accident_assignee_expense, :status => :created, :location => @accident_assignee_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @accident_assignee_expense.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @cetegory = Cetegory.new(cetegory_params)\n\n respond_to do |format|\n if @cetegory.save\n format.html { redirect_to @cetegory, notice: 'Cetegory was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cetegory }\n else\n format.html { render action: 'new' }\n format.json { render json: @cetegory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nature_financing = NatureFinancing.new(nature_financing_params)\n @nature_financing.institute = current_institute\n\n respond_to do |format|\n if @nature_financing.save\n format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully created.' }\n format.json { render :show, status: :created, location: @nature_financing }\n else\n format.html { render :new }\n format.json { render json: @nature_financing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @demand = Demand.new(demand_params)\n # byebug\n authorize @demand\n # @demand.competences.build(demand_params[:competence_ids])\n respond_to do |format|\n if @demand.save\n @demand.competence_ids = params[:demand][:competence_ids].first.split(',')\n @demand.criterion_ids = params[:demand][:criterion_ids].first.split(',')\n format.html { redirect_to @demand, notice: 'Demand was successfully created.' }\n format.json { render :show, status: :created, location: @demand }\n format.js\n else\n format.html { render :new }\n format.json { render json: @demand.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @carrera_investigacion = CarreraInvestigacion.new(carrera_investigacion_params)\n\n respond_to do |format|\n if @carrera_investigacion.save\n format.html { redirect_to @carrera_investigacion, notice: 'Carrera investigacion was successfully created.' }\n format.json { render :show, status: :created, location: @carrera_investigacion }\n else\n format.html { render :new }\n format.json { render json: @carrera_investigacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @expense = Expense.new\n @workflow = Workflow.find(params[:wid])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def create\n @competence = Competence.new(competence_params)\n respond_to do |format|\n if @competence.save\n format.json { render :show, status: :created, object: @competence }\n else\n format.json { render json: @competence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.create(expense_params)\n @expense.user_id = current_user.id\n @expense.save!\n respond_with @expense, status: 201\n end", "def create\r\n @fixed_deposit_investment = FixedDepositInvestment.new(fixed_deposit_investment_params)\r\n\r\n respond_to do |format|\r\n if @fixed_deposit_investment.save\r\n format.html { redirect_to @fixed_deposit_investment, notice: 'Fixed deposit investment was successfully created.' }\r\n format.json { render :show, status: :created, location: @fixed_deposit_investment }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @fixed_deposit_investment.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n\n # authenticate request\n if auth_user\n\n #check we have everything we need!\n if params[:date] && params[:amount] && params[:category] && valid_date? && valid_amount?\n @new_expense = Expense.create(category: params[:category], date: params[:date], amount: params[:amount], user_id: @user.id)\n render json: { message: \"Good going! You made an expense for $#{params[:amount]}\", object: @new_expense }, status: 200\n else\n # tell user what they haven't provided correctly\n whats_not_supplied(params) \n end\n\n else\n # request not authenticated\n return render json: { message: \"Invalid Token\", status: 400}, status: 400\n end\n\n end", "def create\n @competence_center = CompetenceCenter.new(params[:competence_center])\n\n respond_to do |format|\n if @competence_center.save\n format.html { redirect_to @competence_center, notice: 'Competence center was successfully created.' }\n format.json { render json: @competence_center, status: :created, location: @competence_center }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competence_center.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @descuento_adicional = DescuentoAdicional.new(descuento_adicional_params)\n\n respond_to do |format|\n if @descuento_adicional.save\n format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @descuento_adicional }\n else\n format.html { render :new }\n format.json { render json: @descuento_adicional.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 @esod_contractor = Esod::Contractor.new(esod_contractor_params)\n\n respond_to do |format|\n if @esod_contractor.save\n format.html { redirect_to @esod_contractor, notice: 'Contractor was successfully created.' }\n format.json { render :show, status: :created, location: @esod_contractor }\n else\n format.html { render :new }\n format.json { render json: @esod_contractor.errors, status: :unprocessable_entity }\n end\n end\n end", "def expense_params\n params.require(:expense).permit(:date, :amount, :desc, :money, :project_id, :hst)\n end", "def create\n @expedient = Expedient.new(expedient_params)\n\n respond_to do |format|\n if @expedient.save\n format.html { redirect_to expedients_url, notice: 'Se creó un nuevo expediente' }\n format.json { render :show, status: :created, location: @expedient }\n else\n format.html { render :new }\n format.json { render json: @expedient.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @non_political_expenditure = NonPoliticalExpenditure.new(non_political_expenditure_params)\n\n respond_to do |format|\n if @non_political_expenditure.save\n format.html { redirect_to @non_political_expenditure, notice: 'Non political expenditure was successfully created.' }\n format.json { render :show, status: :created, location: @non_political_expenditure }\n else\n format.html { render :new }\n format.json { render json: @non_political_expenditure.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @competence_center = CompetenceCenter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competence_center }\n end\n end", "def create\n @expression = Expression.new expression_params\n respond_to do |format|\n if @expression.save\n format.html { redirect_to @expression, notice: 'Expression was successfully created.' }\n format.json { render json: @expression, status: :created, location: @expression }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expression.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @individual_company_investment = IndividualCompanyInvestment.new(individual_company_investment_params)\n\n respond_to do |format|\n if @individual_company_investment.save\n format.html { redirect_to @individual_company_investment, notice: 'Individual company investment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @individual_company_investment }\n else\n format.html { render action: 'new' }\n format.json { render json: @individual_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calorie_consumption = CalorieConsumption.new(calorie_consumption_params)\n\n respond_to do |format|\n if @calorie_consumption.save\n format.html { redirect_to @calorie_consumption, notice: 'Calorie consumption was successfully created.' }\n format.json { render :show, status: :created, location: @calorie_consumption }\n else\n format.html { render :new }\n format.json { render json: @calorie_consumption.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.new(params[:competency_pertenece_evaluation])\n\n respond_to do |format|\n if @competency_pertenece_evaluation.save\n format.html { redirect_to @competency_pertenece_evaluation, notice: 'Competency pertenece evaluation was successfully created.' }\n format.json { render json: @competency_pertenece_evaluation, status: :created, location: @competency_pertenece_evaluation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competency_pertenece_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cash_flow ||= @monthly_budget.cash_flows.build(\n category_id: @category.id\n )\n\n @cash_flow.planned = cash_flow_params[:planned]\n\n if @cash_flow.save\n render json: @cash_flow, status: :created\n else\n render json: @cash_flow.errors, status: :unprocessable_entity\n end\n end" ]
[ "0.69896954", "0.69765955", "0.69157416", "0.66434765", "0.6574246", "0.65408623", "0.6496539", "0.64624095", "0.6363663", "0.6356102", "0.6346727", "0.6338695", "0.6337026", "0.6293627", "0.62786674", "0.62495375", "0.6247721", "0.6238824", "0.62264425", "0.6225141", "0.6202735", "0.620046", "0.61959255", "0.61909205", "0.6188432", "0.61773074", "0.61679", "0.61632764", "0.6151714", "0.61446893", "0.6135939", "0.6132014", "0.612164", "0.6104543", "0.6095804", "0.60740983", "0.60691375", "0.60690963", "0.6066331", "0.6059847", "0.6054728", "0.6046911", "0.60418093", "0.60357493", "0.6005447", "0.6002476", "0.59959507", "0.59926534", "0.5985947", "0.5981668", "0.59738874", "0.596712", "0.5928552", "0.5927934", "0.59259385", "0.5925133", "0.5922254", "0.5915298", "0.59152377", "0.5913296", "0.5912112", "0.58963656", "0.5883614", "0.5881702", "0.5875077", "0.5874357", "0.5873418", "0.58665955", "0.58663744", "0.5865243", "0.58557904", "0.5855681", "0.5844861", "0.5840469", "0.5834867", "0.5832921", "0.5832548", "0.5829004", "0.5826248", "0.5822975", "0.5818067", "0.58129996", "0.5811939", "0.58078176", "0.5806878", "0.58064055", "0.5799458", "0.57954293", "0.5790617", "0.578157", "0.5777793", "0.5771563", "0.57693154", "0.57637525", "0.5763671", "0.575893", "0.57581854", "0.5748186", "0.5746445", "0.57459915" ]
0.7696556
0
PATCH/PUT /construction_expenses/1 PATCH/PUT /construction_expenses/1.json
def update respond_to do |format| if @construction_expense.update(construction_expense_params) format.html { redirect_to @construction_expense, notice: 'Construction expense was successfully updated.' } format.json { render :show, status: :ok, location: @construction_expense } else format.html { render :edit } format.json { render json: @construction_expense.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end", "def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @offense.update(offense_params)\n format.html { redirect_to @offense, notice: 'Offense was successfully updated.' }\n format.json { render :show, status: :ok, location: @offense }\n else\n format.html { render :edit }\n format.json { render json: @offense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to expenses_url, notice: 'Expense was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n #format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :ok }\n else\n #format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end", "def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to expenses_path, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to '/expenses', notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to edit_expense_path(@expense), notice: 'Expense was successfully updated.' }\n format.json { render :edit, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.json { head :ok }\n format.js\n else\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n respond_to do |format|\n if @petty_cash_expense.update(petty_cash_expense_params)\n format.json { render :show, status: :ok, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expenses_file.update(expenses_file_params)\n format.html { redirect_to @expenses_file, notice: 'Expenses file was successfully updated.' }\n format.json { render :show, status: :ok, location: @expenses_file }\n else\n format.html { render :edit }\n format.json { render json: @expenses_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @solideo_depense.update(solideo_depense_params)\n format.html { redirect_to solideo_depenses_path, notice: 'Solideo depense was successfully updated.' }\n format.json { render :show, status: :ok, location: @solideo_depense }\n else\n format.html { render :edit }\n format.json { render json: @solideo_depense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employment_contract.update(employment_contract_params)\n format.html { redirect_to request_steps_path, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment_contract }\n else\n format.html { render :edit }\n format.json { render json: @employment_contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def update\n @operating_expense = OperatingExpense.find(params[:id])\n\n respond_to do |format|\n if @operating_expense.update_attributes(params[:operating_expense])\n format.html { redirect_to(@operating_expense, :notice => 'Operating expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operating_expense.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expensesbasis.update(expensesbasis_params)\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully updated.' }\n format.json { render :show, status: :ok, location: @expensesbasis }\n else\n format.html { render :edit }\n format.json { render json: @expensesbasis.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def update\n respond_to do |format|\n if @depense.update(depense_params)\n format.html { redirect_to @depense, notice: 'Depense was successfully updated.' }\n format.json { render :show, status: :ok, location: @depense }\n else\n format.html { render :edit }\n format.json { render json: @depense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n respond_to do |format|\n if @dispense.update(dispense_params)\n format.html { redirect_to @dispense, notice: 'Dispense was successfully updated.' }\n format.json { render :show, status: :ok, location: @dispense }\n else\n format.html { render :edit }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lincense.update(lincense_params)\n format.html { redirect_to @lincense, notice: 'Licensia fue exitosamente editada.' }\n format.json { render :show, status: :ok, location: @lincense }\n else\n format.html { render :edit }\n format.json { render json: @lincense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_to :back, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { redirect :back}\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @expense_owner.update(expense_owner_params)\n format.html { redirect_to @expense_owner, notice: 'Expense owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_owner }\n else\n format.html { render :edit }\n format.json { render json: @expense_owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense, :notice => 'Expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense, :notice => 'Expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @calorie_consumption.update(calorie_consumption_params)\n format.html { redirect_to @calorie_consumption, notice: 'Calorie consumption was successfully updated.' }\n format.json { render :show, status: :ok, location: @calorie_consumption }\n else\n format.html { render :edit }\n format.json { render json: @calorie_consumption.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @food_expenditure.update(food_expenditure_params)\n @food_expenditure.update_attributes(:edit_able=>false)\n format.html { redirect_to @food_expenditure, notice: 'FoodExpenditure was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_expenditure }\n else\n format.html { render :edit }\n format.json { render json: @food_expenditure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @expense = Expense.find(params[:id])\n \n if params[:expense][:item_id].present?\n @expense.categorie_id = Item.find(params[:expense][:item_id]).categorie_id\n end\n if params[:activite_id].present?\n @expense.activite_id = params[:activite_id]\n end\n \n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to(@expense, :notice => 'Expense was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => { :success => true, :message => \"Updated Expense #{@expense.id}\", :data => @expense.attributes.merge(:total_ht => @expense.total, :total_ttc => @expense.total_ttc, :activite_name => @expense.activite.try(:description))}} \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cash_dispense = CashDispense.find(params[:id])\n\n respond_to do |format|\n if @cash_dispense.update_attributes(params[:cash_dispense])\n format.html { redirect_to @cash_dispense, notice: 'Cash dispense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cash_dispense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n if @exprience.update_attributes(params[:exprience])\n format.html { redirect_to @exprience, notice: 'Exprience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exprience.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @expense\n @expense.updated_by = current_user\n respond_to do |format|\n if @expense.update(expense_params)\n format.html { redirect_back_or_default expenses_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n\n respond_to do |format|\n if @admin_expense_type.update_attributes(params[:admin_expense_type])\n format.html { redirect_to admin_expense_types_url }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_expense_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expansion = Expansion.find(params[:id])\n\n respond_to do |format|\n if @expansion.update_attributes(params[:expansion])\n format.html { redirect_to @expansion, notice: 'Expansion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expansion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person_expense_record = PersonExpenseRecord.find(params[:id])\n\n if @person_expense_record.update(person_expense_record_params)\n head :no_content\n else\n render json: @person_expense_record.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @rec_expense.update(rec_expense_params)\n format.html { redirect_to @rec_expense, notice: 'Rec expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @rec_expense }\n else\n format.html { render :edit }\n format.json { render json: @rec_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expense_type.update(expense_type_params)\n format.html { redirect_to @expense_type, notice: 'Expense type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shared_expense.update(shared_expense_params)\n format.html { redirect_to @shared_expense, notice: 'Shared expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @shared_expense }\n else\n format.html { render :edit }\n format.json { render json: @shared_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @marketing_expense.update(marketing_expense_params)\n\n @project.create_activity :edited_marketing_expense, owner: current_user,\n parameters: { text: 'Edited ', object_id: @marketing_expense.id, form_data: params[:marketing_expense].to_s }\n\n ProjectMailer.marketing_expense(@project, @marketing_expense, current_user)\n\n format.html { redirect_to @marketing_expense, notice: 'Marketing expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @marketing_expense }\n else\n format.html { render :edit }\n format.json { render json: @marketing_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expenditure = Expenditure.find(params[:id])\n\n respond_to do |format|\n if @expenditure.update_attributes(params[:expenditure])\n format.html { redirect_to @expenditure, notice: 'Expenditure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expenditure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contract_document.update(contract_document_params)\n format.html { redirect_to @contract_document, notice: 'Contract document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contract_document.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @etat_depense.update(etat_depense_params)\n format.html { redirect_to etat_depenses_path, notice: 'Etat depense was successfully updated.' }\n format.json { render :show, status: :ok, location: @etat_depense }\n else\n format.html { render :edit }\n format.json { render json: @etat_depense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @explaination = Explaination.find(params[:id])\n\n respond_to do |format|\n if @explaination.update_attributes(params[:explaination])\n format.html { redirect_to @explaination, notice: 'Explaination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @explaination.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense = Expense.find(params[:id])\n @expense.reset\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n\n flash[:notice] = 'Expense was successfully updated.'\n format.html { redirect_to expense_url(@expense) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors.to_xml }\n end\n end\n end", "def update\n authorize @expense_report\n\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.update(expense_report_params)\n format.html { redirect_to @expense_report, notice: 'Expense report was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_report }\n else\n format.html { render :edit }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sunshine_center_other_expense.update(sunshine_center_other_expense_params)\n format.html { redirect_to @sunshine_center_other_expense, notice: 'Sunshine center other expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @sunshine_center_other_expense }\n else\n format.html { render :edit }\n format.json { render json: @sunshine_center_other_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fixed_exp.update(fixed_exp_params)\n format.html { redirect_to @fixed_exp, notice: 'Fixed exp was successfully updated.' }\n format.json { render :show, status: :ok, location: @fixed_exp }\n else\n format.html { render :edit }\n format.json { render json: @fixed_exp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dog_expense.update(dog_expense_params)\n format.html { redirect_to @dog_expense, notice: 'Dog expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dog_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @office_career.update(office_career_params)\n head :no_content\n end", "def update\n respond_to do |format|\n if @docs_ponto.update(docs_ponto_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @docs_ponto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @economic.update(economic_params)\n format.html { redirect_to @economic, notice: 'Economic was successfully updated.' }\n format.json { render :show, status: :ok, location: @economic }\n else\n format.html { render :edit }\n format.json { render json: @economic.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\n @income = current_company.incomes.find(params[:id])\n\n respond_to do |format|\n if @income.update_attributes(params[:income])\n format.html { redirect_to incomes_path, notice: 'Income was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @expenditure.update(expenditure_params)\n format.html { redirect_to expenditures_path, notice: 'Expenditure was successfully updated.' }\n format.json { render :show, status: :ok, location: @expenditure }\n else\n format.html { render :edit }\n format.json { render json: @expenditure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t @service = servicio\n\t @experience = @service.experiences.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tif @experience.update(experience_params)\n\t\t\t\tformat.html { redirect_to experience_path(@experience), notice: 'La experiencia se ha modificado exitosamente.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @experience }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @experience.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @housing_expense = HousingExpense.find(params[:id])\n\n respond_to do |format|\n if @housing_expense.update_attributes(params[:housing_expense])\n flash[:notice] = 'HousingExpense was successfully updated.'\n format.html { redirect_to housing_expense_url(@housing_expense) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @housing_expense.errors.to_xml }\n end\n end\n end", "def update\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n if @expense_state.update_attributes(params[:expense_state])\n format.html { redirect_to @expense_state, notice: 'Expense state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @livingexpense = Livingexpense.find(params[:id])\n\n respond_to do |format|\n if @livingexpense.update_attributes(params[:livingexpense])\n format.html { redirect_to @livingexpense, notice: 'Livingexpense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @livingexpense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contract_product.update_attributes(params[:contract_product])\n format.html { redirect_to @contract_product, notice: 'Contract product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @record_expense.update(record_expense_params)\n format.html { redirect_to @record_expense, notice: 'Record expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @record_expense }\n else\n format.html { render :edit }\n format.json { render json: @record_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to @contract.lead, notice: 'Contract was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exponat.update(exponat_params)\n format.html { redirect_to @exponat, notice: 'Exponat was successfully updated.' }\n format.json { render :show, status: :ok, location: @exponat }\n else\n format.html { render :edit }\n format.json { render json: @exponat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_field.update(api_v1_initiative_field_params)\n format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_field }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # byebug\n authorize @demand\n\n # @demand.competences.build()\n respond_to do |format|\n if @demand.update(demand_params)\n @demand.competence_ids = params[:demand][:competence_ids].first.split(',')\n @demand.criterion_ids = params[:demand][:criterion_ids].first.split(',')\n puts \"\n params[:demand][:criterion_ids]: #{params[:demand][:criterion_ids]}\n @demand.criterion_ids: #{@demand.criterion_ids}\n \"\n format.html { redirect_to @demand, notice: 'Demand was successfully updated.' }\n format.json { render :show, status: :ok, location: @demand }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @demand.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n respond_to do |format|\n if @individual_company_investment.update(individual_company_investment_params)\n format.html { redirect_to @individual_company_investment, notice: 'Individual company investment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @individual_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to [@expense.statement.account, @expense.statement], notice: 'Statement expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expansion.update(expansion_params)\n format.html { redirect_to @expansion, notice: 'Expansion was successfully updated.' }\n format.json { render :show, status: :ok, location: @expansion }\n else\n format.html { render :edit }\n format.json { render json: @expansion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n if @contractor_feature.update_attributes(params[:contractor_feature])\n format.html { redirect_to @contractor_feature, notice: 'Contractor feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @occasion = Occasion.find(params[:id])\n @ocats = Ocat.all\n @gift_types = GiftType.all\n\n params[:occasion][:price_min] = params[:occasion][:price_min].gsub('$','').to_d * 100\n params[:occasion][:price_max] = params[:occasion][:price_max].gsub('$','').to_d * 100\n respond_to do |format|\n if @occasion.update_attributes(params[:occasion])\n format.html {\n flash[:success] = 'Occasion was successfully updated.'\n redirect_to @occasion \n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @factoid = Factoid.find(params[:id])\n\n respond_to do |format|\n if @factoid.update_attributes(params[:factoid])\n format.html { redirect_to @factoid, notice: 'Factoid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @factoid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exp = Exp.find(params[:id])\n\n respond_to do |format|\n if @exp.update_attributes(params[:exp])\n format.html { redirect_to @exp, notice: 'Successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exp.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 @expedition.update(expedition_params)\n format.html { redirect_to @expedition, notice: 'Expedition was successfully updated.' }\n format.json { render :show, status: :ok, location: @expedition }\n else\n format.html { render :edit }\n format.json { render json: @expedition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @finance_document = FinanceDocument.find(params[:id])\n\n if @finance_document.update(finance_document_params)\n audit(@finance_document, current_user)\n head :no_content\n else\n render json: @finance_document.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @personal_finance.update(personal_finance_params)\n format.html { redirect_to @personal_finance, notice: 'Personal finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @personal_finance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @competence.update(competence_params)\n format.html { redirect_to '/profile#addMoreCompetences', notice: t('competences_controller.competences_update_success') }\n format.json { render :show, status: :ok, location: @competence }\n else\n format.html { render :edit }\n format.json { render json: @competence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @competence.update(competence_params)\n format.json { render :show, status: :ok, object: @competence }\n else\n format.json { render json: @competence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contract.update(update_params)\n format.html { redirect_to_leaf_notice(UPDATE_SUCCESS) }\n format.json { render :show, status: :ok, location: @contract }\n else\n unprocessable_response(format)\n end\n end\n end", "def update\n @vdocs_requirement = VdocsRequirement.find(params[:id])\n\t@contract = @vdocs_requirement.contract\n\n respond_to do |format|\n if @vdocs_requirement.update_attributes(params[:vdocs_requirement])\n flash[:notice] = 'VdocsRequirement was successfully updated.'\n format.html { redirect_to(@vdocs_requirement) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vdocs_requirement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @recipy = Recipy.find(params[:id])\n\n respond_to do |format|\n if @recipy.update_attributes(params[:recipy])\n format.html { redirect_to @recipy, notice: 'Recipy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @competence_center = CompetenceCenter.find(params[:id])\n\n respond_to do |format|\n if @competence_center.update_attributes(params[:competence_center])\n format.html { redirect_to @competence_center, notice: 'Competence center was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competence_center.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expense.update_attributes(params[get_type])\n update_paps\n format.html { redirect_to @expense, notice: 'Udalosť bola úspešne zmenená.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @care_circle.update(care_circle_params)\n format.html { redirect_to @care_circle, notice: 'Care circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @care_circle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:commit] == \"go\"\n respond_to do |format|\n if @expense_detail.update(expense_detail_params)\n format.html { redirect_to expense_details_path, notice: 'Expense detail was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: 'edit' }\n format.json { render json: @expense_detail.errors, status: :unprocessable_entity }\n end\n end\n elsif params[:commit] == \"cancel\"\n @expense_detail = ExpenseDetail.new\n \n respond_to do |format|\n format.js { render \"cancel\" }\n end\n end \n end", "def update\n respond_to do |format|\n if @company_investor.update(company_investor_params)\n format.html { redirect_to @company_investor, notice: 'Company investor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company_investor.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.70114714", "0.6817503", "0.67659867", "0.6595009", "0.6591188", "0.6582702", "0.6581021", "0.6554496", "0.6515357", "0.6515357", "0.64758146", "0.6439279", "0.64058924", "0.639098", "0.6382717", "0.6382717", "0.6382717", "0.6363434", "0.63544077", "0.6351631", "0.63405055", "0.6311495", "0.63110965", "0.6289074", "0.6287408", "0.6285244", "0.62772495", "0.6275473", "0.62406725", "0.62352616", "0.6217682", "0.6204485", "0.6184115", "0.61819804", "0.6172909", "0.6169653", "0.6169653", "0.61686397", "0.6166068", "0.6165823", "0.61591923", "0.61562467", "0.61560285", "0.61499727", "0.61469626", "0.61418223", "0.61352265", "0.61298674", "0.6116969", "0.6110747", "0.6096705", "0.6092355", "0.6091506", "0.6088053", "0.60876185", "0.60826916", "0.60791713", "0.60779715", "0.60706943", "0.6063419", "0.60545695", "0.60531795", "0.6051047", "0.60454565", "0.6042169", "0.6042026", "0.6033763", "0.60321414", "0.6024425", "0.60240215", "0.60125905", "0.601011", "0.60023135", "0.59995615", "0.59966385", "0.5992493", "0.5989348", "0.5987808", "0.5984742", "0.5971991", "0.59666", "0.5964384", "0.5963154", "0.59610474", "0.5959956", "0.59539694", "0.59536684", "0.59452736", "0.59449375", "0.5942345", "0.59409636", "0.5929189", "0.5928229", "0.5927215", "0.5927162", "0.592468", "0.59195215", "0.5918655", "0.5912855", "0.59118056" ]
0.6809714
2
DELETE /construction_expenses/1 DELETE /construction_expenses/1.json
def destroy @construction_expense.destroy respond_to do |format| format.html { redirect_to construction_expenses_url, notice: 'Construction expense was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = current_user.organization.expenses.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @expense = Expense.find params.fetch(:id)\n @expense.destroy\n head :no_content\n end", "def destroy\n @expensesbasis.destroy\n respond_to do |format|\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @expense.destroy\n \n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dog_expense.destroy\n respond_to do |format|\n format.html { redirect_to dog_expenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offense.destroy\n respond_to do |format|\n format.html { redirect_to offenses_url, notice: 'Offense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html {redirect_to expenses_url, notice: 'Expense was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n respond_with @expense.destroy, status: 204\n end", "def destroy\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n format.js\n format.iphone { redirect_to(@bucket) }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @operating_expense = OperatingExpense.find(params[:id])\n @operating_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(operating_expenses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @livingexpense = Livingexpense.find(params[:id])\n @livingexpense.destroy\n\n respond_to do |format|\n format.html { redirect_to livingexpenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense_type.destroy\n respond_to do |format|\n format.html { redirect_to expense_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html\n format.json { render head :ok }\n format.js { render :nothing => true }\n end\n end", "def destroy\n @expense_claim.destroy\n respond_to do |format|\n format.html { redirect_to expense_claims_url, notice: 'Expense claim was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solideo_depense.destroy\n respond_to do |format|\n format.html { redirect_to solideo_depenses_url, notice: 'Solideo depense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @name_expense.destroy\n respond_to do |format|\n format.html { redirect_to name_expenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @depense.destroy\n respond_to do |format|\n format.html { redirect_to depenses_url, notice: 'Depense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rec_expense.destroy\n respond_to do |format|\n format.html { redirect_to rec_expenses_url, notice: 'Rec expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lincense.destroy\n respond_to do |format|\n format.html { redirect_to lincenses_url, notice: 'Licensia fue exitosamente destruida.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n @admin_expense_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_expense_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @expense_state = ExpenseState.find(params[:id])\n @expense_state.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense_id = @expense.id\n @expense.destroy\n\n respond_to do |format|\n format.json { head :ok }\n format.js\n end\n end", "def destroy\n @expansion = Expansion.find(params[:id])\n @expansion.destroy\n\n respond_to do |format|\n format.html { redirect_to expansions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @accident_vehicle_expense = AccidentVehicleExpense.find(params[:id])\n @accident_vehicle_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(accident_vehicle_expenses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @etat_depense.destroy\n respond_to do |format|\n format.html { redirect_to etat_depenses_url, notice: 'Etat depense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dispense.destroy\n respond_to do |format|\n format.html { redirect_to dispenses_url, notice: 'Dispense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shared_expense.destroy\n respond_to do |format|\n format.html { redirect_to shared_expenses_url, notice: 'Shared expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @occasion = Occasion.find(params[:id])\n @occasion.destroy\n\n respond_to do |format|\n format.html { redirect_to occasions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @housing_expense = HousingExpense.find(params[:id])\n @housing_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to housing_expenses_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @explaination = Explaination.find(params[:id])\n @explaination.destroy\n\n respond_to do |format|\n format.html { redirect_to explainations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to account_statement_url(params[:account_id],params[:statement_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @expenditure = Expenditure.find(params[:id])\n @expenditure.destroy\n\n respond_to do |format|\n format.html { redirect_to expenditures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cash_dispense = CashDispense.find(params[:id])\n @cash_dispense.destroy\n\n respond_to do |format|\n format.html { redirect_to cash_dispenses_url }\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 @expenses_file.destroy\n respond_to do |format|\n format.html { redirect_to expenses_files_url, notice: 'Expenses file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @marketing_expense.destroy\n respond_to do |format|\n format.html { redirect_to marketing_expenses_url, notice: 'Marketing expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exprience = Exprience.find(params[:id])\n @exprience.destroy\n\n respond_to do |format|\n format.html { redirect_to expriences_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense_owner.destroy\n respond_to do |format|\n format.html { redirect_to expense_owners_url, notice: 'Expense owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @financial_objects_expense.destroy\n respond_to do |format|\n format.html { redirect_to financial_objects_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @petty_cash_expense.destroy\n head :no_content \n end", "def destroy\n @person_expense_record.destroy\n\n head :no_content\n end", "def destroy\n @sunshine_center_other_expense.destroy\n respond_to do |format|\n format.html { redirect_to sunshine_center_other_expenses_url, notice: 'Sunshine center other expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @round_expense = RoundExpense.find(params[:id])\n @round_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(round_expenses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @individual_company_investment.destroy\n respond_to do |format|\n format.html { redirect_to individual_company_investments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @economic.destroy\n respond_to do |format|\n format.html { redirect_to economics_url, notice: 'Economic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @competency.destroy\n respond_to do |format|\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 expense = Expense.destroy(params[\"id\"])\n\n if expense\n render json: {\n status: \"SUCCESS\",\n message: \"Expense deleted\",\n }, status: :ok\n else\n render json: {\n status: \"ERROR\",\n message: \"Invalid id\",\n }, status: 400\n end\n end", "def destroy\n @economic = Economic.find(params[:id])\n @economic.destroy\n\n respond_to do |format|\n format.html { redirect_to(economics_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @api_v1_initiative.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiatives_url, notice: 'Initiative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @life_insurance.destroy\n\n respond_to do |format|\n format.html { redirect_to life_insurances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @monthly_expense.destroy\n respond_to do |format|\n format.html { redirect_to monthly_expenses_url, notice: \"Monthly expense was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @record_expense.destroy\n respond_to do |format|\n format.html { redirect_to record_expenses_url, notice: 'Record expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n redirect_to expenses_url, notice: (I18n.t 'Expense was successfully deleted.')\n end", "def destroy\n @life_insurance.destroy\n respond_to do |format|\n format.html { redirect_to life_insurances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @investigation.destroy\n respond_to do |format|\n # Redirige al index de investigations.\n format.html { redirect_to investigations_url, notice: 'Investigation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense_detail.destroy\n respond_to do |format|\n format.html { redirect_to expense_details_url, notice: \"Expense detail was successfully deleted. \" }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @exp = Exp.find(params[:id])\n @exp.destroy\n\n respond_to do |format|\n format.html { redirect_to exps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fund_company_investment.destroy\n respond_to do |format|\n format.html { redirect_to fund_company_investments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exp_detail = ExpDetail.find(params[:id])\n @exp_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to exp_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @investable.destroy\n respond_to do |format|\n format.html { redirect_to investables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @income = current_company.incomes.find(params[:id])\n @income.destroy\n\n respond_to do |format|\n format.html { redirect_to incomes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @calorie_consumption.destroy\n respond_to do |format|\n format.html { redirect_to calorie_consumptions_url, notice: 'Calorie consumption was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exponat.destroy\n respond_to do |format|\n format.html { redirect_to exponats_url, notice: 'Вы удалили элемент из медиа-коллекции' }\n format.json { head :no_content }\n end\n end", "def destroy\n @annex = Annex.find(params[:id])\n @annex.destroy\n\n respond_to do |format|\n format.html { redirect_to annexes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_expenditure.destroy\n respond_to do |format|\n format.html { redirect_to food_expenditures_url, notice: 'FoodExpenditure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @socioeconomic.destroy\n respond_to do |format|\n format.html { redirect_to socioeconomics_url, notice: 'Socioeconomic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @initiative = Initiative.find(params[:id])\n @initiative.destroy\n\n respond_to do |format|\n format.html { redirect_to initiatives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid_expense.destroy\n respond_to do |format|\n format.html { redirect_to bid_expenses_url, notice: 'Bid expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @initiative = Initiative.find(params[:id])\n @initiative.destroy\n\n respond_to do |format|\n format.html { render :nothing => true }\n #format.html { redirect_to initiatives_url }\n format.json { head :ok }\n end\n end", "def destroy\n @expansion.destroy\n respond_to do |format|\n format.html { redirect_to expansions_url, notice: 'Expansion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n if @expense.dossier.parametres_cabinet.id = current_user.parametres_cabinet.id\n @expense.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n format.json { render :json => { :success => true, :message => \"Destroyed Expense #{@expense.id}\", :data => []}}\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 destroy\n @defense.destroy\n respond_to do |format|\n format.html { redirect_to defenses_url, notice: 'Defense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipy = Recipy.find(params[:id])\n @recipy.destroy\n\n respond_to do |format|\n format.html { redirect_to recipies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense_group.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expenditure.destroy\n respond_to do |format|\n format.html { redirect_to expenditures_url, notice: 'Expenditure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n if authorized?(:destroy, @expense)\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n format.js { render :action => \"destroy\" }\n end\n end\n end", "def destroy\n @utility_expense.destroy\n respond_to do |format|\n format.html { redirect_to utility_expenses_url, notice: 'Utility expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @descuento_adicional.destroy\n respond_to do |format|\n format.html { redirect_to descuento_adicionals_url, notice: 'Descuento adicional was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @estadocivil.destroy\n respond_to do |format|\n format.html { redirect_to estadocivils_url, notice: 'Estadocivil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @complexity = Complexity.find(params[:id])\n @complexity.destroy\n\n respond_to do |format|\n format.html { redirect_to complexities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense_sub_type.destroy\n respond_to do |format|\n format.html { redirect_to expense_sub_types_url, notice: 'Expense sub type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7375016", "0.7301809", "0.73000616", "0.73000616", "0.7262738", "0.7252981", "0.7248885", "0.7248885", "0.7145355", "0.7112137", "0.70849514", "0.7055886", "0.7045581", "0.7045581", "0.7045581", "0.7045581", "0.7045581", "0.7045581", "0.69821775", "0.6977332", "0.695557", "0.694555", "0.6940763", "0.6940763", "0.6937528", "0.69353396", "0.69310236", "0.6908847", "0.68899995", "0.68752134", "0.6871324", "0.6857146", "0.6856935", "0.68345684", "0.6827591", "0.681908", "0.6808199", "0.68056095", "0.6800702", "0.6799056", "0.6778467", "0.67733103", "0.677066", "0.6765001", "0.67575264", "0.6755232", "0.6739913", "0.67349285", "0.6729646", "0.67237884", "0.67195445", "0.6717279", "0.67159307", "0.6709818", "0.67058736", "0.6703932", "0.67018825", "0.67018604", "0.66993785", "0.66910934", "0.66862553", "0.66812146", "0.6678715", "0.6669849", "0.6669595", "0.664638", "0.66439044", "0.66324043", "0.66302234", "0.66242206", "0.6624154", "0.6623586", "0.662285", "0.66225505", "0.66205204", "0.6620083", "0.661743", "0.66092855", "0.65972507", "0.65922266", "0.6586504", "0.658506", "0.6581292", "0.65805286", "0.65799135", "0.65773356", "0.6576414", "0.65755653", "0.65696806", "0.6563355", "0.65567803", "0.6547398", "0.6546297", "0.65454775", "0.65421414", "0.65298074", "0.65294194", "0.65225375", "0.65223724", "0.65203375" ]
0.7442039
0
Use callbacks to share common setup or constraints between actions.
def set_construction_expense @construction_expense = ConstructionExpense.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
Only allow a list of trusted parameters through.
def construction_expense_params params.require(:construction_expense).permit(:material_description, :amount, :owner) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\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 strong_params\n params.require(:user).permit(param_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 allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "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 param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\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 allowed?(*_)\n true\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 allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\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 permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; 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 url_allowlist=(_arg0); 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 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 list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\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 shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
GET /everydays GET /everydays.json
def index @everydays = Everyday.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end", "def set_everyday\n @everyday = Everyday.find(params[:id])\n end", "def get(days,start_cep,end_cep)\n self.class.get(\"/api/v1/quote/available_scheduling_dates/#{days}/#{start_cep}/#{end_cep}\")\n end", "def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end", "def index\n @things = current_user.things.where('the_date >= ?', Date.today ).order('the_date ASC')\n @thing_day = @things.group_by { |t| t.the_date }\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @things }\n end\n end", "def daily\n object # Initializing to make sure that the passed in day is\n # acceptable. Else a 404 will be raised.\n render :template => \"weekly_digests/show\"\n rescue ActiveRecord::RecordNotFound\n rescue_404\n end", "def index\r\n @classdays = Classday.all\r\n\r\n render json: @classdays\r\n end", "def day\n @yoga_sessions = YogaSession.on_day params[:day]\n respond_with @yoga_sessions\n end", "def today_users opts= {}\n JSON.parse(get \"user/today\", opts)\n end", "def index\n if params[:all]\n @today = Time.now.strftime(\"%A\")\n @yoga_sessions = YogaSession.all\n elsif params[:day]\n @today = params[:day].capitalize\n @yoga_sessions = YogaSession.on_day params[:day]\n else\n @today = \"Today\"\n @yoga_sessions = YogaSession.today.remaining\n end \n respond_with @yoga_sessions\n end", "def index\n @entries = Entry.order(\"created_at DESC\").includes(:user)\n @days_left = ( Date.new( 2013, 06, 23 ) - Date.today ).to_i\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end", "def calendar\n get '/gtfs/calendar'\n end", "def index\n number = request.query_parameters.first[1].to_i\n respond_with Event.where(date_time: Date.current..(Date.current + number.days))\n end", "def index\n @day_weeks = DayWeek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @day_weeks }\n end\n end", "def show\n render json: @day, include: [:activities]\n end", "def index\n @days = Day.where(user_id: current_user.id).order(:created_at).limit(10)\n end", "def index\n @time_of_days = TimeOfDay.all\n end", "def index\n @calendar_days = CalendarDay.all\n end", "def index\n # Get all work days in the actual month\n currentTime = Time.now\n @user = current_user\n @work_days = @user.work_days.order(\"date\").where(date: currentTime.at_beginning_of_month..currentTime.at_end_of_month)\n \n # Gets sum of all the work hours\n @work_days_total_hours = @work_days.inject(0.0){|sum, item| sum+item.work_hours} || 0\n @work_days_extra_hours = @work_days_total_hours - (@work_days.count * @user.daily_hours)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_days }\n end\n end", "def index\n if params[:date]\n redirect_date(params[:date])\n else\n @school_days = SchoolDay.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_days }\n end\n end\n end", "def calendar_exceptions\n get '/gtfs/calendarDate'\n end", "def index\n @days = Day.all\n end", "def index\n @user_days = UserDay.all\n end", "def days\n @trainings = Training.all\n @activities = Activity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trainings }\n end\n end", "def today(sym='btcusd', options={})\n #Hashie::Mash.new(self.class.get(\"/v1/today/#{sym}\", options).parsed_response)\n nil\n end", "def calendars\n records 'calendar', '/calendars.xml', :method => :get\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 index\n @days = current_user.days.paginate(page: params[:page], per_page: 7)\n end", "def get_remaining_days(view_id, sprint_id)\n\thttp = create_http\n\trequest = create_request(\"/rest/greenhopper/1.0/gadgets/sprints/remainingdays?rapidViewId=#{view_id}&sprintId=#{sprint_id}\")\n\tresponse = http.request(request)\n\tJSON.parse(response.body)\nend", "def load_daily\n response = HTTParty.get(DAILY_URI, format: :xml)\n load(response['Envelope']['Cube']['Cube'])\n end", "def daily\n if dates_ok?\n @entries = Entry.where('user_id = ?\n AND \"time\"(date) BETWEEN ? AND ?\n AND CAST(date AS DATE) >= ? and CAST(date AS DATE) <= ?', current_user.id, params[:timeFrom], params[:timeTo], Date.parse(params[:dateFrom]), Date.parse(params[:dateTo])).\n select('CAST(date AS DATE), sum(calories) as calories').group('CAST(date AS DATE)')\n else\n @entries = Entry.where('user_id = ?', current_user.id).\n select('CAST(date AS DATE), sum(calories) as calories').group('CAST(date AS DATE)')\n end\n end", "def retrieve_rates(date)\n path = \"http://openexchangerates.org/api/historical/#{date.to_s}.json?app_id=#{$app_id}\"\n response = Net::HTTP.get_response(URI.parse path)\n # TODO: error handling\n response.body\nend", "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 results(day:, month:, year:)\n date = \"#{year}-#{month}-#{day}\"\n\n uri = URI(\"/schedules/#{date}/results.#{response_format}?api_key=#{API_KEYS[:tennis]}\")\n response = Net::HTTP.get_response(uri)\n\n puts response.status unless response.is_a?(Net::HTTPSuccess)\n puts response.body\n end", "def calendars\n if @event.travels_done?\n if current_user.expired == 1\n render :nothing => true, :status => :unauthorized\n else\n render :json => @event.to_json, :status => :ok\n end\n elsif @event.canceled?\n render :nothing => true, :status => :gone\n else\n render :nothing => true, :status => :not_found\n end\n end", "def index\n @workout_days = WorkoutDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workout_days }\n end\n end", "def get_calendars\r\n http = Net::HTTP.new(@google_url, 80)\r\n response, data = http.get(\"http://#{@google_url}/calendar/feeds/\" + @user_id, @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n redirect_response, redirect_data = http.get(response['location'], @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n doc = REXML::Document.new redirect_data\r\n \t doc.elements.each('//entry')do |e|\r\n \t title = e.elements['title'].text\r\n \t url = e.elements['link'].attributes['href']\r\n \t @calendars << GCalendar.new(title, url.sub!(\"http://#{@google_url}\",''))\r\n \t end\r\n return redirect_response\r\n else\r\n response.error!\r\n end\r\n else\r\n response.error!\r\n end\r\n end", "def index\n #@alarms = Alarm.all\n @alarms = Alarm.where(machine_id:Tenant.find(current_tenant.id).machines.ids).distinct(:alarm_message).order(\"updated_at DESC\").where('updated_at > ?', 3.days.ago)\n render json: @alarms\n end", "def dayIndex\n render json: Restaurant.restaurantsDay\n end", "def index\n # @weekdays = Weekday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@weekdays, mode: :compat) }\n end\n end", "def get_companies_reporting_earnings_within days\n @earnings = robinhood_get(\"https://api.robinhood.com/marketdata/earnings/?range=#{days}day\")[\"results\"]\n end", "def index\n log_request(\"Show All Schedules\")\n\n @schedules = Schedule.all\n\n @response = {\n \tevents: @schedules\n }\n\n respond_to do |format|\n format.html { @schedules }\n format.json { render :json => @response }\n end\n end", "def day\n @client = Client.new\n @title = @current_user.name\n @view = 'day'\n # TODO is Date.parse in current time zone? If not add.\n @date = params[:date].nil? ? Date.current : Date.parse(params[:date])\n # TODO: brakeman is warning of security problem with this line\n @nav_title = @date.strftime(NAV_TITLE[@view.to_sym])\n # TODO: should employees stay or go?\n @employees = [1]\n\n @appointments_by_hour = Hash.new\n r = Appointment.where(time: @date.in_time_zone.beginning_of_day..@date.in_time_zone.end_of_day).order(:time).includes(:client)\n r.each do |appointment| #.order(:time).group_by(&:time)\n k = appointment.time.hour\n if @appointments_by_hour.has_key?(k)\n @appointments_by_hour[k].push(appointment)\n else\n @appointments_by_hour[k] = [appointment]\n end\n end\n\n render 'index'\n end", "def each_day(&block)\n calendar_range.map { |day| Day.new(day, requests_for(day)) }\n .each(&block)\n end", "def getToday\n page = params[:page] || 1\n per = params[:per] || 10\n\n surprise = @current_user.event.where(event_type: \"surprise\").where(date: Time.now.strftime('%F')).page(page).per(per)\n\n if surprise\n render :json => {\n :event => surprise.as_json(:except => [:created_at , :updated_at] , include: {surprise: {include: :surprise_user}})\n } , status: 200\n return\n else\n render json: { message: \"not found\" } , status:404\n return\n end\n end", "def hourly(query)\n get_json(\"#{api_url}/hourly/q/#{parse_query(query)}.#{@options[:format]}\")\n end", "def chart_days\n daily_requests = self.daily_requests.limit(10)\n days = daily_requests.map(&:created_at)\n days.map { |d| d.strftime(\"%b %e\") }\n end", "def visits_by_day\n render json: Ahoy::Visit.this_month.group_by_day(:started_at).count\n end", "def visits_by_day\n render json: Visit.group_by_day(:visited_at, format: \"%B %d, %Y\").count\n end", "def index\n @events = Event.where(\"date >= ?\", Date.today).order(:date).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @users = User.all\n \n session[:day] = Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def get_companies_reporting_earnings_within days\n @earnings = robinhood_get(\"#{ROBINHOOD_API_URL}/marketdata/earnings/?range=#{days}day\")[\"results\"]\n end", "def daily(options = {})\n branch options.merge(every: :day)\n end", "def daily(options = {})\n branch options.merge(every: :day)\n end", "def index\n @daily_logs = current_user.daily_logs.order(\"updated_at DESC\")\n render json: @daily_logs, each_serializer: Rest::DailyLogSerializer\n end", "def weekdays\n result = veeamconfig('schedule', 'show', '--jobId', get_job_id).lines\n\n if result[0].strip == 'Every day'\n ['daily']\n else\n result[0].strip.split(': ')[1].split(', ')\n end\n end", "def index\n @daily_happinesses = DailyHappiness.all\n end", "def get_calendar_list()\n\t\tif(!@client.nil?)\n\t\t\tresponse = @client.execute(api_method: @service.calendar_list.list)\n\t\t\tcalendars = JSON.parse(response.body)\n\t\telse\n\t\t\tputs \"Client No Calendar boi\"\n\t\tend\n\tend", "def find\n days = Day.where(fulldate: Date.parse(params[:startdate])..Date.parse(params[:enddate]))\n sorted_days = days.sort_by{ |day| day.fulldate }\n render json: sorted_days\n end", "def index\n @campaigns = site.campaigns.by_campaign_and_day.all\n render :json => @campaigns\n end", "def index\n @best_of_days = BestOfDay.all\n end", "def events_per_day\n city = City.find(params[:city_id])\n @events = city.events.month(params[:year], params[:month])\n days = {}\n (1..31).each do |d|\n days[d] = 0\n end\n\n @events.each do |e|\n days[e.start_time.day] += 1\n end\n\n respond_to do |format|\n format.json { render :json => days}\n end\n end", "def index\n #@event_days = EventDay.all\n @event_days = Event.find(params[:event_id]).event_days\n end", "def index\n meals = json_decode(RestClient::Resource.new(BASE_URL).get({:accept => :json}).body)\n\n styled_array(meals.map do |meal|\n [(meal['today'] ? '*' : ''), day_of_week(meal['date']), meal['summary']]\n end, :sort => false)\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 @lunchplans = Lunchplan.all\n\t@lunchplans_by_date = @lunchplans.group_by(&:day)\n\t@date = params[:date] ? Date.parse(params[:date]) : Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lunchplans }\n end\n end", "def create\n @everyday = Everyday.new(everyday_params)\n\n respond_to do |format|\n if @everyday.save\n format.html { redirect_to :back, notice: 'Everyday was successfully created.' }\n format.json { render :show, status: :created, location: :back }\n else\n format.html { render :new }\n format.json { render json: @everyday.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @events = @calendar.events.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "def all\n @timesheet_entries = TimesheetEntry.all\n\n respond_to do |format|\n format.html { render json: @timesheet_entries }\n format.json { render json: @timesheet_entries }\n end\n end", "def weekly\n render json: Question.active.weekly.not_seen(@api_current_user.id).first\n end", "def weekly_goals\n get(\"/user/#{@user_id}/activities/goals/weekly.json\")\n end", "def schedules\n params = init_params\n request_url = UrlGenerator.url_for(\"schedules\")\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end", "def calendar_list\n\t\t logger.info(\"-- get_calendar_list_responce st --\") if logger\n\t\t auth unless @auth\n\t\t uri = URI.parse(CALENDAR_LIST_PATH)\n\t\t res = do_get(uri, {})\n\t\t logger.info(\"-- get_calendar_list_responce en(#{res.message}) --\") if logger\n\t\t res\n\t\tend", "def showtimes_json(day)\n showtimes_by_cinemas_json(CONST::WORD_DAY_HASH[day]).to_json\n end", "def get_days\n return 0b0 if @params[:type] != 'advanced'\n\n return get_weekday_bitmask(['weekday_sun', 'weekday_mon', 'weekday_tue', 'weekday_wed', 'weekday_thu', 'weekday_fri', 'weekday_sat']) if @params[:schedule] == 'weekly'\n\n return get_month_bitmask(@params[:dates_picked]) if @params[:schedule] == 'monthly' && @params[:days] == 'specific'\n\n return get_unspecific_days\n\n end", "def index\n @forecasts = Forecast.all\n @days = @forecasts.order(\"created_at desc\").pluck(:date).uniq\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end", "def index\n @fridays = Friday.all\n end", "def todayEvent\n event = NationalEvent.where(date: Date.today ).all\n if event\n render json: event , status:200\n else\n render json: { error: \"رویداد ملی ای پیدا نشد\" } , status: 200\n end\n end", "def calendar_list\r\n logger.info(\"-- calendar list st --\") if logger\r\n auth unless @auth\r\n uri = URI.parse(CALENDAR_LIST_PATH)\r\n res = do_get(uri, {})\r\n logger.info(\"-- calendar list en(#{res.message}) --\") if logger\r\n res\r\n end", "def daily_update\n\t\t\tcurrent_user.investment_account.daily_update\n\t\t\trender json: current_user, status: 200\n\t\tend", "def search_for_future_calendar_events\n uri = URI.parse(\"https://www.googleapis.com/calendar/v3/calendars/ufbobbo%40gmail.com/events?orderBy=startTime&singleEvents=true&timeMin=#{Time.now.strftime(\"%FT%T%:z\")}&fields=items(id%2Cstart)&key=#{ENV['GOOGLE_API_KEY']}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request).body\n end", "def index\n @holidays = Holiday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holidays }\n end\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def events\n results = @client.execute(\n :api_method => @calendar.events.list,\n :authenticated => false,\n :parameters => {\n 'calendarId' => @config[:calendar_id],\n 'fields' => 'items(start,end,summary)',\n 'singleEvents' => true,\n 'orderBy' => 'startTime',\n 'timeMin' => DateTime.now.to_s,\n 'timeMax' => (DateTime.now + 7).to_s,\n 'q' => 'LIVE'\n }\n )\n\n results.data.items.map do |event|\n summary = event.summary.gsub(/^LIVE:\\s+/, '')\n CalendarEvent.new(summary, event.start.date_time, event.end.date_time)\n end\n end", "def index\n @week_days = WeekDay.all\n end", "def index\n @gamedays = Gameday.all\n end", "def today_events\n @dayly_by_date = current_student.user_events.group_by { |event| event.date.to_date }\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end", "def index\n params.permit(:day)\n if params[:day] then\n @tasks = current_user.tasks.where(day: [nil, Date.parse(params[:day])])\n else\n @tasks = current_user.tasks\n end\n end", "def index\n @current_user = current_user\n if @current_user.nil? || !@current_user.is_admin\n redirect_to root_url\n return\n end\n\n # TODO show dates in user's time zone\n @nfl_games = NflSchedule.includes(:home_nfl_team)\n .includes(:away_nfl_team)\n .order(:week)\n .order(:start_time)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nfl_games }\n end\n end", "def index\n @wednesdays = Wednesday.all\n end", "def query_by_date\n # find the wdays of the trip\n dates = dates_to_wdays(\n Date.parse(params[:from]),\n Date.parse(params[:to])\n )\n\n # find schedules that fit the wdays of the trip\n schedules = Schedule.where.overlap(wdays: dates)\n\n respond_with TripsBySchedulePresenter.new(schedules).as_json\n end", "def calendars(user)\n Transport::url = Config.url\n\n _started = Time.now\n result = Transport::get(Config.username, Config.password, user, self.transport)\n _ended = Time.now\n KerioIcal.logger.info \"Transport::get spent #{_ended - _started}, with #{self.transport}\"\n\n _started = Time.now\n cals = Icalendar.parse(result)\n _ended = Time.now\n KerioIcal.logger.info \"Icalendar::parse spent #{_ended - _started}\"\n\n cals\n end", "def update\n respond_to do |format|\n if @everyday.update(everyday_params)\n format.html { redirect_to :back, notice: 'Everyday was successfully updated.' }\n format.json { render :show, status: :ok, location: :back }\n else\n format.html { render :edit }\n format.json { render json: @everyday.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_days\n puts \"This Week's Forecast:\"\n\n Scraper.scrape_cast \n\n days = Project1::Forecast.all\n days.map.with_index(1) do |day, i|\n puts \"#{i}. #{day.name}\"\n end\n end", "def index\n @radars = Radar.all\n @days = @radars.order(\"created_at desc\").pluck(:created_at).uniq.collect { |d| d = d ? d.utc.strftime(\"%Y-%m-%d\") : DateTime.now.utc.strftime(\"%Y-%m-%d\") }.uniq\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end", "def index\n @day_availabilities = DayAvailability.all\n\n respond_to do |format|\n format.html {redirect_to @day_availabilities.week_availability}\n # format.json { render json: @day_availability }\n end\n end", "def events_seven_days()\n events = []\n today = Date.today\n for i in 0..6 do\n events += events_by_date(today + i)\n end\n return events\nend", "def index\n @date = params[:date].present? ? Date.parse(params[:date]) : Date.today\n beginning_of_day, end_of_day = @date.beginning_of_day, @date.end_of_day\n @feats = @person.feats.all(\n :include => :activity, \n :conditions => [\"activities.start_time > ? and activities.start_time < ?\", beginning_of_day, end_of_day])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feats }\n end\n end", "def index\n @prices = authorized_scope(venue.prices).includes(:courts)\n if params[:day].present?\n day = params[:day].to_s\n raise WrongActionError unless Price::WEEKDAYS.map(&:to_s).include?(day)\n @prices = @prices.where(\"#{day}\": true)\n end\n\n # TODO: filter ones by sport, so it doesn't render golf prices when looking for tennis\n\n @prices = @prices.uniq\n end" ]
[ "0.66841364", "0.65996456", "0.6409283", "0.6333991", "0.62007236", "0.61959934", "0.6188859", "0.61742467", "0.61663413", "0.6161771", "0.61412436", "0.6059106", "0.60513824", "0.5995897", "0.5991781", "0.59844416", "0.59807616", "0.59723216", "0.59380704", "0.5926723", "0.5894425", "0.58795583", "0.58788764", "0.5866568", "0.5865714", "0.5847849", "0.58411133", "0.58355564", "0.58350974", "0.58233476", "0.5818765", "0.5802132", "0.58003765", "0.5800238", "0.576253", "0.5745597", "0.5739753", "0.573754", "0.5720098", "0.571507", "0.5712315", "0.57093513", "0.570913", "0.57078505", "0.57022965", "0.56940234", "0.5674929", "0.5673401", "0.566299", "0.5660432", "0.56559795", "0.5652978", "0.5650911", "0.5650911", "0.5645547", "0.56406903", "0.56307226", "0.563065", "0.56246346", "0.56231827", "0.56218505", "0.5616739", "0.5611974", "0.5609271", "0.56082004", "0.56002796", "0.5593679", "0.5585552", "0.55826825", "0.5575478", "0.557434", "0.5572843", "0.5572152", "0.5571656", "0.5569828", "0.5569308", "0.5557444", "0.5556429", "0.5550429", "0.5543773", "0.55412614", "0.5530598", "0.5506843", "0.5506397", "0.5503284", "0.55012727", "0.5500419", "0.5496754", "0.5496053", "0.5495631", "0.54922706", "0.54844207", "0.5483489", "0.54830307", "0.5480959", "0.54808587", "0.54804116", "0.5480274", "0.5474595", "0.5463823" ]
0.7274144
0
GET /everydays/1 GET /everydays/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @everydays = Everyday.all\n end", "def get(days,start_cep,end_cep)\n self.class.get(\"/api/v1/quote/available_scheduling_dates/#{days}/#{start_cep}/#{end_cep}\")\n end", "def set_everyday\n @everyday = Everyday.find(params[:id])\n end", "def daily\n object # Initializing to make sure that the passed in day is\n # acceptable. Else a 404 will be raised.\n render :template => \"weekly_digests/show\"\n rescue ActiveRecord::RecordNotFound\n rescue_404\n end", "def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end", "def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end", "def index\n number = request.query_parameters.first[1].to_i\n respond_with Event.where(date_time: Date.current..(Date.current + number.days))\n end", "def day\n @yoga_sessions = YogaSession.on_day params[:day]\n respond_with @yoga_sessions\n end", "def index\r\n @classdays = Classday.all\r\n\r\n render json: @classdays\r\n end", "def index\n @things = current_user.things.where('the_date >= ?', Date.today ).order('the_date ASC')\n @thing_day = @things.group_by { |t| t.the_date }\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @things }\n end\n end", "def index\n if params[:date]\n redirect_date(params[:date])\n else\n @school_days = SchoolDay.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_days }\n end\n end\n end", "def index\n @entries = Entry.order(\"created_at DESC\").includes(:user)\n @days_left = ( Date.new( 2013, 06, 23 ) - Date.today ).to_i\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end", "def show\n render json: @day, include: [:activities]\n end", "def index\n @days = Day.where(user_id: current_user.id).order(:created_at).limit(10)\n end", "def calendar\n get '/gtfs/calendar'\n end", "def index\n if params[:all]\n @today = Time.now.strftime(\"%A\")\n @yoga_sessions = YogaSession.all\n elsif params[:day]\n @today = params[:day].capitalize\n @yoga_sessions = YogaSession.on_day params[:day]\n else\n @today = \"Today\"\n @yoga_sessions = YogaSession.today.remaining\n end \n respond_with @yoga_sessions\n end", "def index\n @day_weeks = DayWeek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @day_weeks }\n end\n end", "def retrieve_rates(date)\n path = \"http://openexchangerates.org/api/historical/#{date.to_s}.json?app_id=#{$app_id}\"\n response = Net::HTTP.get_response(URI.parse path)\n # TODO: error handling\n response.body\nend", "def index\n @days = Day.all\n end", "def today(sym='btcusd', options={})\n #Hashie::Mash.new(self.class.get(\"/v1/today/#{sym}\", options).parsed_response)\n nil\n end", "def today_users opts= {}\n JSON.parse(get \"user/today\", opts)\n end", "def index\n @calendar_days = CalendarDay.all\n end", "def calendar_exceptions\n get '/gtfs/calendarDate'\n end", "def dayIndex\n render json: Restaurant.restaurantsDay\n end", "def index\n @time_of_days = TimeOfDay.all\n end", "def load_daily\n response = HTTParty.get(DAILY_URI, format: :xml)\n load(response['Envelope']['Cube']['Cube'])\n end", "def index\n @user_days = UserDay.all\n end", "def days\n @trainings = Training.all\n @activities = Activity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trainings }\n end\n end", "def getToday\n page = params[:page] || 1\n per = params[:per] || 10\n\n surprise = @current_user.event.where(event_type: \"surprise\").where(date: Time.now.strftime('%F')).page(page).per(per)\n\n if surprise\n render :json => {\n :event => surprise.as_json(:except => [:created_at , :updated_at] , include: {surprise: {include: :surprise_user}})\n } , status: 200\n return\n else\n render json: { message: \"not found\" } , status:404\n return\n end\n end", "def index\n @days = current_user.days.paginate(page: params[:page], per_page: 7)\n end", "def index\n # Get all work days in the actual month\n currentTime = Time.now\n @user = current_user\n @work_days = @user.work_days.order(\"date\").where(date: currentTime.at_beginning_of_month..currentTime.at_end_of_month)\n \n # Gets sum of all the work hours\n @work_days_total_hours = @work_days.inject(0.0){|sum, item| sum+item.work_hours} || 0\n @work_days_extra_hours = @work_days_total_hours - (@work_days.count * @user.daily_hours)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_days }\n end\n end", "def index\n @forecasts = Forecast.all\n @days = @forecasts.order(\"created_at desc\").pluck(:date).uniq\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end", "def get_remaining_days(view_id, sprint_id)\n\thttp = create_http\n\trequest = create_request(\"/rest/greenhopper/1.0/gadgets/sprints/remainingdays?rapidViewId=#{view_id}&sprintId=#{sprint_id}\")\n\tresponse = http.request(request)\n\tJSON.parse(response.body)\nend", "def weekly\n render json: Question.active.weekly.not_seen(@api_current_user.id).first\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 index\n #@event_days = EventDay.all\n @event_days = Event.find(params[:event_id]).event_days\n end", "def calories_on_date(date)\n get_call(\"1/user/#{user_id}/activities/calories/date/#{format_date(date)}/1d.json\")\n end", "def day\n @client = Client.new\n @title = @current_user.name\n @view = 'day'\n # TODO is Date.parse in current time zone? If not add.\n @date = params[:date].nil? ? Date.current : Date.parse(params[:date])\n # TODO: brakeman is warning of security problem with this line\n @nav_title = @date.strftime(NAV_TITLE[@view.to_sym])\n # TODO: should employees stay or go?\n @employees = [1]\n\n @appointments_by_hour = Hash.new\n r = Appointment.where(time: @date.in_time_zone.beginning_of_day..@date.in_time_zone.end_of_day).order(:time).includes(:client)\n r.each do |appointment| #.order(:time).group_by(&:time)\n k = appointment.time.hour\n if @appointments_by_hour.has_key?(k)\n @appointments_by_hour[k].push(appointment)\n else\n @appointments_by_hour[k] = [appointment]\n end\n end\n\n render 'index'\n end", "def index\n meals = json_decode(RestClient::Resource.new(BASE_URL).get({:accept => :json}).body)\n\n styled_array(meals.map do |meal|\n [(meal['today'] ? '*' : ''), day_of_week(meal['date']), meal['summary']]\n end, :sort => false)\n end", "def weekly_goals\n get(\"/user/#{@user_id}/activities/goals/weekly.json\")\n end", "def index\n # @weekdays = Weekday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@weekdays, mode: :compat) }\n end\n end", "def company_onethings(start_date,period,interval)\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_all_company'])\n\t\t url_params = {\"period\" => period, \"start_date\" => start_date, \"interval\" => interval}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "def show\n @weekday = Weekday.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weekday }\n end\n end", "def daily_update\n\t\t\tcurrent_user.investment_account.daily_update\n\t\t\trender json: current_user, status: 200\n\t\tend", "def show\n @days_since_visit = DaysSinceVisit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @days_since_visit }\n end\n end", "def index\n @workout_days = WorkoutDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workout_days }\n end\n end", "def daily(options = {})\n branch options.merge(every: :day)\n end", "def daily(options = {})\n branch options.merge(every: :day)\n end", "def daily\n if dates_ok?\n @entries = Entry.where('user_id = ?\n AND \"time\"(date) BETWEEN ? AND ?\n AND CAST(date AS DATE) >= ? and CAST(date AS DATE) <= ?', current_user.id, params[:timeFrom], params[:timeTo], Date.parse(params[:dateFrom]), Date.parse(params[:dateTo])).\n select('CAST(date AS DATE), sum(calories) as calories').group('CAST(date AS DATE)')\n else\n @entries = Entry.where('user_id = ?', current_user.id).\n select('CAST(date AS DATE), sum(calories) as calories').group('CAST(date AS DATE)')\n end\n end", "def results(day:, month:, year:)\n date = \"#{year}-#{month}-#{day}\"\n\n uri = URI(\"/schedules/#{date}/results.#{response_format}?api_key=#{API_KEYS[:tennis]}\")\n response = Net::HTTP.get_response(uri)\n\n puts response.status unless response.is_a?(Net::HTTPSuccess)\n puts response.body\n end", "def query\n begin\n response = resource[\"/query/#{app}\"].post(:days => options[:days], :url => options[:url], :mode => options[:mode])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def index\n #@alarms = Alarm.all\n @alarms = Alarm.where(machine_id:Tenant.find(current_tenant.id).machines.ids).distinct(:alarm_message).order(\"updated_at DESC\").where('updated_at > ?', 3.days.ago)\n render json: @alarms\n end", "def index\n @daily_happinesses = DailyHappiness.all\n end", "def index\n @lunchplans = Lunchplan.all\n\t@lunchplans_by_date = @lunchplans.group_by(&:day)\n\t@date = params[:date] ? Date.parse(params[:date]) : Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lunchplans }\n end\n end", "def index\n @radars = Radar.all\n @days = @radars.order(\"created_at desc\").pluck(:created_at).uniq.collect { |d| d = d ? d.utc.strftime(\"%Y-%m-%d\") : DateTime.now.utc.strftime(\"%Y-%m-%d\") }.uniq\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end", "def create\n @everyday = Everyday.new(everyday_params)\n\n respond_to do |format|\n if @everyday.save\n format.html { redirect_to :back, notice: 'Everyday was successfully created.' }\n format.json { render :show, status: :created, location: :back }\n else\n format.html { render :new }\n format.json { render json: @everyday.errors, status: :unprocessable_entity }\n end\n end\n end", "def daily_events_for_id(id, action, date = default_date_range)\n additional_params = {\n flat: 1,\n label: \"#{id} - #{action}\"\n }\n response = api_params('Events.getName', 'day', date, additional_params)\n results_array(response, 'nb_events')\n end", "def show\n @day_list = DayList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @day_list }\n end\n end", "def hourly(query)\n get_json(\"#{api_url}/hourly/q/#{parse_query(query)}.#{@options[:format]}\")\n end", "def list_days\n puts \"This Week's Forecast:\"\n\n Scraper.scrape_cast \n\n days = Project1::Forecast.all\n days.map.with_index(1) do |day, i|\n puts \"#{i}. #{day.name}\"\n end\n end", "def each_day(&block)\n calendar_range.map { |day| Day.new(day, requests_for(day)) }\n .each(&block)\n end", "def index\n @events = Event.where(\"date >= ?\", Date.today).order(:date).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def todayEvent\n event = NationalEvent.where(date: Date.today ).all\n if event\n render json: event , status:200\n else\n render json: { error: \"رویداد ملی ای پیدا نشد\" } , status: 200\n end\n end", "def index\n @mondays = Monday.all\n end", "def index\n @users = User.all\n \n session[:day] = Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def index\n @best_of_days = BestOfDay.all\n end", "def index\n @daily_logs = current_user.daily_logs.order(\"updated_at DESC\")\n render json: @daily_logs, each_serializer: Rest::DailyLogSerializer\n end", "def index\n params.permit(:day)\n if params[:day] then\n @tasks = current_user.tasks.where(day: [nil, Date.parse(params[:day])])\n else\n @tasks = current_user.tasks\n end\n end", "def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end", "def show\n @daytime = Daytime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daytime }\n end\n end", "def index\n @week_days = WeekDay.all\n end", "def index\n @wednesdays = Wednesday.all\n end", "def chart_days\n daily_requests = self.daily_requests.limit(10)\n days = daily_requests.map(&:created_at)\n days.map { |d| d.strftime(\"%b %e\") }\n end", "def events_per_day\n city = City.find(params[:city_id])\n @events = city.events.month(params[:year], params[:month])\n days = {}\n (1..31).each do |d|\n days[d] = 0\n end\n\n @events.each do |e|\n days[e.start_time.day] += 1\n end\n\n respond_to do |format|\n format.json { render :json => days}\n end\n end", "def visits_by_day\n render json: Ahoy::Visit.this_month.group_by_day(:started_at).count\n end", "def index\n @fridays = Friday.all\n end", "def index\n @date = params[:date].present? ? Date.parse(params[:date]) : Date.today\n beginning_of_day, end_of_day = @date.beginning_of_day, @date.end_of_day\n @feats = @person.feats.all(\n :include => :activity, \n :conditions => [\"activities.start_time > ? and activities.start_time < ?\", beginning_of_day, end_of_day])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feats }\n end\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 index\n log_request(\"Show All Schedules\")\n\n @schedules = Schedule.all\n\n @response = {\n \tevents: @schedules\n }\n\n respond_to do |format|\n format.html { @schedules }\n format.json { render :json => @response }\n end\n end", "def show\n #@day = Day.find_by_user_id(current_user)\n @day = Day.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @day }\n end\n end", "def daily_requests_for(time = Time.now)\n find_or_create_daily_requests_for(time)\n end", "def food_logs(user_id: '-', date: Date.today)\n return get(\"#{API_URI}/#{FOOD_API_VERSION}/user/#{user_id}/foods/log/date/#{date}.json\")\n end", "def employee_vacations\n #vacaciones de este año\n vacations = Employee.find(params[:id]).get_vacation_days\n\n respond_to do |format|\n format.json { render json: vacations }\n end\n end", "def find\n days = Day.where(fulldate: Date.parse(params[:startdate])..Date.parse(params[:enddate]))\n sorted_days = days.sort_by{ |day| day.fulldate }\n render json: sorted_days\n end", "def index\n @holidays = Holiday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holidays }\n end\n end", "def index\n date = (Date.today).to_s\n @tasks = current_user.tasks.where(task_day: date)\n end", "def day()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Day::DayRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end", "def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end", "def index\n @campaigns = site.campaigns.by_campaign_and_day.all\n render :json => @campaigns\n end", "def get_calendars\r\n http = Net::HTTP.new(@google_url, 80)\r\n response, data = http.get(\"http://#{@google_url}/calendar/feeds/\" + @user_id, @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n redirect_response, redirect_data = http.get(response['location'], @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n doc = REXML::Document.new redirect_data\r\n \t doc.elements.each('//entry')do |e|\r\n \t title = e.elements['title'].text\r\n \t url = e.elements['link'].attributes['href']\r\n \t @calendars << GCalendar.new(title, url.sub!(\"http://#{@google_url}\",''))\r\n \t end\r\n return redirect_response\r\n else\r\n response.error!\r\n end\r\n else\r\n response.error!\r\n end\r\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 weekdays\n result = veeamconfig('schedule', 'show', '--jobId', get_job_id).lines\n\n if result[0].strip == 'Every day'\n ['daily']\n else\n result[0].strip.split(': ')[1].split(', ')\n end\n end", "def index_for_calendar\n # build_calendar_data --> AppointmentsHelper method\n render json: build_calendar_data, status: 200\n end", "def index\n @sundays = Sunday.all\n end", "def index\n @valet_data = ValetDatum.all.limit(20)\n @day = params[:day]\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 @day_availabilities = DayAvailability.all\n\n respond_to do |format|\n format.html {redirect_to @day_availabilities.week_availability}\n # format.json { render json: @day_availability }\n end\n end", "def index\n @gios_measurments = GiosMeasurment.all\n @days = @gios_measurments.order(\"calc_date desc\").pluck(:calc_date).uniq.collect { |d| d = d ? d.strftime(\"%Y-%m-%d\") : DateTime.now.strftime(\"%Y-%m-%d\") }.uniq\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end" ]
[ "0.7072942", "0.6704829", "0.66739696", "0.6578025", "0.6522374", "0.63656336", "0.6358717", "0.6280563", "0.6162076", "0.615712", "0.6151431", "0.6126535", "0.60666364", "0.60655785", "0.60551673", "0.6052626", "0.60312504", "0.6025219", "0.60220593", "0.5994382", "0.5978404", "0.5975435", "0.5972516", "0.59411156", "0.5935351", "0.5928934", "0.58913827", "0.5888303", "0.5874134", "0.5871354", "0.58589613", "0.58549285", "0.5830962", "0.58306754", "0.5819044", "0.5806434", "0.57916075", "0.5790255", "0.57878315", "0.5778827", "0.5746288", "0.57429117", "0.57428765", "0.57387316", "0.5726617", "0.57218844", "0.5720703", "0.5720703", "0.5716458", "0.5714018", "0.5698039", "0.56951463", "0.56889886", "0.56812954", "0.5681103", "0.5680449", "0.5680247", "0.5678327", "0.56729925", "0.5670397", "0.5662053", "0.5660496", "0.56593823", "0.5646676", "0.56466395", "0.5642355", "0.56414396", "0.56324524", "0.56260115", "0.5625261", "0.56250274", "0.5595058", "0.5582604", "0.5579274", "0.5579214", "0.55745053", "0.55716544", "0.5570992", "0.55708444", "0.5569342", "0.55665714", "0.5565035", "0.555549", "0.55537987", "0.55534446", "0.55488396", "0.5546808", "0.5539185", "0.5538217", "0.5535189", "0.5535189", "0.5534111", "0.5530423", "0.55285037", "0.5523057", "0.5520412", "0.55181664", "0.55161446", "0.5515443", "0.5508453", "0.55062956" ]
0.0
-1
POST /everydays POST /everydays.json
def create @everyday = Everyday.new(everyday_params) respond_to do |format| if @everyday.save format.html { redirect_to :back, notice: 'Everyday was successfully created.' } format.json { render :show, status: :created, location: :back } else format.html { render :new } format.json { render json: @everyday.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_everyday\n @everyday = Everyday.find(params[:id])\n end", "def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params['tuesday'] = tuesday\n params['wednesday'] = wednesday\n params['thursday'] = thursday\n params['friday'] = friday\n params['saturday'] = saturday\n params['sunday'] = sunday\n params['closed'] = closed\n params['closed_public_holidays'] = closed_public_holidays\n return doCurl(\"post\",\"/entity/opening_times\",params)\n end", "def everyday_params\n params.require(:everyday).permit(:read, :cardio, :exercise, :eat_to_plan, :make_money)\n end", "def create_day\n trip = Trip.find(params[:id])\n offset = 0\n trip.days.all.each do |day|\n offset += 1\n end\n @day = Day.new({\"date\" => trip.beginning + offset , \"trip\" => trip})\n trip.update_attribute(:duration, trip.attributes['duration'] + 1)\n trip.save\n respond_to do |format|\n if @day.save\n format.html { redirect_to trip, notice: 'Day was successfully created.' }\n format.json { render :show, status: :created, location: @day }\n else\n format.html { render home_path }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @everydays = Everyday.all\n end", "def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end", "def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end", "def create\n \n\tdays = params[:day]\n\tsaved = true\n \n\tdays.each do |d|\n\t\t@shift = Shift.new(params[:shift])\n\t\t@shift.business_id = current_user.id\n\t\t@shift.day = d[0]\n\n\t if !@shift.save\n\t\tsaved = false\n\t end\n\tend\n\t\n\trespond_to do |format|\n\t\tif saved\n\t\t\tformat.html { redirect_to shifts_path, notice: 'Shift was successfully created.' }\n\t\t\tformat.json { render json: shifts_path, status: :created, location: @shift }\n\t\telse\n\t\t\tformat.html { render action: \"new\" }\n\t\t\tformat.json { render json: @shift.errors, status: :unprocessable_entity }\n\t\tend\n\tend\n\t\n end", "def day\n @yoga_sessions = YogaSession.on_day params[:day]\n respond_with @yoga_sessions\n end", "def create\n @day ||= Weekday.day\n @days ||= Weekday.days\n @batch = Weekday.set_day(params[:weekday][:batch_id], params[:weekdays])\n flash[:notice] = t('weekday_create')\n end", "def daily\n respond_with PostDailyList.last_or_create\n end", "def create\n days = [\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"Sunday\"]\n\n @user = current_user\n @user_location = @user.user_locations.find(params[:user_location_id])\n\n UserSchedule.transaction do\n \n days.each do |day|\n if params[day]\n @user_schedule = @user_location.user_schedules.build\n\n @user_schedule.to_standard = params[:to_standard] \n @user_schedule.from_standard = params[:from_standard] \n @user_schedule.day = day\n @user_schedule.save\n\n end\n end\n end\n\n respond_to :js\n\n end", "def daily_update\n\t\t\tcurrent_user.investment_account.daily_update\n\t\t\trender json: current_user, status: 200\n\t\tend", "def create\n busy_shifts = params[:busy_shift]\n if busy_shifts\n busy_shifts[:day].length.times do |index|\n day = busy_shifts[:day][index]\n start_time = busy_shifts[:start_time][index]\n end_time = busy_shifts[:end_time][index]\n @busy_shifts = current_user.busy_shifts.create(:day => day, :start_time => start_time, :end_time => end_time)\n end\n render json: current_user.busy_shifts\n else\n render json: {errors: \"Could not create busy shifts there was a error\"}\n end\n end", "def create\n if params[:pay_day] && params[:start_day] && params[:end_day]\n ::TimeEntry.where(pay_day: params[:pay_day]).update_all(pay_day: nil)\n ::TimeEntry.where(\"day>=? AND day<=?\",params[:start_day],params[:end_day]).update_all(pay_day: params[:pay_day])\n end\n redirect_to \"/time/#{params[:start_day]}\"\n end", "def each_day(&block)\n calendar_range.map { |day| Day.new(day, requests_for(day)) }\n .each(&block)\n end", "def create\n @user = current_user\n @baby = Baby.find(params[:baby_id])\n @day = Day.new(day_params)\n @day.baby_id = @baby.id\n @day.user_id = @user.id\n respond_to do |format|\n if @day.save\n @baby.days << @day\n @user.days << @day\n format.html { redirect_to baby_path(@baby), notice: 'Day was successfully created.' }\n # format.json { render :show, status: :created, location: @day }\n else\n format.html { render :new }\n # format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_day = WorkDay.new(work_day_params)\n\t\t#delete for today everything else \n\t\tWorkDay.select{|wd| wd.employee_id == @work_day.employee_id}.each do |wd|\n\t\t\twd.destroy\n\t\tend\n\t\t\n respond_to do |format|\n\t\t\t#validation line, make sure that this employee doesnt already have a schedule for today\n if !(WorkDay.all.select{|work_day| work_day.start_time.day == @work_day.start_time.day && work_day.employee_id == @work_day.employee_id}.any?)\n\t\t\t\t@work_day.save\n format.html { redirect_to @work_day, notice: 'Work day was successfully created.' }\n format.json { render :show, status: :created, location: @work_day }\n else\n format.html { render :new }\n format.json { render json: @work_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @day = Day.new(params[:day])\n\n respond_to do |format|\n if @day.save\n format.html { redirect_to @day, notice: 'Day was successfully created.' }\n format.json { render json: @day, status: :created, location: @day }\n else\n format.html { render action: \"new\" }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end", "def daily(options = {})\n branch options.merge(every: :day)\n end", "def daily(options = {})\n branch options.merge(every: :day)\n end", "def events_per_day\n city = City.find(params[:city_id])\n @events = city.events.month(params[:year], params[:month])\n days = {}\n (1..31).each do |d|\n days[d] = 0\n end\n\n @events.each do |e|\n days[e.start_time.day] += 1\n end\n\n respond_to do |format|\n format.json { render :json => days}\n end\n end", "def update\n respond_to do |format|\n if @everyday.update(everyday_params)\n format.html { redirect_to :back, notice: 'Everyday was successfully updated.' }\n format.json { render :show, status: :ok, location: :back }\n else\n format.html { render :edit }\n format.json { render json: @everyday.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n attendance_params[:checkin] = attendance_params[:checkin].to_time\n attendance_params[:checkout] = attendance_params[:checkout].to_time\n attendance_params[:attendance_date] = attendance_params[:attendance_date].to_date\n\n r = @api.create_attendance(attendance_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n end", "def new_day_params\n params.require(:new_day).permit!\n end", "def create\n @day = Day.new(day_params)\n\n respond_to do |format|\n if @day.save\n format.html { redirect_to @day, notice: 'Day was successfully created.' }\n format.json { render :show, status: :created, location: @day }\n else\n format.html { render :new }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(params[:schedule])\n @schedule.days = params[:days]\n\n if @schedule.save\n redirect_to edit_profiles_path\n else\n respond_with(@schedule) do\n format.html {render 'new'}\n end\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 build_enphase_energy_lifetime_daily_readings(eel, body_json)\n values = []\n\n body_json[\"production\"].each_with_index do |stat, i|\n values << [ \n :enphase_user_id => @user_id, \n :system_id => body_json[\"system_id\"], \n :production_enwh => stat, \n :est_date => (Date.parse(body_json[\"start_date\"]) + (i+1)) \n ]\n end\n\n eel.enphase_energy_lifetime_daily_readings.create!(values)\n end", "def update_daily_happiness_distributions! \n HappinessEntry.dates.each do |date|\n uid = uid_for_day(date)\n entries_for_date = HappinessEntry.on_date(date)\n update_happiness_distribution! uid, :day, entries_for_date \n end\n end", "def daily_new(options = {})\n request_model = @request_model_factory.daily_new_request_model(options)\n response = @network_client.perform_request(request_model)\n parse_point_response(response)\n end", "def create\n data = reload(get_series('sleep'), str(Date.strptime(params[:sleep].values.join(\"-\"))))\n saved = false\n get_series('sleep').each do |s|\n data[s].each do |day|\n logger.debug \"data=#{day} date=#{day['dateTime']} value=#{day['value']}\"\n @sleep = for_date(day['dateTime'])\n\t# get variable name from last part of series\n @sleep.send(s.rpartition('/')[2] + '=', day['value'])\n saved = @sleep.save\n if not saved\n flash[:error] = @sleep.errors\n end\n end\n end\n \n respond_to do |format|\n flash[:success] = 'Sleep was successfully created.'\n format.html { redirect_to sleeps_path }\n format.json { render :json => sleeps_path, :status => :created, :location => sleeps_path }\n end\n end", "def daily_midnight\n logger.info \" daily_midnight\"\n PersistStatsJob.create({})\n Gift.send_expiration_reminders(5)\n Gift.send_expiration_reminders(3)\n Gift.send_expiration_reminders(1)\n end", "def create\n @calendar_day = CalendarDay.new(calendar_day_params)\n\n respond_to do |format|\n if @calendar_day.save\n format.html { redirect_to @calendar_day, notice: 'Calendar day was successfully created.' }\n format.json { render :show, status: :created, location: @calendar_day }\n else\n format.html { render :new }\n format.json { render json: @calendar_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def daily_requests_for(time = Time.now)\n find_or_create_daily_requests_for(time)\n end", "def day_params\n params.require(:day).permit(:date)\n end", "def create\n @weekday = Weekday.new(params[:weekday])\n\n respond_to do |format|\n if @weekday.save\n format.html { redirect_to @weekday, notice: 'Weekday was successfully created.' }\n format.json { render json: @weekday, status: :created, location: @weekday }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weekday.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_retun_every_set_of_days_of_month\n assertion = Month.august(2006).every!(:monday,:wednesday)\n # verify\n assert assertion.is_a?(Hash)\n # monday assertions\n assert_equal assertion[:monday].size, 4\n assert_equal assertion[:monday], [Date.new(2006,8,7),Date.new(2006,8,14),Date.new(2006,8,21),Date.new(2006,8,28)]\n # wednesday assertions\n assert_equal assertion[:wednesday].size, 5\n assert_equal assertion[:wednesday],\n [Date.new(2006,8,2),Date.new(2006,8,9),Date.new(2006,8,16),Date.new(2006,8,23),Date.new(2006,8,30)]\n end", "def create\n @event_day = EventDay.new(event_day_params)\n @event = Event.find(params[:event_id])\n\n respond_to do |format|\n if @event_day.save\n format.html { redirect_to @event, notice: 'Event day was successfully created.' }\n format.json { render :show, status: :created, location: @event_day }\n else\n format.html { render :new }\n format.json { render json: @event_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_to_JSON\n evaluate_checks = [check_times, check_dates, check_day_of_week]\n evaluate_checks.all?\n end", "def create\n @user_day = UserDay.new(user_day_params)\n\n respond_to do |format|\n if @user_day.save\n format.html { redirect_to @user_day, notice: 'User day was successfully created.' }\n format.json { render :show, status: :created, location: @user_day }\n else\n format.html { render :new }\n format.json { render json: @user_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_days_off\n if params[:company]\n days_off = DayOff.where(\"company = ?\", true)\n redirect = holidays_path(:company => true)\n day_hours = DayHour.first\n day_hours.hours = params[:day_hours]\n day_hours.save!\n else\n days_off = DayOff.where(\"project_id = ?\", session[:actual_project])\n redirect = holidays_path\n ap = actual_project\n ap.hours_day = params[:day_hours]\n ap.save!(:validate => false) #por las dudas le pongo que skip validations, no vaya a ser que de un error\n end\n days_off.each do |day|\n day.off = true\n case day.wday\n when 0: day.off = false unless params[:wday_domingo]\n when 1: day.off = false unless params[:wday_lunes]\n when 2: day.off = false unless params[:wday_martes]\n when 3: day.off = false unless params[:wday_miercoles]\n when 4: day.off = false unless params[:wday_jueves]\n when 5: day.off = false unless params[:wday_viernes]\n when 6: day.off = false unless params[:wday_sabado]\n end\n day.save!\n end\n redirect_to(redirect, :notice => t(\"screens.notice.successfully_created\"))\n end\n\nend", "def sendData\n\t# List of all days\n\t@list_of_days = (1.month.ago.to_date...Date.today).to_a\n\t# New Array for graph\n\t@graph = Array.new\n\t# Set all dates to zero\n\t@list_of_days.each do |k|\n\t\t# Convert to useable date\n\t\tdate = k.to_date\n\t\t# Count all clicks/leads per day, per user\n\t\t@clicks = Click.complete_day(date).where(:user_id => current_user.id).count\n\t\t@leads = Lead.complete_day(date).where(:user_id => current_user.id).count\n\t\t# Add to array per day with clicks\n\t\t@graph << { y: date.strftime(\"%Y-%m-%d\"), click: @clicks, lead: @leads}\n\tend\n\t#Respond to JSON\n\trespond_to do |format|\n\t\tformat.json { render json: @graph }\n\tend\n end", "def create\n @days_since_visit = DaysSinceVisit.new(params[:days_since_visit])\n\n respond_to do |format|\n if @days_since_visit.save\n format.html { redirect_to @days_since_visit, :notice => 'Days since visit was successfully created.' }\n format.json { render :json => @days_since_visit, :status => :created, :location => @days_since_visit }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @days_since_visit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_daily_tests()\n\n Rails.logger.info \"Checking for Daily test runs\"\n\n # get instances of a daily test run\n tests_to_add_to_stack = RecurringSchedule.get_daily_tests()\n setup_scheduled_test(tests_to_add_to_stack)\n end", "def day_put_on_sale\n @day = params[:day]\n @seller = @day.seller\n @url = \"https://chickpeas.herokuapp.com/days\"\n\n seller_parent_ids = @seller.parents.map(&:id)\n # email to all parents other than those posting\n emails = Parent.all_current_with_active_email_except(seller_parent_ids)\n send_mail(to: emails, subject: \"A New Chickpeas Day is Up For Sale\")\n end", "def create\n @workday = Workday.new(workday_params)\n\n respond_to do |format|\n if @workday.save\n format.html { redirect_to dashboard_path, notice: 'Workday was successfully created.' }\n format.json { render :show, status: :created, location: @workday }\n else\n format.html { render :new }\n format.json { render json: @workday.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n number = request.query_parameters.first[1].to_i\n respond_with Event.where(date_time: Date.current..(Date.current + number.days))\n end", "def create\n successful = false\n @leave_day = @user.leave_days.build\n @leave_day.leave_day_type = leave_day_params[:leave_day_type]\n\n @leave_day_dates = params[:leave_day_dates]\n\n dates = params[:leave_day_dates].split(\",\")\n if dates.size == 0\n successful = false\n #TODO add manual validation error 'missing dates'\n end\n begin\n ActiveRecord::Base.transaction do\n for date in dates\n leave_day = @user.leave_days.build\n leave_day.date = date\n leave_day.leave_day_type = leave_day_params[:leave_day_type]\n leave_day.description = leave_day_params[:description]\n begin\n if (!leave_day.save)\n flash[:alert] = I18n.t('controllers.leave_days.could_not_save', date: date)\n break\n end\n rescue ActiveRecord::RecordNotUnique => e\n flash[:alert] = I18n.t('controllers.leave_days.leave_day_already_exists', date: date)\n raise e\n end\n end\n successful = true\n end\n rescue ActiveRecord::RecordNotUnique => e\n logger.error \"Error persisting leave day #{e.message}\"\n end\n\n respond_to do |format|\n if successful\n format.html { redirect_to user_leave_days_path(@user), notice: I18n.t('controllers.leave_days.successfully_created') }\n format.json { render :show, status: :created, location: @leave_day }\n else\n format.html { render :new }\n format.json { render json: @leave_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def day_params\n params.require(:day).permit(:user_id,:date, :task, :completed)\n end", "def day_params\n params.require(:day).permit(:date, :title, :status, :note)\n end", "def create\n @daytime = Daytime.new(params[:daytime])\n\n respond_to do |format|\n if @daytime.save\n format.html { redirect_to @daytime, notice: 'Daytime was successfully created.' }\n format.json { render json: @daytime, status: :created, location: @daytime }\n else\n format.html { render action: \"new\" }\n format.json { render json: @daytime.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @off_day = OffDay.new(off_day_params)\n\n respond_to do |format|\n if @off_day.save\n format.html { redirect_to @off_day, notice: 'Off day was successfully created.' }\n format.json { render :show, status: :created, location: @off_day }\n else\n format.html { render :new }\n format.json { render json: @off_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(params[:plan])\n @plan.user = current_user\n @plan.request = Request.find( params[:request_id] )\n\n respond_to do |format|\n if @plan.save\n @plan.request.days.times do |day|\n @plan.plan_days << PlanDay.create( { plan_id: @plan.id, day: day+1 } )\n end\n\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render json: @plan, status: :created, location: @plan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @week_day = WeekDay.new(week_day_params)\n\n respond_to do |format|\n if @week_day.save\n format.html { redirect_to @week_day, notice: 'Week day was successfully created.' }\n format.json { render :show, status: :created, location: @week_day }\n else\n format.html { render :new }\n format.json { render json: @week_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = current_user\n @work_day = user.work_days.create(params[:work_day]) \n\n respond_to do |format|\n if @work_day.save\n flash[:notice] = 'Giornata di lavoro salvata con successo.'\n format.html { redirect_to action: 'index' }\n format.json { render json: @work_day, status: :created, location: @work_day }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gameday = Gameday.new(gameday_params)\n\n respond_to do |format|\n if @gameday.save\n format.html { redirect_to gamedays_path, notice: 'Gameday was successfully created.' }\n format.json { render :show, status: :created, location: @gameday }\n else\n format.html { render :new }\n format.json { render json: @gameday.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n expire_action :action => [:shadyside, :south_side, :lawrenceville, :oakland, :bloomfield, :strip_district, :downtown]\n @event = current_user.events.build(event_params)\n #@event = Event.new(event_params)\n if @event.day == \"Weekdays\"\n @event.day = \"Monday\"\n @event_tue = current_user.events.build(event_params)\n @event_tue.day = \"Tuesday\"\n @event_wed = current_user.events.build(event_params)\n @event_wed.day = \"Wednesday\"\n @event_thu = current_user.events.build(event_params)\n @event_thu.day = \"Thursday\"\n @event_fri = current_user.events.build(event_params)\n @event_fri.day = \"Friday\"\n\n\n respond_to do |format|\n if @event.save && @event_tue.save && @event_wed.save && @event_thu.save && @event_fri.save\n #EventMailer.sample_email(current_user, @event).deliver\n\n Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now)\n format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n elsif @event.day == \"Everyday\"\n @event.day = \"Monday\"\n @event_tue = current_user.events.build(event_params)\n @event_tue.day = \"Tuesday\"\n @event_wed = current_user.events.build(event_params)\n @event_wed.day = \"Wednesday\"\n @event_thu = current_user.events.build(event_params)\n @event_thu.day = \"Thursday\"\n @event_fri = current_user.events.build(event_params)\n @event_fri.day = \"Friday\"\n @event_sat = current_user.events.build(event_params)\n @event_sat.day = \"Saturday\"\n @event_sun = current_user.events.build(event_params)\n @event_sun.day = \"Sunday\"\n\n\n respond_to do |format|\n if @event.save && @event_tue.save && @event_wed.save && @event_thu.save && @event_fri.save && @event_sat.save && @event_sun.save\n #EventMailer.sample_email(current_user, @event).deliver\n\n Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now)\n format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' }\n format.json { head :no_content }\n format.js { render :layout => false } \n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n elsif @event.day == \"Weekend\"\n @event_sat = current_user.events.build(event_params)\n @event_sat.day = \"Saturday\"\n @event_sun = current_user.events.build(event_params)\n @event_sun.day = \"Sunday\"\n\n respond_to do |format|\n if @event.save && @event_sun.save\n #EventMailer.sample_email(current_user, @event).deliver\n\n Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now)\n format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n if @event.save\n #EventMailer.sample_email(current_user, @event).deliver\n\n Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now)\n format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def destroy\n @everyday.destroy\n respond_to do |format|\n format.html { redirect_to everydays_url, notice: 'Everyday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def today_events\n @dayly_by_date = current_student.user_events.group_by { |event| event.date.to_date }\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end", "def daily_forecast(location)\n id = location_id[location.downcase.to_sym]\n puts id\n# Maybe call it weather_update to call at 00:01 every day, needs to iterate over each location\n url = \"http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/#{id}?res=3hourly&key=0da4e1ea-8681-47bc-a5f9-5ab535ff75f2\"\n resp = Net::HTTP.get_response(URI.parse(url))\n data = resp.body\n result = JSON.parse(data)\n tomorrow = result[\"SiteRep\"][\"DV\"][\"Location\"][\"Period\"][1][\"Rep\"]\n\n @temp_tomorrow=[]\n tomorrow.each do |f|\n @temp_tomorrow << f[\"F\"].to_i\n end\n @cloud_tomorrow=[]\n tomorrow.each do |f|\n @cloud_tomorrow << f[\"V\"].to_i\n end\n @rain_tomorrow=[]\n tomorrow.each do |f|\n @rain_tomorrow << f[\"Pp\"].to_i\n end\n @wind_tomorrow=[]\n tomorrow.each do |f|\n @wind_tomorrow << f[\"S\"].to_i\n end\n\n tomorrow = WeatherData.new \n tomorrow.date = [Date.today.next_day.year, Date.today.next_day.month, Date.today.next_day.day]\n tomorrow.location = location\n tomorrow.temperature = @temp_tomorrow\n tomorrow.rainfall = @rain_tomorrow\n tomorrow.wind = @wind_tomorrow\n tomorrow.cloud = @cloud_tomorrow\n tomorrow.save\nend", "def schedule_day_params\n params.require(:schedule_day).permit(:schedule_week_id, :available_24_hours, :range_begin, :range_end, :date)\n end", "def update\n if @day.update(update_params)\n render json: @day, include: [:activities]\n else \n render json: @day.errors\n end\n end", "def create\n \t@conference = Conference.find(params[:conference_id])\n @day = @conference.days.new(params[:day])\n\n respond_to do |format|\n if @day.save\n format.html { redirect_to(conference_days_url, :notice => 'Day was successfully created.') }\n format.xml { render :xml => @day, :status => :created, :location => @day }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @day.errors, :status => :unprocessable_entity }\n end\n end\n end", "def daily_morning\n logger.info \" daily_morning\"\n run('Newsletter', :send!)\n end", "def visits_by_day\n render json: Ahoy::Visit.this_month.group_by_day(:started_at).count\n end", "def create\n @user_day = UserDay.new(params[:user_day])\n\n today = Date.today\n #TODO this should be a selected year\n holiday_year = HolidayYear.where('date_start<=? and date_end>=?', today, today).first\n @user_day.holiday_year = holiday_year\n\n @allowance = @user_day.user.get_holiday_allowance\n @allowance.days_remaining += @user_day.no_days\n\n respond_to do |format|\n if @user_day.save and @allowance.save\n format.js\n else\n format.js\n end\n end\n end", "def conferences_schedule terms={}\n call_path = \"conferences/schedule\"\n data = build_post_data(terms.to_json)\n perform_post(build_url(call_path), data)\n end", "def create\n @schedule = Schedule.new(params[:schedule])\n times =[]\n count_days = 0\n days = params[:day].join(\", \") if params[:day]\n (0..6).each do |i|\n if params[:hour][i].present? && params[:minute][i].present?\n times<< \"#{params[:hour][i]}:#{ params[:minute][i]}\"\n end\n end\n\n count_days = params[:day].count if params[:day]\n count_times = times.count\n\n if count_days == count_times\n\n if count_days && count_times != 0\n times = times.join(\", \")\n @schedule.day = days\n @schedule.time = times\n end\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n\n else\n #redirect_to new_schedule_path, notice: \"даныне введены некорректно (день-время)\"\n render action: \"new\"\n end\n end", "def day_params\n params.require(:day).permit(:gift, :thing, :daily, :effort, :improvement)\n end", "def create\n @dayoff = Dayoff.new(params[:dayoff])\n\n respond_to do |format|\n if @dayoff.save\n format.html { redirect_to @dayoff, notice: 'Dayoff was successfully created.' }\n format.json { render json: @dayoff, status: :created, location: @dayoff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dayoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end", "def submit_events_api_call(date, begin_time, end_time, location, itinerary)\n preferences_request = current_user.supplemental_preferences\n designated_preference = preferences_request.sample\n category_request = designated_preference.events_categories.sample\n start_date_time = user_input_to_unix(date, begin_time)\n end_date_time = user_input_to_unix(date, end_time)\n y = YelpResponse.new\n response = y.get_events_response({location: location, categories: category_request, start_date: start_date_time, end_date: end_date_time})\n handle_events_response(response, y, itinerary)\n y.destroy\n end", "def new_service_regular_schedules(service_id, regular_schedule_data)\n # @TODO theres nothing stopping silly opening hours being put in here\n days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday','sunday']\n if regular_schedule_data['scheduled_weekday'].present?\n weekday = days.find_index(regular_schedule_data['scheduled_weekday'].downcase)\n end\n\n if regular_schedule_data['schedules_opens_at'].to_time.present? && regular_schedule_data['schedules_closes_at'].to_time.present? && !weekday.nil?\n new_regular_schedule = RegularSchedule.new(\n opens_at: regular_schedule_data['schedules_opens_at'].to_time,\n closes_at: regular_schedule_data['schedules_closes_at'].to_time,\n weekday: weekday+1,\n service_id: service_id\n )\n if new_regular_schedule.save\n puts \" 🟢 Regular schedule: created (id: #{new_regular_schedule.id}).\"\n else \n abort(\" 🔴 Regular schedule: was not created. Exiting. #{new_regular_schedule.errors.messages}\")\n end\n\n else \n puts \" 👉 Regular schedule: wonky hours.\"\n end \n end", "def visits_by_day\n render json: Visit.group_by_day(:visited_at, format: \"%B %d, %Y\").count\n end", "def calendar_day_params\n params.require(:calendar_day).permit(:date, :notes)\n end", "def index\n @forecasts = Forecast.all\n @days = @forecasts.order(\"created_at desc\").pluck(:date).uniq\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end", "def query_by_date\n # find the wdays of the trip\n dates = dates_to_wdays(\n Date.parse(params[:from]),\n Date.parse(params[:to])\n )\n\n # find schedules that fit the wdays of the trip\n schedules = Schedule.where.overlap(wdays: dates)\n\n respond_with TripsBySchedulePresenter.new(schedules).as_json\n end", "def index\n if params[:date]\n redirect_date(params[:date])\n else\n @school_days = SchoolDay.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_days }\n end\n end\n end", "def create\n current_account.parties.create(params[:parties].values)\n @date = params[:parties].values.first[:created_at].to_time\n @parties = current_account.parties.by_month(@date.month, :year => @date.year)\n @daily = @parties.select{|p| p.created_at.to_date == @date.to_date}.group_by(&:game)\n @count = @parties.size\n find_yours(@parties)\n @games = compute_monthly_played(@parties, @date.beginning_of_month)\n respond_to do |format|\n format.js\n end\n end", "def create\n @cycle = Cycle.new(cycle_params)\n @cycle.user_id = current_user.id\n\n respond_to do |format|\n if @cycle.save\n @cycle.populate_days\n format.html { redirect_to cycle_days_path(@cycle), notice: 'Cycle was successfully created.' }\n format.json { render :show, status: :created, location: @cycle }\n else\n format.html { render :new }\n format.json { render json: @cycle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @group = Group.find(params[:group_id])\r\n\r\n if @group.update_attributes(classdays_params)\r\n @group.generate_calendar!\r\n render json: @group.classdays, status: :created\r\n else\r\n render json: @group.errors, status: :unprocessable_entity\r\n end\r\n end", "def days\n @trainings = Training.all\n @activities = Activity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trainings }\n end\n end", "def create\n @daily_happiness = DailyHappiness.new(daily_happiness_params)\n\n respond_to do |format|\n if @daily_happiness.save\n format.html { redirect_to @daily_happiness, notice: 'Daily happiness was successfully created.' }\n format.json { render :show, status: :created, location: @daily_happiness }\n else\n format.html { render :new }\n format.json { render json: @daily_happiness.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @entry = Entry.new(entry_params)\n\n respond_to do |format|\n\n if @entry.save\n format.html { redirect_to entries_path, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n @today_entries = Entry.where(\"date = ?\", Date.today)\n @yesterday_entries = Entry.where(\"date = ?\", Date.yesterday)\n format.html { render :action => :index }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @monday = Monday.new(monday_params)\n\n respond_to do |format|\n if @monday.save\n format.html { redirect_to @monday, notice: 'Monday was successfully created.' }\n format.json { render :show, status: :created, location: @monday }\n else\n format.html { render :new }\n format.json { render json: @monday.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @elective_day = ElectiveDay.new(elective_day_params)\n\n respond_to do |format|\n if @elective_day.save\n format.html { redirect_to elective_days_url }\n #format.html { redirect_to 'index', notice: 'Elective day was successfully created.' }\n format.json { render action: 'index', status: :created, location: @elective_day }\n else\n format.html { render action: 'new' }\n format.json { render json: @elective_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def expiration_set(days)\n payload = {\n 'expiration_days' => days\n }\n @conn.put('/api/v1/backup-expiration/', payload.to_json)\n end", "def calculate_meetings\n @semester = Semester.find_by_id params[:semester_id]\n return unless semester_is_valid(@semester)\n class_meetings = 0\n class_meetings_hash = @semester.specific_days_in_semester\n params.each do |d, value|\n day_of_week = d.to_i\n if value != \"checked\"; next; end\n if ((1 <= day_of_week) and (day_of_week <= 7))\n class_meetings += class_meetings_hash[day_of_week]\n end\n end\n\n @calculate_meetings = class_meetings.to_json\n render :text => @calculate_meetings\n end", "def clicks_by_day(input, options={})\n options.reject! { |k, v| k.to_s != 'days' }\n get_method(:clicks_by_day, input, options)\n end", "def index\n if params[:all]\n @today = Time.now.strftime(\"%A\")\n @yoga_sessions = YogaSession.all\n elsif params[:day]\n @today = params[:day].capitalize\n @yoga_sessions = YogaSession.on_day params[:day]\n else\n @today = \"Today\"\n @yoga_sessions = YogaSession.today.remaining\n end \n respond_with @yoga_sessions\n end", "def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end", "def create\n data = reload(get_series('foods'), str(Date.strptime(params[:food].values.join(\"-\"))))\n saved = false\n get_series('foods').each do |s|\n #puts \"Updating series=#{s}\"\n data[s].each do |day|\n @food = for_date(day['dateTime'])\n @food.send(s.rpartition('/')[2] + '=', day['value'])\n\n # update from collection too\n logged_food = reload_range(['foods/log'], day['dateTime'], nil)\n # TODO refactor this into a lood instead of separate IFs\n if logged_food['summary']['carbs'].nil?\n @food.carbs = 0\n else\n @food.carbs = logged_food['summary']['carbs'].floor\n end\n if logged_food['summary']['protein'].nil?\n @food.protein = 0\n else\n @food.protein = logged_food['summary']['protein'].floor\n end\n if logged_food['summary']['fat'].nil?\n @food.fat = 0\n else\n @food.fat = logged_food['summary']['fat'].floor\n end\n if logged_food['summary']['fiber'].nil?\n @food.fiber = 0\n else\n @food.fiber = logged_food['summary']['fiber'].floor\n end\n if @food.caloriesIn.nil?\n @food.caloriesIn = 0\n end\n if @food.water.nil?\n @food.water = 0\n end\n\n saved = @food.save\n if not saved\n flash[:error] = @food.errors\n end\n end\n end\n\n respond_to do |format|\n flash[:success] = 'Food was successfully created.'\n format.html { redirect_to @food }\n format.json { render json: @food, status: :created, location: @food }\n end\n end", "def create\n @day_of_week = DayOfWeek.new(day_of_week_params)\n\n respond_to do |format|\n if @day_of_week.save\n format.html { redirect_to @day_of_week, notice: 'Day of week was successfully created.' }\n format.json { render :show, status: :created, location: @day_of_week }\n else\n format.html { render :new }\n format.json { render json: @day_of_week.errors, status: :unprocessable_entity }\n end\n end\n end", "def day_params\n params.require(:day).permit(:start_time, :user_id, :meals)\n end", "def add_event\n id = params[:id].to_i\n from = Time.parse(params[:from])\n to = from + 1.day\n to = Time.parse(params[:to]) if params[:to]\n \n obj = nil\n if params[:type] == \"event\"\n obj = current_itinerary.add_event(id, from, to) \n elsif params[:type] == \"attraction\"\n obj = current_itinerary.add_attraction(id, from, to)\n elsif params[:type] == \"meal\"\n obj = current_itinerary.add_meal(id, from, to)\n elsif params[:type] == \"transportation\"\n obj = current_itinerary.add_transportation(id, from, to)\n end\n\n render :json => {\n :status => 0,\n :obj => obj\n }\n end", "def create\n data = reload(get_series('activities'), str(Date.strptime(params[:activity].values.join(\"-\"))))\n saved = false\n get_series('activities').each do |s|\n puts \"Updating series=#{s}\"\n data[s].each do |day|\n @activity = for_date(day['dateTime'])\n @activity.send(s.partition('/')[2] + '=', day['value'])\n saved = @activity.save\n if not saved\n flash[:error] = @activity.errors\n end\n end\n end\n\n respond_to do |format|\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to @activity }\n format.json { render json: @activity, status: :created, location: @activity }\n end\n end", "def index\r\n @classdays = Classday.all\r\n\r\n render json: @classdays\r\n end", "def get(days,start_cep,end_cep)\n self.class.get(\"/api/v1/quote/available_scheduling_dates/#{days}/#{start_cep}/#{end_cep}\")\n end", "def recurrence_to_events!(now = Time.now.utc)\n recurring.each {|r| r.recurrence_to_events!(now)}\n end" ]
[ "0.60896844", "0.59003717", "0.58973724", "0.57750404", "0.57136077", "0.5689553", "0.56647605", "0.5659476", "0.5605483", "0.54992175", "0.5485113", "0.5469261", "0.54659045", "0.54556376", "0.5435531", "0.54342586", "0.5425583", "0.54221326", "0.5417237", "0.540463", "0.540463", "0.5394732", "0.53941554", "0.53782576", "0.53695476", "0.5325737", "0.532416", "0.5314232", "0.53123724", "0.52912813", "0.5275603", "0.5251932", "0.52515984", "0.5240452", "0.52378994", "0.5230441", "0.5215837", "0.52016544", "0.519668", "0.5193692", "0.5193618", "0.51857907", "0.51722956", "0.51560104", "0.5150641", "0.5141786", "0.513629", "0.51313186", "0.5116935", "0.5116216", "0.5112454", "0.5102121", "0.5101836", "0.5100249", "0.5094799", "0.50863254", "0.5082897", "0.507982", "0.50750154", "0.50723857", "0.50695753", "0.50679296", "0.50492847", "0.50470835", "0.50431126", "0.50414586", "0.5037224", "0.503582", "0.50236285", "0.5018785", "0.5016844", "0.5014499", "0.5011002", "0.5008493", "0.4997273", "0.4996791", "0.49966434", "0.49947545", "0.49926725", "0.49860245", "0.49839363", "0.49799585", "0.4977451", "0.49762025", "0.49658573", "0.49618116", "0.49585602", "0.49565923", "0.49525416", "0.49500245", "0.4949968", "0.49413246", "0.49368083", "0.4934831", "0.49346754", "0.49317017", "0.4926948", "0.49215823", "0.49181107", "0.4914599" ]
0.6630837
0
PATCH/PUT /everydays/1 PATCH/PUT /everydays/1.json
def update respond_to do |format| if @everyday.update(everyday_params) format.html { redirect_to :back, notice: 'Everyday was successfully updated.' } format.json { render :show, status: :ok, location: :back } else format.html { render :edit } format.json { render json: @everyday.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @day.update(update_params)\n render json: @day, include: [:activities]\n else \n render json: @day.errors\n end\n end", "def set_everyday\n @everyday = Everyday.find(params[:id])\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n @task.whenever_reset unless task_params[:every].blank? && task_params[:at].blank?\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @daily_recurrence = args[:daily_recurrence] if args.key?(:daily_recurrence)\n @every = args[:every] if args.key?(:every)\n @monthly_recurrence = args[:monthly_recurrence] if args.key?(:monthly_recurrence)\n @recurrence_end_date = args[:recurrence_end_date] if args.key?(:recurrence_end_date)\n @recurrence_start = args[:recurrence_start] if args.key?(:recurrence_start)\n @repeat_count = args[:repeat_count] if args.key?(:repeat_count)\n @repeat_forever = args[:repeat_forever] if args.key?(:repeat_forever)\n @single_recurrence = args[:single_recurrence] if args.key?(:single_recurrence)\n @weekly_recurrence = args[:weekly_recurrence] if args.key?(:weekly_recurrence)\n @yearly_recurrence = args[:yearly_recurrence] if args.key?(:yearly_recurrence)\n end", "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n offset = -1\n @trip.days.all.each do |day|\n offset += 1\n day.update_attribute(:date, @trip.beginning + offset)\n end\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @day.update(day_params)\n format.html { redirect_to days_path, notice: 'Day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @monthly_day_recurrence = args[:monthly_day_recurrence] if args.key?(:monthly_day_recurrence)\n @monthly_weekday_recurrence = args[:monthly_weekday_recurrence] if args.key?(:monthly_weekday_recurrence)\n end", "def update\n @day = Day.find(params[:id])\n\n respond_to do |format|\n if @day.update_attributes(params[:day])\n format.html { redirect_to @day, notice: 'Day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @day.update(day_params)\n format.html { redirect_to @day, notice: 'Day was successfully updated.' }\n format.json { render :show, status: :ok, location: @day }\n else\n format.html { render :edit }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @all_day = args[:all_day] if args.key?(:all_day)\n @timed = args[:timed] if args.key?(:timed)\n end", "def update\n # Protect from non-admin access\n admin_only do\n params[:weeklyday] = nil if params[:weeklyday] = ''\n @test = RecurringSchedule.find(params[:id])\n if @test.update(schedule_params)\n log_action('Update', current_user ? current_user.username : 'Anonymous', params[:id], 'RecurringSchedule')\n if params[:weeklyday].nil?\n @test.reload\n @test.weeklyday = nil\n @test.save\n end\n redirect_to action: \"show\", id: @test.id\n else\n render 'edit'\n end\n end\n end", "def update\n respond_to do |format|\n if @event_day.update(event_day_params)\n format.html { redirect_to events_path, notice: 'Event day was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_day }\n else\n format.html { render :edit }\n format.json { render json: @event_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @weekday = Weekday.find(params[:id])\n\n respond_to do |format|\n if @weekday.update_attributes(params[:weekday])\n format.html { redirect_to @weekday, notice: 'Weekday was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weekday.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @off_day.update(off_day_params)\n format.html { redirect_to @off_day, notice: 'Off day was successfully updated.' }\n format.json { render :show, status: :ok, location: @off_day }\n else\n format.html { render :edit }\n format.json { render json: @off_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @batch_day.update(batch_day_params)\n format.html { redirect_to @batch_day, notice: 'Batch day was successfully updated.' }\n format.json { render :show, status: :ok, location: @batch_day }\n else\n format.html { render :edit }\n format.json { render json: @batch_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @dayopen = args[:dayopen] if args.key?(:dayopen)\n @interval = args[:interval] if args.key?(:interval)\n end", "def daily_update\n\t\t\tcurrent_user.investment_account.daily_update\n\t\t\trender json: current_user, status: 200\n\t\tend", "def update\n respond_to do |format|\n if @calendar_day.update(calendar_day_params)\n format.html { redirect_to @calendar_day, notice: 'Calendar day was successfully updated.' }\n format.json { render :show, status: :ok, location: @calendar_day }\n else\n format.html { render :edit }\n format.json { render json: @calendar_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_calendar(opts = {})\n update_calendar(opts)\n end", "def update!(**args)\n @day_period = args[:day_period] if args.key?(:day_period)\n @time_of_day = args[:time_of_day] if args.key?(:time_of_day)\n end", "def update\n respond_to do |format|\n if @spec_day.update(spec_day_params)\n format.html { redirect_to spec_days_path, notice: '更新成功!' }\n format.json { render :show, status: :ok, location: @spec_day }\n else\n flash.now[:alert] = @spec_day.errors.full_messages\n format.html { render :edit }\n format.json { render json: @spec_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @new_day.update(new_day_params)\n format.html { render text: '已经把反馈传给用户了,谢谢您' }\n format.json { render :show, status: :ok, location: @new_day }\n else\n format.html { render :edit }\n format.json { render json: @new_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n params[:appointment]['scheduled_at(5i)'] = '0'\n\n @appointment.scheduled_at = DateTime.new(params[:appointment]['scheduled_at(1i)'].to_i,\n params[:appointment]['scheduled_at(2i)'].to_i,\n params[:appointment]['scheduled_at(3i)'].to_i,\n params[:appointment]['scheduled_at(4i)'].to_i,\n params[:appointment]['scheduled_at(5i)'].to_i, 0)\n\n check_for_errors if params[:staff_ids].present?\n\n if @appointment.errors.present?\n render :json => {:success => false, :html => render_to_string(:partial => \"/appointments/errors\")}.to_json\n else\n if @appointment.update(appointment_params)\n create_appointment_users if params[:staff_ids].present?\n flash[:notice]= 'Appointment was successfully updated.'\n render :json => {:success => true,\n :html => render_to_string(:partial => \"/appointments/calandar\"),\n :flash => render_to_string(:partial => \"layouts/flash\")}.to_json\n else\n render :json => {:success => false, :html => render_to_string(:partial => \"/appointments/errors\")}.to_json\n end\n end\n\n end", "def update\n @dayoff = Dayoff.find(params[:id])\n\n respond_to do |format|\n if @dayoff.update_attributes(params[:dayoff])\n format.html { redirect_to @dayoff, notice: 'Dayoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dayoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @elective_day.update(elective_day_params)\n format.html { redirect_to 'index', notice: 'Elective day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @elective_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n attendance_params[:checkout] = DateTime.parse(attendance_params[:checkout]) if attendance_params[:checkout].present?\n attendance_params[:attendance_date] = attendance_params[:attendance_date].to_date if attendance_params[:attendance_date].present?\n\n r = @api.update_attendance(params[:id], attendance_params)\n respond_to do |format|\n if r.code == 204\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully updated.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n \n end", "def update\n status_key = STATUS[rand(STATUS.length)]\n\n n = Spooge.update_all_on_redis(:touch_date, DateTime.now)\n n = Spooge.update_all_on_redis(:status, status_key)\n resp = {:updated => n, :status_key => status_key}\n render :json => resp\n end", "def update_calendar(opts = {})\n end", "def update\n respond_to do |format|\n data = schedule_params\n data[:update_at] = Time.now\n if @schedule.update(data)\n format.html { redirect_to @schedule, notice: 'Schedule ha sido actualizado.' }\n format.json { render :index, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @calendar_day = args[:calendar_day] if args.key?(:calendar_day)\n @grace_period_end = args[:grace_period_end] if args.key?(:grace_period_end)\n @grace_period_start = args[:grace_period_start] if args.key?(:grace_period_start)\n @grace_period_type = args[:grace_period_type] if args.key?(:grace_period_type)\n @manual_grace_period_info = args[:manual_grace_period_info] if args.key?(:manual_grace_period_info)\n end", "def update!(**args)\n @open_now = args[:open_now] if args.key?(:open_now)\n @periods = args[:periods] if args.key?(:periods)\n @secondary_hours_type = args[:secondary_hours_type] if args.key?(:secondary_hours_type)\n @special_days = args[:special_days] if args.key?(:special_days)\n @weekday_descriptions = args[:weekday_descriptions] if args.key?(:weekday_descriptions)\n end", "def update\n @shift = Shift.find(params[:id])\n\n respond_to do |format|\n if @shift.update_attributes(params[:shift])\n @shift.day = params[:day]\n\n format.html { redirect_to shifts_path, notice: 'Shift was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @calendar = Calendar.find(params[:id])\n params[:calendar][:entry_date] = change_date_format(params[:calendar][:entry_date]) if !(params[:calendar][:entry_date]).blank?\n respond_to do |format|\n if @calendar.update_attributes(params[:calendar])\n format.html { redirect_to calendars_url, notice: 'Calendar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n get_day = check_task_day(params[:task][:task_day])\n respond_to do |format|\n if @task.update(task_name: params[:task][:task_name], task_description: params[:task][:task_description], task_priority: params[:task][:task_priority], task_day: get_day, task_color: params[:task_color] )\n @tasks = current_user.tasks.where(task_day: get_day)\n format.js { render 'tasks/task_update' }\n else\n redirect_to root_path\n end\n end\n end", "def update\n @timesheet = Timesheet.find(params[:id])\n @date = Date.parse params[:timesheet][:day]\n\n respond_to do |format|\n if @timesheet.update_attributes(params[:timesheet])\n format.html { redirect_to timesheets_month_path(:y => @date.year, :m => @date.month) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @daily_happiness.update(daily_happiness_params)\n format.html { redirect_to @daily_happiness, notice: 'Daily happiness was successfully updated.' }\n format.json { render :show, status: :ok, location: @daily_happiness }\n else\n format.html { render :edit }\n format.json { render json: @daily_happiness.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @workday.update(workday_params)\n format.html { redirect_to dashboard_path, notice: 'Workday was successfully updated.' }\n format.json { render :show, status: :ok, location: @workday }\n else\n format.html { render :edit }\n format.json { render json: @workday.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!(**args)\n @open_now = args[:open_now] if args.key?(:open_now)\n @periods = args[:periods] if args.key?(:periods)\n @weekday_texts = args[:weekday_texts] if args.key?(:weekday_texts)\n end", "def update\n respond_to do |format|\n if @daily_intake.update(daily_intake_params)\n format.html { redirect_to @daily_intake, notice: 'Daily intake was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @daily_intake.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @daytime = Daytime.find(params[:id])\n\n respond_to do |format|\n if @daytime.update_attributes(params[:daytime])\n format.html { redirect_to @daytime, notice: 'Daytime was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daytime.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @schedule = Schedule.find(params[:id])\n\n if @schedule.update(params[:schedule])\n head :no_content\n else\n render json: @schedule.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @theory_day.update(theory_day_params)\n format.html { redirect_to @theory_day, notice: 'Theory day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @theory_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @day.update(day_params)\n format.html { redirect_to @day, notice: 'Day was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @the_day = TheDay.find(params[:id])\n\n respond_to do |format|\n if @the_day.update_attributes(params[:the_day])\n format.html { redirect_to(@the_day, :notice => 'The day was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @the_day.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @day.update(meals: params[:meals])\n #respond_to do |format|\n #if @day.update(day_params)\n #format.html { redirect_to @day, notice: 'Day was successfully updated.' }\n #format.json { render :show, status: :ok, location: @day }\n #else\n #format.html { render :edit }\n #format.json { render json: @day.errors, status: :unprocessable_entity }\n #end\n #end\n end", "def update\n respond_to do |format|\n if @admin_cron_request.update(admin_cron_request_params)\n format.html { redirect_to @admin_cron_request, notice: I18n.t('admin.cron_requests.update.message.success') }\n format.json { render :show, status: :ok, location: @admin_cron_request }\n else\n format.html { render :edit }\n format.json { render json: @admin_cron_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n if @calendar.update_attributes(params[:calendar])\n format.html { redirect_to @calendar, :notice => 'Calendar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @daily_pattern = args[:daily_pattern] if args.key?(:daily_pattern)\n @eval_data = args[:eval_data] if args.key?(:eval_data)\n @every = args[:every] if args.key?(:every)\n @frequency = args[:frequency] if args.key?(:frequency)\n @monthly_pattern = args[:monthly_pattern] if args.key?(:monthly_pattern)\n @num_instances_in_frequency = args[:num_instances_in_frequency] if args.key?(:num_instances_in_frequency)\n @recurrence_end = args[:recurrence_end] if args.key?(:recurrence_end)\n @recurrence_start = args[:recurrence_start] if args.key?(:recurrence_start)\n @time = args[:time] if args.key?(:time)\n @weekly_pattern = args[:weekly_pattern] if args.key?(:weekly_pattern)\n @yearly_pattern = args[:yearly_pattern] if args.key?(:yearly_pattern)\n end", "def update\n respond_to do |format|\n if @monday.update(monday_params)\n format.html { redirect_to @monday, notice: 'Monday was successfully updated.' }\n format.json { render :show, status: :ok, location: @monday }\n else\n format.html { render :edit }\n format.json { render json: @monday.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @oncourse_exercise.update(oncourse_exercise_params)\n@tti_date = @oncourse_exercise.date + @oncourse_exercise.tti_days \n@oncourse_exercise.update(:tti_date => @tti_date)\n format.html { redirect_to @oncourse_exercise, notice: 'Oncourse exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @oncourse_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sunday.update(sunday_params)\n format.html { redirect_to @sunday, notice: 'Sunday was successfully updated.' }\n format.json { render :show, status: :ok, location: @sunday }\n else\n format.html { render :edit }\n format.json { render json: @sunday.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if !params[:program_cycle][:starts_on].nil? && params[:program_cycle][:starts_on] != \"\"\n params[:program_cycle][:starts_on] = Date.strptime(program_cycle_params[:starts_on], \"%m/%d/%Y\")\n end\n \n if !params[:program_cycle][:ends_on].nil? && params[:program_cycle][:ends_on] != \"\"\n params[:program_cycle][:ends_on] = Date.strptime(program_cycle_params[:ends_on], \"%m/%d/%Y\")\n end\n respond_to do |format|\n if @program_cycle.update(program_cycle_params)\n format.html { redirect_to @program_cycle, notice: 'Program cycle was successfully updated.' }\n format.json { render :show, status: :ok, location: @program_cycle }\n format.js {render :js => \"window.location.reload();\"}\n else\n format.html { render :edit }\n format.json { render json: @program_cycle.errors, status: :unprocessable_entity }\n format.js {render 'edit'} \n end\n end\n end", "def update\n respond_to do |format|\n if @meal_schedule.update(meal_schedule_params)\n format.html { redirect_to meal_schedules_path, notice: 'MealSchedule was updated successfully' }\n format.json { render :show, status: :ok, location: meal_schedules_path }\n else\n format.html { render :edit }\n format.json { render json: @meal_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @periodic.update(periodic_params)\n format.html { redirect_to @periodic, notice: 'Periodic was successfully updated.' }\n format.json { render :show, status: :ok, location: @periodic }\n else\n format.html { render :edit }\n format.json { render json: @periodic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @workday = Workday.find(params[:id])\n respond_to do |format|\n if @workday.update_attributes(params[:workday])\n format.html { redirect_to(@workday, :notice => 'Workday was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @workday.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t respond_to do |format|\n\t\t\tparams[:timetable].each do |day, hours|\n\t\t\t\texisting = Timetable.first :conditions => {\n\t\t\t\t\t\t:employer_id => selected_employer_id,\n\t\t\t\t\t\t:user_id => current_user.id,\n\t\t\t\t :day => day\n\t\t\t\t}\n\n\t\t\t\tif (existing) then\n\t\t\t\t\tsuccess = existing.update :hours => hours unless hours.empty?\n\t\t\t\t\tsuccess = existing.delete if hours.empty?\n\t\t\t\telsif not hours.empty? then\n\t\t\t\t\tt = Timetable.new :employer_id => selected_employer_id,\n\t\t\t\t\t\t:user_id => current_user.id, :day => day, :hours => hours\n\t\t\t\t\tsuccess = t.save\n\t\t\t else\n\t\t\t\t\tsuccess = true\n\t\t\t\tend\n\n\t\t\t\tunless success then\n\t\t\t\t\tformat.html { render action: 'show', error: sprintf(\"%s has wrong format.\", I18n.t('date.day_names')[day]) }\n\t\t\t\t\tformat.json { render json: sprintf(\"%s has wrong format.\", I18n.t('date.day_names')[day]), status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\t\tformat.html { redirect_to timetable_path, notice: 'Timetable was successfully updated.' }\n\t\t\tformat.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @important_date.update(important_date_params)\n format.html { redirect_to @important_date, notice: 'Important date was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @important_date.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work_day.update(work_day_params)\n format.html { redirect_to @work_day, notice: 'Work day was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_day }\n else\n format.html { render :edit }\n format.json { render json: @work_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n price_schedule_params[:basis] = price_schedule_params[:basis].to_i\n price_schedule_params[:break_type] = price_schedule_params[:break_type].to_i\n price_schedule_params[:qualifier] = price_schedule_params[:qualifier].to_i\n price_schedule_params[:fee_calculation_type] = price_schedule_params[:fee_calculation_type].to_i\n price_schedule_params[:usual_customary_calculation] = price_schedule_params[:usual_customary_calculation].to_i\n price_schedule_params[:customer_assigned_schedule] = price_schedule_params[:customer_assigned_schedule].to_i\n price_schedule_params[:percentage_fee_type] = price_schedule_params[:percentage_fee_type].to_i\n price_schedule_params[:amount_fee_type] = price_schedule_params[:amount_fee_type].to_i\n\n respond_to do |format|\n if @price_schedule.update(price_schedule_params)\n format.html { redirect_to @price_schedule, notice: 'Price Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @price_schedule }\n else\n format.html { render :edit }\n format.json { render json: @price_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n respond_to do |format|\n if @my_schedule.update(my_schedule_params)\n format.html { redirect_to @my_schedule, notice: 'My schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_schedule }\n else\n format.html { render :edit }\n format.json { render json: @my_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @calendar = Calendar.find(params[:id])\n\n respond_to do |format|\n if @calendar.update_attributes(params[:calendar])\n format.html { redirect_to @calendar, notice: 'Calendar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calendar.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 update\n @schedule = Schedule.find(params[:id])\n\n times =[]\n count_days = 0\n days = params[:day].join(\", \") if params[:day]\n\n (0..6).each do |i|\n if params[:hour][i].present? && params[:minute][i].present?\n times<< \"#{params[:hour][i]}:#{ params[:minute][i]}\"\n end\n end\n\n count_days = params[:day].count if params[:day]\n count_times = times.count\n\n if count_days == count_times\n\n if count_days && count_times != 0\n times = times.join(\", \")\n @schedule.day = days\n @schedule.time = times\n end\n\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n else\n render action: \"edit\"\n end\n\n end", "def update!(**args)\n @day = args[:day] if args.key?(:day)\n @time = args[:time] if args.key?(:time)\n end", "def update\n params[:thing][:time] = @thing.time + params[:thing][:time].to_f if @thing.time\n\n respond_to do |format|\n if @thing.update(thing_params)\n format.html { redirect_to things_url, notice: 'The thing was updated.' }\n format.json { render :show, status: :ok, location: @thing }\n\n # Realtime push\n message = {:channel => '/things', :data => { :name => @thing.name, :time => @thing.time}}\n uri = URI.parse(\"http://localhost:9292/faye\")\n Net::HTTP.post_form(uri, :message => message.to_json)\n else\n format.html { render :edit }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @date_request.update(date_request_params)\n format.html { redirect_to @date_request, notice: \"Date request was successfully updated.\" }\n format.json { render :show, status: :ok, location: @date_request }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @date_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_day.update(user_day_params)\n format.html { redirect_to @user_day, notice: 'User day was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_day }\n else\n format.html { render :edit }\n format.json { render json: @user_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(date)\n remove date\n Calendar.create_new_events if all.count <= 1\n end", "def update\n respond_to do |format|\n if @weekly_schedule.update(weekly_schedule_params)\n format.html { redirect_to @weekly_schedule, notice: 'Weekly schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @weekly_schedule }\n else\n format.html { render :edit }\n format.json { render json: @weekly_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @commission_day = CommissionDay.find(params[:id])\n\n respond_to do |format|\n if @commission_day.update_attributes(params[:commission_day])\n format.html { redirect_to(@commission_day, :notice => 'CommissionDay was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @commission_day.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @days_since_visit = DaysSinceVisit.find(params[:id])\n\n respond_to do |format|\n if @days_since_visit.update_attributes(params[:days_since_visit])\n format.html { redirect_to @days_since_visit, :notice => 'Days since visit was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @days_since_visit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @allow_personal = args[:allow_personal] if args.key?(:allow_personal)\n @day = args[:day] if args.key?(:day)\n @deleted11 = args[:deleted11] if args.key?(:deleted11)\n @holiday = args[:holiday] if args.key?(:holiday)\n @hour = args[:hour] if args.key?(:hour)\n @hour_state = args[:hour_state] if args.key?(:hour_state)\n @is_bc = args[:is_bc] if args.key?(:is_bc)\n @meridiem = args[:meridiem] if args.key?(:meridiem)\n @minute = args[:minute] if args.key?(:minute)\n @modifier = args[:modifier] if args.key?(:modifier)\n @month = args[:month] if args.key?(:month)\n @non_gregorian_date = args[:non_gregorian_date] if args.key?(:non_gregorian_date)\n @partial_second = args[:partial_second] if args.key?(:partial_second)\n @properties = args[:properties] if args.key?(:properties)\n @quarter = args[:quarter] if args.key?(:quarter)\n @range_modifier = args[:range_modifier] if args.key?(:range_modifier)\n @season = args[:season] if args.key?(:season)\n @second = args[:second] if args.key?(:second)\n @timezone = args[:timezone] if args.key?(:timezone)\n @weekday = args[:weekday] if args.key?(:weekday)\n @year = args[:year] if args.key?(:year)\n end", "def update\n @bday = Bday.find(params[:id])\n\n respond_to do |format|\n if @bday.update_attributes(params[:bday])\n format.html { redirect_to(@bday, :notice => 'Bday was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bday.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @day = DayAvailability.find(params[:id])\n @week = WeekAvailability.find(params[:week_availability_id])\n\n respond_to do |format|\n if @day.update_attributes(params[:day_availability])\n format.html {redirect_to @week, notice: 'Successfully updated schedule.'}\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @day_timeslot.update(day_timeslot_params)\n format.html { redirect_to @day_timeslot, notice: 'Day timeslot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @day_timeslot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_of_day.update(time_of_day_params)\n format.html { redirect_to @time_of_day, notice: 'Time of day was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_of_day }\n else\n format.html { render :edit }\n format.json { render json: @time_of_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @calendar = Calendar.find(params[:id])\n params[:calendar][:available] = true\n\n respond_to do |format|\n if @calendar.update_attributes(params[:calendar])\n format.html { redirect_to(@calendar, :notice => 'Calendar was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @client_id = args[:client_id] if args.key?(:client_id)\n @recurrence = args[:recurrence] if args.key?(:recurrence)\n @recurrence_id = args[:recurrence_id] if args.key?(:recurrence_id)\n @server_id = args[:server_id] if args.key?(:server_id)\n end", "def update\n @calendar_date = CalendarDate.find(params[:id])\n\n respond_to do |format|\n if @calendar_date.update_attributes(params[:calendar_date])\n format.html { redirect_to @calendar_date, notice: 'Calendar date was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calendar_date.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t@conference = Conference.find(params[:conference_id])\n @day = Day.find(params[:id])\n\n respond_to do |format|\n if @day.update_attributes(params[:day])\n format.html { redirect_to(conference_day_url, :notice => 'Day was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @day.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @days = args[:days] if args.key?(:days)\n @hours = args[:hours] if args.key?(:hours)\n @microseconds = args[:microseconds] if args.key?(:microseconds)\n @minutes = args[:minutes] if args.key?(:minutes)\n @months = args[:months] if args.key?(:months)\n @seconds = args[:seconds] if args.key?(:seconds)\n @tz_offset = args[:tz_offset] if args.key?(:tz_offset)\n @years = args[:years] if args.key?(:years)\n end", "def update\n respond_to do |format|\n if @periodic.update(periodic_params)\n format.html { redirect_to @periodic, notice: 'Periódico atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @periodic }\n else\n format.html { render :edit }\n format.json { render json: @periodic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n get_credentials\n begin\n response = resource[\"/update/#{app}\"].post(:apikey => @credentials[1], :frequency => options[:frequency])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def update\n @email_reminder.update(email_reminder_params)\n respond_with @email_reminder\n end", "def update\n respond_to do |format|\n if @daily_step.udpate(daily_step_params)\n format.html { redirect_to @daily_step, notice: 'Daily step was successfully update.' }\n format.json { render :show, status: :ok, location: @daily_step }\n else\n format.html { render :edit }\n format.json { render json: @daily_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reminder = Reminder.find(params[:id])\n\n respond_to do |format|\n if @reminder.update_attributes(reminder_params)\n format.html { redirect_to @reminder, notice: 'Reminder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reminder.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @essay = Essay.find(params[:id])\n\n respond_to do |format|\n if @essay.update_attributes(params[:essay])\n format.html { redirect_to @essay, notice: 'Essay was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @essay.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @cron = args[:cron] if args.key?(:cron)\n end", "def update\n if params[:meal][:expires_at] == \"1\"\n params[:meal][:expires_at] = 1.hour.from_now\n else \n params[:meal].delete(:expires_at)\n end\n\n respond_to do |format|\n if @meal.update(meal_params)\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal }\n else\n format.html { render :edit }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n\n # First create jobkey with existing name,group\n key = JobKey.new(@schedule.name, @schedule.group)\n\n if @schedule.update_attributes(params[:schedule])\n\n # reload schedule to refresh attributes\n @schedule.reload\n\n # Also update schedule in Quartz, if it already exists\n if RemoteJobScheduler.instance.scheduler.check_exists(key)\n RemoteJobScheduler.instance.update_schedule_trigger(@schedule)\n end\n\n format.html { redirect_to(@schedule, :notice => 'Schedule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @reminder = Reminder.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @reminder.update_attributes(params[:reminder])\r\n format.html { redirect_to @reminder, notice: 'Reminder was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @reminder.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @work_day = WorkDay.find(params[:id])\n\n respond_to do |format|\n if @work_day.update_attributes(params[:work_day])\n format.html { redirect_to(@work_day, :notice => 'Work day was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @work_day.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @day = args[:day] unless args[:day].nil?\n @month = args[:month] unless args[:month].nil?\n end", "def update\n params[:shift].delete(:employee)\n @shift = Shift.find(params[:id])\n @shift.attributes = params[:shift]\n @shift.date = Chronic.parse(params[:shift][:date])\n\n respond_to do |format|\n if @shift.save\n format.html { redirect_to @shift, notice: 'Shift was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @daily_exercise = DailyExercise.find(params[:id])\n\n respond_to do |format|\n if @daily_exercise.update_attributes(params[:daily_exercise])\n format.html { redirect_to @daily_exercise, notice: 'Daily exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daily_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @calendar.update(calendar_params)\n format.html { redirect_to calendars_calendars_url, notice: t('calendar.update') }\n format.json { render :show, status: :ok, location: calendars_calendars_url }\n else\n format.html { render :edit }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6328196", "0.6328081", "0.6133792", "0.611257", "0.5963384", "0.5951463", "0.5947674", "0.5879265", "0.5850053", "0.58497775", "0.58165795", "0.580463", "0.5785597", "0.5773269", "0.5760348", "0.57367593", "0.5730971", "0.57227343", "0.57154465", "0.56800395", "0.56774", "0.56538606", "0.56532043", "0.56486565", "0.5641091", "0.56355226", "0.56213856", "0.5617059", "0.5615168", "0.5614689", "0.5606875", "0.5605761", "0.55999887", "0.55950475", "0.55879116", "0.55867213", "0.5583655", "0.55788493", "0.5567567", "0.5565905", "0.5558003", "0.55544275", "0.5546767", "0.5535321", "0.55229306", "0.55075616", "0.5493444", "0.5490857", "0.5481173", "0.546831", "0.54614276", "0.5460402", "0.5456994", "0.54540586", "0.54510266", "0.544745", "0.54453546", "0.5437712", "0.54372185", "0.5436688", "0.54299647", "0.5428888", "0.5428233", "0.5426214", "0.5426115", "0.5419227", "0.54169434", "0.54167074", "0.5413695", "0.54111737", "0.5407829", "0.54040927", "0.5400348", "0.53991747", "0.53957814", "0.5392545", "0.538721", "0.53856087", "0.53817225", "0.5380621", "0.5378258", "0.53758764", "0.53711253", "0.5370894", "0.536957", "0.5368939", "0.5367692", "0.5366825", "0.5366516", "0.536311", "0.53607404", "0.5356792", "0.53561956", "0.53490645", "0.53462315", "0.53398246", "0.5334943", "0.5332712", "0.5329034", "0.53247297" ]
0.6927426
0
DELETE /everydays/1 DELETE /everydays/1.json
def destroy @everyday.destroy respond_to do |format| format.html { redirect_to everydays_url, notice: 'Everyday was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_all(date = Date.today)\n delete(date.strftime(@request_path))\n end", "def destroy\n @day.destroy\n respond_to do |format|\n format.html { redirect_to days_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @day = Day.find(params[:id])\n @day.destroy\n\n respond_to do |format|\n format.html { redirect_to days_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daytime = Daytime.find(params[:id])\n @daytime.destroy\n\n respond_to do |format|\n format.html { redirect_to daytimes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_intake.destroy\n respond_to do |format|\n format.html { redirect_to daily_intakes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @new_day.destroy\n respond_to do |format|\n format.html { redirect_to new_days_url, notice: 'New day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_calendar(id)\n @client.raw('delete', \"/config/calendars/#{id}\")\n end", "def destroy\n @weekday = Weekday.find(params[:id])\n @weekday.destroy\n\n respond_to do |format|\n format.html { redirect_to weekdays_url }\n format.json { head :ok }\n end\n end", "def destroy\n @elective_day.destroy\n respond_to do |format|\n format.html { redirect_to elective_days_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @day.destroy\n respond_to do |format|\n format.html { redirect_to days_url, notice: 'Day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @days_since_visit = DaysSinceVisit.find(params[:id])\n @days_since_visit.destroy\n\n respond_to do |format|\n format.html { redirect_to days_since_visits_url }\n format.json { head :ok }\n end\n end", "def delete\n @free_day = @free_days.first :date => params[:date]\n if @free_day && @free_day.destroy\n render_success \"Vacation at #{params[:date]} was removed\"\n else\n render_failure \"Couldn't remove vacation\"\n end\n end", "def destroy\n send_calendar_request(\"/#{@id}\", :delete)\n end", "def destroy\n @daily_happiness.destroy\n respond_to do |format|\n format.html { redirect_to daily_happinesses_url, notice: 'Daily happiness was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @day = Day.find(params[:id])\n @day.destroy\n\n respond_to do |format|\n format.html { redirect_to(conference_days_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @off_day.destroy\n respond_to do |format|\n format.html { redirect_to off_days_url, notice: 'Off day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @theory_day.destroy\n respond_to do |format|\n format.html { redirect_to theory_days_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @day.destroy\n respond_to do |format|\n format.html { redirect_to days_url, notice: 'Day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_record.destroy\n respond_to do |format|\n format.html { redirect_to daily_records_url, notice: 'Daily record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @day_week.destroy\n respond_to do |format|\n format.html { redirect_to day_weeks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dayoff = Dayoff.find(params[:id])\n @dayoff.destroy\n\n respond_to do |format|\n format.html { redirect_to dayoffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_step.destroy\n respond_to do |format|\n format.html { redirect_to daily_steps_url, notice: 'Daily step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @matchday.destroy\n respond_to do |format|\n format.html { redirect_to matchdays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_of_day.destroy\n respond_to do |format|\n format.html { redirect_to time_of_days_url, notice: 'Time of day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip.days.all.each do |day|\n day.destroy\n end\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @important_date.destroy\n respond_to do |format|\n format.html { redirect_to important_dates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @the_day = TheDay.find(params[:id])\n @the_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(the_days_url) }\n format.xml { head :ok }\n end\n end", "def delete_calendar(id)\n return @client.raw(\"delete\", \"/config/calendars/#{id}\")\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @monday.destroy\n respond_to do |format|\n format.html { redirect_to mondays_url, notice: 'Monday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_exercise = DailyExercise.find(params[:id])\n @daily_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bday = Bday.find(params[:id])\n @bday.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdays_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @calendar_day.destroy\n respond_to do |format|\n format.html { redirect_to calendar_days_url, notice: 'Calendar day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_period.destroy\n format.json { head :no_content }\n end", "def cron_del(type)\n cmd = \"{\\\"id\\\":14,\\\"method\\\":\\\"cron_del\\\",\\\"params\\\":[#{type}]}\\r\\n\"\n request(cmd)\n end", "def destroy\n @vehicle_daily = VehicleDaily.find(params[:id])\n @vehicle_daily.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicle_dailies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @batch_day.destroy\n respond_to do |format|\n format.html { redirect_to batch_days_url, notice: 'Batch day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @spec_day.destroy\n respond_to do |format|\n format.html { redirect_to spec_days_url, notice: 'Spec day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sunday.destroy\n respond_to do |format|\n format.html { redirect_to sundays_url, notice: 'Sunday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_grr = DailyGrr.find(params[:id])\n @daily_grr.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_daily_grrs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @day_of_week.destroy\n respond_to do |format|\n format.html { redirect_to day_of_weeks_url, notice: 'Day of week was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_calendar(calendar_id)\n end", "def destroy\n event = @event_day.destroy\n @event_day.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Event day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_task_log.destroy\n respond_to do |format|\n format.html { redirect_to daily_task_logs_url, notice: 'Daily task log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @week_day.destroy\n respond_to do |format|\n format.html { redirect_to week_days_url, notice: 'Week day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @weekly_update.destroy\n respond_to do |format|\n format.html { redirect_to weekly_updates_url, notice: 'Weekly update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @closing_day = ClosingDay.find(params[:id])\n @closing_day.destroy\n\n respond_to do |format|\n format.html { redirect_to closing_days_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_visitor.destroy\n respond_to do |format|\n format.html { redirect_to daily_visitors_url, notice: 'Daily visitor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find_by_id(params[:id])\n #if params[:delete_all] == 'true'\n # @event.event_series.destroy\n \n #elsif params[:delete_all] == 'future'\n # @events = @event.event_series.events.find(:all, :conditions => [\"start_time > '#{@event.start_time.to_formatted_s(:db)}' \"])\n # @event.event_series.events.delete(@events)\n \n #else\n # @event.destroy\n # redirect_to '/events'\n #end\n\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datetime.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.xml { head :ok }\n end\n end", "def destroy\n @workday = Workday.find(params[:id])\n @workday.destroy\n\n respond_to do |format|\n format.html { redirect_to(workdays_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @day_timeslot.destroy\n respond_to do |format|\n format.html { redirect_to day_timeslots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @downtime.destroy\n respond_to do |format|\n format.html { redirect_to downtimes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wednesday.destroy\n respond_to do |format|\n format.html { redirect_to wednesdays_url, notice: \"Wednesday was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @event_date.destroy\n respond_to do |format|\n format.html { redirect_to event_dates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @date_request.destroy\n respond_to do |format|\n format.html { redirect_to date_requests_url, notice: \"Date request was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @calendario = Calendario.find(params[:id])\n @calendario.destroy\n expire_fragment Time.now.to_date.to_s\n respond_to do |format|\n format.html { redirect_to(admin_calendarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @availability_day = AvailabilityDay.find(params[:id])\n @availability_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(availability_days_url) }\n format.xml { head :ok }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete_appointment(id)\n @client.raw('delete', \"/config/appointments/#{id}\")\n end", "def destroy\n @daily_data_payment.destroy\n respond_to do |format|\n format.html { redirect_to daily_data_payments_url }\n format.json { head :no_content }\n end\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 destroy\n @essay = Essay.find(params[:id])\n @essay.destroy\n\n respond_to do |format|\n format.html { redirect_to essays_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user_day.destroy\n respond_to do |format|\n format.html { redirect_to user_days_url, notice: 'User day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @daytype = Daytype.find(params[:id])\n @daytype.destroy\n\n respond_to do |format|\n format.html { redirect_to daytypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @expiration_date = ExpirationDate.find(params[:id])\n @expiration_date.destroy\n\n respond_to do |format|\n format.html { redirect_to expiration_dates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacation = Vacation.find(params[:id])\n @vacation.destroy\n current_user.updatetotaldays\n respond_to do |format|\n format.html { redirect_to vacations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hospitalization_day.destroy\n respond_to do |format|\n format.html { redirect_to hospitalization_days_url, notice: 'Día de estancia eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @day_week = DayWeek.find(params[:id])\n @day_week.destroy\n\n respond_to do |format|\n format.html { redirect_to day_weeks_url, :notice => 'Dia da semana excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @station_daily.destroy\n respond_to do |format|\n format.html { redirect_to station_dailies_url, notice: 'Station daily 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 @daily_total.destroy\n respond_to do |format|\n format.html { redirect_to daily_totals_url, notice: 'Daily total was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @workday.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path, notice: 'Workday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n attendance = Attendance.all.where(day_type: @day_type.id)\n attendance.each do |a|\n a.destroy\n end\n\n @day_type.destroy\n respond_to do |format|\n format.html { redirect_to day_types_url, notice: 'Day type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @weekly_schedule.destroy\n respond_to do |format|\n format.html { redirect_to weekly_schedules_url, notice: 'Weekly schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteEntityOpening_times( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/opening_times\",params)\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 destroy\n @day_statistics = @patient.day_statistics.all\n @day_statistics.delete_all\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Данные пациента удалены.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @day_list = DayList.find(params[:id])\n @day_list.destroy\n\n respond_to do |format|\n format.html { redirect_to day_lists_url }\n format.json { head :ok }\n end\n end", "def delete_paycycle_hours(user_id, start_date)\n db_params = {\n host: ENV['host'],\n port: ENV['port'],\n dbname: ENV['dbname'],\n user: ENV['user'],\n password: ENV['password']\n }\n db = PG::Connection.new(db_params)\n db.exec(\"DELETE FROM payperiod_hours WHERE user_id = '#{user_id}' AND start_date = '#{start_date}'\")\n db.close\nend", "def destroy\n @daily_price = DailyPrice.find(params[:id])\n @daily_price.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_prices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gameday.destroy\n respond_to do |format|\n format.html { redirect_to gamedays_url, notice: 'Gameday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @periodic.destroy\n respond_to do |format|\n format.html { redirect_to periodics_url, notice: 'Periodic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @periodic.destroy\n respond_to do |format|\n format.html { redirect_to periodics_url, notice: 'Periódico excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @day_hour.destroy\n respond_to do |format|\n format.html { redirect_to day_hours_url, notice: 'Day hour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @work_day = WorkDay.find(params[:id])\n @work_day.destroy\n\n respond_to do |format|\n flash[:notice] = 'Giornata di lavoro rimossa con successo.'\n format.html { redirect_to work_days_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work_day = WorkDay.find(params[:id])\n @work_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(work_days_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @timesheet = Timesheet.find(params[:id])\n @date = @timesheet.day\n @timesheet.destroy\n\n @timesheets = current_user.timesheets\n @title = \"My Timesheets\"\n\n respond_to do |format|\n format.html { render :index }\n format.json { head :ok }\n end\n end", "def destroy\n @tournament_day = TournamentDay.find(params[:id])\n @tournament_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(tournament_days_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.69665116", "0.67102396", "0.66386753", "0.6553476", "0.65202314", "0.6462715", "0.646062", "0.64455366", "0.6442089", "0.64065385", "0.63933307", "0.63892376", "0.6362518", "0.63495654", "0.6343083", "0.6332661", "0.63257277", "0.6316366", "0.63014525", "0.62983966", "0.62980807", "0.6288144", "0.6286291", "0.62803215", "0.6279323", "0.6271536", "0.62658185", "0.6263577", "0.62509567", "0.62280566", "0.62120235", "0.62037134", "0.6192838", "0.61668664", "0.6153318", "0.6151396", "0.61508155", "0.6142217", "0.6104573", "0.6100733", "0.60997325", "0.6091258", "0.608791", "0.60851246", "0.6072089", "0.6069663", "0.6067199", "0.60646456", "0.60582876", "0.6056116", "0.6056012", "0.6048244", "0.60435104", "0.6041002", "0.60406446", "0.6033109", "0.6027262", "0.6023912", "0.6022914", "0.6021176", "0.6020722", "0.6017555", "0.6016147", "0.6012176", "0.6011651", "0.60112584", "0.60058373", "0.5997259", "0.59959805", "0.5985469", "0.5985469", "0.59831834", "0.5970855", "0.5968703", "0.5964414", "0.5962872", "0.59622175", "0.5955921", "0.59542483", "0.59531087", "0.59511703", "0.5950359", "0.59462625", "0.5942462", "0.59412855", "0.59412855", "0.59412855", "0.59412855", "0.593563", "0.59335196", "0.59299415", "0.5925162", "0.59184456", "0.5918396", "0.5916897", "0.5911037", "0.5910969", "0.5910003", "0.5909801", "0.5907866" ]
0.71945614
0
Use callbacks to share common setup or constraints between actions.
def set_everyday @everyday = Everyday.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 set_actions\n actions :all\n end", "def define_action_helpers?; 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 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 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 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\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\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 setup(easy)\n super\n easy.customrequest = @verb\n 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 default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\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 _handle_action_missing(*args); end", "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 duas1(action)\n action.call\n action.call\nend" ]
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.53312254", "0.53121567", "0.52971965", "0.52964705", "0.52956307", "0.52587366", "0.52450675", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5233381", "0.52325714", "0.52288216", "0.52229726", "0.5218362", "0.52142864", "0.5207988", "0.5206337", "0.51762295", "0.51745105", "0.51728606", "0.516616", "0.5161016", "0.5157393", "0.5152562", "0.51524293", "0.5152397", "0.5144533", "0.513982", "0.51342106", "0.5113793", "0.5113793", "0.5113671", "0.51092553", "0.51062804", "0.50921935", "0.5088855", "0.5082236", "0.5079901", "0.5066569", "0.5055307", "0.5053106", "0.50499666", "0.50499666", "0.5035068", "0.50258636", "0.50220853", "0.5015893", "0.50134486", "0.5001442", "0.50005543", "0.4998581", "0.49901858", "0.49901858", "0.4986648", "0.49809486", "0.49792925", "0.4978855", "0.49685496", "0.49656174", "0.49576473", "0.49563017", "0.4955349", "0.49536878", "0.4952439", "0.49460214", "0.494239", "0.49334687", "0.49315962", "0.49266812", "0.49261138", "0.4925925", "0.4922542", "0.4920779", "0.49173284", "0.49169463", "0.4916256", "0.49162322", "0.49156886" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def everyday_params params.require(:everyday).permit(:read, :cardio, :exercise, :eat_to_plan, :make_money) 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 /resource_import_files GET /resource_import_files.json
def index @resource_import_files = ResourceImportFile.page(params[:page]) respond_to do |format| format.html # index.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @resource_import_file = ResourceImportFile.find_by(id: params[:resource_import_file_id])\n if @resource_import_file\n if request.format.text?\n @resource_import_results = @resource_import_file.resource_import_results\n else\n @resource_import_results = @resource_import_file.resource_import_results.page(params[:page])\n end\n else\n @resource_import_results = ResourceImportResult.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.text\n end\n end", "def discover_files\n authorize! :create, resource_class\n respond_to do |f|\n f.json do\n render json: file_locator.to_h\n end\n end\n end", "def files\n @files=get_endpoint('extra').keys\n end", "def import\n \tGrant.import(params[:file])\n respond_to do |format|\n format.html { redirect_to grants_url, notice: 'Successful Upload!' }\n format.json { head :no_content }\n end\n end", "def show\n @resource_import_results = @resource_import_file.resource_import_results.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def index\n @event_import_files = EventImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_import_files }\n end\n end", "def index\n @agent_import_files = AgentImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @agent_import_files }\n end\n end", "def request_import\n end", "def index\n @event_import_files = EventImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @event_import_files }\n end\n end", "def create\n @resource_import_file = ResourceImportFile.new(resource_import_file_params)\n @resource_import_file.user = current_user\n\n respond_to do |format|\n if @resource_import_file.save\n if @resource_import_file.mode == 'import'\n ResourceImportFileJob.perform_later(@resource_import_file)\n end\n format.html { redirect_to @resource_import_file, notice: t('import.successfully_created', model: t('activerecord.models.resource_import_file')) }\n format.json { render json: @resource_import_file, status: :created, location: @resource_import_file }\n else\n prepare_options\n format.html { render action: \"new\" }\n format.json { render json: @resource_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def import_resources\n # for each resource type, look for a file of measurement data\n Report.plugin_matrix.each do |resource_name, measurements|\n model = Object.const_get((resource_name + 'Resource').camelcase(:upper))\n model.unrestrict_primary_key\n iterate_lines(@directory + resource_name + '.json') do |idx, line|\n print \"\\rImporting #{resource_name}: #{idx}...\"\n\n resource = JSON.parse(line)\n resource.each do |key, value|\n value = update_date(value, @date_offset)\n resource[key] = value unless value.nil?\n end\n model.create(resource)\n end\n model.restrict_primary_key\n print \"Done\\n\"\n import_measurements(measurements)\n end\n end", "def file_report(resources)\n resources = format(resources)\n merged_options = options.merge({ resource: resources })\n response = RestClient.post endpoint(\"/file/report\"), merged_options\n parse_response(response)\n end", "def index\n @imports = Import.all\n respond_to do |format|\n format.html\n format.json { render json: ImportsDatatable.new(view_context)}\n end\n end", "def index\n @event_import_file = EventImportFile.where(id: params[:event_import_file_id]).first\n if @event_import_file\n @event_import_results = @event_import_file.event_import_results.page(params[:page])\n else\n @event_import_results = EventImportResult.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_import_results }\n format.txt\n end\n end", "def import\n Worker.import(params[:file])\n redirect_to tenant_workers_path(@tenant), notice: \"Worker list imported.\"\n end", "def json_files\n file_list '**/*.json'\n end", "def batch_import_params\n params.permit(:file)\n end", "def import\n Project.import(params[:file])\n redirect_to students_path, notice: \"Projects imported.\"\n end", "def index\n @imports = Import.all\n end", "def index\n @imports = Import.all\n end", "def index\n @imports = Import.all\n end", "def index\n @imports = Import.all\n end", "def show\n @import = Import.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import }\n end\n end", "def show\n @import = Import.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import }\n end\n end", "def show\n @import = Import.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import }\n end\n end", "def import\n User.import(params[:file])\n redirect_to users_path\n end", "def import_params\n params.permit(:import_type, :file)\n end", "def index\n # @product_imports = ImportFile.where(:company_id => @company.id, :item_type => 1).order(\"created_at DESC\")\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render :json => @product_imports }\n format.json { render :json => ProductImportDatatable.new(view_context,@company)}\n end\n end", "def get_sis_import_list(account_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"account_id is required\" if account_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :account_id => account_id\n )\n\n # resource path\n path = path_replace(\"/v1/accounts/{account_id}/sis_imports\",\n :account_id => account_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response.map {|response|SisImport.new(response)}\n end", "def import\n Item.import( params[:file])\n redirect_to '/items', notice: 'Items Imported.'\n end", "def files\n results\n rescue ApiStruct::EntityError\n result\n end", "def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def import\n respond_to do |format|\n begin\n # process upload file, must be xls/xlsx(better, 'cause xls only can upload 65000 rows)\n @asset_categorization = AssetCategorization.import(params[:file])\n format.html { render action: \"new\" }\n rescue => e\n format.html { redirect_to upload_asset_categorizations_url, flash: { error: e.message } } \n end\n end\n end", "def file_rescan(resources)\n resources = format(resources)\n merged_options = options.merge({ resource: resources})\n response = RestClient.post endpoint(\"/file/rescan\"), merged_options\n parse_response(response)\n end", "def show\n @resource_file = ResourceFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_file }\n end\n end", "def index\n @resources = []\n\t\tDir.glob(\"#{params[:path]}/*\").each do |f|\n\t\tunless File.directory?(f)\n\t\t\t@resources.push(File.basename(f))\n\t\tend\n\tend\n\n\trender json: @resources\n end", "def import\n Map.import(params[:file])\n end", "def import\n Schedule.import(params[:file])\n redirect_to schedules_path, notice: \"Schedules imported successfully\"\n end", "def import\n DispensarySource.import(params[:file])\n flash[:success] = 'Dispensary Sources were successfully imported'\n redirect_to dispensary_sources_admin_path \n end", "def importing\n @dataset = Dataset.where(id: params.fetch(:id)).first\n render plain: @dataset.import_status\n end", "def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end", "def import_params\n params.require(:import).permit(:filename, :imported)\n end", "def files\n return get_result('files')\n end", "def index\n @upload_file_to_servers = UploadFileToServer.all\n end", "def index\n @incidentfiles = Incidentfile.all\n end", "def get_files_list(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'FilesList')\n end", "def index\n @user_import_file = UserImportFile.find_by(id: params[:user_import_file_id])\n if @user_import_file\n @user_import_results = @user_import_file.user_import_results.page(params[:page])\n else\n @user_import_results = UserImportResult.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.text\n end\n end", "def index\n @agent_import_files = AgentImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def imports_files\n @pagenumber=27\n end", "def import_params\n params.require(:file)\n end", "def update\n respond_to do |format|\n if @resource_import_file.update(resource_import_file_params)\n if @resource_import_file.mode == 'import'\n ResourceImportFileJob.perform_later(@resource_import_file)\n end\n format.html { redirect_to @resource_import_file, notice: t('controller.successfully_updated', model: t('activerecord.models.resource_import_file')) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render action: \"edit\" }\n format.json { render json: @resource_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end", "def index\n authorize Import\n @imports = Import.\n where(institution: current_institution).\n where(\"created_at > ?\", 6.months.ago).\n order(created_at: :desc)\n respond_to do |format|\n format.js\n format.html\n end\n end", "def import\n DispensarySourceProduct.import(params[:file])\n flash[:success] = 'Dispensary Source Products were successfully imported'\n redirect_to dispensary_source_products_admin_path \n end", "def create\n @import = Import.new(import_params)\n\n respond_to do |format|\n if @import.save\n format.html { redirect_to courses_path, notice: 'Datei erfolgreich importiert.' }\n format.json { render action: 'show', status: :created, location: @import }\n else\n format.html { render action: 'new' }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n import_file(@import)\n end", "def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\n end", "def get_file_listing\n execute!(drive.files.list).data\n end", "def create\n respond_to do |format|\n if @import.save\n\n if @import.file_file_name?\n @import.import\n end\n\n format.html { redirect_to(\"/users/edit#imports\", :notice => I18n.t('backend.actions.success_create', :model => I18n.t('activerecord.capitalized_models.import'))) }\n format.xml { render :xml => @import, :status => :created, :location => @import }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @import.errors, :status => :unprocessable_entity }\n end\n end\n end", "def retrieve_cloud_files(files); end", "def select\n upload_file or import_list\n load_importer\n end", "def file_data\n @client.get_file @file_url\n end", "def sources\n respond_to do |format|\n format.html{ redirect_to root_path }\n format.json{\n list = []\n Plugins::Import.included_modules.each do |plugin|\n list << { \n :display => \"#{plugin::Meta::NAME} (#{plugin.name} #{plugin::Meta::VERSION::STRING})\",\n :value => plugin.name\n }\n end\n render :json => list\n }\n end\n end", "def import_params\n params[:import]\n end", "def index\n @event_import_file = EventImportFile.find_by(id: params[:event_import_file_id])\n if @event_import_file\n @event_import_results = @event_import_file.event_import_results.order(created_at: :asc).page(params[:page])\n else\n @event_import_results = EventImportResult.order(created_at: :desc).page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.text\n end\n end", "def users_import_params\n\t\tparams.require(:user).require(:file)\n\tend", "def import_list(options={})\n map_file = options[:map_file]\n source_file = options[:source_file]\n file_encoding = options[:file_encoding]\n\n raise ArgumentError, \":map_file is required\" unless map_file\n raise ArgumentError, \":source_file is required\" unless source_file\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.ImportList do\n xml.MAP_FILE map_file\n xml.SOURCE_FILE source_file\n xml.FILE_ENCODING file_encoding if file_encoding.present?\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)['JOB_ID'] rescue nil\n end", "def show\n @importer = Importer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @importer }\n end\n end", "def assets\n @list = []\n\n raise DRI::Exceptions::BadRequest unless params[:objects].present?\n\n solr_query = Solr::Query.construct_query_for_ids(\n params[:objects].map { |o| o.values.first }\n )\n result_docs = Solr::Query.new(solr_query)\n result_docs.each do |doc|\n item = {}\n item['pid'] = doc.id\n item['files'] = assets_and_surrogates(doc)\n\n @list << item unless item.empty?\n end\n\n raise DRI::Exceptions::NotFound if @list.empty?\n\n respond_to do |format|\n format.json\n end\n end", "def show\n @product_import = ProductImport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_import }\n end\n end", "def import\n url = \"#{self.url}/import?auth=#{self.authtoken}\"\n status, response = rest_post( url, nil )\n if ok?( status )\n return status, response['new_count'], response['update_count'], response['duplicate_count'], response['error_count']\n end\n return status, 0, 0, 0, 0\n end", "def files(trading_partner_id, filename)\n scope 'default'\n url = URI.parse(@api_url + '/files/')\n\n File.open(filename) do |f|\n req = Net::HTTP::Post::Multipart.new url.path,\n 'file' => UploadIO.new(f, 'application/EDI-X12', filename),\n 'trading_partner_id' => trading_partner_id\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 end\n\n JSON.parse(@response.body)\n end", "def import\n VendorProduct.import(params[:file])\n flash[:success] = 'Vendor Products were successfully imported'\n redirect_to vendor_products_admin_path \n end", "def import\n if params[:file]\n @users = User.import(params[:file])\n redirect_to root_url(:users => @users), notice: 'Users were successfully imported.'\n else\n redirect_to root_url, notice: 'Please select File to upload'\n end \n end", "def import()\n # TODO\n end", "def show\n @import_def = ImportDef.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import_def }\n end\n end", "def import\n ret = @uri.import\n render plain: ret[:message], status: ret[:status]\n end", "def uploaded_file\n initalize_breadcrumb(\"Uploaded File(s)\", uploadedfile_datauploaders_path)\n currentUser = current_user.id\n @uploadedFiles = UserFileMapping.where(:user_id =>currentUser )\n respond_with(@uploadedFiles)\n end", "def read_file(resource)\n File.read(resource)\n end", "def index\n @import_jobs = ImportJob.all\n end", "def import\n Student.import(params[:file], params[:course][:id])\n @course = Course.find_by_id(params[:course][:id])\n @students = @course.students\n # redirect_to show_students_url, notice: \"Students imported successfully.\"\n end", "def files\n result = form.select_files.map do |label, id|\n { id: id, text: label }\n end\n render json: result\n end", "def files_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_get ...\"\n end\n # resource path\n local_var_path = \"/files\"\n\n # query parameters\n query_params = {}\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'include_deleted_files'] = opts[:'include_deleted_files'] if !opts[:'include_deleted_files'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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 = [ 'access_token' ]\n response = @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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def import_files(dir)\n Dir.glob(dir.to_s).map {|file| import_file(file)}\nend", "def files options = {}\n ensure_connection!\n resp = connection.list_files name, options\n if resp.success?\n File::List.from_resp resp, connection\n else\n fail ApiError.from_response(resp)\n end\n end", "def files\n result = form.select_files.map do |label, id|\n { id: id, text: label }\n end\n render json: result\n end", "def files\n result = form.select_files.map do |label, id|\n { id: id, text: label }\n end\n render json: result\n end", "def import_files(obj_pid, obj_identifier, new_obj_id)\n query = \"SELECT id, file_format, uri, size, intellectual_object_id, \" +\n \"identifier, created_at, updated_at FROM generic_files \" +\n \"WHERE intellectual_object_id = ?\"\n if @file_query.nil?\n @file_query = @db.prepare(query)\n end\n result_set = @file_query.execute(obj_pid)\n while true\n files = get_file_batch(result_set, obj_identifier)\n break if files.count == 0\n save_file_batch(files, new_obj_id)\n end\n end", "def show\n @treq = Treq.find(params[:id])\n @treq_files = @treq.treq_files.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @treq }\n end\n end", "def index\n @transfers = Transfer.resources(params[:resource].capitalize)\n end", "def index\n @file_packages = FilePackage.all\n end", "def import_file_path\n @import_file_path ||= real_import_file_path\n end", "def get_upload_urls(mime_type)\n\tputs \"Getting upload urls\"\n\tresponse = request_get_with_param('/api/file/getpreupload', mime_type)\n\tputs response.body\nend", "def entry_files\n @entry_files = base_files @entry_path\n end", "def upload # be ready for when we can accept an actual file directly uploaded instead of copy/paste\n array_of_hashes = Contact.parse_tab_delimited(params[:import])\n \n respond_to do |format|\n if Contact.import(array_of_hashes, @group)\n format.html { redirect_to [@hub, @group], :notice => 'Contacts were successfully imported.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"import\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def list_assets\n @list = []\n\n raise DRI::Exceptions::BadRequest unless params[:objects].present?\n\n solr_query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids(\n params[:objects].map { |o| o.values.first }\n )\n result_docs = Solr::Query.new(solr_query)\n result_docs.each do |doc|\n item = list_files_with_surrogates(doc)\n @list << item unless item.empty?\n end\n\n raise DRI::Exceptions::NotFound if @list.empty?\n\n respond_to do |format|\n format.json\n end\n end", "def import!\n import_binary_files\n member_ids = []\n source_metadata_adapter.query_service.find_members(resource: source_resource).each do |member|\n member = self.class.import(source_resource: member, source_metadata_adapter: source_metadata_adapter, change_set_persister: change_set_persister)\n source_change_set.created_file_sets += [member] if member.is_a?(FileSet)\n member_ids << member.id\n end\n # Get rid of non-preserved members.\n source_change_set.try(:member_ids=, member_ids)\n output = change_set_persister.save(change_set: source_change_set)\n output\n end", "def index\n @import_jobs = [@dataset.import_job]\n end", "def index\n @csv_imports = CsvImport.all\n end", "def import_files\n\t\tif(params[:file].present?)\n begin\n\t\t\t\tNcQuestion.build_from_import(params[:file], current_company)\n redirect_to new_audit_nc_question_path, :flash => { :notice => MESSAGES[\"nc_question\"][\"csv_upload\"][\"success\"]}\n rescue\n redirect_to new_audit_nc_question_path, :flash => { :error => MESSAGES[\"csv_upload\"][\"error\"]}\n end\n else\n redirect_to new_audit_nc_question_path , :flash => { :notice => MESSAGES[\"csv_upload\"][\"presence\"]}\n end\n end", "def index\n @uploaded_files = UploadedFile.all\n end" ]
[ "0.65673685", "0.63847166", "0.6238196", "0.6160717", "0.6133016", "0.6123933", "0.6122611", "0.6096373", "0.6085375", "0.60096335", "0.5826483", "0.5823359", "0.58093315", "0.58054435", "0.5777549", "0.5763998", "0.5763272", "0.57436293", "0.5695138", "0.5695138", "0.5695138", "0.5695138", "0.5679089", "0.5679089", "0.5679089", "0.56771576", "0.5646753", "0.56307983", "0.562295", "0.5604014", "0.5602545", "0.5591919", "0.55651814", "0.5555992", "0.5540861", "0.55375254", "0.5522205", "0.5511685", "0.55075455", "0.5502059", "0.54793245", "0.54724926", "0.54689276", "0.5461328", "0.5460341", "0.5452745", "0.54443204", "0.54269105", "0.54266703", "0.54117596", "0.54041934", "0.5388599", "0.53816503", "0.53671324", "0.53660893", "0.53545135", "0.53447145", "0.5344395", "0.5339468", "0.53393924", "0.5337323", "0.532827", "0.5323439", "0.5317377", "0.53123885", "0.53078747", "0.5306096", "0.53017694", "0.52983594", "0.5293538", "0.52826655", "0.5271222", "0.5269203", "0.52690977", "0.52676845", "0.5264306", "0.5259653", "0.5259499", "0.525668", "0.52518135", "0.52510077", "0.5245931", "0.52454877", "0.52314043", "0.52301866", "0.52301866", "0.5226596", "0.5223978", "0.52187765", "0.5217162", "0.52169234", "0.52160966", "0.52133435", "0.52127624", "0.52100724", "0.52100503", "0.52090704", "0.52083445", "0.5208135", "0.52067333" ]
0.70251775
0
GET /resource_import_files/1 GET /resource_import_files/1.json
def show @resource_import_results = @resource_import_file.resource_import_results.page(params[:page]) respond_to do |format| format.html # show.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @resource_import_files = ResourceImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n @resource_import_file = ResourceImportFile.find_by(id: params[:resource_import_file_id])\n if @resource_import_file\n if request.format.text?\n @resource_import_results = @resource_import_file.resource_import_results\n else\n @resource_import_results = @resource_import_file.resource_import_results.page(params[:page])\n end\n else\n @resource_import_results = ResourceImportResult.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.text\n end\n end", "def index\n @event_import_file = EventImportFile.where(id: params[:event_import_file_id]).first\n if @event_import_file\n @event_import_results = @event_import_file.event_import_results.page(params[:page])\n else\n @event_import_results = EventImportResult.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_import_results }\n format.txt\n end\n end", "def discover_files\n authorize! :create, resource_class\n respond_to do |f|\n f.json do\n render json: file_locator.to_h\n end\n end\n end", "def import\n \tGrant.import(params[:file])\n respond_to do |format|\n format.html { redirect_to grants_url, notice: 'Successful Upload!' }\n format.json { head :no_content }\n end\n end", "def index\n @event_import_files = EventImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_import_files }\n end\n end", "def index\n @event_import_files = EventImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @event_import_files }\n end\n end", "def index\n @agent_import_files = AgentImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @agent_import_files }\n end\n end", "def create\n @resource_import_file = ResourceImportFile.new(resource_import_file_params)\n @resource_import_file.user = current_user\n\n respond_to do |format|\n if @resource_import_file.save\n if @resource_import_file.mode == 'import'\n ResourceImportFileJob.perform_later(@resource_import_file)\n end\n format.html { redirect_to @resource_import_file, notice: t('import.successfully_created', model: t('activerecord.models.resource_import_file')) }\n format.json { render json: @resource_import_file, status: :created, location: @resource_import_file }\n else\n prepare_options\n format.html { render action: \"new\" }\n format.json { render json: @resource_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def request_import\n end", "def show\n @import = Import.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import }\n end\n end", "def show\n @import = Import.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import }\n end\n end", "def show\n @import = Import.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import }\n end\n end", "def show\n @resource_file = ResourceFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_file }\n end\n end", "def files\n @files=get_endpoint('extra').keys\n end", "def importing\n @dataset = Dataset.where(id: params.fetch(:id)).first\n render plain: @dataset.import_status\n end", "def index\n # @product_imports = ImportFile.where(:company_id => @company.id, :item_type => 1).order(\"created_at DESC\")\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render :json => @product_imports }\n format.json { render :json => ProductImportDatatable.new(view_context,@company)}\n end\n end", "def index\n @user_import_file = UserImportFile.find_by(id: params[:user_import_file_id])\n if @user_import_file\n @user_import_results = @user_import_file.user_import_results.page(params[:page])\n else\n @user_import_results = UserImportResult.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.text\n end\n end", "def index\n @imports = Import.all\n respond_to do |format|\n format.html\n format.json { render json: ImportsDatatable.new(view_context)}\n end\n end", "def update\n respond_to do |format|\n if @resource_import_file.update(resource_import_file_params)\n if @resource_import_file.mode == 'import'\n ResourceImportFileJob.perform_later(@resource_import_file)\n end\n format.html { redirect_to @resource_import_file, notice: t('controller.successfully_updated', model: t('activerecord.models.resource_import_file')) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render action: \"edit\" }\n format.json { render json: @resource_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @import_def = ImportDef.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import_def }\n end\n end", "def files\n results\n rescue ApiStruct::EntityError\n result\n end", "def import\n Worker.import(params[:file])\n redirect_to tenant_workers_path(@tenant), notice: \"Worker list imported.\"\n end", "def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end", "def batch_import_params\n params.permit(:file)\n end", "def read\n status = 200\n\n # File path\n fpath = filepathById params[:id]\n\n if nil == fpath\n # File description does not exists\n result = {status: 'error', message: 'Bad request'}\n status = 400\n elsif File.exists? fpath\n result = {content: File.read(fpath)}\n else\n result = {content: ''}\n end\n render json: result.to_json, status: status\n end", "def file_report(resources)\n resources = format(resources)\n merged_options = options.merge({ resource: resources })\n response = RestClient.post endpoint(\"/file/report\"), merged_options\n parse_response(response)\n end", "def index\n @event_import_file = EventImportFile.find_by(id: params[:event_import_file_id])\n if @event_import_file\n @event_import_results = @event_import_file.event_import_results.order(created_at: :asc).page(params[:page])\n else\n @event_import_results = EventImportResult.order(created_at: :desc).page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.text\n end\n end", "def import\n Project.import(params[:file])\n redirect_to students_path, notice: \"Projects imported.\"\n end", "def show\n @importer = Importer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @importer }\n end\n end", "def import\n respond_to do |format|\n begin\n # process upload file, must be xls/xlsx(better, 'cause xls only can upload 65000 rows)\n @asset_categorization = AssetCategorization.import(params[:file])\n format.html { render action: \"new\" }\n rescue => e\n format.html { redirect_to upload_asset_categorizations_url, flash: { error: e.message } } \n end\n end\n end", "def import\n Item.import( params[:file])\n redirect_to '/items', notice: 'Items Imported.'\n end", "def import_resources\n # for each resource type, look for a file of measurement data\n Report.plugin_matrix.each do |resource_name, measurements|\n model = Object.const_get((resource_name + 'Resource').camelcase(:upper))\n model.unrestrict_primary_key\n iterate_lines(@directory + resource_name + '.json') do |idx, line|\n print \"\\rImporting #{resource_name}: #{idx}...\"\n\n resource = JSON.parse(line)\n resource.each do |key, value|\n value = update_date(value, @date_offset)\n resource[key] = value unless value.nil?\n end\n model.create(resource)\n end\n model.restrict_primary_key\n print \"Done\\n\"\n import_measurements(measurements)\n end\n end", "def show\n @product_import = ProductImport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_import }\n end\n end", "def file_data\n @client.get_file @file_url\n end", "def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def index\n @incidentfiles = Incidentfile.all\n end", "def import\n User.import(params[:file])\n redirect_to users_path\n end", "def show\n if @agent_import_file.agent_import.path\n unless Setting.uploaded_file.storage == :s3\n file = @agent_import_file.agent_import.path\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @agent_import_file }\n format.download {\n if Setting.uploaded_file.storage == :s3\n redirect_to @agent_import_file.agent_import.expiring_url(10)\n else\n send_file file, :filename => @agent_import_file.agent_import_file_name.encode(\"cp932\"), :type => 'application/octet-stream'\n end\n }\n end\n end", "def new\n @event_import_file = EventImportFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event_import_file }\n end\n end", "def import\n url = \"#{self.url}/import?auth=#{self.authtoken}\"\n status, response = rest_post( url, nil )\n if ok?( status )\n return status, response['new_count'], response['update_count'], response['duplicate_count'], response['error_count']\n end\n return status, 0, 0, 0, 0\n end", "def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\n end", "def import\n DispensarySource.import(params[:file])\n flash[:success] = 'Dispensary Sources were successfully imported'\n redirect_to dispensary_sources_admin_path \n end", "def import\n Schedule.import(params[:file])\n redirect_to schedules_path, notice: \"Schedules imported successfully\"\n end", "def show\n @importation = Importation.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @importation }\n end\n end", "def imports_files\n @pagenumber=27\n end", "def import_params\n params.permit(:import_type, :file)\n end", "def index\n @imports = Import.all\n end", "def index\n @imports = Import.all\n end", "def index\n @imports = Import.all\n end", "def index\n @imports = Import.all\n end", "def show\n @importtodb = Importtodb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @importtodb }\n end\n end", "def show\n @treq = Treq.find(params[:id])\n @treq_files = @treq.treq_files.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @treq }\n end\n end", "def get_sis_import_list(account_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"account_id is required\" if account_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :account_id => account_id\n )\n\n # resource path\n path = path_replace(\"/v1/accounts/{account_id}/sis_imports\",\n :account_id => account_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response.map {|response|SisImport.new(response)}\n end", "def file_rescan(resources)\n resources = format(resources)\n merged_options = options.merge({ resource: resources})\n response = RestClient.post endpoint(\"/file/rescan\"), merged_options\n parse_response(response)\n end", "def index\n @agent_import_files = AgentImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend", "def new\n @agent_import_file = AgentImportFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @agent_import_file }\n end\n end", "def get_file(file_id)\n\tputs \"Getting file: \" + file_id\n\tresponse = request_get('/api/partner/file/' + file_id)\n\tputs response.body\nend", "def files_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_get ...\"\n end\n # resource path\n local_var_path = \"/files\"\n\n # query parameters\n query_params = {}\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'include_deleted_files'] = opts[:'include_deleted_files'] if !opts[:'include_deleted_files'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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 = [ 'access_token' ]\n response = @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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def show\n @importdatum = Importdatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @importdatum }\n end\n end", "def create\n respond_to do |format|\n if @import.save\n\n if @import.file_file_name?\n @import.import\n end\n\n format.html { redirect_to(\"/users/edit#imports\", :notice => I18n.t('backend.actions.success_create', :model => I18n.t('activerecord.capitalized_models.import'))) }\n format.xml { render :xml => @import, :status => :created, :location => @import }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @import.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end", "def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end", "def new\n @resource_file = ResourceFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_file }\n end\n end", "def import\n DispensarySourceProduct.import(params[:file])\n flash[:success] = 'Dispensary Source Products were successfully imported'\n redirect_to dispensary_source_products_admin_path \n end", "def create\n @import = Import.new(import_type: import_params[:import_type], filename: import_params[:file].original_filename)\n if @import.valid_file_type?(import_params)\n @import.save\n @export_json = @import.handle_import_file(@import.import_type, import_params[:file])\n else\n #Handle error message response\n @export_json = 'File format must be a csv'\n end\n respond_to do |format|\n # format.html { redirect_to imports_path(@export_json) }\n format.json {render json: @export_json }\n end\n end", "def select\n upload_file or import_list\n load_importer\n end", "def show\n if @event_import_file.event_import.path\n unless Setting.uploaded_file.storage == :s3\n file = @event_import_file.event_import.path\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event_import_file }\n format.download {\n if Setting.uploaded_file.storage == :s3\n redirect_to @event_import_file.event_import.expiring_url(10)\n else\n send_file file, :filename => @event_import_file.event_import_file_name, :type => 'application/octet-stream'\n end\n }\n end\n end", "def json_files\n file_list '**/*.json'\n end", "def show\n @importation_attachment = ImportationAttachment.find(params[:id])\n \n respond_to do |format|\n format.html { redirect_to edit_admin_importation_path(@importation_attachment.importation) if @importation_attachment.collection_name == 'images' }\n format.json { render json: @importation_attachment }\n end\n end", "def uploaded_file\n initalize_breadcrumb(\"Uploaded File(s)\", uploadedfile_datauploaders_path)\n currentUser = current_user.id\n @uploadedFiles = UserFileMapping.where(:user_id =>currentUser )\n respond_with(@uploadedFiles)\n end", "def files(trading_partner_id, filename)\n scope 'default'\n url = URI.parse(@api_url + '/files/')\n\n File.open(filename) do |f|\n req = Net::HTTP::Post::Multipart.new url.path,\n 'file' => UploadIO.new(f, 'application/EDI-X12', filename),\n 'trading_partner_id' => trading_partner_id\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 end\n\n JSON.parse(@response.body)\n end", "def index\n @upload_file_to_servers = UploadFileToServer.all\n end", "def show\n @file_record = FileRecord.find(params[:id])\n @file_versions = @file_record.file_versions.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @file_record }\n format.json { render json: {file_record: @file_record,file_versions: @file_versions} }\n end\n end", "def import\n ret = @uri.import\n render plain: ret[:message], status: ret[:status]\n end", "def create\n @import = Import.new(import_params)\n\n respond_to do |format|\n if @import.save\n format.html { redirect_to courses_path, notice: 'Datei erfolgreich importiert.' }\n format.json { render action: 'show', status: :created, location: @import }\n else\n format.html { render action: 'new' }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n import_file(@import)\n end", "def read_file(resource)\n File.read(resource)\n end", "def destroy\n @resource_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_import_files_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.resource_import_file')) }\n format.json { head :no_content }\n end\n end", "def list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PublicationsFileApi.list ...'\n end\n # resource path\n local_var_path = '/pulp/api/v3/publications/file/file/'\n\n # query parameters\n query_params = {}\n query_params[:'ordering'] = opts[:'ordering'] if !opts[:'ordering'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?\n query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].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 = ['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 => 'InlineResponse20015')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PublicationsFileApi#list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n if @event_import_file.event_import.path\n unless Rails.application.config_for(:enju_leaf)[\"uploaded_file\"][\"storage\"] == :s3\n file = @event_import_file.event_import.path\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_import_file }\n format.download {\n if Rails.application.config_for(:enju_leaf)[\"uploaded_file\"][\"storage\"] == :s3\n redirect_to @event_import_file.event_import.expiring_url(10)\n else\n send_file file, filename: @event_import_file.event_import_file_name, type: 'application/octet-stream'\n end\n }\n end\n end", "def upload_file(item_file)\n upload_response = @server.upload(item_file.file(item_file.metadata_full_path))\n json = JSON.parse(upload_response.body)\n json['files'].map { |f| f['id'] }\n end", "def import_params\n params.require(:import).permit(:filename, :imported)\n end", "def import_files(obj_pid, obj_identifier, new_obj_id)\n query = \"SELECT id, file_format, uri, size, intellectual_object_id, \" +\n \"identifier, created_at, updated_at FROM generic_files \" +\n \"WHERE intellectual_object_id = ?\"\n if @file_query.nil?\n @file_query = @db.prepare(query)\n end\n result_set = @file_query.execute(obj_pid)\n while true\n files = get_file_batch(result_set, obj_identifier)\n break if files.count == 0\n save_file_batch(files, new_obj_id)\n end\n end", "def original_file_id\n \"#{resource.id}/files/#{resource.original_file_id}\"\n end", "def show\n puts params[:id]\n @file_versions = FileVersion.where(versioned_file_id: params[:id]) \n #@file_versions = FileVersion.find(:versioned_file_id => params[:versioned_file_id])\n render json: @file_versions\n end", "def index\n @authorized = true\n begin\n authorize! :show, UploadFile\n rescue CanCan::AccessDenied\n @authorized = false\n end\n #added to avoid raise condition when initially uploading multiple files\n check_uploads_collection unless !@authorized\n\n respond_to do |format|\n format.json {\n #TODO find_by_solr could be faster \n @multiresimages = current_user.upload_files.map do |file|\n begin\n Multiresimage.find(file.pid)\n rescue ActiveFedora::ObjectNotFoundError\n end\n end.compact\n render :json=>@multiresimages.map(&:to_jq_upload)\n }\n format.html\n end\n end", "def index\n @resources = []\n\t\tDir.glob(\"#{params[:path]}/*\").each do |f|\n\t\tunless File.directory?(f)\n\t\t\t@resources.push(File.basename(f))\n\t\tend\n\tend\n\n\trender json: @resources\n end", "def retrieve_cloud_files(files); end", "def file(file_type, id)\n query = \"/?client_id=#{@client_id}&#{id}\"\n path = \"#{file_type}/#{__method__}.to_s\"\n resp = http_get(path, query)\n end", "def get_file_listing\n execute!(drive.files.list).data\n end", "def action_import_bulk_with_http_info(list_id, import_bulk_file_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.action_import_bulk ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactsApi.action_import_bulk\"\n end\n if @api_client.config.client_side_validation && list_id < 1\n fail ArgumentError, 'invalid value for \"list_id\" when calling ContactsApi.action_import_bulk, must be greater than or equal to 1.'\n end\n\n # verify the required parameter 'import_bulk_file_request' is set\n if @api_client.config.client_side_validation && import_bulk_file_request.nil?\n fail ArgumentError, \"Missing the required parameter 'import_bulk_file_request' when calling ContactsApi.action_import_bulk\"\n end\n # resource path\n local_var_path = '/lists/{list_id}/contacts/actions/import-bulk'.sub('{' + 'list_id' + '}', CGI.escape(list_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 # 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\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(import_bulk_file_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"ContactsApi.action_import_bulk\",\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: ContactsApi#action_import_bulk\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @importdata = Importdatum.where(\"maxscheduler_id = ?\", @maxschedulerId).order('id desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @importdata }\n end\n end", "def index\n @inventory_files = InventoryFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @inventory_files }\n end\n end", "def index\n @csv_files = CsvFile.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csv_files }\n end\n end", "def index\n @backup_files = BackupFile.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @backup_files }\n end\n end", "def get_upload_urls(mime_type)\n\tputs \"Getting upload urls\"\n\tresponse = request_get_with_param('/api/file/getpreupload', mime_type)\n\tputs response.body\nend", "def import\n Map.import(params[:file])\n end", "def import\n Student.import(params[:file], params[:course][:id])\n @course = Course.find_by_id(params[:course][:id])\n @students = @course.students\n # redirect_to show_students_url, notice: \"Students imported successfully.\"\n end", "def file_get(id)\n response = get('FileService.getFile', id)\n end" ]
[ "0.6988211", "0.68019485", "0.628874", "0.6260535", "0.62352586", "0.62322205", "0.61994076", "0.61859846", "0.61519456", "0.6042415", "0.6017899", "0.6017899", "0.6017899", "0.5998597", "0.59978217", "0.5868479", "0.58679044", "0.57720214", "0.5749232", "0.57485163", "0.5740962", "0.5740105", "0.5726386", "0.57119364", "0.57000566", "0.5699773", "0.5678866", "0.56600523", "0.5656981", "0.56503326", "0.5646707", "0.56434345", "0.5640838", "0.56399107", "0.5639793", "0.55838037", "0.5576773", "0.5568684", "0.55632067", "0.5562285", "0.5560987", "0.55539155", "0.5553802", "0.55469024", "0.5545591", "0.55355495", "0.5533844", "0.55235726", "0.55235726", "0.55235726", "0.55235726", "0.5500026", "0.5493543", "0.5492972", "0.5492018", "0.5490727", "0.5485103", "0.5478694", "0.54600286", "0.54591244", "0.5453432", "0.54423285", "0.5437246", "0.5437246", "0.543337", "0.54234004", "0.54202986", "0.5418663", "0.5415525", "0.5411342", "0.54100776", "0.5408347", "0.5407379", "0.53922266", "0.53814125", "0.5376674", "0.53755856", "0.53735566", "0.53634554", "0.53538746", "0.5351096", "0.5347615", "0.5340396", "0.53391814", "0.53244734", "0.5321888", "0.5320955", "0.5312069", "0.5308868", "0.5305502", "0.53047645", "0.5302729", "0.53023654", "0.5296824", "0.5296284", "0.5293152", "0.5292816", "0.52918005", "0.52908707", "0.52837265" ]
0.6465003
2
POST /resource_import_files POST /resource_import_files.json
def create @resource_import_file = ResourceImportFile.new(resource_import_file_params) @resource_import_file.user = current_user respond_to do |format| if @resource_import_file.save if @resource_import_file.mode == 'import' ResourceImportFileJob.perform_later(@resource_import_file) end format.html { redirect_to @resource_import_file, notice: t('import.successfully_created', model: t('activerecord.models.resource_import_file')) } format.json { render json: @resource_import_file, status: :created, location: @resource_import_file } else prepare_options format.html { render action: "new" } format.json { render json: @resource_import_file.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_import_params\n params.permit(:file)\n end", "def import_resources\n # for each resource type, look for a file of measurement data\n Report.plugin_matrix.each do |resource_name, measurements|\n model = Object.const_get((resource_name + 'Resource').camelcase(:upper))\n model.unrestrict_primary_key\n iterate_lines(@directory + resource_name + '.json') do |idx, line|\n print \"\\rImporting #{resource_name}: #{idx}...\"\n\n resource = JSON.parse(line)\n resource.each do |key, value|\n value = update_date(value, @date_offset)\n resource[key] = value unless value.nil?\n end\n model.create(resource)\n end\n model.restrict_primary_key\n print \"Done\\n\"\n import_measurements(measurements)\n end\n end", "def import_params\n params.permit(:import_type, :file)\n end", "def import_params\n params.require(:import).permit(:filename, :imported)\n end", "def import\n \tGrant.import(params[:file])\n respond_to do |format|\n format.html { redirect_to grants_url, notice: 'Successful Upload!' }\n format.json { head :no_content }\n end\n end", "def import\n Worker.import(params[:file])\n redirect_to tenant_workers_path(@tenant), notice: \"Worker list imported.\"\n end", "def file_report(resources)\n resources = format(resources)\n merged_options = options.merge({ resource: resources })\n response = RestClient.post endpoint(\"/file/report\"), merged_options\n parse_response(response)\n end", "def create\n @import = Import.new(import_params)\n\n respond_to do |format|\n if @import.save\n format.html { redirect_to courses_path, notice: 'Datei erfolgreich importiert.' }\n format.json { render action: 'show', status: :created, location: @import }\n else\n format.html { render action: 'new' }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n import_file(@import)\n end", "def create\n @resource_file = ResourceFile.new(params[:resource_file])\n\n respond_to do |format|\n if @resource_file.save\n format.html { redirect_to @resource_file, notice: 'Resource file was successfully created.' }\n format.json { render json: @resource_file, status: :created, location: @resource_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def import\n respond_to do |format|\n begin\n # process upload file, must be xls/xlsx(better, 'cause xls only can upload 65000 rows)\n @asset_categorization = AssetCategorization.import(params[:file])\n format.html { render action: \"new\" }\n rescue => e\n format.html { redirect_to upload_asset_categorizations_url, flash: { error: e.message } } \n end\n end\n end", "def create\n respond_to do |format|\n if @import.save\n\n if @import.file_file_name?\n @import.import\n end\n\n format.html { redirect_to(\"/users/edit#imports\", :notice => I18n.t('backend.actions.success_create', :model => I18n.t('activerecord.capitalized_models.import'))) }\n format.xml { render :xml => @import, :status => :created, :location => @import }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @import.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @uploaded_file = UploadedFile.new(file_name: params[:uploaded_file][:file_name].original_filename)\n respond_to do |format|\n if @uploaded_file.save\n load_imported_items\n format.html { redirect_to root_path, notice: 'Uploaded file was successfully created.' }\n format.json { render :show, status: :created, location: @uploaded_file }\n else\n format.html { render :new }\n format.json { render json: @uploaded_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agent_import_file = AgentImportFile.new(params[:agent_import_file])\n @agent_import_file.user = current_user\n\n respond_to do |format|\n if @agent_import_file.save\n format.html { redirect_to @agent_import_file, :notice => t('controller.successfully_created', :model => t('activerecord.models.agent_import_file')) }\n format.json { render :json => @agent_import_file, :status => :created, :location => @agent_import_file }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @agent_import_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @resource_import_files = ResourceImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def import\n Project.import(params[:file])\n redirect_to students_path, notice: \"Projects imported.\"\n end", "def import_files\n\t\tif(params[:file].present?)\n begin\n\t\t\t\tNcQuestion.build_from_import(params[:file], current_company)\n redirect_to new_audit_nc_question_path, :flash => { :notice => MESSAGES[\"nc_question\"][\"csv_upload\"][\"success\"]}\n rescue\n redirect_to new_audit_nc_question_path, :flash => { :error => MESSAGES[\"csv_upload\"][\"error\"]}\n end\n else\n redirect_to new_audit_nc_question_path , :flash => { :notice => MESSAGES[\"csv_upload\"][\"presence\"]}\n end\n end", "def data_import_params\n params.require(:data_import).permit(:employee_file, :qualification_file, :training_file, :created_by_id)\n end", "def create\n @import = Import.new(import_type: import_params[:import_type], filename: import_params[:file].original_filename)\n if @import.valid_file_type?(import_params)\n @import.save\n @export_json = @import.handle_import_file(@import.import_type, import_params[:file])\n else\n #Handle error message response\n @export_json = 'File format must be a csv'\n end\n respond_to do |format|\n # format.html { redirect_to imports_path(@export_json) }\n format.json {render json: @export_json }\n end\n end", "def import\n Item.import( params[:file])\n redirect_to '/items', notice: 'Items Imported.'\n end", "def create\n @event_import_file = EventImportFile.new(event_import_file_params)\n @event_import_file.user = current_user\n\n respond_to do |format|\n if @event_import_file.save\n if @event_import_file.mode == 'import'\n Resque.enqueue(EventImportFileQueue, @event_import_file.id)\n end\n format.html { redirect_to @event_import_file, notice: t('import.successfully_created', model: t('activerecord.models.event_import_file')) }\n format.json { render json: @event_import_file, status: :created, location: @event_import_file }\n else\n prepare_options\n format.html { render action: \"new\" }\n format.json { render json: @event_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def import\n @obj = Node.create_sub_tree JSON.parse(File.read(params[:file_to_upload].tempfile.path), symbolize_names: true)\n\n respond_to do |format|\n format.html { redirect_to @obj, notice: 'Node was successfully created.' }\n format.json { render json: @obj, status: :created, location: @obj }\n end\n end", "def import\n User.import(params[:file])\n redirect_to users_path\n end", "def create_upload_files(record)\n return unless record.mapper.respond_to?(:files)\n files_to_attach = record.mapper.files\n return [] if files_to_attach.nil? || files_to_attach.empty?\n\n uploaded_file_ids = []\n files_to_attach.each do |filename|\n file = File.open(find_file_path(filename))\n uploaded_file = Hyrax::UploadedFile.create(user: depositor, file: file)\n uploaded_file_ids << uploaded_file.id\n file.close\n end\n uploaded_file_ids\n end", "def request_import\n end", "def import_params\n params.require(:file)\n end", "def create\n\n params['file'].each{|f|\n doc = Community::File.new(community_file_params)\n doc.file = f\n community_file_params[:title].blank? ? doc.title = f.original_filename : doc.title = community_file_params[:title]\n doc.author = current_user.email unless current_user.nil?\n doc.save\n\n file = File.read('public/uploads/community/file/file/' + doc._id.to_s + '/' + doc.file.filename)\n\n doc.import JSON.parse(file)\n } unless params['file'].nil?\n\n respond_to do |format|\n format.js {}\n format.json { head :no_content, status: :created }\n end\n end", "def create\n @inventory_file = InventoryFile.new(inventory_file_params)\n @inventory_file.user = current_user\n\n respond_to do |format|\n if @inventory_file.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.inventory_file'))\n @inventory_file.import\n format.html { redirect_to(@inventory_file) }\n format.json { render :json => @inventory_file, :status => :created, :location => @inventory_file }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @inventory_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def import\n Schedule.import(params[:file])\n redirect_to schedules_path, notice: \"Schedules imported successfully\"\n end", "def create\n @indicator_files = []\n\n params['indicate_file'].each do |f|\n doc = KeyIndicateMap::IndicatorFile.new\n doc.indicate_file = f\n params[:key_indicate_map_indicator_file][:title].blank? ? doc.title = f.original_filename : doc.title = params[:key_indicate_map_indicator_file][:title]\n doc.description = params[:key_indicate_map_indicator_file][:description]\n doc.year = params[:year]\n doc.author = current_user.email\n if !doc.save\n respond_to do |format|\n format.js {render :js=> 'alert(\"' + doc.errors.messages[:year][0] + '\");' }\n format.json { head :no_content, status: :unprocessable_entity }\n end\n return\n end\n @indicator_files << doc\n\n table = read_table_from_file 'public/uploads/key_indicate_map/indicator_file/indicate_file/' + doc._id.to_s + '/' + doc.indicate_file.filename\n @errors = doc.import table, doc.year.to_s\n end unless params['indicate_file'].nil?\n\n respond_to do |format|\n format.js {}\n format.json { head :no_content, status: :created }\n end\n end", "def import\n DispensarySourceProduct.import(params[:file])\n flash[:success] = 'Dispensary Source Products were successfully imported'\n redirect_to dispensary_source_products_admin_path \n end", "def upload\n ActivityLogSeeder.import!(params[:csv_file].tempfile) # background it for large files\n render json: { message: 'Uploaded successfully' }\n end", "def create\n @import = @business.imports.new(import_params)\n \n respond_to do |format|\n if @import.save\n format.html { redirect_to business_import_path(@business, @import), notice: 'Import was successfully created.' }\n format.json { render json: @import, status: :created, location: @import }\n else\n format.html { render action: \"new\" }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n end", "def import \n NewBiosensor.import(params[:file])\n redirect_to root_url, notice: \"Biosensors imported\" \n end", "def create\n @event_import_file = EventImportFile.new(params[:event_import_file])\n @event_import_file.user = current_user\n\n respond_to do |format|\n if @event_import_file.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.event_import_file'))\n format.html { redirect_to(@event_import_file) }\n format.json { render :json => @event_import_file, :status => :created, :location => @event_import_file }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event_import_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def import\n DispensarySource.import(params[:file])\n flash[:success] = 'Dispensary Sources were successfully imported'\n redirect_to dispensary_sources_admin_path \n end", "def import_params\n params.require(:import).permit(:useless, :xmlfile)\n end", "def create\n @sales_import = SalesImport.new(\n document_file_name: sales_import_params[:document].original_filename,\n document_file_size: sales_import_params[:document].size,\n document_content_type: sales_import_params[:document].content_type,\n doc_file_system_path: sales_import_params[:document].path\n )\n respond_to do |format|\n if @sales_import.save \n format.html { redirect_to @sales_import, notice: 'Purchases were successfully imported.' }\n format.json { render action: 'show', status: :created, location: @sales_import }\n else\n format.html { render action: 'new' }\n format.json { render json: @sales_import.errors, status: :unprocessable_entity }\n end\n end\n end", "def client_import_params\n #params.require(:client_import).permit(:account_id,:user_uuid,:file,:user_id,:source)\n end", "def import\n task = Task.create!(name: 'Preparing to import MARCXML records',\n service: Service::LOCAL_STORAGE,\n status: Task::Status::SUBMITTED)\n RecordSource.new.import_async(task)\n rescue => e\n handle_error(e)\n else\n flash['success'] = 'Import will begin momentarily.'\n ensure\n redirect_back fallback_location: tasks_path\n end", "def import!\n import_binary_files\n member_ids = []\n source_metadata_adapter.query_service.find_members(resource: source_resource).each do |member|\n member = self.class.import(source_resource: member, source_metadata_adapter: source_metadata_adapter, change_set_persister: change_set_persister)\n source_change_set.created_file_sets += [member] if member.is_a?(FileSet)\n member_ids << member.id\n end\n # Get rid of non-preserved members.\n source_change_set.try(:member_ids=, member_ids)\n output = change_set_persister.save(change_set: source_change_set)\n output\n end", "def discover_files\n authorize! :create, resource_class\n respond_to do |f|\n f.json do\n render json: file_locator.to_h\n end\n end\n end", "def create\n @inventory_file = InventoryFile.new(inventory_file_params)\n @inventory_file.user = current_user\n\n respond_to do |format|\n if @inventory_file.save\n flash[:notice] = t('controller.successfully_created', model: t('activerecord.models.inventory_file'))\n @inventory_file.import\n format.html { redirect_to(@inventory_file) }\n format.json { render json: @inventory_file, status: :created, location: @inventory_file }\n else\n prepare_options\n format.html { render action: \"new\" }\n format.json { render json: @inventory_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agent_import_file = AgentImportFile.new(agent_import_file_params)\n @agent_import_file.user = current_user\n\n respond_to do |format|\n if @agent_import_file.save\n if @agent_import_file.mode == 'import'\n AgentImportFileJob.perform_later(@agent_import_file)\n end\n format.html { redirect_to @agent_import_file, notice: t('controller.successfully_created', model: t('activerecord.models.agent_import_file')) }\n format.json { render json: @agent_import_file, status: :created, location: @agent_import_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agent_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @import = Import.new(import_params)\n\n respond_to do |format|\n if @import.save\n format.html { redirect_to reconcile_import_path(@import), notice: 'Import was successfully created.' }\n format.json { render :show, status: :created, location: @import }\n else\n format.html { render :new }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n ImportJob.perform_now(@list, import_params.tempfile.path)\n redirect_to @list, notice: 'Import was successfully created.'\n end", "def upload_all_resources\n upload_conformance_resources\n upload_sample_resources\n retry_failed_upload\nend", "def delegate_import\n if Rails.env == 'development'\n # use local file path on development\n csv = open(self.import.import_file.products.path)\n else\n # use s3 file on production\n csv = open_tmp_file(self.import.import_file.products.url)\n end\n\n\n # Send file to fnz module using import api\n response = RestClient.post Fnz::HOST + '/api/v0/imports',\n app_key: Fnz::API_KEY,\n import: {\n object: 'Product',\n padma_id: self.import.account.name,\n upload: csv\n }\n if response.code == 201\n # If import was created successfully create a product importer\n #that will show the status of this import\n remote_import_id = JSON.parse(response.body)['id']\n self.update_attributes(status_url: Fnz::HOST + '/api/v0/imports/' + remote_import_id.to_s)\n end\n end", "def import\n VendorProduct.import(params[:file])\n flash[:success] = 'Vendor Products were successfully imported'\n redirect_to vendor_products_admin_path \n end", "def upload # be ready for when we can accept an actual file directly uploaded instead of copy/paste\n array_of_hashes = Contact.parse_tab_delimited(params[:import])\n \n respond_to do |format|\n if Contact.import(array_of_hashes, @group)\n format.html { redirect_to [@hub, @group], :notice => 'Contacts were successfully imported.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"import\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n file = opml_import_params[:file]\n current_user.import_subscriptions file.tempfile\n rescue => e\n Rails.logger.error \"Error importing OPML for user #{current_user.id} - #{current_user.email}\"\n Rails.logger.error e.message\n Rails.logger.error e.backtrace\n opml_import_job_state = current_user.create_opml_import_job_state state: OpmlImportJobState::ERROR\n ensure\n redirect_to read_path\n end", "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def import\n Trick.import params[:file]\n redirect_to root_path, notice: \"Imported!!\"\n end", "def import\n if params[:location_id]\n @location = Location.find(params[:location_id])\n elsif params[:resource_id]\n @parent_resource = Resource.find(params[:resource_id])\n @location = @parent_resource.location\n end\n\n command = ImportArchivesspaceEadCommand.new(\n params[:files], @parent_resource, @location, current_user,\n request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n redirect_back fallback_location: location_url(@location)\n else\n if command.object.length > 0\n flash['success'] = \"Imported #{command.object.length} resource(s).\"\n else\n flash['notice'] = 'Unable to detect an ArchivesSpace EAD XML file in '\\\n 'any of the uploaded files.'\n end\n redirect_back fallback_location: location_url(@location)\n end\n end", "def users_import_params\n\t\tparams.require(:user).require(:file)\n\tend", "def items_import_params\n # params.require(:items_import).permit(:file_name, :uploaded_by, :uploaded_at, :status)\n params.fetch(:items_import, {}).permit(:file_name, :uploaded_by, :uploaded_at, :status, :file)\n end", "def citation_import_params\n # what kind of files do we want to import?\n params.require(:project).permit(citation_files: [])\n end", "def import_files(obj_pid, obj_identifier, new_obj_id)\n query = \"SELECT id, file_format, uri, size, intellectual_object_id, \" +\n \"identifier, created_at, updated_at FROM generic_files \" +\n \"WHERE intellectual_object_id = ?\"\n if @file_query.nil?\n @file_query = @db.prepare(query)\n end\n result_set = @file_query.execute(obj_pid)\n while true\n files = get_file_batch(result_set, obj_identifier)\n break if files.count == 0\n save_file_batch(files, new_obj_id)\n end\n end", "def upload\n importer = ::PicaReportImporter.new(params.require(:data_file))\n creation_results = importer.evaluation_hashes.map do |eval_attrs|\n key_attrs, other_attrs = split_attributes(eval_attrs)\n\n Evaluation.create_if_needed_and_update(key_attrs, other_attrs)\n end\n\n num_new_records = creation_results.count { |result| result == true }\n num_updated_records = creation_results.length - num_new_records\n\n flash[:notice] = \"#{num_new_records} new evaluations imported. #{num_updated_records} evaluations updated.\"\n redirect_to evaluation_index_path\n end", "def file_rescan(resources)\n resources = format(resources)\n merged_options = options.merge({ resource: resources})\n response = RestClient.post endpoint(\"/file/rescan\"), merged_options\n parse_response(response)\n end", "def save_file_batch(files, new_obj_id)\n url = \"#{@base_url}/api/v2/files/#{new_obj_id}/create_batch\"\n resp = api_post_json(url, files.to_json)\n if resp.code != '201'\n @log.write(\"Error saving #{files.count} files #{files[0]['identifier']}...\\n\")\n @log.write(files.inspect)\n @log.write(\"\\n\" + resp.body + \"\\n\")\n #exit(1)\n end\n end", "def create\n @import = Import.new(params[:import])\n\n respond_to do |format|\n if @import.save\n format.html { redirect_to @import, notice: 'Import was successfully created.' }\n format.json { render json: @import, status: :created, location: @import }\n else\n format.html { render action: \"new\" }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize Import\n @import = Import.new(sanitized_params)\n @import.user = current_user\n @import.institution = current_institution\n begin\n @import.save!\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @import.errors.any? ? @import : e },\n status: :bad_request\n else\n toast!(title: \"Import created\",\n message: \"An import has been created. Click its upload button \"\\\n \"to add files to it.\")\n render \"shared/reload\"\n end\n end", "def update\n respond_to do |format|\n if @resource_import_file.update(resource_import_file_params)\n if @resource_import_file.mode == 'import'\n ResourceImportFileJob.perform_later(@resource_import_file)\n end\n format.html { redirect_to @resource_import_file, notice: t('controller.successfully_updated', model: t('activerecord.models.resource_import_file')) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render action: \"edit\" }\n format.json { render json: @resource_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n return redirect_to(ticket_sales_imports_path, :alert => 'Please choose a will-call list to upload.') if params[:file].blank?\n @import = TicketSalesImport.new(ticketsalesimport_params)\n @import.processed_by = current_user\n return redirect_to(ticket_sales_imports_path(:vendor => @import.vendor), :alert => @import.errors.as_html) unless @import.valid?\n @import.parser.parse or return redirect_to(ticket_sales_imports_path(:vendor => @import.vendor), :alert => @import.errors.as_html)\n @import.save or return redirect_to(ticket_sales_imports_path(:vendor => @import.vendor), :alert => @import.errors.as_html)\n redirect_to edit_ticket_sales_import_path(@import), :alert => (@import.warnings.as_html if !@import.warnings.empty?)\n end", "def import\n Map.import(params[:file])\n end", "def import\n @scenario.import\n respond_to do |format|\n format.html { redirect_to scenarios_url, notice: 'Scenario was successfully imported.' }\n format.json { head :no_content }\n end\n end", "def import\n url = \"#{self.url}/import?auth=#{self.authtoken}\"\n status, response = rest_post( url, nil )\n if ok?( status )\n return status, response['new_count'], response['update_count'], response['duplicate_count'], response['error_count']\n end\n return status, 0, 0, 0, 0\n end", "def import\n if params[:file]\n @users = User.import(params[:file])\n redirect_to root_url(:users => @users), notice: 'Users were successfully imported.'\n else\n redirect_to root_url, notice: 'Please select File to upload'\n end \n end", "def create\n @campaign = Campaign.new(campaign_params)\n\n respond_to do |format|\n if @campaign.save\n @campaign.import(params[:file], params[:number_of_rows])\n format.html { redirect_to campaigns_url, notice: 'Campaign was successfully 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 files(trading_partner_id, filename)\n scope 'default'\n url = URI.parse(@api_url + '/files/')\n\n File.open(filename) do |f|\n req = Net::HTTP::Post::Multipart.new url.path,\n 'file' => UploadIO.new(f, 'application/EDI-X12', filename),\n 'trading_partner_id' => trading_partner_id\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 end\n\n JSON.parse(@response.body)\n end", "def csv_import_params\n params.require(:csv_import).permit(:filename, :imported)\n end", "def create_data_file(resource_id)\n filename = Faker::File.file_name(dir: '', directory_separator: '')\n StashEngine::DataFile.create(\n {\n original_filename: filename,\n upload_file_name: filename,\n resource_id: resource_id,\n upload_content_type: 'text/plain',\n upload_file_size: 31_726,\n status_code: 200,\n file_state: 'created'\n }\n )\n end", "def csv_import_params\n params.require(:csv_import).permit(:file, :processor)\n end", "def create\n files = params[:files]\n\n files.each do |file|\n\n filename = file.original_filename\n\n # Rack uploads have `#tempfiles` and test uploads are Tempfile objects. More\n # investigation required.\n file = file.tempfile if file.respond_to?(:tempfile)\n\n UploadStore.create(\n :key => filename,\n :body => file,\n :public => true\n )\n end\n\n render json: {status: 'success'}\n end", "def import\n Book.import(params[:file])\n redirect_to root_url, notice: \"Books Imported!\"\n end", "def productimport_params\n params.require(:productimport).permit(:action, :csv)\n end", "def index\n @resource_import_file = ResourceImportFile.find_by(id: params[:resource_import_file_id])\n if @resource_import_file\n if request.format.text?\n @resource_import_results = @resource_import_file.resource_import_results\n else\n @resource_import_results = @resource_import_file.resource_import_results.page(params[:page])\n end\n else\n @resource_import_results = ResourceImportResult.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.text\n end\n end", "def create\n @import = Import.new(import_params)\n\n respond_to do |format|\n if @import.save\n format.html { redirect_to imports_url, notice: 'Import was successfully created.' }\n format.json { render json: @import, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tif ResourceItem.exists?(google_doc_id: params[:resource_item]['google_doc_id'])\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html {redirect_to import_google_fellow_resource_items_path, notice: 'Resource existed'}\n\t\t\tend\n\t\telse\n\t \t@resource_item = ResourceItem.create(resource_item_params)\n\t \tgon.resource_item = @resource_item\n\n\t\t respond_to do |format|\n\t\t if @resource_item.valid?\n\t\t format.html { redirect_to @resource_item, notice: 'Resource item was successfully created.' }\n\t\t if Rails.env.production?\n\t\t \tRestClient.patch(\"https://lensshift-drive.firebaseio.com/resources/#{@resource_item.google_doc_id}.json\", @resource_item.to_json)\n\t\t \tend\n\t\t format.json { render :show, status: :created, location: @resource_item }\n\t\t else\n\t\t format.html { render :new }\n\t\t format.json { render json: @resource_item.errors, status: :unprocessable_entity }\n\t\t end\n\t\t end\n\t\tend\n\tend", "def import_params\n params.require(:import).permit(:klass_action, :package, :department_id)\n end", "def create\n uploaded_io = params[:file]\n if !uploaded_io.blank?\n extension = uploaded_io.original_filename.split('.')\n filename = \"#{Time.now.strftime('%Y%m%d%H%M%S')}.#{extension[-1]}\"\n filepath = \"#{PIC_PATH}/teachResources/#{filename}\"\n File.open(filepath, 'wb') do |file|\n file.write(uploaded_io.read)\n end\n params[:lab_teach_resource].merge!(:file=>\"/teachResources/#{filename}\")\n end\n params[:lab_teach_resource].merge!(:author_id=>@user.id)\n params[:lab_teach_resource].merge!(:status=>'0')\n @lab_teach_resource = LabTeachResource.new(params[:lab_teach_resource])\n\n respond_to do |format|\n if @lab_teach_resource.save\n format.html { redirect_to @lab_teach_resource, notice: 'Lab teach resource was successfully created.' }\n format.json { render json: @lab_teach_resource, status: :created, location: @lab_teach_resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab_teach_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def import!\n import_binary_files\n member_ids = []\n source_metadata_adapter.query_service.find_members(resource: source_resource).each do |member|\n member = self.class.import(source_resource: member, source_metadata_adapter: source_metadata_adapter, change_set_persister: change_set_persister)\n # Set this property so derivatives will run, acts like a FileAppender.\n source_change_set.created_file_sets += [member] if member.is_a?(FileSet)\n member_ids << member.id\n end\n # Get rid of non-preserved members. If they're not preserved, it was\n # probably a bug - e.g. page 3 didn't make it into preservation.\n source_change_set.try(:member_ids=, member_ids)\n output = change_set_persister.save(change_set: source_change_set, external_resource: true)\n output\n end", "def create_import_task_by_file\n task_result = UserTask.import_task_by_excel(params,current_user.id)\n responds_to_parent do\n render :update do |page|\n if task_result[2].blank?\n flash[:notice] = \"#{task_result[1]} tasks are successfully save in total tasks #{task_result[0]}\"\n page.redirect_to wfm_user_tasks_path\n else\n page << \"show_error_full_msg('error_messages','#{task_result[2].flatten.join('<br>')}','message_error_div');\"\n end\n end\n end\n end", "def delegate_import\n if Rails.env == 'development'\n # use local file path on development\n csv = open(self.import.import_file.time_slots.path)\n else\n # use s3 file on production\n csv = open_tmp_file(self.import.import_file.time_slots.url)\n end\n\n\n # Send file to attendance module using import api\n # The last two headers are: vacancy (it doesn't matter) and school_id (already imported)\n response = RestClient.post Attendance::HOST + '/api/v0/imports',\n app_key: Attendance::API_KEY,\n account_name: self.import.account.name,\n import: {\n object: 'TimeSlot',\n csv_file: csv,\n headers: headers\n }\n if response.code == 201\n # If import was created successfully create a time_slot importer\n #that will show the status of this import\n remote_import_id = JSON.parse(response.body)['id']\n self.update_attributes(status_url: Attendance::HOST + '/api/v0/imports/' + remote_import_id.to_s)\n end\n end", "def process_file\n instance_variable_get(:@fields).keys.each do |locale|\n request = Request.new(\n \"/#{space.id}/assets/#{id}/files/#{locale}/process\",\n {},\n nil,\n version: sys[:version]\n )\n request.put\n end\n sys[:version] += 1\n self\n end", "def create\n @incidentfile = Incidentfile.new(incidentfile_params)\n\n respond_to do |format|\n if @incidentfile.save\n format.html { redirect_to @incidentfile, notice: 'Incidentfile was successfully created.' }\n format.json { render :show, status: :created, location: @incidentfile }\n else\n format.html { render :new }\n format.json { render json: @incidentfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def import\n filename = CsvUploadService.call(file: file, user: current_user)\n correlation_id = SecureRandom.uuid\n job_name = RegisterCheckerApi.register_job(filename, correlation_id)\n save_details_to_session(job_name, filename, correlation_id)\n redirect_to processing_upload_index_path\n end", "def upload_file(item_file)\n upload_response = @server.upload(item_file.file(item_file.metadata_full_path))\n json = JSON.parse(upload_response.body)\n json['files'].map { |f| f['id'] }\n end", "def import\n ExportImport::Csv::Product.new.import(params[:file])\n redirect_to refinery.ironman_admin_products_path, notice: \"Products imported.\"\n rescue => e\n redirect_to refinery.ironman_admin_products_path, alert: \"There was an error while importing products: #{e.message}.\"\n end", "def bulk_import!\n remote_filenames = [ENV.fetch('BULK_IEP_IMPORT_TARGET')]\n\n import_ieps!(remote_filenames)\n end", "def create\n @treq = Treq.new(params[:treq])\n \n respond_to do |format|\n if @treq.save\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n TreqNotifier.submit_treq(@treq).deliver\n format.html { redirect_to @treq, notice: 'Treq was successfully created.' }\n format.json { render json: @treq, status: :created, location: @treq }\n else\n format.html { render action: \"new\", alert: \"Test Requset has been submitted.\"}\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_file\n return { success: false } unless can_upload?\n data, errors = build_data_array\n if errors.any? # save errors to model id any\n { success: false, error_messages_text: errors.flatten.join(\"\\n\") }\n else\n if self.class.model_class.import(data, recursive: true, validate: false) # bulk insert\n { success: true }\n else\n { success: false }# unknown error happened\n end\n end\n end", "def create_course_import_request(org_unit_id, file_path, callback_url = '')\n path = \"/d2l/le/#{$le_ver}/import/#{org_unit_id}/imports/\"\n path += \"?callbackUrl=#{callback_url}\" if callback_url != ''\n # TODO: (SCHEMA) Find out WTH a 'course package' entails as far as standards.\n _course_package_upload(path, file_path, \"POST\")\n # RETURNS: Parsed CreateImportJobResponse JSON block.\nend", "def create\n imported_file = params[:csv_file][:file]\n @csv_file = CsvFile.new(params[:csv_file])\n @csv_file.name = params[:csv_file][:file].original_filename rescue nil\n\n respond_to do |format|\n if @csv_file.save\n format.html { redirect_to @csv_file, notice: 'Csv file was successfully created.' }\n format.json { render json: @csv_file, status: :created, location: @csv_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @csv_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def attach_files(files)\n # BY RIK\n files = [files] unless(files.is_a?(Array))\n files.each do |file|\n file.to_options!\n filename = file[:url]\n assit(filename)\n options = file[:options] || {}\n records = TaliaCore::DataTypes::FileRecord.create_from_url(filename, options)\n records.each {|rec| self.data_records << rec}\n end\n end", "def run\n check_files_exist\n\n file_metadata = UploadFilesMetadataBuilder.build(files: files, mime_types: mime_types, basepath: basepath)\n upload_responses = UploadFiles.upload(file_metadata: file_metadata,\n filepath_map: filepath_map,\n logger: logger,\n connection: connection)\n metadata_builder = MetadataBuilder.new(metadata: metadata,\n grouping_strategy: grouping_strategy,\n file_set_type_strategy: file_set_type_strategy,\n logger: logger)\n request = metadata_builder.with_uploads(upload_responses)\n model = Cocina::Models.build_request(request.as_json.with_indifferent_access)\n CreateResource.run(accession: @accession,\n priority: @priority,\n assign_doi: @assign_doi,\n metadata: model,\n logger: logger,\n connection: connection)\n end", "def process_fnz_imports\n ProductImporter.create(import: @import)\n SaleImporter.create(import: @import)\n MembershipImporter.create(import: @import)\n InstallmentImporter.create(import: @import)\n end", "def import\n Student.import(params[:file], params[:course][:id])\n @course = Course.find_by_id(params[:course][:id])\n @students = @course.students\n # redirect_to show_students_url, notice: \"Students imported successfully.\"\n end", "def import(new_attributes={})\n raise ArgumentError unless self.template_releases.exists?\n #only released template is importable\n #create theme record\n new_theme = self.dup\n #set resource to site native\n new_theme.title = \"Imported \"+ new_theme.title\n new_theme.attributes = new_attributes\n new_theme.site_id = SpreeTheme.site_class.current.id\n new_theme.save!\n if new_theme.template_files.present?\n new_theme.template_files.each{|file|\n original_file = new_attributes[:template_files].first\nRails.logger.debug \"#{file.page_layout_id},#{original_file.page_layout_id},#{file.object_id},#{original_file.object_id},#{file.inspect}, #{original_file.inspect}\" \n new_theme.assign_resource( file, PageLayout.find(file.page_layout_id))\n } \n end\n new_theme\n end", "def create\n @import_results = TextImporter.new.import_from_file(file.open)\n\n respond_to do |format|\n if @import_results\n format.html { redirect_to imported_purchases_url(@import_results.purchases.first, @import_results.purchases.last),\n notice: 'Purchases successfully imported.' }\n format.json { render action: 'show', status: :created, location: @import_results.total }\n else\n format.html { render action: 'new' }\n format.json { render json: @import_result.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.66359407", "0.6210905", "0.61485267", "0.61209726", "0.60407674", "0.60240185", "0.6018459", "0.5925431", "0.59234285", "0.58760333", "0.58420527", "0.5828545", "0.5824298", "0.58238655", "0.5813659", "0.58081394", "0.57994705", "0.5795284", "0.5773734", "0.5766934", "0.5757188", "0.57565296", "0.57439125", "0.5728779", "0.57264745", "0.5711755", "0.5692044", "0.56821066", "0.56721795", "0.56708825", "0.56537634", "0.5645142", "0.5635636", "0.56329", "0.56315523", "0.5630379", "0.56230295", "0.5607775", "0.56036997", "0.5603621", "0.5583759", "0.55736136", "0.5572317", "0.5551067", "0.55478084", "0.5542818", "0.5534595", "0.5533808", "0.5522405", "0.55129844", "0.5493742", "0.54854304", "0.54748654", "0.5468236", "0.544958", "0.5419236", "0.5414805", "0.5410532", "0.53961617", "0.5394155", "0.5378969", "0.5378825", "0.5375183", "0.5366538", "0.53662825", "0.53604114", "0.53521436", "0.5349153", "0.53459764", "0.5340833", "0.5337676", "0.5330124", "0.5311171", "0.53105664", "0.53012854", "0.52988493", "0.5296081", "0.5282979", "0.5274524", "0.5260132", "0.5252905", "0.5249951", "0.5243815", "0.52419746", "0.5241669", "0.52408683", "0.5233957", "0.5216351", "0.52150434", "0.5213956", "0.52116865", "0.5208041", "0.520511", "0.52017426", "0.5199354", "0.51982576", "0.518034", "0.51765764", "0.51731884", "0.51719195" ]
0.68423814
0
PUT /resource_import_files/1 PUT /resource_import_files/1.json
def update respond_to do |format| if @resource_import_file.update(resource_import_file_params) if @resource_import_file.mode == 'import' ResourceImportFileJob.perform_later(@resource_import_file) end format.html { redirect_to @resource_import_file, notice: t('controller.successfully_updated', model: t('activerecord.models.resource_import_file')) } format.json { head :no_content } else prepare_options format.html { render action: "edit" } format.json { render json: @resource_import_file.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @resource_import_file = ResourceImportFile.new(resource_import_file_params)\n @resource_import_file.user = current_user\n\n respond_to do |format|\n if @resource_import_file.save\n if @resource_import_file.mode == 'import'\n ResourceImportFileJob.perform_later(@resource_import_file)\n end\n format.html { redirect_to @resource_import_file, notice: t('import.successfully_created', model: t('activerecord.models.resource_import_file')) }\n format.json { render json: @resource_import_file, status: :created, location: @resource_import_file }\n else\n prepare_options\n format.html { render action: \"new\" }\n format.json { render json: @resource_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event_import_file.update_attributes(event_import_file_params)\n if @event_import_file.mode == 'import'\n Resque.enqueue(EventImportFileQueue, @event_import_file.id)\n end\n format.html { redirect_to @event_import_file, notice: t('controller.successfully_updated', model: t('activerecord.models.event_import_file')) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render action: \"edit\" }\n format.json { render json: @event_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @agent_import_file.update_attributes(params[:agent_import_file])\n format.html { redirect_to @agent_import_file, :notice => t('controller.successfully_updated', :model => t('activerecord.models.agent_import_file')) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @agent_import_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event_import_file.update_attributes(params[:event_import_file])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.event_import_file'))\n format.html { redirect_to(@event_import_file) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event_import_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @agent_import_file.update(agent_import_file_params)\n if @agent_import_file.mode == 'import'\n AgentImportFileJob.perform_later(@agent_import_file)\n end\n format.html { redirect_to @agent_import_file, notice: t('controller.successfully_updated', model: t('activerecord.models.agent_import_file')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agent_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def batch_import_params\n params.permit(:file)\n end", "def update\n @resource_file = ResourceFile.find(params[:id])\n\n respond_to do |format|\n if @resource_file.update_attributes(params[:resource_file])\n format.html { redirect_to @resource_file, notice: 'Resource file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @import.update(import_params)\n format.html { redirect_to @import, notice: 'Datei erfolgreich importiert.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @import = @business.imports.find(params[:id])\n\n respond_to do |format|\n if @import.update_attributes(import_params || {})\n format.html { redirect_to business_import_path(@business, @import), notice: 'Import was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n end", "def import_params\n params.require(:import).permit(:filename, :imported)\n end", "def update\n respond_to do |format|\n if @import.update(import_params)\n format.html { redirect_to reconcile_import(@import), notice: 'Import was successfully updated.' }\n format.json { render :show, status: :ok, location: @import }\n else\n format.html { render :edit }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @import = Import.find(params[:id])\n\n respond_to do |format|\n if @import.update_attributes(params[:import])\n format.html { redirect_to @import, notice: 'Import was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @import = Import.find(params[:id])\n\n respond_to do |format|\n if @import.update_attributes(params[:import])\n format.html { redirect_to @import, notice: 'Import was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n end", "def import_params\n params.permit(:import_type, :file)\n end", "def update\n respond_to do |format|\n if @import.update(import_params)\n format.html { redirect_to @import, notice: 'Import was successfully updated.' }\n format.json { render :show, status: :ok, location: @import }\n else\n format.html { render :edit }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n end", "def import\n \tGrant.import(params[:file])\n respond_to do |format|\n format.html { redirect_to grants_url, notice: 'Successful Upload!' }\n format.json { head :no_content }\n end\n end", "def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend", "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def update\n uploaded_io = params[:file]\n if !uploaded_io.blank?\n extension=uploaded_io.original_filename.split('.')\n filename= \"#{Time.now.strftime('%Y%m%d%H%M%S')}.#{extension[-1]}\"\n File.open(Rails.root.join('public', 'upload','teachResources',filename), 'wb') do |file|\n file.write(uploaded_io.read)\n end\n params[:lab_teach_resource].merge!(:file=>\"/upload/teachResourcs/#{filename}\")\n end\n @lab_teach_resource = LabTeachResource.find(params[:id])\n\n respond_to do |format|\n if @lab_teach_resource.update_attributes(params[:lab_teach_resource])\n format.html { redirect_to @lab_teach_resource, notice: 'Lab teach resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_teach_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_files(resource)\n updated = files.select { |file| file.is_a?(Hash) }.map do |file|\n node = resource.file_metadata.select { |x| x.id.to_s == file.keys.first.to_s }.first\n node.updated_at = Time.current\n # Uses the UploadDecorator to abstract the interface for the File Object during persistence by the storage_adapter\n file_wrapper = UploadDecorator.new(file.values.first, node.original_filename.first)\n\n # Ensure that errors for one file are logged but do not block updates for others\n begin\n storage_adapter.upload(file: file_wrapper, original_filename: file_wrapper.original_filename, resource: node)\n node.label = file.values.first.original_filename\n node.mime_type = file.values.first.content_type\n node\n rescue StandardError => error\n Valkyrie.logger.error \"#{self.class}: Failed to update the file #{file_wrapper.original_filename} for #{node.id}: #{error}\"\n # Ensure that this file is not created instead of updated\n @files.delete_if { |updated_file| updated_file.values.first.original_filename == file_wrapper.original_filename }\n nil\n end\n end\n\n updated.compact\n end", "def update\n @import_def = ImportDef.find(params[:id])\n\n respond_to do |format|\n if @import_def.update_attributes(params[:import_def])\n format.html { redirect_to @import_def, notice: 'Import def was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @import_def.errors, status: :unprocessable_entity }\n end\n end\n end", "def process_file\n instance_variable_get(:@fields).keys.each do |locale|\n request = Request.new(\n \"/#{space.id}/assets/#{id}/files/#{locale}/process\",\n {},\n nil,\n version: sys[:version]\n )\n request.put\n end\n sys[:version] += 1\n self\n end", "def import\n Item.import( params[:file])\n redirect_to '/items', notice: 'Items Imported.'\n end", "def update\n respond_to do |format|\n if @import.update_attributes(params[:import])\n format.html { redirect_to(@import,\n :notice => I18n.t('backend.actions.success_update',\n :model => I18n.t('activerecord.capitalized_models.import'))) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @import.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @import.save\n\n if @import.file_file_name?\n @import.import\n end\n\n format.html { redirect_to(\"/users/edit#imports\", :notice => I18n.t('backend.actions.success_create', :model => I18n.t('activerecord.capitalized_models.import'))) }\n format.xml { render :xml => @import, :status => :created, :location => @import }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @import.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_import\n @import = Import.find(params[:id])\n end", "def import\n Schedule.import(params[:file])\n redirect_to schedules_path, notice: \"Schedules imported successfully\"\n end", "def update\n file = params[:file_name]\n @processor = Import::VehicleImporter.new(current_account, current_user)\n @processor.process(file)\n end", "def import\n log.debug(\"Importing from #{@location}\")\n id = File.basename(@location)\n record = storage_engine.get_by_id(id)\n raise MainControllerError, \"Cannot import a non-exist record\" if record.nil?\n record.whitelist = file_rw_manager.read(\"#{@location}/whitelist\")\n record.blacklist = file_rw_manager.read(\"#{@location}/blacklist\")\n record.qual = \"true\"\n record.auditor = @auditor\n storage_engine.update(record)\n log.info(\"Qualified record #{id} has been successfully imported\")\n end", "def import\n Project.import(params[:file])\n redirect_to students_path, notice: \"Projects imported.\"\n end", "def update!(**args)\n @attachment_upload_token = args[:attachment_upload_token] if args.key?(:attachment_upload_token)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end", "def create\n @agent_import_file = AgentImportFile.new(params[:agent_import_file])\n @agent_import_file.user = current_user\n\n respond_to do |format|\n if @agent_import_file.save\n format.html { redirect_to @agent_import_file, :notice => t('controller.successfully_created', :model => t('activerecord.models.agent_import_file')) }\n format.json { render :json => @agent_import_file, :status => :created, :location => @agent_import_file }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @agent_import_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @import = Import.new(import_params)\n\n respond_to do |format|\n if @import.save\n format.html { redirect_to courses_path, notice: 'Datei erfolgreich importiert.' }\n format.json { render action: 'show', status: :created, location: @import }\n else\n format.html { render action: 'new' }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n import_file(@import)\n end", "def import \n NewBiosensor.import(params[:file])\n redirect_to root_url, notice: \"Biosensors imported\" \n end", "def import!\n import_binary_files\n member_ids = []\n source_metadata_adapter.query_service.find_members(resource: source_resource).each do |member|\n member = self.class.import(source_resource: member, source_metadata_adapter: source_metadata_adapter, change_set_persister: change_set_persister)\n source_change_set.created_file_sets += [member] if member.is_a?(FileSet)\n member_ids << member.id\n end\n # Get rid of non-preserved members.\n source_change_set.try(:member_ids=, member_ids)\n output = change_set_persister.save(change_set: source_change_set)\n output\n end", "def import_resources\n # for each resource type, look for a file of measurement data\n Report.plugin_matrix.each do |resource_name, measurements|\n model = Object.const_get((resource_name + 'Resource').camelcase(:upper))\n model.unrestrict_primary_key\n iterate_lines(@directory + resource_name + '.json') do |idx, line|\n print \"\\rImporting #{resource_name}: #{idx}...\"\n\n resource = JSON.parse(line)\n resource.each do |key, value|\n value = update_date(value, @date_offset)\n resource[key] = value unless value.nil?\n end\n model.create(resource)\n end\n model.restrict_primary_key\n print \"Done\\n\"\n import_measurements(measurements)\n end\n end", "def set_import\n @import = Import.find(params[:id])\n end", "def set_import\n @import = Import.find(params[:id])\n end", "def set_import\n @import = Import.find(params[:id])\n end", "def client_import_params\n #params.require(:client_import).permit(:account_id,:user_uuid,:file,:user_id,:source)\n end", "def set_incidentfile\n @incidentfile = Incidentfile.find(params[:id])\n end", "def update\n @product_import = ProductImport.find(params[:id])\n\n respond_to do |format|\n if @product_import.update_attributes(params[:product_import])\n format.html { redirect_to @product_import, :notice => 'Product import was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product_import.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @inventory_file = InventoryFile.new(inventory_file_params)\n @inventory_file.user = current_user\n\n respond_to do |format|\n if @inventory_file.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.inventory_file'))\n @inventory_file.import\n format.html { redirect_to(@inventory_file) }\n format.json { render :json => @inventory_file, :status => :created, :location => @inventory_file }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @inventory_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @upload = Upload.new(params[:upload])\n @upload.resource_id = @resource.id\n @upload.save\n\n @resource.attachment = @upload\n @resource.save\n \n respond_to do |format|\n if @upload.update_attributes(params[:upload]) && @resource.update_attributes(params[:resource])\n format.js\n end\n end \n end", "def import\n DispensarySourceProduct.import(params[:file])\n flash[:success] = 'Dispensary Source Products were successfully imported'\n redirect_to dispensary_source_products_admin_path \n end", "def create\n @resource_file = ResourceFile.new(params[:resource_file])\n\n respond_to do |format|\n if @resource_file.save\n format.html { redirect_to @resource_file, notice: 'Resource file was successfully created.' }\n format.json { render json: @resource_file, status: :created, location: @resource_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event_import_file = EventImportFile.new(params[:event_import_file])\n @event_import_file.user = current_user\n\n respond_to do |format|\n if @event_import_file.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.event_import_file'))\n format.html { redirect_to(@event_import_file) }\n format.json { render :json => @event_import_file, :status => :created, :location => @event_import_file }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event_import_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def upload_file(item_file)\n upload_response = @server.upload(item_file.file(item_file.metadata_full_path))\n json = JSON.parse(upload_response.body)\n json['files'].map { |f| f['id'] }\n end", "def import\n DispensarySource.import(params[:file])\n flash[:success] = 'Dispensary Sources were successfully imported'\n redirect_to dispensary_sources_admin_path \n end", "def update\n @software = Software.find(params[:id])\n if params[:datafile]\n r = Resource.new\n r.original_filename = params[:datafile].original_filename\n r.file_type = params[:file_type]\n r.ext = File.extname(r.original_filename)\n r.save\n directory = \"public/upload/\" + r.file_type\n path = File.join(directory, r.id.to_s + r.ext)\n \n File.open(path, \"wb\") { |f| f.write(params[:datafile].read) }\n @software.resources << r\n # render :text => \"File has been uploaded successfully \"\n end\n respond_to do |format|\n if @software.update_attributes(params[:software])\n format.html { redirect_to(admin_software_path(@software), :notice => 'Software was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @software.errors, :status => :unprocessable_entity }\n end\n end\n \n end", "def update\n @event_subscription.update(event_subscription_params)\n @event_subscription.save\n\n file_params.each do |requirement|\n if(requirement[\"doc\"])\n requirement.symbolize_keys\n requirement[:doc].symbolize_keys\n path = \"data:#{requirement[:doc][:filetype]};base64, #{requirement[:doc][:base64]}\"\n Document.update(id: requirement[:doc][:id],\n user_id: @event_subscription.user_id,\n requirement_id: requirement[:id],\n state: \"pending_review\",\n path: path\n )\n end\n end\n render json: @event_subscription, status: :updated\n end", "def update\n upload = params.require(:file)\n handler = setup_handler(upload)\n\n if handler.valid?\n handler.call\n render json: {}, status: 202\n else\n render json: { errors: handler.errors }, status: 422\n end\n end", "def delegate_import\n if Rails.env == 'development'\n # use local file path on development\n csv = open(self.import.import_file.products.path)\n else\n # use s3 file on production\n csv = open_tmp_file(self.import.import_file.products.url)\n end\n\n\n # Send file to fnz module using import api\n response = RestClient.post Fnz::HOST + '/api/v0/imports',\n app_key: Fnz::API_KEY,\n import: {\n object: 'Product',\n padma_id: self.import.account.name,\n upload: csv\n }\n if response.code == 201\n # If import was created successfully create a product importer\n #that will show the status of this import\n remote_import_id = JSON.parse(response.body)['id']\n self.update_attributes(status_url: Fnz::HOST + '/api/v0/imports/' + remote_import_id.to_s)\n end\n end", "def update\n description = file_params[:description] || @file.description\n\n raise ApiError, \"Can't rename a file.\" unless @file.rename(file_params[:name], description)\n\n render json: @file, adapter: :json\n end", "def create\n @event_import_file = EventImportFile.new(event_import_file_params)\n @event_import_file.user = current_user\n\n respond_to do |format|\n if @event_import_file.save\n if @event_import_file.mode == 'import'\n Resque.enqueue(EventImportFileQueue, @event_import_file.id)\n end\n format.html { redirect_to @event_import_file, notice: t('import.successfully_created', model: t('activerecord.models.event_import_file')) }\n format.json { render json: @event_import_file, status: :created, location: @event_import_file }\n else\n prepare_options\n format.html { render action: \"new\" }\n format.json { render json: @event_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def import\n Worker.import(params[:file])\n redirect_to tenant_workers_path(@tenant), notice: \"Worker list imported.\"\n end", "def create\n @import = Import.new(import_params)\n\n respond_to do |format|\n if @import.save\n format.html { redirect_to reconcile_import_path(@import), notice: 'Import was successfully created.' }\n format.json { render :show, status: :created, location: @import }\n else\n format.html { render :new }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @csv_import.update(csv_import_params)\n format.html { redirect_to @csv_import, notice: 'Csv import was successfully updated.' }\n format.json { render :show, status: :ok, location: @csv_import }\n else\n format.html { render :edit }\n format.json { render json: @csv_import.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @resource = Resource.find(params[:id])\n @resource.campaign_id = session[:campaign_id]\n\n respond_to do |format|\n aresource = Resource.find(params[:id])\n if @resource.update_attributes(params[:resource])\n\n #borra archivo anterir\n if aresource.file != @resource.file\n File.unlink(aresource.file) if File.exists? aresource.file\n end\n\n format.html { redirect_to @resource, :notice => 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def import\n url = \"#{self.url}/import?auth=#{self.authtoken}\"\n status, response = rest_post( url, nil )\n if ok?( status )\n return status, response['new_count'], response['update_count'], response['duplicate_count'], response['error_count']\n end\n return status, 0, 0, 0, 0\n end", "def create\n\n params['file'].each{|f|\n doc = Community::File.new(community_file_params)\n doc.file = f\n community_file_params[:title].blank? ? doc.title = f.original_filename : doc.title = community_file_params[:title]\n doc.author = current_user.email unless current_user.nil?\n doc.save\n\n file = File.read('public/uploads/community/file/file/' + doc._id.to_s + '/' + doc.file.filename)\n\n doc.import JSON.parse(file)\n } unless params['file'].nil?\n\n respond_to do |format|\n format.js {}\n format.json { head :no_content, status: :created }\n end\n end", "def update\n @importer = Importer.find(params[:id])\n\n respond_to do |format|\n if @importer.update_attributes(params[:importer])\n format.html { redirect_to @importer, notice: 'Importer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @importer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uploaded_file = UploadedFile.new(file_name: params[:uploaded_file][:file_name].original_filename)\n respond_to do |format|\n if @uploaded_file.save\n load_imported_items\n format.html { redirect_to root_path, notice: 'Uploaded file was successfully created.' }\n format.json { render :show, status: :created, location: @uploaded_file }\n else\n format.html { render :new }\n format.json { render json: @uploaded_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sales_import = SalesImport.new(\n document_file_name: sales_import_params[:document].original_filename,\n document_file_size: sales_import_params[:document].size,\n document_content_type: sales_import_params[:document].content_type,\n doc_file_system_path: sales_import_params[:document].path\n )\n respond_to do |format|\n if @sales_import.save \n format.html { redirect_to @sales_import, notice: 'Purchases were successfully imported.' }\n format.json { render action: 'show', status: :created, location: @sales_import }\n else\n format.html { render action: 'new' }\n format.json { render json: @sales_import.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload\n ActivityLogSeeder.import!(params[:csv_file].tempfile) # background it for large files\n render json: { message: 'Uploaded successfully' }\n end", "def update\n respond_to do |format|\n if @incidentfile.update(incidentfile_params)\n format.html { redirect_to @incidentfile, notice: 'Incidentfile was successfully updated.' }\n format.json { render :show, status: :ok, location: @incidentfile }\n else\n format.html { render :edit }\n format.json { render json: @incidentfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def import_files(obj_pid, obj_identifier, new_obj_id)\n query = \"SELECT id, file_format, uri, size, intellectual_object_id, \" +\n \"identifier, created_at, updated_at FROM generic_files \" +\n \"WHERE intellectual_object_id = ?\"\n if @file_query.nil?\n @file_query = @db.prepare(query)\n end\n result_set = @file_query.execute(obj_pid)\n while true\n files = get_file_batch(result_set, obj_identifier)\n break if files.count == 0\n save_file_batch(files, new_obj_id)\n end\n end", "def import\n User.import(params[:file])\n redirect_to users_path\n end", "def create\n @inventory_file = InventoryFile.new(inventory_file_params)\n @inventory_file.user = current_user\n\n respond_to do |format|\n if @inventory_file.save\n flash[:notice] = t('controller.successfully_created', model: t('activerecord.models.inventory_file'))\n @inventory_file.import\n format.html { redirect_to(@inventory_file) }\n format.json { render json: @inventory_file, status: :created, location: @inventory_file }\n else\n prepare_options\n format.html { render action: \"new\" }\n format.json { render json: @inventory_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def delegate_import\n if Rails.env == 'development'\n # use local file path on development\n csv = open(self.import.import_file.time_slots.path)\n else\n # use s3 file on production\n csv = open_tmp_file(self.import.import_file.time_slots.url)\n end\n\n\n # Send file to attendance module using import api\n # The last two headers are: vacancy (it doesn't matter) and school_id (already imported)\n response = RestClient.post Attendance::HOST + '/api/v0/imports',\n app_key: Attendance::API_KEY,\n account_name: self.import.account.name,\n import: {\n object: 'TimeSlot',\n csv_file: csv,\n headers: headers\n }\n if response.code == 201\n # If import was created successfully create a time_slot importer\n #that will show the status of this import\n remote_import_id = JSON.parse(response.body)['id']\n self.update_attributes(status_url: Attendance::HOST + '/api/v0/imports/' + remote_import_id.to_s)\n end\n end", "def data_import_params\n params.require(:data_import).permit(:employee_file, :qualification_file, :training_file, :created_by_id)\n end", "def import\n @obj = Node.create_sub_tree JSON.parse(File.read(params[:file_to_upload].tempfile.path), symbolize_names: true)\n\n respond_to do |format|\n format.html { redirect_to @obj, notice: 'Node was successfully created.' }\n format.json { render json: @obj, status: :created, location: @obj }\n end\n end", "def set_imports_import\n @imports_import = Imports::Import.find(params[:imports_import_id])\n end", "def update\n @indexed_file = IndexedFile.find(params[:id])\n\n respond_to do |format|\n if @indexed_file.update_attributes(params[:indexed_file])\n format.html { redirect_to @indexed_file, notice: 'Indexed file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @indexed_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n\n @resource = Resource.find(params[:id])\n @resource.type = 'Resource'\n @type = 'file' if params[:type] == 'file'\n\n end", "def import\n VendorProduct.import(params[:file])\n flash[:success] = 'Vendor Products were successfully imported'\n redirect_to vendor_products_admin_path \n end", "def update\n @super_file = SuperFile.find(params[:id])\n\n respond_to do |format|\n if @super_file.update_attributes(params[:super_file])\n format.html { redirect_to @super_file, notice: 'Super file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @super_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question_template = QuestionTemplate.find(params[:id])\n params[:files].each_pair do |field_name, file|\n unless file.original_filename.empty?\n @question_template.send \"#{field_name}=\", file.original_filename\n end\n end\n respond_to do |format|\n if @question_template.update_attributes(params[:question_template])\n @question_template.upload_files(params[:files].values)\n format.html { redirect_to [:admin,@question_template], notice: 'Question template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @import = Import.new(import_type: import_params[:import_type], filename: import_params[:file].original_filename)\n if @import.valid_file_type?(import_params)\n @import.save\n @export_json = @import.handle_import_file(@import.import_type, import_params[:file])\n else\n #Handle error message response\n @export_json = 'File format must be a csv'\n end\n respond_to do |format|\n # format.html { redirect_to imports_path(@export_json) }\n format.json {render json: @export_json }\n end\n end", "def request_import\n end", "def items_import_params\n # params.require(:items_import).permit(:file_name, :uploaded_by, :uploaded_at, :status)\n params.fetch(:items_import, {}).permit(:file_name, :uploaded_by, :uploaded_at, :status, :file)\n end", "def save_file_batch(files, new_obj_id)\n url = \"#{@base_url}/api/v2/files/#{new_obj_id}/create_batch\"\n resp = api_post_json(url, files.to_json)\n if resp.code != '201'\n @log.write(\"Error saving #{files.count} files #{files[0]['identifier']}...\\n\")\n @log.write(files.inspect)\n @log.write(\"\\n\" + resp.body + \"\\n\")\n #exit(1)\n end\n end", "def put_import_fields_from_xml_in_storage_with_http_info(name, xml_file_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_import_fields_from_xml_in_storage ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.put_import_fields_from_xml_in_storage\"\n end\n # verify the required parameter 'xml_file_path' is set\n if @api_client.config.client_side_validation && xml_file_path.nil?\n fail ArgumentError, \"Missing the required parameter 'xml_file_path' when calling PdfApi.put_import_fields_from_xml_in_storage\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/import/xml\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'xmlFilePath'] = xml_file_path\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].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 # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_import_fields_from_xml_in_storage\\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 @used_object.update(used_object_params)\n if params[:supporting_files]\n params[:supporting_files].each { |file| \n @used_object.supporting_files.create(file: file)\n }\n end\n format.html { redirect_to @used_object, notice: 'Used object was successfully updated.' }\n format.json { render :show, status: :ok, location: @used_object }\n else\n format.html { render :edit }\n format.json { render json: @used_object.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @capa = Capa.find(params[:id])\n\n respond_to do |format|\n if @capa.update_attributes(params[:capa])\n unless params[:capa_files].blank?\n params[:capa_files]['file'].each do |a|\n @capa_file = @capa.capa_files.create!(:file => a, :capa_id => @capa.id)\n end\n end\n format.html { redirect_to @capa, notice: 'Capa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @capa.errors, status: :unprocessable_entity }\n end\n end\n end", "def import\n Trick.import params[:file]\n redirect_to root_path, notice: \"Imported!!\"\n end", "def update\n respond_to do |format|\n if @upload.update_attributes(params[:upload]) && @resource.update_attributes(params[:resource])\n format.js \n end\n end\n end", "def update\n if @import_avatar.update(import_avatar_params)\n render :show, status: :ok, location: @import_avatar\n else\n render json: @import_avatar.errors, status: :unprocessable_entity\n end\n end", "def index\n @resource_import_files = ResourceImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def update\n @import = Import.find(params[:id])\n\n if @import.update_attributes(params[:import])\n redirect_to edit_import_path(@import), notice: 'Import was successfully updated.'\n else\n render action: \"edit\"\n end\n end", "def upload_file\n file = google_session.upload_from_file(file_params[:file].tempfile,\n file_params[:file].original_filename)\n collection.add(file)\n google_session.root_collection.remove(file)\n render json: 'Upload Successful'\n end", "def create\n @agent_import_file = AgentImportFile.new(agent_import_file_params)\n @agent_import_file.user = current_user\n\n respond_to do |format|\n if @agent_import_file.save\n if @agent_import_file.mode == 'import'\n AgentImportFileJob.perform_later(@agent_import_file)\n end\n format.html { redirect_to @agent_import_file, notice: t('controller.successfully_created', model: t('activerecord.models.agent_import_file')) }\n format.json { render json: @agent_import_file, status: :created, location: @agent_import_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agent_import_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_file(bucket_key, file_location, file_name, access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\n end", "def update\n if params[:resource][:document].present?\n @resource.document.purge\n @resource.document.attach(params[:resource][:document])\n end\n if params[:resource][:sample].present?\n @resource.sample.purge\n @resource.sample.attach(params[:resource][:sample])\n end\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def import\n respond_to do |format|\n begin\n # process upload file, must be xls/xlsx(better, 'cause xls only can upload 65000 rows)\n @asset_categorization = AssetCategorization.import(params[:file])\n format.html { render action: \"new\" }\n rescue => e\n format.html { redirect_to upload_asset_categorizations_url, flash: { error: e.message } } \n end\n end\n end", "def update\n @sys_image = resource_find(params[:id])\n uploaded_io = params[:file]\n if (params[:sys_image_id] != -1)\n @sys_image.sys_image_id = params[:sys_image_id]\n end\n\n unless uploaded_io.nil?\n _size = File.size(uploaded_io) \n params[:sys_image].merge!({:size => _size}) \n end\n\n if @sys_image.update_attributes(params[:sys_image])\n unless uploaded_io.nil?\n write_resource(@sys_image, uploaded_io.read, \"ndz\")\n end \n\n #flash[\"success\"] = 'Sys image was successfully updated.'\n flash[\"success\"] = t(\"amazing.sys_image.updated\")\n redirect_to(@sys_image) \n else\n render :action => \"edit\"\n end\n end", "def create\n\t\tif ResourceItem.exists?(google_doc_id: params[:resource_item]['google_doc_id'])\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html {redirect_to import_google_fellow_resource_items_path, notice: 'Resource existed'}\n\t\t\tend\n\t\telse\n\t \t@resource_item = ResourceItem.create(resource_item_params)\n\t \tgon.resource_item = @resource_item\n\n\t\t respond_to do |format|\n\t\t if @resource_item.valid?\n\t\t format.html { redirect_to @resource_item, notice: 'Resource item was successfully created.' }\n\t\t if Rails.env.production?\n\t\t \tRestClient.patch(\"https://lensshift-drive.firebaseio.com/resources/#{@resource_item.google_doc_id}.json\", @resource_item.to_json)\n\t\t \tend\n\t\t format.json { render :show, status: :created, location: @resource_item }\n\t\t else\n\t\t format.html { render :new }\n\t\t format.json { render json: @resource_item.errors, status: :unprocessable_entity }\n\t\t end\n\t\t end\n\t\tend\n\tend", "def _upload(api_key, file) \n url = Client.site + \"/upload.json\"\n params = { \"api_key\" => api_key, \"api_method\" => \"ruby\", \"id\" => id.to_s, \"file\" => file }\n resp = HTTPClient.post url, params \n JSON.parse(resp.content)\n end", "def destroy\n @resource_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_import_files_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.resource_import_file')) }\n format.json { head :no_content }\n end\n end" ]
[ "0.6438908", "0.6217954", "0.6214161", "0.6188599", "0.60518265", "0.60505116", "0.60078007", "0.59259033", "0.589679", "0.5834578", "0.5829367", "0.5814859", "0.58146626", "0.58146626", "0.5807853", "0.5791179", "0.5754489", "0.5743385", "0.5727049", "0.56840557", "0.56676483", "0.56341", "0.5623662", "0.5604833", "0.5602914", "0.560136", "0.559806", "0.55804753", "0.55587846", "0.553663", "0.5533578", "0.55148834", "0.55095696", "0.55083907", "0.55055195", "0.55049765", "0.5502773", "0.55020505", "0.55020505", "0.55020505", "0.5493893", "0.54881793", "0.5487913", "0.54828817", "0.5467485", "0.5462974", "0.54621327", "0.5459095", "0.5453264", "0.54396415", "0.54390854", "0.5436416", "0.54292494", "0.54279345", "0.5423534", "0.5423157", "0.5404061", "0.54032063", "0.5402405", "0.5400496", "0.5389473", "0.5385757", "0.5383306", "0.5382442", "0.5381877", "0.5376684", "0.5373207", "0.537295", "0.53716296", "0.5367941", "0.53581935", "0.53565603", "0.5327868", "0.5327304", "0.5326595", "0.5324", "0.5316997", "0.531506", "0.5302246", "0.53003025", "0.52987176", "0.52973783", "0.52932215", "0.5292678", "0.5292223", "0.5292164", "0.52830446", "0.5280917", "0.52695245", "0.5266055", "0.526118", "0.52592015", "0.52435803", "0.52401257", "0.52369195", "0.523095", "0.5228157", "0.52280277", "0.5226258", "0.52247894" ]
0.6792846
0
DELETE /resource_import_files/1 DELETE /resource_import_files/1.json
def destroy @resource_import_file.destroy respond_to do |format| format.html { redirect_to resource_import_files_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.resource_import_file')) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @agent_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(agent_import_files_url) }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource_file = ResourceFile.find(params[:id])\n @resource_file.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(event_import_files_url) }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to event_import_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @agent_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to agent_import_files_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.agent_import_file')) }\n format.json { head :no_content }\n end\n end", "def destroy\n @import = @business.imports.find(params[:id])\n @import.reload.destroy\n\n respond_to do |format|\n format.html { redirect_to business_imports_url(@business) }\n format.json { head :no_content }\n end\n end", "def destroy\n @q_resource = QResource.find(params[:id])\n @q_resource.bfile.remove!\n @q_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to q_resources_url }\n format.json { head :ok }\n end\n end", "def destroy\n @import_def = ImportDef.find(params[:id])\n @import_def.destroy\n\n respond_to do |format|\n format.html { redirect_to import_defs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @import.destroy\n respond_to do |format|\n format.html { redirect_to imports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @import = Import.find(params[:id])\n @import.destroy\n\n respond_to do |format|\n format.html { redirect_to imports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @import = Import.find(params[:id])\n @import.destroy\n\n respond_to do |format|\n format.html { redirect_to imports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @import = Import.find(params[:id])\n @import.destroy\n\n respond_to do |format|\n format.html { redirect_to imports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource_import_result.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_import_results_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.resource_import_result')) }\n format.json { head :no_content }\n end\n end", "def destroy\n @incidentfile.destroy\n respond_to do |format|\n format.html { redirect_to incidentfiles_url, notice: 'Incidentfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_all_files\n @import.delete_all_files\n head :no_content\n end", "def delete_service_files(resource)\n file get_service_script_name(resource) do\n action :delete\n only_if { get_service_script_name != nil }\n end\nend", "def delete\n unless FileDescriptor.exists?(filename: params[:fname])\n fpath = filePath params[:fname]\n begin\n File.delete fpath\n result = {status: 'ok'}\n status = 200\n rescue Exception => e\n result = {status: 'error', message: e.message}\n status = 500\n end\n else\n result = {status: 'error', message: 'File is open'}\n status = 403 # Forbidden\n end\n render json: result.to_json, status: status\n end", "def destroy\n @action_file = ActionFile.find(params[:id])\n @action_file.destroy\n\n respond_to do |format|\n format.html { redirect_to action_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @import.destroy\n respond_to do |format|\n flash[:notice] = \"Record import berhasil dihapus, #{undo_link(@import)}\"\n format.html { redirect_to imports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datafile.destroy\n respond_to do |format|\n format.html { redirect_to datafiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_file = TestFile.find(params[:id])\n @test_file.destroy\n\n respond_to do |format|\n format.html { redirect_to test_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @backup_file = BackupFile.find(params[:id])\n @backup_file.destroy\n\n respond_to do |format|\n format.html { redirect_to backup_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @import.destroy\n respond_to do |format|\n format.html { redirect_to imports_url, notice: 'Import was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @import.destroy\n respond_to do |format|\n format.html { redirect_to imports_url, notice: 'Import was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #Finds selected data file\n @data_file = DataFile.find(params[:id])\n #destroys data file\n @data_file.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "def destroy\n @importdatum = Importdatum.find(params[:id])\n @importdatum.destroy\n\n respond_to do |format|\n format.html { redirect_to importdata_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @importtodb = Importtodb.find(params[:id])\n @importtodb.destroy\n\n respond_to do |format|\n format.html { redirect_to importtodbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @super_file = SuperFile.find(params[:id])\n @super_file.destroy\n\n respond_to do |format|\n format.html { redirect_to super_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @import.destroy\n respond_to do |format|\n format.html { redirect_to imports_url, notice: \"Import was destroyed\" }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\tif Rails.env.production?\n\t\t\tRestClient.patch(\"https://lensshift-drive.firebaseio.com/resources_deleted/#{@resource_item.google_doc_id}.json\", @resource_item.to_json)\n\t\t\tRestClient.delete(\"https://lensshift-drive.firebaseio.com/resources/#{@resource_item.google_doc_id}.json\")\n\t\tend\n\t\t@resource_item.destroy\n\t respond_to do |format|\n\t format.html { redirect_to fellow_resource_items_url, notice: 'Resource item was successfully destroyed.' }\n\t format.json { head :no_content }\n\t end\n\tend", "def destroy\n @file.destroy\n respond_to do |format|\n format.html { render text: 'created', layout: false, status: :created }\n format.json { head :no_content }\n end\n end", "def destroy\n @csv_import.destroy\n respond_to do |format|\n format.html { redirect_to csv_imports_url, notice: 'Csv import was successfully destroyed.' }\n format.json { head :no_content }\n end\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 destroy\n @csv_file = CsvFile.find(params[:id])\n @csv_file.destroy\n\n respond_to do |format|\n format.html { redirect_to csv_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @indexed_file = IndexedFile.find(params[:id])\n @indexed_file.destroy\n\n respond_to do |format|\n format.html { redirect_to indexed_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_record = FileRecord.find(params[:id])\n @file_record.destroy\n\n respond_to do |format|\n format.html { redirect_to file_records_url }\n format.json { head :no_content }\n end\n end", "def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting file\"\n end\n\n end\n\nend", "def destroy\n @csv_upload = CsvUpload.find(params[:id])\n @csv_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to csv_uploads_url }\n format.json { head :no_content }\n end\n end", "def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end", "def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @batch_file.destroy\n respond_to do |format|\n format.html { redirect_to batch_files_url, notice: \"Batch file was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @product_import = ProductImport.find(params[:id])\n @product_import.destroy\n\n respond_to do |format|\n format.html { redirect_to product_imports_url }\n format.json { head :ok }\n end\n end", "def destroy\n \n @attachment = Attachment.find(params[:attachment_id])\n @attachment.destroy\n Keys.where(attachment_id: @attachment.id).destroy_all\n GetModel(params[:type]).where(file_id: @attachment.id).destroy_all\n \n respond_to do |format| \n format.html { redirect_to '/imports/'+params[:profile_id].to_s+'/csv/'+params[:type].to_s,notice: 'File has been deleted!' }\n end\n \n end", "def destroy\n @journal_import = JournalImport.find(params[:id])\n @journal_import.destroy\n\n respond_to do |format|\n format.html { redirect_to journal_imports_url }\n format.json { head :ok }\n end\n end", "def destroy\n @importation = Importation.find(params[:id])\n session[:importation_actual_id] = \"0\"\n @importation.remove_all_files\n @importation.remove_directory\n @importation.destroy\n \n respond_to do |format|\n format.html { redirect_to admin_importations_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @grid_fs_file.destroy\n respond_to do |format|\n format.html { redirect_to grid_fs_files_url, notice: 'Grid fs file 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 @history_file_delete.destroy\n respond_to do |format|\n format.html { redirect_to history_file_deletes_url }\n format.json { head :no_content }\n end\n end", "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def destroy\n @userfile = Userfile.find(params[:id])\n @userfile.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #FIXME: Double check auth is working for deletion. Also, maybe should only delete if not associated with any experiments.\n @data_file.destroy\n \n respond_to do |format|\n format.html { redirect_to(data_files_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @file_upload.destroy\n respond_to do |format|\n format.html { redirect_to file_uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @up_file = UpFile.find(params[:id])\n @up_file.destroy\n\n respond_to do |format|\n format.html { redirect_to up_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report_file = ReportFile.find(params[:id])\n @report_file.destroy\n\n respond_to do |format|\n format.html { redirect_to report_files_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @pgn_file = PgnFile.find(params[:id])\n @pgn_file.destroy\n\n respond_to do |format|\n format.html { redirect_to pgn_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fileversion = Fileversion.find(params[:id])\n @fileversion.destroy\n\n respond_to do |format|\n format.html { redirect_to fileversions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sale_on_sale_import = SaleOnSaleImport.find(params[:id])\n @sale_on_sale_import.destroy\n\n respond_to do |format|\n format.html { redirect_to(sale_on_sale_imports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @import_job.destroy\n respond_to do |format|\n format.html { redirect_to import_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase_file = PurchaseFile.find(params[:id])\n @purchase_file.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_version = FileVersion.find(params[:id])\n @file_version.destroy\n\n respond_to do |format|\n format.html { redirect_to file_versions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @import_survey.destroy\n respond_to do |format|\n format.html { redirect_to import_surveys_url, notice: 'Import survey was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @importer = Importer.find(params[:id])\n @importer.destroy\n\n respond_to do |format|\n format.html { redirect_to importers_url }\n format.json { head :ok }\n end\n end", "def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[: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 raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def delete_importer(id)\n return @client.raw(\"delete\", \"/config/importers/#{id}\")\n end", "def destroy\n @asset = Resource.find(params[:id])\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to admin_resources_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @datafile.destroy\n respond_to do |format|\n format.html { redirect_to datafiles_url, notice: 'Datafile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testfile.destroy\n respond_to do |format|\n format.html { redirect_to materials_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @import_error.destroy\n respond_to do |format|\n format.html { redirect_to import_errors_url, notice: \"Import error was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def deleteFileFromServer(filepath)\n filepath = filepath[1, filepath.length - 1] \n address = @@host + \"/user/\" + @@conf[\"username\"] + \"/device/\" + @@conf[\"dev_name\"] + \"/files/\" + filepath\n \n res = HttpRequest.new(:delete, address).send(@@host) \n puts res\n puts \"CODE: \" + res.code\n\nend", "def destroy\n @data_file = DataFile.find(params[:id])\n @data_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_files_url) }\n format.xml { head :ok }\n end\n end", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def delete_files(uuids)\n Uploadcare::FileList.batch_delete(uuids)\n end", "def destroy\n @file_sequence = FileSequence.find(params[:id])\n @file_sequence.destroy\n\n respond_to do |format|\n format.html { redirect_to file_sequences_url }\n format.json { head :no_content }\n end\n end", "def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\").body_str\n end", "def destroy\n @importacion = Importacion.find(params[:id])\n @importacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(importaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n record = Asset.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @document = Document.find(params[:id])\n collection = Collection.find(@document.collection_id)\n upload_remove(@document) #Removes upload record if file is deleted\n @document.destroy\n\n respond_to do |format|\n #format.html { redirect_to collections_path }\n format.html { redirect_to collection }\n format.json { head :ok }\n end\n end", "def destroy\n @importation_attachment = ImportationAttachment.find(params[:id])\n @importation=@importation_attachment.importation_id\n\n @importation_attachment.destroy\n \n respond_to do |format|\n format.html { redirect_to edit_admin_importation_path(@importation) }\n format.json { head :no_content }\n end\n end", "def destroy\n @unuse_file.destroy\n respond_to do |format|\n format.html { redirect_to unuse_files_url, notice: 'Unuse file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def delete\n @resource.delete\n end", "def b2_delete_file_version(file)\n\n auth_hash = convert_json(b2_authorize_account)\n api_url = auth_hash[\"apiUrl\"]\n account_authorization_token = auth_hash[\"authorizationToken\"]\n\n file_hash = parse_files_json(file)\n file_name = file\n file_id = file_hash[file]\n\n uri = URI(\"#{api_url}/b2api/v1/b2_delete_file_version\")\n req = Net::HTTP::Post.new(uri)\n req.add_field(\"Authorization\",\"#{account_authorization_token}\")\n req.body = \"{\\\"fileName\\\":\\\"#{file_name}\\\", \\\"fileId\\\":\\\"#{file_id}\\\"}\"\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then res.body\n when Net::HTTPRedirection then fetch(res['location'], limit - 1)\n else res.error!\n end\n\nend", "def destroy\n @import_trial_log_datum.destroy\n respond_to do |format|\n format.html { redirect_to import_trial_log_data_url, notice: 'Import trial log datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_upload_attachment.destroy\n respond_to do |format|\n format.html { redirect_to file_upload_attachments_url }\n format.json { head :no_content }\n end\n end", "def deleteFile(bucket, file, client)\n\tfilename = File.basename(file)\n\tbegin\n\t \tresp = client.client.delete_objects({\n\t \t\tbucket: bucket,\n\t\t\tdelete: { objects: [\n\t\t\t\t{ key: filename }\n\t\t\t],\n\t\t\tquiet: false }\n\t\t})\n\trescue Exception => e\n\t\tputs \"Wrong file name\"\n\t\tputs e\n\t\texit\n\tend\n\treturn resp\nend", "def destroy\n @filename.destroy\n respond_to do |format|\n format.html { redirect_to filenames_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source_file.destroy\n respond_to do |format|\n format.html { redirect_to source_files_url, notice: 'Source file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_link.destroy\n respond_to do |format|\n format.html { redirect_to file_links_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @config_file = ConfigFile.find(params[:id])\n @config_file.destroy\n\n respond_to do |format|\n format.html { redirect_to config_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gadget_file.destroy\n respond_to do |format|\n format.html { redirect_to gadget_files_url, notice: 'Gadget file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mfile = Mfile.find(params[:id])\n @mfile.destroy\n\n respond_to do |format|\n format.html { redirect_to mfiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @upload_file = UploadFile.find(params[:id])\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(upload_files_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @file_upload = FileUpload.find(params[:id])\n @file_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to(file_uploads_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \n @user_file = UserFile.find(params[:id])\n authorize! :destroy, @user_file\n name=@user_file.uploaded_file_file_name\n @user_file.destroy\n\n respond_to do |format|\n format.html { redirect_to :back,:notice=>\"Deleted file: \"+name }\n format.json { head :ok }\n end\n end" ]
[ "0.7266368", "0.71524155", "0.71393204", "0.71231097", "0.70842123", "0.67905974", "0.6733849", "0.67136604", "0.6695157", "0.66710293", "0.66710293", "0.66710293", "0.6636724", "0.66088045", "0.6603813", "0.6593575", "0.65913576", "0.6543522", "0.6518902", "0.65058625", "0.6493795", "0.64844525", "0.64834684", "0.64834684", "0.64805", "0.6479689", "0.6476397", "0.64666426", "0.64460963", "0.6440886", "0.64386564", "0.6433829", "0.64311963", "0.64273024", "0.64220446", "0.64173794", "0.6410395", "0.6410277", "0.64050937", "0.64025414", "0.64025414", "0.63862854", "0.6383923", "0.63633054", "0.6358703", "0.63580173", "0.6351523", "0.6350409", "0.6343877", "0.6335315", "0.63314074", "0.63295746", "0.63292164", "0.6322777", "0.63197625", "0.6316592", "0.6307314", "0.6299414", "0.6289895", "0.6288382", "0.627969", "0.6267082", "0.6263424", "0.625966", "0.6259656", "0.62555426", "0.62520593", "0.62520593", "0.62246585", "0.6223864", "0.62204325", "0.6211022", "0.6208983", "0.62072784", "0.6200548", "0.6199827", "0.61966026", "0.6195733", "0.6182783", "0.6181344", "0.6178552", "0.61783093", "0.61766773", "0.6175085", "0.61749464", "0.61708057", "0.6168428", "0.61669177", "0.61667603", "0.6164258", "0.61624956", "0.6156668", "0.6154665", "0.6153385", "0.61505723", "0.614874", "0.6144684", "0.6143528", "0.6140067", "0.61395985" ]
0.75656533
0
return the new version and the reasons
def new_version %w(major minor patch).each do |level| changes = git_changelog.select(&"#{level}?".to_sym) return [ last_release.send("#{level}!"), changes ] if changes.size > 0 end raise "No commit since last release (#{last_release})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_version; end", "def get_version()\n\t\tend", "def version_mismatch_detected\n end", "def update_necessary?\n load_mixlib_versioning\n cur_version = Mixlib::Versioning.parse(current_version)\n des_version = Mixlib::Versioning.parse(desired_version)\n Chef::Log.debug(\"The current chef-client version is #{cur_version} and the desired version is #{desired_version}\")\n new_resource.prevent_downgrade ? (des_version > cur_version) : (des_version != cur_version)\nend", "def version_description\n raise NotImplementedError\n end", "def outdated_state(scraper_version, latest_version)\n scraper_parts = scraper_version.to_s.split(/[-.]/).map(&:to_i)\n latest_parts = latest_version.to_s.split(/[-.]/).map(&:to_i)\n\n # Only check the first two parts, the third part is for patch updates\n [0, 1].each do |i|\n break if i >= scraper_parts.length or i >= latest_parts.length\n return 'Outdated major version' if i == 0 and latest_parts[i] > scraper_parts[i]\n return 'Outdated minor version' if i == 1 and latest_parts[i] > scraper_parts[i]\n return 'Up-to-date' if latest_parts[i] < scraper_parts[i]\n end\n\n 'Up-to-date'\n end", "def outdated?; end", "def get_version\n\t\tend", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def outdated; end", "def new_version\n @version = Time.now.to_i\n end", "def version!\r\n fail\r\n end", "def def_version; end", "def bump_patch_version; end", "def changed_reason\n\t\treturn \"Struct was modified\" if @struct.modified?\n\n\t\tif self.name && self.loader.is_newer?( self.name, self.create_time )\n\t\t\treturn \"Config source (%s) has been updated since %s\" %\n\t\t\t\t[ self.name, self.create_time ]\n\t\tend\n\n\t\treturn nil\n\tend", "def initial_version\n version - changes.size\n end", "def version_history\n res = []\n event = 'create'\n author = user\n versions.each do |version|\n # some old entries still include create actions\n # TODO remove next line\n next if version.event == 'create'\n res << {\n obj: version.reify,\n event: event,\n author: author\n }\n event = version.event\n author = User.find_by_id(version.whodunnit.to_i)\n end\n res << {\n obj: self,\n event: event,\n author: author\n }\n end", "def version\n new_resource.version || latest_version\n end", "def target_version; end", "def version\n res = {}\n res[:branch] = @branch\n res[:history] = @history\n res[:releases] = @releases\n res[:diffs] = @diffs.keys\n res\n end", "def version_added; end", "def version_style\n version_warnings[0]\n end", "def version; REVLOG_VERSION_0; end", "def update_necessary?\n load_mixlib_versioning\n cur_version = Mixlib::Versioning.parse(current_version)\n # we have to \"resolve\" partial versions like \"12\" through mixlib-install before comparing them here\n des_version =\n if new_resource.download_url_override\n # probably in an air-gapped environment.\n Mixlib::Versioning.parse(desired_version)\n else\n Mixlib::Versioning.parse(Array(mixlib_install.artifact_info).first.version)\n end\n Chef::Log.debug(\"The current chef-client version is #{cur_version} and the desired version is #{desired_version}\")\n new_resource.prevent_downgrade ? (des_version > cur_version) : (des_version != cur_version)\nend", "def minor_version; end", "def version\n 1\n end", "def version\n '2.0.7.7' # Version number <major-update>.<minor-update>.<patch-update>.<commit-count>\n end", "def test\n commit_v = check_commit_version\n serv_v = check_server_version\n updated = Gem::Version.new(serv_v) < Gem::Version.new(commit_v)\n\n puts \"Running cookbook version rev'd test:\"\n puts \"Server version: #{serv_v}\".indent\n puts \"Commit version: #{commit_v}\".indent\n puts updated ? \"PASS: Metadata version has been rev'd\".indent : \"FAIL: Metadata version has NOT been rev'd\".indent.to_red\n updated\n end", "def version\n not_implemented\n end", "def description\n \"Derelict::Parser::Version instance\"\n end", "def upgrade_app_explain; \"Check for updates to Hobix.\"; end", "def version\n @version.dup\n end", "def version\n @version.dup\n end", "def default_version; end", "def palladius_version\n\t:TODO\nend", "def version\n 1\n end", "def version\n super.to_s\n end", "def version\n super.to_s\n end", "def major_version; end", "def has_version?; end", "def print_puppetfile_diff(old, new)\n # Build hashes mapping the module name to the module object. This makes it\n # a little easier to determine which modules have been added, removed, or\n # modified.\n old = (old&.modules || []).each_with_object({}) do |mod, acc|\n next unless mod.type == :forge\n acc[mod.full_name] = mod\n end\n\n new = new.modules.each_with_object({}) do |mod, acc|\n next unless mod.type == :forge\n acc[mod.full_name] = mod\n end\n\n # New modules are those present in new but not in old.\n added = new.reject { |full_name, _mod| old.include?(full_name) }.values\n\n if added.any?\n diff = \"Adding the following modules:\\n\"\n added.each { |mod| diff += \"#{mod.full_name} #{mod.version}\\n\" }\n @outputter.print_action_step(diff)\n end\n\n # Upgraded modules are those that have a newer version in new than old.\n upgraded = new.select do |full_name, mod|\n if old.include?(full_name)\n mod.version > old[full_name].version\n end\n end.keys\n\n if upgraded.any?\n diff = \"Upgrading the following modules:\\n\"\n upgraded.each { |full_name| diff += \"#{full_name} #{old[full_name].version} to #{new[full_name].version}\\n\" }\n @outputter.print_action_step(diff)\n end\n\n # Downgraded modules are those that have an older version in new than old.\n downgraded = new.select do |full_name, mod|\n if old.include?(full_name)\n mod.version < old[full_name].version\n end\n end.keys\n\n if downgraded.any?\n diff = \"Downgrading the following modules: \\n\"\n downgraded.each { |full_name| diff += \"#{full_name} #{old[full_name].version} to #{new[full_name].version}\\n\" }\n @outputter.print_action_step(diff)\n end\n\n # Removed modules are those present in old but not in new.\n removed = old.reject { |full_name, _mod| new.include?(full_name) }.values\n\n if removed.any?\n diff = \"Removing the following modules:\\n\"\n removed.each { |mod| diff += \"#{mod.full_name} #{mod.version}\\n\" }\n @outputter.print_action_step(diff)\n end\n end", "def explain\n if build_version\n \"Build Version: #{build_version}\"\n else\n if from_dependency?\n \"Build Version will be determined from software '#{version_dependency}'\"\n else\n \"Build Version is not determined yet.\"\n end\n end\n end", "def version\n 0\n end", "def outdatedness_reasons_for(obj)\n reasons = basic.outdatedness_status_for(obj).reasons\n if reasons.any?\n reasons\n elsif outdated_due_to_dependencies?(obj)\n [Reasons::DependenciesOutdated]\n else\n []\n end\n end", "def changelog_contains_relevant_versions?\n # Assume the changelog is relevant if we can't parse the new version\n return true unless version_class.correct?(dependency.version)\n\n # Assume the changelog is relevant if it mentions the new version\n # anywhere\n return true if full_changelog_text.include?(dependency.version)\n\n # Otherwise check if any intermediate versions are included in headers\n versions_in_changelog_headers.any? do |version|\n next false unless version <= version_class.new(dependency.version)\n next true unless dependency.previous_version\n next true unless version_class.correct?(dependency.previous_version)\n version > version_class.new(dependency.previous_version)\n end\n end", "def minimum_warning_patch_version\n return @minimum_warning_patch_version\n end", "def version\n nil\n end", "def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend", "def determine_api_version(new_file_content: nil, old_file_content: nil)\n # we know 100% there is a difference, so no need to compare\n unless old_file_content.length >= new_file_content.length\n old_api_version = find_api_version_string(content: old_file_content)\n\n return DEFAULT_API_VERSION_STRING if old_api_version.nil?\n\n return increment_api_version_string(api_version_string: old_api_version)\n end\n\n relevant_old_file_content = old_file_content[0..(new_file_content.length - 1)]\n\n if relevant_old_file_content == new_file_content\n # no changes at all, just return the same old api version string\n return find_api_version_string(content: old_file_content)\n else\n # there are differences, so calculate a new api_version_string\n old_api_version = find_api_version_string(content: old_file_content)\n\n return DEFAULT_API_VERSION_STRING if old_api_version.nil?\n\n return increment_api_version_string(api_version_string: old_api_version)\n end\n end", "def reconcile_deltas(new_version, new_deltas, old_deltas)\n old_deltas ||= []\n new_version = new_version.to_s\n\n now = DateTime.now.to_s(:db)\n\n new_deltas.map do |delta|\n { \"text\" => delta[\"text\"], \n \"authorId\" => delta[\"attributes\"][\"authorId\"] \n }.tap do |new_delta|\n\n # Try to find new in old.\n found_index = old_deltas.find_index do |old_delta|\n authors_are_same = old_delta[\"authorId\"] == new_delta[\"authorId\"]\n old_text_begins_with_new_text = old_delta[\"text\"].index(new_delta[\"text\"])\n authors_are_same && old_text_begins_with_new_text\n end\n\n if found_index\n found = old_deltas[found_index]\n #old_deltas = old_deltas.drop(found_index + 1)\n\n # Set timestamp/version to old.\n new_delta[\"version\"] = found[\"version\"]\n new_delta[\"updated_at\"] = found[\"updated_at\"]\n else\n # Use current version.\n new_delta[\"version\"] = new_version\n new_delta[\"updated_at\"] = now\n end\n end\n end\n end", "def info\n stability_bump(raw_info)\n end", "def ic_version_if_changed\n return nil if do_not_check_for_version_change\n if step_not_modified\n begin\n # ae = application_environment\n ae = []\n request.apps.each do |app|\n ae << app.application_environments.find_by_environment_id(request.environment_id)\n end\n # ac = application_component\n ac = []\n ae.each do |app_env|\n ac << app_env.application_components.find_by_component_id(component_id)\n end\n ae.flatten!\n ac.flatten!\n # ic = installed_component\n ic = InstalledComponent.find_by_application_component_id_and_application_environment_id(ac.map(&:id), ae.map(&:id))\n ic.nil? ? nil : (ic.version.eql?(version_name) ? nil : ic.version)\n rescue\n nil\n end\n end\n end", "def version\n data.version\n end", "def which_severity_changed(cur_version_tag, prior_version_tag)\n return nil if cur_version_tag.nil? || prior_version_tag.nil?\n return :major if cur_version_tag.major != prior_version_tag.major\n return :minor if cur_version_tag.minor != prior_version_tag.minor\n return :admin if cur_version_tag.admin != prior_version_tag.admin\n\n nil\n end", "def original_application_version\n read('original_application_version')\n end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def version\n\t\t\tbegin\n\t\t\t\tv = \"#{GVB.major_version}.#{GVB.minor_version}.#{GVB.patch_version}\"\n\t\t\trescue\n\t\t\t\tv = File.read(\".gvb_version\") if File.exists?(\".gvb_version\")\n\t\t\tend\n\t\t\t# If we got a version then use it to construct a link to the github tag of the same\n\t\t\tif v\n\t\t\t\tl = link_to v, \"https://github.com/machiavellian/machiavelli/releases/tag/v#{v}\", target: \"blank\" if v\n\t\t\t\treturn \"version #{l} \".html_safe\n\t\t\tend\n\t\tend", "def name_and_version\n [display_name, version].compact.join(' ')\n end", "def current_version\n @version\n end", "def git_describe_version\n return nil unless is_git_repo and raw = run_git_describe_internal\n # reprocess that into a nice set of output data\n # The elements we select potentially change if this is an rc\n # For an rc with added commits our string will be something like '0.7.0-rc1-63-g51ccc51'\n # and our return will be [0.7.0, rc1, 63, <dirty>]\n # For a final with added commits, it will look like '0.7.0-63-g51ccc51'\n # and our return will be [0.7.0, 64, <dirty>]\n info = raw.chomp.sub(/^v/, '').split('-')\n if git_ref_type == \"tag\"\n version_string = info.compact\n elsif info[1].to_s.match('^[\\d]+')\n version_string = info.values_at(0, 1, 3).compact\n else\n version_string = info.values_at(0, 1, 2, 4).compact\n end\n version_string\n end", "def versions\n info[:versions]\n end", "def version\n build_string\n end", "def version\n updated_at.to_i\n end", "def version\n updated_at.to_i\n end", "def productVersion \n \"productVersion\" \n end", "def verdict_details\n return @verdict_details\n end", "def save_version?\n\t\t\t \t\tchanged?\n\t\t\t \tend", "def current_version\n version_number rev\n end", "def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\n end", "def version=(newversion)\t\n notice \"Version of #{resource[:name]} does not match the required version.\"\n destroy\n create\n end", "def version\n\t\tmodule_info['Version'].split(/,/).map { |ver|\n\t\t\tver.gsub(/\\$Rev.s.on:\\s+|\\s+\\$$/, '')\n\t\t}.join(',')\n\tend", "def version\n puts \"v0.3\"\n end" ]
[ "0.67777437", "0.6207351", "0.61994094", "0.6154905", "0.614534", "0.6111828", "0.61111784", "0.6100825", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.60958844", "0.6080586", "0.6080586", "0.6078745", "0.6074715", "0.60152197", "0.5982304", "0.59740096", "0.5971067", "0.59633315", "0.5950024", "0.5941879", "0.5933965", "0.5927126", "0.5901255", "0.5899047", "0.5887525", "0.58651686", "0.585443", "0.58287156", "0.5826532", "0.5823615", "0.582065", "0.5791689", "0.5787277", "0.57777673", "0.5772192", "0.5772192", "0.5763224", "0.57615536", "0.5758063", "0.5745901", "0.5745901", "0.57418483", "0.572993", "0.57286376", "0.5726432", "0.57254905", "0.56873095", "0.5686341", "0.56754607", "0.566472", "0.56618613", "0.56576234", "0.5655329", "0.56482846", "0.564179", "0.562555", "0.56224775", "0.5620735", "0.56163883", "0.56163883", "0.56163883", "0.56163883", "0.56159735", "0.56074697", "0.56011164", "0.5596148", "0.5593604", "0.55823183", "0.55788994", "0.55788994", "0.5568359", "0.55673647", "0.5563275", "0.5560609", "0.55592674", "0.5558516", "0.55544704", "0.554762" ]
0.63348883
1
This show method displays the user's accout details
def show @my_accounts=@current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @user_picture = @user.profile_image.expiring_url(3600, :square)\n @bookmarks = @user.bookmarks\n @enrollments = @user.courses\n @enrollments_visible = @user.course_enrollments_visible_for_user(current_user)\n @completions_visible = @user.course_results_visible_for_user(current_user)\n end", "def show\n @cita = Cita.find(params[:id])\n quien = User.find_by_id(@cita.user_id)\n @autor = quien.login + \" | \" + quien.email\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cita }\n end\n end", "def show\n \n @user = logged_in_user \n @questions = logged_in_user.user_attribute_details \n @change_list = ContentManager.calculate_change_list(@user) \n @campaigns_to_show = 5\n @owned_campaigns = logged_in_user.owned_campaigns.not_deleted\n @is_org_user = @user.has_role? \"OrganizationUser\"\n @orgs = OrganizationUser.find_all_by_user_id(@user.id).map(&:organization) if @is_org_user\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n end\n end", "def show\n ap @user\n end", "def show\n set_user\n end", "def show\n @user = @account.user\n @authorized = true\n end", "def show\n set_accesory\n end", "def show\n @accident_record = AccidentRecord.find(params[:id])\n end", "def show\n set_account\n end", "def show\n owner(@account, @current_user.id) if !admin_signed_in?\n end", "def show\n puts \"##################user id is #{@user.id}\"\n @owned_challenges = Challenge.where(owner_id: params[:id])\n @activities = Activity.where(user_id: @user.id)\n puts \"##################activities is #{@activities}\"\n end", "def show\n @user = User.find(params[:id])\n\t@cuser = current_user\n\t@visible = Relationship.where(\"accessed_id = ? AND accessor_id = ? AND accepted = ?\", @user.id, @cuser.id, true).first || Relationship.where(\"accessed_id = ? AND accessor_id = ? AND accepted = ?\", @cuser.id, @user.id, true).first || (@cuser.id == @user.id)\n\t@title = \"#{@user.first_name} #{@user.last_name}\"\n\tif (@user.relationships.find_by_accessed_id(@cuser).nil?)\n\t\t@rel = @cuser.relationships.find_by_accessed_id(@user)\n\telse\n\t\t@rel = @user.relationships.find_by_accessed_id(@cuser)\n\tend\n\t\t\n end", "def show\n # @user = current_user\n @apartment \n end", "def display_account_details\n puts \"\"\n puts \"Account Details\"\n puts \"-------------------------\"\n puts \"Rank: #{rank}\"\n puts \"Name: #{name}\"\n puts \"Handle: @#{handle}\"\n puts \"Followers: #{followers}\"\n puts \"-------------------------\"\n end", "def show\n @account = current_account\n end", "def show\n\t\t@user = current_user\n\tend", "def show\n authorize @accountant_profile\n end", "def display_details()\n\t\tputs \"------------------------------\"\n\t\tputs \"User Details\"\n\t\tputs \"#{@first_name} #{@surname} aged '#{@age}'\"\n\t\tputs \"------------------------------\"\n\tend", "def show\n unless params[:id].blank?\n @user = User.find_by_id(params[:id])\n else\n if logged_in?\n @user = current_user\n else\n require_login and return\n end\n end\n \n if @user.blank?\n flash[:error] = \"User not found\"\n redirect_to root_path and return\n end\n\n @own_profile = (logged_in? && (@user.id == current_user.id))\n\n @page_title = @own_profile ? \"My profile\" : \"View profile\"\n\n @memberships = @user.liga_users.approved.map(&:league)\n end", "def show\n\t\t@user = User.where(passport: @visa.passport).first\n\tend", "def show\n\n\t\t@current_profile = Profile.get_profile params[:id], \"asdf\"\n\n\t\tpretty_render \"api/public_user\"\t\n\n\tend", "def show\n #@contracts = @user.contracts\n end", "def show\n user_identity = build_identity_from_headers\n process_identity(user_identity)\n end", "def show\n # check that the current user has access to the account page\n if !@account.users.include?(current_user) and current_user != @account.user\n flash[:notice] = 'You do not have access to that, please sign in again'\n sign_out current_user\n redirect_to new_user_session_path\n else\n @accounts = current_user.accounts\n @transactions = @account.transactionSummary.reverse\n @auto_payment = @account.auto_bill_payments.new\n end\n end", "def show\n verifica_user\n end", "def show\n set_user_information\n authorize @user_information\n respond_with(@user_information)\n end", "def display\n @object.send(Innsights.user_display)\n end", "def show\n # @u = current_user\n end", "def show\n\n #if student, show class enrollments/bookings\n @enrollments = @current_user.enrollments.sort_by {\n |enrollment| enrollment['date']\n }\n\n # if instructor show classes that they are teaching\n @classes_teaching = @current_user.classes_teaching\n\n\n end", "def show\n @users = User.all\n @user = current_user\n end", "def show\n @user = get_user\n end", "def index\n \n\n @info_self_cares = current_user.info_self_cares\n \n end", "def show\n @educators = Educator.where(verified: [false, nil]).all\n @dmcas = Dmca.all\n end", "def show\n @useraccountright = Useraccountright.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @useraccountright }\n end\n end", "def show\n @user = User.find(current_user.id)\n end", "def show\n require_user()\n end", "def show\n @iseditor = useriseditor\n end", "def show\n @absence = Absence.find(params[:id])\n @title = \"User #{@absence.user_id} Absence\" \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @absence }\n end\n end", "def show\n show_user\n end", "def show\n @user = find_user\n end", "def show\n success_response(message: 'Account', data: { user_account: @user_account })\n end", "def show\n @profile = @user.profile\n end", "def show\n @user = User.find_by(user_uuid: user_uuid)\n raise UserException, \"The user you entered does not exist\" if @user.nil?\n story_so_far = Story.build_to_top_from(user_uuid: @user.user_uuid)\n future_story = Story.build_down_from(user_uuid: @user.user_uuid)\n @user_display = UserDisplay.new(parent: @user.parent, story: story_so_far, future_story: future_story)\n end", "def show\n set_user\n end", "def show\n\t\t@user = User.find(params[:id])\n authorize! :show, @user\n\n # => for related Players\n # => move this to the User Model\n # => make it a single call from the controller to get this information\n @player_ids = UserToPlayer.user_has_players(@user.id)\n player_ids_array = Array.new\n @player_ids.each do |player_ids|\n player_ids_array.push(player_ids.player_id)\n end\n @players = Player.find(player_ids_array)\n\n # => for related Coaches\n @coach = []\n\n\tend", "def show\n if @application_case.has_user?(current_user)\n\n @notes = @application_case.notes\n @requirements = @application_case.case_requirements\n @status = @application_case.application_statuses\n @statuses = Status.all.sort_by(&:created_at)\n @m_address = @application_case.mortgage_address\n @applicants = @application_case.applicants.as_applicants\n @agent = @application_case.applicants.as_agents.first\n\n @agents ||= []\n @applicants.each do |applicant|\n if !@agents.include?(applicant.user)\n @agents << ClientAgent.agents(applicant.user).first\n end \n end\n\n else \n flash[:notice] = \"You are not authorized to view this\";\n redirect_to(application_cases_path);\n end\n end", "def show\n if params[:id]\n @user = User.find(params[:id])\n else\n @user = current_user\n end\n \n if @user == current_user\n render :show_full\n else\n render :show\n end\n end", "def show\n @user = current_user\n end", "def show\n @tab=\"account\"\n if current_user\n if current_user.admin\n @user = get_user(params[:id])\n else\n @user = get_user(current_user.id)\n end\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n unless current_user\n flash[:error] = \"You must be logged in to view your account.\"\n redirect_away(login_path) \n else\n @user = current_user\n @tab = params[:tab]\n @on_my_account = true\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @customer }\n end\n end\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n authorize! :show, UsuarioCurso\n @badges = BadgeAluno.where(usuario_curso_id: @usuario_curso.id) \n @artefatos = ArtefatoAluno.where(usuario_curso_id: @usuario_curso.id) \n authorize! :show, UsuarioCurso\n end", "def show\n @user = User.find_by_id(@publicacion.user_id)\n end", "def show\n authorize AccountingEntry\n end", "def show\n \n @user = User.find(session[:id])\n end", "def show\n @flag = @profile.country_code + \" flag\" unless @profile.country_code.nil?\n\n if @profile.user_id == current_user.id\n @title = \"My Profile Card\"\n else\n @title = \"#{@profile.nickname}'s Profile Card\"\n end\n end", "def show\n json_response(current_user.decorate, :ok)\n end", "def show\n load_variables\n initialize_variables\n \n check_user\n \n match_cards_and_programs\n \n sort_results\n end", "def show\n getProfile\n @appointment = Appointment.find(params[:id])\n @owner = User.find(@appointment.owner_id)\n if !@appointment.patient_id.blank?\n @patient = Patient.find(@appointment.patient_id)\n end\n @therapist = Therapist.find(@appointment.therapist_id)\n end", "def show\n\n @user = User.get(params[:id])\n \n if signed_in? && @user.id == current_user.id\n @menu = \"home\"\n @board = \"user\"\n @section = \"show\"\n \n render 'user'\n else\n redirect_to '/'\n end\n end", "def show\n @user=current_user\n end", "def show\n @albums = @user.albums\n @followers = @user.followers\n @followees = @user.followees\n end", "def show\n @user_author = User.find_by_id(@materiallink.user_id)\n @user_author_name = @user_author.username\n end", "def show\n @user = User.find(params[:id])\n @sources = current_user.sources.all\n @reports = current_user.reports.all\n @forms = current_user.forms.all\n @applications = current_user.owned_applications.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\r\n #authorize @chapa\r\n @membros = @chapa.membros\r\n respond_with @chapa\r\n end", "def show\n\t\t@car = Car.find( params[:id] )\n\t\t@user = @car.user\n\t\t@profile = @user.profile\n\tend", "def show\n\n if user_signed_in?\n @user = current_user\n # @bandtogether set to bandtogether on current page\n @bandtogether = Bandtogether.find(params[:id])\n @concert = @bandtogether.concert\n # @membership set to membership matching the bandtogether on current page and mapping all members\n @membership = Membership.where(bandtogether_id: @bandtogether.id).map {|membership| membership.user_id}\n else\n redirect_to '/users/sign_up'\n end\n end", "def show\n @userinfo = User.all\n @usergwamokinfo = Usergwamok.all\n @sigandannies = Sigandanny.all\n end", "def show\n @users = @business_profile.users\n end", "def show\n if current_user\n user_congress_members = CongressMemberFinder.get_all(current_user)\n @senator_handles = user_congress_members[:senators] ? user_congress_members[:senators].map { |senator| senator.twitter_handle }.join(\" \") : \"@YourSenators\"\n @representative_handle = user_congress_members[:representative] ? user_congress_members[:representative].twitter_handle : \"@YourRepresentative\"\n else\n @senator_handles = \"@YourSenators\"\n @representative_handle = \"@YourRepresentative\"\n end\n end", "def show\n\t\t@user = User.find(params[:id])\n\t\tauthorize @user\n\tend", "def show\n json_response(@user)\n end", "def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end", "def show\n\t\t# Find all users with id passed by params.\n\t\t@user = User.find(params[:id])\n\t\tCUSTOM_LOGGER.info(\"Start to find users #{@user.to_yaml}\")\n\tend", "def show\n if current_user.detail.church_name == nil\n \n redirect_to edit_user_detail_path(current_user,current_user.detail)\n end \n authorize @detail\n end", "def display\n puts \"Personal Details\"\n puts \" Name : #{self.name}\"\n puts \" Date of Birth : #{self.dob}\"\n puts \" Marital Status : #{self.marital_status}\"\n puts \" Mobile Number : #{self.mobile_number}\"\n puts \" Email : #{self.email}\"\n end", "def show\n @rtc_info = RtcInfo.find_by_users_id(current_user.id)\n end", "def show\n\t\tauthorize! :show, AsignacionFuncion\n end", "def show\n\t\t@user = current_user\n\t\trender_wizard\n\tend", "def show\n @title = \"Perfil del Candidato: #{@profile.forenames} #{@profile.surnames}\"\n end", "def show\n #@user=current_user\n end", "def show_user\n \tuser = User.where({:id => self.user_id}).first\n \tuser.name\n end", "def show\n @developers = @project.users.developers\n @qas = @project.users.qas\n end", "def show\n @user = current_user\n @title = \"Account\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(session[:user_id])\n @articles = @course.articles\n end" ]
[ "0.75487053", "0.7194765", "0.7172333", "0.7027965", "0.7009028", "0.7008943", "0.68949753", "0.6892981", "0.6883185", "0.68554735", "0.6837769", "0.6820351", "0.6820149", "0.6819964", "0.68073547", "0.6804762", "0.6798909", "0.6776452", "0.672516", "0.6709773", "0.6709125", "0.66996866", "0.6698479", "0.6693958", "0.66886485", "0.66868037", "0.66712934", "0.66707754", "0.6664999", "0.66606885", "0.66591775", "0.66445285", "0.662375", "0.66197", "0.66158664", "0.65989166", "0.6598895", "0.6596857", "0.65893245", "0.65832025", "0.65692043", "0.6567296", "0.6557241", "0.65559894", "0.65552557", "0.65441024", "0.6543325", "0.65332067", "0.65315384", "0.65226936", "0.6516836", "0.6516836", "0.6516836", "0.6516836", "0.6516836", "0.6516836", "0.6516836", "0.6516836", "0.6516836", "0.6516836", "0.6516836", "0.6516836", "0.6516836", "0.6516836", "0.65163517", "0.65154773", "0.65140426", "0.6512657", "0.65109116", "0.65061903", "0.65042853", "0.6500692", "0.6500122", "0.6499217", "0.6497203", "0.6496991", "0.64860934", "0.6481829", "0.6474427", "0.64742005", "0.6472188", "0.64704347", "0.6470399", "0.64691556", "0.6466086", "0.64631027", "0.6460095", "0.64524317", "0.64523494", "0.6448797", "0.6448796", "0.64481455", "0.644711", "0.64460015", "0.6445007", "0.6441944", "0.64411134", "0.6441012", "0.6436284", "0.6432192" ]
0.7154594
3
This update method is used to update the user's account details like firstname, lastname, email id, password, contact details etc.
def update #@my_accounts=@current_user.user_profile.update_attributes(params[:body]) @my_account=@current_user #@my_account.before_update_account(params[:body][:user]) @my_account.update_attributes(params[:body][:user]) #@my_accounts.after_update_account(params[:body][:user]) file=params[:body][:file] unless file[:encoded].empty? if @my_account.attachment.nil? Attachment.create_file(file[:encoded],@my_account,file[:file_name]) else Attachment.update_file(file[:encoded],@my_account,file[:file_name]) end end unless @my_account.errors.empty? render :json=>failure1(@my_account.errors) else render :json=>success1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n if @user.update(username: params[:username], email: params[:email], password: params[:password])\n render json: {status: 'SUCCESS', message: 'Account successfully updated', accessToken: @user.access_token}.to_json\n else\n render json: { errors: ['Update unsuccessful!'], status: 422 }.to_json\n end\n\n end", "def update\n @user = User.find(params[:id])\n\n @user.update(\n name: params[:user][:name],\n email: params[:user][:email]\n )\n # update user then redirect them to their own page\n flash[:update] = \"Account successfully updated.\"\n redirect_to user_path(@user)\n end", "def update \n user = User.find_by(username: @current_user.username)\n user.update!(username_edit_params)\n response = { message: Message.account_edited, status: :ok}\n json_response(response)\n end", "def updated_profile\n \n @user = User.find_by_id(session[:user_id])\n \n @user.name = params[:user][:name]\n @user.email = params[:user][:email]\n @user.address = params[:user][:address]\n @user.city = params[:user][:city]\n @user.pincode = params[:user][:pincode]\n @user.state = params[:user][:state]\n @user.contact_no = params[:user][:contact_no]\n\n if @user.save\n flash[:notice] = \"Changes Updated Successfully\"\n redirect_to :action => \"admin_profile\"\n else\n flash[:notice] = \"Changes are not updated\"\n end # if @user.save\n\n end", "def update\n response = UserAccount::Update.call(user_account_params)\n if response.success?\n success_response(message: response.status_message, http_status: 202, data: response.data)\n else\n error_response(message: response.status_message, data: response.data)\n end\n end", "def update_user\n end", "def update\n @user = User.find(current_user.id)\n if @user.update_attributes(user_params)\n redirect_to account_url, flash: { success: t(:update_user_success) }\n else\n render 'edit'\n end\n end", "def update!\n unless id\n raise \"user can not be updated before it is created.\"\n end\n hash = \"W10=\"\n\n payload = {\n \"id\" => id,\n \"email\" => @email_address,\n \"time_zone\" => @time_zone,\n \"country\" => @country,\n \"preferred_language\" => @language,\n \"receive_campaign_emails\" => \"true\",\n \"hash\" => hash,\n \"username\" => @email_address,\n \"last_login_at\" => get_last_login_at!,\n \"password\" => @password,\n \"password_confirmation\" => @confirm_password,\n \"user\" => {\n \"email\" => @email_address,\n \"password\" => @password,\n \"password_confirmation\" => @confirm_password,\n \"time_zone\" => @time_zone,\n \"receive_campaign_emails\" => \"true\",\n \"country\" => @country,\n \"preferred_language\" => @language\n }\n }\n\n response = authenticated_request(:put, \"api/client/users/#{id}\", payload: payload)\n response[:status]\n end", "def update\n @user.update! user_params\n logger.info \"Account updation succeed! #{@user.id}.\"\n render :show, status: :ok\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n redirect_to user_account_path(@user.id), :notice => \"Successfully updated Account!\"\n else\n render action: \"edit\"\n end\n end", "def update\n\t\tif current_user._id == user_params[:id]\n\t\t\t@user = User.find_by(:id => user_params[:id])\n\t\t\t@user.update({\n\t\t\t\tfirst_name: user_params[:first_name],\n\t\t\t\tlast_name: user_params[:last_name],\n\t\t\t\tphone_number: user_params[:phone_number],\n\t\t\t\tfacebook_link: user_params[:facebook_link],\n\t\t\t\tcar_model: user_params[:car_model],\n\t\t\t\tlicense_plate: user_params[:license_plate]\n\t\t\t})\n\t\t\t@user.save!\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\tuser: @user\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'You are not authorized to edit this field!'\n\t\t\t}, status: 422\n\t\tend\n\tend", "def update_account_user(id, options = {})\n post(\"accountuser/#{id}?_method=POST\", options)\n end", "def update\n\t\tparams[:user][:email] = params[:user][:email].strip\n\t\tparams[:user][:name] = params[:user][:name].strip\n\t\tputs params\n\t\tif @user.update_attributes(user_params)\n\t\t\tflash[:success] = \"Profile updated\"\n\t\t\tredirect_to edit_user_path\n\t\telse\n\t\t\trender 'edit'\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @account_user.update(account_user_params)\n format.html { redirect_to @account_user, notice: 'Account user was successfully updated.' }\n format.json { render :show, status: :ok, location: @account_user }\n else\n format.html { render :edit }\n format.json { render json: @account_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[\"user\"].each do |key, value| \n value.strip!\n if value == \"\"\n params[\"user\"].delete(key)\n end\n end\n \n params[\"user\"][\"email\"].downcase!\n \n @prev_user_info = User.find_by_id(params[\"user\"][\"id\"])\n existing_user = User.find_by_id(params[\"user\"][\"id\"])\n \n if !params[\"user\"][\"password_hash\"].blank?\n existing_user.password = params[\"user\"][\"password_hash\"]\n end\n\n if existing_user.update_attributes(params[\"user\"])\n @object = existing_user\n \n render \"user_success\"\n\n else\n @error_messages = existing_user.errors.to_a\n @user = User.new\n @new_item = User.find_by_id(params[\"id\"])\n\n render \"edit\"\n end\n end", "def update\n # User.find(current_user) vs plain current_user avoids failed name change to appear immediately in layout\n @user = User.find(current_user.id)\n \n # this needs to be passed to the object instance so that it validates the current password\n # any more elegant way to do it?\n @user.validate_current_password = true if account_section == 'password'\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Changes saved.\"\n format.html { redirect_to account_edit_url(account_section) }\n format.xml { head :ok }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update_attributes(user_params)\n flash[:success] = 'Account_updated'\n redirect_to dashboard_home_path\n else\n render 'users/registrations/edit'\n end\n end", "def update\n @user = @current_user\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'Account details updated.'\n format.html { redirect_to account_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\tif @user.update(user_params)\n\t\t\tflash[:notice] = \"User account was updated successfully.\"\n\t\t\tredirect_to user_path(@user)\n\t\telse\n\t\t\tflash[:error] = get_all_errors\n\t\t\trender 'edit'\n\t\tend\t\t\n\tend", "def update\n\t\tuser = User.find(params[:id])\n if user\n if @current_user.id == user.id\n \n user.encrypted_password = nil if params[:password]\n user.password = params[:password] if params[:password]\n user.password_confirmation = params[:password_confirmation] if params[:password]\n user.first_name = params[:first_name] if params[:first_name]\n user.last_name = params[:last_name] if params[:last_name]\n \n if user.save()\n payload = {\n error: false,\n id: user.id\n }\n render status: 200, json: payload\n else\n errors = []\n user.errors.keys.each do |key|\n errors << {field: key, message: user.errors.full_messages_for(key).first}\n end\n payload = {\n error: true,\n errors: errors\n }\n render status: 200, json: payload\n end\n else\n render status: 403\n end\n else\n render status: 404\n end\n\tend", "def update\n\t\tparams.permit!\n\t\t@user = User.find(params[:id])\n\t\t@first_name = params[:user][:first_name].to_s\n\t\t@second_name = params[:user][:second_name].to_s\n\t\t@last_name = params[:user][:last_name].to_s\n\n\t\tif @first_name != \"-\" and @second_name != \"-\" and @last_name != \"-\"\n\t\t\t\t@user.update_attribute(:active,1)\n\t\tend\t\n\n\t\tif User.find_by_id(session[:user_id]).access != \"admin\" and @user_id == session[:user_id]\n\t\t\tif\tUser.authenticate(@user.name, params[:old_password]) == @user\n\t\t\t\t@user.update_attribute(:password, \"#{params[:user][:password]}\")\n\t\t\telse\n\t\t\t\tparams[:user][:password] = \"\"\n\t\t\tend\n\t\tend\n\t\t\t\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url,\n :notice => \"User #{@user.name} was successfully updated.\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@user = current_user\n\t\t@user.name = params[:name]\n\t\t@user.phone = params[:phone]\n\t\t@user.phone_operator = params[:phone_operator]\n\t\tif @user.save\n\t\t\tsession[:user_id] = @user.id\n\t\t\tflash[:notice] = \"Details Updated.\"\n\t\t\tredirect_to(dashboard_path)\n\t\telse\n\t\t\tflash[:alert] = \"Unable to update profile\"\n\t\t\trender \"edit\", layout: \"application_inside\"\n\t\tend\n\tend", "def update\n @user = User.find(params[:id]) \n p @user\n\n # p params[:user]\n \n # @user.update(user_params2)\n if @user.update_attribute(:name,params[:user][:name]) && \n @user.update_attribute(:email,params[:user][:email]) &&\n @user.authenticate(params[:user][:password])\n flash[:success] = \"Profile Updated\"\n redirect_to @user\n else\n flash[:success] = \"Password is wrong\"\n redirect_to @user\n end\n \n \n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n flash[:notice] = \"Your account was updated successfully.\"\n else\n flash[:notice] = \"There was a problem updating your account.\"\n end\n redirect_to user_path(@user)\n end", "def update\n\t\t@user = User.find(params[:id])\n \t@user.valid?\n \t@user.errors.messages\n \t\tif @user.update(account_params)\n \t\tredirect_to '/cool'\n \t\telse\n \t\t\tflash[:error] = 'Please enter all content'\n \t\tredirect_to :back\n \t\tend\n\tend", "def update\n if not params[:id]\n redirect_to root_path\n end\n user = User.find(params[:id])\n # update fields\n user.first_name = user_params[:first_name]\n user.last_name = user_params[:last_name]\n user.age = user_params[:age]\n user.education = user_params[:education]\n user.school = user_params[:school]\n user.expertise = user_params[:expertise]\n user.description = user_params[:description]\n user.availability = user_params[:availability]\n user.save\n \n # update complete flag\n if not user.complete\n all_fields_filled = true\n user_params.each do |k, v|\n if v.blank?\n all_fields_filled = false\n end\n end\n if all_fields_filled \n user.complete = true\n user.save\n else\n flash[:warning] = \"Some profile information is still missing. Please fill out the missing fields so that we can determine the best projects for you!\"\n end\n\n if not flash[:warning]\n flash[:notice] = \"Profile was successfully updated.\"\n end\n end\n\n redirect_to user_path(params[:id])\n end", "def updateUser(linkedInInfo, user)\n user.update_attributes(:firstName => getValueFromLinkedInInfo(linkedInInfo, 'firstName'),\n :lastName => getValueFromLinkedInInfo(linkedInInfo, 'lastName'),\n :location => getValueFromLinkedInInfo(linkedInInfo, 'location'),\n :industry => getValueFromLinkedInInfo(linkedInInfo, 'industry'),\n :numConnections => getValueFromLinkedInInfo(linkedInInfo, 'numConnections'),\n :position => getValueFromLinkedInInfo(linkedInInfo, 'title'),\n :company => getValueFromLinkedInInfo(linkedInInfo, 'company'),\n :emailAddress => getValueFromLinkedInInfo(linkedInInfo, 'emailAddress'))\n user.save\n return user\n end", "def update\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n puts params\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n @user = current_user\n @user.update_attributes(user_params)\n current_user.save\n render_wizard @user\n end", "def update\n account_update_params = devise_parameter_sanitizer.sanitize(:account_update)\n\n # This is required for the form to submit when the password is left blank.\n if account_update_params[:password].blank?\n account_update_params.delete('password')\n account_update_params.delete('password_confirmation')\n end\n\n @user = User.find(current_user.id)\n if @user.update_attributes(account_update_params)\n set_flash_message ':notice', :updated\n\n # Sign in the user and bypass validation in case the password changed.\n sign_in @user, bypass: true\n redirect_to after_update_path_for(@user)\n else\n render 'edit'\n end\n end", "def update\n @user = current_user\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'Your profile has been updated'\n format.html { redirect_to account_path() }\n else\n flash[:notice] = 'We couldn\\'t update your profile. Fix the errors, and let\\'s try again'\n format.html { redirect_to account_path() }\n end\n end\n end", "def update_account\n\n @user = User.find(current_user.id)\n\n successfully_updated = @user.update_with_password(user_params)\n\n if successfully_updated\n set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n bypass_sign_in @user\n redirect_to user_path(@user.username)\n else\n render \"edit_account\"\n end\n\n end", "def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update_account(options)\n password = options[:new_password]\n parameters = { :curpass => options[:current_password], :email => options[:email], :newpass => password, :verpass => password, :api_type => :json }\n\n post('api/update', parameters)\n end", "def update_user_details_in_chargify\n unless self.account.chargify_customer_id.blank?\n\n if self.roles.any? { |r| r.title == 'account_holder' }\n chargify_customer = Chargify::Customer.find_by_reference(self.account.id)\n chargify_customer.first_name = self.firstname\n chargify_customer.last_name = self.lastname\n chargify_customer.email = self.email\n chargify_customer.save\n end\n end\n end", "def update\n\t@user = User.find(params[:id])\n\tif @user.update_attributes(user_params)\n\t\tflash[:notice] = \"Your account was updated successfully.\"\n\telse\n\t\tflash[:notice] = \"There was a problem updating your account.\"\n\tend\n\tredirect_to user_path(@user)\nend", "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def update\n @account = Account.find(params[:id]) \n if @account.update_attributes!(params[:account])\n flash[:success] = \"Profile updated\"\n sign_in @account\n redirect_to @account\n else\n render 'edit'\n end\n end", "def update\n \n oldUser = User.find(current_user.id)\n @user = User.find(current_user.id)\n\n successfully_updated = if needs_password?(@user, account_update_params)\n @user.update_with_password(account_update_params)\n else\n # remove the virtual current_password attribute update_without_password\n # doesn't know how to ignore it\n params[:user].delete(:current_password)\n @user.update_without_password(account_update_params)\n end\n\n if successfully_updated\n \n ## Move the user profile photo from tmp to user directory\n if @user.profile_photo!=\"\"\n move_tmp_user_photo(@user)\n end\n \n #update latitude longitude here ...\n if @user.user_type == \"fan\" || @user.user_type == \"artist\"\n #//check if the address has been changed\n addressChanged = !((oldUser.country_id == @user.country_id) && (oldUser.state_id == @user.state_id) && (oldUser.zip ==@user.zip) && (oldUser.city == @user.city))\n if addressChanged\n fullAddress = \"\"\n countryName = \"\"\n stateName = \"\"\n if @user.country_id.to_i > 0\n countryRow = Country.where(\"id = ? \",@user.country_id.to_i).take\n if countryRow != nil\n countryName = countryRow.country_name\n end\n end\n \n if @user.state_id.to_i > 0\n stateRow = State.where(\"id = ? \",@user.state_id.to_i).take\n if stateRow != nil\n stateName = stateRow.state_name\n end\n end\n \n if @user.zip.to_s != \"\"\n fullAddress = URI.encode(@user.zip)\n end\n \n if @user.city.to_s !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(@user.city)\n else\n fullAddress += \",\"+URI.encode(@user.city)\n end \n end\n \n if stateName !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(stateName)\n else\n fullAddress += \",\"+URI.encode(stateName)\n end \n end\n \n if countryName !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(countryName)\n else\n fullAddress += \",\"+URI.encode(countryName)\n end \n end\n \n #render text: fullAddress and return\n if !fullAddress.blank?\n lat_long = Geocoder.coordinates(fullAddress)\n cUser = User.find(@user.id);\n if lat_long!=nil\n cUser.update_attributes(:latitude => lat_long[0],:longitude => lat_long[1])\n end \n end \n end \n end\n \n set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n sign_in @user, :bypass => true\n redirect_to after_update_path_for(@user)\n else\n render \"edit\"\n end\n end", "def update\n id = params[ :id ]\n\n if ( @current_user.restricted? and @current_user.id != id.to_i )\n return appctrl_not_permitted()\n end\n\n @user = User.find( id )\n\n if ( @current_user.admin? and params[ :notify_user ] )\n EmailNotifier.admin_update_notification( @user ).deliver()\n end\n\n # New user just set up a previously uninitialised account (no\n # e-mail yet stored - update_and_save_user will take that from\n # the params hash) or a normal account edit?\n\n if ( @user.nil? or @user.name.empty? )\n if ( User.count == 1 )\n message = 'New administrator account created. You can now set up whatever ' <<\n 'initial customers, projects and tasks you need.'\n else\n message = 'New account created. Before you can use the service fully, the ' <<\n 'administrator will have to configure some account settings. You ' <<\n 'will be notified by e-mail when this process is complete. Please ' <<\n \"direct queries to the administrator at '#{ EMAIL_ADMIN }'.\"\n end\n\n update_and_save_user(\n message,\n 'edit',\n true\n )\n else\n update_and_save_user( 'User details updated.', 'edit' )\n end\n end", "def update\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n account = Account.find_by(user_id: user[\"id\"], id: params[:id])\n \n if ( account == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n if account.update(account_params)\n render json: account, status: :ok\n else\n render json: account.errors, status: :unprocessable_entity\n end\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end", "def update\n # @user = User.find(params[:id])\n @user = current_user # makes our views \"cleaner\" and more consistent\n params[:user][:existing_identity_attrs] ||= {}\n unless configatron.user_can_change_login\n params[:user].delete(:login)\n @user_login_is_readonly = true\n end\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Account updated!\"\n format.html { redirect_to account_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update_attributes params[:user]\n if @user.id == current_user.id\n flash[:notice] = \"Your account was successfully updated.\"\n else\n flash[:notice] = \"#{@user.full_name} account was successfully updated.\"\n end\n if current_user.administrator?\n redirect_to users_path\n else\n redirect_to dashboard_path\n end\n else\n render :action => :edit\n end\n end", "def update\n @user = current_user\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Updated your account settings!\"\n redirect_to(account_path)\n else\n @title = \"Account and Notification Settings\"\n flash[:error] = \"Error updating your account settings.\"\n render(:action => 'show')\n end\n end", "def update_user_with_sfdc_info(id, sfdc_account_info, sfdc_authentication)\n u = User.find(id)\n u.access_token = sfdc_authentication.access_token\n u.sfdc_username = sfdc_account_info.sfdc_username\n u.profile_pic = sfdc_account_info.profile_pic\n u.accountid = sfdc_account_info.accountid\n u.save\n end", "def update\n #Can update first name, last name, email and handle\n #@user = get_user_for_update(params[:id])\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n user_session.name = @user.full_name\n flash_notice(:user_data_updated)\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n flash_error(:user_data_not_updated)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n rescue\n logger.error(\"error updating user\")\n end", "def account_update_params()\n params.require(:user).permit(:First_Name, :Last_Name, :UserName, :email, :password, :password_confirmation, :Age_Agreement, :current_password)\n end", "def update\n #@user = User.find(params[:id])\n \n #@update_pass = 0\n #puts @change_password\n if @user.update_attributes(params[:user])\n # :name => params[:user][:name],\n # :surname => params[:user][:surname],\n # :nif => params[:user][:nif],\n # :address => params[:user][:address],\n # :email => params[:user][:email],\n # :phone => params[:user][:phone])\n #if @user.valid?\n flash[:success] = \"Profile updated.\"\n redirect_to @user\n else\n @title = \"Edit user\"\n render 'edit'\n end\n end", "def update\n respond_to do |format|\n if @user_account.update(user_account_params)\n format.html { redirect_to @user_account, notice: 'User account was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_account }\n else\n format.html { render :edit }\n format.json { render json: @user_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @t_user_account.update(t_user_account_params)\n format.html { redirect_to @t_user_account, notice: 'T user account was successfully updated.' }\n format.json { render :show, status: :ok, location: @t_user_account }\n else\n format.html { render :edit }\n format.json { render json: @t_user_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # If no user is found, render an error.\n user = User.find_by_id(params[:id])\n if user.nil?\n render 'shared/http_status', locals: {code: '404', message:\n 'User was not found'}, status: 404\n return\n end\n\n # Create a hash to hold fields/values to be updated for the user\n attributes = {}\n\n unless params[:user_name].blank?\n # Make sure the user_name isn't taken\n other_user = User.find_by_user_name(params[:user_name])\n if !other_user.nil? && other_user != user\n render 'shared/http_status', locals: {code: '409', message:\n 'Username already in use'}, status: 409\n return\n end\n attributes[:user_name] = params[:user_name]\n end\n\n attributes = process_attributes(params, attributes)\n\n user.attributes = attributes\n unless user.save\n # Some error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n return\n end\n\n # Otherwise everything went alright.\n render 'shared/http_status', locals: {code: '200', message:\n HttpStatusHelper::ERROR_CODE['message']['200']}, status: 200\n end", "def update\n if @user.update_attributes(users_params)\n flash[:success] = \"Nailed it! You've successfully updated your account information.\"\n redirect_to user_path(@user)\n else\n render 'edit' # automatically saves valid information on form\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n flash[:success] = 'Changes to your account information have been saved.'\n redirect_to @user\n else\n @page_title = \"Edit user #{@user.id}\"\n render 'edit'\n end\n end", "def update_user(data, options = {})\n GoodData::Domain.update_user(data, { client: client }.merge(options))\n end", "def update\n if current__user.isAdmin || current__user == @user\n if @user.update(user_update_params)\n # setToken\n # UserNotifierMailer.send_signup_email(@user).deliver\n render :show, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n render json: 'Sorry you are not allowed to perform this operation.', status: :unprocessable_entity\n end\n end", "def update\n @user_account = UserAccount.find(params[:id])\n\n respond_to do |format|\n if @user_account.update_attributes(params[:user_account])\n format.html { redirect_to(@user_account, :notice => 'User account was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @account.update(account_params)\n redirect_to root_path, notice: 'Account was successfully updates.'\n else\n redirect_to root_path, alert: 'Some thing went wrong! try more...'\n end\n end", "def update\n\t\tthe_user_id = params[\"id\"]\n \tuser = User.find_by(:id => the_user_id)\n \tuser.first = params[\"first\"]\n \tuser.last = params[\"last\"]\n \tuser.email = params[\"email\"]\n user.phone = params[\"phone\"]\n user.add_l1 = params[\"add1\"]\n \tuser.city = params[\"city\"]\n \tuser.state = params[\"state\"]\n \tuser.zip = params[\"zip\"]\n \tuser.age = params[\"age\"]\n \tuser.save\n \tredirect_to show_lobbys_url\n\tend", "def update\n respond_to do |format|\n current_user.assign_attributes(user_params)\n\n notice = 'Profile was successfully updated.'\n notice = \"A confirmation link has been sent to your new email address. Please click it to complete your update.\" if current_user.email_changed?\n\n if current_user.save\n format.html { redirect_to edit_profile_path, notice: notice }\n format.json { render :edit, status: :ok, location: current_user }\n else\n format.html { render :edit }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def account_update_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :current_password)\n end", "def update\n #\n # Update Record / Change Password\n #\n if token_present? && @current_account\n if @current_account.email != params[:id]\n return render_error(422, :WRONG_PARAM, \"email\")\n end\n # Do any privileged operations here, we're authenticated\n # IE update name, update email?, update password\n update_account_authenticated\n #\n # ResetPassword/Confirm Account\n #\n else\n # Not authenticated...couple things we could be trying to do\n @account = Account.first_by_email(params[:id])\n if @account.nil?\n # No account found\n render_error_modelname(404, :MISSING_RECORD, User)\n #resend confirmation token (and regenerate token if expired)\n elsif params['resend'].present?\n update_resend_account\n #if the confirmation token has expired, error out\n elsif !@account.confirmed? && @account.send(:confirmation_period_expired?)\n render_error(401, \"Confirmation Token Expired\")\n elsif !@account.confirmed? && (params[:confirmation_token].present? || params[:old_password].present?)\n # Unconfirmed accounts\n # Confirming and setting name and password details\n update_and_confirm_account\n elsif @account.confirmed? && params[:reset_password_token]\n update_and_reset_password\n else\n name = \"User=#{params[:id]}\"\n log_security_unauthorized_alert_message(\"User\", name, \"not authenticated\")\n render_error(401, :UNAUTHORIZED)\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:notice] = \"This user has been updated.\"\n redirect_to admin_accounts_path\n else\n flash[:notice] = \"This user could not be updated.\"\n render :action => \"edit\"\n end\n end", "def update\n @user_account = UserAccount.find(params[:id])\n\n respond_to do |format|\n if @user_account.update_attributes(params[:user_account])\n format.html { redirect_to user_account_url(@user_account.user, @user_account), notice: 'User account was successfully updated.' }\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_account.errors, status: :unprocessable_entity }\n format.xml { render xml: @user_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @update_success = @user.update(user_params)\n super\n end", "def update\n @user = User.find_by_id(session[:user_id])\n\n #check password\n if !@user.authenticate(params[:password])\n flash[:error] = \"Incorrect password\"\n redirect_to(:action => \"update_form\")\n return\n end\n\n #update details\n _birth = Date.civil(params[:birth][:year].to_i, params[:birth][:month].to_i, params[:birth][:day].to_i)\n if @user.update_attributes(:password => params[:password], :email => params[:email], :first_name => params[:first_name], :mid_name => params[:mid_name], :last_name => params[:last_name], :birth => _birth)\n flash[:notice] = \"Details updated successfully. \"\n redirect_to(:action => \"update_form\")\n else\n flash[:error] = \"Failed to update user:\" + @user.errors.full_messages[0]\n redirect_to(:action => \"update_form\")\n end\n end", "def account_update_params\n params.require(:user).permit(:username, :bio, :email, :password, :password_confirmation, :current_password, :full_name, :profile_image_datafile)\n end", "def update_account(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n account = find_account(accounts, options[:email])\n if !account.nil?\n if !options[:firstname].nil?\n account.given_name = options[:firstname]\n end\n if !options[:surname].nil?\n account.surname = options[:surname]\n end\n if !options[:username].nil?\n account.username = options[:username]\n end \n if !options[:password].nil?\n account.password = options[:password]\n end\n if !options[:status].nil?\n account.status = (options[:status] == \"disabled\" ? Stormpath::Resource::Status::DISABLED : Stormpath::Resource::Status::ENABLED)\n end\n\n begin\n account.save\n puts \"Account updated.\"\n rescue Stormpath::Error => e\n print_error(e)\n end\n else\n puts \"Account not found\"\n return\n end\nend", "def update\n @user = LinkedData::Client::Models::User.find(params[:id])\n @user = LinkedData::Client::Models::User.find_by_username(params[:id]).first if @user.nil?\n @errors = validate_update(user_params)\n if @errors.size < 1\n\n if params[:user][:password]\n error_response = @user.update(values: { password: params[:user][:password] })\n else\n user_roles = @user.role\n\n if @user.admin? != (params[:user][:admin].to_i == 1)\n user_roles = update_role(@user)\n end\n\n @user.update_from_params(user_params.merge!(role: user_roles))\n error_response = @user.update\n end\n\n if response_error?(error_response)\n @errors = response_errors(error_response)\n # @errors = {acronym: \"Username already exists, please use another\"} if error_response.status == 409\n render action: \"edit\"\n else\n flash[:notice] = 'Account was successfully updated'\n\n if session[:user].username == @user.username\n session[:user].update_from_params(user_params)\n end\n redirect_to user_path(@user.username)\n end\n else\n render action: \"edit\"\n end\n end", "def update\n @user = current_user\n @user.update(user_params)\n render_wizard @user\n end", "def update\n @user = params[:id].nil? ? current_user : User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(safe_params[:user])\n format.html { redirect_to \"/\", notice: \"Account updated!\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n account = current_organization.accounts.find(params[:id])\n return forbidden unless account && current_account.allowed_to_edit_account?(account, current_organization)\n return json(account) unless account.update_attributes pick(params, :first_name, :last_name, :email,:language, :document_language)\n\n role = pick(params, :role)\n #account.update_attributes(role) if !role.empty? && current_account.admin?\n membership = current_organization.role_of(account)\n membership.update_attributes(role) if !role.empty? && current_account.admin?\n password = pick(params, :password)[:password]\n if (current_account.id == account.id) && password\n account.update(password: password)\n end\n json account.canonical(membership: membership)\n end", "def update\n respond_to do |format|\n if @account.update(account_params)\n format.html { redirect_to edit_user_info_path(session[:user_info_no]) }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n @user.username = params[\"user\"][\"username\"]\n @user.email = params[\"user\"][\"email\"]\n @user.user_detail.first_name = params[\"user_detail\"][\"first_name\"]\n @user.user_detail.last_name = params[\"user_detail\"][\"last_name\"]\n @user.user_detail.dob = params[\"user_detail\"][\"dob\"]\n @user.user_detail.address = params[\"user_detail\"][\"address\"]\n if @user.save\n redirect_to :users\n else \n flash[\"alert\"] = @user.errors.full_messages.to_sentence\n puts @user.errors.full_messages.to_sentence\n redirect_to :action => 'edit'\n end\n end", "def update\n if current_user.update(user_params)\n redirect_to user_path(current_user), notice: 'Your profile was successfully updated.'\n else\n render :edit\n end\n end", "def update\n # this finds the current user\n @user = User.find params[:id]\n # just setting the variable 'p' to user_params\n p = user_params\n # here we are checking to see if the user updated some\n # part of their info, but didn't enter anything for password.\n # we infer from this that they weren't trying to update their\n # password, and so this method removes the password from the\n # params that we pass into the update method.\n if user_params[:password].blank?\n p.delete(:password)\n p.delete(:password_confirmation)\n end\n # this updates what the user changed?\n @user.update! p\n # flash message after they have updated info\n flash[:notice] = \"Successful update\"\n # redirects the user to their newly update profile?\n redirect_to user_path(@user)\n end", "def account_update_params\n params.require(:user).permit(:name, :last_name, :email, :password, :password_confirmation, :current_password)\n end", "def update\n @user = User.find_by_username(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:success] = \"Account updated.\"\n format.html { redirect_to @user }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find_by(id: params[:id])\n if @user.update_attributes :username => user_params[:username], :email => user_params[:email], :password => user_params[:password]\n render :show\n else\n render :edit\n end\n end", "def update\n modified_params = user_params\n modified_params.delete(\"password\") if modified_params[\"password\"].empty?\n if @user.update(modified_params)\n @users = current_user.users\n end\n end", "def update\n @profile = Account.find(params[:id])\n\t if @profile.update_attributes!(update_params)\n\t if @profile.save\n redirect_to profile_index_path, notice: \"Account was successfully saved.\"\n end\n else\n flash[:alert] = \"Account failed to save\"\n redirect_to profile_index_path\n end\n end", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update_user_info(opts)\n opts[:birthday] = format_date(opts[:birthday]) if opts[:birthday]\n post(\"/user/#{@user_id}/profile.json\", opts)\n end", "def update\n\t\t@user = User.find(params[:id])\n\t\t@user.update_attributes(user_params)\n\t\t\tflash[:success] = \"Profile updated!\"\n\t\t\tredirect_to @user\n\tend", "def account_update_params\n\t\tparams.require(:user).permit(:email, :password, :password_confirmation, :username, :current_password, :age, :bio, :gender)\n\tend", "def account_update_params\n params.require(:user).permit(\n :email,\n :password,\n :password_confirmation,\n :current_password,\n :username,\n :firstname,\n :lastname\n )\n end", "def update\n @user = User.update(user_params)\n end", "def update\n if current_user.update_attributes(user_params)\n redirect_to current_user, notice: 'Profile successfully updated.'\n else\n render 'edit'\n end\n end", "def update\n if @user.update_attributes(params[:user])\n if params[:user][:password].present?\n # this logic needed b/c devise wants to log us out after password changes\n user = Spree::User.reset_password_by_token(params[:user])\n sign_in(@user, :event => :authentication, :bypass => !Spree::Auth::Config[:signout_after_password_change])\n end\n if request.xhr?\n render \"spree/shared/close_dialog\"\n else\n redirect_to spree.account_url, :notice => Spree.t(:account_updated) \n end\n else\n render :edit\n end\n end", "def update\n @user = User.update(params[:user])\n end", "def update\n @user = User.find(params[:id])\n unless @account.admin || @account.username==@user.username\n flash[:warning] = \"You do not have enough access rights to edit this user.\"\n redirect_to root_path\n return\n end\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(root_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(user_params)\n flash[:success] = \"Your profile was updated successfully\"\n redirect_to current_user\n else\n flash[:error] = \"Something went wrong. Please try again\"\n end\n\n end", "def update\n if @user.update_columns(first_name: params[:user][:first_name], last_name: params[:user][:last_name])\n flash[:success] = \"Update success\"\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n @user = User.find_by_urlname(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Account updated successfully\"\n format.html { redirect_to user_path(@user) }\n format.xml { head :ok }\n else\n flash[:error] = \"There were problems updating the profile\"\n format.html { render :action => 'edit' }\n format.xml { @user.errors.to_xml }\n end\n end\n end", "def update\n result = Users::UpdateCommand.new(current_user: current_user).call(update_user_params)\n\n render(json: result.value.as_json, status: :created)\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:success] = \"Profile updated\"\n sign_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:success] = \"Profile updated\"\n sign_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(params.require(:user).permit(:username, :email))\n redirect_to users_path\n else\n render 'edit'\n end\n end", "def update\n @account = current_account \n respond_to do |format|\n if @account.update_attributes(params[:account])\n flash[:notice] = 'Account was successfully updated.'\n format.html { redirect_to user_account_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n @user.guid = params[:user][:guid]\n @user.accountgroup_id = params[:user][:accountgroup_id]\n @user.viewer_userID = params[:user][:username]\n @user.language_id = params[:user][:language_id]\n @user.viewer_isActive = params[:user][:is_active]\n @user.viewer_lastLogin = params[:user][:last_login]\n @user.remember_token = params[:user][:remember_token]\n @user.remember_token_expires_at = params[:user][:remember_token_expires_at]\n @user.email_validated = params[:user][:email_validated]\n @user.developer = params[:user][:developer]\n @user.facebook_hash = params[:user][:facebook_hash]\n @user.facebook_username = params[:user][:facebook_username]\n \n if @user.save\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(accountadmin_user_path(@user)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n user_params = params.require(:user).permit(:first_name, :last_name, :bio, :email, :image)\n user = User.find_by username: params[:username]\n if !user || user.id != session[:user_id]\n flash[:error] = \"You are not authorized to edit this user's profile.\"\n redirect_to user_path params[:username]\n else\n user.update_attributes(user_params)\n redirect_to user_path(user.username)\n end\n end", "def update\n @user = @current_user\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'Account updated!') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(self.current_user.id)\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n redirect_to :action => 'profile'\n else\n render :action => 'edit'\n end\n end" ]
[ "0.77663153", "0.7693334", "0.7693111", "0.7604531", "0.75612116", "0.7513157", "0.75130856", "0.7504295", "0.74569434", "0.7436344", "0.74172926", "0.7413689", "0.7364494", "0.7331689", "0.73256224", "0.7323617", "0.7321192", "0.73104686", "0.7297421", "0.72915566", "0.72797865", "0.7270883", "0.72609943", "0.7238486", "0.7234705", "0.72195643", "0.72115993", "0.7208046", "0.7172735", "0.71696", "0.716476", "0.7157684", "0.71560043", "0.7151364", "0.71435755", "0.7134914", "0.7126843", "0.71255296", "0.7123489", "0.711623", "0.7104907", "0.71037", "0.7100594", "0.70978385", "0.7096235", "0.7096163", "0.70917124", "0.7086063", "0.7084876", "0.70801705", "0.70747817", "0.7065771", "0.7057203", "0.7056632", "0.7048711", "0.70465875", "0.7035049", "0.7034802", "0.70328885", "0.7032594", "0.70305604", "0.7028908", "0.70272523", "0.70244837", "0.70075166", "0.69936264", "0.69932157", "0.69841707", "0.69804937", "0.6971483", "0.6963464", "0.69589496", "0.69541746", "0.69531924", "0.69528943", "0.69515216", "0.6949935", "0.6947791", "0.69456005", "0.69455767", "0.6943667", "0.694087", "0.69387966", "0.6936943", "0.6926551", "0.6925832", "0.6924199", "0.69200236", "0.69167566", "0.6916627", "0.69083726", "0.6907586", "0.6905089", "0.69045925", "0.69045925", "0.6902333", "0.6899189", "0.68982446", "0.68872255", "0.68862134", "0.6885293" ]
0.0
-1
This confirmation method saves user's accont details
def confirm @profiles=@current_user.user_profile.update_attributes(params[:body]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show \n @user.confirmed = true\n @user.save!\n Session.create(@user)\n flash[:notice] = \"Thanks, your email address has been confirmed.\" \n redirect_to dashboard_url \n end", "def confirm\n approval = Approval.find_by(id: params[:id])\n approval.approval = true\n approval.save\n redirect_to users_path\n end", "def approve_user\n user = User.find(params[:id])\n user.update_attributes(coop_id: params[:coop_id])\n flash[:success] = \"#{user.name} has been admitted to \\\n #{Coop.find(user.coop_id).name}. Thanks MemCo!\"\n\n redirect_to root_url\n notify_user_approval(user, params[:coop_id])\n end", "def confirm\n\n end", "def confirm!\n self.confirmation_token = nil\n self.confirmed_at = Time.now.utc\n save(:validate => false)\n end", "def confirmed!\n @_confirmed = false\n self.confirmed = true\n save\n end", "def after_confirmation\n end", "def confirm_account\n confirm\n end", "def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end", "def update_confirm\n \t@id = params[:id]\n \t@name = params[:name]\n @email = params[:email]\n @role = params[:role]\n @phone = params[:phone]\n @dob = params[:dob]\n @address = params[:address]\n @profile = params[:profile]\n \n @user = UserProfileForm.new(id: @id,name: @name, email: @email, role: @role, phone: @phone, dob: @dob, address: @address, profile: @profile)\n end", "def confirm\n \t\tuser = User.find_by_uid params[:uid]\n \t\tuser.confirm_email params[:confirmation_code]\n \t\tif not user.confirmed?\n \t\tflash[:error] = \"You're link doesn't match what we have on record.\"\n \t\tredirect_to signup_path\n \t\telse\n \t\tsession[:user] = user\n \t\tflash[:success] = \"We will update you at #{user.email} with new information as it because available\"\n \t\tredirect_to dashboard_path\n \t\tend \n \tend", "def confirm_mandate\n begin\n redirect_flow = GO_CARDLESS_CLIENT.redirect_flows.complete(\n params[:redirect_flow_id],\n params: { session_token: \"#{current_user.id}\" }\n )\n current_user.go_cardless_customer = redirect_flow.links.customer\n current_user.go_cardless_mandate = redirect_flow.links.mandate\n\n if current_user.save(validate: false)\n create_gocardless_subscription\n flash[:notice] = 'Your payment has been successfully completed and subscription added to your GoCardless bank account.'\n else\n flash[:error] = 'Something went wrong!'\n end\n rescue StandardError => e\n flash[:error] = e\n end\n redirect_to root_path\n end", "def confirm\n @petition = @signature.petition\n # generate the update signature url\n @url = petition_signature_confirm_submit_path(@petition, @signature.unique_key)\n\n # check if we are in the unconfirmed table\n if @signature.class == NewSignature\n\n # check if we need to have extra information\n # and inform user about it\n if @signature.require_full_address? ||\n # @signature.require_person_birth_city? ||\n @signature.require_born_at? ||\n @signature.require_person_country?\n\n # create the information needed messages\n @action = t('confirm.form.action.confirm_and_save')\n @message = t('confirm.form.add_information_and_confirm')\n else\n # we don't need extra information so everything is fine\n @message = t('confirm.form.is_confirmed_add_information')\n end\n # always move new_signature to signature\n # since the user must be real\n confirm_signature\n else\n @message = t('confirm.form.update_information')\n @action = t('confirm.form.action.add_details')\n end\n # add some javascript data to allow for data checking\n add_check_fields\n end", "def confirm_account(user)\n @name = user.first_name\n @confirm_url = confirm_url(user.token)\n\n mail to: user.email, subject: 'Account confirmation'\n end", "def approve(user)\n set_attachments\n\n @user = user\n mail(to: @user.email, subject: \"Cuenta Activada @ Social Target - Its time to go social\")\n end", "def confirm!\n # add if else here in case user already existed and is updating/changing data (email etc),\n # shouldn't add_profile again if profile already exists. can determine with a user db 'nil' value...\n unless self.profile\n add_profile\n end\n super\n end", "def after_confirmation; end", "def account_confirmed(user)\n @notify_subject = strip_tags( \"USER CONFIRMED ACCOUNT AT #{ENV['APPLICATION_CONFIG_name']}\")\n @user = user\n mail( :to => ENV['APPLICATION_CONFIG_admin_notification_address'], :subject => @notify_subject)\n end", "def approve_user\n @user = User.find(params[:id])\n\n @user.approved_torcida = true\n @user.save(validate: false)\n redirect_to root_path\n end", "def identityconfirmation\n # procura o professor selecionado na lista\n @professor = Professor.where(:name => params[:professor][:name])[0]\n # faz o envio do e-mail de confirmação para o respectivo professor\n ProfessorMailer.with(professor: @professor).key_email.deliver_now\n end", "def confirm\n user = User.find(params[:id])\n authorize user\n if user.state != \"active\"\n user.confirm\n user.make_user_a_member\n\n # assume this type of user just activated someone from somewhere else in the app\n flash['notice'] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n end", "def activation_confirmation(user)\n user_login_link(user)\n\n @greeting = \"Thank you for choosing Contractor\"\n @name = user.name\n\n mail to: user.email\n end", "def signup_confirmation_advisee(user)\n @user = user\n mail to: @user.email, subject: \"Advisee new registration\"\n end", "def confirm!\n self.pending = false\n self.save\n self.createDebts\n end", "def update_user_details_in_chargify\n unless self.account.chargify_customer_id.blank?\n\n if self.roles.any? { |r| r.title == 'account_holder' }\n chargify_customer = Chargify::Customer.find_by_reference(self.account.id)\n chargify_customer.first_name = self.firstname\n chargify_customer.last_name = self.lastname\n chargify_customer.email = self.email\n chargify_customer.save\n end\n end\n end", "def activate\n @user = User.find(params[:id])\n\n \tif @user.user_state == \"confirmed\"\n flash[:notice] = \"\" + @user.first_name + \", your account is already confirmed.\"\n redirect_to(:action => 'confirmed', :id => params[:id])\n else\n\t\t\trespond_to do |format|\n\t\t\t\tif @user.update_attributes(params[:user])\n\t\t \t\t@user.user_state = \"confirmed\"\n\t\t\t\t\t@user.confirmed_at = Time.now\n\n\t\t\t\t\tif @user.update_attributes(params[:user])\t\t\t\t\t\t\n\t\t\t\t\t\tNotifier.user_confirmed(@user).deliver\n\t\t\t\t\t\tflash[:notice] = \"You're all set, \" + @user.first_name + \"!\"\n\t\t\t\t\t\tformat.html { redirect_to(:action => 'completed', :id => params[:id]) }\n\t\t\t\t\telse\n\t\t\t\t\t\tflash[:error] = 'Failed to set user state to confirmed. Please try again.'\n\t\t\t\t\t\tformat.html { render :action => \"invitation\", :layout => \"activate\" }\n\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = 'User was not updated.'\n\t\t\t\t\tformat.html { render :action => \"invitation\", :layout => \"activate\" }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n end", "def signup_confirmation(user)\n @user= user\n debugger\n mail to: @user.email , subject: \"MovieBox Sign Up Confirmation\"\n \n end", "def create_cleaner_account_confirmation(account)\n\t\t@first_name = account.first_name\n\t\t@last_name = account.last_name\n\t\t@email = account.email\n\n mail(:to => \"tom@cleanjay.ca\", :subject => \"New Cleaner Signup!\")\n end", "def confirmed?; end", "def create\n @fava_user = FavaUser.new(user_params)\n\n @fava_user.update(fava_points: 20)\n respond_to do |format|\n if @fava_user.save\n UserMailer.account_activation(@fava_user).deliver_now\n flash.now[:info] = \"Please check your email to activate your account.\"\n format.html {redirect_to confirm_path}\n else\n format.html { render :new }\n format.json { render json: @fava_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def confirm\r\n # Change user status to active\r\n update(status: :active)\r\n # Update all pending company_roles to active\r\n company_roles.update_all(status: 1)\r\n NotifyMailer.welcome_mail(self).deliver_later\r\n super\r\n end", "def confirm!\n update!(confirmed_at: DateTime.now)\n end", "def signup_confirmation user\n @user = user\n mail to: user.email, subject: \"Welcome to the Clone\"\n end", "def confirmed_it\n #look up user\n url = request.fullpath\n id = url[9]\n u = User.find(:id => user_id)\n # check code to paramater code\n if u.confirmation_code == confirmation_code then\n u.confirmed = true\n u.save\n #if all clear log them in and go to dashboard\n session[:user] = User.authenticate(u.email, u.password)\n redirect_to :action => \"dashboard\", :controller => 'sessions' \n end\n redirect_to :action => \"signup\", :controller => 'prelogins' \n end", "def transaction_created(user)\n @user = user\n mail to: user.email, subject: \"Sign Up Confirmation\"\n end", "def confirm_user(user)\n confirmed_interpreter_requests.create(user_id: user.id)\n end", "def after_confirmation\n # rubocop:disable Rails/SkipsModelValidations\n update_attribute(:active, true)\n # rubocop:enable Rails/SkipsModelValidations\n end", "def create\n @user = User.new(user_params)\n if @user.save\n @user.send_confirmation\n flash.now[:success] = \"<h4>Novo chief criado.</h4>Um email de confirmação foi enviado para: #{@user.email}.\"\n redirect_to root_path\n else\n render :new\n end\n end", "def confirmation(user)\n \n @user = user\n\n if Rails.env.production?\n @root_path = \"http://allianz-community.com/\"\n else\n @root_path = \"http://localhost:3000/\"\n end\n\n @confirm_path = @root_path + users_confirm_path + \"?id=\"+@user.id.to_s+\"&hash=\" + @user.confirm_hash\n mail to: @user.mail, subject: 'Email confiramtion'\n end", "def act_signup_confirmation(user, act)\n @user = user\n @act = act\n\n mail to: user.email, subject: 'Act Sign Up Confirmation'\n end", "def confirm(user)\n @greeting = \"Hi\"\n @user = user\n\n mail to: user.email, subject: 'Welcome to Hikultura!'\n end", "def activate_user\n user = User.find_by_confirmation_hash params[:confirmation_hash]\n redirect_to root_path and return if user.nil?\n \n # Activate the user, update the hash, and save\n user.is_active = true\n user.generate_confirmation_hash\n user.save!\n \n # Log in the user\n self.current_user = user\n \n # Create a new user detail if the user has not does this\n redirect_to new_user_detail_path(user.confirmation_hash) and return if user.user_detail.nil?\n\n # Return to root if we make it this far\n redirect_to root_path\n end", "def after_save\n if self.credit && self.credit.user.nil?\n self.credit.user = self.user\n end\n self.credit.save if !self.credit.nil?\n end", "def confirmation(user)\n @user = user\n @user.generate_confirmation_code\n mail(to: @user.email, subject: \"Confirmation\") do |f|\n f.html\n end\n\n end", "def confirm!\n update(confirmed_at: Time.now.utc, status: :confirmed)\n end", "def confirm\n if current_visitor && current_visitor.has_role?('admin', 'manager')\n user = User.find(params[:id]) unless params[:id].blank?\n if !params[:id].blank? && user && user.state != \"active\"\n user.confirm!\n user.make_user_a_member\n # assume this type of user just activated someone from somewhere else in the app\n flash[:notice] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n else\n flash[:notice] = \"Please login as an administrator.\"\n redirect_to(root_path)\n end\n end", "def confirmarCotizEscCam\n GeneradorCorreoMailer.confirmarCotizEscCam\n end", "def activate\n if params[:id]\n @user = User.find_by_confirmation_token(params[:id])\n if @user.present?\n @user.activate\n flash[:notice] = \"User activated successfully.\"\n Notifier.confirm_user(@user).deliver\n else\n flash[:notice] = \"User already activated.\"\n end\n else\n flash[:notice] = \"You do not have Activation Code.\"\n end\n redirect_to :action => \"home\"\n end", "def accept\n @user = User.find(params[:id])\n @user.pending = false\n if @user.update_attribute(:pending,false)\n flash[:success] = \"Account accepted !\"\n else\n flash[:warning] = \"Account has not been accepted.#{@user.errors.inspect}\"\n end\n redirect_to :action => 'index'\n end", "def confirmation\n end", "def confirm\n end", "def confirm\n end", "def activate_user\n self.save\n self.send_user_notification_email\n end", "def update\n if @user.update_attributes user_params\n # check if we need to re-sent an confirmation email\n if @user.maybe_deliver_email_confirmation! self\n flash[:success] = \"Votre compte a été mise à jour, un email de confirmation vous a été envoyé.\"\n else\n flash[:success] = \"Votre compte a été mise à jour.\"\n end\n redirect_to @user\n else\n flash[:danger] = \"Une erreur est survenue.\"\n render 'edit'\n end\n end", "def account\n @title = \"Account Details\"\n # Update account details\n if request.post?\n if @affiliate.update_attributes(params[:affiliate])\n flash.now[:notice] = \"Account details saved.\"\n else\n flash.now[:notice] = \"There was a problem saving your account.\"\n end\n end\n end", "def confirm!\n @@api.post(endpoint: self.endpoint + ['confirm'])\n end", "def confirm\n #@asset_categorization = AssetCategorization.find(params[:id])\n if @asset_categorization.confirm!(current_user)\n AssetCategorizationMailer.confirmed_email(@asset_categorization.id).deliver\n respond_to do |format|\n format.html { redirect_to asset_categorizations_url, notice: I18n.t('controllers.confirm_success', name: @asset_categorization.class.model_name.human) }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to asset_categorizations_url, flash: { error: @asset_categorization.errors.messages.values.join } }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end\n end", "def confirm\n @asset_info_adjustment = AssetInfoAdjustment.accessible_by(current_ability, :confirm).find(params[:id])\n if @asset_info_adjustment.confirm!(current_user)\n respond_to do |format|\n format.html { redirect_to asset_info_adjustments_url, notice: I18n.t('controllers.confirm_success', name: @asset_info_adjustment.class.model_name.human) } \n format.json { head :no_content }\n format.xml { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to asset_info_adjustments_url, flash: {error: @asset_info_adjustment.errors} }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end\n end", "def confirm(args={})\n pending_any_confirmation do\n if confirmation_period_expired?\n self.errors.add(:phone, :confirmation_period_expired,\n period: Devise::TimeInflector.time_ago_in_words(self.class.activate_within.ago))\n return false\n end\n\n self.confirmed_at = Time.now.utc\n\n saved = if self.class.reactivatable && unconfirmed_phone.present?\n skip_reactivation!\n self.phone = unconfirmed_phone\n self.unconfirmed_phone = nil\n\n # We need to validate in such cases to enforce e-mail uniqueness\n save(validate: true)\n else\n save(validate: args[:ensure_valid] == true)\n end\n\n after_confirmation if saved\n saved\n end\n end", "def confirm(new_reservation)\n @reservation = new_reservation\n \n mail to: new_reservation.user.email,\n from: \"support@example.com\",\n subject: \"Thanks for your reservation\"\n end", "def confirmacionordenesccam\n RemisorOrdenesCompraMailer.confirmacionordenesccam\n end", "def user_saved(user)\n \n self.logged_user = user\n flash[:notice] = l(:notice_account_activated)\n redirect_to :controller => \"my\", :action => \"account\"\nend", "def mark_as_confirmed!\n self.confirmation_token = nil\n self.confirmed_at = Time.now.utc\n save\n end", "def confirm(reservation)\n @reservation = reservation\n\n mail to: reservation.user.email, subject: \"Your Itinerary\"\n end", "def create_confirm\n \t@name = params[:name]\n @email = params[:email]\n @password =params[:password]\n @password_confirmation = params[:password_confirmation]\n @role = params[:role]\n @dob = params[:dob]\n @phone = params[:phone]\n @address = params[:address]\n @profile = params[:profile]\n \n @user = User.new(name: @name, email: @email, password: @password, password_confirmation: @password_confirmation, role: @role, phone: @phone, dob: @dob, address: @address, profile: @profile)\n end", "def delivery_settings_confirm\n # get delivery preferences\n @delivery_preferences = DeliveryPreference.find_by_user_id(current_user.id)\n @delivery_preferences.update(settings_confirmed: true)\n \n # redirect back to settings so user sees it's now complete\n redirect_to delivery_settings_path\n \n end", "def account\n @title = \"Your Account Details\"\n # Update account details\n if request.post?\n if @customer.update_attributes(params[:customer])\n flash.now[:notice] = \"Account details saved.\"\n else\n flash.now[:notice] = \"There was a problem saving your account.\"\n end\n end\n end", "def resend_confirmation_instructions; end", "def update\n @user = User.find(params[:id])\n\n if params[:user].has_key?(:is_admin) && current_user.is_admin\n @user.is_admin = params[:user][:is_admin]\n end\n @user.assign_attributes(params[:user])\n did_save = @user.save\n \n if @user.fix_ude_approval_order_gaps?\n flash[:alert] = 'There were gaps in the approval order that have been automatically corrected'\n end\n\n\n respond_to do |format|\n if did_save \n prepare_contacts\n flash[:notice] = 'Changes have been saved'\n format.html { render :action=>:show }\n format.json { head :ok }\n else\n prepare_contacts\n format.html { render :action=>:show }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n \n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n # if super user create something, do not send confirmation, activate tis account & login as this user \n if current_user and current_user.super_user?\n @user.confirm_email!\n UserSession.create(@user)\n flash[:success] = \"Votre compte a été créé avec succès.\"\n else\n @user.maybe_deliver_email_confirmation! self\n flash[:success] = \"Votre compte a été créé avec succès, un email de confirmation vous a été envoyé.\"\n end\n\n redirect_to @user\n else\n flash[:danger] = \"Une erreur est survenue.\"\n render :new\n end\n end", "def confirm\n #@sub_items = Spree::Order.get_receipt_items(current_user.id)\n order_ids = params[:confirmed_order_ids]\n if order_ids.present?\n @sub_items = Spree::Order.get_snack_queue_updated_orders(order_ids)\n @delivery_dates = Spree::Order.get_delivery_dates(order_ids)\n\n else\n redirect_to main_app.profile_users_path and return if @sub_items.blank?\n end\n\n #after confirmation if user wishes to reload page then it'll auto redirect user to profile section.\n end", "def creator_payment\n redirect_to root_path and return if @user != current_user\n if request.put?\n @user.update_attributes(params[:user])\n redirect_to button_user_path(@user)\n end\n @nav = \"signup\"\n end", "def email_activate\n self.email_confirmed = true\n self.confirm_token = nil\n save!\n # save!(:validate => false)\n # validate for password validation, done on front end\n end", "def confirm_email!\n confirm_email\n save_without_session_maintenance(validate: false)\n end", "def tutor_confirmation_notification(tutoria)\n @tutoria = tutoria\n @tutor = tutoria.tutor\n @student = tutoria.student\n @admin = tutoria.order.admin_user\n @greeting = \"#{@tutor.name}\"\n\n\n mail(to: @tutor.email, subject: \"Confirmacion Tutorias\", cc: @admin.email )\n end", "def confirm\n @order.confirm_notes = params[:order][:confirm_notes]\n @order.approx_cost = (@order.approx_cost.to_f * 100.0).floor\n @order.confirm\n \n if @order.confirm_notes.present? \n OrderNote.create(:message => @order.confirm_notes, :order_id => @order.id, :author_id => @order.assigned_to.id) rescue nil \n end\n\n @order.approx_cost = (@order.approx_cost.to_f / 100.0).floor\n \n render 'status'\n end", "def confirm_delivery\n @delivery = Delivery.find_by_id params[:delivery_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @delivery.confirm( current_user ) \n @delivery.reload\n end", "def activate\n @membership.activate!\n @membership.generate_dues_invoice!\n _user = @membership.user\n _user.roles = [:member]\n _user.save\n flash[:success] = \"Successfully activated #{ @membership.user.full_name }\"\n redirect_to '/'\n end", "def confirm\n @user = User.new(sign_up_params)\n if @user.invalid?\n flash.now[:danger] = '入力内容にエラーがあります。'\n render :new\n return\n end\n end", "def save_without_confirmation!\n self.skip_confirmation!\n save()\n end", "def save_without_confirmation!\n self.skip_confirmation!\n save()\n end", "def confirmarCotizMesCam\n GeneradorCorreoMailer.confirmarCotizMesCam\n end", "def cuenta_activacion(maestro)\n @maestro = maestro \n mail to: maestro.correo, subject: \"Activa tu cuenta de profesor\"\n end", "def signup_confirmation(user)\n @user = user\n\n mail to: user.email, subject: \"Sign Up Confirmation\"\n end", "def reactivacion_guardar\r\n\t\tif session[:usuario_id]\t\r\n\t\t\tif params[:Instructor].to_s != \"0\"\r\n\t\t\t\tusuari = Usuario.where(id: params[:Instructor]).take\r\n\t\t\t\tif !usuari.blank?\r\n\t\t\t\t\tusuari.activo = 1\r\n\t\t\t\t\tusuari.save\r\n\t\t\t\t\tpers = Persona.where(usuario_id: usuari.id).take\r\n\t\t\t\t\tnombres = pers.nombres.to_s.split.map(&:capitalize).join(' ') + \" \" + pers.apellidos.to_s.split.map(&:capitalize).join(' ')\r\n\t\t\t\t\tflash[:success]= \"Se ha habilitado a \" + nombres + \" de manera exitosa\"\r\n\t\t\t\telse\r\n\t\t\t\t\tflash[:danger]= \"Error al seleccionar usuario, puede no existir en la Base de Datos\"\r\n\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tflash[:info]= \"Debe seleccionar un instructor primero\"\r\n\t\t\tend\r\n\t\t\tredirect_to :back\r\n\t\telse\r\n\t\t\tredirect_to controller:\"forminst\", action: \"index\"\r\n\t\tend\r\n\tend", "def email_confirmation\n @user = User.where(:username => params[:username]).first\n\n #checking if email is already confirmed:\n if @user.email_confirmed == true then return end\n \n #checking if confirmation id is the same as in DB:\n if @user.email_confirmation_id == params[:id] \n \n #updating email_confirmed in DB:\n if @user.update_columns(:email_confirmed => true) == false \n \n flash[:error] += \" Error updating db. \" \n else\n @user.email_confirmed = true \n end\n end\n end", "def send_confirmation_instructions; end", "def after_confirmation\n activate\n end", "def email_activate\n self.email_confirmed = true\n self.confirm_token = nil\n save!(:validate => false)\n end", "def email_activate\n self.email_confirmed = true\n self.confirm_token = nil\n save!(:validate => false)\n end", "def finalize\n @confirmation_token = params[:user].delete(:confirmation_token)\n self.resource = resource_class.find_for_confirmation(@confirmation_token)\n\n # Exit action and redirect if user is already confirmed\n if resource && resource.confirmed?\n yield(:already_confirmed, resource) if block_given?\n redirect_to after_confirmation_path_for(resource_name, resource)\n return\n end\n\n if resource.errors.empty?\n if params[:tos] == \"accept\"\n params[:user][:meta_data] = resource.meta_data.merge(tos_accepted_at: Time.current)\n end\n resource.assign_attributes(params[:user]) unless resource.confirmed?\n resource.perform_confirmation(@confirmation_token)\n resource.save\n sign_in resource, bypass: true\n set_flash_message(:notice, :confirmed) if is_flashing_format?\n yield(:success,resource) if block_given?\n MnoEnterprise::EventLogger.info('user_confirm', resource.id, 'User confirmed', resource)\n respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource, new_user: true) }\n else\n yield(:error,resource) if block_given?\n respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }\n end\n end", "def signup_confirmation(user)\n @user = user\n mail to: user.email, subject: \"Sign Up Confirmation\"\n end", "def item_edit_confirm(user, item)\n\t@user = user\n\t@item = item\n mail to: @user.email, subject: \"ToDo Thank u for editing Item bla bla ;-)\"\n end", "def approve\n @user.state = User::ENABLED\n @user.save\n \n respond_to do |format|\n format.html { redirect_to(registrations_users_path, :notice => \"User registration was successfully approved.\") }\n format.xml { head :ok }\n end\n end", "def confirm\n @order = Order.new(params[:order])\n session[:order]= params[:order]\n @companyIdToSell = params[:companyIdToSell] if params[:companyIdToSell] \n @user = User.find(current_user.id)\n unless @order.valid?\n render :action => 'new'\n end\n# flash[:notice] = \"Card information invalid!!\"\n end", "def confirm\n\n\t\tprint \"\\n\\n\\tAre you Sure want to purchase this product(y/n)?: \" \n\t\t\n\t\toption=gets.chomp\n\n\t\tif option==\"y\" or option==\"Y\"\n\t\t\n\t\tloop do\n\t\t\tprint \"\\n\\n\\t\\tEnter Your Name: \"\n\t#get user name\n\t\t\t@name=gets.chomp\n\t#check validation for name\n\t\tbreak if @name=~ /^[A-Z a-z]+$/ and @name.length>2 and @name.length<31\n\t\t\tputs \"\\n\\n\\t\\tInvalid Name!!!...Enter Correct\"\n\t\tend\n\n\t\tloop do\n\t\t\tprint \"\\n\\n\\t\\tEnter Your Address: \"\n\t#get user address\n\t\t\t@address=gets.chomp\n\t#check validation for address\n\t\tbreak if@address.length>10 and @address.length<51\n\t\t\tputs \"\\n\\n\\t\\tInvalid Address!!!...Enter full Correct address(minimum 10 character)\"\n\t\tend\n\t\t\n\t\tloop do\n\t\t\tprint \"\\n\\n\\t\\tEnter Your Mobile No.: \"\n\t#get mobile number\n\t\t\t@mobile=gets.chomp\n\t#check validation for mobile\n\t\tbreak if @mobile=~ /\\d{10}/ and @mobile.length<11\n\t\t\tputs \"\\n\\n\\t\\tInvalid Mobile No!!!...Enter Correct\"\n\t\tend\n\t#insert values into users \n\t\t\tstatement8=@connection.prepare(\"insert into users values(?,?,?,?)\")\n\t\t\tstatement8.execute(@user_id,@name,@address,@mobile)\n\t\t\t@connection.commit\n\t#call order method\n\t\t\torder\n\t\t\t\n\t\telsif option==\"n\" or option==\"N\"\n\t#call delete_entry method\n\t\t\t\tdelete_entry\n\t\t\t\texit -1\n\t\telse\n\t\t\tputs \"\\n\\n\\t\\tInvalid Choice!!!...Try again\"\n\t#call confirm method\n\t\t\tconfirm\n\t\tend\n\n\tend", "def account_activation(user)\n @user = user\n\n mail to: user.email, subject: \"Account activation\"\n end", "def account_activation(user)\n @user = user\n mail to: user.email, subject: \"CRS Account Activation\"\n end", "def approve_clutch\n @clutch.approved = !@clutch.approved\n if @clutch.save\n redirect_to users_path\n else\n redirect_to users_path, alert: \"Error! Failed to Approve!\"\n end\n end", "def registration_confirmation(user)\n \t@user = user\n \tmail(:to => \"#{user.name} #{user.last_name} <#{user.email}>\", :subject => \"(IMI-Map) Registered\")\n end" ]
[ "0.6479514", "0.6477246", "0.639822", "0.6364255", "0.6328995", "0.6306834", "0.6261867", "0.62605214", "0.6229507", "0.62193197", "0.62167263", "0.6208338", "0.6168529", "0.6163406", "0.6126741", "0.61217546", "0.6110658", "0.6105941", "0.6090884", "0.60697573", "0.6065104", "0.6054662", "0.6044138", "0.60433125", "0.6041824", "0.6022967", "0.6022064", "0.60181206", "0.60068285", "0.60062444", "0.5995095", "0.5989895", "0.59619004", "0.5959903", "0.5957195", "0.5950409", "0.5924622", "0.5919145", "0.59146434", "0.59085757", "0.59003276", "0.5894504", "0.58917505", "0.58846843", "0.58788925", "0.5873226", "0.5868131", "0.58661866", "0.58516455", "0.58491343", "0.5845093", "0.5845093", "0.5839273", "0.5837327", "0.58355993", "0.5835329", "0.58292764", "0.58265483", "0.5824545", "0.581546", "0.5808929", "0.58083254", "0.58073616", "0.5805552", "0.5795158", "0.57909536", "0.5787287", "0.5776567", "0.5773916", "0.5767834", "0.5765442", "0.57635945", "0.5746187", "0.5736033", "0.57272905", "0.5726173", "0.57196164", "0.57131815", "0.5712596", "0.57051885", "0.57051885", "0.57048804", "0.57008666", "0.56984943", "0.5692171", "0.5689403", "0.5687827", "0.56867164", "0.56780607", "0.56780607", "0.56767994", "0.5671947", "0.5669015", "0.56681436", "0.5665823", "0.5665554", "0.5658162", "0.5658148", "0.56577605", "0.5656874" ]
0.6491109
0
UpdatePassword method updates the user's current password
def update_password parameters=params[:body] @my_accounts=@current_user if @my_accounts.valid_password?(parameters[:current_password]) if @my_accounts.updatePassword(parameters) render :json=>success1 else render :json=>failure1(:current_password=>["Current password is wrong"]) end else render :json=>failure1(@my_accounts.errors) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_password\n if current_user.update_with_password(update_password_params)\n expose current_user\n else\n error! :invalid_resource, current_user.errors\n end\n end", "def update_password\n @user = current_user\n\n # update_password assigns params to user object\n if @user.update_password(password_params)\n redirect_after_successful_password_update\n else\n render('change_password', status: :unprocessable_entity)\n end\n end", "def password\n if @user.update_with_password(password_params)\n render_update_success @user\n else\n render_failure @user\n end\n end", "def update_password(user, new_password)\n user.update_password(new_password)\n end", "def update_password\n\t\t# if admin, allow editing user's password\n if current_user.is_admin?\n @user = User.find(params[:id])\n else\n\t\t\t# else just use current user\n @user = current_user\n end\n\n\t\t# update user password with regards to the parameters\n if @user.update_attributes(params[:user])\n gflash :success => \"Password Successfully Updated\"\n redirect_to :action => 'edit', :id => @user.id\n else\n render :action => 'change_password', :id => params[:id]\n end\n end", "def update_password\n # check current password is valid\n if params[:account].present? and !@account.valid_password?(params[:account][:current_password])\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"Current password incorrectly.\" }\n return\n end\n\n if params[:account].present?\n params[:account].delete(:password) if params[:account][:password].blank?\n params[:account].delete(:password_confirmation) if params[:account][:password].blank? and params[:account][:password_confirmation].blank?\n\n if @account.update_with_password(account_params)\n bypass_sign_in(@account)\n redirect_to gns_core.my_account_backend_accounts_path, flash: { success: \"The new password has been successfully changed.\" }\n else\n if params[:account][:password].nil? or params[:account][:password].length < 6\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"New password must contain at least 6 characters.\" }\n else\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"Repeat password does not match.\" }\n end\n end\n end\n end", "def update\n auth_password = self.class.klass.auth_password\n self.send(\"current_#{self.class.klass_sym}\")&.update_password(password_params[auth_password])\n render json: { meesage: \"update password successful\"}, status: 200\n rescue UserError => e\n render json: { error: e.message }, status: e.status\n end", "def update_password\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Your password was updated successfully!\"\n sign_in @user, :bypass => true\n redirect_to root_path\n else\n flash[:error] = \"Error updating password!\"\n redirect_to edit_password_path(@user.authentication_token)\n end\n end", "def update_password(password_params)\n assign_attributes(password_params)\n return false unless valid?(:update_password)\n\n call_ok?(:maintain_user, update_password_request)\n end", "def update_password\n @user = current_user\n\n if @user.valid_password?(params[:user][:current_password])\n if params[:user][:password] == params[:user][:current_password]\n flash[:notice] = 'Current Password and New Password should not be same.'\n redirect_to(:back)\n elsif @user.update!(user_params)\n flash[:success] = 'Password updated successfully, please login with the new password.'\n redirect_to new_user_session_path\n end\n else\n flash[:notice] = 'Please enter valid current password.'\n redirect_to(:back)\n end\n end", "def update_password\n @user = User.find(current_user.id)\n unless !@user.check_password? params[:user]\n if @user.update_with_password(params[:user])\n sign_in @user, :bypass => true\n else\n @user.errors[:current_password].shift\n @user.errors.add(:current_password, \"The given password is invalid\")\n render \"change_password\", :user => @user\n end\n else\n render \"change_password\", :user => @user\n end\n end", "def update_password\n @user_profile = true\n if request.patch?\n if @user.update_with_password(user_params) # Only :password and :password_confirmation are sent to this action\n # Sign in the user by passing validation in case their password changed\n bypass_sign_in(@user)\n flash[:notice] = \"Password successfully changed.\"\n redirect_to root_path\n else\n if @user.errors.any?\n error_messages = [\"Password could not be updated:\"]\n error_messages << @user.errors.messages.values\n flash[:error] = error_messages.join('<br/>')\n end\n render \"update_password\"\n end\n end\n end", "def update\n @user = User.find(current_user.id)\n if @user.update_with_password(user_params)\n # Sign in the user and bypass validation in case their password changed\n bypass_sign_in(@user)\n flash[:notice] = 'Your password has been changed successfully.'\n redirect_to root_path\n else\n render 'edit'\n end\n end", "def update_with_password(params={})\n params.delete(:current_password)\n self.update_without_password(params)\n end", "def update_with_password(params={})\n params.delete(:current_password)\n self.update_without_password(params)\n end", "def update_password\n @user = User.shod(params[:id])\n if @user.update(user_params)\n flash[:notice] = t('pass_change')\n redirect_to user_path(@user)\n else\n render 'change_password'\n end\n end", "def update\n @user = User.find_by_forgot_password_token(params[:forgot_password_token])\n raise_404 unless good_password_change_request?\n\n @user.password_required!\n if @user.update_attributes(password_params)\n signin_user!(@user)\n flash[:success] = \"Changed password successfully!\"\n redirect_to dashboard_url\n else\n flash.now[:alert] = \"Couldn't change password. See below.\"\n render :reset_password\n end\n end", "def update_password\n @user = User.find_by_id(current_user.id)\n\n if User.authenticate(@user.username,pwd_params[:current_password])\n if(User.check_password_validity(pwd_params1[:password]))\n if @user.update(pwd_params1)\n flash[:notice] = \"Password was successfully changed.\"\n flash[:color]= \"valid\"\n redirect_to profile_index_path\n else\n render profile_change_password_path\n end\n else\n flash.now[:notice] = \"Password must be minimum of 6 characters.\"\n flash.now[:color]= \"invalid\"\n render profile_change_password_path\n end\n else\n flash.now[:notice] = \"Wrong Current Password.\"\n flash.now[:color]= \"invalid\"\n render profile_change_password_path\n end\n end", "def update\n user_password_update = UserPasswordUpdate.new(params[:t])\n if user_password_update.apply(params[:user])\n redirect_to sign_in_path, notice: 'Your password has been updated'\n else\n @user = user_password_update.user\n flash.now[:alert] = @user ? \"Invalid User\" : 'Failed to update password'\n render :change\n end\n end", "def update_password\n @user = User.find(params[:id])\n\n if params[:current_password] && !@user.authenticate(params[:current_password])\n flash.now[:fail] = \"Current password incorrect\"\n render :change_password\n elsif @user.update_attributes(params[:user])\n flash[:success] = \"Updated password\"\n redirect_to user_url(@user)\n else\n flash.now[:errors] = @user.errors.full_messages\n\n # Render appropriate template\n if params[:current_password]\n render :change_password\n else\n render :reset_password\n end\n end\n end", "def update_password\n @admin.password = Admin.get_encrypted_password(@new_password, @login_salt_d)\n @admin.save!\n end", "def update_password\n current_password = params[:current_password]\n correct_password = @account.password\n if current_password == correct_password\n @account.password = params[:account_password]\n flash.now[:message] = \"你的密码已成功修改\" if @account.save\n else\n flash.now[:error_msg] = \"你输入的当前密码不正确, 不能修改密码\"\n end\n \n render :action => \"edit\"\n end", "def update\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n if @user.save\n flash[:notice] = \"Password successfully updated\"\n redirect_to user_url\n else\n render :action => :edit\n end\n end", "def update_password\n user = UserService.getUserById(params[:id])\n if !user.authenticate(params[:password])\n redirect_to change_password_user_path, notice: Messages::INCORRECT_PASSWORD\n elsif params[:new_password] != params[:new_password_confirmation]\n redirect_to change_password_user_path, notice: Messages::INCORRECT_PASSWORD_CONFIRM\n else\n isUpdatedPassword = UserService.updatePassword(user, params)\n if isUpdatedPassword\n redirect_to users_path\n else\n redirect_to change_password_user_path\n end\n end\n end", "def update_password\n @user = current_user\n\n old_password = params[:old_password]\n new_password = params[:new_password]\n\n if old_password == '' || new_password == ''\n flash[:notice] = I18n.t('accounts.password_blank')\n elsif @user.valid_password?(old_password)\n flash[:notice] = I18n.t('accounts.password_wrong')\n else\n @user.update_attributes(password: new_password)\n flash[:notice] = I18n.t('accounts.password_update_successful')\n end\n\n respond_with @user, location: :account\n end", "def update_password\n @user = current_user\n\n old_password = params[:old_password]\n new_password = params[:new_password]\n\n if old_password == '' or new_password == ''\n flash[:notice] = I18n.t('accounts.password_blank')\n elsif @user.valid_password?(old_password)\n flash[:notice] = I18n.t('accounts.password_wrong')\n else\n @user.update_attributes(:password => new_password)\n flash[:notice] = I18n.t('accounts.password_update_successful')\n end\n\n respond_with @user, :location => :account\n end", "def update\n @user.password = params[:password]\n @user.password_confirmation = params[:password_confirmation]\n return unless @user\n if @user.save\n flash[:notice] = t 'password_resets.updated'\n redirect_to @user\n else\n render :action => :edit\n end\n end", "def password_updation\n user_id = params[:user_id]\n password = params[:password]\n if password.present?\n @password = User.find(params[:user_id]).update(password: params[:password])\n render json: @password, status: :ok\n else\n render json: { error: 'password can not be nil' }, status: :unauthorized\n end \n end", "def update_password username, password, new_password, account: Conjur.configuration.account\n if Conjur.log\n Conjur.log << \"Updating password for #{username} in account #{account}\\n\"\n end\n url_for(:authn_update_password, account, username, password).put new_password\n end", "def update\n @user = current_user\n if @user.update_with_password(params[:user])\n if is_navigational_format?\n flash[:notice] = t(\"passwords.update.success\")\n end\n sign_in @user, :bypass => true\n redirect_to edit_user_registration_path\n else\n flash[:error] = t(\"passwords.update.failed\")\n redirect_to :action => :edit\n end\n end", "def update_users_account_password( user_uid, password )\n engines_api_system.update_users_account_password( user_uid, password )\n end", "def update_password\n\t\t@admin = current_admin\n\t\tif(@admin.update_attributes(params[:admin]))\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender :action => \"reset\"\n\t\tend\n\tend", "def admin_pwd_update\n @user = User.find_by_id(params[:user_id])\n @user.validate_pwd = true\n if @user.update(email: params[:user][:email], password: params[:user][:password], password_confirmation: params[:user][:password_confirmation])\n # if an admin is updating her own password, we need to get around Devise's automatic sign out\n if @user.id == current_user.id\n sign_in(@user, :bypass => true)\n end\n flash.keep[:notice] = 'The password for \"' + params[:user][:email] + '\" was successfully updated.'\n redirect_to '/users'\n else\n render :admin_pwd\n end\n end", "def update\n load_user\n\n return if (@user.blank?)\n\n # Read the params and check if the password must be changed\n user_values = user_params\n new_password = (user_values[:change_password] == \"true\")\n\n # Delete the field of change password.\n user_values.delete(:change_password)\n user_values.delete(:level) if (@user.id == current_user.id)\n\n # Change the password if needed\n user_values[:password] = User::generate_random_password if (new_password)\n\n respond_to do|format|\n format.html{\n # The user can be updated?\n if (@user.update_attributes(user_values))\n # Send an e-mail of password changed if needed\n UserMailerWorker.perform_async(:change_password_email, @user.id.to_s, @user.password) if (new_password)\n\n flash[:notice] = t(\"users.notice.updated\", :email => @user.email)\n redirect_to user_path(@user)\n else\n # If an error raises, show the form again\n render :action => :edit\n end\n return\n }\n end\n end", "def update_password\n enc_password = Authentication::Encryptor.digest(password)\n account = Authentication::Account.reset_token_account(reset_password_token)\n account.encrypted_password = enc_password\n account.reset_password_token, account.reset_password_expires_at = nil, nil\n account.save!\n {'success' => true}\n end", "def update_password\n @user.password = @new_e_password\n if GlobalConstant::User.auto_blocked_status == @user.status\n # if we had blocked a user for more than a threshhold failed login attemps we set status to blocked\n # now we should reset it to active\n @user.status = GlobalConstant::User.active_status\n @user.failed_login_attempt_count = 0\n end\n @user.save!\n end", "def change_password\n if current_user.update_with_password(password_params)\n #\n # Sign in the user bypassing validation in case\n # their password changed.\n #\n sign_in current_user, bypass: true\n\n redirect_to current_user, notice: 'Password successfully changed.'\n else\n render 'edit'\n end\n end", "def update_password\n @user = current_user\n return unless request.post?\n if User.authenticate(current_user.email, params[:old_password])\n if (params[:password] == params[:password_confirmation])\n current_user.password_confirmation = params[:password_confirmation]\n current_user.password = params[:password]\n if !params[:password].blank? && current_user.save\n flash[:notice] = \"Password changed\" \n redirect_to edit_user_path(current_user)\n else\n flash[:notice] = \"Password not changed\"\n end\n else\n flash[:notice] = \"Password mismatch\"\n @old_password = params[:old_password]\n end\n else\n flash[:notice] = \"Wrong password\" \n end \n end", "def update\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n if @user.save\n @user.attempts = 0\n @user.save\n flash[:notice] = \"Password succesefully updated\"\n redirect_to account_url\n else\n render :action =>:edit\n end\n end", "def update_password\n # o e-mail do utilizador está colocado num campo hidden para poder identificar o utilizador que se está a editar\n @user = User.find_by_email(params[:user][:email])\n\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n @user.failed_password_attempt_count = 0;\n\n # guarda user na base de dados\n if @user.save\n # alerta para user criado com sucesso\n flash[:notice] = \"A sua password foi alterada com sucesso.\"\n\n # autentica o user criado\n sign_in @user\n\n redirect_to root_path \n\n else \n render 'edit_password'\n end\n\n end", "def update_with_password(params, *options)\n current_password = params.delete(:current_password)\n\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n\n result = if valid_password?(current_password)\n update_attributes(params, *options)\n else\n self.assign_attributes(params, *options)\n self.valid?\n self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)\n false\n end\n\n clean_up_passwords\n result\n end", "def password_update\n redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission\n user = LatoCore::Superuser.find(params[:id])\n if !user || user.session_code != params[:token]\n flash[:warning] = CORE_LANG['recover_password']['recover_error']\n redirect_to lato_core.login_path and return false\n end\n user.update(password: params[:password], password_confirmation: params[:password])\n if !user.save\n flash[:warning] = CORE_LANG['recover_password']['recover_error']\n redirect_to lato_core.login_path and return false\n end\n\n flash[:success] = CORE_LANG['recover_password']['recover_success']\n redirect_to lato_core.login_path\n end", "def update\n # Make the password confirmation validation work.\n @user.password_confirmation = params[:user][:password_confirmation]\n\n # Don't require entry of the old password.\n @user.resetting_password = true\n\n # Clear the temporary token and update the password.\n if @user.change_password!(params[:user][:password])\n redirect_to(root_path, notice: t('password_resets.update.password_updated'))\n else\n render action: \"edit\"\n end\n end", "def update_password(newpwd)\n self.password = Utils.sha1(newpwd + 'ad2012spot' + email)\n end", "def update_password(id, password)\n url = \"#{@api_base_path}/users/#{id}/update_password\"\n handle_timeouts do\n response = self.class.put(url, headers: auth_header,\n body: { user: { password: password,\n confirmation: password } })\n convert_response(response, \"user\")\n\n end\n end", "def update_password\n if params[:current_password].present? && @current_user.valid_password?(params[:current_password])\n @current_user.update(password: params[:new_password])\n if @current_user.errors.any?\n render json: @current_user.errors.messages, status: 400\n else\n render json: { message: \"Password updated successfully!\" }, status: 200\n end\n else\n render json: { message: \"Current Password is not present or invalid!\" }, status: 400\n end\n rescue StandardError => e # rescue if any exception occurr\n render json: { message: \"Error: Something went wrong... \" }, status: :bad_request\n end", "def update_with_password(params, *options); end", "def update_password\n if resource.update_password(params[resource_name])\n set_flash_message :notice, :password_updated if is_navigational_format?\n sign_in resource_name, resource, :bypass => true\n respond_with resource, :location => after_update_path_for(resource)\n else\n clean_up_passwords(resource)\n render :edit_password\n end\n end", "def update_with_password(params={})\n\t\tcurrent_password = params.delete(:current_password) if !params[:current_password].blank?\n\t\t\n\t\tif params[:password].blank?\n\t\t\tparams.delete(:password)\n\t\t\tparams.delete(:password_confirmation) if params[:password_confirmation].blank?\n\t\tend\n\t\t\n\t\tresult = if has_no_password? || valid_password?(current_password)\n\t\t\tr = update_attributes(params)\n\t\t\tupdate_attribute(:has_password, true) if params[:password].present?\n\t\t\tr\n\t\telse\n\t\t\tself.errors.add(:current_password, current_password.blank? ? :blank : :invalid)\n\t\t\tself.attributes = params\n\t\t\tfalse\n\t\tend\n\t\t\n\t\tclean_up_passwords\n\t\tresult\n\tend", "def update_password\n @user = User.find_by_uuid(params[:id])\n if @user.update(user_params_with_password)\n if @user.send_password.present? && @user.send_password.to_i == 1\n @user.send_welcome_email\n end\n flash[:success] = t('messages.default_success')\n redirect_to users_path\n else\n flash[:error] = t('messages.default_error')\n render :edit_password\n end\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params.except(:current_password), *options)\n else\n update_with_password_pass(params)\n end\n end", "def update_user_password(user_id, new_password)\n Result.new(call(CMD_UPD_USER_PASS % [user_id, new_password]))\n end", "def change_password\n if params[:user][:current_password].present? && params[:user][:password].present?\n @user = @current_user.update_with_password(change_password_params)\n if @user\n render_json({:result=>{:messages =>[\"ok\"],:rstatus=>1, :errorcode =>\"\"},:data=>{:messages =>[\"Your Password Successfully updated\"]}}.to_json)\n else\n render_json({:result=>{:messages =>@current_user.display_errors,:rstatus=>0, :errorcode => 404}}.to_json)\n end\n else\n render_json({:result=>{:messages =>[\"Invaild User / Current Password and Password required\"],:rstatus=>0, :errorcode => 404}}.to_json)\n end\n end", "def update_with_password(params={})\n current_password = params.delete(:current_password)\n\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n update_attributes(params)\n end", "def set_password\n @user = User.find(session[:user_id])\n if @user.password == params[:old_password]\n if @user.update_attributes(params[:user])\n redirect_to user_new_path\n else\n flash[:notice] = \"Please enter correct passwords\"\n render user_change_password_path\n end\n else\n flash[:notice] = \"Please enter your correct passwords\"\n redirect_to user_change_password_path\n end\n end", "def change_password\n #if not logged in, display error message\n if !logged_in?\n flash[:error] = \"Must log in to change password\"\n redirect_to(:action => :login)\n else\n current_user = User.find(current_user_id)\n if current_user.update(user_params(params[:user])) then\n reset_session\n flash[:success] = \"Password successfully updated\"\n redirect_to(:action => :login)\n else\n current_user.errors.full_messages.each do |mess|\n flash[:error] = mess\n end\n redirect_to(:action => :password)\n end\n end\n end", "def update_password\n if params[:current_password].present? && @user.valid_password?(params[:current_password])\n @user.update(password: params[:new_password])\n if @user.errors.any?\n render json: @user.errors.messages, status: 400\n else\n render json: { message: \"Password updated successfully!\" }, status: 200\n end\n else\n render json: { message: \"Current Password is not present or invalid!\" }, status: 400\n end\n rescue StandardError => e # rescue if any exception occurr\n render json: { message: \"Error: Something went wrong... \" }, status: :bad_request\n end", "def update_with_password(params, *options)\n current_password = params.delete(:current_password)\n\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n\n result = if valid_password?(current_password)\n update_attributes(params, *options)\n else\n self.assign_attributes(params, *options)\n self.valid?\n self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)\n false\n end\n\n clean_up_passwords\n result\n end", "def update\n @user = User.find(current_user.id)\n\n successfully_updated = if needs_password?(@user, params)\n @user.update_with_password(params.require(:user).permit(:city, :email, :image, :mobile, :name, :current_password, :password, :password_confirmation))\n # Rails 3: @user.update_with_password(params[:user])\n else\n # remove the virtual current_password attribute update_without_password\n # doesn't know how to ignore it\n params[:user].delete(:current_password)\n params[:user].delete(:password)\n params[:user].delete(:password_confirmation)\n @user.update_without_password(params.require(:user).permit(:city, :email, :image, :mobile, :name))\n # Rails 3: @user.update_without_password(params[:user])\n end\n\n if successfully_updated\n set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n sign_in @user, :bypass => true\n redirect_to after_update_path_for(@user)\n else\n render \"edit\"\n end\n end", "def update\n modified_params = user_params\n modified_params.delete(\"password\") if modified_params[\"password\"].empty?\n if @user.update(modified_params)\n @users = current_user.users\n end\n end", "def change_password\n @user = current_user\n @user.update_password(params)\n\n if @user.errors.empty?\n redirect_to profile_path, :notice => I18n.t('profile.password_changed')\n else\n flash.now[:alert] = I18n.t(\"errors.passwords.problem\")\n render 'show', :status => :forbidden\n end\n end", "def update_with_password(params, *options)\n current_password = params.delete(:current_password)\n\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n\n result = if params[:password].blank? || valid_password?(current_password)\n update_attributes(params, *options)\n else\n self.assign_attributes(params, *options)\n self.valid?\n self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)\n false\n end\n\n clean_up_passwords\n result\n end", "def update\n begin\n _params = update_password_params\n if _params[:password].length < Devise.password_length.min\n render json: {errors: [\"Too short password.\"]}, status: :bad_request\n return\n elsif _params[:password].length > Devise.password_length.max\n render json: {errors: [\"Too long password.\"]}, status: :bad_request\n return\n end\n user = User.reset_password_by_token(_params)\n render json: user, status: :ok\n rescue => e\n logger.error(\"Password update failed. #{e.message}\")\n render json: {errors: [\"Password update failed.\"]}, status: :internal_server_error\n return\n end\n end", "def update_with_password(params={})\n params.delete(:current_password)\n\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n update_attributes(params)\n\n end", "def update_hash!(password)\n self.password = password\n hash_password\n save\n end", "def update\n current_password = params.delete(:current_password)\n unless @user.authenticate(current_password)\n @user.errors.add(:current_password, t('activerecord.errors.models.user.attributes.current_password.invalid'))\n end\n\n respond_to do |format|\n if @user.errors.empty? and @user.update(user_params)\n format.html { redirect_to users_url,\n notice: t('activerecord.attributes.user.messages.updated', name: @user.name) }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_with_password(params, *options)\n current_password = params.delete(:current_password)\n\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n\n result = if params[:password].blank? || valid_password?(current_password) \n update_attributes(params, *options)\n else\n self.assign_attributes(params, *options)\n self.valid?\n self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)\n false\n end\n\n clean_up_passwords\n result\n end", "def update\n @user = User.find(current_user.id)\n\n # See https://github.com/plataformatec/devise/wiki/How-To%3A-Allow-users-to-edit-their-account-without-providing-a-password\n successfully_updated = if needs_password?(@user, params)\n @user.update_with_password(devise_parameter_sanitizer.sanitize(:account_update))\n else\n params[:user].delete(:current_password)\n \n @user.update_without_password(devise_parameter_sanitizer.sanitize(:account_update))\n end\n\n if successfully_updated\n sign_in @user, :bypass => true\n redirect_to dashboard_path, notice: 'User was successfully updated.'\n else\n render 'edit'\n end\n end", "def change_password\n @user = User.find(session[:user_id])\n if params[:user]\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n if @user.save\n flash[:notice] = \"Password change successful\"\n end\n end\n end", "def update\n @user = current_user\n @user_locations = @user.user_locations\n \n old_password = @user.sync_password\n \n new_password = request_password\n \n # @user_locations.each do |ul|\n request = request_github(@user.user_locations.where({ :location_id => 1 }).first.login_name, old_password, new_password)\n # end\n \n unless request.nil?\n # TXT user\n txt_user(@user.cell_phone, request)\n \n # Save new password to user\n @user.update_attributes({ :sync_password => request })\n \n redirect_to root_url, :notice => \"New password TXT'd to your cell phone.\"\n else\n redirect_to root_url, :notice => 'Authentication Failed. Try again.'\n end\n end", "def update_with_password(params={})\n # TODO Remove me in next release\n if params[:old_password].present?\n params[:current_password] ||= params[:old_password]\n ActiveSupport::Deprecation.warn \"old_password is deprecated, please use current_password instead\", caller\n end\n\n params.delete(:password) if params[:password].blank?\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n current_password = params.delete(:current_password)\n\n result = if valid_password?(current_password)\n update_attributes(params)\n else\n message = current_password.blank? ? :blank : :invalid\n self.class.add_error_on(self, :current_password, message, false)\n self.attributes = params\n false\n end\n\n clean_up_passwords unless result\n result\n end", "def update_password\n @password_change_form = UserChangePasswordForm.new(change_password_params)\n if !@password_change_form.valid?\n render :change_password\n else\n updatePassword = UsersService.updatePassword(change_password_params,current_user)\n if updatePassword\n redirect_to users_path, notice: \"Successfully Update the Password!!!.\"\n else\n redirect_to change_password_user_path, notice: \"New Password and New Confirm Password must be same !!!.\"\n end\n end\n end", "def update_password\n @employee = current_employee\n if @employee.update_with_password(params_employee)\n redirect_to root_path\n else\n render :action => \"edit_password\"\n end\n end", "def update\n if correct_password_check account_update_params[:current_password]\n \n pw_params = params[:user].permit(:current_password, :password, :password_confirmation, :first_name, :last_name)\n # Handle updating password if they added anything.\n if (current_user.valid_password?(pw_params[:password]) || current_user.valid_password?(pw_params[:password_confirmation]))\n # Passwords are the same, do nothing.\n elsif (pw_params[:password] == pw_params[:password_confirmation] && pw_params[:password].length > 6)\n # Password are different.\n current_user.password = pw_params[:password]\n current_user.password_confirmation = pw_params[:password_confirmation]\n current_user.save!\n flash.alert = \"Success: Password has been changed!\"\n end\n\n \n user_params = params[:user].except(:current_password, :password, :password_confirmation).permit(:first_name, :last_name, :email)\n unless current_user.update!( user_params )\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n\n flash.alert = \"Success: Account has been updated!\"\n redirect_to edit_user_registration_path\n end\n end", "def attempt_set_password(params)\n update_attributes(password: params[:password], password_confirmation: params[:password_confirmation])\n end", "def update_password(new_password)\n updated_data = Login.load_data.each do |user|\n user['password'] = new_password if user['id'] == Login.user.uid.to_s\n end\n File.open(Login.userdata, 'w') do |f|\n f.puts JSON.pretty_generate(updated_data)\n end\n end", "def update_with_password(params={})\n current_password = params.delete(:current_password)\n check_password = true\n if params[:password].blank?\n params.delete(:password)\n if params[:password_confirmation].blank?\n params.delete(:password_confirmation)\n check_password = false\n end \n end\n result = if valid_password?(current_password) || !check_password\n update_attributes(params)\n else\n self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)\n self.attributes = params\n false\n end\n clean_up_passwords\n result\n end", "def change_password\n puts \"Starting password change...\"\n puts params.inspect\n if current_user.authenticate(params[:password][:original_password])\n if params[:password][:password] === params[:password][:password_confirmation]\n @user = User.find_by_id(current_user.id)\n @user.password = params[:password][:password]\n @user.password_confirmation = params[:password][:password_confirmation]\n if @user.save\n render status: 200, json: { message: 'Password successfully updated.' }\n else\n render status: 500, json: { message: 'ERROR: New password could not be saved.' }\n end\n else\n render status: 403, json: { message: 'Password and confirmation passwords do not match.' }\n end\n else\n render status: 403, json: { message: 'Your original password seems to be incorrect. Please try again.' }\n end\n end", "def update_account\n\n @user = User.find(current_user.id)\n\n successfully_updated = @user.update_with_password(user_params)\n\n if successfully_updated\n set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n bypass_sign_in @user\n redirect_to user_path(@user.username)\n else\n render \"edit_account\"\n end\n\n end", "def update_password\n @teacher = current_teacher\n\n # case 1 - verify current password\n my_params = password_params\n if (! @teacher.authenticate( my_params[:current_password]))\n flash[:danger] = \"Incorrect password entered\"\n redirect_to password_path\n\n # case 2 - new password and confirmation must match\n elsif my_params[:password] != my_params[:password_confirmation]\n flash[:danger] = \"New password and confirmation don't match\"\n redirect_to password_path\n\n # case 3 - update new password, error if this fails\n else\n @teacher.password = my_params[:password]\n if @teacher.save\n flash[ :success] = \"Password change successful\"\n redirect_to profile_path\n else\n render 'password' # saving new password failed\n end\n end\n end", "def update\n respond_to do |format|\n if @password.update(password_params)\n format.html { redirect_to @password, notice: 'Password was successfully updated.' }\n format.json { render :show, status: :ok, location: @password }\n else\n format.html { render :edit }\n format.json { render json: @password.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_password_for_user\n if (@user = find_user(params[:id]))\n do_change_password_for(@user)\n flash[:notice] = \"Password for user '#{@user.login}' has been updated.\"\n end\n redirect_back_or_default :action => 'list'\n end", "def change_password\n #check if user is new or being updated\n if self.encrypted_password.present?\n #verifies password\n if self.password_check\n self.encrypt_password\n else\n raise \"error\"\n end\n else\n raise \"error\"\n end\n end", "def update_password\n @user = User.where(\"reset_password_code = '#{params[:id]}'\").first\n if @user and @user.update_attributes(:password => params[:password], :password_confirmation => params[:password_confirmation])\n flash[:notice] = \"Password has been changed successfully. Please login\"\n redirect_to login_path\n else\n render :action => \"reset_password\"\n end\n end", "def update_staffs_password(password, password_confirmation)\n self.update_attributes(password: password, password_confirmation: password_confirmation)\n end", "def update_password(passwd = @password)\n validate_before_update\n\n return false if self.errors.any?\n\n cursor = parse \"BEGIN msf.manage_accounts.reset_password_with_answer(:i_username, :i_answer, :i_new_password, :o_status); end;\"\n cursor.bind_param ':i_username', self.username\n cursor.bind_param ':i_answer', @answer, String, 256\n cursor.bind_param ':i_new_password', passwd, String, 32\n exec cursor do\n case cursor[':o_status']\n when 'DONE' : true\n when 'NOT FOUND' : false\n when 'ERROR'\n self.errors.add_to_base 'An error prevented us from resetting your password'\n false\n when 'SAME PASSWORD'\n self.errors.add :password, \"can't be the same as your existing password\"\n false\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if User.authenticate(@user.name, params[:current_password])\n if @user.update_attributes(params[:user]) \n flash[:notice] = \"You have changed your password.\"\n redirect_to :controller => 'admin'\n else \n flash[:notice] = \"There was a problem, please try again.\"\n render :action => :edit\n end\n else\n flash[:notice] = \"You did not enter your current password correctly.\"\n render :action => :edit\n end \n end", "def change_password\n set_breadcrumbs(\"change_password\") \n if request.post? || request.patch? \n admin = Admin.find(current_admin.id)\n @check = params[:admin][:password] == params[:admin][:password_confirmation] && params[:admin][:password].present? && params[:admin][:password_confirmation].present?\n if admin.present? && admin.valid_password?(params[:admin][:old_password])\n if @check \n if admin.update_attribute(:password, params[:admin][:password])\n sign_in admin, :bypass => true\n flash[:notice] = I18n.t('change_password.update.success')\n redirect_to admin_root_path\n else\n flash[:error] = I18n.t('common.error') \n end\n else\n flash[:error] = I18n.t('change_password.failure.password_is_not_match')\n end\n else\n flash[:error] = I18n.t('change_password.failure.invalid_old_password')\n end\n end\n end", "def update_with_password(params, *options)\n\t\tif encrypted_password.blank?\n\t\t\tupdate_attributes(params, *options)\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend", "def update_password(user_id:, password:)\n path = '/users/{userId}/password'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if password.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"password\"')\n end\n\n params = {\n password: password,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def password\n \n if request.post?\n begin\n @user = User.find(User.current_user.id)\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n if @user.save\n # Send confirmation email here\n update_session\n flash[:notice], flash[:class] = \"Password changed successfully\", \"good\"\n redirect_to :controller => \"account\", :action => \"index\" and return\n else\n raise \"Sorry, your password couldn't be changed.\"\n end\n rescue Exception => e\n flash.now[:notice], flash.now[:class] = \"#{e}<br /><small>#{@user.errors.full_messages.join(\"<br />\")}</small>\", \"bad\"\n #redirect_to :controller => \"account\", :action => \"password\" and return\n end\n end\n\n end", "def change_password!(password_attributes)\n unless skip_current_password\n self.current_password = password_attributes[:current_password]\n authenticated = validate_current_password\n else\n authenticated = true\n end\n self.skip_current_password = true\n assign_attributes(password_attributes)\n validated = authenticated && valid?\n self.skip_current_password = nil\n if validated\n update_attribute(:password, password_attributes[:password])\n else\n false\n end\n end", "def update_password(user_id, password)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'userId', user_id)\n\t\t\tclient.add_param(kparams, 'password', password)\n\t\t\tclient.queue_service_action_call('ottuser', 'updatePassword', '', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "def update_password password, password_confirmation, old_password\n if crypted_password.blank?\n self.password, self.password_confirmation = password, password_confirmation\n elsif authenticated_by_password? old_password\n self.password, self.password_confirmation = password, password_confirmation\n true\n else\n errors.add :base, t(:invalid_old_password)\n false\n end\n end", "def update_with_password(params = {})\n if has_facebook_profile?\n params.delete(:current_password)\n update_without_password(params)\n else\n super\n end\n end", "def update\n @user = current_user\n user = current_user\n if (params[:user][:current_password].present? && params[:user][:password].present?)\n user = false if(! User.authenticate(current_user.login, params[:user][:current_password]))\n end\n if(user && user.update_attributes(user_params))\n redirect_to root_url, :notice => \"Your credentials have been updated.\"\n else\n # @user = current_user\n flash.now[:error] = \"Incorrect Current Password\" unless user\n @title=\"Email Password\"\n @header=\"<h1>Email Password</h1><em>Enter your email address to have a new password sent to you.</em>\"\n render \"edit\"\n #redirect_to :edit, :flash => { :error => \"Error! Login and Email NOT Changed.\"}\n end\n end", "def password=(new_password)\n if validate_password(new_password)\n @password = new_password\n end\n end", "def update_with_password(params = {})\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n update(params)\n end", "def update\n if user_params[:password].blank?\n user_params.delete(:password)\n user_params.delete(:password_confirmation)\n end\n\n if needs_password?(current_user, user_params)\n save = current_user.update(user_params)\n else\n save = current_user.update_without_password(user_params)\n end\n\n respond_to do |format|\n if save\n format.html { redirect_to current_user.url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end" ]
[ "0.8609968", "0.835052", "0.82832676", "0.8243227", "0.8206766", "0.82027483", "0.8143924", "0.81153727", "0.8032305", "0.80255777", "0.79965085", "0.79620785", "0.7953362", "0.79267395", "0.79267395", "0.78944284", "0.7860386", "0.7860186", "0.78431106", "0.783977", "0.7835156", "0.7787679", "0.77732974", "0.7766182", "0.7711552", "0.7702364", "0.7701944", "0.7697957", "0.7685497", "0.7677536", "0.7664689", "0.76501673", "0.76495486", "0.7642822", "0.76216644", "0.76176035", "0.7605696", "0.760397", "0.76004714", "0.7584517", "0.75821793", "0.7570248", "0.7561601", "0.7557055", "0.75484043", "0.75468975", "0.7536178", "0.75321454", "0.75320625", "0.7528826", "0.752797", "0.75266534", "0.7519992", "0.75187826", "0.75105405", "0.7505089", "0.7504181", "0.74970216", "0.74885476", "0.74872154", "0.74794805", "0.7468185", "0.7455157", "0.7428228", "0.742706", "0.7418659", "0.7415158", "0.740791", "0.73864794", "0.7379844", "0.73760474", "0.73757935", "0.73688895", "0.73674977", "0.7366584", "0.73660314", "0.73621976", "0.7361438", "0.7340233", "0.73397595", "0.7339246", "0.73384297", "0.7338154", "0.7337318", "0.73350936", "0.73303396", "0.7323242", "0.73217183", "0.73214793", "0.7321154", "0.73117596", "0.73007405", "0.72962135", "0.7295184", "0.7282789", "0.7278208", "0.7267899", "0.7267215", "0.7266264", "0.7264585" ]
0.7828948
21